[llvm] [AMDGPU] Introduce ABI occupancy for object linking (PR #199475)
Gheorghe-Teodor Bercea via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 8 07:07:04 PDT 2026
================
@@ -224,7 +226,35 @@ AMDGPUSubtarget::getWavesPerEU(std::pair<unsigned, unsigned> FlatWorkGroupSizes,
// Requested minimum/maximum number of waves per execution unit.
std::pair<unsigned, unsigned> Requested =
AMDGPU::getIntegerPairAttribute(F, "amdgpu-waves-per-eu", Default, true);
- return getEffectiveWavesPerEU(Requested, FlatWorkGroupSizes, LDSBytes);
+ std::pair<unsigned, unsigned> WavesPerEU =
+ getEffectiveWavesPerEU(Requested, FlatWorkGroupSizes, LDSBytes);
+ if (!AMDGPUTargetMachine::EnableObjectLinking)
+ return WavesPerEU;
+
+ unsigned FunctionABIOccupancy = getFunctionABIOccupancy(F);
+ unsigned EffectiveMinWaves =
+ F.hasFnAttribute("amdgpu-waves-per-eu")
+ ? std::max(WavesPerEU.first, FunctionABIOccupancy)
+ : FunctionABIOccupancy;
+ return {EffectiveMinWaves, std::max(WavesPerEU.second, EffectiveMinWaves)};
+}
+
+unsigned AMDGPUSubtarget::getDefaultABIOccupancy(const Module &M) const {
+ unsigned Override = AMDGPU::getAMDGPUABIWavesPerEU(M);
+ if (Override)
+ Override = std::clamp(Override, getMinWavesPerEU(), getMaxWavesPerEU());
----------------
doru1004 wrote:
Could we document this override / diagnostic it if it interferes with any user requested value?
https://github.com/llvm/llvm-project/pull/199475
More information about the llvm-commits
mailing list