[Mlir-commits] [mlir] [mlir][vector][NFC] Rename getShapeForUnroll to getIterationShapeToUnroll (PR #232648)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Oct 16 02:02:58 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-vector
@llvm/pr-subscribers-mlir-arith
Author: Andrzej WarzyĆski (banach-space)
<details>
<summary>Changes</summary>
The old name was ambiguous about whether it returned the original shape
or the target shape for unrolling.
The new name makes clear that it returns the shape of the iteration
space to be unrolled. This can differ from the result shape: for example,
vector.contract includes reduction dimensions in its iteration space
that are absent from its result shape.
---
Patch is 25.08 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/232648.diff
11 Files Affected:
- (modified) mlir/include/mlir/Dialect/Arith/IR/ArithOps.td (+4-4)
- (modified) mlir/include/mlir/Dialect/Math/IR/MathOps.td (+1-1)
- (modified) mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td (+1-1)
- (modified) mlir/include/mlir/Dialect/Vector/IR/VectorOps.td (+15-15)
- (modified) mlir/include/mlir/Interfaces/VectorInterfaces.td (+11-4)
- (modified) mlir/lib/Dialect/Arith/IR/ArithOps.cpp (+4-4)
- (modified) mlir/lib/Dialect/ArmNeon/Transforms/LowerContractToNeonPatterns.cpp (+2-2)
- (modified) mlir/lib/Dialect/Math/IR/MathOps.cpp (+2-1)
- (modified) mlir/lib/Dialect/Tosa/IR/TosaOps.cpp (+2-1)
- (modified) mlir/lib/Dialect/Vector/IR/VectorOps.cpp (+24-15)
- (modified) mlir/lib/Dialect/Vector/Transforms/VectorUnroll.cpp (+13-8)
``````````diff
diff --git a/mlir/include/mlir/Dialect/Arith/IR/ArithOps.td b/mlir/include/mlir/Dialect/Arith/IR/ArithOps.td
index 219fb12ab4ed1c..4e7b85c534209c 100644
--- a/mlir/include/mlir/Dialect/Arith/IR/ArithOps.td
+++ b/mlir/include/mlir/Dialect/Arith/IR/ArithOps.td
@@ -354,7 +354,7 @@ def Arith_AddUIExtendedOp : Arith_Op<"addui_extended", [Pure, Commutative,
let hasCanonicalizer = 1;
let extraClassDeclaration = [{
- std::optional<SmallVector<int64_t, 4>> getShapeForUnroll();
+ std::optional<SmallVector<int64_t, 4>> getIterationShapeToUnroll();
}];
}
@@ -407,7 +407,7 @@ def Arith_SubUIExtendedOp : Arith_Op<"subui_extended", [Pure,
let hasCanonicalizer = 1;
let extraClassDeclaration = [{
- std::optional<SmallVector<int64_t, 4>> getShapeForUnroll();
+ std::optional<SmallVector<int64_t, 4>> getIterationShapeToUnroll();
}];
}
@@ -543,7 +543,7 @@ def Arith_MulSIExtendedOp : Arith_Op<"mulsi_extended", [Pure, Commutative,
let hasCanonicalizer = 1;
let extraClassDeclaration = [{
- std::optional<SmallVector<int64_t, 4>> getShapeForUnroll();
+ std::optional<SmallVector<int64_t, 4>> getIterationShapeToUnroll();
}];
}
@@ -586,7 +586,7 @@ def Arith_MulUIExtendedOp : Arith_Op<"mului_extended", [Pure, Commutative,
let hasCanonicalizer = 1;
let extraClassDeclaration = [{
- std::optional<SmallVector<int64_t, 4>> getShapeForUnroll();
+ std::optional<SmallVector<int64_t, 4>> getIterationShapeToUnroll();
}];
}
diff --git a/mlir/include/mlir/Dialect/Math/IR/MathOps.td b/mlir/include/mlir/Dialect/Math/IR/MathOps.td
index 5debb3c57a319d..d06ea9ef2f7b56 100644
--- a/mlir/include/mlir/Dialect/Math/IR/MathOps.td
+++ b/mlir/include/mlir/Dialect/Math/IR/MathOps.td
@@ -583,7 +583,7 @@ def Math_SincosOp : Math_Op<"sincos",
attr-dict `:` type($operand) }];
let extraClassDeclaration = [{
- std::optional<SmallVector<int64_t, 4>> getShapeForUnroll();
+ std::optional<SmallVector<int64_t, 4>> getIterationShapeToUnroll();
}];
let hasFolder = 1;
diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td b/mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td
index fd23ff78798663..9ba3c31613ff15 100644
--- a/mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td
+++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td
@@ -52,7 +52,7 @@ def Tosa_ApplyScaleOp :
);
let extraClassDeclaration = [{
- std::optional<SmallVector<int64_t, 4>> getShapeForUnroll();
+ std::optional<SmallVector<int64_t, 4>> getIterationShapeToUnroll();
}];
let assemblyFormat =
diff --git a/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td b/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
index 291b1d5049116f..437d0f7c4ee029 100644
--- a/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
+++ b/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
@@ -54,7 +54,7 @@ def Vector_ContractionOp :
TCresVTEtIsSameAsOpBase<0, 2>>,
DeclareOpInterfaceMethods<ArithFastMathInterface>,
DeclareOpInterfaceMethods<MaskableOpInterface>,
- DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getShapeForUnroll"]>
+ DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getIterationShapeToUnroll"]>
]>,
Arguments<(ins AnyVectorOfNonZeroRankNonI0Elem:$lhs, AnyVectorOfNonZeroRankNonI0Elem:$rhs, AnyType:$acc,
ArrayAttr:$indexing_maps,
@@ -273,7 +273,7 @@ def Vector_ReductionOp :
"dest", "acc", "::llvm::cast<Type>($_self)">,
DeclareOpInterfaceMethods<ArithFastMathInterface>,
DeclareOpInterfaceMethods<MaskableOpInterface>,
- DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getShapeForUnroll"]>
+ DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getIterationShapeToUnroll"]>
]>,
Arguments<(ins Vector_CombiningKindAttr:$kind,
AnyVectorOfNonI0Elem:$vector,
@@ -334,7 +334,7 @@ def Vector_MultiDimReductionOp :
DeclareOpInterfaceMethods<InferTypeOpInterface>,
DeclareOpInterfaceMethods<MaskableOpInterface>,
DeclareOpInterfaceMethods<VectorUnrollOpInterface,
- ["getShapeForUnroll"]>]>,
+ ["getIterationShapeToUnroll"]>]>,
Arguments<(ins Vector_CombiningKindAttr:$kind,
AnyVectorOfNonZeroRankNonI0Elem:$source,
AnyType:$acc,
@@ -398,7 +398,7 @@ def Vector_MultiDimReductionOp :
def Vector_BroadcastOp :
Vector_Op<"broadcast", [Pure,
- DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getShapeForUnroll"]>,
+ DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getIterationShapeToUnroll"]>,
DeclareOpInterfaceMethods<InferIntRangeInterface, ["inferResultRanges"]>,
PredOpTrait<"source operand and result have same element type",
TCresVTEtIsSameAsOpBase<0, 0>>]>,
@@ -572,7 +572,7 @@ def ResultIsDoubleSourceVectorType : TypesMatchWith<
def Vector_InterleaveOp :
Vector_Op<"interleave", [Pure, AllTypesMatch<["lhs", "rhs"]>,
ResultIsDoubleSourceVectorType,
- DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getShapeForUnroll"]>]> {
+ DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getIterationShapeToUnroll"]>]> {
let summary = "constructs a vector by interleaving two input vectors";
let description = [{
The interleave operation constructs a new vector by interleaving the
@@ -651,7 +651,7 @@ def Vector_DeinterleaveOp :
SourceVectorEvenElementCount,
ResultIsHalfSourceVectorType<"res1">,
AllTypesMatch<["res1", "res2"]>,
- DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getShapeForUnroll"]>
+ DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getIterationShapeToUnroll"]>
]> {
let summary = "constructs two vectors by deinterleaving an input vector";
let description = [{
@@ -780,7 +780,7 @@ def Vector_ExtractOp :
def Vector_FMAOp :
Op<Vector_Dialect, "fma", [
Pure, AllTypesMatch<["lhs", "rhs", "acc", "result"]>,
- DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getShapeForUnroll"]>
+ DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getIterationShapeToUnroll"]>
] # ElementwiseMappable.traits>,
Arguments<(ins VectorOfAnyRankOf<[AnyFloat]>:$lhs,
VectorOfAnyRankOf<[AnyFloat]>:$rhs,
@@ -1290,7 +1290,7 @@ def Vector_ExtractStridedSliceOp :
def Vector_TransferReadOp :
Vector_Op<"transfer_read", [
DeclareOpInterfaceMethods<VectorTransferOpInterface>,
- DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getShapeForUnroll"]>,
+ DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getIterationShapeToUnroll"]>,
DeclareOpInterfaceMethods<MaskableOpInterface>,
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>,
DeclareOpInterfaceMethods<ConditionallySpeculatable>,
@@ -1544,7 +1544,7 @@ def Vector_TransferReadOp :
def Vector_TransferWriteOp :
Vector_Op<"transfer_write", [
DeclareOpInterfaceMethods<VectorTransferOpInterface>,
- DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getShapeForUnroll"]>,
+ DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getIterationShapeToUnroll"]>,
DeclareOpInterfaceMethods<MaskableOpInterface>,
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>,
DeclareOpInterfaceMethods<ConditionallySpeculatable>,
@@ -1706,7 +1706,7 @@ def Vector_TransferWriteOp :
// Promises IndexedAccessOpInterface.
def Vector_LoadOp : Vector_Op<"load", [
- DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getShapeForUnroll"]>,
+ DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getIterationShapeToUnroll"]>,
DeclareOpInterfaceMethods<MemorySpaceCastConsumerOpInterface>,
DeclareOpInterfaceMethods<AlignmentAttrOpInterface>
]> {
@@ -1834,7 +1834,7 @@ def Vector_LoadOp : Vector_Op<"load", [
// Promises IndexedAccessOpInterface.
def Vector_StoreOp : Vector_Op<"store", [
- DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getShapeForUnroll"]>,
+ DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getIterationShapeToUnroll"]>,
DeclareOpInterfaceMethods<MemorySpaceCastConsumerOpInterface>,
DeclareOpInterfaceMethods<AlignmentAttrOpInterface>
]> {
@@ -2143,7 +2143,7 @@ def Vector_GatherOp :
Vector_Op<"gather", [
DeclareOpInterfaceMethods<MaskableOpInterface>,
DeclareOpInterfaceMethods<MemorySpaceCastConsumerOpInterface>,
- DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getShapeForUnroll"]>,
+ DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getIterationShapeToUnroll"]>,
DeclareOpInterfaceMethods<AlignmentAttrOpInterface>
]>,
Arguments<(ins Arg<TensorOrMemRef<[AnyType]>, "", [MemRead]>:$base,
@@ -2523,7 +2523,7 @@ def Vector_CompressStoreOp :
def Vector_ShapeCastOp :
Vector_Op<"shape_cast", [Pure,
- DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getShapeForUnroll"]>,
+ DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getIterationShapeToUnroll"]>,
DeclareOpInterfaceMethods<InferIntRangeInterface, ["inferResultRanges"]>
]>,
Arguments<(ins AnyVectorOfAnyRank:$source)>,
@@ -2569,7 +2569,7 @@ def Vector_ShapeCastOp :
def Vector_BitCastOp :
Vector_Op<"bitcast", [Pure, AllRanksMatch<["source", "result"]>,
- DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getShapeForUnroll"]>]>,
+ DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getIterationShapeToUnroll"]>]>,
Arguments<(ins AnyVectorOfNonI0Elem:$source)>,
Results<(outs AnyVectorOfNonI0Elem:$result)>{
let summary = "bitcast casts between vectors";
@@ -2863,7 +2863,7 @@ def Vector_MaskOp : Vector_Op<"mask", [
def Vector_TransposeOp :
Vector_Op<"transpose", [Pure,
DeclareOpInterfaceMethods<InferIntRangeInterface, ["inferResultRanges"]>,
- DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getShapeForUnroll"]>,
+ DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getIterationShapeToUnroll"]>,
PredOpTrait<"operand and result have same element type",
TCresVTEtIsSameAsOpBase<0, 0>>]> {
let summary = "vector transpose operation";
diff --git a/mlir/include/mlir/Interfaces/VectorInterfaces.td b/mlir/include/mlir/Interfaces/VectorInterfaces.td
index 3ba8ac4fc0a0a0..9123a751099cb7 100644
--- a/mlir/include/mlir/Interfaces/VectorInterfaces.td
+++ b/mlir/include/mlir/Interfaces/VectorInterfaces.td
@@ -24,12 +24,19 @@ def VectorUnrollOpInterface : OpInterface<"VectorUnrollOpInterface"> {
let methods = [
InterfaceMethod<
/*desc=*/[{
- Return the shape ratio of unrolling to the target vector shape
- `targetShape`. Return `std::nullopt` if the op cannot be unrolled to the
- target vector shape.
+ Return the shape of the iteration space to unroll.
+
+ For most vector operations, this is identical to the result shape.
+ For operations such as vector.contract, it also includes reduction
+ dimensions that are absent from the result shape, so unrolling accounts
+ for all iteration dimensions.
+
+ For operations that support both vector and scalar operands, return
+ the iteration shape when operating on vectors, or std::nullopt when
+ operating on scalars to indicate that there is nothing to unroll.
}],
/*retTy=*/"::std::optional<::llvm::SmallVector<int64_t, 4>>",
- /*methodName=*/"getShapeForUnroll",
+ /*methodName=*/"getIterationShapeToUnroll",
/*args=*/(ins),
/*methodBody=*/"",
/*defaultImplementation=*/[{
diff --git a/mlir/lib/Dialect/Arith/IR/ArithOps.cpp b/mlir/lib/Dialect/Arith/IR/ArithOps.cpp
index 40fcfa5c458819..dcb8163385f184 100644
--- a/mlir/lib/Dialect/Arith/IR/ArithOps.cpp
+++ b/mlir/lib/Dialect/Arith/IR/ArithOps.cpp
@@ -461,7 +461,7 @@ void arith::AddIOp::getCanonicalizationPatterns(RewritePatternSet &patterns,
//===----------------------------------------------------------------------===//
std::optional<SmallVector<int64_t, 4>>
-arith::AddUIExtendedOp::getShapeForUnroll() {
+arith::AddUIExtendedOp::getIterationShapeToUnroll() {
if (auto vt = dyn_cast<VectorType>(getType(0)))
return llvm::to_vector<4>(vt.getShape());
return std::nullopt;
@@ -525,7 +525,7 @@ void arith::AddUIExtendedOp::getCanonicalizationPatterns(
//===----------------------------------------------------------------------===//
std::optional<SmallVector<int64_t, 4>>
-arith::SubUIExtendedOp::getShapeForUnroll() {
+arith::SubUIExtendedOp::getIterationShapeToUnroll() {
if (auto vt = dyn_cast<VectorType>(getType(0)))
return llvm::to_vector<4>(vt.getShape());
return std::nullopt;
@@ -697,7 +697,7 @@ void arith::MulIOp::getCanonicalizationPatterns(RewritePatternSet &patterns,
//===----------------------------------------------------------------------===//
std::optional<SmallVector<int64_t, 4>>
-arith::MulSIExtendedOp::getShapeForUnroll() {
+arith::MulSIExtendedOp::getIterationShapeToUnroll() {
if (auto vt = dyn_cast<VectorType>(getType(0)))
return llvm::to_vector<4>(vt.getShape());
return std::nullopt;
@@ -741,7 +741,7 @@ void arith::MulSIExtendedOp::getCanonicalizationPatterns(
//===----------------------------------------------------------------------===//
std::optional<SmallVector<int64_t, 4>>
-arith::MulUIExtendedOp::getShapeForUnroll() {
+arith::MulUIExtendedOp::getIterationShapeToUnroll() {
if (auto vt = dyn_cast<VectorType>(getType(0)))
return llvm::to_vector<4>(vt.getShape());
return std::nullopt;
diff --git a/mlir/lib/Dialect/ArmNeon/Transforms/LowerContractToNeonPatterns.cpp b/mlir/lib/Dialect/ArmNeon/Transforms/LowerContractToNeonPatterns.cpp
index d776d51480671f..887f8afa48fc6c 100644
--- a/mlir/lib/Dialect/ArmNeon/Transforms/LowerContractToNeonPatterns.cpp
+++ b/mlir/lib/Dialect/ArmNeon/Transforms/LowerContractToNeonPatterns.cpp
@@ -395,7 +395,7 @@ class VectorContractRewriterI8MM : public VectorContractRewriter {
rewriter);
// Initialize parameters for unrolling.
- iterationBounds = *op.getShapeForUnroll();
+ iterationBounds = *op.getIterationShapeToUnroll();
if (iterationBounds.size() == 3)
subTileShape = SmallVector<int64_t>({dimM == 1 ? 1 : 2, 2, 8});
else
@@ -436,7 +436,7 @@ class VectorContractRewriterBFMMLA : public VectorContractRewriter {
acc = op.getAcc();
// Initialize parameters for unrolling.
- iterationBounds = *op.getShapeForUnroll();
+ iterationBounds = *op.getIterationShapeToUnroll();
if (iterationBounds.size() == 3)
subTileShape = SmallVector<int64_t>({dimM == 1 ? 1 : 2, 2, 4});
else
diff --git a/mlir/lib/Dialect/Math/IR/MathOps.cpp b/mlir/lib/Dialect/Math/IR/MathOps.cpp
index c012b26d285c68..b8c8918f1fc964 100644
--- a/mlir/lib/Dialect/Math/IR/MathOps.cpp
+++ b/mlir/lib/Dialect/Math/IR/MathOps.cpp
@@ -305,7 +305,8 @@ OpFoldResult math::SinhOp::fold(FoldAdaptor adaptor) {
// SinCosOp
//===----------------------------------------------------------------------===//
-std::optional<SmallVector<int64_t, 4>> math::SincosOp::getShapeForUnroll() {
+std::optional<SmallVector<int64_t, 4>>
+math::SincosOp::getIterationShapeToUnroll() {
if (auto vt = mlir::dyn_cast<VectorType>(getOperand().getType()))
return llvm::to_vector<4>(vt.getShape());
return std::nullopt;
diff --git a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
index 838d039cb2c24a..c9789efd02db25 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
@@ -5394,7 +5394,8 @@ LogicalResult WhileOp::inferReturnTypeComponents(
return success();
}
-std::optional<SmallVector<int64_t, 4>> ApplyScaleOp::getShapeForUnroll() {
+std::optional<SmallVector<int64_t, 4>>
+ApplyScaleOp::getIterationShapeToUnroll() {
if (auto vt = llvm::dyn_cast<VectorType>(getType()))
return llvm::to_vector<4>(vt.getShape());
return std::nullopt;
diff --git a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
index 252b92cd5c56c5..490202f2dc9778 100644
--- a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
+++ b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
@@ -617,7 +617,7 @@ OpFoldResult MultiDimReductionOp::fold(FoldAdaptor adaptor) {
}
std::optional<SmallVector<int64_t, 4>>
-MultiDimReductionOp::getShapeForUnroll() {
+MultiDimReductionOp::getIterationShapeToUnroll() {
return llvm::to_vector<4>(getSourceVectorType().getShape());
}
@@ -825,7 +825,8 @@ Value mlir::vector::getVectorReductionOp(arith::AtomicRMWKind op,
return nullptr;
}
-std::optional<SmallVector<int64_t, 4>> ReductionOp::getShapeForUnroll() {
+std::optional<SmallVector<int64_t, 4>>
+ReductionOp::getIterationShapeToUnroll() {
return llvm::to_vector<4>(getSourceVectorType().getShape());
}
@@ -1330,7 +1331,8 @@ std::vector<std::pair<int64_t, int64_t>> ContractionOp::getBatchDimMap() {
getContext());
}
-std::optional<SmallVector<int64_t, 4>> ContractionOp::getShapeForUnroll() {
+std::optional<SmallVector<int64_t, 4>>
+ContractionOp::getIterationShapeToUnroll() {
SmallVector<int64_t, 4> shape;
getIterationBounds(shape);
return shape;
@@ -2639,7 +2641,7 @@ static void populateFromInt64AttrArray(ArrayAttr arrayAttr,
// FmaOp
//===----------------------------------------------------------------------===//
-std::optional<SmallVector<int64_t, 4>> FMAOp::getShapeForUnroll() {
+std::optional<SmallVector<int64_t, 4>> FMAOp::getIterationShapeToUnroll() {
return llvm::to_vector<4>(getVectorType().getShape());
}
@@ -3050,7 +3052,8 @@ void BroadcastOp::inferResultRanges(ArrayRef<ConstantIntRanges> argRanges,
setResultRanges(getResult(), argRanges.front());
}
-std::optional<SmallVector<int64_t, 4>> BroadcastOp::getShapeForUnroll() {
+std::optional<SmallVector<int64_t, 4>>
+BroadcastOp::getIterationShapeToUnroll() {
return llvm::to_vector<4>(getResultVectorType().getShape());
}
@@ -5580,7 +5583,8 @@ OpFoldResult TransferReadOp::fold(FoldAdaptor) {
return OpFoldResult();
}
-std::optional<SmallVector<int64_t, 4>> TransferReadOp::getShapeForUnroll() {
+std::optional<SmallVector<int64_t, 4>>
+TransferReadOp::getIterationShapeToUnroll() {
return llvm::to_vector<4>(getVectorType().getShape());
}
@@ -6035,7 +6039,8 @@ LogicalResult TransferWriteOp::fold(FoldAdaptor adaptor,
//===----------------------------------------------------------------------===//
// TransferWriteOp: other methods.
//===----------------------------------------------------------------------===//
-std::optional<SmallVector<int64_t, 4>> TransferWriteOp::getShapeForUnroll() {
+std::optional<SmallVector<int64_t, 4>>
+TransferWriteOp::getIterationShapeToUnroll() {
return llvm::to_vector<4>(getVectorType().getShape());
}
@@ -6301,7 +6306,7 @@ OpFoldResult LoadOp::fold(FoldAdaptor) {
return OpFoldResult();
}
-std::optional<SmallVector<int64_t, 4>> LoadOp::getShapeForUnroll() {
+std::optional<SmallVector<int64_t, 4>> LoadOp::getIterationShapeToUnroll() {
return llvm::to_vector<4>(getVectorType().getShape());
}
@@ -6352,7 +6357,7 @@ LogicalResult StoreOp::fold(FoldAdaptor adaptor,
return memref::foldMemRefCast(*this);
}
-std::optional<SmallVector<int64_t, 4>> StoreOp::getShapeForUnroll() {
+std::optional<SmallVector<int64_t, 4>> StoreOp::getIterationShapeToUnroll() {
return llvm::to_vector<4>(getVectorType().getShape());
}
@@ -6547,7 +6552,7 @@ Type GatherOp::getExpectedMaskType() {
vecType.getScalableDims());
}
-std::optional<SmallVector<int64_t, 4>> GatherOp::getShapeForUnroll() {
+std::optional<SmallVector<int64_t, 4>> GatherOp::getIterationShapeToUnroll() {
return llvm::to_vector<4>(getVectorType().getShape());
}
@@ -6858,7 +6863,8 @@ void ShapeCastOp::inferResultRanges(ArrayRef<ConstantIntRanges> argRanges,
setResultRanges(getResult(), argRanges.front());
}
-std::optional<SmallVector<int64_t, 4>> ShapeCastOp::getShapeForUnroll() {
+std::optional<SmallVector<int64_t, 4>>
+ShapeCastOp::getIterationShapeToUnroll() {
return llvm::to_vector<4>(getResultVectorType().getShape());
}
@@ -7363,7 +7369,7 @@ OpFoldResult BitCastOp::fold(FoldAdaptor adaptor) {
return {};
}
-std::optional<SmallVector<int64_t, 4>> BitCastOp::getShapeForUnroll() {
+std::optional<SmallVector<int64_t, 4>> BitCastOp::getIterationShapeToUnroll() {
return llvm::to_v...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/232648
More information about the Mlir-commits
mailing list