[PATCH] D125060: [amdgpu][wip] Implement lds kernel id intrinsic
Jon Chesterfield via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 5 16:46:22 PDT 2022
JonChesterfield created this revision.
JonChesterfield added reviewers: arsenm, rampitec, foad, bcahoon, carlo.bertolli.
Herald added subscribers: jsilvanus, hsmhsm, okura, jdoerfert, kuter, kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
Herald added a project: All.
JonChesterfield requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added a project: LLVM.
WIP in that the tests need to be updated (and some written)
and this summary similarly updated. Posting for design feedback.
The motivation is to allocate LDS variables at different addresses in
different kernels such that only those reachable from a kernel take up
space in that kernel, while still allowing (indirect) function calls to
work out where the variable is located.
The intent is to emit a __const array of addresses and index into it. This
patch, or something equivalent, gives a way to do that lookup.
This patch introduces an intrinsic, i32 amdgcn_lds_kernel_id(). This can be
called from (indirect) functions. It lowers to the i32 kernel metadata from
whichever kernel is the root of the call graph. The implementation is a sgpr.
Testing will involve checking that the value set in !amdgcn.lds_kernel_id is
in the corresponding positions in the asm. With that working, LowerModuleLDS
can emit a table of constants, metadata on some kernels and calls to the
intrinsic to resolve addresses to the kernel at the root of the dynamic scope.
The patch is larger than anticipated. I'm hopeful that reviewers more
familiar with our backend can see ways to cut it down significantly.
Thanks!
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D125060
Files:
llvm/include/llvm/IR/IntrinsicsAMDGPU.td
llvm/lib/Target/AMDGPU/AMDGPUArgumentUsageInfo.cpp
llvm/lib/Target/AMDGPU/AMDGPUArgumentUsageInfo.h
llvm/lib/Target/AMDGPU/AMDGPUAttributes.def
llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.h
llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp
llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h
llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
llvm/lib/Target/AMDGPU/SIFrameLowering.cpp
llvm/lib/Target/AMDGPU/SIISelLowering.cpp
llvm/lib/Target/AMDGPU/SIISelLowering.h
llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h
llvm/test/CodeGen/AMDGPU/llvm.amdgcn.lds.kernel.id.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125060.427495.patch
Type: text/x-patch
Size: 21160 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220505/f86f2adc/attachment.bin>
More information about the llvm-commits
mailing list