[clang] [llvm] [AMDGPU] Adding the amdgpu-num-work-groups function attribute (PR #79035)
Erich Keane via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 23 06:35:07 PST 2024
================
@@ -8069,6 +8069,38 @@ static void handleAMDGPUNumVGPRAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
D->addAttr(::new (S.Context) AMDGPUNumVGPRAttr(S.Context, AL, NumVGPR));
}
+static void handleAMDGPUMaxNumWorkGroupsAttr(Sema &S, Decl *D,
+ const ParsedAttr &AL) {
+ if (AL.getNumArgs() != 3) {
+ S.Diag(AL.getLoc(), diag::err_attribute_wrong_number_arguments) << AL << 3;
+ return;
+ }
+ uint32_t NumWGX = 0;
+ uint32_t NumWGY = 0;
+ uint32_t NumWGZ = 0;
+ Expr *NumWGXExpr = AL.getArgAsExpr(0);
+ Expr *NumWGYExpr = AL.getArgAsExpr(1);
+ Expr *NumWGZExpr = AL.getArgAsExpr(2);
+ if (!checkUInt32Argument(S, AL, NumWGXExpr, NumWGX, 0, true))
+ return;
+ if (!checkUInt32Argument(S, AL, NumWGYExpr, NumWGY, 1, true))
+ return;
+ if (!checkUInt32Argument(S, AL, NumWGZExpr, NumWGZ, 2, true))
+ return;
+
+ if (NumWGX == 0 || NumWGY == 0 || NumWGZ == 0) {
----------------
erichkeane wrote:
It seems that this whole function is effectively just `handleWorkGroupSize`. Can we just use that function here instead? It seems to do exactly what you want here without such awkward layout.
https://github.com/llvm/llvm-project/pull/79035
More information about the llvm-commits
mailing list