Skip to content

Commit 3fe6268

Browse files
authored
[mlir][vector] Use result consistently as the result argument name (#144739)
This patch updates the following ops to use `result` (instead of `res`) as the name for their result argument: * `vector.scalable.insert` * `vector.scalable.extract` * `vector.insert_strided_slice` This change ensures naming consistency with other ops in the `vector` dialect. It addresses part of: * #131602
1 parent c0cc81c commit 3fe6268

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

mlir/include/mlir/Dialect/Vector/IR/VectorOps.td

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,15 +1008,15 @@ def Vector_InsertOp :
10081008
def Vector_ScalableInsertOp :
10091009
Vector_Op<"scalable.insert", [Pure,
10101010
AllElementTypesMatch<["valueToStore", "dest"]>,
1011-
AllTypesMatch<["dest", "res"]>,
1011+
AllTypesMatch<["dest", "result"]>,
10121012
PredOpTrait<"position is a multiple of the source length.",
10131013
CPred<
10141014
"(getPos() % getSourceVectorType().getNumElements()) == 0"
10151015
>>]>,
10161016
Arguments<(ins VectorOfRank<[1]>:$valueToStore,
10171017
ScalableVectorOfRank<[1]>:$dest,
10181018
I64Attr:$pos)>,
1019-
Results<(outs ScalableVectorOfRank<[1]>:$res)> {
1019+
Results<(outs ScalableVectorOfRank<[1]>:$result)> {
10201020
let summary = "insert subvector into scalable vector operation";
10211021
// NOTE: This operation is designed to map to `llvm.vector.insert`, and its
10221022
// documentation should be kept aligned with LLVM IR:
@@ -1059,19 +1059,23 @@ def Vector_ScalableInsertOp :
10591059
VectorType getDestVectorType() {
10601060
return ::llvm::cast<VectorType>(getDest().getType());
10611061
}
1062+
/// Wrapper for getResult, which replaced getRes.
1063+
[[deprecated("Use getResult instead!")]] ::mlir::Value getRes() {
1064+
return getResult();
1065+
}
10621066
}];
10631067
}
10641068

10651069
def Vector_ScalableExtractOp :
10661070
Vector_Op<"scalable.extract", [Pure,
1067-
AllElementTypesMatch<["source", "res"]>,
1071+
AllElementTypesMatch<["source", "result"]>,
10681072
PredOpTrait<"position is a multiple of the result length.",
10691073
CPred<
10701074
"(getPos() % getResultVectorType().getNumElements()) == 0"
10711075
>>]>,
10721076
Arguments<(ins ScalableVectorOfRank<[1]>:$source,
10731077
I64Attr:$pos)>,
1074-
Results<(outs VectorOfRank<[1]>:$res)> {
1078+
Results<(outs VectorOfRank<[1]>:$result)> {
10751079
let summary = "extract subvector from scalable vector operation";
10761080
// NOTE: This operation is designed to map to `llvm.vector.extract`, and its
10771081
// documentation should be kept aligned with LLVM IR:
@@ -1100,15 +1104,19 @@ def Vector_ScalableExtractOp :
11001104
}];
11011105

11021106
let assemblyFormat = [{
1103-
$source `[` $pos `]` attr-dict `:` type($res) `from` type($source)
1107+
$source `[` $pos `]` attr-dict `:` type($result) `from` type($source)
11041108
}];
11051109

11061110
let extraClassDeclaration = extraPoisonClassDeclaration # [{
11071111
VectorType getSourceVectorType() {
11081112
return ::llvm::cast<VectorType>(getSource().getType());
11091113
}
11101114
VectorType getResultVectorType() {
1111-
return ::llvm::cast<VectorType>(getRes().getType());
1115+
return ::llvm::cast<VectorType>(getResult().getType());
1116+
}
1117+
/// Wrapper for getResult, which replaced getRes.
1118+
[[deprecated("Use getResult instead!")]] ::mlir::Value getRes() {
1119+
return getResult();
11121120
}
11131121
}];
11141122
}
@@ -1117,10 +1125,10 @@ def Vector_InsertStridedSliceOp :
11171125
Vector_Op<"insert_strided_slice", [Pure,
11181126
PredOpTrait<"operand #0 and result have same element type",
11191127
TCresVTEtIsSameAsOpBase<0, 0>>,
1120-
AllTypesMatch<["dest", "res"]>]>,
1128+
AllTypesMatch<["dest", "result"]>]>,
11211129
Arguments<(ins AnyVectorOfNonZeroRank:$valueToStore, AnyVectorOfNonZeroRank:$dest, I64ArrayAttr:$offsets,
11221130
I64ArrayAttr:$strides)>,
1123-
Results<(outs AnyVectorOfNonZeroRank:$res)> {
1131+
Results<(outs AnyVectorOfNonZeroRank:$result)> {
11241132
let summary = "strided_slice operation";
11251133
let description = [{
11261134
Takes a k-D valueToStore vector, an n-D destination vector (n >= k), n-sized
@@ -1164,6 +1172,10 @@ def Vector_InsertStridedSliceOp :
11641172
return ::llvm::cast<IntegerAttr>(attr).getInt() != 1;
11651173
});
11661174
}
1175+
/// Wrapper for getResult, which replaced getRes.
1176+
[[deprecated("Use getResult instead!")]] ::mlir::Value getRes() {
1177+
return getResult();
1178+
}
11671179
}];
11681180

11691181
let hasFolder = 1;

0 commit comments

Comments
 (0)