[llvm] [AMDGPU] Support dynamically sized allocas (PR #121148)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 26 05:07:16 PST 2024
================
@@ -1190,9 +1190,14 @@ bool AMDGPURegisterBankInfo::applyMappingDynStackAlloc(
const RegisterBank *SizeBank = getRegBank(AllocSize, MRI, *TRI);
- // TODO: Need to emit a wave reduction to get the maximum size.
- if (SizeBank != &AMDGPU::SGPRRegBank)
- return false;
+ if (SizeBank != &AMDGPU::SGPRRegBank) {
+ auto WaveReduction =
+ B.buildIntrinsic(Intrinsic::amdgcn_wave_reduce_umax,
+ {LLT::scalar(MRI.getType(AllocSize).getSizeInBits())})
----------------
arsenm wrote:
```suggestion
{MRI.getType(AllocSize)})
```
This is extra steps, but you could also just hardcode this to S32
https://github.com/llvm/llvm-project/pull/121148
More information about the llvm-commits
mailing list