[llvm-branch-commits] [clang] [CIR] Record why the CUDA registration attribute parses itself (PR #220893)
Henrich Lauko via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Sep 3 06:53:47 PDT 2026
https://github.com/xlauko updated https://github.com/llvm/llvm-project/pull/220893
>From 6568f16d9bb7b1bc08742145b9076a4ed93feb01 Mon Sep 17 00:00:00 2001
From: Henrich Lauko <hlauko at nvidia.com>
Date: Thu, 3 Sep 2026 12:44:31 +0000
Subject: [PATCH] [CIR] Record why the CUDA registration attribute parses
itself
hasCustomAssemblyFormat with no explanation invites the question of whether a
declarative assemblyFormat would do. It would not. The three flags print as
presence-only keywords and parse in any order, while an optional group
anchored on a `bool` parameter parses and prints a value, so the group would
spell `extern true`. MLIR has no presence-only flag for `bool` in an
attribute format, unlike UnitAttr in an operation format. struct(params)
round-trips but spells the attribute
`<device_side_name = "i", kind = Variable, isExtern = true>` instead of
`<i, Variable, extern>`.
NFC.
---
clang/include/clang/CIR/Dialect/IR/CIRCUDAAttrs.td | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/clang/include/clang/CIR/Dialect/IR/CIRCUDAAttrs.td b/clang/include/clang/CIR/Dialect/IR/CIRCUDAAttrs.td
index 1684615c862b2..c159bb499e5aa 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIRCUDAAttrs.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIRCUDAAttrs.td
@@ -92,6 +92,11 @@ def CIR_CUDAVarRegistrationInfoAttr : CIR_Attr<"CUDAVarRegistrationInfo", "cu.va
"bool":$isManaged
);
+ // Not expressible as a declarative assemblyFormat. The three flags print as
+ // presence-only keywords and parse in any order, whereas an optional group
+ // anchored on a `bool` parameter parses and prints a value, so `extern`
+ // would have to spell `extern true`. struct(params) round-trips but costs
+ // the compact syntax.
let hasCustomAssemblyFormat = 1;
}
More information about the llvm-branch-commits
mailing list