[Mlir-commits] [mlir] [mlir][IR] Add builtin `TokenType` (PR #195640)
Renato Golin
llvmlistbot at llvm.org
Wed May 13 06:12:48 PDT 2026
================
@@ -1237,6 +1237,26 @@ def Builtin_RankedTensor : Builtin_Type<"RankedTensor", "tensor", [
let genVerifyDecl = 1;
}
+//===----------------------------------------------------------------------===//
+// TokenType
+//===----------------------------------------------------------------------===//
+
+def Builtin_Token : Builtin_Type<"Token", "token"> {
+ let summary = "Token type";
+ let description = [{
+ Syntax:
+
+ ```
+ token-type ::= `token`
+ ```
+
+ A use of a token SSA value is a pointer to an operation (in case of an
+ OpResult) or a pointer to a region (in case of an entry block argument).
+ A token carries no runtime data and cannot be forwarded. Tokens are
+ excluded from the `AnyType` type constraint.
----------------
rengolin wrote:
> > Or at the very least, is misleading calling these structural if there's no structural verification.
>
> I disagree with your characterization: these are structural constraints, regardless of the enforcement: this is orthogonal.
While definition and validation of constraints are technically orthogonal, the former is not very useful without the latter.
But it is hard to enforce safety when the IR forms come from a separate generator tool, like Python, IRDL, etc. where we have no control from MLIR core.
I'd treat this as core design propagation:
* We design, implement and validate in ODS, because that's the core infrastructure in MLIR.
* Other implementations must follow the same semantics/validation IF they want to coexist with ODS dialects.
* Any bug related to mis-implementation by third-parties or alternative methods should be fixed in the offending code.
https://github.com/llvm/llvm-project/pull/195640
More information about the Mlir-commits
mailing list