Skip to content

Commit 1fa21a1

Browse files
committed
Address reviewer comments.
1 parent b439a72 commit 1fa21a1

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ def PrivateClauseOp : OpenMP_Op<"private", [IsolatedFromAbove, RecipeInterface]>
128128

129129
def ParallelOp : OpenMP_Op<"parallel", traits = [
130130
AttrSizedOperandSegments, AutomaticAllocationScope,
131+
DeclareOpInterfaceMethods<ComposableOpInterface>,
131132
DeclareOpInterfaceMethods<LoopWrapperInterface>,
132-
DeclareOpInterfaceMethods<ComposableLoopWrapperInterface>,
133133
DeclareOpInterfaceMethods<OutlineableOpenMPOpInterface>,
134134
RecursiveMemoryEffects
135135
], clauses = [
@@ -357,8 +357,9 @@ def LoopNestOp : OpenMP_Op<"loop_nest", traits = [
357357
//===----------------------------------------------------------------------===//
358358

359359
def WsloopOp : OpenMP_Op<"wsloop", traits = [
360-
AttrSizedOperandSegments, DeclareOpInterfaceMethods<LoopWrapperInterface>,
361-
DeclareOpInterfaceMethods<ComposableLoopWrapperInterface>,
360+
AttrSizedOperandSegments,
361+
DeclareOpInterfaceMethods<ComposableOpInterface>,
362+
DeclareOpInterfaceMethods<LoopWrapperInterface>,
362363
RecursiveMemoryEffects, SingleBlock
363364
], clauses = [
364365
OpenMP_AllocateClauseSkip<assemblyFormat = true>,
@@ -434,8 +435,9 @@ def WsloopOp : OpenMP_Op<"wsloop", traits = [
434435
//===----------------------------------------------------------------------===//
435436

436437
def SimdOp : OpenMP_Op<"simd", traits = [
437-
AttrSizedOperandSegments, DeclareOpInterfaceMethods<LoopWrapperInterface>,
438-
DeclareOpInterfaceMethods<ComposableLoopWrapperInterface>,
438+
AttrSizedOperandSegments,
439+
DeclareOpInterfaceMethods<ComposableOpInterface>,
440+
DeclareOpInterfaceMethods<LoopWrapperInterface>,
439441
RecursiveMemoryEffects, SingleBlock
440442
], clauses = [
441443
OpenMP_AlignedClause, OpenMP_IfClause, OpenMP_LinearClause,
@@ -502,8 +504,9 @@ def YieldOp : OpenMP_Op<"yield",
502504
// Distribute construct [2.9.4.1]
503505
//===----------------------------------------------------------------------===//
504506
def DistributeOp : OpenMP_Op<"distribute", traits = [
505-
AttrSizedOperandSegments, DeclareOpInterfaceMethods<LoopWrapperInterface>,
506-
DeclareOpInterfaceMethods<ComposableLoopWrapperInterface>,
507+
AttrSizedOperandSegments,
508+
DeclareOpInterfaceMethods<ComposableOpInterface>,
509+
DeclareOpInterfaceMethods<LoopWrapperInterface>,
507510
RecursiveMemoryEffects, SingleBlock
508511
], clauses = [
509512
OpenMP_AllocateClause, OpenMP_DistScheduleClause, OpenMP_OrderClause,
@@ -591,8 +594,8 @@ def TaskOp : OpenMP_Op<"task", traits = [
591594

592595
def TaskloopOp : OpenMP_Op<"taskloop", traits = [
593596
AttrSizedOperandSegments, AutomaticAllocationScope,
597+
DeclareOpInterfaceMethods<ComposableOpInterface>,
594598
DeclareOpInterfaceMethods<LoopWrapperInterface>,
595-
DeclareOpInterfaceMethods<ComposableLoopWrapperInterface>,
596599
RecursiveMemoryEffects, SingleBlock
597600
], clauses = [
598601
OpenMP_AllocateClause, OpenMP_FinalClause, OpenMP_GrainsizeClause,

mlir/include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.td

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,20 +142,19 @@ def LoopWrapperInterface : OpInterface<"LoopWrapperInterface"> {
142142
];
143143
}
144144

145-
def ComposableLoopWrapperInterface : OpInterface<"ComposableLoopWrapperInterface"> {
145+
def ComposableOpInterface : OpInterface<"ComposableOpInterface"> {
146146
let description = [{
147-
OpenMP operations that can wrap a single loop nest. When taking a wrapper
148-
role, these operations must only contain a single region with a single block
149-
in which there's a single operation and a terminator. That nested operation
150-
must be another loop wrapper or an `omp.loop_nest`.
147+
OpenMP operations that can represent a single leaf of a composite OpenMP
148+
construct.
151149
}];
152150

153151
let cppNamespace = "::mlir::omp";
154152

155153
let methods = [
156154
InterfaceMethod<
157155
/*description=*/[{
158-
Check whether the operation is composable.
156+
Check whether the operation is representing a leaf of a composite OpenMP
157+
construct.
159158
}],
160159
/*retTy=*/"bool",
161160
/*methodName=*/"isComposite",
@@ -165,12 +164,15 @@ def ComposableLoopWrapperInterface : OpInterface<"ComposableLoopWrapperInterface
165164
>,
166165
InterfaceMethod<
167166
/*description=*/[{
168-
Set the CompositeAttr for the op.
167+
Mark the operation as part of an OpenMP composite construct.
169168
}],
170169
/*retTy=*/"void",
171170
/*methodName=*/"setComposite",
172-
(ins), [{}], [{
173-
$_op->setDiscardableAttr("omp.composite", mlir::UnitAttr::get($_op->getContext()));
171+
(ins "bool":$val), [{}], [{
172+
if(val)
173+
$_op->setDiscardableAttr("omp.composite", mlir::UnitAttr::get($_op->getContext()));
174+
else
175+
$_op->removeDiscardableAttr("omp.composite");
174176
}]
175177
>
176178
];

0 commit comments

Comments
 (0)