Use tablegen generic tables to get the index of image intrinsic
arguments.
Before, the computation of which image intrinsic argument is at which
index was scattered in a few places, tablegen, the SDag instruction
selection and GlobalISel. This patch changes that, so only tablegen
contains code to compute indices and the ImageDimIntrinsicInfo table
provides these information.
Details
- Reviewers
arsenm foad - Commits
- rG6a089ce0e40a: [AMDGPU] Use tablegen for argument indices
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/AMDGPU/AMDGPUInstrInfo.h | ||
---|---|---|
56 | uint8_t should be enough for all of these? |
llvm/include/llvm/IR/IntrinsicsAMDGPU.td | ||
---|---|---|
694 | Would it make more sense to daisy-chain these so e.g. SampArgIndex is just !add(RSrcArgIndex, NumRSrcArgs)? |
llvm/include/llvm/IR/IntrinsicsAMDGPU.td | ||
---|---|---|
694 | I don’t care much about which variant to use. The more obvious the index of an argument gets, the better. Here are both variants for comparison: // No daisy-chaining int DmaskArgIndex = NumDataArgs; int VAddrArgIndex = !add(NumDataArgs, NumDmaskArgs); int GradientArgIndex = !add(NumDataArgs, NumDmaskArgs, NumExtraAddrArgs); int CoordArgIndex = !add(NumDataArgs, NumDmaskArgs, NumExtraAddrArgs, NumGradientArgs); int LodArgIndex = !add(NumDataArgs, NumDmaskArgs, NumVAddrArgs, -1); int MipArgIndex = LodArgIndex; int RsrcArgIndex = !add(NumDataArgs, NumDmaskArgs, NumVAddrArgs); int SampArgIndex = !add(NumDataArgs, NumDmaskArgs, NumVAddrArgs, NumRSrcArgs); int UnormArgIndex = !add(NumDataArgs, NumDmaskArgs, NumVAddrArgs, NumRSrcArgs, 1); int TexFailCtrlArgIndex = !add(NumDataArgs, NumDmaskArgs, NumVAddrArgs, NumRSrcArgs, NumSampArgs); int CachePolicyArgIndex = !add(TexFailCtrlArgIndex, 1); // Daisy-chaining int DmaskArgIndex = NumDataArgs; int VAddrArgIndex = !add(DmaskArgIndex, NumDmaskArgs); int GradientArgIndex = !add(VAddrArgIndex, NumExtraAddrArgs); int CoordArgIndex = !add(GradientArgIndex, NumGradientArgs); int LodArgIndex = !add(VAddrArgIndex, NumVAddrArgs, -1); int MipArgIndex = LodArgIndex; int RsrcArgIndex = !add(VAddrArgIndex, NumVAddrArgs); int SampArgIndex = !add(RsrcArgIndex, NumRSrcArgs); int UnormArgIndex = !add(SampArgIndex, 1); int TexFailCtrlArgIndex = !add(SampArgIndex, NumSampArgs); int CachePolicyArgIndex = !add(TexFailCtrlArgIndex, 1); |
friendly ping for review
It looks like nobody has strong opinions on whether to use daisy-chaining or not, so this should be fine to push?
llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp | ||
---|---|---|
3945 | Hi! ../lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp:3945:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] (I == Intr->GradientStart + (Intr->NumGradients / 2) - 1 || ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp:3946:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] I == Intr->GradientStart + Intr->NumGradients - 1)) || ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I suppose it's because I changed from signed to unsigned. |
Would it make more sense to daisy-chain these so e.g. SampArgIndex is just !add(RSrcArgIndex, NumRSrcArgs)?