This is an archive of the discontinued LLVM Phabricator instance.

New intrinsic void llvm.amdgcn.s.nop(i16)
AbandonedPublic

Authored by dstuttard on Aug 24 2023, 9:30 AM.

Details

Reviewers
arsenm
nhaehnle

Diff Detail

Event Timeline

dstuttard created this revision.Aug 24 2023, 9:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2023, 9:30 AM
dstuttard requested review of this revision.Aug 24 2023, 9:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2023, 9:30 AM

What’s the point?

What’s the point?

It can be used by a front-end to insert a delay that's less than s_sleep 1

arsenm added inline comments.Aug 30 2023, 4:15 PM
llvm/lib/Target/AMDGPU/SOPInstructions.td
1166

The regular one should be marked with side effects

dstuttard added inline comments.Aug 31 2023, 5:18 AM
llvm/lib/Target/AMDGPU/SOPInstructions.td
1166

My initial implementation did that - even though I was unsure if a nop should be tagged as having side-effects.
Also, there were failures in some of the lit tests (mir variants) which made me even more reluctant to tag s_nop as having side-effects since it would no longer be a NFC for vanilla s_nops.
I got failures (mainly (all?) out of order matches) for:

LLVM :: CodeGen/AMDGPU/copy-vgpr-clobber-spill-vgpr.mir
LLVM :: CodeGen/AMDGPU/fold-immediate-operand-shrink.mir
LLVM :: CodeGen/AMDGPU/sched-barrier-pre-RA.mir
LLVM :: CodeGen/AMDGPU/sched-group-barrier-pipeline-solver.mir
LLVM :: CodeGen/AMDGPU/sched-group-barrier-pre-RA.mir
LLVM :: CodeGen/AMDGPU/spill-empty-live-interval.mir
arsenm added inline comments.Aug 31 2023, 7:17 AM
llvm/lib/Target/AMDGPU/SOPInstructions.td
1166

First I've noticed this odd bug that it doesn't have side effects before. That should be fixed independently.

Also, pseudos that modify any real instruction should use a lowercase suffix

dstuttard updated this revision to Diff 555746.Sep 4 2023, 6:44 AM

Rename pseudo instruction (lowercase suffix)

foad added a comment.Sep 4 2023, 7:28 AM

Depending on the use case, you might also have to mark it as a scheduling barrier, not just having side effects.

Depending on the use case, you might also have to mark it as a scheduling barrier, not just having side effects.

It is possible that might be required, but the behaviour is modelled on s_sleep which only tags "hasSideEffects" and doesn't attempt to make it a scheduling barrier as well.
I propose to leave the implementation as-is and it can be re-visited if a scheduling barrier needs to be enforced.

foad added a comment.Sep 5 2023, 2:01 AM

Depending on the use case, you might also have to mark it as a scheduling barrier, not just having side effects.

It is possible that might be required, but the behaviour is modelled on s_sleep which only tags "hasSideEffects" and doesn't attempt to make it a scheduling barrier as well.
I propose to leave the implementation as-is and it can be re-visited if a scheduling barrier needs to be enforced.

That's fine with me.

@arsenm are you happy with this?

foad added inline comments.Sep 8 2023, 5:36 AM
llvm/lib/Target/AMDGPU/SOPInstructions.td
1166

The regular one should be marked with side effects

https://github.com/llvm/llvm-project/pull/65745

Rebased on @foad 's change and submitted as PR here: https://github.com/llvm/llvm-project/pull/65757

dstuttard abandoned this revision.Sep 8 2023, 8:07 AM