[llvm] [AMDGPU] Fix computation of waves/EU maximum (PR #140921)

Lucas Ramirez via llvm-commits llvm-commits at lists.llvm.org
Wed May 21 17:45:56 PDT 2025


================
@@ -191,17 +191,21 @@ std::pair<unsigned, unsigned> AMDGPUSubtarget::getEffectiveWavesPerEU(
       getOccupancyWithWorkGroupSizes(LDSBytes, FlatWorkGroupSizes).second};
   Default.first = std::min(Default.first, Default.second);
 
-  // Make sure requested minimum is less than requested maximum.
-  if (RequestedWavesPerEU.second &&
-      RequestedWavesPerEU.first > RequestedWavesPerEU.second)
+  // Make sure requested min is within the default range.
+  if (RequestedWavesPerEU.first < Default.first ||
+      RequestedWavesPerEU.first > Default.second)
     return Default;
 
-  // Make sure requested values do not violate subtarget's specifications and
-  // are compatible with values implied by minimum/maximum flat workgroup sizes.
-  if (RequestedWavesPerEU.first < Default.first ||
-      RequestedWavesPerEU.second > Default.second)
+  // When provided, make sure requested max is higher than min and does not
+  // violate target specification.
+  if (RequestedWavesPerEU.second &&
----------------
lucas-rami wrote:

Thanks for the clarification, thought I was imagining stuff for a minute :)

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


More information about the llvm-commits mailing list