@@ -14,3 +14,30 @@ other definitions in this dialect, refer to the automatically-generated
14
14
[ ODS Documentation] ( ODS.md ) .
15
15
16
16
[ TOC]
17
+
18
+ ## Operation Naming Conventions
19
+
20
+ This section aims to standardize how dialect operation names are chosen, to
21
+ ensure a level of consistency. There are two categories of names: tablegen names
22
+ and assembly names. The former also corresponds to the C++ class that is
23
+ generated for the operation, whereas the latter is used to represent it in MLIR
24
+ text form.
25
+
26
+ Tablegen names are CamelCase, with the first letter capitalized and an "Op"
27
+ suffix, whereas assembly names are snake_case, with all lowercase letters and
28
+ words separated by underscores.
29
+
30
+ If the operation corresponds to a directive, clause or other kind of definition
31
+ in the OpenMP specification, it must use the same name split into words in the
32
+ same way. For example, the ` target data ` directive would become ` TargetDataOp ` /
33
+ ` omp.target_data ` , whereas ` taskloop ` would become ` TaskloopOp ` /
34
+ ` omp.taskloop ` .
35
+
36
+ Operations intended to carry extra information for another particular operation
37
+ or clause must be named after that other operation or clause, followed by the
38
+ name of the additional information. The assembly name must use a period to
39
+ separate both parts. For example, the operation used to define some extra
40
+ mapping information is named ` MapInfoOp ` / ` omp.map.info ` . The same rules are
41
+ followed if multiple operations are created for different variants of the same
42
+ directive, e.g. ` atomic ` becomes ` Atomic{Read,Write,Update,Capture}Op ` /
43
+ ` omp.atomic.{read,write,update,capture} ` .
0 commit comments