[clang] [llvm] [AMDGPU] Allow 0 as min./max. of amdgpu-waves-per-eu (PR #138284)

Lucas Ramirez via llvm-commits llvm-commits at lists.llvm.org
Wed May 7 17:03:35 PDT 2025


lucas-rami wrote:

> It doesn't add the attribute if it's 0?

Indeed I missed this, sorry.

> I don't see a reason to support this on the IR level. We should just make it a verifier error to use 0.

After further investigation and from what I can understand sema already rejects a minimum of 0 if the maximum is not 0 i.e., it will only accept amdgpu_waves_per_eu(0, 0) or amdgpu_waves_per_eu(N) or amdgpu_waves_per_eu(N, M) where N>0 and M>=N.

> Supporting 0 is only a shortcut to the default behavior without knowing the target limits in the source

I see your point. With the current way the attribute affects the range of waves/EU returned by the subtarget method a user may set the range to [1,N] to only limit the maximum number of waves/EU, so accepting 0 is indeed useless as-is. I think it only makes sense with what I intended to be the followup change to this, which I integrated here now (PR description updated to reflect the change). Hopefully letting the minimum be 0 makes more sense now.

https://github.com/llvm/llvm-project/pull/138284


More information about the llvm-commits mailing list