Skip to content

Commit 61f8ab3

Browse files
authored
[mlir] [irdl] Improve IRDL documentation (#104928)
Updates some of the irdl documentation to be in line with the current state of IRDL. Also removes some trailing spaces in this documentation.
1 parent 7c06786 commit 61f8ab3

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

mlir/include/mlir/Dialect/IRDL/IR/IRDL.td

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ def IRDL_Dialect : Dialect {
3737
```mlir
3838
irdl.dialect @cmath {
3939
irdl.type @complex {
40-
%0 = irdl.is_type : f32
41-
%1 = irdl.is_type : f64
40+
%0 = irdl.is f32
41+
%1 = irdl.is f64
4242
%2 = irdl.any_of(%0, %1)
4343
irdl.parameters(%2)
4444
}
4545

4646
irdl.operation @mul {
47-
%0 = irdl.is_type : f32
48-
%1 = irdl.is_type : f64
47+
%0 = irdl.is f32
48+
%1 = irdl.is f64
4949
%2 = irdl.any_of(%0, %1)
50-
%3 = irdl.parametric_type : "cmath.complex"<%2>
50+
%3 = irdl.parametric @cmath::@complex<%2>
5151
irdl.operands(%3, %3)
5252
irdl.results(%3)
5353
}

mlir/include/mlir/Dialect/IRDL/IR/IRDLOps.td

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def IRDL_OperationOp : IRDL_Op<"operation",
182182

183183
irdl.operation @norm {
184184
%0 = irdl.any
185-
%1 = irdl.parametric @complex<%0>
185+
%1 = irdl.parametric @cmath::@complex<%0>
186186
irdl.results(%0)
187187
irdl.operands(%1)
188188
}
@@ -216,7 +216,7 @@ def IRDL_OperandsOp : IRDL_Op<"operands", [HasParent<"OperationOp">]> {
216216

217217
irdl.operation @mul {
218218
%0 = irdl.any
219-
%1 = irdl.parametric @complex<%0>
219+
%1 = irdl.parametric @cmath::@complex<%0>
220220
irdl.results(%1)
221221
irdl.operands(%1, %1)
222222
}
@@ -230,7 +230,7 @@ def IRDL_OperandsOp : IRDL_Op<"operands", [HasParent<"OperationOp">]> {
230230
```mlir
231231
irdl.operands(%0, single %1, optional %2, variadic %3)
232232
```
233-
233+
234234
Here, %0 and %1 are required single operands, %2 is an optional operand,
235235
and %3 is a variadic operand.
236236

@@ -239,7 +239,7 @@ def IRDL_OperandsOp : IRDL_Op<"operands", [HasParent<"OperationOp">]> {
239239
operands in each segment.
240240
}];
241241

242-
let arguments = (ins Variadic<IRDL_AttributeType>:$args,
242+
let arguments = (ins Variadic<IRDL_AttributeType>:$args,
243243
VariadicityArrayAttr:$variadicity);
244244
let assemblyFormat =
245245
"`` custom<ValuesWithVariadicity>($args, $variadicity) attr-dict";
@@ -262,7 +262,7 @@ def IRDL_ResultsOp : IRDL_Op<"results", [HasParent<"OperationOp">]> {
262262

263263
irdl.operation @get_values {
264264
%0 = irdl.any
265-
%1 = irdl.parametric @complex<%0>
265+
%1 = irdl.parametric @cmath::@complex<%0>
266266
irdl.results(%0, %0)
267267
irdl.operands(%1)
268268
}
@@ -276,7 +276,7 @@ def IRDL_ResultsOp : IRDL_Op<"results", [HasParent<"OperationOp">]> {
276276
```mlir
277277
irdl.results(%0, single %1, optional %2, variadic %3)
278278
```
279-
279+
280280
Here, %0 and %1 are required single results, %2 is an optional result,
281281
and %3 is a variadic result.
282282

@@ -285,7 +285,7 @@ def IRDL_ResultsOp : IRDL_Op<"results", [HasParent<"OperationOp">]> {
285285
results in each segment.
286286
}];
287287

288-
let arguments = (ins Variadic<IRDL_AttributeType>:$args,
288+
let arguments = (ins Variadic<IRDL_AttributeType>:$args,
289289
VariadicityArrayAttr:$variadicity);
290290
let assemblyFormat =
291291
" `` custom<ValuesWithVariadicity>($args, $variadicity) attr-dict";
@@ -296,7 +296,7 @@ def IRDL_AttributesOp : IRDL_Op<"attributes", [HasParent<"OperationOp">]> {
296296
let summary = "Define the attributes of an operation";
297297

298298
let description = [{
299-
`irdl.attributes` defines the attributes of the `irdl.operation` parent
299+
`irdl.attributes` defines the attributes of the `irdl.operation` parent
300300
operation definition.
301301

302302
In the following example, `irdl.attributes` defines the attributes of the
@@ -320,10 +320,10 @@ def IRDL_AttributesOp : IRDL_Op<"attributes", [HasParent<"OperationOp">]> {
320320
attribute "attr2" with value `i64`.
321321
}];
322322

323-
let arguments = (ins Variadic<IRDL_AttributeType>:$attributeValues,
323+
let arguments = (ins Variadic<IRDL_AttributeType>:$attributeValues,
324324
StrArrayAttr:$attributeValueNames);
325325
let assemblyFormat = [{
326-
custom<AttributesOp>($attributeValues, $attributeValueNames) attr-dict
326+
custom<AttributesOp>($attributeValues, $attributeValueNames) attr-dict
327327
}];
328328

329329
let hasVerifier = true;
@@ -489,7 +489,7 @@ def IRDL_BaseOp : IRDL_ConstraintOp<"base",
489489
OptionalAttr<StrAttr>:$base_name);
490490
let results = (outs IRDL_AttributeType:$output);
491491
let assemblyFormat = " ($base_ref^)? ($base_name^)? ` ` attr-dict";
492-
492+
493493
let builders = [
494494
OpBuilder<(ins "SymbolRefAttr":$base_ref), [{
495495
build($_builder, $_state, base_ref, {});
@@ -521,7 +521,7 @@ def IRDL_ParametricOp : IRDL_ConstraintOp<"parametric",
521521

522522
irdl.operation @norm {
523523
%0 = irdl.any
524-
%1 = irdl.parametric @complex<%0>
524+
%1 = irdl.parametric @cmath::@complex<%0>
525525
irdl.operands(%1)
526526
irdl.results(%0)
527527
}
@@ -574,8 +574,8 @@ def IRDL_AnyOfOp : IRDL_ConstraintOp<"any_of",
574574
Example:
575575

576576
```mlir
577-
irdl.dialect cmath {
578-
irdl.type complex {
577+
irdl.dialect @cmath {
578+
irdl.type @complex {
579579
%0 = irdl.is i32
580580
%1 = irdl.is i64
581581
%2 = irdl.is f32
@@ -607,8 +607,8 @@ def IRDL_AllOfOp : IRDL_ConstraintOp<"all_of",
607607
Example:
608608

609609
```mlir
610-
irdl.dialect cmath {
611-
irdl.type complex_f32 {
610+
irdl.dialect @cmath {
611+
irdl.type @complex_f32 {
612612
%0 = irdl.is i32
613613
%1 = irdl.is f32
614614
%2 = irdl.any_of(%0, %1) // is 32-bit

0 commit comments

Comments
 (0)