This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Add llvm.amdgcn.cs.chain intrinsic to IR & verifier
ClosedPublic

Authored by rovka on Jun 2 2023, 6:40 AM.

Details

Summary

We only check a subset of the constraints in the verifier:

  • that we only call the intrinsic from functions with a restricted set of calling conventions
  • that the 'flags' argument is an immediate

Other checks are (probably) more appropriate for codegen.

Diff Detail

Event Timeline

rovka created this revision.Jun 2 2023, 6:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 2 2023, 6:40 AM
rovka requested review of this revision.Jun 2 2023, 6:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 2 2023, 6:40 AM
Herald added a subscriber: wdng. · View Herald Transcript
arsenm added a subscriber: arsenm.Jun 2 2023, 12:16 PM
arsenm added inline comments.
llvm/include/llvm/IR/IntrinsicsAMDGPU.td
1862

Should probably use llvm_anyptr_ty

1872

Should it be convergent, or leave that to callsites to set?

Looks good to me apart from the comments.

llvm/include/llvm/IR/IntrinsicsAMDGPU.td
1862

The distinction being about the address space? Yeah, that sounds reasonable.

1872

Yeah, I think it should be convergent.

ruiling added inline comments.Jun 6 2023, 12:52 AM
llvm/test/Verifier/AMDGPU/intrinsic-amdgpu-cs-chain.ll
11

A minor suggestion: as cs.chain is marked as NoRet, it may be more proper to use unreachable here instead of ret.

arsenm added inline comments.Jun 6 2023, 5:35 AM
llvm/test/Verifier/AMDGPU/intrinsic-amdgpu-cs-chain.ll
47

Since you documented you aren't allowed to call these, check a callsite with the chain calling convention is rejected

rovka updated this revision to Diff 529251.Jun 7 2023, 4:39 AM

Address review comments.

rovka marked 5 inline comments as done.Jun 7 2023, 4:41 AM
rovka added inline comments.
llvm/test/Verifier/AMDGPU/intrinsic-amdgpu-cs-chain.ll
47

There are tests for that at the very end of https://reviews.llvm.org/D151994
Or did you have something else in mind?

nhaehnle accepted this revision.Jun 21 2023, 2:44 AM
This revision is now accepted and ready to land.Jun 21 2023, 2:44 AM
This revision was landed with ongoing or failed builds.Jun 22 2023, 1:39 AM
This revision was automatically updated to reflect the committed changes.