diff --git a/flang/lib/Optimizer/Dialect/FIROps.cpp b/flang/lib/Optimizer/Dialect/FIROps.cpp index 61ba0f584ae6d..960fc62190f5f 100644 --- a/flang/lib/Optimizer/Dialect/FIROps.cpp +++ b/flang/lib/Optimizer/Dialect/FIROps.cpp @@ -128,9 +128,8 @@ static mlir::ParseResult parseAllocatableOp(FN wrapResultType, 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 @@ static void printAllocatableOp(mlir::OpAsmPrinter &p, OP &op) { 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 index bf03c24fee75c..d67198d97699e 100644 --- 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 @@ func.func @_QPsb1(%arg0: !fir.ref {fir.bindc_name = "n"}, %arg1: !fir.ref, 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 @@ func.func @_QPsimd1(%arg0: !fir.ref {fir.bindc_name = "n"}, %arg1: !fir.ref // 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 @@ func.func @_QPomp_target_data() { // 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 @@ func.func @_QPopenmp_target_data_region() { // 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 @@ -338,7 +338,7 @@ func.func @_QPomp_target() { // 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 @@ -544,7 +544,7 @@ func.func @_QPsb() { // 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:.*]]({{.*}}) @@ -582,7 +582,7 @@ func.func @_QPsb() { // 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 index d0c154fb0376e..52716afe3198d 100644 --- a/flang/test/Fir/convert-to-llvm.fir +++ b/flang/test/Fir/convert-to-llvm.fir @@ -1748,7 +1748,7 @@ func.func @no_reassoc(%arg0: !fir.ref) { // 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 @@ func.func private @_QPxb(!fir.box>) // 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 @@ func.func private @_QPtest_dt_callee(%arg0: !fir.box>) // 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 index 8428d4ba991ef..8fe5ef35a7603 100644 --- a/mlir/docs/PatternRewriter.md +++ b/mlir/docs/PatternRewriter.md @@ -383,7 +383,7 @@ Example output is shown below: ``` //===-------------------------------------------===// 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 index dfa97c865118f..9f15ca767abf9 100644 --- a/mlir/include/mlir/Dialect/IRDL/IR/IRDLOps.td +++ b/mlir/include/mlir/Dialect/IRDL/IR/IRDLOps.td @@ -223,6 +223,18 @@ def IRDL_OperandsOp : IRDL_Op<"operands", [HasParent<"OperationOp">]> { The `mul` operation will expect two operands of type `cmath.complex`, that have the same type, and return a result of the same type. + + The operands can also be marked as variadic or optional: + ```mlir + irdl.operands(%0, single %1, optional %2, variadic %3) + ``` + + Here, %0 and %1 are required single operands, %2 is an optional operand, + and %3 is a variadic operand. + + When more than one operand is marked as optional or variadic, the operation + will expect a 'operandSegmentSizes' attribute that defines the number of + operands in each segment. }]; let arguments = (ins Variadic:$args); @@ -254,6 +266,18 @@ def IRDL_ResultsOp : IRDL_Op<"results", [HasParent<"OperationOp">]> { The operation will expect one operand of the `cmath.complex` type, and two results that have the underlying type of the `cmath.complex`. + + The results can also be marked as variadic or optional: + ```mlir + irdl.results(%0, single %1, optional %2, variadic %3) + ``` + + Here, %0 and %1 are required single results, %2 is an optional result, + and %3 is a variadic result. + + When more than one result is marked as optional or variadic, the operation + will expect a 'resultSegmentSizes' attribute that defines the number of + results in each segment. }]; let arguments = (ins Variadic:$args); diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td index 1efd2b6b63dd9..4567b3f1902d7 100644 --- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td +++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td @@ -874,23 +874,6 @@ def LinalgStructuredInterface : OpInterface<"LinalgOp"> { 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 index 274a531f4061e..f25106b1593a3 100644 --- a/mlir/include/mlir/IR/OpBase.td +++ b/mlir/include/mlir/IR/OpBase.td @@ -2178,7 +2178,7 @@ def SameVariadicOperandSize : GenInternalOpTrait<"SameVariadicOperandSize">; // 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 SameVariadicResultSize : GenInternalOpTrait<"SameVariadicResultSize">; 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 index d42bffaf32b03..afbd0395b466a 100644 --- a/mlir/include/mlir/IR/OpDefinition.h +++ b/mlir/include/mlir/IR/OpDefinition.h @@ -1331,7 +1331,7 @@ struct HasParent { /// 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 @@ template 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 @@ template 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 index 971d2819ade44..c755dc12a311b 100644 --- a/mlir/lib/Bindings/Python/IRCore.cpp +++ b/mlir/lib/Bindings/Python/IRCore.cpp @@ -1675,28 +1675,28 @@ py::object PyOpView::buildGeneric( } 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 index 9dfe07797ff4b..e6154a329aacc 100644 --- a/mlir/lib/Dialect/AMDGPU/Transforms/EmulateAtomics.cpp +++ b/mlir/lib/Dialect/AMDGPU/Transforms/EmulateAtomics.cpp @@ -53,7 +53,7 @@ enum class DataArgAction : unsigned char { // 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 @@ static void patchOperandSegmentSizes(ArrayRef attrs, 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 index 7d018bf8f3a3d..abe6670c7f855 100644 --- a/mlir/lib/Dialect/Async/IR/Async.cpp +++ b/mlir/lib/Dialect/Async/IR/Async.cpp @@ -61,7 +61,7 @@ YieldOp::getMutableSuccessorOperands(std::optional index) { /// ExecuteOp //===----------------------------------------------------------------------===// -constexpr char kOperandSegmentSizesAttr[] = "operand_segment_sizes"; +constexpr char kOperandSegmentSizesAttr[] = "operandSegmentSizes"; OperandRange ExecuteOp::getSuccessorEntryOperands(std::optional index) { @@ -100,7 +100,7 @@ void ExecuteOp::build(OpBuilder &builder, OperationState &result, 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 @@ ParseResult ExecuteOp::parse(OpAsmParser &parser, OperationState &result) { 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 index d6778ed72c7d0..4f5452b27e3e0 100644 --- a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp +++ b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp @@ -170,7 +170,7 @@ static void buildStructuredOp(OpBuilder &b, OperationState &state, 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 @@ parseCommonStructuredOpParts(OpAsmParser &parser, OperationState &result, // 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 @@ static void printNamedStructuredOp(OpAsmPrinter &p, Operation *op, 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"}); @@ -878,7 +878,7 @@ void GenericOp::print(OpAsmPrinter &p) { 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 index aaa5e39cd2f3d..a7b516e1e8640 100644 --- a/mlir/lib/Dialect/SCF/IR/SCF.cpp +++ b/mlir/lib/Dialect/SCF/IR/SCF.cpp @@ -1365,7 +1365,7 @@ ParseResult ForallOp::parse(OpAsmParser &parser, OperationState &result) { 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 @@ void ForallOp::build( 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 @@ struct ForallOpSingleOrZeroIterationDimsFolder 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 @@ ParseResult ParallelOp::parse(OpAsmParser &parser, OperationState &result) { 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 index c8c442823781b..e7d4c4089a991 100644 --- a/mlir/lib/Rewrite/ByteCode.cpp +++ b/mlir/lib/Rewrite/ByteCode.cpp @@ -1846,7 +1846,7 @@ void ByteCodeExecutor::executeGetOperands() { 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 @@ void ByteCodeExecutor::executeGetResults() { 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 index 9791bd4e0f264..c0379c2994f49 100644 --- 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 index ab91729a0556b..b83b122f75e4b 100644 --- a/mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir +++ b/mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir @@ -79,7 +79,7 @@ func.func @wsloop(%arg0: index, %arg1: index, %arg2: index, %arg3: index, %arg4: // 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 @@ llvm.func @_QPsimple_reduction(%arg0: !llvm.ptr> {fir.bindc_nam %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 index e280cd65811db..80c65e14e7635 100644 --- a/mlir/test/Dialect/GPU/invalid.mlir +++ b/mlir/test/Dialect/GPU/invalid.mlir @@ -4,7 +4,7 @@ func.func @not_enough_sizes(%sz : index) { // 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 @@ func.func @no_region_attrs(%sz : index) { ^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_requires_gpu_return(%sz : index) { 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 @@ module attributes {gpu.container_module} { 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 index 14141c4c243ab..cf4697b17aa46 100644 --- a/mlir/test/Dialect/LLVMIR/invalid.mlir +++ b/mlir/test/Dialect/LLVMIR/invalid.mlir @@ -887,7 +887,7 @@ func.func @switch_wrong_number_of_weights(%arg0 : i32) { 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 index 8f00d54655327..b0bb06cc8654a 100644 --- 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_default_attributes(%input: memref // ----- 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 @@ func.func @conv_interface_wrong_input_indexing_map( %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 @@ func.func @conv_interface_wrong_num_operands( %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 index fc65fb77ffc88..009f08ced97e0 100644 --- a/mlir/test/Dialect/OpenMP/invalid.mlir +++ b/mlir/test/Dialect/OpenMP/invalid.mlir @@ -197,7 +197,7 @@ func.func @omp_simdloop(%lb : index, %ub : index, %step : i32) -> () { "omp.simdloop" (%lb, %ub, %step) ({ ^bb0(%iv: index): omp.yield - }) {operand_segment_sizes = array} : + }) {operandSegmentSizes = array} : (index, index, i32) -> () return @@ -225,7 +225,7 @@ func.func @omp_simdloop_aligned_mismatch(%arg0 : index, %arg1 : index, ^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 @@ func.func @omp_simdloop_aligned_negative(%arg0 : index, %arg1 : index, "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 @@ func.func @omp_simdloop_unexpected_alignment(%arg0 : index, %arg1 : index, "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 @@ func.func @omp_simdloop_aligned_float(%arg0 : index, %arg1 : index, "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 @@ func.func @omp_simdloop_aligned_the_same_var(%arg0 : index, %arg1 : index, "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 @@ func.func @omp_simdloop_nontemporal_the_same_var(%arg0 : index, "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 @@ func.func @omp_teams_allocate(%data_var : memref) { // 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 @@ func.func @omp_teams_num_teams1(%lb : i32) { // 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 @@ func.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 = array} : (memref) -> () + }) {operandSegmentSizes = array} : (memref) -> () return } @@ -1169,7 +1169,7 @@ func.func @omp_sections(%data_var : memref) -> () { // 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 @@ func.func @omp_single(%data_var : memref) -> () { // 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 @@ func.func @omp_task_depend(%data_var: memref) { // 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 @@ func.func @taskloop(%lb: i32, %ub: i32, %step: i32) { "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 @@ func.func @taskloop(%lb: i32, %ub: i32, %step: i32) { "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 @@ func.func @taskloop(%lb: i32, %ub: i32, %step: i32) { "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 @@ func.func @taskloop(%lb: i32, %ub: i32, %step: i32) { "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 @@ func.func @taskloop(%lb: i32, %ub: i32, %step: i32) { "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 index 2f0d224a3fef7..be59defd27d03 100644 --- a/mlir/test/Dialect/OpenMP/ops.mlir +++ b/mlir/test/Dialect/OpenMP/ops.mlir @@ -59,7 +59,7 @@ func.func @omp_parallel(%data_var : memref, %if_cond : i1, %num_threads : i // 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 @@ func.func @omp_parallel(%data_var : memref, %if_cond : i1, %num_threads : i // 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 @@ func.func @omp_wsloop(%lb : index, %ub : index, %step : index, %data_var : memre "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 @@ func.func @omp_wsloop(%lb : index, %ub : index, %step : index, %data_var : memre "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 @@ func.func @omp_wsloop(%lb : index, %ub : index, %step : index, %data_var : memre "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 @@ func.func @omp_wsloop(%lb : index, %ub : index, %step : index, %data_var : memre "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 @@ func.func @omp_wsloop(%lb : index, %ub : index, %step : index, %data_var : memre "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 @@ func.func @omp_simdloop(%lb : index, %ub : index, %step : index) -> () { "omp.simdloop" (%lb, %ub, %step) ({ ^bb0(%iv: index): omp.yield - }) {operand_segment_sizes = array} : + }) {operandSegmentSizes = array} : (index, index, index) -> () return @@ -349,7 +349,7 @@ func.func @omp_simdloop_aligned_list(%arg0 : index, %arg1 : index, %arg2 : index ^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 @@ func.func @omp_simdloop_aligned_single(%arg0 : index, %arg1 : index, %arg2 : ind ^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 @@ func.func @omp_simdloop_nontemporal_list(%arg0 : index, "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 @@ func.func @omp_simdloop_nontemporal_single(%arg0 : index, "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 @@ func.func @omp_target(%if_cond : i1, %device : si32, %num_threads : i32, %map1: "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 @@ func.func @omp_sectionsop(%data_var1 : memref, %data_var2 : memref, "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 index c76bc9dcad72d..c6b7fe1cc1789 100644 --- a/mlir/test/Dialect/PDL/invalid.mlir +++ b/mlir/test/Dialect/PDL/invalid.mlir @@ -122,7 +122,7 @@ pdl.pattern : benefit(1) { // 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 @@ pdl.pattern : benefit(1) { // 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 @@ pdl.pattern : benefit(1) { // 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.pattern : benefit(1) { "pdl.rewrite"(%op, %op) ({ ^bb1: }) { - operand_segment_sizes = array + operandSegmentSizes = array }: (!pdl.operation, !pdl.operation) -> () } @@ -303,7 +303,7 @@ pdl.pattern : benefit(1) { ^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 index 0457a158430a2..c201dda71ef7f 100644 --- a/mlir/test/Dialect/PDLInterp/invalid.mlir +++ b/mlir/test/Dialect/PDLInterp/invalid.mlir @@ -19,7 +19,7 @@ pdl_interp.func @rewriter() { 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 index 8566943ef8012..0ff3eaadc8fec 100644 --- a/mlir/test/Dialect/SCF/invalid.mlir +++ b/mlir/test/Dialect/SCF/invalid.mlir @@ -139,7 +139,7 @@ func.func @parallel_body_arguments_wrong_type( "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 @@ func.func @parallel_body_wrong_number_of_arguments( "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 @@ func.func @parallel_missing_terminator(%0 : index) { ^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 index af3f3ea2889f7..8496448759f0c 100644 --- 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_condition_type() -> () { 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 @@ func.func @wrong_number_of_weights() -> () { %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 index c72af7363f67f..3e30947769eb4 100644 --- a/mlir/test/Dialect/Transform/ops-invalid.mlir +++ b/mlir/test/Dialect/Transform/ops-invalid.mlir @@ -76,7 +76,7 @@ transform.sequence failures(propagate) { "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 index 66c9adca8f98c..0193fae37af7f 100644 --- a/mlir/test/IR/parser.mlir +++ b/mlir/test/IR/parser.mlir @@ -460,7 +460,7 @@ func.func @verbose_terminators() -> (i1, i17) { ^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 index 7d922ecf67de5..0402ebe758750 100644 --- a/mlir/test/IR/traits.mlir +++ b/mlir/test/IR/traits.mlir @@ -383,101 +383,101 @@ func.func private @foo() // ----- 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 index 57bec8ce37073..513ff3c40bc64 100644 --- a/mlir/test/Rewrite/pdl-bytecode.mlir +++ b/mlir/test/Rewrite/pdl-bytecode.mlir @@ -1093,7 +1093,7 @@ module @patterns { // 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 @@ module @patterns { // 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 index 1573f30d5b391..a58d4f1463a0b 100644 --- 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 @_QPopenmp_target_data_region(%1 : !llvm.ptr>) { 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 index 126fff70ce3b1..bead0200b2731 100644 --- a/mlir/test/Target/LLVMIR/omptarget-region-device-llvm.mlir +++ b/mlir/test/Target/LLVMIR/omptarget-region-device-llvm.mlir @@ -5,11 +5,11 @@ module attributes {omp.is_target_device = true} { %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 index e130f96af79f7..9ba083d5137d8 100644 --- a/mlir/test/Target/LLVMIR/omptarget-region-llvm.mlir +++ b/mlir/test/Target/LLVMIR/omptarget-region-llvm.mlir @@ -5,11 +5,11 @@ module attributes {omp.is_target_device = false} { %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 index cfa8039c94ba2..7f5e79db9bcd6 100644 --- a/mlir/test/Target/LLVMIR/omptarget-region-parallel-llvm.mlir +++ b/mlir/test/Target/LLVMIR/omptarget-region-parallel-llvm.mlir @@ -5,11 +5,11 @@ module attributes {omp.is_target_device = false} { %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 index 6469868b8751f..4fb00660cc423 100644 --- a/mlir/test/Target/LLVMIR/openmp-llvm.mlir +++ b/mlir/test/Target/LLVMIR/openmp-llvm.mlir @@ -310,7 +310,7 @@ llvm.func @wsloop_simple(%arg0: !llvm.ptr) { 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 @@ llvm.func @wsloop_inclusive_1(%arg0: !llvm.ptr) { %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 @@ llvm.func @wsloop_inclusive_2(%arg0: !llvm.ptr) { %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 @@ llvm.func @simdloop_simple(%lb : i64, %ub : i64, %step : i64, %arg0: !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 @@ llvm.func @simdloop_simple_multiple_simdlen_safelen(%lb1 : i64, %ub1 : i64, %ste // 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 index d33c911e042d7..bf44973ab646c 100644 --- a/mlir/test/Transforms/canonicalize-block-merge.mlir +++ b/mlir/test/Transforms/canonicalize-block-merge.mlir @@ -257,7 +257,7 @@ func.func @nomerge(%arg0: i32, %i: i32) { 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 index db24432b65cc6..dcae052c29c24 100644 --- a/mlir/test/Transforms/sccp.mlir +++ b/mlir/test/Transforms/sccp.mlir @@ -204,7 +204,7 @@ func.func @simple_produced_operand() -> (i32, i32) { // 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/mlir-tblgen/op-decl-and-defs.td b/mlir/test/mlir-tblgen/op-decl-and-defs.td index aad7ea4437e78..077aa750352e0 100644 --- a/mlir/test/mlir-tblgen/op-decl-and-defs.td +++ b/mlir/test/mlir-tblgen/op-decl-and-defs.td @@ -141,7 +141,7 @@ def NS_AttrSizedOperandOp : NS_Op<"attr_sized_operands", 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 index de979f7e8f43e..a131209fa45cb 100644 --- a/mlir/test/mlir-tblgen/op-python-bindings.td +++ b/mlir/test/mlir-tblgen/op-python-bindings.td @@ -39,7 +39,7 @@ def AttrSizedOperandsOp : TestOp<"attr_sized_operands", // 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 @@ def AttrSizedOperandsOp : TestOp<"attr_sized_operands", // 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 @@ def AttrSizedResultsOp : TestOp<"attr_sized_results", // 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 index 88f48d0d544e7..b728e00837814 100644 --- a/mlir/test/python/dialects/linalg/ops.py +++ b/mlir/test/python/dialects/linalg/ops.py @@ -100,7 +100,7 @@ def named_form(lhs, rhs): 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 index 71879bdcb51f5..0d2a18e0eb0af 100644 --- a/mlir/test/python/dialects/ods_helpers.py +++ b/mlir/test/python/dialects/ods_helpers.py @@ -96,8 +96,8 @@ class TestOp(OpView): # 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 @@ class TestOp(OpView): # 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 @@ class TestOp(OpView): # 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 index 0ff72ec75f1d4..e1161e6dca3da 100644 --- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp +++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp @@ -56,8 +56,8 @@ static const char *const propertyDiag = "propDiag"; /// 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 @@ void OpOrAdaptorHelper::computeAttrMetadata() { if (op.getDialect().usePropertiesForAttributes()) { operandSegmentsSizeStorage = llvm::formatv("std::array", op.getNumOperands()); - operandSegmentsSize = {"odsOperandSegmentSizes", + operandSegmentsSize = {"operandSegmentSizes", makeProperty(operandSegmentsSizeStorage)}; } else { attrMetadata.insert( @@ -460,7 +460,7 @@ void OpOrAdaptorHelper::computeAttrMetadata() { if (op.getDialect().usePropertiesForAttributes()) { resultSegmentsSizeStorage = llvm::formatv("std::array", op.getNumResults()); - resultSegmentsSize = {"odsResultSegmentSizes", + resultSegmentsSize = {"resultSegmentSizes", makeProperty(resultSegmentsSizeStorage)}; } else { attrMetadata.insert( @@ -1306,10 +1306,12 @@ void OpEmitter::genPropertiesSupport() { 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(); @@ -1327,10 +1329,12 @@ void OpEmitter::genPropertiesSupport() { 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(); @@ -1466,34 +1470,34 @@ void OpEmitter::genPropertiesSupport() { // 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); } @@ -1507,7 +1511,7 @@ void OpEmitter::genPropertiesSupport() { } )decl", name); - if (name == "odsOperandSegmentSizes") { + if (name == operandSegmentAttrName) { populateInherentAttrsMethod << formatv(" attrs.append(\"{0}\", {1});\n", operandSegmentAttrName, tgfmt(prop.getConvertToAttributeCall(), &fctx)); @@ -2015,7 +2019,7 @@ void OpEmitter::genNamedOperandGetters() { if (op.getTrait("::mlir::OpTrait::AttrSizedOperandSegments")) { if (op.getDialect().usePropertiesForAttributes()) attrSizeInitCode = formatv(adapterSegmentSizeAttrInitCodeProperties, - "getProperties().odsOperandSegmentSizes"); + "getProperties().operandSegmentSizes"); else attrSizeInitCode = formatv(opSegmentSizeAttrInitCode, @@ -2057,7 +2061,7 @@ void OpEmitter::genNamedOperandSetters() { body << formatv(", ::mlir::MutableOperandRange::OperandSegment({0}u, " "{{getOperandSegmentSizesAttrName(), " "DenseI32ArrayAttr::get(getContext(), " - "getProperties().odsOperandSegmentSizes)})", + "getProperties().operandSegmentSizes)})", i); else body << formatv( @@ -2116,7 +2120,7 @@ void OpEmitter::genNamedResultGetters() { if (attrSizedResults) { if (op.getDialect().usePropertiesForAttributes()) attrSizeInitCode = formatv(adapterSegmentSizeAttrInitCodeProperties, - "getProperties().odsResultSegmentSizes"); + "getProperties().resultSegmentSizes"); else attrSizeInitCode = formatv(opSegmentSizeAttrInitCode, @@ -2291,7 +2295,7 @@ void OpEmitter::genSeparateArgParamBuilder() { << ");\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()) { @@ -2321,7 +2325,7 @@ void OpEmitter::genSeparateArgParamBuilder() { if (op.getDialect().usePropertiesForAttributes()) { body << "}), " << builderOpState << ".getOrAddProperties()." - "odsResultSegmentSizes.begin());\n"; + "resultSegmentSizes.begin());\n"; } else { body << "}));\n"; } @@ -2947,7 +2951,7 @@ void OpEmitter::genCodeForAddingArgAndRegionForBuilder( emitSegment(); body << "}), " << builderOpState << ".getOrAddProperties()." - "odsOperandSegmentSizes.begin());\n"; + "operandSegmentSizes.begin());\n"; } else { body << " " << builderOpState << ".addAttribute(" << sizes << "AttrName(" << builderOpState << ".name), " @@ -3819,8 +3823,7 @@ OpOperandAdaptorEmitter::OpOperandAdaptorEmitter( 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. @@ -3935,7 +3938,7 @@ OpOperandAdaptorEmitter::OpOperandAdaptorEmitter( 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 index c38f873ddaba4..5f33f7faf80c0 100644 --- a/mlir/tools/mlir-tblgen/OpFormatGen.cpp +++ b/mlir/tools/mlir-tblgen/OpFormatGen.cpp @@ -1666,10 +1666,10 @@ void OperationFormat::genParserVariadicSegmentResolution(Operator &op, 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 @@ void OperationFormat::genParserVariadicSegmentResolution(Operator &op, 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 @@ static void genAttrDictPrinter(OperationFormat &fmt, Operator &op, // 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 index dd6e52d300efe..7c7b991fb7b07 100644 --- a/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp +++ b/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp @@ -170,7 +170,7 @@ constexpr const char *opVariadicSegmentTemplate = R"Py( 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 index ec15d30875755..4a01d2c52b645 100644 --- a/mlir/unittests/IR/AdaptorTest.cpp +++ b/mlir/unittests/IR/AdaptorTest.cpp @@ -39,7 +39,7 @@ TEST(Adaptor, GenericAdaptorsOperandAccess) { // 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);