[Mlir-commits] [mlir] a1f04b7 - [mlir][Interfaces][NFC] Use camel case for offset/size/stride accessors
Matthias Springer
llvmlistbot at llvm.org
Thu Aug 3 02:36:46 PDT 2023
Author: Matthias Springer
Date: 2023-08-03T11:32:17+02:00
New Revision: a1f04b7037ad43e27dc196a687d954c78a97247a
URL: https://github.com/llvm/llvm-project/commit/a1f04b7037ad43e27dc196a687d954c78a97247a
DIFF: https://github.com/llvm/llvm-project/commit/a1f04b7037ad43e27dc196a687d954c78a97247a.diff
LOG: [mlir][Interfaces][NFC] Use camel case for offset/size/stride accessors
This is for consistency with the remaining MLIR code base.
Differential Revision: https://reviews.llvm.org/D156857
Added:
Modified:
mlir/include/mlir/Interfaces/ViewLikeInterface.td
mlir/lib/Interfaces/ViewLikeInterface.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Interfaces/ViewLikeInterface.td b/mlir/include/mlir/Interfaces/ViewLikeInterface.td
index 4cddcc1764690e..6c5e7c6a93302c 100644
--- a/mlir/include/mlir/Interfaces/ViewLikeInterface.td
+++ b/mlir/include/mlir/Interfaces/ViewLikeInterface.td
@@ -88,7 +88,7 @@ def OffsetSizeAndStrideOpInterface : OpInterface<"OffsetSizeAndStrideOpInterface
Return the dynamic offset operands.
}],
/*retTy=*/"::mlir::OperandRange",
- /*methodName=*/"offsets",
+ /*methodName=*/"getOffsets",
/*args=*/(ins),
/*methodBody=*/"",
/*defaultImplementation=*/[{
@@ -100,7 +100,7 @@ def OffsetSizeAndStrideOpInterface : OpInterface<"OffsetSizeAndStrideOpInterface
Return the dynamic size operands.
}],
/*retTy=*/"::mlir::OperandRange",
- /*methodName=*/"sizes",
+ /*methodName=*/"getSizes",
/*args=*/(ins),
/*methodBody=*/"",
/*defaultImplementation=*/[{
@@ -112,7 +112,7 @@ def OffsetSizeAndStrideOpInterface : OpInterface<"OffsetSizeAndStrideOpInterface
Return the dynamic stride operands.
}],
/*retTy=*/"::mlir::OperandRange",
- /*methodName=*/"strides",
+ /*methodName=*/"getStrides",
/*args=*/(ins),
/*methodBody=*/"",
/*defaultImplementation=*/[{
@@ -124,7 +124,7 @@ def OffsetSizeAndStrideOpInterface : OpInterface<"OffsetSizeAndStrideOpInterface
Return the static offset attributes.
}],
/*retTy=*/"::llvm::ArrayRef<int64_t>",
- /*methodName=*/"static_offsets",
+ /*methodName=*/"getStaticOffsets",
/*args=*/(ins),
/*methodBody=*/"",
/*defaultImplementation=*/[{
@@ -136,7 +136,7 @@ def OffsetSizeAndStrideOpInterface : OpInterface<"OffsetSizeAndStrideOpInterface
Return the static size attributes.
}],
/*retTy=*/"::llvm::ArrayRef<int64_t>",
- /*methodName=*/"static_sizes",
+ /*methodName=*/"getStaticSizes",
/*args=*/(ins),
/*methodBody=*/"",
/*defaultImplementation=*/[{
@@ -148,7 +148,7 @@ def OffsetSizeAndStrideOpInterface : OpInterface<"OffsetSizeAndStrideOpInterface
Return the dynamic stride attributes.
}],
/*retTy=*/"::llvm::ArrayRef<int64_t>",
- /*methodName=*/"static_strides",
+ /*methodName=*/"getStaticStrides",
/*args=*/(ins),
/*methodBody=*/"",
/*defaultImplementation=*/[{
@@ -179,7 +179,8 @@ def OffsetSizeAndStrideOpInterface : OpInterface<"OffsetSizeAndStrideOpInterface
/*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 @@ def OffsetSizeAndStrideOpInterface : OpInterface<"OffsetSizeAndStrideOpInterface
/*args=*/(ins "unsigned":$idx),
/*methodBody=*/"",
/*defaultImplementation=*/[{
- return ::mlir::ShapedType::isDynamic(static_offsets()[idx]);
+ return ::mlir::ShapedType::isDynamic(getStaticOffsets()[idx]);
}]
>,
InterfaceMethod<
@@ -214,7 +215,7 @@ def OffsetSizeAndStrideOpInterface : OpInterface<"OffsetSizeAndStrideOpInterface
/*args=*/(ins "unsigned":$idx),
/*methodBody=*/"",
/*defaultImplementation=*/[{
- return ::mlir::ShapedType::isDynamic(static_sizes()[idx]);
+ return ::mlir::ShapedType::isDynamic(getStaticSizes()[idx]);
}]
>,
InterfaceMethod<
@@ -224,7 +225,7 @@ def OffsetSizeAndStrideOpInterface : OpInterface<"OffsetSizeAndStrideOpInterface
/*args=*/(ins "unsigned":$idx),
/*methodBody=*/"",
/*defaultImplementation=*/[{
- return ::mlir::ShapedType::isDynamic(static_strides()[idx]);
+ return ::mlir::ShapedType::isDynamic(getStaticStrides()[idx]);
}]
>,
InterfaceMethod<
@@ -237,7 +238,7 @@ def OffsetSizeAndStrideOpInterface : OpInterface<"OffsetSizeAndStrideOpInterface
/*methodBody=*/"",
/*defaultImplementation=*/[{
assert(!$_op.isDynamicOffset(idx) && "expected static offset");
- return static_offsets()[idx];
+ return getStaticOffsets()[idx];
}]
>,
InterfaceMethod<
@@ -250,7 +251,7 @@ def OffsetSizeAndStrideOpInterface : OpInterface<"OffsetSizeAndStrideOpInterface
/*methodBody=*/"",
/*defaultImplementation=*/[{
assert(!$_op.isDynamicSize(idx) && "expected static size");
- return static_sizes()[idx];
+ return getStaticSizes()[idx];
}]
>,
InterfaceMethod<
@@ -263,7 +264,7 @@ def OffsetSizeAndStrideOpInterface : OpInterface<"OffsetSizeAndStrideOpInterface
/*methodBody=*/"",
/*defaultImplementation=*/[{
assert(!$_op.isDynamicStride(idx) && "expected static stride");
- return static_strides()[idx];
+ return getStaticStrides()[idx];
}]
>,
@@ -279,9 +280,7 @@ def OffsetSizeAndStrideOpInterface : OpInterface<"OffsetSizeAndStrideOpInterface
/*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 @@ def OffsetSizeAndStrideOpInterface : OpInterface<"OffsetSizeAndStrideOpInterface
/*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 @@ def OffsetSizeAndStrideOpInterface : OpInterface<"OffsetSizeAndStrideOpInterface
/*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 @@ def OffsetSizeAndStrideOpInterface : OpInterface<"OffsetSizeAndStrideOpInterface
/*retTy=*/"bool",
/*methodName=*/"isSameAs",
/*args=*/(ins "::mlir::OffsetSizeAndStrideOpInterface":$other,
- "::llvm::function_ref<bool(::mlir::OpFoldResult, ::mlir::OpFoldResult)>":$cmp),
+ "::llvm::function_ref<bool(::mlir::OpFoldResult, ::mlir::OpFoldResult)>":$cmp),
/*methodBody=*/"",
/*defaultImplementation=*/[{
return ::mlir::detail::sameOffsetsSizesAndStrides(
diff --git a/mlir/lib/Interfaces/ViewLikeInterface.cpp b/mlir/lib/Interfaces/ViewLikeInterface.cpp
index 7d350b110ce237..907c3534d2af31 100644
--- a/mlir/lib/Interfaces/ViewLikeInterface.cpp
+++ b/mlir/lib/Interfaces/ViewLikeInterface.cpp
@@ -57,14 +57,14 @@ mlir::detail::verifyOffsetSizeAndStrideOp(OffsetSizeAndStrideOpInterface op) {
<< 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 @@ ParseResult mlir::parseDynamicIndexList(
bool mlir::detail::sameOffsetsSizesAndStrides(
OffsetSizeAndStrideOpInterface a, OffsetSizeAndStrideOpInterface b,
llvm::function_ref<bool(OpFoldResult, OpFoldResult)> 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)))
More information about the Mlir-commits
mailing list