@@ -155,23 +155,10 @@ static void fillStructuredOpRegion(OpBuilder &opBuilder, Region ®ion,
155
155
// iterator_types is an auto-generated method.
156
156
}
157
157
158
- // / Helper to create a typical indexing map for MatmulOp. Returns a list of
159
- // / AffineMap.
160
- static SmallVector<AffineMap, 3 >
161
- getDefaultIndexingMapsForMatmul (MLIRContext *context) {
162
- AffineExpr d0, d1, d2;
163
- SmallVector<AffineMap, 3 > indexingMaps;
164
- bindDims (context, d0, d1, d2);
165
- indexingMaps.push_back (AffineMap::get (3 , 0 , {d0, d2}, context));
166
- indexingMaps.push_back (AffineMap::get (3 , 0 , {d2, d1}, context));
167
- indexingMaps.push_back (AffineMap::get (3 , 0 , {d0, d1}, context));
168
- return indexingMaps;
169
- }
170
-
171
158
// / Wrapper to return the typical indexing map array attribute for MatmulOp.
172
159
static SmallVector<Attribute> getDefaultIndexingMapAttr (MLIRContext *context) {
173
160
return llvm::map_to_vector (
174
- getDefaultIndexingMapsForMatmul (context),
161
+ MatmulOp::getDefaultIndexingMaps (context),
175
162
[](AffineMap map) -> Attribute { return AffineMapAttr::get (map); });
176
163
}
177
164
@@ -204,9 +191,6 @@ static void buildStructuredOp(
204
191
indexingMapsAttrVal.push_back (AffineMapAttr::get (map));
205
192
}
206
193
state.addAttribute (" indexing_maps" , b.getArrayAttr (indexingMapsAttrVal));
207
- } else {
208
- indexingMapsAttrVal = getDefaultIndexingMapAttr (b.getContext ());
209
- state.addAttribute (" indexing_maps" , b.getArrayAttr (indexingMapsAttrVal));
210
194
}
211
195
212
196
state.addAttributes (attributes);
@@ -3481,7 +3465,7 @@ static LogicalResult verifyExtendedMatmulSemantic(MatmulOp matmulOp,
3481
3465
unsigned opIndex) {
3482
3466
SmallVector<AffineMap, 3 > opIndexingMaps = matmulOp.getIndexingMapsArray ();
3483
3467
SmallVector<AffineMap, 3 > defaultIndexingMaps =
3484
- matmulOp.getDefaultIndexingMaps ();
3468
+ matmulOp.getDefaultIndexingMaps (matmulOp-> getContext () );
3485
3469
3486
3470
auto opIndexingMap = opIndexingMaps[opIndex];
3487
3471
auto defaultIndexingMap = defaultIndexingMaps[opIndex];
@@ -3523,7 +3507,8 @@ bool MatmulOp::hasDynamicIndexingMaps() { return true; }
3523
3507
// / Check if the op has broadcast and/or transpose semantic. Returns true if the
3524
3508
// / user defined indexing maps are not equal to default map.
3525
3509
bool MatmulOp::hasUserDefinedMaps () {
3526
- SmallVector<AffineMap, 3 > defaultMaps = getDefaultIndexingMaps ();
3510
+ SmallVector<AffineMap, 3 > defaultMaps =
3511
+ MatmulOp::getDefaultIndexingMaps (this ->getContext ());
3527
3512
SmallVector<AffineMap, 3 > explicitMaps = getIndexingMapsArray ();
3528
3513
return defaultMaps != explicitMaps;
3529
3514
}
@@ -3557,12 +3542,6 @@ void MatmulOp::regionBuilder(ImplicitLocOpBuilder &b, Block &block,
3557
3542
helper.yieldOutputs (yields);
3558
3543
}
3559
3544
3560
- // / Returns a list of AffineMap with the typical matmul indexing charactristic.
3561
- SmallVector<AffineMap> MatmulOp::getDefaultIndexingMaps () {
3562
- MLIRContext *context = this ->getContext ();
3563
- return getDefaultIndexingMapsForMatmul (context);
3564
- }
3565
-
3566
3545
// / Returns true if the given broadcast map \p bcastMap is valid for this op.
3567
3546
bool MatmulOp::isValidLhsRhsBroadcastMap (AffineMap bcastMap) {
3568
3547
assert (bcastMap.getNumResults () == 1 && " Expected single result dim expr." );
0 commit comments