[clang] [Clang][HIP][CUDA] Add `__cluster_dims__` and `__no_cluster__` attribute (PR #156686)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 30 12:20:07 PDT 2025


================
@@ -402,6 +405,29 @@ void AMDGPUTargetCodeGenInfo::setFunctionDeclAttributes(
 
     F->addFnAttr("amdgpu-max-num-workgroups", AttrVal.str());
   }
+
+  if (auto *Attr = FD->getAttr<CUDAClusterDimsAttr>()) {
+    uint32_t X =
----------------
erichkeane wrote:

```
auto getVal(const Expr * E) { return E->EvaluateKnownConstInt(M.getContext()).getExtValue()' };
```

Then you can just omit all X, Y, and Z (and avoid the problematic type here), and make it:

```
llvm::interleaveComma({Attr->getX(), Attr->getY(), Attr->getZ()}, OS, [&](const Expr *E){getVal(E); });

```

Instead of the comma stuff.  Perhaps a cast/etc needed to get the init list to form correctly though.

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


More information about the cfe-commits mailing list