[mlir][OpenMP][NFC] Removing unnecessary builders for wsloop
This patch removes the builders for `omp.wsloop` operation that aren't specifically needed anywhere. We can add them later if the need arises. Reviewed By: kiranchandramohan Differential Revision: https://reviews.llvm.org/D120533
This commit is contained in:
parent
b3fcfcb946
commit
77296dc5e9
|
@ -286,22 +286,10 @@ def WsLoopOp : OpenMP_Op<"wsloop", [AttrSizedOperandSegments,
|
|||
OptionalAttr<OrderKindAttr>:$order_val,
|
||||
UnitAttr:$inclusive);
|
||||
|
||||
let skipDefaultBuilders = 1;
|
||||
|
||||
let builders = [
|
||||
OpBuilder<(ins "ValueRange":$lowerBound, "ValueRange":$upperBound,
|
||||
"ValueRange":$step,
|
||||
CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes)>,
|
||||
OpBuilder<(ins "TypeRange":$resultTypes, "ValueRange":$lowerBound,
|
||||
"ValueRange":$upperBound, "ValueRange":$step,
|
||||
"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<NamedAttribute>", "{}">:$attributes)>
|
||||
];
|
||||
|
||||
let regions = (region AnyRegion:$region);
|
||||
|
|
|
@ -1005,73 +1005,16 @@ LogicalResult ReductionOp::verify() {
|
|||
void WsLoopOp::build(OpBuilder &builder, OperationState &state,
|
||||
ValueRange lowerBound, ValueRange upperBound,
|
||||
ValueRange step, ArrayRef<NamedAttribute> attributes) {
|
||||
build(builder, state, TypeRange(), lowerBound, upperBound, step,
|
||||
/*linear_vars=*/ValueRange(), /*linear_step_vars=*/ValueRange(),
|
||||
/*reduction_vars=*/ValueRange(), /*schedule_val=*/nullptr,
|
||||
/*schedule_chunk_var=*/nullptr, /*collapse_val=*/nullptr,
|
||||
/*nowait=*/nullptr, /*ordered_val=*/nullptr, /*order_val=*/nullptr,
|
||||
/*inclusive=*/nullptr, /*buildBody=*/false);
|
||||
build(builder, state, lowerBound, upperBound, step,
|
||||
/*linear_vars=*/ValueRange(),
|
||||
/*linear_step_vars=*/ValueRange(), /*reduction_vars=*/ValueRange(),
|
||||
/*reductions=*/nullptr, /*schedule_val=*/nullptr,
|
||||
/*schedule_chunk_var=*/nullptr, /*schedule_modifier=*/nullptr,
|
||||
/*simd_modifier=*/false, /*collapse_val=*/nullptr, /*nowait=*/false,
|
||||
/*ordered_val=*/nullptr, /*order_val=*/nullptr, /*inclusive=*/false);
|
||||
state.addAttributes(attributes);
|
||||
}
|
||||
|
||||
void WsLoopOp::build(OpBuilder &, OperationState &state, TypeRange resultTypes,
|
||||
ValueRange operands, ArrayRef<NamedAttribute> attributes) {
|
||||
state.addOperands(operands);
|
||||
state.addAttributes(attributes);
|
||||
(void)state.addRegion();
|
||||
assert(resultTypes.empty() && "mismatched number of return types");
|
||||
state.addTypes(resultTypes);
|
||||
}
|
||||
|
||||
void WsLoopOp::build(OpBuilder &builder, OperationState &result,
|
||||
TypeRange typeRange, ValueRange lowerBounds,
|
||||
ValueRange upperBounds, ValueRange steps,
|
||||
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(linearVars);
|
||||
result.addOperands(linearStepVars);
|
||||
if (scheduleChunkVar)
|
||||
result.addOperands(scheduleChunkVar);
|
||||
|
||||
if (scheduleVal)
|
||||
result.addAttribute("schedule_val", scheduleVal);
|
||||
if (collapseVal)
|
||||
result.addAttribute("collapse_val", collapseVal);
|
||||
if (nowait)
|
||||
result.addAttribute("nowait", nowait);
|
||||
if (orderedVal)
|
||||
result.addAttribute("ordered_val", orderedVal);
|
||||
if (orderVal)
|
||||
result.addAttribute("order", orderVal);
|
||||
if (inclusive)
|
||||
result.addAttribute("inclusive", inclusive);
|
||||
result.addAttribute(
|
||||
WsLoopOp::getOperandSegmentSizeAttr(),
|
||||
builder.getI32VectorAttr(
|
||||
{static_cast<int32_t>(lowerBounds.size()),
|
||||
static_cast<int32_t>(upperBounds.size()),
|
||||
static_cast<int32_t>(steps.size()),
|
||||
static_cast<int32_t>(linearVars.size()),
|
||||
static_cast<int32_t>(linearStepVars.size()),
|
||||
static_cast<int32_t>(reductionVars.size()),
|
||||
static_cast<int32_t>(scheduleChunkVar != nullptr ? 1 : 0)}));
|
||||
|
||||
Region *bodyRegion = result.addRegion();
|
||||
if (buildBody) {
|
||||
OpBuilder::InsertionGuard guard(builder);
|
||||
unsigned numIVs = steps.size();
|
||||
SmallVector<Type, 8> argTypes(numIVs, steps.getType().front());
|
||||
SmallVector<Location, 8> argLocs(numIVs, result.location);
|
||||
builder.createBlock(bodyRegion, {}, argTypes, argLocs);
|
||||
}
|
||||
}
|
||||
|
||||
LogicalResult WsLoopOp::verify() {
|
||||
return verifyReductionVarList(*this, reductions(), reduction_vars());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue