[clang] [llvm] [AMDGPU][Clang] Allow amdgpu-waves-per-eu attribute to lower target occupancy range (PR #138284)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 27 00:57:50 PDT 2025
================
@@ -2519,6 +2519,29 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, AttributeList Attrs,
CheckFailed("invalid value for 'denormal-fp-math-f32' attribute: " + S,
V);
}
+
+ if (TT.isAMDGPU()) {
+ if (auto A = Attrs.getFnAttr("amdgpu-waves-per-eu"); A.isValid()) {
+ std::pair<StringRef, StringRef> Strs = A.getValueAsString().split(',');
+ unsigned Min = 0;
+ StringRef MinStr = Strs.first.trim();
+ Check(!MinStr.getAsInteger(0, Min),
+ "minimum for 'amdgpu-waves-per-eu' must be integer: " + MinStr);
+ if (!Strs.second.empty()) {
+ unsigned Max = 0;
+ StringRef MaxStr = Strs.second.trim();
+ Check(!MaxStr.getAsInteger(0, Max),
+ "maximum for 'amdgpu-waves-per-eu' must be integer: " + MaxStr);
+ Check(Max, "maximum for 'amdgpu-waves-per-eu' must be non-zero");
+ Check(Min <= Max, "minimum must be less than or equal to maximum for "
+ "'amdgpu-waves-per-eu': " +
+ MinStr + " > " + MaxStr);
+ } else {
+ Check(Min, "minimum for 'amdgpu-waves-per-eu' must be non-zero when "
+ "maximum is not provided");
+ }
+ }
+ }
----------------
arsenm wrote:
Should do this in separate patch. We could also drop some of the error messages we emit in the backend on parse failures of these
https://github.com/llvm/llvm-project/pull/138284
More information about the llvm-commits
mailing list