================
@@ -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
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits