diff --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp --- a/flang/lib/Lower/OpenMP.cpp +++ b/flang/lib/Lower/OpenMP.cpp @@ -143,8 +143,6 @@ if (blockDirective.v == llvm::omp::OMPD_parallel) { mlir::Value ifClauseOperand, numThreadsClauseOperand; - SmallVector privateClauseOperands, firstprivateClauseOperands, - sharedClauseOperands, copyinClauseOperands; Attribute defaultClauseOperand, procBindClauseOperand; const auto ¶llelOpClauseList = @@ -162,59 +160,17 @@ // OMPIRBuilder expects `NUM_THREAD` clause as a `Value`. numThreadsClauseOperand = fir::getBase(converter.genExprValue( *Fortran::semantics::GetExpr(numThreadsClause->v))); - } else if (const auto &privateClause = - std::get_if( - &clause.u)) { - const Fortran::parser::OmpObjectList &ompObjectList = privateClause->v; - genObjectList(ompObjectList, converter, privateClauseOperands); - } else if (const auto &firstprivateClause = - std::get_if( - &clause.u)) { - const Fortran::parser::OmpObjectList &ompObjectList = - firstprivateClause->v; - genObjectList(ompObjectList, converter, firstprivateClauseOperands); - } else if (const auto &sharedClause = - std::get_if( - &clause.u)) { - const Fortran::parser::OmpObjectList &ompObjectList = sharedClause->v; - genObjectList(ompObjectList, converter, sharedClauseOperands); - } else if (const auto ©inClause = - std::get_if( - &clause.u)) { - const Fortran::parser::OmpObjectList &ompObjectList = copyinClause->v; - genObjectList(ompObjectList, converter, copyinClauseOperands); } + // TODO: Handle private, firstprivate, shared and copyin } // Create and insert the operation. auto parallelOp = firOpBuilder.create( currentLocation, argTy, ifClauseOperand, numThreadsClauseOperand, - defaultClauseOperand.dyn_cast_or_null(), - privateClauseOperands, firstprivateClauseOperands, sharedClauseOperands, - copyinClauseOperands, ValueRange(), ValueRange(), + ValueRange(), ValueRange(), procBindClauseOperand.dyn_cast_or_null()); // Handle attribute based clauses. for (const auto &clause : parallelOpClauseList.v) { - if (const auto &defaultClause = - std::get_if(&clause.u)) { - const auto &ompDefaultClause{defaultClause->v}; - omp::ClauseDefault clause; - switch (ompDefaultClause.v) { - case Fortran::parser::OmpDefaultClause::Type::Private: - clause = omp::ClauseDefault::defprivate; - break; - case Fortran::parser::OmpDefaultClause::Type::Firstprivate: - clause = omp::ClauseDefault::deffirstprivate; - break; - case Fortran::parser::OmpDefaultClause::Type::Shared: - clause = omp::ClauseDefault::defshared; - break; - case Fortran::parser::OmpDefaultClause::Type::None: - clause = omp::ClauseDefault::defnone; - break; - } - parallelOp.default_valAttr( - omp::ClauseDefaultAttr::get(firOpBuilder.getContext(), clause)); - } + // TODO: Handle default clause if (const auto &procBindClause = std::get_if(&clause.u)) { const auto &ompProcBindClause{procBindClause->v}; diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td --- a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td +++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td @@ -63,23 +63,6 @@ // 2.6 parallel Construct //===----------------------------------------------------------------------===// -// Possible values for the default clause -def ClauseDefaultPrivate : I32EnumAttrCase<"defprivate", 0>; -def ClauseDefaultFirstPrivate : I32EnumAttrCase<"deffirstprivate", 1>; -def ClauseDefaultShared : I32EnumAttrCase<"defshared", 2>; -def ClauseDefaultNone : I32EnumAttrCase<"defnone", 3>; - -def ClauseDefault : I32EnumAttr< - "ClauseDefault", - "default clause", - [ClauseDefaultPrivate, ClauseDefaultFirstPrivate, ClauseDefaultShared, - ClauseDefaultNone]> { - let genSpecializedAttr = 0; - let cppNamespace = "::mlir::omp"; -} -def ClauseDefaultAttr : EnumAttr; - def ParallelOp : OpenMP_Op<"parallel", [AttrSizedOperandSegments, DeclareOpInterfaceMethods]> { let summary = "parallel construct"; @@ -95,14 +78,6 @@ The optional $num_threads_var parameter specifies the number of threads which should be used to execute the parallel region. - The optional $default_val attribute specifies the default data sharing attribute - of values used in the parallel region that are not passed explicitly as parameters - to the operation. - - The $private_vars, $firstprivate_vars, $shared_vars and $copyin_vars parameters - are a variadic list of values that specify the data sharing attribute of - those values. - The $allocators_vars and $allocate_vars parameters are a variadic list of values that specify the memory allocator to be used to obtain storage for private values. @@ -112,11 +87,6 @@ let arguments = (ins Optional:$if_expr_var, Optional:$num_threads_var, - OptionalAttr:$default_val, - Variadic:$private_vars, - Variadic:$firstprivate_vars, - Variadic:$shared_vars, - Variadic:$copyin_vars, Variadic:$allocate_vars, Variadic:$allocators_vars, OptionalAttr:$proc_bind_val); @@ -181,10 +151,6 @@ is executed once by one of the threads in the team in the context of its implicit task. - `private_vars`, `firstprivate_vars` and`lastprivate_vars` arguments are - variadic list of operands that specify the data sharing attributes of the - list of values. They are optional. - Reductions can be performed in a sections construct by specifying reduction accumulator variables in `reduction_vars` and symbols referring to reduction declarations in the `reductions` attribute. Each reduction is identified @@ -203,10 +169,7 @@ The `nowait` attribute, when present, signifies that there should be no implicit barrier at the end of the construct. }]; - let arguments = (ins Variadic:$private_vars, - Variadic:$firstprivate_vars, - Variadic:$lastprivate_vars, - Variadic:$reduction_vars, + let arguments = (ins Variadic:$reduction_vars, OptionalAttr:$reductions, Variadic:$allocate_vars, Variadic:$allocators_vars, @@ -246,12 +209,10 @@ } ``` - `private_vars`, `firstprivate_vars`, `lastprivate_vars` and `linear_vars` - arguments are variadic list of operands that specify the data sharing - attributes of the list of values. The `linear_step_vars` operand - additionally specifies the step for each associated linear operand. Note - that the `linear_vars` and `linear_step_vars` variadic lists should contain - the same number of elements. + The `linear_step_vars` operand additionally specifies the step for each + associated linear operand. Note that the `linear_vars` and + `linear_step_vars` variadic lists should contain the same number of + elements. Reductions can be performed in a workshare loop by specifying reduction accumulator variables in `reduction_vars` and symbols referring to reduction @@ -287,9 +248,6 @@ let arguments = (ins Variadic:$lowerBound, Variadic:$upperBound, Variadic:$step, - Variadic:$private_vars, - Variadic:$firstprivate_vars, - Variadic:$lastprivate_vars, Variadic:$linear_vars, Variadic:$linear_step_vars, Variadic:$reduction_vars, @@ -312,13 +270,12 @@ CArg<"ArrayRef", "{}">:$attributes)>, OpBuilder<(ins "TypeRange":$resultTypes, "ValueRange":$lowerBound, "ValueRange":$upperBound, "ValueRange":$step, - "ValueRange":$privateVars, "ValueRange":$firstprivateVars, - "ValueRange":$lastprivate_vars, "ValueRange":$linear_vars, - "ValueRange":$linear_step_vars, "ValueRange":$reduction_vars, - "StringAttr":$schedule_val, "Value":$schedule_chunk_var, - "IntegerAttr":$collapse_val, "UnitAttr":$nowait, - "IntegerAttr":$ordered_val, "StringAttr":$order_val, - "UnitAttr":$inclusive, CArg<"bool", "true">:$buildBody)>, + "ValueRange":$linear_vars, "ValueRange":$linear_step_vars, + "ValueRange":$reduction_vars, "StringAttr":$schedule_val, + "Value":$schedule_chunk_var, "IntegerAttr":$collapse_val, + "UnitAttr":$nowait, "IntegerAttr":$ordered_val, + "StringAttr":$order_val, "UnitAttr":$inclusive, + CArg<"bool", "true">:$buildBody)>, OpBuilder<(ins "TypeRange":$resultTypes, "ValueRange":$operands, CArg<"ArrayRef", "{}">:$attributes)> ]; @@ -403,7 +360,7 @@ The optional $nowait elliminates the implicit barrier so the parent task can make progress even if the target task is not yet completed. - TODO: private, map, is_device_ptr, firstprivate, depend, defaultmap, in_reduction + TODO: map, is_device_ptr, depend, defaultmap, in_reduction }]; diff --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp --- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp +++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp @@ -66,56 +66,11 @@ ArrayRef attributes) { ParallelOp::build( builder, state, /*if_expr_var=*/nullptr, /*num_threads_var=*/nullptr, - /*default_val=*/nullptr, /*private_vars=*/ValueRange(), - /*firstprivate_vars=*/ValueRange(), /*shared_vars=*/ValueRange(), - /*copyin_vars=*/ValueRange(), /*allocate_vars=*/ValueRange(), - /*allocators_vars=*/ValueRange(), /*proc_bind_val=*/nullptr); + /*allocate_vars=*/ValueRange(), /*allocators_vars=*/ValueRange(), + /*proc_bind_val=*/nullptr); state.addAttributes(attributes); } -//===----------------------------------------------------------------------===// -// Parser and printer for Operand and type list -//===----------------------------------------------------------------------===// - -/// Parse a list of operands with types. -/// -/// operand-and-type-list ::= `(` ssa-id-and-type-list `)` -/// ssa-id-and-type-list ::= ssa-id-and-type | -/// ssa-id-and-type `,` ssa-id-and-type-list -/// ssa-id-and-type ::= ssa-id `:` type -static ParseResult -parseOperandAndTypeList(OpAsmParser &parser, - SmallVectorImpl &operands, - SmallVectorImpl &types) { - return parser.parseCommaSeparatedList( - OpAsmParser::Delimiter::Paren, [&]() -> ParseResult { - OpAsmParser::OperandType operand; - Type type; - if (parser.parseOperand(operand) || parser.parseColonType(type)) - return failure(); - operands.push_back(operand); - types.push_back(type); - return success(); - }); -} - -/// Print an operand and type list with parentheses -static void printOperandAndTypeList(OpAsmPrinter &p, OperandRange operands) { - p << "("; - llvm::interleaveComma( - operands, p, [&](const Value &v) { p << v << " : " << v.getType(); }); - p << ") "; -} - -/// Print data variables corresponding to a data-sharing clause `name` -static void printDataVars(OpAsmPrinter &p, OperandRange operands, - StringRef name) { - if (!operands.empty()) { - p << name; - printOperandAndTypeList(p, operands); - } -} - //===----------------------------------------------------------------------===// // Parser and printer for Allocate Clause //===----------------------------------------------------------------------===// @@ -180,17 +135,9 @@ if (auto threads = num_threads_var()) p << "num_threads(" << threads << " : " << threads.getType() << ") "; - printDataVars(p, private_vars(), "private"); - printDataVars(p, firstprivate_vars(), "firstprivate"); - printDataVars(p, shared_vars(), "shared"); - printDataVars(p, copyin_vars(), "copyin"); - if (!allocate_vars().empty()) printAllocateAndAllocator(p, allocate_vars(), allocators_vars()); - if (auto def = default_val()) - p << "default(" << stringifyClauseDefault(*def).drop_front(3) << ") "; - if (auto bind = proc_bind_val()) p << "proc_bind(" << stringifyClauseProcBindKind(*bind) << ") "; @@ -542,13 +489,7 @@ numThreadsClause, deviceClause, threadLimitClause, - privateClause, - firstprivateClause, - lastprivateClause, - sharedClause, - copyinClause, allocateClause, - defaultClause, procBindClause, reductionClause, nowaitClause, @@ -660,9 +601,9 @@ // Skip the following clauses - they do not take any position in operand // segments - if (clause == defaultClause || clause == procBindClause || - clause == nowaitClause || clause == collapseClause || - clause == orderClause || clause == orderedClause) + if (clause == procBindClause || clause == nowaitClause || + clause == collapseClause || clause == orderClause || + clause == orderedClause) continue; pos[clause] = currPos++; @@ -714,31 +655,6 @@ parser.parseColonType(threadLimit.second) || parser.parseRParen()) return failure(); clauseSegments[pos[threadLimitClause]] = 1; - } else if (clauseKeyword == "private") { - if (checkAllowed(privateClause) || - parseOperandAndTypeList(parser, privates, privateTypes)) - return failure(); - clauseSegments[pos[privateClause]] = privates.size(); - } else if (clauseKeyword == "firstprivate") { - if (checkAllowed(firstprivateClause) || - parseOperandAndTypeList(parser, firstprivates, firstprivateTypes)) - return failure(); - clauseSegments[pos[firstprivateClause]] = firstprivates.size(); - } else if (clauseKeyword == "lastprivate") { - if (checkAllowed(lastprivateClause) || - parseOperandAndTypeList(parser, lastprivates, lastprivateTypes)) - return failure(); - clauseSegments[pos[lastprivateClause]] = lastprivates.size(); - } else if (clauseKeyword == "shared") { - if (checkAllowed(sharedClause) || - parseOperandAndTypeList(parser, shareds, sharedTypes)) - return failure(); - clauseSegments[pos[sharedClause]] = shareds.size(); - } else if (clauseKeyword == "copyin") { - if (checkAllowed(copyinClause) || - parseOperandAndTypeList(parser, copyins, copyinTypes)) - return failure(); - clauseSegments[pos[copyinClause]] = copyins.size(); } else if (clauseKeyword == "allocate") { if (checkAllowed(allocateClause) || parseAllocateAndAllocator(parser, allocates, allocateTypes, @@ -746,21 +662,6 @@ return failure(); clauseSegments[pos[allocateClause]] = allocates.size(); clauseSegments[pos[allocateClause] + 1] = allocators.size(); - } else if (clauseKeyword == "default") { - StringRef defval; - SMLoc loc = parser.getCurrentLocation(); - if (checkAllowed(defaultClause) || parser.parseLParen() || - parser.parseKeyword(&defval) || parser.parseRParen()) - return failure(); - // The def prefix is required for the attribute as "private" is a keyword - // in C++. - if (Optional def = - symbolizeClauseDefault(("def" + defval).str())) { - result.addAttribute("default_val", - ClauseDefaultAttr::get(parser.getContext(), *def)); - } else { - return parser.emitError(loc, "invalid default clause"); - } } else if (clauseKeyword == "proc_bind") { if (checkAllowed(procBindClause) || parseClauseAttr(parser, result, @@ -857,37 +758,6 @@ result.operands))) return failure(); - // Add private parameters. - if (done[privateClause] && clauseSegments[pos[privateClause]] && - failed(parser.resolveOperands(privates, privateTypes, - privates[0].location, result.operands))) - return failure(); - - // Add firstprivate parameters. - if (done[firstprivateClause] && clauseSegments[pos[firstprivateClause]] && - failed(parser.resolveOperands(firstprivates, firstprivateTypes, - firstprivates[0].location, - result.operands))) - return failure(); - - // Add lastprivate parameters. - if (done[lastprivateClause] && clauseSegments[pos[lastprivateClause]] && - failed(parser.resolveOperands(lastprivates, lastprivateTypes, - lastprivates[0].location, result.operands))) - return failure(); - - // Add shared parameters. - if (done[sharedClause] && clauseSegments[pos[sharedClause]] && - failed(parser.resolveOperands(shareds, sharedTypes, shareds[0].location, - result.operands))) - return failure(); - - // Add copyin parameters. - if (done[copyinClause] && clauseSegments[pos[copyinClause]] && - failed(parser.resolveOperands(copyins, copyinTypes, copyins[0].location, - result.operands))) - return failure(); - // Add allocate parameters. if (done[allocateClause] && clauseSegments[pos[allocateClause]] && failed(parser.resolveOperands(allocates, allocateTypes, @@ -971,10 +841,8 @@ /// allocate | default | proc-bind /// ParseResult ParallelOp::parse(OpAsmParser &parser, OperationState &result) { - SmallVector clauses = { - ifClause, numThreadsClause, privateClause, - firstprivateClause, sharedClause, copyinClause, - allocateClause, defaultClause, procBindClause}; + SmallVector clauses = {ifClause, numThreadsClause, allocateClause, + procBindClause}; SmallVector segments; @@ -1030,9 +898,8 @@ /// clause ::= private | firstprivate | lastprivate | reduction | allocate | /// nowait ParseResult SectionsOp::parse(OpAsmParser &parser, OperationState &result) { - SmallVector clauses = {privateClause, firstprivateClause, - lastprivateClause, reductionClause, - allocateClause, nowaitClause}; + SmallVector clauses = {reductionClause, allocateClause, + nowaitClause}; SmallVector segments; @@ -1051,9 +918,6 @@ void SectionsOp::print(OpAsmPrinter &p) { p << " "; - printDataVars(p, private_vars(), "private"); - printDataVars(p, firstprivate_vars(), "firstprivate"); - printDataVars(p, lastprivate_vars(), "lastprivate"); if (!reduction_vars().empty()) printReductionVarList(p, reductions(), reduction_vars()); @@ -1069,18 +933,6 @@ } LogicalResult SectionsOp::verify() { - // A list item may not appear in more than one clause on the same directive, - // except that it may be specified in both firstprivate and lastprivate - // clauses. - for (auto var : private_vars()) { - if (llvm::is_contained(firstprivate_vars(), var)) - return emitOpError() - << "operand used in both private and firstprivate clauses"; - if (llvm::is_contained(lastprivate_vars(), var)) - return emitOpError() - << "operand used in both private and lastprivate clauses"; - } - if (allocate_vars().size() != allocators_vars().size()) return emitError( "expected equal sizes for allocate and allocator variables"); @@ -1142,9 +994,8 @@ return failure(); SmallVector clauses = { - privateClause, firstprivateClause, lastprivateClause, linearClause, - reductionClause, collapseClause, orderClause, orderedClause, - nowaitClause, scheduleClause}; + linearClause, reductionClause, collapseClause, orderClause, + orderedClause, nowaitClause, scheduleClause}; SmallVector segments{numIVs, numIVs, numIVs}; if (failed(parseClauses(parser, result, clauses, segments))) return failure(); @@ -1170,10 +1021,6 @@ } p << "step (" << step() << ") "; - printDataVars(p, private_vars(), "private"); - printDataVars(p, firstprivate_vars(), "firstprivate"); - printDataVars(p, lastprivate_vars(), "lastprivate"); - if (!linear_vars().empty()) printLinearClause(p, linear_vars(), linear_step_vars()); @@ -1288,8 +1135,6 @@ ValueRange lowerBound, ValueRange upperBound, ValueRange step, ArrayRef attributes) { build(builder, state, TypeRange(), lowerBound, upperBound, step, - /*privateVars=*/ValueRange(), - /*firstprivateVars=*/ValueRange(), /*lastprivate_vars=*/ValueRange(), /*linear_vars=*/ValueRange(), /*linear_step_vars=*/ValueRange(), /*reduction_vars=*/ValueRange(), /*schedule_val=*/nullptr, /*schedule_chunk_var=*/nullptr, /*collapse_val=*/nullptr, @@ -1310,18 +1155,14 @@ void WsLoopOp::build(OpBuilder &builder, OperationState &result, TypeRange typeRange, ValueRange lowerBounds, ValueRange upperBounds, ValueRange steps, - ValueRange privateVars, ValueRange firstprivateVars, - ValueRange lastprivateVars, ValueRange linearVars, - ValueRange linearStepVars, ValueRange reductionVars, - StringAttr scheduleVal, Value scheduleChunkVar, - IntegerAttr collapseVal, UnitAttr nowait, - IntegerAttr orderedVal, StringAttr orderVal, - UnitAttr inclusive, bool buildBody) { + ValueRange linearVars, ValueRange linearStepVars, + ValueRange reductionVars, StringAttr scheduleVal, + Value scheduleChunkVar, IntegerAttr collapseVal, + UnitAttr nowait, IntegerAttr orderedVal, + StringAttr orderVal, UnitAttr inclusive, bool buildBody) { result.addOperands(lowerBounds); result.addOperands(upperBounds); result.addOperands(steps); - result.addOperands(privateVars); - result.addOperands(firstprivateVars); result.addOperands(linearVars); result.addOperands(linearStepVars); if (scheduleChunkVar) @@ -1345,9 +1186,6 @@ {static_cast(lowerBounds.size()), static_cast(upperBounds.size()), static_cast(steps.size()), - static_cast(privateVars.size()), - static_cast(firstprivateVars.size()), - static_cast(lastprivateVars.size()), static_cast(linearVars.size()), static_cast(linearStepVars.size()), static_cast(reductionVars.size()), diff --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp --- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp +++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp @@ -580,15 +580,12 @@ // TODO: Support the following clauses: private, firstprivate, lastprivate, // reduction, allocate - if (!sectionsOp.private_vars().empty() || - !sectionsOp.firstprivate_vars().empty() || - !sectionsOp.lastprivate_vars().empty() || - !sectionsOp.reduction_vars().empty() || sectionsOp.reductions() || + if (!sectionsOp.reduction_vars().empty() || sectionsOp.reductions() || !sectionsOp.allocate_vars().empty() || !sectionsOp.allocators_vars().empty()) return emitError(sectionsOp.getLoc()) - << "private, firstprivate, lastprivate, reduction and allocate " - "clauses are not supported for sections construct"; + << "reduction and allocate clauses are not supported for sections " + "construct"; LogicalResult bodyGenStatus = success(); SmallVector sectionCBs; diff --git a/mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir b/mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir --- a/mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir +++ b/mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir @@ -57,7 +57,7 @@ // CHECK: "test.payload"(%[[CAST_ARG6]], %[[CAST_ARG7]]) : (index, index) -> () "test.payload"(%arg6, %arg7) : (index, index) -> () omp.yield - }) {operand_segment_sizes = dense<[2, 2, 2, 0, 0, 0, 0, 0, 0, 0]> : vector<10xi32>} : (index, index, index, index, index, index) -> () + }) {operand_segment_sizes = dense<[2, 2, 2, 0, 0, 0, 0]> : vector<7xi32>} : (index, index, index, index, index, index) -> () omp.terminator } return diff --git a/mlir/test/Dialect/OpenMP/invalid.mlir b/mlir/test/Dialect/OpenMP/invalid.mlir --- a/mlir/test/Dialect/OpenMP/invalid.mlir +++ b/mlir/test/Dialect/OpenMP/invalid.mlir @@ -30,54 +30,6 @@ // ----- -func @private_once(%n : memref) { - // expected-error@+1 {{at most one private clause can appear on the omp.parallel operation}} - omp.parallel private(%n : memref) private(%n : memref) { - } - - return -} - -// ----- - -func @firstprivate_once(%n : memref) { - // expected-error@+1 {{at most one firstprivate clause can appear on the omp.parallel operation}} - omp.parallel firstprivate(%n : memref) firstprivate(%n : memref) { - } - - return -} - -// ----- - -func @shared_once(%n : memref) { - // expected-error@+1 {{at most one shared clause can appear on the omp.parallel operation}} - omp.parallel shared(%n : memref) shared(%n : memref) { - } - - return -} - -// ----- - -func @copyin_once(%n : memref) { - // expected-error@+1 {{at most one copyin clause can appear on the omp.parallel operation}} - omp.parallel copyin(%n : memref) copyin(%n : memref) { - } - - return -} - -// ----- - -func @lastprivate_not_allowed(%n : memref) { - // expected-error@+1 {{lastprivate is not a valid clause for the omp.parallel operation}} - omp.parallel lastprivate(%n : memref) {} - return -} - -// ----- - func @nowait_not_allowed(%n : memref) { // expected-error@+1 {{nowait is not a valid clause for the omp.parallel operation}} omp.parallel nowait {} @@ -125,16 +77,6 @@ // ----- -func @default_once() { - // expected-error@+1 {{at most one default clause can appear on the omp.parallel operation}} - omp.parallel default(private) default(firstprivate) { - } - - return -} - -// ----- - func @proc_bind_once() { // expected-error@+1 {{at most one proc_bind clause can appear on the omp.parallel operation}} omp.parallel proc_bind(close) proc_bind(spread) { @@ -163,24 +105,6 @@ // ----- -func @shared_not_allowed(%lb : index, %ub : index, %step : index, %var : memref) { - // expected-error @below {{shared is not a valid clause for the omp.wsloop operation}} - omp.wsloop (%iv) : index = (%lb) to (%ub) step (%step) shared(%var) { - omp.yield - } -} - -// ----- - -func @copyin(%lb : index, %ub : index, %step : index, %var : memref) { - // expected-error @below {{copyin is not a valid clause for the omp.wsloop operation}} - omp.wsloop (%iv) : index = (%lb) to (%ub) step (%step) copyin(%var) { - omp.yield - } -} - -// ----- - func @if_not_allowed(%lb : index, %ub : index, %step : index, %bool_var : i1) { // expected-error @below {{if is not a valid clause for the omp.wsloop operation}} omp.wsloop (%iv) : index = (%lb) to (%ub) step (%step) if(%bool_var: i1) { @@ -199,15 +123,6 @@ // ----- -func @default_not_allowed(%lb : index, %ub : index, %step : index) { - // expected-error @below {{default is not a valid clause for the omp.wsloop operation}} - omp.wsloop (%iv) : index = (%lb) to (%ub) step (%step) default(private) { - omp.yield - } -} - -// ----- - func @proc_bind_not_allowed(%lb : index, %ub : index, %step : index) { // expected-error @below {{proc_bind is not a valid clause for the omp.wsloop operation}} omp.wsloop (%iv) : index = (%lb) to (%ub) step (%step) proc_bind(close) { @@ -847,41 +762,11 @@ // ----- -func @omp_sections(%data_var1 : memref, %data_var2 : memref, %data_var3 : memref) -> () { - // expected-error @below {{operand used in both private and firstprivate clauses}} - omp.sections private(%data_var1 : memref) firstprivate(%data_var1 : memref) { - omp.terminator - } - return -} - -// ----- - -func @omp_sections(%data_var1 : memref, %data_var2 : memref, %data_var3 : memref) -> () { - // expected-error @below {{operand used in both private and lastprivate clauses}} - omp.sections private(%data_var1 : memref) lastprivate(%data_var1 : memref) { - omp.terminator - } - return -} - -// ----- - -func @omp_sections(%data_var1 : memref, %data_var2 : memref, %data_var3 : memref) -> () { - // expected-error @below {{operand used in both private and lastprivate clauses}} - omp.sections private(%data_var1 : memref, %data_var2 : memref) lastprivate(%data_var3 : memref, %data_var2 : memref) { - omp.terminator - } - return -} - -// ----- - func @omp_sections(%data_var : memref) -> () { // expected-error @below {{expected equal sizes for allocate and allocator variables}} "omp.sections" (%data_var) ({ omp.terminator - }) {operand_segment_sizes = dense<[0,0,0,0,1,0]> : vector<6xi32>} : (memref) -> () + }) {operand_segment_sizes = dense<[0,1,0]> : vector<3xi32>} : (memref) -> () return } @@ -891,7 +776,7 @@ // expected-error @below {{expected as many reduction symbol references as reduction variables}} "omp.sections" (%data_var) ({ omp.terminator - }) {operand_segment_sizes = dense<[0,0,0,1,0,0]> : vector<6xi32>} : (memref) -> () + }) {operand_segment_sizes = dense<[1,0,0]> : vector<3xi32>} : (memref) -> () return } @@ -927,36 +812,6 @@ // ----- -func @omp_sections(%datavar : memref) { - // expected-error @below {{shared is not a valid clause for the omp.sections operation}} - omp.sections shared(%datavar : memref) { - omp.terminator - } - return -} - -// ----- - -func @omp_sections(%datavar : memref) { - // expected-error @below {{copyin is not a valid clause for the omp.sections operation}} - omp.sections copyin(%datavar : memref) { - omp.terminator - } - return -} - -// ----- - -func @omp_sections() { - // expected-error @below {{default is not a valid clause for the omp.sections operation}} - omp.sections default(private) { - omp.terminator - } - return -} - -// ----- - func @omp_sections() { // expected-error @below {{proc_bind is not a valid clause for the omp.sections operation}} omp.sections proc_bind(close) { diff --git a/mlir/test/Dialect/OpenMP/ops.mlir b/mlir/test/Dialect/OpenMP/ops.mlir --- a/mlir/test/Dialect/OpenMP/ops.mlir +++ b/mlir/test/Dialect/OpenMP/ops.mlir @@ -52,38 +52,38 @@ } func @omp_parallel(%data_var : memref, %if_cond : i1, %num_threads : si32) -> () { - // CHECK: omp.parallel if(%{{.*}}) num_threads(%{{.*}} : si32) private(%{{.*}} : memref) firstprivate(%{{.*}} : memref) shared(%{{.*}} : memref) copyin(%{{.*}} : memref) allocate(%{{.*}} : memref -> %{{.*}} : memref) - "omp.parallel" (%if_cond, %num_threads, %data_var, %data_var, %data_var, %data_var, %data_var, %data_var) ({ + // CHECK: omp.parallel if(%{{.*}}) num_threads(%{{.*}} : si32) allocate(%{{.*}} : memref -> %{{.*}} : memref) + "omp.parallel" (%if_cond, %num_threads, %data_var, %data_var) ({ // test without if condition - // CHECK: omp.parallel num_threads(%{{.*}} : si32) private(%{{.*}} : memref) firstprivate(%{{.*}} : memref) shared(%{{.*}} : memref) copyin(%{{.*}} : memref) allocate(%{{.*}} : memref -> %{{.*}} : memref) - "omp.parallel"(%num_threads, %data_var, %data_var, %data_var, %data_var, %data_var, %data_var) ({ + // CHECK: omp.parallel num_threads(%{{.*}} : si32) allocate(%{{.*}} : memref -> %{{.*}} : memref) + "omp.parallel"(%num_threads, %data_var, %data_var) ({ omp.terminator - }) {operand_segment_sizes = dense<[0,1,1,1,1,1,1,1]>: vector<8xi32>, default_val = #omp<"clause_default defshared">} : (si32, memref, memref, memref, memref, memref, memref) -> () + }) {operand_segment_sizes = dense<[0,1,1,1]>: vector<4xi32>} : (si32, memref, memref) -> () // CHECK: omp.barrier omp.barrier // test without num_threads - // CHECK: omp.parallel if(%{{.*}}) private(%{{.*}} : memref) firstprivate(%{{.*}} : memref) shared(%{{.*}} : memref) copyin(%{{.*}} : memref) allocate(%{{.*}} : memref -> %{{.*}} : memref) - "omp.parallel"(%if_cond, %data_var, %data_var, %data_var, %data_var, %data_var, %data_var) ({ + // CHECK: omp.parallel if(%{{.*}}) allocate(%{{.*}} : memref -> %{{.*}} : memref) + "omp.parallel"(%if_cond, %data_var, %data_var) ({ omp.terminator - }) {operand_segment_sizes = dense<[1,0,1,1,1,1,1,1]> : vector<8xi32>} : (i1, memref, memref, memref, memref, memref, memref) -> () + }) {operand_segment_sizes = dense<[1,0,1,1]> : vector<4xi32>} : (i1, memref, memref) -> () // test without allocate - // CHECK: omp.parallel if(%{{.*}}) num_threads(%{{.*}} : si32) private(%{{.*}} : memref) firstprivate(%{{.*}} : memref) shared(%{{.*}} : memref) copyin(%{{.*}} : memref) - "omp.parallel"(%if_cond, %num_threads, %data_var, %data_var, %data_var, %data_var) ({ + // CHECK: omp.parallel if(%{{.*}}) num_threads(%{{.*}} : si32) + "omp.parallel"(%if_cond, %num_threads) ({ omp.terminator - }) {operand_segment_sizes = dense<[1,1,1,1,1,1,0,0]> : vector<8xi32>} : (i1, si32, memref, memref, memref, memref) -> () + }) {operand_segment_sizes = dense<[1,1,0,0]> : vector<4xi32>} : (i1, si32) -> () omp.terminator - }) {operand_segment_sizes = dense<[1,1,1,1,1,1,1,1]> : vector<8xi32>, proc_bind_val = #omp<"procbindkind spread">} : (i1, si32, memref, memref, memref, memref, memref, memref) -> () + }) {operand_segment_sizes = dense<[1,1,1,1]> : vector<4xi32>, proc_bind_val = #omp<"procbindkind spread">} : (i1, si32, memref, memref) -> () // test with multiple parameters for single variadic argument - // CHECK: omp.parallel private(%{{.*}} : memref) firstprivate(%{{.*}} : memref, %{{.*}} : memref) shared(%{{.*}} : memref) copyin(%{{.*}} : memref) allocate(%{{.*}} : memref -> %{{.*}} : memref) - "omp.parallel" (%data_var, %data_var, %data_var, %data_var, %data_var, %data_var, %data_var) ({ + // CHECK: omp.parallel allocate(%{{.*}} : memref -> %{{.*}} : memref) + "omp.parallel" (%data_var, %data_var) ({ omp.terminator - }) {operand_segment_sizes = dense<[0,0,1,2,1,1,1,1]> : vector<8xi32>} : (memref, memref, memref, memref, memref, memref, memref) -> () + }) {operand_segment_sizes = dense<[0,0,1,1]> : vector<4xi32>} : (memref, memref) -> () return } @@ -104,13 +104,9 @@ omp.terminator } - // CHECK: omp.parallel private(%{{.*}} : memref, %{{.*}} : memref) firstprivate(%{{.*}} : memref) - omp.parallel private(%data_var : memref, %data_var : memref) firstprivate(%data_var : memref) { - omp.terminator - } - - // CHECK omp.parallel shared(%{{.*}} : memref) copyin(%{{.*}} : memref, %{{.*}} : memref) - omp.parallel shared(%data_var : memref) copyin(%data_var : memref, %data_var : memref) { + // CHECK: omp.parallel + // CHECK-NEXT: omp.parallel if(%{{.*}} : i1) + omp.parallel { omp.parallel if(%if_cond: i1) { omp.terminator } @@ -118,71 +114,50 @@ } // CHECK omp.parallel if(%{{.*}}) num_threads(%{{.*}} : si32) private(%{{.*}} : memref) proc_bind(close) - omp.parallel num_threads(%num_threads : si32) if(%if_cond: i1) - private(%data_var : memref) proc_bind(close) { + omp.parallel num_threads(%num_threads : si32) if(%if_cond: i1) proc_bind(close) { omp.terminator } - // CHECK: omp.parallel default(private) - omp.parallel default(private) { - omp.terminator - } - - // CHECK: omp.parallel default(firstprivate) - omp.parallel default(firstprivate) { - omp.terminator - } - - // CHECK: omp.parallel default(shared) - omp.parallel default(shared) { - omp.terminator - } - - // CHECK: omp.parallel default(none) - omp.parallel default(none) { - omp.terminator - } - return } // CHECK-LABEL: omp_wsloop func @omp_wsloop(%lb : index, %ub : index, %step : index, %data_var : memref, %linear_var : i32, %chunk_var : i32) -> () { - // CHECK: omp.wsloop (%{{.*}}) : index = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) private(%{{.*}} : memref, %{{.*}} : memref) collapse(2) ordered(1) - "omp.wsloop" (%lb, %ub, %step, %data_var, %data_var) ({ + // CHECK: omp.wsloop (%{{.*}}) : index = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) collapse(2) ordered(1) + "omp.wsloop" (%lb, %ub, %step) ({ ^bb0(%iv: index): omp.yield - }) {operand_segment_sizes = dense<[1,1,1,2,0,0,0,0,0,0]> : vector<10xi32>, collapse_val = 2, ordered_val = 1} : - (index, index, index, memref, memref) -> () + }) {operand_segment_sizes = dense<[1,1,1,0,0,0,0]> : vector<7xi32>, collapse_val = 2, ordered_val = 1} : + (index, index, index) -> () // CHECK: omp.wsloop (%{{.*}}) : index = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) linear(%{{.*}} = %{{.*}} : memref) schedule(static) "omp.wsloop" (%lb, %ub, %step, %data_var, %linear_var) ({ ^bb0(%iv: index): omp.yield - }) {operand_segment_sizes = dense<[1,1,1,0,0,0,1,1,0,0]> : vector<10xi32>, schedule_val = #omp<"schedulekind Static">} : + }) {operand_segment_sizes = dense<[1,1,1,1,1,0,0]> : vector<7xi32>, schedule_val = #omp<"schedulekind Static">} : (index, index, index, memref, i32) -> () // CHECK: omp.wsloop (%{{.*}}) : index = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) linear(%{{.*}} = %{{.*}} : memref, %{{.*}} = %{{.*}} : memref) schedule(static) "omp.wsloop" (%lb, %ub, %step, %data_var, %data_var, %linear_var, %linear_var) ({ ^bb0(%iv: index): omp.yield - }) {operand_segment_sizes = dense<[1,1,1,0,0,0,2,2,0,0]> : vector<10xi32>, schedule_val = #omp<"schedulekind Static">} : + }) {operand_segment_sizes = dense<[1,1,1,2,2,0,0]> : vector<7xi32>, schedule_val = #omp<"schedulekind Static">} : (index, index, index, memref, memref, i32, i32) -> () - // CHECK: omp.wsloop (%{{.*}}) : index = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) private(%{{.*}} : memref) firstprivate(%{{.*}} : memref) lastprivate(%{{.*}} : memref) linear(%{{.*}} = %{{.*}} : memref) schedule(dynamic = %{{.*}}) collapse(3) ordered(2) - "omp.wsloop" (%lb, %ub, %step, %data_var, %data_var, %data_var, %data_var, %linear_var, %chunk_var) ({ + // CHECK: omp.wsloop (%{{.*}}) : index = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) linear(%{{.*}} = %{{.*}} : memref) schedule(dynamic = %{{.*}}) collapse(3) ordered(2) + "omp.wsloop" (%lb, %ub, %step, %data_var, %linear_var, %chunk_var) ({ ^bb0(%iv: index): omp.yield - }) {operand_segment_sizes = dense<[1,1,1,1,1,1,1,1,0,1]> : vector<10xi32>, schedule_val = #omp<"schedulekind Dynamic">, collapse_val = 3, ordered_val = 2} : - (index, index, index, memref, memref, memref, memref, i32, i32) -> () + }) {operand_segment_sizes = dense<[1,1,1,1,1,0,1]> : vector<7xi32>, schedule_val = #omp<"schedulekind Dynamic">, collapse_val = 3, ordered_val = 2} : + (index, index, index, memref, i32, i32) -> () - // CHECK: omp.wsloop (%{{.*}}) : index = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) private(%{{.*}} : memref) schedule(auto) nowait - "omp.wsloop" (%lb, %ub, %step, %data_var) ({ + // CHECK: omp.wsloop (%{{.*}}) : index = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) schedule(auto) nowait + "omp.wsloop" (%lb, %ub, %step) ({ ^bb0(%iv: index): omp.yield - }) {operand_segment_sizes = dense<[1,1,1,1,0,0,0,0,0,0]> : vector<10xi32>, nowait, schedule_val = #omp<"schedulekind Auto">} : - (index, index, index, memref) -> () + }) {operand_segment_sizes = dense<[1,1,1,0,0,0,0]> : vector<7xi32>, nowait, schedule_val = #omp<"schedulekind Auto">} : + (index, index, index) -> () return } @@ -190,39 +165,36 @@ // CHECK-LABEL: omp_wsloop_pretty func @omp_wsloop_pretty(%lb : index, %ub : index, %step : index, %data_var : memref, %linear_var : i32, %chunk_var : i32, %chunk_var2 : i16) -> () { - // CHECK: omp.wsloop (%{{.*}}) : index = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) private(%{{.*}} : memref) - omp.wsloop (%iv) : index = (%lb) to (%ub) step (%step) private(%data_var : memref) collapse(2) ordered(2) { + // CHECK: omp.wsloop (%{{.*}}) : index = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) + omp.wsloop (%iv) : index = (%lb) to (%ub) step (%step) collapse(2) ordered(2) { omp.yield } // CHECK: omp.wsloop (%{{.*}}) : index = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) linear(%{{.*}} = %{{.*}} : memref) schedule(static) - omp.wsloop (%iv) : index = (%lb) to (%ub) step (%step) schedule(static) lastprivate(%data_var : memref) linear(%data_var = %linear_var : memref) { + omp.wsloop (%iv) : index = (%lb) to (%ub) step (%step) schedule(static) linear(%data_var = %linear_var : memref) { omp.yield } - // CHECK: omp.wsloop (%{{.*}}) : index = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) private(%{{.*}} : memref) firstprivate(%{{.*}} : memref) lastprivate(%{{.*}} : memref) linear(%{{.*}} = %{{.*}} : memref) schedule(static = %{{.*}} : i32) collapse(3) ordered(2) - omp.wsloop (%iv) : index = (%lb) to (%ub) step (%step) ordered(2) private(%data_var : memref) - firstprivate(%data_var : memref) lastprivate(%data_var : memref) linear(%data_var = %linear_var : memref) + // CHECK: omp.wsloop (%{{.*}}) : index = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) linear(%{{.*}} = %{{.*}} : memref) schedule(static = %{{.*}} : i32) collapse(3) ordered(2) + omp.wsloop (%iv) : index = (%lb) to (%ub) step (%step) ordered(2) linear(%data_var = %linear_var : memref) schedule(static = %chunk_var : i32) collapse(3) { omp.yield } - // CHECK: omp.wsloop (%{{.*}}) : index = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) private(%{{.*}} : memref) firstprivate(%{{.*}} : memref) lastprivate(%{{.*}} : memref) linear(%{{.*}} = %{{.*}} : memref) schedule(dynamic = %{{.*}} : i32, nonmonotonic) collapse(3) ordered(2) - omp.wsloop (%iv) : index = (%lb) to (%ub) step (%step) ordered(2) private(%data_var : memref) - firstprivate(%data_var : memref) lastprivate(%data_var : memref) linear(%data_var = %linear_var : memref) + // CHECK: omp.wsloop (%{{.*}}) : index = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) linear(%{{.*}} = %{{.*}} : memref) schedule(dynamic = %{{.*}} : i32, nonmonotonic) collapse(3) ordered(2) + omp.wsloop (%iv) : index = (%lb) to (%ub) step (%step) ordered(2) linear(%data_var = %linear_var : memref) schedule(dynamic = %chunk_var : i32, nonmonotonic) collapse(3) { omp.yield } - // CHECK: omp.wsloop (%{{.*}}) : index = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) private(%{{.*}} : memref) firstprivate(%{{.*}} : memref) lastprivate(%{{.*}} : memref) linear(%{{.*}} = %{{.*}} : memref) schedule(dynamic = %{{.*}} : i16, monotonic) collapse(3) ordered(2) - omp.wsloop (%iv) : index = (%lb) to (%ub) step (%step) ordered(2) private(%data_var : memref) - firstprivate(%data_var : memref) lastprivate(%data_var : memref) linear(%data_var = %linear_var : memref) + // CHECK: omp.wsloop (%{{.*}}) : index = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) linear(%{{.*}} = %{{.*}} : memref) schedule(dynamic = %{{.*}} : i16, monotonic) collapse(3) ordered(2) + omp.wsloop (%iv) : index = (%lb) to (%ub) step (%step) ordered(2) linear(%data_var = %linear_var : memref) schedule(dynamic = %chunk_var2 : i16, monotonic) collapse(3) { omp.yield } - // CHECK: omp.wsloop (%{{.*}}) : index = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) private({{.*}} : memref) - omp.wsloop (%iv) : index = (%lb) to (%ub) step (%step) private(%data_var : memref) { + // CHECK: omp.wsloop (%{{.*}}) : index = (%{{.*}}) to (%{{.*}}) step (%{{.*}}) + omp.wsloop (%iv) : index = (%lb) to (%ub) step (%step) { omp.yield } @@ -648,81 +620,20 @@ // CHECK-LABEL: omp_sectionsop func @omp_sectionsop(%data_var1 : memref, %data_var2 : memref, %data_var3 : memref, %redn_var : !llvm.ptr) { - - // CHECK: omp.sections private(%{{.*}} : memref) { - "omp.sections" (%data_var1) ({ - // CHECK: omp.terminator - omp.terminator - }) {operand_segment_sizes = dense<[1,0,0,0,0,0]> : vector<6xi32>} : (memref) -> () - - // CHECK: omp.sections firstprivate(%{{.*}} : memref) { - "omp.sections" (%data_var1) ({ - // CHECK: omp.terminator - omp.terminator - }) {operand_segment_sizes = dense<[0,1,0,0,0,0]> : vector<6xi32>} : (memref) -> () - - // CHECK: omp.sections lastprivate(%{{.*}} : memref) { - "omp.sections" (%data_var1) ({ - // CHECK: omp.terminator - omp.terminator - }) {operand_segment_sizes = dense<[0,0,1,0,0,0]> : vector<6xi32>} : (memref) -> () - - // CHECK: omp.sections private(%{{.*}} : memref) firstprivate(%{{.*}} : memref) lastprivate(%{{.*}} : memref) { - "omp.sections" (%data_var1, %data_var2, %data_var3) ({ - // CHECK: omp.terminator - omp.terminator - }) {operand_segment_sizes = dense<[1,1,1,0,0,0]> : vector<6xi32>} : (memref, memref, memref) -> () - // CHECK: omp.sections allocate(%{{.*}} : memref -> %{{.*}} : memref) "omp.sections" (%data_var1, %data_var1) ({ // CHECK: omp.terminator omp.terminator - }) {operand_segment_sizes = dense<[0,0,0,0,1,1]> : vector<6xi32>} : (memref, memref) -> () + }) {operand_segment_sizes = dense<[0,1,1]> : vector<3xi32>} : (memref, memref) -> () // CHECK: omp.sections reduction(@add_f32 -> %{{.*}} : !llvm.ptr) "omp.sections" (%redn_var) ({ // CHECK: omp.terminator omp.terminator - }) {operand_segment_sizes = dense<[0,0,0,1,0,0]> : vector<6xi32>, reductions=[@add_f32]} : (!llvm.ptr) -> () - - // CHECK: omp.sections private(%{{.*}} : memref) { - omp.sections private(%data_var1 : memref) { - // CHECK: omp.terminator - omp.terminator - } + }) {operand_segment_sizes = dense<[1,0,0]> : vector<3xi32>, reductions=[@add_f32]} : (!llvm.ptr) -> () - // CHECK: omp.sections firstprivate(%{{.*}} : memref) - omp.sections firstprivate(%data_var1 : memref) { - // CHECK: omp.terminator - omp.terminator - } - - // CHECK: omp.sections lastprivate(%{{.*}} : memref) - omp.sections lastprivate(%data_var1 : memref) { - // CHECK: omp.terminator - omp.terminator - } - - // CHECK: omp.sections private(%{{.*}} : memref) firstprivate(%{{.*}} : memref) lastprivate(%{{.*}} : memref) { - omp.sections private(%data_var1 : memref) firstprivate(%data_var2 : memref) lastprivate(%data_var3 : memref) { - // CHECK: omp.terminator - omp.terminator - } - - // CHECK: omp.sections private(%{{.*}} : memref) firstprivate(%{{.*}} : memref) lastprivate(%{{.*}} : memref) { - omp.sections lastprivate(%data_var1 : memref) firstprivate(%data_var2 : memref) private(%data_var3 : memref) { - // CHECK: omp.terminator - omp.terminator - } - - // CHECK: omp.sections private(%{{.*}} : memref) nowait { - omp.sections nowait private(%data_var1 : memref) { - // CHECK: omp.terminator - omp.terminator - } - - // CHECK: omp.sections firstprivate(%{{.*}} : memref, %{{.*}} : memref) lastprivate(%{{.*}} : memref) { - omp.sections firstprivate(%data_var1 : memref, %data_var2 : memref) lastprivate(%data_var1 : memref) { + // CHECK: omp.sections nowait { + omp.sections nowait { // CHECK: omp.terminator omp.terminator } diff --git a/mlir/test/Target/LLVMIR/openmp-llvm.mlir b/mlir/test/Target/LLVMIR/openmp-llvm.mlir --- a/mlir/test/Target/LLVMIR/openmp-llvm.mlir +++ b/mlir/test/Target/LLVMIR/openmp-llvm.mlir @@ -379,7 +379,7 @@ llvm.store %3, %4 : !llvm.ptr omp.yield // CHECK: call void @__kmpc_for_static_fini(%struct.ident_t* @[[$wsloop_loc_struct]], - }) {operand_segment_sizes = dense<[1, 1, 1, 0, 0, 0, 0, 0, 0, 0]> : vector<10xi32>} : (i64, i64, i64) -> () + }) {operand_segment_sizes = dense<[1, 1, 1, 0, 0, 0, 0]> : vector<7xi32>} : (i64, i64, i64) -> () omp.terminator } llvm.return @@ -399,7 +399,7 @@ %4 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %3, %4 : !llvm.ptr omp.yield - }) {operand_segment_sizes = dense<[1, 1, 1, 0, 0, 0, 0, 0, 0, 0]> : vector<10xi32>} : (i64, i64, i64) -> () + }) {operand_segment_sizes = dense<[1, 1, 1, 0, 0, 0, 0]> : vector<7xi32>} : (i64, i64, i64) -> () llvm.return } @@ -417,7 +417,7 @@ %4 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %3, %4 : !llvm.ptr omp.yield - }) {inclusive, operand_segment_sizes = dense<[1, 1, 1, 0, 0, 0, 0, 0, 0, 0]> : vector<10xi32>} : (i64, i64, i64) -> () + }) {inclusive, operand_segment_sizes = dense<[1, 1, 1, 0, 0, 0, 0]> : vector<7xi32>} : (i64, i64, i64) -> () llvm.return }