[llvm] [AMDGPU] Sink uniform buffer address offsets into soffset (PR #169230)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 24 06:53:07 PST 2025
jayfoad wrote:
> I agree that semantically raw buffer addressing is just the sum of voffset + soffset + imm. However, we keep them separate to enable later optimizations like promoting to SMEM when everything is uniform. This makes late splitting tricky because it must preserve uniformity
No, it is simple. You can only promote to SMEM if the entire address is uniform.
> ```
> // Original
> voffset = (divergent_tid * stride) + uniform_val1;
> soffset = uniform_val2;
> // Backend knows soffset is uniform can promote to s_buffer_load if voffset == 0
> ```
Don't understand the "if voffset == 0" condition, since this example has a non-0 voffset.
> ```
> // After merging:
> merged_offset = (divergent_tid * stride) + uniform_val1 + uniform_val2;
> // Problem: merged_offset is divergent, hence cannot promote even though most is uniform.
> ```
The part that came from voffset is still non-zero and divergent, so it would be incorrect to promote to SMEM.
https://github.com/llvm/llvm-project/pull/169230
More information about the llvm-commits
mailing list