I have noticed there are currently a few discrepancies on how operations in the OpenMP dialect are named, so this RFC is mainly to seek agreement on a uniform way to do this. There’s an open PR with an initial proposal, but after receiving some comments my current proposal would instead be the following:
- Names of C++ operation classes should follow the spelling of the corresponding directive or clause. The first letter of each word would be in uppercase. Directives like
taskloop
would be expressed asTaskloopOp
, whereastarget data
would becomeTargetDataOp
. - Names used in the textual MLIR representation would match the corresponding directive or clause. In this case, spaces would be replaced by underscores, such that
taskloop
becomesomp.taskloop
andtarget data
becomesomp.target_data
. - When a single directive makes more sense to be split into multiple operations, its textual MLIR representation uses a dot to split the directive from the variant. This is the case for
atomic
, which is split intoomp.atomic.read
,omp.atomic.write
,omp.atomic.update
andomp.atomic.capture
. - Other operations that don’t directly refer to OpenMP directives or clauses should use underscores to separate each word in the textual MLIR representation. If they are expected to only ever apply to one directive or clause (i.e. they are always associated to one other operation), prefix them with its name followed by a dot.
The result of applying these rules would be the following changes:
omp::TaskLoopOp
→omp::TaskloopOp
: Point 1.omp::TaskGroupOp
→omp::TaskgroupOp
: Point 1.omp::DataBoundsOp
→omp::MapBoundsOp
: Point 4.omp::DataOp
→omp::TargetDataOp
: Point 1.omp::EnterDataOp
→omp::TargetEnterDataOp
: Point 1.omp::ExitDataOp
→omp::TargetExitDataOp
: Point 1.omp::UpdateDataOp
→omp::TargetUpdateOp
: Point 1.omp::ReductionDeclareOp
→omp::DeclareReductionOp
: Point 1.omp::WsLoopOp
→omp::WsloopOp
: For consistency, due to the lack of underscore inomp.wsloop
.omp.bounds
→omp.map.bounds
: Point 4.omp.map_info
→omp.map.info
: Point 4.omp.target_update_data
→omp.target_update
: Point 2.omp.cancellationpoint
→omp.cancellation_point
: Point 2.omp.ordered_region
→omp.ordered.region
: Point 3.omp.reduction.declare
→omp.declare_reduction
: Point 2.
The omp::SimdLoopOp
/ omp.simdloop
operation would exceptionally remain unchanged, but as part of the ongoing transition to using wrapper operations to represent composite constructs this operation would eventually become omp::SimdOp
/ omp.simd
.