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