Skip to content

Commit 7c8fd23

Browse files
committed
Revert formatting changes, add deprecated getSource method
1 parent 460adfa commit 7c8fd23

File tree

2 files changed

+121
-92
lines changed

2 files changed

+121
-92
lines changed

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

Lines changed: 58 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,20 +1263,23 @@ def Vector_ExtractStridedSliceOp :
12631263

12641264
// TODO: Tighten semantics so that masks and inbounds can't be used
12651265
// simultaneously within the same transfer op.
1266-
def Vector_TransferReadOp
1267-
: Vector_Op<"transfer_read",
1268-
[DeclareOpInterfaceMethods<VectorTransferOpInterface>,
1269-
DeclareOpInterfaceMethods<
1270-
VectorUnrollOpInterface, ["getShapeForUnroll"]>,
1271-
DeclareOpInterfaceMethods<MaskableOpInterface>,
1272-
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>,
1273-
DeclareOpInterfaceMethods<ConditionallySpeculatable>,
1274-
AttrSizedOperandSegments, DestinationStyleOpInterface]>,
1275-
Arguments<(ins AnyShaped:$base, Variadic<Index>:$indices,
1276-
AffineMapAttr:$permutation_map, AnyType:$padding,
1277-
Optional<VectorOfNonZeroRankOf<[I1]>>:$mask,
1278-
BoolArrayAttr:$in_bounds)>,
1279-
Results<(outs AnyVectorOfAnyRank:$vector)> {
1266+
def Vector_TransferReadOp :
1267+
Vector_Op<"transfer_read", [
1268+
DeclareOpInterfaceMethods<VectorTransferOpInterface>,
1269+
DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getShapeForUnroll"]>,
1270+
DeclareOpInterfaceMethods<MaskableOpInterface>,
1271+
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>,
1272+
DeclareOpInterfaceMethods<ConditionallySpeculatable>,
1273+
AttrSizedOperandSegments,
1274+
DestinationStyleOpInterface
1275+
]>,
1276+
Arguments<(ins AnyShaped:$base,
1277+
Variadic<Index>:$indices,
1278+
AffineMapAttr:$permutation_map,
1279+
AnyType:$padding,
1280+
Optional<VectorOfNonZeroRankOf<[I1]>>:$mask,
1281+
BoolArrayAttr:$in_bounds)>,
1282+
Results<(outs AnyVectorOfAnyRank:$vector)> {
12801283

12811284
let summary = "Reads a supervector from memory into an SSA vector value.";
12821285

@@ -1465,25 +1468,30 @@ def Vector_TransferReadOp
14651468
}];
14661469

14671470
let builders = [
1468-
/// 1. Builder that sets padding to zero and an empty mask (variant with
1469-
/// attrs).
1470-
OpBuilder<(ins "VectorType":$vectorType, "Value":$base,
1471-
"ValueRange":$indices, "AffineMapAttr":$permutationMapAttr,
1472-
"ArrayAttr":$inBoundsAttr)>,
1473-
/// 2. Builder that sets padding to zero and an empty mask (variant
1474-
/// without attrs).
1475-
OpBuilder<(ins "VectorType":$vectorType, "Value":$base,
1476-
"ValueRange":$indices, "AffineMap":$permutationMap,
1477-
CArg<"std::optional<ArrayRef<bool>>", "::std::nullopt">:$inBounds)>,
1478-
/// 3. Builder that sets permutation map to 'getMinorIdentityMap'.
1479-
OpBuilder<(ins "VectorType":$vectorType, "Value":$base,
1480-
"ValueRange":$indices, "Value":$padding,
1481-
CArg<"std::optional<ArrayRef<bool>>", "::std::nullopt">:$inBounds)>,
1482-
/// 4. Builder that sets padding to zero and permutation map to
1483-
/// 'getMinorIdentityMap'.
1484-
OpBuilder<(ins "VectorType":$vectorType, "Value":$base,
1485-
"ValueRange":$indices,
1486-
CArg<"std::optional<ArrayRef<bool>>", "::std::nullopt">:$inBounds)>,
1471+
/// 1. Builder that sets padding to zero and an empty mask (variant with attrs).
1472+
OpBuilder<(ins "VectorType":$vectorType,
1473+
"Value":$source,
1474+
"ValueRange":$indices,
1475+
"AffineMapAttr":$permutationMapAttr,
1476+
"ArrayAttr":$inBoundsAttr)>,
1477+
/// 2. Builder that sets padding to zero and an empty mask (variant without attrs).
1478+
OpBuilder<(ins "VectorType":$vectorType,
1479+
"Value":$source,
1480+
"ValueRange":$indices,
1481+
"AffineMap":$permutationMap,
1482+
CArg<"std::optional<ArrayRef<bool>>", "::std::nullopt">:$inBounds)>,
1483+
/// 3. Builder that sets permutation map to 'getMinorIdentityMap'.
1484+
OpBuilder<(ins "VectorType":$vectorType,
1485+
"Value":$source,
1486+
"ValueRange":$indices,
1487+
"Value":$padding,
1488+
CArg<"std::optional<ArrayRef<bool>>", "::std::nullopt">:$inBounds)>,
1489+
/// 4. Builder that sets padding to zero and permutation map to
1490+
/// 'getMinorIdentityMap'.
1491+
OpBuilder<(ins "VectorType":$vectorType,
1492+
"Value":$source,
1493+
"ValueRange":$indices,
1494+
CArg<"std::optional<ArrayRef<bool>>", "::std::nullopt">:$inBounds)>,
14871495
];
14881496

