[MLIR][OpenMP] Add missing clauses to OpenMP op definitions (#99507)
This patch adds the missing `OpenMP_Clause` definitions to all existing
`OpenMP_Op`s and updates their operand structure based builders to
initialize the new arguments.
The result of this change is that operation operand structures are now
based in the same list of clauses as their tablegen counterparts. This
means that all of the information needed is now in place to
automatically generate OpenMP operand structures from tablegen
defitions.
Since this change doesn't involve the introduction of actual support for
these clauses, new arguments are not initialized from values stored in
the corresponding operand structure fields but rather set to empty or
null. Those should be updated when support for these clauses on the
corresponding operation is added.
diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPClauseOperands.h b/mlir/include/mlir/Dialect/OpenMP/OpenMPClauseOperands.h
index a680a85..38e4d8f 100644
--- a/mlir/include/mlir/Dialect/OpenMP/OpenMPClauseOperands.h
+++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPClauseOperands.h
@@ -272,11 +272,10 @@
using SectionsOperands = detail::Clauses<AllocateClauseOps, NowaitClauseOps,
PrivateClauseOps, ReductionClauseOps>;
-// TODO `linear` clause.
using SimdOperands =
- detail::Clauses<AlignedClauseOps, IfClauseOps, NontemporalClauseOps,
- OrderClauseOps, PrivateClauseOps, ReductionClauseOps,
- SafelenClauseOps, SimdlenClauseOps>;
+ detail::Clauses<AlignedClauseOps, IfClauseOps, LinearClauseOps,
+ NontemporalClauseOps, OrderClauseOps, PrivateClauseOps,
+ ReductionClauseOps, SafelenClauseOps, SimdlenClauseOps>;
using SingleOperands = detail::Clauses<AllocateClauseOps, CopyprivateClauseOps,
NowaitClauseOps, PrivateClauseOps>;
diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
index 00dadc6..16b6f62 100644
--- a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
+++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
@@ -195,10 +195,9 @@
def TeamsOp : OpenMP_Op<"teams", traits = [
AttrSizedOperandSegments, RecursiveMemoryEffects
], clauses = [
- // TODO: Complete clause list (private).
// TODO: Sort clauses alphabetically.
OpenMP_NumTeamsClause, OpenMP_IfClause, OpenMP_ThreadLimitClause,
- OpenMP_AllocateClause, OpenMP_ReductionClause
+ OpenMP_AllocateClause, OpenMP_ReductionClause, OpenMP_PrivateClause
], singleRegion = true> {
let summary = "teams construct";
let description = [{
@@ -238,9 +237,9 @@
def SectionsOp : OpenMP_Op<"sections", traits = [
AttrSizedOperandSegments
], clauses = [
- // TODO: Complete clause list (private).
// TODO: Sort clauses alphabetically.
- OpenMP_ReductionClause, OpenMP_AllocateClause, OpenMP_NowaitClause
+ OpenMP_ReductionClause, OpenMP_AllocateClause, OpenMP_NowaitClause,
+ OpenMP_PrivateClause
], singleRegion = true> {
let summary = "sections construct";
let description = [{
@@ -271,8 +270,8 @@
def SingleOp : OpenMP_Op<"single", traits = [
AttrSizedOperandSegments
], clauses = [
- // TODO: Complete clause list (private).
- OpenMP_AllocateClause, OpenMP_CopyprivateClause, OpenMP_NowaitClause
+ OpenMP_AllocateClause, OpenMP_CopyprivateClause, OpenMP_NowaitClause,
+ OpenMP_PrivateClause
], singleRegion = true> {
let summary = "single directive";
let description = [{
@@ -363,14 +362,15 @@
AttrSizedOperandSegments, DeclareOpInterfaceMethods<LoopWrapperInterface>,
RecursiveMemoryEffects, SingleBlock
], clauses = [
- // TODO: Complete clause list (allocate, private).
// TODO: Sort clauses alphabetically.
OpenMP_LinearClauseSkip<assemblyFormat = true>,
OpenMP_ReductionClauseSkip<assemblyFormat = true>,
OpenMP_ScheduleClauseSkip<assemblyFormat = true>,
OpenMP_NowaitClauseSkip<assemblyFormat = true>,
OpenMP_OrderedClauseSkip<assemblyFormat = true>,
- OpenMP_OrderClauseSkip<assemblyFormat = true>
+ OpenMP_OrderClauseSkip<assemblyFormat = true>,
+ OpenMP_AllocateClauseSkip<assemblyFormat = true>,
+ OpenMP_PrivateClauseSkip<assemblyFormat = true>
], singleRegion = true> {
let summary = "worksharing-loop construct";
let description = [{
@@ -417,6 +417,13 @@
|`nowait` $nowait
|`ordered` `(` $ordered `)`
|`order` `(` custom<OrderClause>($order, $order_mod) `)`
+ |`allocate` `(`
+ custom<AllocateAndAllocator>(
+ $allocate_vars, type($allocate_vars), $allocator_vars,
+ type($allocator_vars)) `)`
+ |`private` `(`
+ custom<PrivateList>(
+ $private_vars, type($private_vars), $private_syms) `)`
) custom<Wsloop>($region, $reduction_vars, type($reduction_vars),
$reduction_byref, $reduction_syms) attr-dict
}];
@@ -432,9 +439,9 @@
AttrSizedOperandSegments, DeclareOpInterfaceMethods<LoopWrapperInterface>,
RecursiveMemoryEffects, SingleBlock
], clauses = [
- // TODO: Complete clause list (linear, private, reduction).
- OpenMP_AlignedClause, OpenMP_IfClause, OpenMP_NontemporalClause,
- OpenMP_OrderClause, OpenMP_SafelenClause, OpenMP_SimdlenClause
+ OpenMP_AlignedClause, OpenMP_IfClause, OpenMP_LinearClause,
+ OpenMP_NontemporalClause, OpenMP_OrderClause, OpenMP_PrivateClause,
+ OpenMP_ReductionClause, OpenMP_SafelenClause, OpenMP_SimdlenClause
], singleRegion = true> {
let summary = "simd construct";
let description = [{
@@ -499,9 +506,9 @@
AttrSizedOperandSegments, DeclareOpInterfaceMethods<LoopWrapperInterface>,
RecursiveMemoryEffects, SingleBlock
], clauses = [
- // TODO: Complete clause list (private).
// TODO: Sort clauses alphabetically.
- OpenMP_DistScheduleClause, OpenMP_AllocateClause, OpenMP_OrderClause
+ OpenMP_DistScheduleClause, OpenMP_AllocateClause, OpenMP_OrderClause,
+ OpenMP_PrivateClause
], singleRegion = true> {
let summary = "distribute construct";
let description = [{
@@ -552,11 +559,12 @@
AttrSizedOperandSegments, AutomaticAllocationScope,
OutlineableOpenMPOpInterface
], clauses = [
- // TODO: Complete clause list (affinity, detach, private).
+ // TODO: Complete clause list (affinity, detach).
// TODO: Sort clauses alphabetically.
OpenMP_IfClause, OpenMP_FinalClause, OpenMP_UntiedClause,
OpenMP_MergeableClause, OpenMP_InReductionClause,
- OpenMP_PriorityClause, OpenMP_DependClause, OpenMP_AllocateClause
+ OpenMP_PriorityClause, OpenMP_DependClause, OpenMP_AllocateClause,
+ OpenMP_PrivateClause
], singleRegion = true> {
let summary = "task construct";
let description = [{
@@ -589,14 +597,13 @@
DeclareOpInterfaceMethods<LoopWrapperInterface>, RecursiveMemoryEffects,
SingleBlock
], clauses = [
- // TODO: Complete clause list (private).
// TODO: Sort clauses alphabetically.
OpenMP_IfClause, OpenMP_FinalClause, OpenMP_UntiedClause,
OpenMP_MergeableClause,
OpenMP_InReductionClauseSkip<extraClassDeclaration = true>,
OpenMP_ReductionClauseSkip<extraClassDeclaration = true>,
OpenMP_PriorityClause, OpenMP_AllocateClause, OpenMP_GrainsizeClause,
- OpenMP_NumTasksClause, OpenMP_NogroupClause
+ OpenMP_NumTasksClause, OpenMP_NogroupClause, OpenMP_PrivateClause
], singleRegion = true> {
let summary = "taskloop construct";
let description = [{
@@ -1076,12 +1083,12 @@
def TargetOp : OpenMP_Op<"target", traits = [
AttrSizedOperandSegments, IsolatedFromAbove, OutlineableOpenMPOpInterface
], clauses = [
- // TODO: Complete clause list (allocate, defaultmap, in_reduction,
- // uses_allocators).
+ // TODO: Complete clause list (defaultmap, uses_allocators).
// TODO: Sort clauses alphabetically.
OpenMP_IfClause, OpenMP_DeviceClause, OpenMP_ThreadLimitClause,
OpenMP_DependClause, OpenMP_NowaitClause, OpenMP_IsDevicePtrClause,
- OpenMP_HasDeviceAddrClause, OpenMP_MapClause, OpenMP_PrivateClause
+ OpenMP_HasDeviceAddrClause, OpenMP_MapClause, OpenMP_PrivateClause,
+ OpenMP_AllocateClause, OpenMP_InReductionClause
], singleRegion = true> {
let summary = "target construct";
let description = [{
@@ -1207,7 +1214,7 @@
//===----------------------------------------------------------------------===//
def TaskwaitOp : OpenMP_Op<"taskwait", clauses = [
- // TODO: Complete clause list (depend, nowait).
+ OpenMP_DependClause, OpenMP_NowaitClause
]> {
let summary = "taskwait construct";
let description = [{
@@ -1218,9 +1225,6 @@
let builders = [
OpBuilder<(ins CArg<"const TaskwaitOperands &">:$clauses)>
];
-
- // TODO: Remove overriden `assemblyFormat` once a clause is added.
- let assemblyFormat = "attr-dict";
}
//===----------------------------------------------------------------------===//
diff --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
index 84de63b..51e9dbe 100644
--- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
+++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
@@ -1451,13 +1451,15 @@
const TargetOperands &clauses) {
MLIRContext *ctx = builder.getContext();
// TODO Store clauses in op: allocateVars, allocatorVars, inReductionVars,
- // inReduceVarByRef, inReductionDeclSymbols, reductionVars, reduceVarByRef,
- // reductionDeclSymbols.
+ // inReductionByref, inReductionSyms.
TargetOp::build(builder, state, clauses.ifVar, clauses.device,
clauses.threadLimit, makeArrayAttr(ctx, clauses.dependKinds),
clauses.dependVars, clauses.nowait, clauses.isDevicePtrVars,
clauses.hasDeviceAddrVars, clauses.mapVars,
- clauses.privateVars, makeArrayAttr(ctx, clauses.privateSyms));
+ clauses.privateVars, makeArrayAttr(ctx, clauses.privateSyms),
+ /*allocate_vars=*/{}, /*allocator_vars=*/{},
+ /*in_reduction_vars=*/{}, /*in_reduction_byref=*/nullptr,
+ /*in_reduction_syms=*/nullptr);
}
LogicalResult TargetOp::verify() {
@@ -1584,7 +1586,8 @@
clauses.ifVar, clauses.threadLimit, clauses.allocateVars,
clauses.allocatorVars, clauses.reductionVars,
makeDenseBoolArrayAttr(ctx, clauses.reductionByref),
- makeArrayAttr(ctx, clauses.reductionSyms));
+ makeArrayAttr(ctx, clauses.reductionSyms), /*private_vars=*/{},
+ /*private_syms=*/nullptr);
}
LogicalResult TeamsOp::verify() {
@@ -1630,8 +1633,8 @@
SectionsOp::build(builder, state, clauses.reductionVars,
makeDenseBoolArrayAttr(ctx, clauses.reductionByref),
makeArrayAttr(ctx, clauses.reductionSyms),
- clauses.allocateVars, clauses.allocatorVars,
- clauses.nowait);
+ clauses.allocateVars, clauses.allocatorVars, clauses.nowait,
+ /*private_vars=*/{}, /*private_syms=*/nullptr);
}
LogicalResult SectionsOp::verify() {
@@ -1664,7 +1667,8 @@
// TODO Store clauses in op: privateVars, privateSyms.
SingleOp::build(builder, state, clauses.allocateVars, clauses.allocatorVars,
clauses.copyprivateVars,
- makeArrayAttr(ctx, clauses.copyprivateSyms), clauses.nowait);
+ makeArrayAttr(ctx, clauses.copyprivateSyms), clauses.nowait,
+ /*private_vars=*/{}, /*private_syms=*/nullptr);
}
LogicalResult SingleOp::verify() {
@@ -1716,7 +1720,9 @@
/*reduction_byref=*/nullptr, /*reduction_syms=*/nullptr,
/*schedule_kind=*/nullptr, /*schedule_chunk=*/nullptr,
/*schedule_mod=*/nullptr, /*schedule_simd=*/false, /*nowait=*/false,
- /*ordered=*/nullptr, /*order=*/nullptr, /*order_mod=*/nullptr);
+ /*ordered=*/nullptr, /*order=*/nullptr, /*order_mod=*/nullptr,
+ /*allocate_vars=*/{}, /*allocator_vars=*/{}, /*private_vars=*/{},
+ /*private_syms=*/nullptr);
state.addAttributes(attributes);
}
@@ -1731,7 +1737,9 @@
makeArrayAttr(ctx, clauses.reductionSyms),
clauses.scheduleKind, clauses.scheduleChunk,
clauses.scheduleMod, clauses.scheduleSimd, clauses.nowait,
- clauses.ordered, clauses.order, clauses.orderMod);
+ clauses.ordered, clauses.order, clauses.orderMod,
+ /*allocate_vars=*/{}, /*allocator_vars=*/{},
+ /*private_vars=*/{}, /*private_syms=*/nullptr);
}
LogicalResult WsloopOp::verify() {
@@ -1756,12 +1764,15 @@
void SimdOp::build(OpBuilder &builder, OperationState &state,
const SimdOperands &clauses) {
MLIRContext *ctx = builder.getContext();
- // TODO Store clauses in op: privateVars, privateSyms, reductionVars,
- // reduceVarByRef, reductionDeclSymbols.
+ // TODO Store clauses in op: linearVars, linearStepVars, privateVars,
+ // privateSyms, reductionVars, reductionByref, reductionSyms.
SimdOp::build(builder, state, clauses.alignedVars,
makeArrayAttr(ctx, clauses.alignments), clauses.ifVar,
+ /*linear_vars=*/{}, /*linear_step_vars=*/{},
clauses.nontemporalVars, clauses.order, clauses.orderMod,
- clauses.safelen, clauses.simdlen);
+ /*private_vars=*/{}, /*private_syms=*/nullptr,
+ /*reduction_vars=*/{}, /*reduction_byref=*/nullptr,
+ /*reduction_syms=*/nullptr, clauses.safelen, clauses.simdlen);
}
LogicalResult SimdOp::verify() {
@@ -1795,7 +1806,8 @@
// TODO Store clauses in op: privateVars, privateSyms.
DistributeOp::build(builder, state, clauses.distScheduleStatic,
clauses.distScheduleChunkSize, clauses.allocateVars,
- clauses.allocatorVars, clauses.order, clauses.orderMod);
+ clauses.allocatorVars, clauses.order, clauses.orderMod,
+ /*private_vars=*/{}, /*private_syms=*/nullptr);
}
LogicalResult DistributeOp::verify() {
@@ -1927,7 +1939,8 @@
makeDenseBoolArrayAttr(ctx, clauses.inReductionByref),
makeArrayAttr(ctx, clauses.inReductionSyms), clauses.priority,
makeArrayAttr(ctx, clauses.dependKinds), clauses.dependVars,
- clauses.allocateVars, clauses.allocatorVars);
+ clauses.allocateVars, clauses.allocatorVars,
+ /*private_vars=*/{}, /*private_syms=*/nullptr);
}
LogicalResult TaskOp::verify() {
@@ -1975,7 +1988,8 @@
makeDenseBoolArrayAttr(ctx, clauses.reductionByref),
makeArrayAttr(ctx, clauses.reductionSyms), clauses.priority,
clauses.allocateVars, clauses.allocatorVars,
- clauses.grainsize, clauses.numTasks, clauses.nogroup);
+ clauses.grainsize, clauses.numTasks, clauses.nogroup,
+ /*private_vars=*/{}, /*private_syms=*/nullptr);
}
SmallVector<Value> TaskloopOp::getAllReductionVars() {
@@ -2225,8 +2239,9 @@
void TaskwaitOp::build(OpBuilder &builder, OperationState &state,
const TaskwaitOperands &clauses) {
- // TODO Store clauses in op: dependTypeAttrs, dependVars, nowaitAttr.
- TaskwaitOp::build(builder, state);
+ // TODO Store clauses in op: dependKinds, dependVars, nowait.
+ TaskwaitOp::build(builder, state, /*depend_kinds=*/nullptr,
+ /*depend_vars=*/{}, /*nowait=*/nullptr);
}
//===----------------------------------------------------------------------===//
diff --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
index fe3f258..ddee117 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
@@ -837,9 +837,9 @@
// TODO: Support the following clauses: private, firstprivate, lastprivate,
// allocate
if (!sectionsOp.getAllocateVars().empty() ||
- !sectionsOp.getAllocatorVars().empty())
- return emitError(sectionsOp.getLoc())
- << "allocate clause is not supported for sections construct";
+ !sectionsOp.getAllocatorVars().empty() ||
+ !sectionsOp.getPrivateVars().empty() || sectionsOp.getPrivateSyms())
+ return opInst.emitError("unhandled clauses for translation to LLVM IR");
llvm::ArrayRef<bool> isByRef = getIsByRef(sectionsOp.getReductionByref());
assert(isByRef.size() == sectionsOp.getNumReductionVars());
@@ -945,6 +945,9 @@
using InsertPointTy = llvm::OpenMPIRBuilder::InsertPointTy;
llvm::OpenMPIRBuilder::LocationDescription ompLoc(builder);
LogicalResult bodyGenStatus = success();
+ if (!singleOp.getPrivateVars().empty() || singleOp.getPrivateSyms())
+ return singleOp.emitError("unhandled clauses for translation to LLVM IR");
+
auto bodyCB = [&](InsertPointTy allocaIP, InsertPointTy codegenIP) {
builder.restoreIP(codegenIP);
convertOmpOpRegions(singleOp.getRegion(), "omp.single.region", builder,
@@ -976,7 +979,8 @@
LLVM::ModuleTranslation &moduleTranslation) {
using InsertPointTy = llvm::OpenMPIRBuilder::InsertPointTy;
LogicalResult bodyGenStatus = success();
- if (!op.getAllocatorVars().empty() || op.getReductionSyms())
+ if (!op.getAllocatorVars().empty() || op.getReductionSyms() ||
+ !op.getPrivateVars().empty() || op.getPrivateSyms())
return op.emitError("unhandled clauses for translation to LLVM IR");
auto bodyCB = [&](InsertPointTy allocaIP, InsertPointTy codegenIP) {
@@ -1043,7 +1047,8 @@
LogicalResult bodyGenStatus = success();
if (taskOp.getUntiedAttr() || taskOp.getMergeableAttr() ||
taskOp.getInReductionSyms() || taskOp.getPriority() ||
- !taskOp.getAllocateVars().empty()) {
+ !taskOp.getAllocateVars().empty() || !taskOp.getPrivateVars().empty() ||
+ taskOp.getPrivateSyms()) {
return taskOp.emitError("unhandled clauses for translation to LLVM IR");
}
auto bodyCB = [&](InsertPointTy allocaIP, InsertPointTy codegenIP) {
@@ -1091,11 +1096,28 @@
ompLoc, allocaIP, bodyCB));
return bodyGenStatus;
}
+
+static LogicalResult
+convertOmpTaskwaitOp(omp::TaskwaitOp twOp, llvm::IRBuilderBase &builder,
+ LLVM::ModuleTranslation &moduleTranslation) {
+ if (!twOp.getDependVars().empty() || twOp.getDependKinds() ||
+ twOp.getNowait())
+ return twOp.emitError("unhandled clauses for translation to LLVM IR");
+
+ moduleTranslation.getOpenMPBuilder()->createTaskwait(builder.saveIP());
+ return success();
+}
+
/// Converts an OpenMP workshare loop into LLVM IR using OpenMPIRBuilder.
static LogicalResult
convertOmpWsloop(Operation &opInst, llvm::IRBuilderBase &builder,
LLVM::ModuleTranslation &moduleTranslation) {
auto wsloopOp = cast<omp::WsloopOp>(opInst);
+ if (!wsloopOp.getAllocateVars().empty() ||
+ !wsloopOp.getAllocatorVars().empty() ||
+ !wsloopOp.getPrivateVars().empty() || wsloopOp.getPrivateSyms())
+ return opInst.emitError("unhandled clauses for translation to LLVM IR");
+
// FIXME: Here any other nested wrappers (e.g. omp.simd) are skipped, so
// codegen for composite constructs like 'DO/FOR SIMD' will be the same as for
// 'DO/FOR'.
@@ -1607,6 +1629,12 @@
auto simdOp = cast<omp::SimdOp>(opInst);
auto loopOp = cast<omp::LoopNestOp>(simdOp.getWrappedLoop());
+ if (!simdOp.getLinearVars().empty() || !simdOp.getLinearStepVars().empty() ||
+ !simdOp.getPrivateVars().empty() || simdOp.getPrivateSyms() ||
+ !simdOp.getReductionVars().empty() || simdOp.getReductionByref() ||
+ simdOp.getReductionSyms())
+ return opInst.emitError("unhandled clauses for translation to LLVM IR");
+
llvm::OpenMPIRBuilder::LocationDescription ompLoc(builder);
// Generator of the canonical loop body.
@@ -3035,6 +3063,18 @@
return false;
}
+ if (!targetOp.getAllocateVars().empty() ||
+ !targetOp.getAllocatorVars().empty()) {
+ opInst.emitError("Allocate clause not yet supported");
+ return false;
+ }
+
+ if (!targetOp.getInReductionVars().empty() ||
+ targetOp.getInReductionByref() || targetOp.getInReductionSyms()) {
+ opInst.emitError("In reduction clause not yet supported");
+ return false;
+ }
+
return true;
}
@@ -3434,10 +3474,6 @@
ompBuilder->createBarrier(builder.saveIP(), llvm::omp::OMPD_barrier);
return success();
})
- .Case([&](omp::TaskwaitOp) {
- ompBuilder->createTaskwait(builder.saveIP());
- return success();
- })
.Case([&](omp::TaskyieldOp) {
ompBuilder->createTaskyield(builder.saveIP());
return success();
@@ -3505,6 +3541,9 @@
.Case([&](omp::TaskgroupOp op) {
return convertOmpTaskgroupOp(op, builder, moduleTranslation);
})
+ .Case([&](omp::TaskwaitOp op) {
+ return convertOmpTaskwaitOp(op, builder, moduleTranslation);
+ })
.Case<omp::YieldOp, omp::TerminatorOp, omp::DeclareReductionOp,
omp::CriticalDeclareOp>([](auto op) {
// `yield` and `terminator` can be just omitted. The block structure
diff --git a/mlir/test/Dialect/OpenMP/invalid.mlir b/mlir/test/Dialect/OpenMP/invalid.mlir
index a29e34a..2854258 100644
--- a/mlir/test/Dialect/OpenMP/invalid.mlir
+++ b/mlir/test/Dialect/OpenMP/invalid.mlir
@@ -421,7 +421,7 @@
omp.yield
}
}) {alignments = [128],
- operandSegmentSizes = array<i32: 2, 0, 0>} : (memref<i32>, memref<i32>) -> ()
+ operandSegmentSizes = array<i32: 2, 0, 0, 0, 0, 0, 0>} : (memref<i32>, memref<i32>) -> ()
return
}
@@ -435,7 +435,7 @@
omp.loop_nest (%iv) : index = (%arg0) to (%arg1) step (%arg2) {
omp.yield
}
- }) {alignments = [-1, 128], operandSegmentSizes = array<i32: 2, 0, 0>} : (memref<i32>, memref<i32>) -> ()
+ }) {alignments = [-1, 128], operandSegmentSizes = array<i32: 2, 0, 0, 0, 0, 0, 0>} : (memref<i32>, memref<i32>) -> ()
return
}
@@ -463,7 +463,7 @@
omp.loop_nest (%iv) : index = (%arg0) to (%arg1) step (%arg2) {
omp.yield
}
- }) {alignments = [1.5, 128], operandSegmentSizes = array<i32: 2, 0, 0>} : (memref<i32>, memref<i32>) -> ()
+ }) {alignments = [1.5, 128], operandSegmentSizes = array<i32: 2, 0, 0, 0, 0, 0, 0>} : (memref<i32>, memref<i32>) -> ()
return
}
@@ -477,7 +477,7 @@
omp.loop_nest (%iv) : index = (%arg0) to (%arg1) step (%arg2) {
omp.yield
}
- }) {alignments = [1, 128], operandSegmentSizes = array<i32: 2, 0, 0>} : (memref<i32>, memref<i32>) -> ()
+ }) {alignments = [1, 128], operandSegmentSizes = array<i32: 2, 0, 0, 0, 0, 0, 0>} : (memref<i32>, memref<i32>) -> ()
return
}
@@ -491,7 +491,7 @@
omp.loop_nest (%iv) : index = (%arg0) to (%arg1) step (%arg2) {
omp.yield
}
- }) {operandSegmentSizes = array<i32: 0, 0, 2>} : (memref<i32>, memref<i32>) -> ()
+ }) {operandSegmentSizes = array<i32: 0, 0, 0, 0, 2, 0, 0>} : (memref<i32>, memref<i32>) -> ()
return
}
@@ -1394,7 +1394,7 @@
// expected-error @below {{expected equal sizes for allocate and allocator variables}}
"omp.teams" (%data_var) ({
omp.terminator
- }) {operandSegmentSizes = array<i32: 0,0,0,0,1,0,0>} : (memref<i32>) -> ()
+ }) {operandSegmentSizes = array<i32: 0,0,0,0,1,0,0,0>} : (memref<i32>) -> ()
omp.terminator
}
return
@@ -1407,7 +1407,7 @@
// expected-error @below {{expected num_teams upper bound to be defined if the lower bound is defined}}
"omp.teams" (%lb) ({
omp.terminator
- }) {operandSegmentSizes = array<i32: 1,0,0,0,0,0,0>} : (i32) -> ()
+ }) {operandSegmentSizes = array<i32: 1,0,0,0,0,0,0,0>} : (i32) -> ()
omp.terminator
}
return
@@ -1432,7 +1432,7 @@
// expected-error @below {{expected equal sizes for allocate and allocator variables}}
"omp.sections" (%data_var) ({
omp.terminator
- }) {operandSegmentSizes = array<i32: 0,1,0>} : (memref<i32>) -> ()
+ }) {operandSegmentSizes = array<i32: 0,1,0,0>} : (memref<i32>) -> ()
return
}
@@ -1442,7 +1442,7 @@
// expected-error @below {{expected as many reduction symbol references as reduction variables}}
"omp.sections" (%data_var) ({
omp.terminator
- }) {operandSegmentSizes = array<i32: 1,0,0>} : (memref<i32>) -> ()
+ }) {operandSegmentSizes = array<i32: 1,0,0,0>} : (memref<i32>) -> ()
return
}
@@ -1557,7 +1557,7 @@
// expected-error @below {{expected equal sizes for allocate and allocator variables}}
"omp.single" (%data_var) ({
omp.barrier
- }) {operandSegmentSizes = array<i32: 1,0,0>} : (memref<i32>) -> ()
+ }) {operandSegmentSizes = array<i32: 1,0,0,0>} : (memref<i32>) -> ()
return
}
@@ -1567,7 +1567,7 @@
// expected-error @below {{inconsistent number of copyprivate vars (= 1) and functions (= 0), both must be equal}}
"omp.single" (%data_var) ({
omp.barrier
- }) {operandSegmentSizes = array<i32: 0,0,1>} : (memref<i32>) -> ()
+ }) {operandSegmentSizes = array<i32: 0,0,1,0>} : (memref<i32>) -> ()
return
}
@@ -1623,7 +1623,7 @@
// expected-error @below {{op expected as many depend values as depend variables}}
"omp.task"(%data_var) ({
"omp.terminator"() : () -> ()
- }) {depend_kinds = [], operandSegmentSizes = array<i32: 0, 0, 0, 0, 1, 0, 0>} : (memref<i32>) -> ()
+ }) {depend_kinds = [], operandSegmentSizes = array<i32: 0, 0, 0, 0, 1, 0, 0, 0>} : (memref<i32>) -> ()
"func.return"() : () -> ()
}
@@ -1820,7 +1820,7 @@
omp.loop_nest (%i, %j) : i32 = (%lb, %ub) to (%ub, %lb) step (%step, %step) {
omp.yield
}
- }) {operandSegmentSizes = array<i32: 0, 0, 0, 0, 0, 1, 0, 0, 0>} : (memref<i32>) -> ()
+ }) {operandSegmentSizes = array<i32: 0, 0, 0, 0, 0, 1, 0, 0, 0, 0>} : (memref<i32>) -> ()
return
}
@@ -1834,7 +1834,7 @@
omp.loop_nest (%i, %j) : i32 = (%lb, %ub) to (%ub, %lb) step (%step, %step) {
omp.yield
}
- }) {operandSegmentSizes = array<i32: 0, 0, 0, 2, 0, 0, 0, 0, 0>, reduction_syms = [@add_f32]} : (!llvm.ptr, !llvm.ptr) -> ()
+ }) {operandSegmentSizes = array<i32: 0, 0, 0, 2, 0, 0, 0, 0, 0, 0>, reduction_syms = [@add_f32]} : (!llvm.ptr, !llvm.ptr) -> ()
return
}
@@ -1847,7 +1847,7 @@
omp.loop_nest (%i, %j) : i32 = (%lb, %ub) to (%ub, %lb) step (%step, %step) {
omp.yield
}
- }) {operandSegmentSizes = array<i32: 0, 0, 0, 1, 0, 0, 0, 0, 0>, reduction_syms = [@add_f32, @add_f32]} : (!llvm.ptr) -> ()
+ }) {operandSegmentSizes = array<i32: 0, 0, 0, 1, 0, 0, 0, 0, 0, 0>, reduction_syms = [@add_f32, @add_f32]} : (!llvm.ptr) -> ()
return
}
@@ -1861,7 +1861,7 @@
omp.loop_nest (%i, %j) : i32 = (%lb, %ub) to (%ub, %lb) step (%step, %step) {
omp.yield
}
- }) {in_reduction_syms = [@add_f32], operandSegmentSizes = array<i32: 0, 0, 2, 0, 0, 0, 0, 0, 0>} : (!llvm.ptr, !llvm.ptr) -> ()
+ }) {in_reduction_syms = [@add_f32], operandSegmentSizes = array<i32: 0, 0, 2, 0, 0, 0, 0, 0, 0, 0>} : (!llvm.ptr, !llvm.ptr) -> ()
return
}
@@ -1874,7 +1874,7 @@
omp.loop_nest (%i, %j) : i32 = (%lb, %ub) to (%ub, %lb) step (%step, %step) {
omp.yield
}
- }) {in_reduction_syms = [@add_f32, @add_f32], operandSegmentSizes = array<i32: 0, 0, 1, 0, 0, 0, 0, 0, 0>} : (!llvm.ptr) -> ()
+ }) {in_reduction_syms = [@add_f32, @add_f32], operandSegmentSizes = array<i32: 0, 0, 1, 0, 0, 0, 0, 0, 0, 0>} : (!llvm.ptr) -> ()
return
}
@@ -2129,7 +2129,7 @@
// expected-error @below {{op expected as many depend values as depend variables}}
"omp.target"(%data_var) ({
"omp.terminator"() : () -> ()
- }) {depend_kinds = [], operandSegmentSizes = array<i32: 0, 0, 0, 1, 0, 0, 0, 0>} : (memref<i32>) -> ()
+ }) {depend_kinds = [], operandSegmentSizes = array<i32: 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0>} : (memref<i32>) -> ()
"func.return"() : () -> ()
}
@@ -2137,7 +2137,7 @@
func.func @omp_distribute_schedule(%chunk_size : i32) -> () {
// expected-error @below {{op chunk size set without dist_schedule_static being present}}
- "omp.distribute"(%chunk_size) <{operandSegmentSizes = array<i32: 1, 0, 0>}> ({
+ "omp.distribute"(%chunk_size) <{operandSegmentSizes = array<i32: 1, 0, 0, 0>}> ({
"omp.terminator"() : () -> ()
}) : (i32) -> ()
}
@@ -2146,7 +2146,7 @@
func.func @omp_distribute_allocate(%data_var : memref<i32>) -> () {
// expected-error @below {{expected equal sizes for allocate and allocator variables}}
- "omp.distribute"(%data_var) <{operandSegmentSizes = array<i32: 0, 1, 0>}> ({
+ "omp.distribute"(%data_var) <{operandSegmentSizes = array<i32: 0, 1, 0, 0>}> ({
"omp.terminator"() : () -> ()
}) : (memref<i32>) -> ()
}
diff --git a/mlir/test/Dialect/OpenMP/ops.mlir b/mlir/test/Dialect/OpenMP/ops.mlir
index f639af9..057d54c 100644
--- a/mlir/test/Dialect/OpenMP/ops.mlir
+++ b/mlir/test/Dialect/OpenMP/ops.mlir
@@ -382,7 +382,7 @@
omp.yield
}
omp.terminator
- }) {operandSegmentSizes = array<i32: 0,0,0,0>, ordered = 1} :
+ }) {operandSegmentSizes = array<i32: 0,0,0,0,0,0,0>, ordered = 1} :
() -> ()
// CHECK: omp.wsloop linear(%{{.*}} = %{{.*}} : memref<i32>) schedule(static) {
@@ -392,7 +392,7 @@
omp.yield
}
omp.terminator
- }) {operandSegmentSizes = array<i32: 1,1,0,0>, schedule_kind = #omp<schedulekind static>} :
+ }) {operandSegmentSizes = array<i32: 1,1,0,0,0,0,0>, schedule_kind = #omp<schedulekind static>} :
(memref<i32>, i32) -> ()
// CHECK: omp.wsloop linear(%{{.*}} = %{{.*}} : memref<i32>, %{{.*}} = %{{.*}} : memref<i32>) schedule(static) {
@@ -402,7 +402,7 @@
omp.yield
}
omp.terminator
- }) {operandSegmentSizes = array<i32: 2,2,0,0>, schedule_kind = #omp<schedulekind static>} :
+ }) {operandSegmentSizes = array<i32: 2,2,0,0,0,0,0>, schedule_kind = #omp<schedulekind static>} :
(memref<i32>, memref<i32>, i32, i32) -> ()
// CHECK: omp.wsloop linear(%{{.*}} = %{{.*}} : memref<i32>) schedule(dynamic = %{{.*}}) ordered(2) {
@@ -412,7 +412,7 @@
omp.yield
}
omp.terminator
- }) {operandSegmentSizes = array<i32: 1,1,0,1>, schedule_kind = #omp<schedulekind dynamic>, ordered = 2} :
+ }) {operandSegmentSizes = array<i32: 1,1,0,1,0,0,0>, schedule_kind = #omp<schedulekind dynamic>, ordered = 2} :
(memref<i32>, i32, i32) -> ()
// CHECK: omp.wsloop schedule(auto) nowait {
@@ -422,7 +422,7 @@
omp.yield
}
omp.terminator
- }) {operandSegmentSizes = array<i32: 0,0,0,0>, nowait, schedule_kind = #omp<schedulekind auto>} :
+ }) {operandSegmentSizes = array<i32: 0,0,0,0,0,0,0>, nowait, schedule_kind = #omp<schedulekind auto>} :
() -> ()
// CHECK: omp.wsloop {
@@ -575,7 +575,7 @@
}) : (index, index, index) -> ()
"omp.terminator"() : () -> ()
}) {alignments = [32, 128],
- operandSegmentSizes = array<i32: 2, 0, 0>} : (memref<i32>, memref<i32>) -> ()
+ operandSegmentSizes = array<i32: 2, 0, 0, 0, 0, 0, 0>} : (memref<i32>, memref<i32>) -> ()
return
}
@@ -590,7 +590,7 @@
}) : (index, index, index) -> ()
"omp.terminator"() : () -> ()
}) {alignments = [32],
- operandSegmentSizes = array<i32: 1, 0, 0>} : (memref<i32>) -> ()
+ operandSegmentSizes = array<i32: 1, 0, 0, 0, 0, 0, 0>} : (memref<i32>) -> ()
return
}
@@ -605,7 +605,7 @@
"omp.yield"() : () -> ()
}) : (index, index, index) -> ()
"omp.terminator"() : () -> ()
- }) {operandSegmentSizes = array<i32: 0, 0, 2>} : (memref<i32>, memref<i64>) -> ()
+ }) {operandSegmentSizes = array<i32: 0, 0, 0, 0, 2, 0, 0>} : (memref<i32>, memref<i64>) -> ()
return
}
@@ -620,7 +620,7 @@
"omp.yield"() : () -> ()
}) : (index, index, index) -> ()
"omp.terminator"() : () -> ()
- }) {operandSegmentSizes = array<i32: 0, 0, 1>} : (memref<i32>) -> ()
+ }) {operandSegmentSizes = array<i32: 0, 0, 0, 0, 1, 0, 0>} : (memref<i32>) -> ()
return
}
@@ -809,7 +809,7 @@
"omp.target"(%if_cond, %device, %num_threads) ({
// CHECK: omp.terminator
omp.terminator
- }) {nowait, operandSegmentSizes = array<i32: 1,1,1,0,0,0,0,0>} : ( i1, si32, i32 ) -> ()
+ }) {nowait, operandSegmentSizes = array<i32: 1,1,1,0,0,0,0,0,0,0,0>} : ( i1, si32, i32 ) -> ()
// Test with optional map clause.
// CHECK: %[[MAP_A:.*]] = omp.map.info var_ptr(%[[VAL_1:.*]] : memref<?xi32>, tensor<?xi32>) map_clauses(tofrom) capture(ByRef) -> memref<?xi32> {name = ""}
@@ -1874,13 +1874,13 @@
"omp.sections" (%data_var1, %data_var1) ({
// CHECK: omp.terminator
omp.terminator
- }) {operandSegmentSizes = array<i32: 0,1,1>} : (memref<i32>, memref<i32>) -> ()
+ }) {operandSegmentSizes = array<i32: 0,1,1,0>} : (memref<i32>, memref<i32>) -> ()
// CHECK: omp.sections reduction(@add_f32 -> %{{.*}} : !llvm.ptr)
"omp.sections" (%redn_var) ({
// CHECK: omp.terminator
omp.terminator
- }) {operandSegmentSizes = array<i32: 1,0,0>, reduction_byref = array<i1: false>, reduction_syms=[@add_f32]} : (!llvm.ptr) -> ()
+ }) {operandSegmentSizes = array<i32: 1,0,0,0>, reduction_byref = array<i1: false>, reduction_syms=[@add_f32]} : (!llvm.ptr) -> ()
// CHECK: omp.sections nowait {
omp.sections nowait {
@@ -2136,7 +2136,7 @@
omp.target depend(taskdependin -> %arg0 : memref<i32>, taskdependin -> %arg1 : memref<i32>, taskdependinout -> %arg0 : memref<i32>) {
// CHECK: omp.terminator
omp.terminator
- } {operandSegmentSizes = array<i32: 0,0,0,3,0>}
+ } {operandSegmentSizes = array<i32: 0,0,0,3,0,0,0,0>}
return
}