diff --git a/flang/lib/Optimizer/Dialect/FIROps.cpp b/flang/lib/Optimizer/Dialect/FIROps.cpp --- a/flang/lib/Optimizer/Dialect/FIROps.cpp +++ b/flang/lib/Optimizer/Dialect/FIROps.cpp @@ -128,9 +128,8 @@ parser.emitError(parser.getNameLoc(), "invalid allocate type: ") << intype; return mlir::failure(); } - result.addAttribute( - "operand_segment_sizes", - builder.getDenseI32ArrayAttr({typeparamsSize, shapeSize})); + result.addAttribute("operandSegmentSizes", builder.getDenseI32ArrayAttr( + {typeparamsSize, shapeSize})); if (parser.parseOptionalAttrDict(result.attributes) || parser.addTypeToList(restype, result.types)) return mlir::failure(); @@ -149,7 +148,7 @@ p << ", "; p.printOperand(sh); } - p.printOptionalAttrDict(op->getAttrs(), {"in_type", "operand_segment_sizes"}); + p.printOptionalAttrDict(op->getAttrs(), {"in_type", "operandSegmentSizes"}); } //===----------------------------------------------------------------------===// diff --git a/flang/test/Fir/convert-to-llvm-openmp-and-fir.fir b/flang/test/Fir/convert-to-llvm-openmp-and-fir.fir --- a/flang/test/Fir/convert-to-llvm-openmp-and-fir.fir +++ b/flang/test/Fir/convert-to-llvm-openmp-and-fir.fir @@ -28,7 +28,7 @@ // CHECK: %[[ONE_2:.*]] = llvm.mlir.constant(1 : i32) : i32 // CHECK: omp.parallel { // CHECK: %[[ONE_3:.*]] = llvm.mlir.constant(1 : i64) : i64 -// CHECK: %[[I_VAR:.*]] = llvm.alloca %[[ONE_3]] x i32 {adapt.valuebyref, in_type = i32, operand_segment_sizes = array, pinned} : (i64) -> !llvm.ptr +// CHECK: %[[I_VAR:.*]] = llvm.alloca %[[ONE_3]] x i32 {adapt.valuebyref, in_type = i32, operandSegmentSizes = array, pinned} : (i64) -> !llvm.ptr // CHECK: %[[N:.*]] = llvm.load %[[N_REF]] : !llvm.ptr // CHECK: omp.wsloop nowait // CHECK-SAME: for (%[[I:.*]]) : i32 = (%[[ONE_2]]) to (%[[N]]) inclusive step (%[[ONE_2]]) { @@ -200,7 +200,7 @@ // CHECK: %[[ONE_2:.*]] = llvm.mlir.constant(1 : i32) : i32 // CHECK: omp.parallel { // CHECK: %[[ONE_3:.*]] = llvm.mlir.constant(1 : i64) : i64 -// CHECK: %[[I_VAR:.*]] = llvm.alloca %[[ONE_3]] x i32 {adapt.valuebyref, in_type = i32, operand_segment_sizes = array, pinned} : (i64) -> !llvm.ptr +// CHECK: %[[I_VAR:.*]] = llvm.alloca %[[ONE_3]] x i32 {adapt.valuebyref, in_type = i32, operandSegmentSizes = array, pinned} : (i64) -> !llvm.ptr // CHECK: %[[N:.*]] = llvm.load %[[N_REF]] : !llvm.ptr // CHECK: omp.simdloop // CHECK-SAME: (%[[I:.*]]) : i32 = (%[[ONE_2]]) to (%[[N]]) step (%[[ONE_2]]) { @@ -231,13 +231,13 @@ // CHECK-LABEL: llvm.func @_QPomp_target_data() { // CHECK: %[[VAL_0:.*]] = llvm.mlir.constant(1 : i64) : i64 -// CHECK: %[[VAL_1:.*]] = llvm.alloca %[[VAL_0]] x !llvm.array<1024 x i32> {bindc_name = "a", in_type = !fir.array<1024xi32>, operand_segment_sizes = array, uniq_name = "_QFomp_target_dataEa"} : (i64) -> !llvm.ptr> +// CHECK: %[[VAL_1:.*]] = llvm.alloca %[[VAL_0]] x !llvm.array<1024 x i32> {bindc_name = "a", in_type = !fir.array<1024xi32>, operandSegmentSizes = array, uniq_name = "_QFomp_target_dataEa"} : (i64) -> !llvm.ptr> // CHECK: %[[VAL_2:.*]] = llvm.mlir.constant(1 : i64) : i64 -// CHECK: %[[VAL_3:.*]] = llvm.alloca %[[VAL_2]] x !llvm.array<1024 x i32> {bindc_name = "b", in_type = !fir.array<1024xi32>, operand_segment_sizes = array, uniq_name = "_QFomp_target_dataEb"} : (i64) -> !llvm.ptr> +// CHECK: %[[VAL_3:.*]] = llvm.alloca %[[VAL_2]] x !llvm.array<1024 x i32> {bindc_name = "b", in_type = !fir.array<1024xi32>, operandSegmentSizes = array, uniq_name = "_QFomp_target_dataEb"} : (i64) -> !llvm.ptr> // CHECK: %[[VAL_4:.*]] = llvm.mlir.constant(1 : i64) : i64 -// CHECK: %[[VAL_5:.*]] = llvm.alloca %[[VAL_4]] x !llvm.array<1024 x i32> {bindc_name = "c", in_type = !fir.array<1024xi32>, operand_segment_sizes = array, uniq_name = "_QFomp_target_dataEc"} : (i64) -> !llvm.ptr> +// CHECK: %[[VAL_5:.*]] = llvm.alloca %[[VAL_4]] x !llvm.array<1024 x i32> {bindc_name = "c", in_type = !fir.array<1024xi32>, operandSegmentSizes = array, uniq_name = "_QFomp_target_dataEc"} : (i64) -> !llvm.ptr> // CHECK: %[[VAL_6:.*]] = llvm.mlir.constant(1 : i64) : i64 -// CHECK: %[[VAL_7:.*]] = llvm.alloca %[[VAL_6]] x !llvm.array<1024 x i32> {bindc_name = "d", in_type = !fir.array<1024xi32>, operand_segment_sizes = array, uniq_name = "_QFomp_target_dataEd"} : (i64) -> !llvm.ptr> +// CHECK: %[[VAL_7:.*]] = llvm.alloca %[[VAL_6]] x !llvm.array<1024 x i32> {bindc_name = "d", in_type = !fir.array<1024xi32>, operandSegmentSizes = array, uniq_name = "_QFomp_target_dataEd"} : (i64) -> !llvm.ptr> // CHECK: omp.target_enter_data map((to -> %[[VAL_1]] : !llvm.ptr>), (to -> %[[VAL_3]] : !llvm.ptr>), (always, alloc -> %[[VAL_5]] : !llvm.ptr>)) // CHECK: omp.target_exit_data map((from -> %[[VAL_1]] : !llvm.ptr>), (from -> %[[VAL_3]] : !llvm.ptr>), (release -> %[[VAL_5]] : !llvm.ptr>), (always, delete -> %[[VAL_7]] : !llvm.ptr>)) // CHECK: llvm.return @@ -278,9 +278,9 @@ // CHECK-LABEL: llvm.func @_QPopenmp_target_data_region() { // CHECK: %[[VAL_0:.*]] = llvm.mlir.constant(1 : i64) : i64 -// CHECK: %[[VAL_1:.*]] = llvm.alloca %[[VAL_0]] x !llvm.array<1024 x i32> {bindc_name = "a", in_type = !fir.array<1024xi32>, operand_segment_sizes = array, uniq_name = "_QFopenmp_target_data_regionEa"} : (i64) -> !llvm.ptr> +// CHECK: %[[VAL_1:.*]] = llvm.alloca %[[VAL_0]] x !llvm.array<1024 x i32> {bindc_name = "a", in_type = !fir.array<1024xi32>, operandSegmentSizes = array, uniq_name = "_QFopenmp_target_data_regionEa"} : (i64) -> !llvm.ptr> // CHECK: %[[VAL_2:.*]] = llvm.mlir.constant(1 : i64) : i64 -// CHECK: %[[VAL_3:.*]] = llvm.alloca %[[VAL_2]] x i32 {bindc_name = "i", in_type = i32, operand_segment_sizes = array, uniq_name = "_QFopenmp_target_data_regionEi"} : (i64) -> !llvm.ptr +// CHECK: %[[VAL_3:.*]] = llvm.alloca %[[VAL_2]] x i32 {bindc_name = "i", in_type = i32, operandSegmentSizes = array, uniq_name = "_QFopenmp_target_data_regionEi"} : (i64) -> !llvm.ptr // CHECK: omp.target_data map((tofrom -> %[[VAL_1]] : !llvm.ptr>)) { // CHECK: %[[VAL_4:.*]] = llvm.mlir.constant(1 : i32) : i32 // CHECK: %[[VAL_5:.*]] = llvm.sext %[[VAL_4]] : i32 to i64 @@ -351,7 +351,7 @@ // CHECK-LABEL: llvm.func @_QPomp_target() { // CHECK: %[[VAL_0:.*]] = llvm.mlir.constant(1 : i64) : i64 -// CHECK: %[[VAL_1:.*]] = llvm.alloca %[[VAL_0]] x !llvm.array<512 x i32> {bindc_name = "a", in_type = !fir.array<512xi32>, operand_segment_sizes = array, uniq_name = "_QFomp_targetEa"} : (i64) -> !llvm.ptr> +// CHECK: %[[VAL_1:.*]] = llvm.alloca %[[VAL_0]] x !llvm.array<512 x i32> {bindc_name = "a", in_type = !fir.array<512xi32>, operandSegmentSizes = array, uniq_name = "_QFomp_targetEa"} : (i64) -> !llvm.ptr> // CHECK: %[[VAL_2:.*]] = llvm.mlir.constant(64 : i32) : i32 // CHECK: omp.target thread_limit(%[[VAL_2]] : i32) map((tofrom -> %[[VAL_1]] : !llvm.ptr>)) { // CHECK: %[[VAL_3:.*]] = llvm.mlir.constant(10 : i32) : i32 @@ -557,7 +557,7 @@ // CHECK: llvm.func @_QPsb() { // CHECK: %[[ONE:.*]] = llvm.mlir.constant(1 : i32) : i32 // CHECK: %[[SIZE:.*]] = llvm.mlir.constant(1 : i64) : i64 -// CHECK: %[[LI_REF:.*]] = llvm.alloca %6 x i32 {bindc_name = "li", in_type = i32, operand_segment_sizes = array, uniq_name = "_QFsbEli"} : (i64) -> !llvm.ptr +// CHECK: %[[LI_REF:.*]] = llvm.alloca %6 x i32 {bindc_name = "li", in_type = i32, operandSegmentSizes = array, uniq_name = "_QFsbEli"} : (i64) -> !llvm.ptr // CHECK: omp.sections { // CHECK: omp.section { // CHECK: llvm.br ^[[BB_ENTRY:.*]]({{.*}}) @@ -595,7 +595,7 @@ // CHECK: } // CHECK-LABEL: @_QPsimple_reduction // CHECK-SAME: %[[ARRAY_REF:.*]]: !llvm.ptr> -// CHECK: %[[RED_ACCUMULATOR:.*]] = llvm.alloca %2 x i32 {bindc_name = "x", in_type = !fir.logical<4>, operand_segment_sizes = array, uniq_name = "_QFsimple_reductionEx"} : (i64) -> !llvm.ptr +// CHECK: %[[RED_ACCUMULATOR:.*]] = llvm.alloca %2 x i32 {bindc_name = "x", in_type = !fir.logical<4>, operandSegmentSizes = array, uniq_name = "_QFsimple_reductionEx"} : (i64) -> !llvm.ptr // CHECK: omp.parallel { // CHECK: omp.wsloop reduction(@[[EQV_REDUCTION]] -> %[[RED_ACCUMULATOR]] : !llvm.ptr) for // CHECK: %[[ARRAY_ELEM_REF:.*]] = llvm.getelementptr %[[ARRAY_REF]][0, %{{.*}}] : (!llvm.ptr>, i64) -> !llvm.ptr diff --git a/flang/test/Fir/convert-to-llvm.fir b/flang/test/Fir/convert-to-llvm.fir --- a/flang/test/Fir/convert-to-llvm.fir +++ b/flang/test/Fir/convert-to-llvm.fir @@ -1748,7 +1748,7 @@ // CHECK-LABEL: llvm.func @no_reassoc( // CHECK-SAME: %[[ARG0:.*]]: !llvm.ptr) { // CHECK: %[[C1:.*]] = llvm.mlir.constant(1 : i64) : i64 -// CHECK: %[[ALLOC:.*]] = llvm.alloca %[[C1]] x i32 {in_type = i32, operand_segment_sizes = array} : (i64) -> !llvm.ptr +// CHECK: %[[ALLOC:.*]] = llvm.alloca %[[C1]] x i32 {in_type = i32, operandSegmentSizes = array} : (i64) -> !llvm.ptr // CHECK: %[[LOAD:.*]] = llvm.load %[[ARG0]] : !llvm.ptr // CHECK: llvm.store %[[LOAD]], %[[ALLOC]] : !llvm.ptr // CHECK: llvm.return @@ -1868,7 +1868,7 @@ // CHECK: %[[C1_0:.*]] = llvm.mlir.constant(1 : i64) : i64 // CHECK: %[[ARR_SIZE_TMP1:.*]] = llvm.mul %[[C1_0]], %[[N1]] : i64 // CHECK: %[[ARR_SIZE:.*]] = llvm.mul %[[ARR_SIZE_TMP1]], %[[N2]] : i64 -// CHECK: %[[ARR:.*]] = llvm.alloca %[[ARR_SIZE]] x f64 {bindc_name = "arr", in_type = !fir.array, operand_segment_sizes = array, uniq_name = "_QFsbEarr"} : (i64) -> !llvm.ptr +// CHECK: %[[ARR:.*]] = llvm.alloca %[[ARR_SIZE]] x f64 {bindc_name = "arr", in_type = !fir.array, operandSegmentSizes = array, uniq_name = "_QFsbEarr"} : (i64) -> !llvm.ptr // CHECK: %[[TYPE_CODE:.*]] = llvm.mlir.constant(28 : i32) : i32 // CHECK: %[[NULL:.*]] = llvm.mlir.null : !llvm.ptr // CHECK: %[[GEP:.*]] = llvm.getelementptr %[[NULL]][1] @@ -1945,9 +1945,9 @@ // CHECK: %[[C10:.*]] = llvm.mlir.constant(10 : i64) : i64 // CHECK: %[[C2:.*]] = llvm.mlir.constant(2 : i64) : i64 // CHECK: %[[ALLOCA_SIZE_V:.*]] = llvm.mlir.constant(1 : i64) : i64 -// CHECK: %[[V:.*]] = llvm.alloca %[[ALLOCA_SIZE_V]] x i32 {bindc_name = "v", in_type = i32, operand_segment_sizes = array, uniq_name = "_QFtest_dt_sliceEv"} : (i64) -> !llvm.ptr +// CHECK: %[[V:.*]] = llvm.alloca %[[ALLOCA_SIZE_V]] x i32 {bindc_name = "v", in_type = i32, operandSegmentSizes = array, uniq_name = "_QFtest_dt_sliceEv"} : (i64) -> !llvm.ptr // CHECK: %[[ALLOCA_SIZE_X:.*]] = llvm.mlir.constant(1 : i64) : i64 -// CHECK: %[[X:.*]] = llvm.alloca %[[ALLOCA_SIZE_X]] x !llvm.array<20 x struct<"_QFtest_dt_sliceTt", (i32, i32)>> {bindc_name = "x", in_type = !fir.array<20x!fir.type<_QFtest_dt_sliceTt{i:i32,j:i32}>>, operand_segment_sizes = array, uniq_name = "_QFtest_dt_sliceEx"} : (i64) -> !llvm.ptr>> +// CHECK: %[[X:.*]] = llvm.alloca %[[ALLOCA_SIZE_X]] x !llvm.array<20 x struct<"_QFtest_dt_sliceTt", (i32, i32)>> {bindc_name = "x", in_type = !fir.array<20x!fir.type<_QFtest_dt_sliceTt{i:i32,j:i32}>>, operandSegmentSizes = array, uniq_name = "_QFtest_dt_sliceEx"} : (i64) -> !llvm.ptr>> // CHECK: %[[TYPE_CODE:.*]] = llvm.mlir.constant(9 : i32) : i32 // CHECK: %[[NULL:.*]] = llvm.mlir.null : !llvm.ptr // CHECK: %[[GEP:.*]] = llvm.getelementptr %[[NULL]][1] diff --git a/mlir/docs/PatternRewriter.md b/mlir/docs/PatternRewriter.md --- a/mlir/docs/PatternRewriter.md +++ b/mlir/docs/PatternRewriter.md @@ -383,7 +383,7 @@ ``` //===-------------------------------------------===// Processing operation : 'cf.cond_br'(0x60f000001120) { - "cf.cond_br"(%arg0)[^bb2, ^bb2] {operand_segment_sizes = array} : (i1) -> () + "cf.cond_br"(%arg0)[^bb2, ^bb2] {operandSegmentSizes = array} : (i1) -> () * Pattern SimplifyConstCondBranchPred : 'cf.cond_br -> ()' { } -> failure : pattern failed to match diff --git a/mlir/include/mlir/Dialect/IRDL/IR/IRDLOps.td b/mlir/include/mlir/Dialect/IRDL/IR/IRDLOps.td --- a/mlir/include/mlir/Dialect/IRDL/IR/IRDLOps.td +++ b/mlir/include/mlir/Dialect/IRDL/IR/IRDLOps.td @@ -234,7 +234,7 @@ and %3 is a variadic operand. When more than one operand is marked as optional or variadic, the operation - will expect a 'operand_segment_sizes' attribute that defines the number of + will expect a 'operandSegmentSizes' attribute that defines the number of operands in each segment. }]; @@ -280,7 +280,7 @@ and %3 is a variadic result. When more than one result is marked as optional or variadic, the operation - will expect a 'result_segment_sizes' attribute that defines the number of + will expect a 'resultSegmentSizes' attribute that defines the number of results in each segment. }]; diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td --- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td +++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td @@ -874,23 +874,6 @@ return cast(*this->getOperation()) .hasTensorSemantics(); } - - //========================================================================// - // Helper functions to mutate the `operand_segment_sizes` attribute. - // These are useful when cloning and changing operand types. - //========================================================================// - void setNumInputs(unsigned num) { setOperandSegmentAt(0, num); } - void setNumOutputBuffers(unsigned num) { setOperandSegmentAt(1, num); } - - private: - void setOperandSegmentAt(unsigned idx, unsigned val) { - auto attr = ::llvm::cast( - (*this)->getAttr("operand_segment_sizes")); - unsigned i = 0; - auto newAttr = attr.mapValues(IntegerType::get(getContext(), 32), - [&](const APInt &v) { return (i++ == idx) ? APInt(32, val) : v; }); - getOperation()->setAttr("operand_segment_sizes", newAttr); - } }]; let verify = [{ return detail::verifyStructuredOpInterface($_op); }]; diff --git a/mlir/include/mlir/IR/OpBase.td b/mlir/include/mlir/IR/OpBase.td --- a/mlir/include/mlir/IR/OpBase.td +++ b/mlir/include/mlir/IR/OpBase.td @@ -2178,7 +2178,7 @@ // to have the same array size. def SameVariadicResultSize : GenInternalOpTrait<"SameVariadicResultSize">; -// Uses an attribute named `operand_segment_sizes` to specify how many actual +// Uses an attribute named `operandSegmentSizes` to specify how many actual // operand each ODS-declared operand (variadic or not) corresponds to. // This trait is used for ops that have multiple variadic operands but do // not know statically their size relationship. The attribute must be a 1D @@ -2188,7 +2188,7 @@ def AttrSizedOperandSegments : NativeOpTrait<"AttrSizedOperandSegments">, StructuralOpTrait; // Similar to AttrSizedOperandSegments, but used for results. The attribute -// should be named as `result_segment_sizes`. +// should be named as `resultSegmentSizes`. def AttrSizedResultSegments : NativeOpTrait<"AttrSizedResultSegments">, StructuralOpTrait; diff --git a/mlir/include/mlir/IR/OpDefinition.h b/mlir/include/mlir/IR/OpDefinition.h --- a/mlir/include/mlir/IR/OpDefinition.h +++ b/mlir/include/mlir/IR/OpDefinition.h @@ -1331,7 +1331,7 @@ /// relationship is not always known statically. For such cases, we need /// a per-op-instance specification to divide the operands into logical groups /// or segments. This can be modeled by attributes. The attribute will be named -/// as `operand_segment_sizes`. +/// as `operandSegmentSizes`. /// /// This trait verifies the attribute for specifying operand segments has /// the correct type (1D vector) and values (non-negative), etc. @@ -1339,9 +1339,7 @@ class AttrSizedOperandSegments : public TraitBase { public: - static StringRef getOperandSegmentSizeAttr() { - return "operand_segment_sizes"; - } + static StringRef getOperandSegmentSizeAttr() { return "operandSegmentSizes"; } static LogicalResult verifyTrait(Operation *op) { return ::mlir::OpTrait::impl::verifyOperandSizeAttr( @@ -1354,7 +1352,7 @@ class AttrSizedResultSegments : public TraitBase { public: - static StringRef getResultSegmentSizeAttr() { return "result_segment_sizes"; } + static StringRef getResultSegmentSizeAttr() { return "resultSegmentSizes"; } static LogicalResult verifyTrait(Operation *op) { return ::mlir::OpTrait::impl::verifyResultSizeAttr( diff --git a/mlir/lib/Bindings/Python/IRCore.cpp b/mlir/lib/Bindings/Python/IRCore.cpp --- a/mlir/lib/Bindings/Python/IRCore.cpp +++ b/mlir/lib/Bindings/Python/IRCore.cpp @@ -1675,28 +1675,28 @@ } else { attributes = py::dict(); } - if (attributes->contains("result_segment_sizes") || - attributes->contains("operand_segment_sizes")) { - throw py::value_error("Manually setting a 'result_segment_sizes' or " - "'operand_segment_sizes' attribute is unsupported. " + if (attributes->contains("resultSegmentSizes") || + attributes->contains("operandSegmentSizes")) { + throw py::value_error("Manually setting a 'resultSegmentSizes' or " + "'operandSegmentSizes' attribute is unsupported. " "Use Operation.create for such low-level access."); } - // Add result_segment_sizes attribute. + // Add resultSegmentSizes attribute. if (!resultSegmentLengths.empty()) { MlirAttribute segmentLengthAttr = mlirDenseI32ArrayGet(context->get(), resultSegmentLengths.size(), resultSegmentLengths.data()); - (*attributes)["result_segment_sizes"] = + (*attributes)["resultSegmentSizes"] = PyAttribute(context, segmentLengthAttr); } - // Add operand_segment_sizes attribute. + // Add operandSegmentSizes attribute. if (!operandSegmentLengths.empty()) { MlirAttribute segmentLengthAttr = mlirDenseI32ArrayGet(context->get(), operandSegmentLengths.size(), operandSegmentLengths.data()); - (*attributes)["operand_segment_sizes"] = + (*attributes)["operandSegmentSizes"] = PyAttribute(context, segmentLengthAttr); } } diff --git a/mlir/lib/Dialect/AMDGPU/Transforms/EmulateAtomics.cpp b/mlir/lib/Dialect/AMDGPU/Transforms/EmulateAtomics.cpp --- a/mlir/lib/Dialect/AMDGPU/Transforms/EmulateAtomics.cpp +++ b/mlir/lib/Dialect/AMDGPU/Transforms/EmulateAtomics.cpp @@ -53,7 +53,7 @@ // Fix up the fact that, when we're migrating from a general bugffer atomic // to a load or to a CAS, the number of openrands, and thus the number of -// entries needed in operand_segment_sizes, needs to change. We use this method +// entries needed in operandSegmentSizes, needs to change. We use this method // because we'd like to preserve unknown attributes on the atomic instead of // discarding them. static void patchOperandSegmentSizes(ArrayRef attrs, @@ -61,7 +61,7 @@ DataArgAction action) { newAttrs.reserve(attrs.size()); for (NamedAttribute attr : attrs) { - if (attr.getName().getValue() != "operand_segment_sizes") { + if (attr.getName().getValue() != "operandSegmentSizes") { newAttrs.push_back(attr); continue; } diff --git a/mlir/lib/Dialect/Async/IR/Async.cpp b/mlir/lib/Dialect/Async/IR/Async.cpp --- a/mlir/lib/Dialect/Async/IR/Async.cpp +++ b/mlir/lib/Dialect/Async/IR/Async.cpp @@ -61,7 +61,7 @@ /// ExecuteOp //===----------------------------------------------------------------------===// -constexpr char kOperandSegmentSizesAttr[] = "operand_segment_sizes"; +constexpr char kOperandSegmentSizesAttr[] = "operandSegmentSizes"; OperandRange ExecuteOp::getSuccessorEntryOperands(std::optional index) { @@ -100,7 +100,7 @@ result.addOperands(dependencies); result.addOperands(operands); - // Add derived `operand_segment_sizes` attribute based on parsed operands. + // Add derived `operandSegmentSizes` attribute based on parsed operands. int32_t numDependencies = dependencies.size(); int32_t numOperands = operands.size(); auto operandSegmentSizes = @@ -208,7 +208,7 @@ int32_t numOperands = valueArgs.size(); - // Add derived `operand_segment_sizes` attribute based on parsed operands. + // Add derived `operandSegmentSizes` attribute based on parsed operands. auto operandSegmentSizes = parser.getBuilder().getDenseI32ArrayAttr({numDependencies, numOperands}); result.addAttribute(kOperandSegmentSizesAttr, operandSegmentSizes); diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp --- a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp +++ b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp @@ -170,7 +170,7 @@ state.addTypes(derivedResultTypes); state.addAttributes(attributes); state.addAttribute( - "operand_segment_sizes", + "operandSegmentSizes", b.getDenseI32ArrayAttr({static_cast(inputs.size()), static_cast(outputs.size())})); @@ -226,18 +226,18 @@ // This is a bit complex because we're trying to be backward compatible with // operation syntax that mix the inherent attributes and the discardable // ones in the same dictionary. If the properties are used, we append the - // operand_segment_sizes there directly. Otherwise we append it to the + // operandSegmentSizes there directly. Otherwise we append it to the // discardable attributes dictionary where it is handled by the generic // Operation::create(...) method. if (result.propertiesAttr) { NamedAttrList attrs = llvm::cast(result.propertiesAttr); - attrs.append("operand_segment_sizes", + attrs.append("operandSegmentSizes", parser.getBuilder().getDenseI32ArrayAttr( {static_cast(inputsOperands.size()), static_cast(outputsOperands.size())})); result.propertiesAttr = attrs.getDictionary(parser.getContext()); } else { - result.addAttribute("operand_segment_sizes", + result.addAttribute("operandSegmentSizes", parser.getBuilder().getDenseI32ArrayAttr( {static_cast(inputsOperands.size()), static_cast(outputsOperands.size())})); @@ -332,7 +332,7 @@ ValueRange inputs, ValueRange outputs) { p.printOptionalAttrDict( op->getAttrs(), - /*elidedAttrs=*/{"operand_segment_sizes", + /*elidedAttrs=*/{"operandSegmentSizes", // See generated code in // LinalgNamedStructuredOps.yamlgen.cpp.inc "linalg.memoized_indexing_maps"}); @@ -900,7 +900,7 @@ printCommonStructuredOpParts(p, SmallVector(getDpsInputOperands()), SmallVector(getDpsInitOperands())); - genericAttrNames.push_back("operand_segment_sizes"); + genericAttrNames.push_back("operandSegmentSizes"); genericAttrNamesSet.insert(genericAttrNames.back()); bool hasExtraAttrs = false; diff --git a/mlir/lib/Dialect/SCF/IR/SCF.cpp b/mlir/lib/Dialect/SCF/IR/SCF.cpp --- a/mlir/lib/Dialect/SCF/IR/SCF.cpp +++ b/mlir/lib/Dialect/SCF/IR/SCF.cpp @@ -1365,7 +1365,7 @@ result.addAttribute("staticLowerBound", staticLbs); result.addAttribute("staticUpperBound", staticUbs); result.addAttribute("staticStep", staticSteps); - result.addAttribute("operand_segment_sizes", + result.addAttribute("operandSegmentSizes", parser.getBuilder().getDenseI32ArrayAttr( {static_cast(dynamicLbs.size()), static_cast(dynamicUbs.size()), @@ -1400,7 +1400,7 @@ result.addAttribute(getStaticStepAttrName(result.name), b.getDenseI64ArrayAttr(staticSteps)); result.addAttribute( - "operand_segment_sizes", + "operandSegmentSizes", b.getDenseI32ArrayAttr({static_cast(dynamicLbs.size()), static_cast(dynamicUbs.size()), static_cast(dynamicSteps.size()), @@ -1601,7 +1601,7 @@ op.getOutputs(), std::nullopt, nullptr); newOp.getBodyRegion().getBlocks().clear(); // The new loop needs to keep all attributes from the old one, except for - // "operand_segment_sizes" and static loop bound attributes which capture + // "operandSegmentSizes" and static loop bound attributes which capture // the outdated information of the old iteration domain. SmallVector elidedAttrs{newOp.getOperandSegmentSizesAttrName(), newOp.getStaticLowerBoundAttrName(), @@ -2833,7 +2833,7 @@ if (parser.parseRegion(*body, ivs)) return failure(); - // Set `operand_segment_sizes` attribute. + // Set `operandSegmentSizes` attribute. result.addAttribute( ParallelOp::getOperandSegmentSizeAttr(), builder.getDenseI32ArrayAttr({static_cast(lower.size()), diff --git a/mlir/lib/Rewrite/ByteCode.cpp b/mlir/lib/Rewrite/ByteCode.cpp --- a/mlir/lib/Rewrite/ByteCode.cpp +++ b/mlir/lib/Rewrite/ByteCode.cpp @@ -1846,7 +1846,7 @@ ByteCodeField rangeIndex = read(); void *result = executeGetOperandsResults( - op->getOperands(), op, index, rangeIndex, "operand_segment_sizes", + op->getOperands(), op, index, rangeIndex, "operandSegmentSizes", valueRangeMemory); if (!result) LLVM_DEBUG(llvm::dbgs() << " * Invalid operand range\n"); @@ -1872,7 +1872,7 @@ ByteCodeField rangeIndex = read(); void *result = executeGetOperandsResults( - op->getResults(), op, index, rangeIndex, "result_segment_sizes", + op->getResults(), op, index, rangeIndex, "resultSegmentSizes", valueRangeMemory); if (!result) LLVM_DEBUG(llvm::dbgs() << " * Invalid result range\n"); diff --git a/mlir/test/Bytecode/operand_segment_sizes.mlir b/mlir/test/Bytecode/operand_segment_sizes.mlir --- a/mlir/test/Bytecode/operand_segment_sizes.mlir +++ b/mlir/test/Bytecode/operand_segment_sizes.mlir @@ -2,7 +2,7 @@ func.func @roundtripOperandSizeAttr(%arg0: i32) { - // CHECK: odsOperandSegmentSizes = array}> - "test.attr_sized_operands"(%arg0, %arg0, %arg0, %arg0) <{odsOperandSegmentSizes = array}> : (i32, i32, i32, i32) -> () + // CHECK: operandSegmentSizes = array}> + "test.attr_sized_operands"(%arg0, %arg0, %arg0, %arg0) <{operandSegmentSizes = array}> : (i32, i32, i32, i32) -> () return } 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 @@ -79,7 +79,7 @@ // CHECK: "test.payload"(%[[CAST_ARG6]], %[[CAST_ARG7]]) : (index, index) -> () "test.payload"(%arg6, %arg7) : (index, index) -> () omp.yield - }) {operand_segment_sizes = array} : (index, index, index, index, index, index) -> () + }) {operandSegmentSizes = array} : (index, index, index, index, index, index) -> () omp.terminator } return @@ -328,7 +328,7 @@ %5 = llvm.zext %2 : i1 to i32 llvm.store %5, %4 : !llvm.ptr omp.parallel { - %6 = llvm.alloca %3 x i32 {adapt.valuebyref, in_type = i32, operand_segment_sizes = array, pinned} : (i64) -> !llvm.ptr + %6 = llvm.alloca %3 x i32 {adapt.valuebyref, in_type = i32, operandSegmentSizes = array, pinned} : (i64) -> !llvm.ptr omp.wsloop reduction(@eqv_reduction -> %4 : !llvm.ptr) for (%arg1) : i32 = (%1) to (%0) inclusive step (%1) { llvm.store %arg1, %6 : !llvm.ptr %7 = llvm.load %6 : !llvm.ptr diff --git a/mlir/test/Dialect/GPU/invalid.mlir b/mlir/test/Dialect/GPU/invalid.mlir --- a/mlir/test/Dialect/GPU/invalid.mlir +++ b/mlir/test/Dialect/GPU/invalid.mlir @@ -4,7 +4,7 @@ // expected-error@+1 {{expected 6 or more operands, but found 5}} "gpu.launch"(%sz, %sz, %sz, %sz, %sz) ({ gpu.return - }) {operand_segment_sizes = array} : (index, index, index, index, index) -> () + }) {operandSegmentSizes = array} : (index, index, index, index, index) -> () return } @@ -16,7 +16,7 @@ ^bb1(%bx: index, %by: index, %bz: index, %tx: index, %ty: index, %tz: index): gpu.terminator - }) {operand_segment_sizes = array} : (index, index, index, index, index, index) -> () + }) {operandSegmentSizes = array} : (index, index, index, index, index, index) -> () return } @@ -38,7 +38,7 @@ func.func @launch_func_too_few_operands(%sz : index) { // expected-error@+1 {{expected 6 or more operands}} "gpu.launch_func"(%sz, %sz, %sz, %sz, %sz) - {operand_segment_sizes = array} + {operandSegmentSizes = array} : (index, index, index, index, index) -> () return } @@ -57,7 +57,7 @@ func.func @launch_func_missing_callee_attribute(%sz : index) { // expected-error@+1 {{'gpu.launch_func' op requires attribute 'kernel'}} "gpu.launch_func"(%sz, %sz, %sz, %sz, %sz, %sz) - {operand_segment_sizes = array} + {operandSegmentSizes = array} : (index, index, index, index, index, index) -> () return } diff --git a/mlir/test/Dialect/LLVMIR/invalid.mlir b/mlir/test/Dialect/LLVMIR/invalid.mlir --- a/mlir/test/Dialect/LLVMIR/invalid.mlir +++ b/mlir/test/Dialect/LLVMIR/invalid.mlir @@ -887,7 +887,7 @@ func.func @switch_case_type_mismatch(%arg0 : i64) { // expected-error@below {{expects case value type to match condition value type}} - "llvm.switch"(%arg0)[^bb1, ^bb2] <{case_operand_segments = array, case_values = dense<42> : vector<1xi32>, odsOperandSegmentSizes = array}> : (i64) -> () + "llvm.switch"(%arg0)[^bb1, ^bb2] <{case_operand_segments = array, case_values = dense<42> : vector<1xi32>, operandSegmentSizes = array}> : (i64) -> () ^bb1: // pred: ^bb0 llvm.return ^bb2: // pred: ^bb0 diff --git a/mlir/test/Dialect/Linalg/named-ops.mlir b/mlir/test/Dialect/Linalg/named-ops.mlir --- a/mlir/test/Dialect/Linalg/named-ops.mlir +++ b/mlir/test/Dialect/Linalg/named-ops.mlir @@ -178,7 +178,7 @@ // ----- func.func @depthwise_conv_2d_input_nhwc_filter_wrong_stride_element_type_properties(%input: memref<1x113x113x96xf32>, %filter: memref<3x3x96xf32>, %output: memref<1x56x56x96xf32>) { - // expected-error @+1 {{invalid properties {dilations = dense<1> : vector<2xi64>, operand_segment_sizes = array, strides = dense<2.000000e+00> : vector<2xf32>} for op linalg.depthwise_conv_2d_nhwc_hwc: Invalid attribute `strides` in property conversion: dense<2.000000e+00> : vector<2xf32>}} + // expected-error @+1 {{invalid properties {dilations = dense<1> : vector<2xi64>, operandSegmentSizes = array, strides = dense<2.000000e+00> : vector<2xf32>} for op linalg.depthwise_conv_2d_nhwc_hwc: Invalid attribute `strides` in property conversion: dense<2.000000e+00> : vector<2xf32>}} linalg.depthwise_conv_2d_nhwc_hwc <{dilations = dense<1> : vector<2xi64>, strides = dense<2.0> : vector<2xf32>}> ins(%input, %filter: memref<1x113x113x96xf32>, memref<3x3x96xf32>) outs(%output: memref<1x56x56x96xf32>) @@ -1100,7 +1100,7 @@ %1 = "arith.mulf"(%arg3, %arg4) : (f32, f32) -> f32 %2 = "arith.addf"(%arg5, %1) : (f32, f32) -> f32 "linalg.yield"(%2) : (f32) -> () - }) {dilations = dense<1> : tensor<2xi64>, linalg.memoized_indexing_maps = [#map0, #map1, #map2], operand_segment_sizes = array, strides = dense<2> : tensor<2xi64>} : (tensor, tensor, tensor) -> tensor + }) {dilations = dense<1> : tensor<2xi64>, linalg.memoized_indexing_maps = [#map0, #map1, #map2], operandSegmentSizes = array, strides = dense<2> : tensor<2xi64>} : (tensor, tensor, tensor) -> tensor return %0 : tensor } @@ -1117,7 +1117,7 @@ %1 = "arith.mulf"(%arg3, %arg4) : (f32, f32) -> f32 %2 = "arith.addf"(%arg5, %1) : (f32, f32) -> f32 "linalg.yield"(%2) : (f32) -> () - }) {dilations = dense<1> : tensor<2xi64>, linalg.memoized_indexing_maps = [#map0, #map1, #map2], operand_segment_sizes = array, strides = dense<1> : tensor<2xi64>} : (tensor, tensor, tensor) -> tensor + }) {dilations = dense<1> : tensor<2xi64>, linalg.memoized_indexing_maps = [#map0, #map1, #map2], operandSegmentSizes = array, strides = dense<1> : tensor<2xi64>} : (tensor, tensor, tensor) -> tensor return %0 : tensor } 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 @@ -197,7 +197,7 @@ "omp.simdloop" (%lb, %ub, %step) ({ ^bb0(%iv: index): omp.yield - }) {operand_segment_sizes = array} : + }) {operandSegmentSizes = array} : (index, index, i32) -> () return @@ -225,7 +225,7 @@ ^bb0(%arg5: index): "omp.yield"() : () -> () }) {alignment_values = [128], - operand_segment_sizes = array} : (index, index, index, memref, memref) -> () + operandSegmentSizes = array} : (index, index, index, memref, memref) -> () return } @@ -238,7 +238,7 @@ "omp.simdloop"(%arg0, %arg1, %arg2, %arg3, %arg4) ({ ^bb0(%arg5: index): "omp.yield"() : () -> () - }) {alignment_values = [-1, 128], operand_segment_sizes = array} : (index, index, index, memref, memref) -> () + }) {alignment_values = [-1, 128], operandSegmentSizes = array} : (index, index, index, memref, memref) -> () return } @@ -251,7 +251,7 @@ "omp.simdloop"(%arg0, %arg1, %arg2) ({ ^bb0(%arg5: index): "omp.yield"() : () -> () - }) {alignment_values = [1, 128], operand_segment_sizes = array} : (index, index, index) -> () + }) {alignment_values = [1, 128], operandSegmentSizes = array} : (index, index, index) -> () return } @@ -264,7 +264,7 @@ "omp.simdloop"(%arg0, %arg1, %arg2, %arg3, %arg4) ({ ^bb0(%arg5: index): "omp.yield"() : () -> () - }) {alignment_values = [1.5, 128], operand_segment_sizes = array} : (index, index, index, memref, memref) -> () + }) {alignment_values = [1.5, 128], operandSegmentSizes = array} : (index, index, index, memref, memref) -> () return } @@ -277,7 +277,7 @@ "omp.simdloop"(%arg0, %arg1, %arg2, %arg3, %arg3) ({ ^bb0(%arg5: index): "omp.yield"() : () -> () - }) {alignment_values = [1, 128], operand_segment_sizes = array} : (index, index, index, memref, memref) -> () + }) {alignment_values = [1, 128], operandSegmentSizes = array} : (index, index, index, memref, memref) -> () return } @@ -291,7 +291,7 @@ "omp.simdloop"(%arg0, %arg1, %arg2, %arg3, %arg3) ({ ^bb0(%arg5: index): "omp.yield"() : () -> () - }) {operand_segment_sizes = array} : (index, index, index, memref, memref) -> () + }) {operandSegmentSizes = array} : (index, index, index, memref, memref) -> () return } @@ -1121,7 +1121,7 @@ // expected-error @below {{expected equal sizes for allocate and allocator variables}} "omp.teams" (%data_var) ({ omp.terminator - }) {operand_segment_sizes = array} : (memref) -> () + }) {operandSegmentSizes = array} : (memref) -> () omp.terminator } return @@ -1134,7 +1134,7 @@ // expected-error @below {{expected num_teams upper bound to be defined if the lower bound is defined}} "omp.teams" (%lb) ({ omp.terminator - }) {operand_segment_sizes = array} : (i32) -> () + }) {operandSegmentSizes = array} : (i32) -> () omp.terminator } return @@ -1159,7 +1159,7 @@ // expected-error @below {{expected equal sizes for allocate and allocator variables}} "omp.sections" (%data_var) ({ omp.terminator - }) {operand_segment_sizes = array} : (memref) -> () + }) {operandSegmentSizes = array} : (memref) -> () return } @@ -1169,7 +1169,7 @@ // expected-error @below {{expected as many reduction symbol references as reduction variables}} "omp.sections" (%data_var) ({ omp.terminator - }) {operand_segment_sizes = array} : (memref) -> () + }) {operandSegmentSizes = array} : (memref) -> () return } @@ -1284,7 +1284,7 @@ // expected-error @below {{expected equal sizes for allocate and allocator variables}} "omp.single" (%data_var) ({ omp.barrier - }) {operand_segment_sizes = array} : (memref) -> () + }) {operandSegmentSizes = array} : (memref) -> () return } @@ -1294,7 +1294,7 @@ // expected-error @below {{op expected as many depend values as depend variables}} "omp.task"(%data_var) ({ "omp.terminator"() : () -> () - }) {depends = [], operand_segment_sizes = array} : (memref) -> () + }) {depends = [], operandSegmentSizes = array} : (memref) -> () "func.return"() : () -> () } @@ -1486,7 +1486,7 @@ "omp.taskloop"(%lb, %ub, %ub, %lb, %step, %step, %testmemref) ({ ^bb0(%arg3: i32, %arg4: i32): "omp.terminator"() : () -> () - }) {operand_segment_sizes = array} : (i32, i32, i32, i32, i32, i32, memref) -> () + }) {operandSegmentSizes = array} : (i32, i32, i32, i32, i32, i32, memref) -> () return } @@ -1499,7 +1499,7 @@ "omp.taskloop"(%lb, %ub, %ub, %lb, %step, %step, %testf32, %testf32_2) ({ ^bb0(%arg3: i32, %arg4: i32): "omp.terminator"() : () -> () - }) {operand_segment_sizes = array, reductions = [@add_f32]} : (i32, i32, i32, i32, i32, i32, !llvm.ptr, !llvm.ptr) -> () + }) {operandSegmentSizes = array, reductions = [@add_f32]} : (i32, i32, i32, i32, i32, i32, !llvm.ptr, !llvm.ptr) -> () return } @@ -1512,7 +1512,7 @@ "omp.taskloop"(%lb, %ub, %ub, %lb, %step, %step, %testf32) ({ ^bb0(%arg3: i32, %arg4: i32): "omp.terminator"() : () -> () - }) {operand_segment_sizes = array, reductions = [@add_f32, @add_f32]} : (i32, i32, i32, i32, i32, i32, !llvm.ptr) -> () + }) {operandSegmentSizes = array, reductions = [@add_f32, @add_f32]} : (i32, i32, i32, i32, i32, i32, !llvm.ptr) -> () return } @@ -1525,7 +1525,7 @@ "omp.taskloop"(%lb, %ub, %ub, %lb, %step, %step, %testf32, %testf32_2) ({ ^bb0(%arg3: i32, %arg4: i32): "omp.terminator"() : () -> () - }) {in_reductions = [@add_f32], operand_segment_sizes = array} : (i32, i32, i32, i32, i32, i32, !llvm.ptr, !llvm.ptr) -> () + }) {in_reductions = [@add_f32], operandSegmentSizes = array} : (i32, i32, i32, i32, i32, i32, !llvm.ptr, !llvm.ptr) -> () return } @@ -1538,7 +1538,7 @@ "omp.taskloop"(%lb, %ub, %ub, %lb, %step, %step, %testf32_2) ({ ^bb0(%arg3: i32, %arg4: i32): "omp.terminator"() : () -> () - }) {in_reductions = [@add_f32, @add_f32], operand_segment_sizes = array} : (i32, i32, i32, i32, i32, i32, !llvm.ptr) -> () + }) {in_reductions = [@add_f32, @add_f32], operandSegmentSizes = array} : (i32, i32, i32, i32, i32, i32, !llvm.ptr) -> () return } 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 @@ -59,7 +59,7 @@ // CHECK: omp.parallel num_threads(%{{.*}} : i32) allocate(%{{.*}} : memref -> %{{.*}} : memref) "omp.parallel"(%num_threads, %data_var, %data_var) ({ omp.terminator - }) {operand_segment_sizes = array} : (i32, memref, memref) -> () + }) {operandSegmentSizes = array} : (i32, memref, memref) -> () // CHECK: omp.barrier omp.barrier @@ -68,22 +68,22 @@ // CHECK: omp.parallel if(%{{.*}}) allocate(%{{.*}} : memref -> %{{.*}} : memref) "omp.parallel"(%if_cond, %data_var, %data_var) ({ omp.terminator - }) {operand_segment_sizes = array} : (i1, memref, memref) -> () + }) {operandSegmentSizes = array} : (i1, memref, memref) -> () // test without allocate // CHECK: omp.parallel if(%{{.*}}) num_threads(%{{.*}} : i32) "omp.parallel"(%if_cond, %num_threads) ({ omp.terminator - }) {operand_segment_sizes = array} : (i1, i32) -> () + }) {operandSegmentSizes = array} : (i1, i32) -> () omp.terminator - }) {operand_segment_sizes = array, proc_bind_val = #omp} : (i1, i32, memref, memref) -> () + }) {operandSegmentSizes = array, proc_bind_val = #omp} : (i1, i32, memref, memref) -> () // test with multiple parameters for single variadic argument // CHECK: omp.parallel allocate(%{{.*}} : memref -> %{{.*}} : memref) "omp.parallel" (%data_var, %data_var) ({ omp.terminator - }) {operand_segment_sizes = array} : (memref, memref) -> () + }) {operandSegmentSizes = array} : (memref, memref) -> () return } @@ -141,7 +141,7 @@ "omp.wsloop" (%lb, %ub, %step) ({ ^bb0(%iv: index): omp.yield - }) {operand_segment_sizes = array, ordered_val = 1} : + }) {operandSegmentSizes = array, ordered_val = 1} : (index, index, index) -> () // CHECK: omp.wsloop linear(%{{.*}} = %{{.*}} : memref) schedule(static) @@ -149,7 +149,7 @@ "omp.wsloop" (%lb, %ub, %step, %data_var, %linear_var) ({ ^bb0(%iv: index): omp.yield - }) {operand_segment_sizes = array, schedule_val = #omp} : + }) {operandSegmentSizes = array, schedule_val = #omp} : (index, index, index, memref, i32) -> () // CHECK: omp.wsloop linear(%{{.*}} = %{{.*}} : memref, %{{.*}} = %{{.*}} : memref) schedule(static) @@ -157,7 +157,7 @@ "omp.wsloop" (%lb, %ub, %step, %data_var, %data_var, %linear_var, %linear_var) ({ ^bb0(%iv: index): omp.yield - }) {operand_segment_sizes = array, schedule_val = #omp} : + }) {operandSegmentSizes = array, schedule_val = #omp} : (index, index, index, memref, memref, i32, i32) -> () // CHECK: omp.wsloop linear(%{{.*}} = %{{.*}} : memref) schedule(dynamic = %{{.*}}) ordered(2) @@ -165,7 +165,7 @@ "omp.wsloop" (%lb, %ub, %step, %data_var, %linear_var, %chunk_var) ({ ^bb0(%iv: index): omp.yield - }) {operand_segment_sizes = array, schedule_val = #omp, ordered_val = 2} : + }) {operandSegmentSizes = array, schedule_val = #omp, ordered_val = 2} : (index, index, index, memref, i32, i32) -> () // CHECK: omp.wsloop schedule(auto) nowait @@ -173,7 +173,7 @@ "omp.wsloop" (%lb, %ub, %step) ({ ^bb0(%iv: index): omp.yield - }) {operand_segment_sizes = array, nowait, schedule_val = #omp} : + }) {operandSegmentSizes = array, nowait, schedule_val = #omp} : (index, index, index) -> () return @@ -333,7 +333,7 @@ "omp.simdloop" (%lb, %ub, %step) ({ ^bb0(%iv: index): omp.yield - }) {operand_segment_sizes = array} : + }) {operandSegmentSizes = array} : (index, index, index) -> () return @@ -349,7 +349,7 @@ ^bb0(%arg5: index): "omp.yield"() : () -> () }) {alignment_values = [32, 128], - operand_segment_sizes = array} : (index, index, index, memref, memref) -> () + operandSegmentSizes = array} : (index, index, index, memref, memref) -> () return } @@ -362,7 +362,7 @@ ^bb0(%arg5: index): "omp.yield"() : () -> () }) {alignment_values = [32], - operand_segment_sizes = array} : (index, index, index, memref) -> () + operandSegmentSizes = array} : (index, index, index, memref) -> () return } @@ -377,7 +377,7 @@ "omp.simdloop"(%arg0, %arg1, %arg2, %arg3, %arg4) ({ ^bb0(%arg5: index): "omp.yield"() : () -> () - }) {operand_segment_sizes = array} : (index, index, index, memref, memref) -> () + }) {operandSegmentSizes = array} : (index, index, index, memref, memref) -> () return } @@ -392,7 +392,7 @@ "omp.simdloop"(%arg0, %arg1, %arg2, %arg3) ({ ^bb0(%arg5: index): "omp.yield"() : () -> () - }) {operand_segment_sizes = array} : (index, index, index, memref) -> () + }) {operandSegmentSizes = array} : (index, index, index, memref) -> () return } @@ -487,7 +487,7 @@ "omp.target"(%if_cond, %device, %num_threads) ({ // CHECK: omp.terminator omp.terminator - }) {nowait, operand_segment_sizes = array} : ( i1, si32, i32 ) -> () + }) {nowait, operandSegmentSizes = array} : ( i1, si32, i32 ) -> () // Test with optional map clause. // CHECK: omp.target map((tofrom -> %{{.*}} : memref), (alloc -> %{{.*}} : memref)) { @@ -1428,13 +1428,13 @@ "omp.sections" (%data_var1, %data_var1) ({ // CHECK: omp.terminator omp.terminator - }) {operand_segment_sizes = array} : (memref, memref) -> () + }) {operandSegmentSizes = array} : (memref, memref) -> () // CHECK: omp.sections reduction(@add_f32 -> %{{.*}} : !llvm.ptr) "omp.sections" (%redn_var) ({ // CHECK: omp.terminator omp.terminator - }) {operand_segment_sizes = array, reductions=[@add_f32]} : (!llvm.ptr) -> () + }) {operandSegmentSizes = array, reductions=[@add_f32]} : (!llvm.ptr) -> () // CHECK: omp.sections nowait { omp.sections nowait { diff --git a/mlir/test/Dialect/PDL/invalid.mlir b/mlir/test/Dialect/PDL/invalid.mlir --- a/mlir/test/Dialect/PDL/invalid.mlir +++ b/mlir/test/Dialect/PDL/invalid.mlir @@ -122,7 +122,7 @@ // expected-error@below {{expected the same number of attribute values and attribute names, got 1 names and 0 values}} %op = "pdl.operation"() { attributeValueNames = ["attr"], - operand_segment_sizes = array + operandSegmentSizes = array } : () -> (!pdl.operation) rewrite %op with "rewriter" } @@ -230,7 +230,7 @@ // expected-error@below {{expected no replacement values to be provided when the replacement operation is present}} "pdl.replace"(%root, %newOp, %newResult) { - operand_segment_sizes = array + operandSegmentSizes = array } : (!pdl.operation, !pdl.operation, !pdl.value) -> () } } @@ -276,7 +276,7 @@ // expected-error@below {{expected rewrite region to be non-empty if external name is not specified}} "pdl.rewrite"(%op) ({}) { - operand_segment_sizes = array + operandSegmentSizes = array } : (!pdl.operation) -> () } @@ -289,7 +289,7 @@ "pdl.rewrite"(%op, %op) ({ ^bb1: }) { - operand_segment_sizes = array + operandSegmentSizes = array }: (!pdl.operation, !pdl.operation) -> () } @@ -303,7 +303,7 @@ ^bb1: }) { name = "foo", - operand_segment_sizes = array + operandSegmentSizes = array } : (!pdl.operation) -> () } diff --git a/mlir/test/Dialect/PDLInterp/invalid.mlir b/mlir/test/Dialect/PDLInterp/invalid.mlir --- a/mlir/test/Dialect/PDLInterp/invalid.mlir +++ b/mlir/test/Dialect/PDLInterp/invalid.mlir @@ -19,7 +19,7 @@ inferredResultTypes, inputAttributeNames = [], name = "foo.op", - operand_segment_sizes = array + operandSegmentSizes = array } : (!pdl.type) -> (!pdl.operation) pdl_interp.finalize } diff --git a/mlir/test/Dialect/SCF/invalid.mlir b/mlir/test/Dialect/SCF/invalid.mlir --- a/mlir/test/Dialect/SCF/invalid.mlir +++ b/mlir/test/Dialect/SCF/invalid.mlir @@ -139,7 +139,7 @@ "scf.parallel"(%arg0, %arg1, %arg2) ({ ^bb0(%i0: f32): scf.yield - }) {operand_segment_sizes = array}: (index, index, index) -> () + }) {operandSegmentSizes = array}: (index, index, index) -> () return } @@ -151,7 +151,7 @@ "scf.parallel"(%arg0, %arg1, %arg2) ({ ^bb0(%i0: index, %i1: index): scf.yield - }) {operand_segment_sizes = array}: (index, index, index) -> () + }) {operandSegmentSizes = array}: (index, index, index) -> () return } @@ -689,7 +689,7 @@ ^bb0(%arg1: index): // expected-note @below {{terminator here}} %2 = "arith.constant"() {value = 1.000000e+00 : f32} : () -> f32 - }) {operand_segment_sizes = array} : (index, index, index) -> () + }) {operandSegmentSizes = array} : (index, index, index) -> () return } diff --git a/mlir/test/Dialect/SPIRV/IR/control-flow-ops.mlir b/mlir/test/Dialect/SPIRV/IR/control-flow-ops.mlir --- a/mlir/test/Dialect/SPIRV/IR/control-flow-ops.mlir +++ b/mlir/test/Dialect/SPIRV/IR/control-flow-ops.mlir @@ -117,7 +117,7 @@ func.func @wrong_accessor_count() -> () { %true = spirv.Constant true // expected-error @+1 {{requires 2 successors but found 1}} - "spirv.BranchConditional"(%true)[^one] {operand_segment_sizes = array} : (i1) -> () + "spirv.BranchConditional"(%true)[^one] {operandSegmentSizes = array} : (i1) -> () ^one: spirv.Return ^two: @@ -130,7 +130,7 @@ %true = spirv.Constant true // expected-error @+1 {{must have exactly two branch weights}} "spirv.BranchConditional"(%true)[^one, ^two] {branch_weights = [1 : i32, 2 : i32, 3 : i32], - operand_segment_sizes = array} : (i1) -> () + operandSegmentSizes = array} : (i1) -> () ^one: spirv.Return ^two: diff --git a/mlir/test/Dialect/Transform/ops-invalid.mlir b/mlir/test/Dialect/Transform/ops-invalid.mlir --- a/mlir/test/Dialect/Transform/ops-invalid.mlir +++ b/mlir/test/Dialect/Transform/ops-invalid.mlir @@ -76,7 +76,7 @@ "transform.sequence"(%0) ({ ^bb0(%arg0: !transform.any_op): "transform.yield"() : () -> () -}) {failure_propagation_mode = 1 : i32, operand_segment_sizes = array} : (!transform.any_op) -> () +}) {failure_propagation_mode = 1 : i32, operandSegmentSizes = array} : (!transform.any_op) -> () // ----- diff --git a/mlir/test/IR/parser.mlir b/mlir/test/IR/parser.mlir --- a/mlir/test/IR/parser.mlir +++ b/mlir/test/IR/parser.mlir @@ -460,7 +460,7 @@ ^bb1(%x : i1, %y : i17): // CHECK: cf.cond_br %{{.*}}, ^bb2(%{{.*}} : i17), ^bb3(%{{.*}}, %{{.*}} : i1, i17) - "cf.cond_br"(%x, %y, %x, %y) [^bb2, ^bb3] {operand_segment_sizes = array} : (i1, i17, i1, i17) -> () + "cf.cond_br"(%x, %y, %x, %y) [^bb2, ^bb3] {operandSegmentSizes = array} : (i1, i17, i1, i17) -> () ^bb2(%a : i17): %true = arith.constant true diff --git a/mlir/test/IR/traits.mlir b/mlir/test/IR/traits.mlir --- a/mlir/test/IR/traits.mlir +++ b/mlir/test/IR/traits.mlir @@ -383,101 +383,101 @@ // ----- func.func @failedMissingOperandSizeAttr(%arg: i32) { - // expected-error @+1 {{op operand count (4) does not match with the total size (0) specified in attribute 'operand_segment_sizes'}} + // expected-error @+1 {{op operand count (4) does not match with the total size (0) specified in attribute 'operandSegmentSizes'}} "test.attr_sized_operands"(%arg, %arg, %arg, %arg) : (i32, i32, i32, i32) -> () } // ----- func.func @failedOperandSizeAttrWrongType(%arg: i32) { - // expected-error @+1 {{op operand count (4) does not match with the total size (0) specified in attribute 'operand_segment_sizes'}} - "test.attr_sized_operands"(%arg, %arg, %arg, %arg) {operand_segment_sizes = 10} : (i32, i32, i32, i32) -> () + // expected-error @+1 {{op operand count (4) does not match with the total size (0) specified in attribute 'operandSegmentSizes'}} + "test.attr_sized_operands"(%arg, %arg, %arg, %arg) {operandSegmentSizes = 10} : (i32, i32, i32, i32) -> () } // ----- func.func @failedOperandSizeAttrWrongElementType(%arg: i32) { - // expected-error @+1 {{op operand count (4) does not match with the total size (0) specified in attribute 'operand_segment_sizes'}} - "test.attr_sized_operands"(%arg, %arg, %arg, %arg) {operand_segment_sizes = array} : (i32, i32, i32, i32) -> () + // expected-error @+1 {{op operand count (4) does not match with the total size (0) specified in attribute 'operandSegmentSizes'}} + "test.attr_sized_operands"(%arg, %arg, %arg, %arg) {operandSegmentSizes = array} : (i32, i32, i32, i32) -> () } // ----- func.func @failedOperandSizeAttrNegativeValue(%arg: i32) { - // expected-error @+1 {{'operand_segment_sizes' attribute cannot have negative elements}} - "test.attr_sized_operands"(%arg, %arg, %arg, %arg) {operand_segment_sizes = array} : (i32, i32, i32, i32) -> () + // expected-error @+1 {{'operandSegmentSizes' attribute cannot have negative elements}} + "test.attr_sized_operands"(%arg, %arg, %arg, %arg) {operandSegmentSizes = array} : (i32, i32, i32, i32) -> () } // ----- func.func @failedOperandSizeAttrWrongTotalSize(%arg: i32) { - // expected-error @+1 {{operand count (4) does not match with the total size (3) specified in attribute 'operand_segment_sizes'}} - "test.attr_sized_operands"(%arg, %arg, %arg, %arg) {operand_segment_sizes = array} : (i32, i32, i32, i32) -> () + // expected-error @+1 {{operand count (4) does not match with the total size (3) specified in attribute 'operandSegmentSizes'}} + "test.attr_sized_operands"(%arg, %arg, %arg, %arg) {operandSegmentSizes = array} : (i32, i32, i32, i32) -> () } // ----- func.func @failedOperandSizeAttrWrongCount(%arg: i32) { - // expected-error @+1 {{test.attr_sized_operands' op operand count (4) does not match with the total size (0) specified in attribute 'operand_segment_sizes}} - "test.attr_sized_operands"(%arg, %arg, %arg, %arg) {operand_segment_sizes = array} : (i32, i32, i32, i32) -> () + // expected-error @+1 {{test.attr_sized_operands' op operand count (4) does not match with the total size (0) specified in attribute 'operandSegmentSizes}} + "test.attr_sized_operands"(%arg, %arg, %arg, %arg) {operandSegmentSizes = array} : (i32, i32, i32, i32) -> () } // ----- func.func @succeededOperandSizeAttr(%arg: i32) { // CHECK: test.attr_sized_operands - "test.attr_sized_operands"(%arg, %arg, %arg, %arg) {operand_segment_sizes = array} : (i32, i32, i32, i32) -> () + "test.attr_sized_operands"(%arg, %arg, %arg, %arg) {operandSegmentSizes = array} : (i32, i32, i32, i32) -> () return } // ----- func.func @failedMissingResultSizeAttr() { - // expected-error @+1 {{op result count (4) does not match with the total size (0) specified in attribute 'result_segment_sizes'}} + // expected-error @+1 {{op result count (4) does not match with the total size (0) specified in attribute 'resultSegmentSizes'}} %0:4 = "test.attr_sized_results"() : () -> (i32, i32, i32, i32) } // ----- func.func @failedResultSizeAttrWrongType() { - // expected-error @+1 {{ op result count (4) does not match with the total size (0) specified in attribute 'result_segment_sizes'}} - %0:4 = "test.attr_sized_results"() {result_segment_sizes = 10} : () -> (i32, i32, i32, i32) + // expected-error @+1 {{ op result count (4) does not match with the total size (0) specified in attribute 'resultSegmentSizes'}} + %0:4 = "test.attr_sized_results"() {resultSegmentSizes = 10} : () -> (i32, i32, i32, i32) } // ----- func.func @failedResultSizeAttrWrongElementType() { - // expected-error @+1 {{ op result count (4) does not match with the total size (0) specified in attribute 'result_segment_sizes'}} - %0:4 = "test.attr_sized_results"() {result_segment_sizes = array} : () -> (i32, i32, i32, i32) + // expected-error @+1 {{ op result count (4) does not match with the total size (0) specified in attribute 'resultSegmentSizes'}} + %0:4 = "test.attr_sized_results"() {resultSegmentSizes = array} : () -> (i32, i32, i32, i32) } // ----- func.func @failedResultSizeAttrNegativeValue() { - // expected-error @+1 {{'result_segment_sizes' attribute cannot have negative elements}} - %0:4 = "test.attr_sized_results"() {result_segment_sizes = array} : () -> (i32, i32, i32, i32) + // expected-error @+1 {{'resultSegmentSizes' attribute cannot have negative elements}} + %0:4 = "test.attr_sized_results"() {resultSegmentSizes = array} : () -> (i32, i32, i32, i32) } // ----- func.func @failedResultSizeAttrWrongTotalSize() { - // expected-error @+1 {{result count (4) does not match with the total size (3) specified in attribute 'result_segment_sizes'}} - %0:4 = "test.attr_sized_results"() {result_segment_sizes = array} : () -> (i32, i32, i32, i32) + // expected-error @+1 {{result count (4) does not match with the total size (3) specified in attribute 'resultSegmentSizes'}} + %0:4 = "test.attr_sized_results"() {resultSegmentSizes = array} : () -> (i32, i32, i32, i32) } // ----- func.func @failedResultSizeAttrWrongCount() { - // expected-error @+1 {{ op result count (4) does not match with the total size (0) specified in attribute 'result_segment_sizes'}} - %0:4 = "test.attr_sized_results"() {result_segment_sizes = array} : () -> (i32, i32, i32, i32) + // expected-error @+1 {{ op result count (4) does not match with the total size (0) specified in attribute 'resultSegmentSizes'}} + %0:4 = "test.attr_sized_results"() {resultSegmentSizes = array} : () -> (i32, i32, i32, i32) } // ----- func.func @succeededResultSizeAttr() { // CHECK: test.attr_sized_results - %0:4 = "test.attr_sized_results"() {result_segment_sizes = array} : () -> (i32, i32, i32, i32) + %0:4 = "test.attr_sized_results"() {resultSegmentSizes = array} : () -> (i32, i32, i32, i32) return } diff --git a/mlir/test/Rewrite/pdl-bytecode.mlir b/mlir/test/Rewrite/pdl-bytecode.mlir --- a/mlir/test/Rewrite/pdl-bytecode.mlir +++ b/mlir/test/Rewrite/pdl-bytecode.mlir @@ -1093,7 +1093,7 @@ // CHECK-NEXT: "test.success"(%[[INPUTS]]#4) : (i32) -> () module @ir attributes { test.get_operands_2 } { %inputs:5 = "test.producer"() : () -> (i32, i32, i32, i32, i32) - "test.attr_sized_operands"(%inputs#0, %inputs#1, %inputs#2, %inputs#3, %inputs#4) {operand_segment_sizes = array} : (i32, i32, i32, i32, i32) -> () + "test.attr_sized_operands"(%inputs#0, %inputs#1, %inputs#2, %inputs#3, %inputs#4) {operandSegmentSizes = array} : (i32, i32, i32, i32, i32) -> () } // ----- @@ -1246,7 +1246,7 @@ // CHECK: %[[RESULTS_2_SINGLE:.*]] = "test.success"() : () -> i32 // CHECK: "test.consumer"(%[[RESULTS_1]]#0, %[[RESULTS_1]]#1, %[[RESULTS_1]]#2, %[[RESULTS_1]]#3, %[[RESULTS_2]]) : (i32, i32, i32, i32, i32) -> () module @ir attributes { test.get_results_2 } { - %results:5 = "test.attr_sized_results"() {result_segment_sizes = array} : () -> (i32, i32, i32, i32, i32) + %results:5 = "test.attr_sized_results"() {resultSegmentSizes = array} : () -> (i32, i32, i32, i32, i32) "test.consumer"(%results#0, %results#1, %results#2, %results#3, %results#4) : (i32, i32, i32, i32, i32) -> () } diff --git a/mlir/test/Target/LLVMIR/omptarget-llvm.mlir b/mlir/test/Target/LLVMIR/omptarget-llvm.mlir --- a/mlir/test/Target/LLVMIR/omptarget-llvm.mlir +++ b/mlir/test/Target/LLVMIR/omptarget-llvm.mlir @@ -2,7 +2,7 @@ llvm.func @_QPopenmp_target_data() { %0 = llvm.mlir.constant(1 : i64) : i64 - %1 = llvm.alloca %0 x i32 {bindc_name = "i", in_type = i32, operand_segment_sizes = array, uniq_name = "_QFopenmp_target_dataEi"} : (i64) -> !llvm.ptr + %1 = llvm.alloca %0 x i32 {bindc_name = "i", in_type = i32, operandSegmentSizes = array, uniq_name = "_QFopenmp_target_dataEi"} : (i64) -> !llvm.ptr omp.target_data map((tofrom -> %1 : !llvm.ptr)) { %2 = llvm.mlir.constant(99 : i32) : i32 llvm.store %2, %1 : !llvm.ptr @@ -79,9 +79,9 @@ llvm.func @_QPomp_target_enter_exit(%1 : !llvm.ptr>, %3 : !llvm.ptr>) { %4 = llvm.mlir.constant(1 : i64) : i64 - %5 = llvm.alloca %4 x i32 {bindc_name = "dvc", in_type = i32, operand_segment_sizes = array, uniq_name = "_QFomp_target_enter_exitEdvc"} : (i64) -> !llvm.ptr + %5 = llvm.alloca %4 x i32 {bindc_name = "dvc", in_type = i32, operandSegmentSizes = array, uniq_name = "_QFomp_target_enter_exitEdvc"} : (i64) -> !llvm.ptr %6 = llvm.mlir.constant(1 : i64) : i64 - %7 = llvm.alloca %6 x i32 {bindc_name = "i", in_type = i32, operand_segment_sizes = array, uniq_name = "_QFomp_target_enter_exitEi"} : (i64) -> !llvm.ptr + %7 = llvm.alloca %6 x i32 {bindc_name = "i", in_type = i32, operandSegmentSizes = array, uniq_name = "_QFomp_target_enter_exitEi"} : (i64) -> !llvm.ptr %8 = llvm.mlir.constant(5 : i32) : i32 llvm.store %8, %7 : !llvm.ptr %9 = llvm.mlir.constant(2 : i32) : i32 diff --git a/mlir/test/Target/LLVMIR/omptarget-region-device-llvm.mlir b/mlir/test/Target/LLVMIR/omptarget-region-device-llvm.mlir --- a/mlir/test/Target/LLVMIR/omptarget-region-device-llvm.mlir +++ b/mlir/test/Target/LLVMIR/omptarget-region-device-llvm.mlir @@ -5,11 +5,11 @@ %0 = llvm.mlir.constant(20 : i32) : i32 %1 = llvm.mlir.constant(10 : i32) : i32 %2 = llvm.mlir.constant(1 : i64) : i64 - %3 = llvm.alloca %2 x i32 {bindc_name = "a", in_type = i32, operand_segment_sizes = array, uniq_name = "_QFomp_target_regionEa"} : (i64) -> !llvm.ptr + %3 = llvm.alloca %2 x i32 {bindc_name = "a", in_type = i32, operandSegmentSizes = array, uniq_name = "_QFomp_target_regionEa"} : (i64) -> !llvm.ptr %4 = llvm.mlir.constant(1 : i64) : i64 - %5 = llvm.alloca %4 x i32 {bindc_name = "b", in_type = i32, operand_segment_sizes = array, uniq_name = "_QFomp_target_regionEb"} : (i64) -> !llvm.ptr + %5 = llvm.alloca %4 x i32 {bindc_name = "b", in_type = i32, operandSegmentSizes = array, uniq_name = "_QFomp_target_regionEb"} : (i64) -> !llvm.ptr %6 = llvm.mlir.constant(1 : i64) : i64 - %7 = llvm.alloca %6 x i32 {bindc_name = "c", in_type = i32, operand_segment_sizes = array, uniq_name = "_QFomp_target_regionEc"} : (i64) -> !llvm.ptr + %7 = llvm.alloca %6 x i32 {bindc_name = "c", in_type = i32, operandSegmentSizes = array, uniq_name = "_QFomp_target_regionEc"} : (i64) -> !llvm.ptr llvm.store %1, %3 : !llvm.ptr llvm.store %0, %5 : !llvm.ptr omp.target { diff --git a/mlir/test/Target/LLVMIR/omptarget-region-llvm.mlir b/mlir/test/Target/LLVMIR/omptarget-region-llvm.mlir --- a/mlir/test/Target/LLVMIR/omptarget-region-llvm.mlir +++ b/mlir/test/Target/LLVMIR/omptarget-region-llvm.mlir @@ -5,11 +5,11 @@ %0 = llvm.mlir.constant(20 : i32) : i32 %1 = llvm.mlir.constant(10 : i32) : i32 %2 = llvm.mlir.constant(1 : i64) : i64 - %3 = llvm.alloca %2 x i32 {bindc_name = "a", in_type = i32, operand_segment_sizes = array, uniq_name = "_QFomp_target_regionEa"} : (i64) -> !llvm.ptr + %3 = llvm.alloca %2 x i32 {bindc_name = "a", in_type = i32, operandSegmentSizes = array, uniq_name = "_QFomp_target_regionEa"} : (i64) -> !llvm.ptr %4 = llvm.mlir.constant(1 : i64) : i64 - %5 = llvm.alloca %4 x i32 {bindc_name = "b", in_type = i32, operand_segment_sizes = array, uniq_name = "_QFomp_target_regionEb"} : (i64) -> !llvm.ptr + %5 = llvm.alloca %4 x i32 {bindc_name = "b", in_type = i32, operandSegmentSizes = array, uniq_name = "_QFomp_target_regionEb"} : (i64) -> !llvm.ptr %6 = llvm.mlir.constant(1 : i64) : i64 - %7 = llvm.alloca %6 x i32 {bindc_name = "c", in_type = i32, operand_segment_sizes = array, uniq_name = "_QFomp_target_regionEc"} : (i64) -> !llvm.ptr + %7 = llvm.alloca %6 x i32 {bindc_name = "c", in_type = i32, operandSegmentSizes = array, uniq_name = "_QFomp_target_regionEc"} : (i64) -> !llvm.ptr llvm.store %1, %3 : !llvm.ptr llvm.store %0, %5 : !llvm.ptr omp.target { diff --git a/mlir/test/Target/LLVMIR/omptarget-region-parallel-llvm.mlir b/mlir/test/Target/LLVMIR/omptarget-region-parallel-llvm.mlir --- a/mlir/test/Target/LLVMIR/omptarget-region-parallel-llvm.mlir +++ b/mlir/test/Target/LLVMIR/omptarget-region-parallel-llvm.mlir @@ -5,11 +5,11 @@ %0 = llvm.mlir.constant(20 : i32) : i32 %1 = llvm.mlir.constant(10 : i32) : i32 %2 = llvm.mlir.constant(1 : i64) : i64 - %3 = llvm.alloca %2 x i32 {bindc_name = "a", in_type = i32, operand_segment_sizes = array, uniq_name = "_QFomp_target_regionEa"} : (i64) -> !llvm.ptr + %3 = llvm.alloca %2 x i32 {bindc_name = "a", in_type = i32, operandSegmentSizes = array, uniq_name = "_QFomp_target_regionEa"} : (i64) -> !llvm.ptr %4 = llvm.mlir.constant(1 : i64) : i64 - %5 = llvm.alloca %4 x i32 {bindc_name = "b", in_type = i32, operand_segment_sizes = array, uniq_name = "_QFomp_target_regionEb"} : (i64) -> !llvm.ptr + %5 = llvm.alloca %4 x i32 {bindc_name = "b", in_type = i32, operandSegmentSizes = array, uniq_name = "_QFomp_target_regionEb"} : (i64) -> !llvm.ptr %6 = llvm.mlir.constant(1 : i64) : i64 - %7 = llvm.alloca %6 x i32 {bindc_name = "c", in_type = i32, operand_segment_sizes = array, uniq_name = "_QFomp_target_regionEc"} : (i64) -> !llvm.ptr + %7 = llvm.alloca %6 x i32 {bindc_name = "c", in_type = i32, operandSegmentSizes = array, uniq_name = "_QFomp_target_regionEc"} : (i64) -> !llvm.ptr llvm.store %1, %3 : !llvm.ptr llvm.store %0, %5 : !llvm.ptr omp.target { 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 @@ -310,7 +310,7 @@ llvm.store %3, %4 : !llvm.ptr omp.yield // CHECK: call void @__kmpc_for_static_fini(ptr @[[$loc_struct]], - }) {operand_segment_sizes = array} : (i64, i64, i64) -> () + }) {operandSegmentSizes = array} : (i64, i64, i64) -> () omp.terminator } llvm.return @@ -330,7 +330,7 @@ %4 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %3, %4 : !llvm.ptr omp.yield - }) {operand_segment_sizes = array} : (i64, i64, i64) -> () + }) {operandSegmentSizes = array} : (i64, i64, i64) -> () llvm.return } @@ -348,7 +348,7 @@ %4 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %3, %4 : !llvm.ptr omp.yield - }) {inclusive, operand_segment_sizes = array} : (i64, i64, i64) -> () + }) {inclusive, operandSegmentSizes = array} : (i64, i64, i64) -> () llvm.return } @@ -628,7 +628,7 @@ %4 = llvm.getelementptr %arg0[%iv] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %3, %4 : !llvm.ptr omp.yield - }) {operand_segment_sizes = array} : + }) {operandSegmentSizes = array} : (i64, i64, i64) -> () llvm.return @@ -733,9 +733,9 @@ // CHECK-LABEL: @simdloop_if llvm.func @simdloop_if(%arg0: !llvm.ptr {fir.bindc_name = "n"}, %arg1: !llvm.ptr {fir.bindc_name = "threshold"}) { %0 = llvm.mlir.constant(1 : i64) : i64 - %1 = llvm.alloca %0 x i32 {adapt.valuebyref, in_type = i32, operand_segment_sizes = array} : (i64) -> !llvm.ptr + %1 = llvm.alloca %0 x i32 {adapt.valuebyref, in_type = i32, operandSegmentSizes = array} : (i64) -> !llvm.ptr %2 = llvm.mlir.constant(1 : i64) : i64 - %3 = llvm.alloca %2 x i32 {bindc_name = "i", in_type = i32, operand_segment_sizes = array, uniq_name = "_QFtest_simdEi"} : (i64) -> !llvm.ptr + %3 = llvm.alloca %2 x i32 {bindc_name = "i", in_type = i32, operandSegmentSizes = array, uniq_name = "_QFtest_simdEi"} : (i64) -> !llvm.ptr %4 = llvm.mlir.constant(0 : i32) : i32 %5 = llvm.load %arg0 : !llvm.ptr %6 = llvm.mlir.constant(1 : i32) : i32 diff --git a/mlir/test/Transforms/canonicalize-block-merge.mlir b/mlir/test/Transforms/canonicalize-block-merge.mlir --- a/mlir/test/Transforms/canonicalize-block-merge.mlir +++ b/mlir/test/Transforms/canonicalize-block-merge.mlir @@ -257,7 +257,7 @@ func.func @mismatch_dominance() -> i32 { // CHECK: %[[RES:.*]] = "test.producing_br"() %0 = "test.producing_br"()[^bb1, ^bb2] { - operand_segment_sizes = array + operandSegmentSizes = array } : () -> i32 ^bb1: diff --git a/mlir/test/Transforms/sccp.mlir b/mlir/test/Transforms/sccp.mlir --- a/mlir/test/Transforms/sccp.mlir +++ b/mlir/test/Transforms/sccp.mlir @@ -204,7 +204,7 @@ // CHECK: %[[ONE:.*]] = arith.constant 1 %1 = arith.constant 1 : i32 "test.internal_br"(%1) [^bb1, ^bb2] { - operand_segment_sizes = array + operandSegmentSizes = array } : (i32) -> () ^bb1: diff --git a/mlir/test/lib/Dialect/Test/TestOpsSyntax.td b/mlir/test/lib/Dialect/Test/TestOpsSyntax.td --- a/mlir/test/lib/Dialect/Test/TestOpsSyntax.td +++ b/mlir/test/lib/Dialect/Test/TestOpsSyntax.td @@ -715,7 +715,7 @@ }]; } -// Test inferReturnTypes coupled with variadic operands (operand_segment_sizes). +// Test inferReturnTypes coupled with variadic operands (operandSegmentSizes). def FormatInferTypeVariadicOperandsOp : TEST_Op<"format_infer_type_variadic_operands", [InferTypeOpInterface, AttrSizedOperandSegments]> { diff --git a/mlir/test/mlir-tblgen/op-decl-and-defs.td b/mlir/test/mlir-tblgen/op-decl-and-defs.td --- a/mlir/test/mlir-tblgen/op-decl-and-defs.td +++ b/mlir/test/mlir-tblgen/op-decl-and-defs.td @@ -141,7 +141,7 @@ Variadic:$b, I32:$c, Variadic:$d, - I32ElementsAttr:$operand_segment_sizes + I32ElementsAttr:$operandSegmentSizes ); } diff --git a/mlir/test/mlir-tblgen/op-python-bindings.td b/mlir/test/mlir-tblgen/op-python-bindings.td --- a/mlir/test/mlir-tblgen/op-python-bindings.td +++ b/mlir/test/mlir-tblgen/op-python-bindings.td @@ -39,7 +39,7 @@ // CHECK: def variadic1(self): // CHECK: operand_range = _ods_segmented_accessor( // CHECK: self.operation.operands, - // CHECK: self.operation.attributes["operand_segment_sizes"], 0) + // CHECK: self.operation.attributes["operandSegmentSizes"], 0) // CHECK: return operand_range // CHECK-NOT: if len(operand_range) // @@ -47,14 +47,14 @@ // CHECK: def non_variadic(self): // CHECK: operand_range = _ods_segmented_accessor( // CHECK: self.operation.operands, - // CHECK: self.operation.attributes["operand_segment_sizes"], 1) + // CHECK: self.operation.attributes["operandSegmentSizes"], 1) // CHECK: return operand_range[0] // // CHECK: @builtins.property // CHECK: def variadic2(self): // CHECK: operand_range = _ods_segmented_accessor( // CHECK: self.operation.operands, - // CHECK: self.operation.attributes["operand_segment_sizes"], 2) + // CHECK: self.operation.attributes["operandSegmentSizes"], 2) // CHECK: return operand_range[0] if len(operand_range) > 0 else None let arguments = (ins Variadic:$variadic1, AnyType:$non_variadic, Optional:$variadic2); @@ -83,21 +83,21 @@ // CHECK: def variadic1(self): // CHECK: result_range = _ods_segmented_accessor( // CHECK: self.operation.results, - // CHECK: self.operation.attributes["result_segment_sizes"], 0) + // CHECK: self.operation.attributes["resultSegmentSizes"], 0) // CHECK: return result_range[0] if len(result_range) > 0 else None // // CHECK: @builtins.property // CHECK: def non_variadic(self): // CHECK: result_range = _ods_segmented_accessor( // CHECK: self.operation.results, - // CHECK: self.operation.attributes["result_segment_sizes"], 1) + // CHECK: self.operation.attributes["resultSegmentSizes"], 1) // CHECK: return result_range[0] // // CHECK: @builtins.property // CHECK: def variadic2(self): // CHECK: result_range = _ods_segmented_accessor( // CHECK: self.operation.results, - // CHECK: self.operation.attributes["result_segment_sizes"], 2) + // CHECK: self.operation.attributes["resultSegmentSizes"], 2) // CHECK: return result_range // CHECK-NOT: if len(result_range) let results = (outs Optional:$variadic1, AnyType:$non_variadic, diff --git a/mlir/test/python/dialects/linalg/ops.py b/mlir/test/python/dialects/linalg/ops.py --- a/mlir/test/python/dialects/linalg/ops.py +++ b/mlir/test/python/dialects/linalg/ops.py @@ -100,7 +100,7 @@ init_result = tensor.EmptyOp([4, 8], f32) # CHECK: "linalg.matmul"(%{{.*}}) # CHECK-SAME: cast = #linalg.type_fn - # CHECK-SAME: odsOperandSegmentSizes = array + # CHECK-SAME: operandSegmentSizes = array # CHECK-NEXT: ^bb0(%{{.*}}: f32, %{{.*}}: f32, %{{.*}}: f32): # CHECK-NEXT: arith.mulf{{.*}} (f32, f32) -> f32 # CHECK-NEXT: arith.addf{{.*}} (f32, f32) -> f32 diff --git a/mlir/test/python/dialects/ods_helpers.py b/mlir/test/python/dialects/ods_helpers.py --- a/mlir/test/python/dialects/ods_helpers.py +++ b/mlir/test/python/dialects/ods_helpers.py @@ -96,8 +96,8 @@ # CHECK: %[[V0:.+]] = "custom.value" # CHECK: %[[V1:.+]] = "custom.value" # CHECK: "custom.test_op"(%[[V0]], %[[V1]]) - # CHECK-NOT: operand_segment_sizes - # CHECK-NOT: result_segment_sizes + # CHECK-NOT: operandSegmentSizes + # CHECK-NOT: resultSegmentSizes # CHECK-SAME: : (i32, i32) -> (i8, i16) print(m) @@ -128,8 +128,8 @@ # CHECK: %[[V2:.+]] = "custom.value" # CHECK: %[[V3:.+]] = "custom.value" # CHECK: "custom.test_op"(%[[V0]], %[[V1]], %[[V2]], %[[V3]]) - # CHECK-SAME: operand_segment_sizes = array - # CHECK-SAME: result_segment_sizes = array + # CHECK-SAME: operandSegmentSizes = array + # CHECK-SAME: resultSegmentSizes = array # CHECK-SAME: : (i32, i32, i32, i32) -> (i8, i16, i32, i64) op = TestOp.build_generic( results=[[t0, t1], t2, t3], operands=[v0, [v1, v2], v3] @@ -137,8 +137,8 @@ # Now test with optional omitted. # CHECK: "custom.test_op"(%[[V0]]) - # CHECK-SAME: operand_segment_sizes = array - # CHECK-SAME: result_segment_sizes = array + # CHECK-SAME: operandSegmentSizes = array + # CHECK-SAME: resultSegmentSizes = array # CHECK-SAME: (i32) -> i64 op = TestOp.build_generic( results=[None, None, t3], operands=[v0, None, None] diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp --- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp +++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp @@ -56,8 +56,8 @@ /// The names of the implicit attributes that contain variadic operand and /// result segment sizes. -static const char *const operandSegmentAttrName = "operand_segment_sizes"; -static const char *const resultSegmentAttrName = "result_segment_sizes"; +static const char *const operandSegmentAttrName = "operandSegmentSizes"; +static const char *const resultSegmentAttrName = "resultSegmentSizes"; /// Code for an Op to lookup an attribute. Uses cached identifiers and subrange /// lookup. @@ -447,7 +447,7 @@ if (op.getDialect().usePropertiesForAttributes()) { operandSegmentsSizeStorage = llvm::formatv("std::array", op.getNumOperands()); - operandSegmentsSize = {"odsOperandSegmentSizes", + operandSegmentsSize = {"operandSegmentSizes", makeProperty(operandSegmentsSizeStorage)}; } else { attrMetadata.insert( @@ -460,7 +460,7 @@ if (op.getDialect().usePropertiesForAttributes()) { resultSegmentsSizeStorage = llvm::formatv("std::array", op.getNumResults()); - resultSegmentsSize = {"odsResultSegmentSizes", + resultSegmentsSize = {"resultSegmentSizes", makeProperty(resultSegmentsSizeStorage)}; } else { attrMetadata.insert( @@ -1296,10 +1296,12 @@ std::string getAttr; llvm::raw_string_ostream os(getAttr); os << " auto attr = dict.get(\"" << name << "\");"; - if (name == "odsOperandSegmentSizes") { + if (name == operandSegmentAttrName) { + // Backward compat for now, TODO: Remove at some point. os << " if (!attr) attr = dict.get(\"operand_segment_sizes\");"; } - if (name == "odsResultSegmentSizes") { + if (name == resultSegmentAttrName) { + // Backward compat for now, TODO: Remove at some point. os << " if (!attr) attr = dict.get(\"result_segment_sizes\");"; } os.flush(); @@ -1318,10 +1320,12 @@ std::string getAttr; llvm::raw_string_ostream os(getAttr); os << " auto attr = dict.get(\"" << name << "\");"; - if (name == "odsOperandSegmentSizes") { + if (name == operandSegmentAttrName) { + // Backward compat for now os << " if (!attr) attr = dict.get(\"operand_segment_sizes\");"; } - if (name == "odsResultSegmentSizes") { + if (name == resultSegmentAttrName) { + // Backward compat for now os << " if (!attr) attr = dict.get(\"result_segment_sizes\");"; } os.flush(); @@ -1458,34 +1462,34 @@ // even though it is a native property. const auto *namedProperty = cast(attrOrProp); StringRef name = namedProperty->name; - if (name != "odsOperandSegmentSizes" && name != "odsResultSegmentSizes") + if (name != operandSegmentAttrName && name != resultSegmentAttrName) continue; auto &prop = namedProperty->prop; FmtContext fctx; fctx.addSubst("_ctxt", "ctx"); fctx.addSubst("_storage", Twine("prop.") + name); - if (name == "odsOperandSegmentSizes") { + if (name == operandSegmentAttrName) { getInherentAttrMethod - << formatv(" if (name == \"odsOperandSegmentSizes\" || name == " + << formatv(" if (name == \"operand_segment_sizes\" || name == " "\"{0}\") return ", operandSegmentAttrName); } else { getInherentAttrMethod - << formatv(" if (name == \"odsResultSegmentSizes\" || name == " + << formatv(" if (name == \"result_segment_sizes\" || name == " "\"{0}\") return ", resultSegmentAttrName); } getInherentAttrMethod << tgfmt(prop.getConvertToAttributeCall(), &fctx) << ";\n"; - if (name == "odsOperandSegmentSizes") { - setInherentAttrMethod << formatv( - " if (name == \"odsOperandSegmentSizes\" || name == " - "\"{0}\") {{", - operandSegmentAttrName); + if (name == operandSegmentAttrName) { + setInherentAttrMethod + << formatv(" if (name == \"operand_segment_sizes\" || name == " + "\"{0}\") {{", + operandSegmentAttrName); } else { setInherentAttrMethod - << formatv(" if (name == \"odsResultSegmentSizes\" || name == " + << formatv(" if (name == \"result_segment_sizes\" || name == " "\"{0}\") {{", resultSegmentAttrName); } @@ -1499,7 +1503,7 @@ } )decl", name); - if (name == "odsOperandSegmentSizes") { + if (name == operandSegmentAttrName) { populateInherentAttrsMethod << formatv(" attrs.append(\"{0}\", {1});\n", operandSegmentAttrName, tgfmt(prop.getConvertToAttributeCall(), &fctx)); @@ -2040,7 +2044,7 @@ if (op.getTrait("::mlir::OpTrait::AttrSizedOperandSegments")) { if (op.getDialect().usePropertiesForAttributes()) attrSizeInitCode = formatv(adapterSegmentSizeAttrInitCodeProperties, - "getProperties().odsOperandSegmentSizes"); + "getProperties().operandSegmentSizes"); else attrSizeInitCode = formatv(opSegmentSizeAttrInitCode, @@ -2082,7 +2086,7 @@ body << formatv(", ::mlir::MutableOperandRange::OperandSegment({0}u, " "{{getOperandSegmentSizesAttrName(), " "DenseI32ArrayAttr::get(getContext(), " - "getProperties().odsOperandSegmentSizes)})", + "getProperties().operandSegmentSizes)})", i); else body << formatv( @@ -2141,7 +2145,7 @@ if (attrSizedResults) { if (op.getDialect().usePropertiesForAttributes()) attrSizeInitCode = formatv(adapterSegmentSizeAttrInitCodeProperties, - "getProperties().odsResultSegmentSizes"); + "getProperties().resultSegmentSizes"); else attrSizeInitCode = formatv(opSegmentSizeAttrInitCode, @@ -2316,7 +2320,7 @@ << ");\n"; } - // Automatically create the 'result_segment_sizes' attribute using + // Automatically create the 'resultSegmentSizes' attribute using // the length of the type ranges. if (op.getTrait("::mlir::OpTrait::AttrSizedResultSegments")) { if (op.getDialect().usePropertiesForAttributes()) { @@ -2346,7 +2350,7 @@ if (op.getDialect().usePropertiesForAttributes()) { body << "}), " << builderOpState << ".getOrAddProperties()." - "odsResultSegmentSizes.begin());\n"; + "resultSegmentSizes.begin());\n"; } else { body << "}));\n"; } @@ -2974,7 +2978,7 @@ emitSegment(); body << "}), " << builderOpState << ".getOrAddProperties()." - "odsOperandSegmentSizes.begin());\n"; + "operandSegmentSizes.begin());\n"; } else { body << " " << builderOpState << ".addAttribute(" << sizes << "AttrName(" << builderOpState << ".name), " @@ -3847,8 +3851,7 @@ if (attr) { storageType = attr->getStorageType(); } else { - if (name != "odsOperandSegmentSizes" && - name != "odsResultSegmentSizes") { + if (name != operandSegmentAttrName && name != resultSegmentAttrName) { report_fatal_error("unexpected AttributeMetadata"); } // TODO: update to use native integers. @@ -3963,7 +3966,7 @@ if (op.getDialect().usePropertiesForAttributes()) sizeAttrInit = formatv(adapterSegmentSizeAttrInitCodeProperties, - llvm::formatv("getProperties().odsOperandSegmentSizes")); + llvm::formatv("getProperties().operandSegmentSizes")); else sizeAttrInit = formatv(adapterSegmentSizeAttrInitCode, emitHelper.getAttr(operandSegmentAttrName)); diff --git a/mlir/tools/mlir-tblgen/OpFormatGen.cpp b/mlir/tools/mlir-tblgen/OpFormatGen.cpp --- a/mlir/tools/mlir-tblgen/OpFormatGen.cpp +++ b/mlir/tools/mlir-tblgen/OpFormatGen.cpp @@ -1666,10 +1666,10 @@ llvm::interleaveComma(op.getOperands(), body, interleaveFn); body << formatv("}), " "result.getOrAddProperties<{0}::Properties>()." - "odsOperandSegmentSizes.begin());\n", + "operandSegmentSizes.begin());\n", op.getCppClassName()); } else { - body << " result.addAttribute(\"operand_segment_sizes\", " + body << " result.addAttribute(\"operandSegmentSizes\", " << "parser.getBuilder().getDenseI32ArrayAttr({"; llvm::interleaveComma(op.getOperands(), body, interleaveFn); body << "}));\n"; @@ -1710,10 +1710,10 @@ llvm::interleaveComma(op.getResults(), body, interleaveFn); body << formatv("}), " "result.getOrAddProperties<{0}::Properties>()." - "odsResultSegmentSizes.begin());\n", + "resultSegmentSizes.begin());\n", op.getCppClassName()); } else { - body << " result.addAttribute(\"result_segment_sizes\", " + body << " result.addAttribute(\"resultSegmentSizes\", " << "parser.getBuilder().getDenseI32ArrayAttr({"; llvm::interleaveComma(op.getResults(), body, interleaveFn); body << "}));\n"; @@ -1767,10 +1767,10 @@ // Elide the variadic segment size attributes if necessary. if (!fmt.allOperands && op.getTrait("::mlir::OpTrait::AttrSizedOperandSegments")) - body << " elidedAttrs.push_back(\"operand_segment_sizes\");\n"; + body << " elidedAttrs.push_back(\"operandSegmentSizes\");\n"; if (!fmt.allResultTypes && op.getTrait("::mlir::OpTrait::AttrSizedResultSegments")) - body << " elidedAttrs.push_back(\"result_segment_sizes\");\n"; + body << " elidedAttrs.push_back(\"resultSegmentSizes\");\n"; for (const StringRef key : fmt.inferredAttributes.keys()) body << " elidedAttrs.push_back(\"" << key << "\");\n"; for (const NamedAttribute *attr : fmt.usedAttributes) diff --git a/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp b/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp --- a/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp +++ b/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp @@ -170,7 +170,7 @@ def {0}(self): {1}_range = _ods_segmented_accessor( self.operation.{1}s, - self.operation.attributes["{1}_segment_sizes"], {2}) + self.operation.attributes["{1}SegmentSizes"], {2}) return {1}_range{3} )Py"; diff --git a/mlir/unittests/IR/AdaptorTest.cpp b/mlir/unittests/IR/AdaptorTest.cpp --- a/mlir/unittests/IR/AdaptorTest.cpp +++ b/mlir/unittests/IR/AdaptorTest.cpp @@ -40,7 +40,7 @@ // value from the value 0. SmallVector> v = {0, 4}; OIListSimple::Properties prop; - prop.odsOperandSegmentSizes = {1, 0, 1}; + prop.operandSegmentSizes = {1, 0, 1}; OIListSimple::GenericAdaptor>> d(v, {}, prop, {}); EXPECT_EQ(d.getArg0(), 0);