[llvm-branch-commits] [clang] [llvm] [AMDGPU][Attributor] Rework update of `AAAMDWavesPerEU` (PR #123995)
Matt Arsenault via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Mar 24 10:09:50 PDT 2025
================
@@ -1336,6 +1311,59 @@ static void addPreloadKernArgHint(Function &F, TargetMachine &TM) {
}
}
+static void checkWavesPerEU(Module &M, TargetMachine &TM) {
+ for (Function &F : M) {
+ const GCNSubtarget &ST = TM.getSubtarget<GCNSubtarget>(F);
+
+ auto FlatWgrpSizeAttr =
+ AMDGPU::getIntegerPairAttribute(F, "amdgpu-flat-work-group-size");
+ auto WavesPerEUAttr = AMDGPU::getIntegerPairAttribute(
+ F, "amdgpu-waves-per-eu", /*OnlyFirstRequired=*/true);
+
+ unsigned MinWavesPerEU = ST.getMinWavesPerEU();
+ unsigned MaxWavesPerEU = ST.getMaxWavesPerEU();
+
+ unsigned MinFlatWgrpSize = 1U;
+ unsigned MaxFlatWgrpSize = 1024U;
+ if (FlatWgrpSizeAttr.has_value()) {
+ MinFlatWgrpSize = FlatWgrpSizeAttr->first;
+ MaxFlatWgrpSize = *(FlatWgrpSizeAttr->second);
+ }
+
+ // Start with the max range.
+ unsigned Min = MinWavesPerEU;
+ unsigned Max = MaxWavesPerEU;
+
+ // If the attribute exists, set them to the value from the attribute.
+ if (WavesPerEUAttr.has_value()) {
+ Min = WavesPerEUAttr->first;
+ if (WavesPerEUAttr->second.has_value())
+ Max = *(WavesPerEUAttr->second);
+ }
----------------
arsenm wrote:
Does this really need another variant of the parsing logic in GCNSubtarget?
https://github.com/llvm/llvm-project/pull/123995
More information about the llvm-branch-commits
mailing list