[llvm] [AMDGPU] Support lowering of cluster related instrinsics (PR #157978)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 11 12:13:40 PDT 2025


================
@@ -3533,6 +3533,54 @@ bool isPackedFP32Inst(unsigned Opc) {
   }
 }
 
+const std::array<unsigned, 3> &ClusterDimsAttr::getDims() const {
+  assert(isFixedDims() && "expect kind to be FixedDims");
+  return Dims;
+}
+
+std::string ClusterDimsAttr::to_string() const {
+  SmallString<10> Buffer;
+  raw_svector_ostream OS(Buffer);
+
+  switch (getKind()) {
+  case Kind::Unknown:
+    return "";
+  case Kind::NoCluster: {
+    OS << EncoNoCluster << ',' << EncoNoCluster << ',' << EncoNoCluster;
+    return Buffer.c_str();
----------------
shiltian wrote:

Why is this a mess? I just don't want to write code like `std::to_string(EncoNoCluster) + "," + std::to_string(EncoNoCluster) + "," + std::to_string(EncoNoCluster)`.

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


More information about the llvm-commits mailing list