@@ -569,8 +569,7 @@ static Value createLinalgBodyCalculationForElementwiseOp(
569
569
// to UIToFP.
570
570
if (srcTy.isUnsignedInteger () && isa<FloatType>(dstTy)) {
571
571
auto unrealizedCast =
572
- rewriter
573
- .create <UnrealizedConversionCastOp>(
572
+ UnrealizedConversionCastOp::create (rewriter,
574
573
loc, rewriter.getIntegerType (srcTy.getIntOrFloatBitWidth ()),
575
574
args[0 ])
576
575
.getResult (0 );
@@ -868,8 +867,7 @@ static Value broadcastDynamicDimension(PatternRewriter &rewriter, Location loc,
868
867
869
868
// Emit 'linalg.generic' op
870
869
auto resultTensor =
871
- opBuilder
872
- .create <linalg::GenericOp>(
870
+ linalg::GenericOp::create (opBuilder,
873
871
loc, outputTensor.getType (), operand, outputTensor, affineMaps,
874
872
getNParallelLoopsAttrs (rank),
875
873
[&](OpBuilder &opBuilder, Location loc, ValueRange blockArgs) {
@@ -1156,8 +1154,7 @@ static LogicalResult reduceMatchAndRewriteHelper(OpTy op, uint64_t axis,
1156
1154
1157
1155
// First fill the output buffer with the init value.
1158
1156
auto emptyTensor =
1159
- rewriter
1160
- .create <tensor::EmptyOp>(loc, reduceShape, resultTy.getElementType (),
1157
+ tensor::EmptyOp::create (rewriter, loc, reduceShape, resultTy.getElementType (),
1161
1158
dynDims)
1162
1159
.getResult ();
1163
1160
@@ -1167,8 +1164,7 @@ static LogicalResult reduceMatchAndRewriteHelper(OpTy op, uint64_t axis,
1167
1164
op, " No initial value found for reduction operation" );
1168
1165
1169
1166
auto fillValue = arith::ConstantOp::create (rewriter, loc, fillValueAttr);
1170
- auto filledTensor = rewriter
1171
- .create <linalg::FillOp>(loc, ValueRange{fillValue},
1167
+ auto filledTensor = linalg::FillOp::create (rewriter, loc, ValueRange{fillValue},
1172
1168
ValueRange{emptyTensor})
1173
1169
.result ();
1174
1170
outputs.push_back (filledTensor);
@@ -1186,13 +1182,11 @@ static LogicalResult reduceMatchAndRewriteHelper(OpTy op, uint64_t axis,
1186
1182
auto trueAttr = rewriter.getBoolAttr (true );
1187
1183
auto trueValue = arith::ConstantOp::create (rewriter, loc, trueAttr);
1188
1184
auto emptyBoolTensor =
1189
- rewriter
1190
- .create <tensor::EmptyOp>(loc, reduceShape, trueValue.getType (),
1185
+ tensor::EmptyOp::create (rewriter, loc, reduceShape, trueValue.getType (),
1191
1186
dynDims)
1192
1187
.getResult ();
1193
1188
auto allResultsNaNTensor =
1194
- rewriter
1195
- .create <linalg::FillOp>(loc, ValueRange{trueValue},
1189
+ linalg::FillOp::create (rewriter, loc, ValueRange{trueValue},
1196
1190
ValueRange{emptyBoolTensor})
1197
1191
.result ();
1198
1192
// Note that because the linalg::ReduceOp has two variadic arguments
@@ -1261,21 +1255,18 @@ static LogicalResult reduceMatchAndRewriteHelper(OpTy op, uint64_t axis,
1261
1255
APFloat::getNaN (cast<FloatType>(elementTy).getFloatSemantics (), false ));
1262
1256
auto nanValue = arith::ConstantOp::create (rewriter, loc, nanValueAttr);
1263
1257
auto emptyNanTensor =
1264
- rewriter
1265
- .create <tensor::EmptyOp>(loc, reduceShape,
1258
+ tensor::EmptyOp::create (rewriter, loc, reduceShape,
1266
1259
resultTy.getElementType (), dynDims)
1267
1260
.getResult ();
1268
1261
auto nanFilledTensor =
1269
- rewriter
1270
- .create <linalg::FillOp>(loc, ValueRange{nanValue},
1262
+ linalg::FillOp::create (rewriter, loc, ValueRange{nanValue},
1271
1263
ValueRange{emptyNanTensor})
1272
1264
.result ();
1273
1265
1274
1266
// Create an empty tensor, non need to fill this since it will be
1275
1267
// overwritten by the select.
1276
1268
auto finalEmptyTensor =
1277
- rewriter
1278
- .create <tensor::EmptyOp>(loc, reduceShape,
1269
+ tensor::EmptyOp::create (rewriter, loc, reduceShape,
1279
1270
resultTy.getElementType (), dynDims)
1280
1271
.getResult ();
1281
1272
@@ -1503,8 +1494,7 @@ class RescaleConverter : public OpRewritePattern<tosa::RescaleOp> {
1503
1494
Value shift = shiftConstant ? shiftConstant : blockArgs[shiftArg];
1504
1495
1505
1496
if (valueTy.isUnsignedInteger ()) {
1506
- value = nestedBuilder
1507
- .create <UnrealizedConversionCastOp>(
1497
+ value = UnrealizedConversionCastOp::create (nestedBuilder,
1508
1498
nestedLoc,
1509
1499
nestedBuilder.getIntegerType (
1510
1500
valueTy.getIntOrFloatBitWidth ()),
@@ -1557,8 +1547,7 @@ class RescaleConverter : public OpRewritePattern<tosa::RescaleOp> {
1557
1547
}
1558
1548
1559
1549
if (outIntType.isUnsignedInteger ()) {
1560
- value = nestedBuilder
1561
- .create <UnrealizedConversionCastOp>(nestedLoc,
1550
+ value = UnrealizedConversionCastOp::create (nestedBuilder, nestedLoc,
1562
1551
outIntType, value)
1563
1552
.getResult (0 );
1564
1553
}
@@ -2095,8 +2084,7 @@ class ReverseConverter : public OpRewritePattern<tosa::ReverseOp> {
2095
2084
Value axisDimSize = tensor::DimOp::create (rewriter, loc, input, axis);
2096
2085
2097
2086
// First fill the output buffer with the init value.
2098
- auto emptyTensor = rewriter
2099
- .create <tensor::EmptyOp>(loc, inputTy.getShape (),
2087
+ auto emptyTensor = tensor::EmptyOp::create (rewriter, loc, inputTy.getShape (),
2100
2088
inputTy.getElementType (),
2101
2089
ArrayRef<Value>({dynDims}))
2102
2090
.getResult ();
@@ -2241,21 +2229,18 @@ class ArgMaxConverter : public OpRewritePattern<tosa::ArgMaxOp> {
2241
2229
}
2242
2230
2243
2231
// First fill the output buffer for the index.
2244
- auto emptyTensorIdx = rewriter
2245
- .create <tensor::EmptyOp>(loc, resultTy.getShape (),
2232
+ auto emptyTensorIdx = tensor::EmptyOp::create (rewriter, loc, resultTy.getShape (),
2246
2233
outElementTy, dynDims)
2247
2234
.getResult ();
2248
2235
auto fillValueIdx = arith::ConstantOp::create (
2249
2236
rewriter, loc, rewriter.getIntegerAttr (outElementTy, 0 ));
2250
2237
auto filledTensorIdx =
2251
- rewriter
2252
- .create <linalg::FillOp>(loc, ValueRange{fillValueIdx},
2238
+ linalg::FillOp::create (rewriter, loc, ValueRange{fillValueIdx},
2253
2239
ValueRange{emptyTensorIdx})
2254
2240
.result ();
2255
2241
2256
2242
// Second fill the output buffer for the running max.
2257
- auto emptyTensorMax = rewriter
2258
- .create <tensor::EmptyOp>(loc, resultTy.getShape (),
2243
+ auto emptyTensorMax = tensor::EmptyOp::create (rewriter, loc, resultTy.getShape (),
2259
2244
inElementTy, dynDims)
2260
2245
.getResult ();
2261
2246
auto fillValueMaxAttr =
@@ -2268,8 +2253,7 @@ class ArgMaxConverter : public OpRewritePattern<tosa::ArgMaxOp> {
2268
2253
auto fillValueMax =
2269
2254
arith::ConstantOp::create (rewriter, loc, fillValueMaxAttr);
2270
2255
auto filledTensorMax =
2271
- rewriter
2272
- .create <linalg::FillOp>(loc, ValueRange{fillValueMax},
2256
+ linalg::FillOp::create (rewriter, loc, ValueRange{fillValueMax},
2273
2257
ValueRange{emptyTensorMax})
2274
2258
.result ();
2275
2259
@@ -2371,8 +2355,7 @@ class GatherConverter : public OpConversionPattern<tosa::GatherOp> {
2371
2355
2372
2356
auto loc = op.getLoc ();
2373
2357
auto emptyTensor =
2374
- rewriter
2375
- .create <tensor::EmptyOp>(loc, resultTy.getShape (), resultElementTy,
2358
+ tensor::EmptyOp::create (rewriter, loc, resultTy.getShape (), resultElementTy,
2376
2359
dynamicDims)
2377
2360
.getResult ();
2378
2361
@@ -2448,8 +2431,7 @@ class TableConverter : public OpRewritePattern<tosa::TableOp> {
2448
2431
}
2449
2432
}
2450
2433
2451
- auto emptyTensor = rewriter
2452
- .create <tensor::EmptyOp>(loc, resultTy.getShape (),
2434
+ auto emptyTensor = tensor::EmptyOp::create (rewriter, loc, resultTy.getShape (),
2453
2435
resultElementTy, dynDims)
2454
2436
.getResult ();
2455
2437
@@ -2585,8 +2567,7 @@ struct RFFT2dConverter final : public OpRewritePattern<RFFT2dOp> {
2585
2567
tensor::EmptyOp::create (rewriter, loc, type, dynamicSizes);
2586
2568
auto fillValueAttr = rewriter.getZeroAttr (type.getElementType ());
2587
2569
auto fillValue = arith::ConstantOp::create (rewriter, loc, fillValueAttr);
2588
- auto filledTensor = rewriter
2589
- .create <linalg::FillOp>(loc, ValueRange{fillValue},
2570
+ auto filledTensor = linalg::FillOp::create (rewriter, loc, ValueRange{fillValue},
2590
2571
ValueRange{emptyTensor})
2591
2572
.result ();
2592
2573
return filledTensor;
0 commit comments