This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Intrinsic to expose s_wait_event for export ready
ClosedPublic

Authored by dstuttard on Nov 17 2022, 7:51 AM.

Details

Diff Detail

Event Timeline

dstuttard created this revision.Nov 17 2022, 7:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 17 2022, 7:51 AM
dstuttard requested review of this revision.Nov 17 2022, 7:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 17 2022, 7:51 AM
foad added a reviewer: Restricted Project.Nov 17 2022, 8:00 AM
foad added inline comments.
llvm/include/llvm/IR/IntrinsicsAMDGPU.td
2070

Should this be int_amdgcn_s_wait_event_export_ready? I'm not sure how consistent we are about including the "s" or "v" prefix in intrinsic names.

llvm/lib/Target/AMDGPU/SIISelLowering.cpp
8375 ↗(On Diff #476134)

Why do you need this? Can't you do it with a tablegen selection pattern?

llvm/test/CodeGen/AMDGPU/llvm.amdgcn.wait.event.ll
1 ↗(On Diff #476134)

Should test globalisel as well.

dstuttard added inline comments.Nov 17 2022, 8:51 AM
llvm/include/llvm/IR/IntrinsicsAMDGPU.td
2070

I'm in two minds about this since the intrinsic doesn't strictly map to the instruction. I think I slightly prefer this one.

llvm/lib/Target/AMDGPU/SIISelLowering.cpp
8375 ↗(On Diff #476134)

Yes, I'll update it. There are potentially some complexities that may have to be handled in a later patch, but I think they can also be handled in tablegen too.

llvm/test/CodeGen/AMDGPU/llvm.amdgcn.wait.event.ll
1 ↗(On Diff #476134)

Yes, will do.

dstuttard updated this revision to Diff 476149.Nov 17 2022, 8:53 AM

Updating based on review comments

arsenm added inline comments.Nov 17 2022, 8:59 AM
llvm/include/llvm/IR/IntrinsicsAMDGPU.td
2071

Why is the immediate missing from the intrinsic? Should this also have the ClangBuiltin name declared here?

llvm/test/CodeGen/AMDGPU/llvm.amdgcn.wait.event.ll
1 ↗(On Diff #476149)

Should use an explicit -global-isel=0

9 ↗(On Diff #476149)

All the other scalar intrinsics have the s in the name

dstuttard updated this revision to Diff 476826.Nov 21 2022, 1:28 AM

Address review comments

dstuttard marked 2 inline comments as done.Nov 21 2022, 1:34 AM
dstuttard added inline comments.
llvm/include/llvm/IR/IntrinsicsAMDGPU.td
2071

Added the ClangBuiltin
Updated the name to include the "s" since that's 2 people who've asked now.
The intrinsic doesn't map to s_wait_event, just to the s_wait_event export_ready - that's why it doesn't take the immediate argument.

dstuttard marked 4 inline comments as done.Nov 21 2022, 1:34 AM
Joe_Nash added inline comments.
llvm/include/llvm/IR/IntrinsicsAMDGPU.td
2071

If you are adding the clang builtin perhaps there should there be an OpenCL test.

dstuttard updated this revision to Diff 477423.Nov 23 2022, 2:05 AM

Updated - adding test for builtin

Herald added a project: Restricted Project. · View Herald TranscriptNov 23 2022, 2:05 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
dstuttard marked an inline comment as done.Nov 23 2022, 2:06 AM
This revision is now accepted and ready to land.Nov 23 2022, 7:02 AM