14891497
let extraClassDeclaration = [{
@@ -1503,20 +1511,23 @@ def Vector_TransferReadOp
15031511

15041512
// TODO: Tighten semantics so that masks and inbounds can't be used
15051513
// simultaneously within the same transfer op.
1506-
def Vector_TransferWriteOp
1507-
: Vector_Op<"transfer_write",
1508-
[DeclareOpInterfaceMethods<VectorTransferOpInterface>,
1509-
DeclareOpInterfaceMethods<
1510-
VectorUnrollOpInterface, ["getShapeForUnroll"]>,
1511-
DeclareOpInterfaceMethods<MaskableOpInterface>,
1512-
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>,
1513-
DeclareOpInterfaceMethods<ConditionallySpeculatable>,
1514-
AttrSizedOperandSegments, DestinationStyleOpInterface]>,
1515-
Arguments<(ins AnyVectorOfAnyRank:$valueToStore, AnyShaped:$base,
1516-
Variadic<Index>:$indices, AffineMapAttr:$permutation_map,
1517-
Optional<VectorOfNonZeroRankOf<[I1]>>:$mask,
1518-
BoolArrayAttr:$in_bounds)>,
1519-
Results<(outs Optional<AnyRankedTensor>:$result)> {
1514+
def Vector_TransferWriteOp :
1515+
Vector_Op<"transfer_write", [
1516+
DeclareOpInterfaceMethods<VectorTransferOpInterface>,
1517+
DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getShapeForUnroll"]>,
1518+
DeclareOpInterfaceMethods<MaskableOpInterface>,
1519+
DeclareOpInterfaceMethods<MemoryEffectsOpInterface>,
1520+
DeclareOpInterfaceMethods<ConditionallySpeculatable>,
1521+
AttrSizedOperandSegments,
1522+
DestinationStyleOpInterface
1523+
]>,
1524+
Arguments<(ins AnyVectorOfAnyRank:$valueToStore,
1525+
AnyShaped:$base,
1526+
Variadic<Index>:$indices,
1527+
AffineMapAttr:$permutation_map,
1528+
Optional<VectorOfNonZeroRankOf<[I1]>>:$mask,
1529+
BoolArrayAttr:$in_bounds)>,
1530+
Results<(outs Optional<AnyRankedTensor>:$result)> {
15201531

15211532
let summary = "The vector.transfer_write op writes a supervector to memory.";
15221533

mlir/include/mlir/Interfaces/VectorInterfaces.td

Lines changed: 63 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -75,66 +75,75 @@ def VectorTransferOpInterface : OpInterface<"VectorTransferOpInterface"> {
7575
}];
7676
let cppNamespace = "::mlir";
7777

78-
let methods = [InterfaceMethod<
79-
/*desc=*/[{
78+
let methods = [
79+
InterfaceMethod<
80+
/*desc=*/[{
8081
Return the `in_bounds` attribute name.
8182
}],
82-
/*retTy=*/"::mlir::StringRef",
83-
/*methodName=*/"getInBoundsAttrName",
84-
/*args=*/(ins)>,
85-
InterfaceMethod<
86-
/*desc=*/[{
83+
/*retTy=*/"::mlir::StringRef",
84+
/*methodName=*/"getInBoundsAttrName",
85+
/*args=*/(ins)
86+
>,
87+
InterfaceMethod<
88+
/*desc=*/[{
8789
Return the `permutation_map` attribute name.
8890
}],
89-
/*retTy=*/"::mlir::StringRef",
90-
/*methodName=*/"getPermutationMapAttrName",
91-
/*args=*/(ins)>,
92-
InterfaceMethod<
93-
/*desc=*/[{
91+
/*retTy=*/"::mlir::StringRef",
92+
/*methodName=*/"getPermutationMapAttrName",
93+
/*args=*/(ins)
94+
>,
95+
InterfaceMethod<
96+
/*desc=*/[{
9497
Return the optional in_bounds attribute that specifies for each vector
9598
dimension whether it is in-bounds or not. (Broadcast dimensions are
9699
always in-bounds).
97100
}],
98-
/*retTy=*/"::mlir::ArrayAttr",
99-
/*methodName=*/"getInBounds",
100-
/*args=*/(ins)>,
101-
InterfaceMethod<
102-
/*desc=*/[{
101+
/*retTy=*/"::mlir::ArrayAttr",
102+
/*methodName=*/"getInBounds",
103+
/*args=*/(ins)
104+
>,
105+
InterfaceMethod<
106+
/*desc=*/[{
103107
Return the memref or ranked tensor operand that this operation operates
104108
on. In case of a "read" operation, that's the source from which the
105109
operation reads. In case of a "write" operation, that's the destination
106110
into which the operation writes.
111+
TODO: Change name of operand, which is not accurate for xfer_write.
107112
}],
108-
/*retTy=*/"::mlir::Value",
109-
/*methodName=*/"getBase",
110-
/*args=*/(ins)>,
111-
InterfaceMethod<
112-
/*desc=*/[{
113+
/*retTy=*/"::mlir::Value",
114+
/*methodName=*/"getBase",
115+
/*args=*/(ins)
116+
>,
117+
InterfaceMethod<
118+
/*desc=*/[{
113119
Return the vector that this operation operates on. In case of a "read",
114120
that's the vector OpResult. In case of a "write", that's the vector
115121
operand value that is written by the op.
116122
}],
117-
/*retTy=*/"::mlir::Value",
118-
/*methodName=*/"getVector",
119-
/*args=*/(ins)>,
120-
InterfaceMethod<
121-
/*desc=*/[{
123+
/*retTy=*/"::mlir::Value",
124+
/*methodName=*/"getVector",
125+
/*args=*/(ins)
126+
>,
127+
InterfaceMethod<
128+
/*desc=*/[{
122129
Return the type of the vector that this operation operates on.
123130
}],
124-
/*retTy=*/"::mlir::VectorType",
125-
/*methodName=*/"getVectorType",
126-
/*args=*/(ins)>,
127-
InterfaceMethod<
128-
/*desc=*/[{
131+
/*retTy=*/"::mlir::VectorType",
132+
/*methodName=*/"getVectorType",
133+
/*args=*/(ins)
134+
>,
135+
InterfaceMethod<
136+
/*desc=*/[{
129137
Return the indices that specify the starting offsets into the source
130138
operand. The starting offsets are guaranteed to be in-bounds.
131139
}],
132-
/*retTy=*/"::mlir::OperandRange",
133-
/*methodName=*/"getIndices",
134-
/*args=*/(ins)>,
140+
/*retTy=*/"::mlir::OperandRange",
141+
/*methodName=*/"getIndices",
142+
/*args=*/(ins)
143+
>,
135144

136-
InterfaceMethod<
137-
/*desc=*/[{
145+
InterfaceMethod<
146+
/*desc=*/[{
138147
Return the permutation map that describes the mapping of vector
139148
dimensions to source dimensions, as well as broadcast dimensions.
140149

@@ -153,17 +162,20 @@ def VectorTransferOpInterface : OpInterface<"VectorTransferOpInterface"> {
153162
: memref<?x?xvector<4x3xf32>>, vector<1x1x4x3xf32>
154163
```
155164
}],
156-
/*retTy=*/"::mlir::AffineMap",
157-
/*methodName=*/"getPermutationMap",
158-
/*args=*/(ins)>,
159-
InterfaceMethod<
160-
/*desc=*/[{
165+
/*retTy=*/"::mlir::AffineMap",
166+
/*methodName=*/"getPermutationMap",
167+
/*args=*/(ins)
168+
>,
169+
InterfaceMethod<
170+
/*desc=*/[{
161171
Return the mask operand if the op has a mask. Otherwise, return an
162172
empty value.
163173
}],
164-
/*retTy=*/"Value",
165-
/*methodName=*/"getMask",
166-
/*args=*/(ins)>];
174+
/*retTy=*/"Value",
175+
/*methodName=*/"getMask",
176+
/*args=*/(ins)
177+
>
178+
];
167179

168180
let extraSharedClassDeclaration = [{
169181
/// Return a vector of all in_bounds values as booleans (one per vector
@@ -175,6 +187,12 @@ def VectorTransferOpInterface : OpInterface<"VectorTransferOpInterface"> {
175187
return inBounds;
176188
}
177189

190+
/// Wrapper for getBase, which replaced getSource.
191+
[[deprecated("Use getBase instead!")]]
192+
::mlir::Value getSource() {
193+
return $_op.getBase();
194+
}
195+
178196
/// Return the number of leading shaped dimensions (of the "source" operand)
179197
/// that do not participate in the permutation map.
180198
unsigned getLeadingShapedRank() {

0 commit comments

Comments
 (0)