[Mlir-commits] [mlir] 8b82fc6 - [MLIR][OpenMP][Docs] Document op naming conventions (NFC) (#107233)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Sep 16 03:25:48 PDT 2024


Author: Sergio Afonso
Date: 2024-09-16T11:25:45+01:00
New Revision: 8b82fc68a9d1b93b47eb0c3f7743ff7040fcbfd7

URL: https://github.com/llvm/llvm-project/commit/8b82fc68a9d1b93b47eb0c3f7743ff7040fcbfd7
DIFF: https://github.com/llvm/llvm-project/commit/8b82fc68a9d1b93b47eb0c3f7743ff7040fcbfd7.diff

LOG: [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).

Added: 
    

Modified: 
    mlir/docs/Dialects/OpenMPDialect/_index.md

Removed: 
    


################################################################################
diff  --git a/mlir/docs/Dialects/OpenMPDialect/_index.md b/mlir/docs/Dialects/OpenMPDialect/_index.md
index 6c9ef0abf290de..fae9549e1d6fe6 100644
--- a/mlir/docs/Dialects/OpenMPDialect/_index.md
+++ b/mlir/docs/Dialects/OpenMPDialect/_index.md
@@ -14,3 +14,30 @@ other definitions in this dialect, refer to the automatically-generated
 [ODS Documentation](ODS.md).
 
 [TOC]
+
+## Operation Naming Conventions
+
+This section aims to standardize how dialect operation names are chosen, to
+ensure a level of consistency. There are two categories of names: tablegen names
+and assembly names. The former also corresponds to the C++ class that is
+generated for the operation, whereas the latter is used to represent it in MLIR
+text form.
+
+Tablegen names are CamelCase, with the first letter capitalized and an "Op"
+suffix, whereas assembly names are snake_case, with all lowercase letters and
+words separated by underscores.
+
+If the operation corresponds to a directive, clause or other kind of definition
+in the OpenMP specification, it must use the same name split into words in the
+same way. For example, the `target data` directive would become `TargetDataOp` /
+`omp.target_data`, whereas `taskloop` would become `TaskloopOp` /
+`omp.taskloop`.
+
+Operations intended to carry extra information for another particular operation
+or clause must be named after that other operation or clause, followed by the
+name of the additional information. The assembly name must use a period to
+separate both parts. For example, the operation used to define some extra
+mapping information is named `MapInfoOp` / `omp.map.info`. The same rules are
+followed if multiple operations are created for 
diff erent variants of the same
+directive, e.g. `atomic` becomes `Atomic{Read,Write,Update,Capture}Op` /
+`omp.atomic.{read,write,update,capture}`.


        


More information about the Mlir-commits mailing list