[clang] [llvm] [AMDGPU] Adding the amdgpu-num-work-groups function attribute (PR #79035)

Erich Keane via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 12 07:09:03 PST 2024


================
@@ -356,6 +356,19 @@ void AMDGPUTargetCodeGenInfo::setFunctionDeclAttributes(
     if (NumVGPR != 0)
       F->addFnAttr("amdgpu-num-vgpr", llvm::utostr(NumVGPR));
   }
+
+  if (const auto *Attr = FD->getAttr<AMDGPUNumWorkGroupsAttr>()) {
+    uint32_t X = Attr->getNumWorkGroupsX();
+    uint32_t Y = Attr->getNumWorkGroupsY();
+    uint32_t Z = Attr->getNumWorkGroupsZ();
+
+    if (X != 0 && Y != 0 && Z != 0) {
----------------
erichkeane wrote:

Yeah, this seems like a 'bad' user interface.  If '0' means 'nothing', we should probably reject that in Sema.

https://github.com/llvm/llvm-project/pull/79035


More information about the llvm-commits mailing list