[Mlir-commits] [mlir] 77296dc - [mlir][OpenMP][NFC] Removing unnecessary builders for wsloop

Shraiysh Vaishay llvmlistbot at llvm.org
Mon Feb 28 00:52:58 PST 2022


Author: Shraiysh Vaishay
Date: 2022-02-28T14:22:43+05:30
New Revision: 77296dc5e98d06a20aea46fdc38268afb44518ac

URL: https://github.com/llvm/llvm-project/commit/77296dc5e98d06a20aea46fdc38268afb44518ac
DIFF: https://github.com/llvm/llvm-project/commit/77296dc5e98d06a20aea46fdc38268afb44518ac.diff

LOG: [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

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
    mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
index fbe099b85f9a0..cd3ea1f470c43 100644
--- a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
+++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
@@ -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);

diff  --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
index 4fa4e5819b339..de526482ae5f0 100644
--- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
+++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
@@ -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());
 }


        


More information about the Mlir-commits mailing list