Skip to content

Commit c34f3fe

Browse files
committed
fix line lengths
1 parent 1931e14 commit c34f3fe

File tree

1 file changed

+57
-17
lines changed

1 file changed

+57
-17
lines changed

mlir/docs/Dialects/IRDL.md

Lines changed: 57 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44

55
## Basics
66

7-
The IRDL (*Intermediate Representation Definition Language*) dialect allows defining MLIR dialects as MLIR programs. Nested operations are used to represent dialect structure: dialects contain operations, types and attributes, themselves containing type parameters, operands, results, etc. Each of those concepts are mapped to MLIR operations in the IRDL dialect, as shown in the example dialect below:
7+
The IRDL (*Intermediate Representation Definition Language*) dialect allows
8+
defining MLIR dialects as MLIR programs. Nested operations are used to
9+
represent dialect structure: dialects contain operations, types and
10+
attributes, themselves containing type parameters, operands, results, etc.
11+
Each of those concepts are mapped to MLIR operations in the IRDL dialect, as
12+
shown in the example dialect below:
813

914
```mlir
1015
irdl.dialect @cmath {
@@ -45,18 +50,34 @@ IRDL wraps all types in an `mlir::TypeAttr` attribute.
4550

4651
The core principles of IRDL are the following, in no particular order:
4752

48-
- **Portability.** IRDL dialects should be self-contained, such that dialects can be easily distributed with minimal assumptions on which compiler infrastructure (or which commit of MLIR) is used.
49-
- **Introspection.** The IRDL dialect definition mechanism should strive towards offering as much introspection abilities as possible. Dialects should be as easy to manipulate, generate, and analyze as possible.
50-
- **Runtime declaration support**. The specification of IRDL dialects should offer the ability to have them be loaded at runtime, via dynamic registration or JIT compilation. Compatibility with dynamic workflows should not hinder the ability to compile IRDL dialects into ahead-of-time declarations.
51-
- **Reliability.** Concepts in IRDL should be consistent and predictable, with as much focus on high-level simplicity as possible. Consequently, IRDL definitions that verify should work out of the box, and those that do not verify should provide clear and understandable errors in all circumstances.
52-
53-
While IRDL simplifies IR definition, it remains an IR itself and thus does not require to be comfortably user-writeable.
53+
- **Portability.** IRDL dialects should be self-contained, such that dialects
54+
can be easily distributed with minimal assumptions on which compiler
55+
infrastructure (or which commit of MLIR) is used.
56+
- **Introspection.** The IRDL dialect definition mechanism should strive
57+
towards offering as much introspection abilities as possible. Dialects
58+
should be as easy to manipulate, generate, and analyze as possible.
59+
- **Runtime declaration support**. The specification of IRDL dialects should
60+
offer the ability to have them be loaded at runtime, via dynamic registration
61+
or JIT compilation. Compatibility with dynamic workflows should not hinder
62+
the ability to compile IRDL dialects into ahead-of-time declarations.
63+
- **Reliability.** Concepts in IRDL should be consistent and predictable, with
64+
as much focus on high-level simplicity as possible. Consequently, IRDL
65+
definitions that verify should work out of the box, and those that do not
66+
verify should provide clear and understandable errors in all circumstances.
67+
68+
While IRDL simplifies IR definition, it remains an IR itself and thus does not
69+
require to be comfortably user-writeable.
5470

5571
## Constraints and combinators
5672

57-
Attribute, type and operation verifiers are expressed in terms of constraint variables. Constraint variables are defined as the results of constraint operations (like `irdl.is` or constraint combinators).
73+
Attribute, type and operation verifiers are expressed in terms of constraint
74+
variables. Constraint variables are defined as the results of constraint
75+
operations (like `irdl.is` or constraint combinators).
5876

59-
Constraint variables act as variables: as such, matching against the same constraint variable multiple times can only succeed if the matching type or attribute is the same as the one that previously matched. In the following example:
77+
Constraint variables act as variables: as such, matching against the same
78+
constraint variable multiple times can only succeed if the matching type or
79+
attribute is the same as the one that previously matched. In the following
80+
example:
6081

6182
```mlir
6283
irdl.type @foo {
@@ -65,18 +86,37 @@ irdl.type @foo {
6586
}
6687
```
6788

68-
only types with two equal parameters will successfully match (`foo<i32, i32>` would match while `foo<i32, i64>` would fail, even though both i32 and i64 individually satisfy the `irdl.any_type` constraint). This constraint variable mechanism allows to easily express a requirement on type or attribute equality.
89+
only types with two equal parameters will successfully match (`foo<i32, i32>`
90+
would match while `foo<i32, i64>` would fail, even though both i32 and i64
91+
individually satisfy the `irdl.any_type` constraint). This constraint variable
92+
mechanism allows to easily express a requirement on type or attribute equality.
6993

70-
To declare more complex verifiers, IRDL provides constraint-combinator operations such as `irdl.any_of`, `irdl.all_of` or `irdl.parametric`. These combinators can be used to combine constraint variables into new constraint variables. Like all uses of constraint variables, their constraint variable operands enforce equality of matched types of attributes as explained in the previous paragraph.
94+
To declare more complex verifiers, IRDL provides constraint-combinator
95+
operations such as `irdl.any_of`, `irdl.all_of` or `irdl.parametric`. These
96+
combinators can be used to combine constraint variables into new constraint
97+
variables. Like all uses of constraint variables, their constraint variable
98+
operands enforce equality of matched types of attributes as explained in the
99+
previous paragraph.
71100

72101
## Motivating use cases
73102

74-
To illustrate the rationale behind IRDL, the following list describes examples of intended use cases for IRDL, in no particular order:
75-
76-
- **Fuzzer generation.** With declarative verifier definitions, it is possible to compile IRDL dialects into compiler fuzzers that generate only programs passing verifiers.
77-
- **Portable dialects between compiler infrastructures.** Some compiler infrastructures are independent from MLIR but are otherwise IR-compatible. Portable IRDL dialects allow to share the dialect definitions between MLIR and other compiler infrastructures without needing to maintain multiple potentially out-of-sync definitions.
78-
- **Dialect simplification.** Because IRDL definitions can easily be mechanically modified, it is possible to simplify the definition of dialects based on which operations are actually used, leading to smaller compilers.
79-
- **SMT analysis.** Because IRDL dialect definitions are declarative, their definition can be lowered to alternative representations like SMT, allowing analysis of the behavior of transforms taking verifiers into account.
103+
To illustrate the rationale behind IRDL, the following list describes examples
104+
of intended use cases for IRDL, in no particular order:
105+
106+
- **Fuzzer generation.** With declarative verifier definitions, it is possible
107+
to compile IRDL dialects into compiler fuzzers that generate only programs
108+
passing verifiers.
109+
- **Portable dialects between compiler infrastructures.** Some compiler
110+
infrastructures are independent from MLIR but are otherwise IR-compatible.
111+
Portable IRDL dialects allow to share the dialect definitions between MLIR
112+
and other compiler infrastructures without needing to maintain multiple
113+
potentially out-of-sync definitions.
114+
- **Dialect simplification.** Because IRDL definitions can easily be
115+
mechanically modified, it is possible to simplify the definition of dialects
116+
based on which operations are actually used, leading to smaller compilers.
117+
- **SMT analysis.** Because IRDL dialect definitions are declarative, their
118+
definition can be lowered to alternative representations like SMT, allowing
119+
analysis of the behavior of transforms taking verifiers into account.
80120

81121
## Operations
82122

0 commit comments

Comments
 (0)