================
@@ -356,6 +356,24 @@ void AMDGPUTargetCodeGenInfo::setFunctionDeclAttributes(
     if (NumVGPR != 0)
       F->addFnAttr("amdgpu-num-vgpr", llvm::utostr(NumVGPR));
   }
+
+  if (const auto *Attr = FD->getAttr<AMDGPUMaxNumWorkGroupsAttr>()) {
+    uint32_t X = Attr->getMaxNumWorkGroupsX()
+                     ->EvaluateKnownConstInt(M.getContext())
+                     .getExtValue();
+    uint32_t Y = Attr->getMaxNumWorkGroupsY()
+                     ->EvaluateKnownConstInt(M.getContext())
+                     .getExtValue();
+    uint32_t Z = Attr->getMaxNumWorkGroupsZ()
+                     ->EvaluateKnownConstInt(M.getContext())
+                     .getExtValue();
+
+    llvm::SmallString<32> AttrVal;
+    llvm::raw_svector_ostream OS(AttrVal);
+    OS << X << "," << Y << "," << Z;
----------------
arsenm wrote:

```suggestion
    OS << X << ',' << Y << ',' << Z;
```

https://github.com/llvm/llvm-project/pull/79035
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to