diff --git a/mlir/include/mlir/Interfaces/ViewLikeInterface.td b/mlir/include/mlir/Interfaces/ViewLikeInterface.td --- a/mlir/include/mlir/Interfaces/ViewLikeInterface.td +++ b/mlir/include/mlir/Interfaces/ViewLikeInterface.td @@ -88,7 +88,7 @@ Return the dynamic offset operands. }], /*retTy=*/"::mlir::OperandRange", - /*methodName=*/"offsets", + /*methodName=*/"getOffsets", /*args=*/(ins), /*methodBody=*/"", /*defaultImplementation=*/[{ @@ -100,7 +100,7 @@ Return the dynamic size operands. }], /*retTy=*/"::mlir::OperandRange", - /*methodName=*/"sizes", + /*methodName=*/"getSizes", /*args=*/(ins), /*methodBody=*/"", /*defaultImplementation=*/[{ @@ -112,7 +112,7 @@ Return the dynamic stride operands. }], /*retTy=*/"::mlir::OperandRange", - /*methodName=*/"strides", + /*methodName=*/"getStrides", /*args=*/(ins), /*methodBody=*/"", /*defaultImplementation=*/[{ @@ -124,7 +124,7 @@ Return the static offset attributes. }], /*retTy=*/"::llvm::ArrayRef", - /*methodName=*/"static_offsets", + /*methodName=*/"getStaticOffsets", /*args=*/(ins), /*methodBody=*/"", /*defaultImplementation=*/[{ @@ -136,7 +136,7 @@ Return the static size attributes. }], /*retTy=*/"::llvm::ArrayRef", - /*methodName=*/"static_sizes", + /*methodName=*/"getStaticSizes", /*args=*/(ins), /*methodBody=*/"", /*defaultImplementation=*/[{ @@ -148,7 +148,7 @@ Return the dynamic stride attributes. }], /*retTy=*/"::llvm::ArrayRef", - /*methodName=*/"static_strides", + /*methodName=*/"getStaticStrides", /*args=*/(ins), /*methodBody=*/"", /*defaultImplementation=*/[{ @@ -179,7 +179,8 @@ /*methodBody=*/"", /*defaultImplementation=*/[{ Builder b($_op->getContext()); - return ::mlir::getMixedValues($_op.getStaticSizes(), $_op.sizes(), b); + return + ::mlir::getMixedValues($_op.getStaticSizes(), $_op.getSizes(), b); }] >, InterfaceMethod< @@ -204,7 +205,7 @@ /*args=*/(ins "unsigned":$idx), /*methodBody=*/"", /*defaultImplementation=*/[{ - return ::mlir::ShapedType::isDynamic(static_offsets()[idx]); + return ::mlir::ShapedType::isDynamic(getStaticOffsets()[idx]); }] >, InterfaceMethod< @@ -214,7 +215,7 @@ /*args=*/(ins "unsigned":$idx), /*methodBody=*/"", /*defaultImplementation=*/[{ - return ::mlir::ShapedType::isDynamic(static_sizes()[idx]); + return ::mlir::ShapedType::isDynamic(getStaticSizes()[idx]); }] >, InterfaceMethod< @@ -224,7 +225,7 @@ /*args=*/(ins "unsigned":$idx), /*methodBody=*/"", /*defaultImplementation=*/[{ - return ::mlir::ShapedType::isDynamic(static_strides()[idx]); + return ::mlir::ShapedType::isDynamic(getStaticStrides()[idx]); }] >, InterfaceMethod< @@ -237,7 +238,7 @@ /*methodBody=*/"", /*defaultImplementation=*/[{ assert(!$_op.isDynamicOffset(idx) && "expected static offset"); - return static_offsets()[idx]; + return getStaticOffsets()[idx]; }] >, InterfaceMethod< @@ -250,7 +251,7 @@ /*methodBody=*/"", /*defaultImplementation=*/[{ assert(!$_op.isDynamicSize(idx) && "expected static size"); - return static_sizes()[idx]; + return getStaticSizes()[idx]; }] >, InterfaceMethod< @@ -263,7 +264,7 @@ /*methodBody=*/"", /*defaultImplementation=*/[{ assert(!$_op.isDynamicStride(idx) && "expected static stride"); - return static_strides()[idx]; + return getStaticStrides()[idx]; }] >, @@ -279,9 +280,7 @@ /*defaultImplementation=*/[{ assert($_op.isDynamicOffset(idx) && "expected dynamic offset"); auto numDynamic = getNumDynamicEntriesUpToIdx( - static_offsets(), - ::mlir::ShapedType::isDynamic, - idx); + getStaticOffsets(), ::mlir::ShapedType::isDynamic, idx); return $_op.getOffsetSizeAndStrideStartOperandIndex() + numDynamic; }] >, @@ -297,9 +296,9 @@ /*defaultImplementation=*/[{ assert($_op.isDynamicSize(idx) && "expected dynamic size"); auto numDynamic = getNumDynamicEntriesUpToIdx( - static_sizes(), ::mlir::ShapedType::isDynamic, idx); + getStaticSizes(), ::mlir::ShapedType::isDynamic, idx); return $_op.getOffsetSizeAndStrideStartOperandIndex() + - offsets().size() + numDynamic; + getOffsets().size() + numDynamic; }] >, InterfaceMethod< @@ -314,17 +313,15 @@ /*defaultImplementation=*/[{ assert($_op.isDynamicStride(idx) && "expected dynamic stride"); auto numDynamic = getNumDynamicEntriesUpToIdx( - static_strides(), - ::mlir::ShapedType::isDynamic, - idx); + getStaticStrides(), ::mlir::ShapedType::isDynamic, idx); return $_op.getOffsetSizeAndStrideStartOperandIndex() + - offsets().size() + sizes().size() + numDynamic; + getOffsets().size() + getSizes().size() + numDynamic; }] >, InterfaceMethod< /*desc=*/[{ - Helper method to compute the number of dynamic entries of `staticVals`, up to - `idx` using `isDynamic` to determine whether an entry is dynamic. + Helper method to compute the number of dynamic entries of `staticVals`, + up to `idx` using `isDynamic` to determine whether an entry is dynamic. }], /*retTy=*/"unsigned", /*methodName=*/"getNumDynamicEntriesUpToIdx", @@ -386,7 +383,7 @@ /*retTy=*/"bool", /*methodName=*/"isSameAs", /*args=*/(ins "::mlir::OffsetSizeAndStrideOpInterface":$other, - "::llvm::function_ref":$cmp), + "::llvm::function_ref":$cmp), /*methodBody=*/"", /*defaultImplementation=*/[{ return ::mlir::detail::sameOffsetsSizesAndStrides( diff --git a/mlir/lib/Interfaces/ViewLikeInterface.cpp b/mlir/lib/Interfaces/ViewLikeInterface.cpp --- a/mlir/lib/Interfaces/ViewLikeInterface.cpp +++ b/mlir/lib/Interfaces/ViewLikeInterface.cpp @@ -57,14 +57,14 @@ << op.getMixedSizes().size() << " vs " << op.getMixedStrides().size() << ") so the rank of the result type is well-formed."; - if (failed(verifyListOfOperandsOrIntegers(op, "offset", maxRanks[0], - op.static_offsets(), op.offsets()))) + if (failed(verifyListOfOperandsOrIntegers( + op, "offset", maxRanks[0], op.getStaticOffsets(), op.getOffsets()))) return failure(); - if (failed(verifyListOfOperandsOrIntegers(op, "size", maxRanks[1], - op.static_sizes(), op.sizes()))) + if (failed(verifyListOfOperandsOrIntegers( + op, "size", maxRanks[1], op.getStaticSizes(), op.getSizes()))) return failure(); - if (failed(verifyListOfOperandsOrIntegers(op, "stride", maxRanks[2], - op.static_strides(), op.strides()))) + if (failed(verifyListOfOperandsOrIntegers( + op, "stride", maxRanks[2], op.getStaticStrides(), op.getStrides()))) return failure(); return success(); } @@ -179,11 +179,11 @@ bool mlir::detail::sameOffsetsSizesAndStrides( OffsetSizeAndStrideOpInterface a, OffsetSizeAndStrideOpInterface b, llvm::function_ref cmp) { - if (a.static_offsets().size() != b.static_offsets().size()) + if (a.getStaticOffsets().size() != b.getStaticOffsets().size()) return false; - if (a.static_sizes().size() != b.static_sizes().size()) + if (a.getStaticSizes().size() != b.getStaticSizes().size()) return false; - if (a.static_strides().size() != b.static_strides().size()) + if (a.getStaticStrides().size() != b.getStaticStrides().size()) return false; for (auto it : llvm::zip(a.getMixedOffsets(), b.getMixedOffsets())) if (!cmp(std::get<0>(it), std::get<1>(it)))