Skip to content

Commit 3298ae1

Browse files
committed
R2: Addressing a few review comments
1 parent d8c4505 commit 3298ae1

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

mlir/include/mlir/Dialect/OpenMP/OpenMPEnums.td

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,16 @@ def OrderModifierAttr : EnumAttr<OpenMP_Dialect, OrderModifier,
182182
// reduction_modifier enum.
183183
//===----------------------------------------------------------------------===//
184184

185-
def ReductionModifierInScan : I32EnumAttrCase<"InScan", 0>;
186-
def ReductionModifierTask : I32EnumAttrCase<"Task", 1>;
187-
def ReductionModifierDefault : I32EnumAttrCase<"Default", 2>;
185+
def ReductionModifierDefault : I32EnumAttrCase<"Default", 0>;
186+
def ReductionModifierInScan : I32EnumAttrCase<"InScan", 1>;
187+
def ReductionModifierTask : I32EnumAttrCase<"Task", 2>;
188188

189189
def ReductionModifier : OpenMP_I32EnumAttr<
190190
"ReductionModifier",
191191
"reduction modifier", [
192+
ReductionModifierDefault,
192193
ReductionModifierInScan,
193-
ReductionModifierTask,
194-
ReductionModifierDefault
194+
ReductionModifierTask
195195
]>;
196196

197197
def ReductionModifierAttr : OpenMP_EnumAttr<ReductionModifier,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1659,7 +1659,7 @@ def ScanOp : OpenMP_Op<"scan", [
16591659
let summary = "scan directive";
16601660
let description = [{
16611661
The scan directive allows to specify scan reduction. Scan directive
1662-
should be enclosed with in a parent directive along with which , a
1662+
should be enclosed with in a parent directive along with which, a
16631663
reduction clause with `InScan` modifier must be specified. Scan directive
16641664
allows to separate code blocks to input phase and scan phase in the region
16651665
enclosed by the parent.

mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,7 +2026,8 @@ void WsloopOp::build(OpBuilder &builder, OperationState &state,
20262026
/*linear_vars=*/ValueRange(), /*linear_step_vars=*/ValueRange(),
20272027
/*nowait=*/false, /*order=*/nullptr, /*order_mod=*/nullptr,
20282028
/*ordered=*/nullptr, /*private_vars=*/{}, /*private_syms=*/nullptr,
2029-
nullptr, /*reduction_vars=*/ValueRange(), /*reduction_byref=*/nullptr,
2029+
/*reduction_mod=*/nullptr, /*reduction_vars=*/ValueRange(),
2030+
/*reduction_byref=*/nullptr,
20302031
/*reduction_syms=*/nullptr, /*schedule_kind=*/nullptr,
20312032
/*schedule_chunk=*/nullptr, /*schedule_mod=*/nullptr,
20322033
/*schedule_simd=*/false);
@@ -2949,8 +2950,9 @@ LogicalResult ScanOp::verify() {
29492950
return success();
29502951
}
29512952
}
2952-
return emitError("Scan Operation should be enclosed within a parent "
2953-
"WORSKSHARING LOOP or SIMD with INSCAN reduction modifier");
2953+
return emitError("SCAN directive needs to be enclosed within a parent "
2954+
"worksharing loop construct or SIMD construct with INSCAN "
2955+
"reduction modifier");
29542956
}
29552957

29562958
#define GET_ATTRDEF_CLASSES

mlir/test/Dialect/OpenMP/invalid.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1894,7 +1894,7 @@ func.func @scan_test_2(%lb: i32, %ub: i32, %step: i32) {
18941894
%test1f32 = "test.f32"() : () -> (!llvm.ptr)
18951895
omp.taskloop reduction(Id:InScan, @add_f32 %test1f32 -> %arg1 : !llvm.ptr) {
18961896
omp.loop_nest (%i, %j) : i32 = (%lb, %ub) to (%ub, %lb) step (%step, %step) {
1897-
// expected-error @below {{Scan Operation should be enclosed within a parent WORSKSHARING LOOP or SIMD with INSCAN reduction modifier}}
1897+
// expected-error @below {{SCAN directive needs to be enclosed within a parent worksharing loop construct or SIMD construct with INSCAN reduction modifier}}
18981898
omp.scan inclusive(%test1f32 : !llvm.ptr)
18991899
omp.yield
19001900
}

0 commit comments

Comments
 (0)