Skip to content

Commit 8b82fc6

Browse files
authored
[MLIR][OpenMP][Docs] Document op naming conventions (NFC) (#107233)
This patch documents op naming conventions discussed in [this RFC](https://discourse.llvm.org/t/rfc-uniformize-openmp-dialect-operation-names/77715).
1 parent 0f86cb3 commit 8b82fc6

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

mlir/docs/Dialects/OpenMPDialect/_index.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,30 @@ other definitions in this dialect, refer to the automatically-generated
1414
[ODS Documentation](ODS.md).
1515

1616
[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

Comments
 (0)