Skip to content

Commit 8a51a76

Browse files
committed
[mlir] update include create APIs (3/n)
See #147168 for more info.
1 parent 54492c2 commit 8a51a76

File tree

11 files changed

+21
-20
lines changed

11 files changed

+21
-20
lines changed

mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ void replaceOpWithBufferizedValues(RewriterBase &rewriter, Operation *op,
651651
template <typename OpTy, typename... Args>
652652
OpTy replaceOpWithNewBufferizedOp(RewriterBase &rewriter, Operation *op,
653653
Args &&...args) {
654-
auto newOp = rewriter.create<OpTy>(op->getLoc(), std::forward<Args>(args)...);
654+
auto newOp = OpTy::create(rewriter, op->getLoc(), std::forward<Args>(args)...);
655655
replaceOpWithBufferizedValues(rewriter, op, newOp->getResults());
656656
return newOp;
657657
}

mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,14 @@ struct BufferResultsToOutParamsOpts {
148148
/// Default memref.alloc is used
149149
AllocationFn allocationFn = [](OpBuilder &builder, Location loc,
150150
MemRefType type) {
151-
return builder.create<memref::AllocOp>(loc, type).getResult();
151+
return memref::AllocOp::create(builder, loc, type).getResult();
152152
};
153153

154154
/// Memcpy function; used to create a copy between two memrefs.
155155
/// Default memref.copy is used.
156156
MemCpyFn memCpyFn = [](OpBuilder &builder, Location loc, Value from,
157157
Value to) {
158-
builder.create<memref::CopyOp>(loc, from, to);
158+
memref::CopyOp::create(builder, loc, from, to);
159159
return success();
160160
};
161161

mlir/include/mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def BasicPtxBuilderOpInterface : OpInterface<"BasicPtxBuilderInterface"> {
114114
/*methodBody=*/"",
115115
/*defaultImpl=*/ [{
116116
mlir::Operation* op = $_op;
117-
return rewriter.create<LLVM::ConstantOp>(
117+
return LLVM::ConstantOp::create(rewriter,
118118
op->getLoc(), rewriter.getIntegerType(32), val);
119119
}]
120120
>,

mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ def TransposeOp : LinalgStructuredBase_Op<"transpose", [
454454
static void regionBuilder(mlir::ImplicitLocOpBuilder &b, mlir::Block &block,
455455
mlir::ArrayRef<mlir::NamedAttribute>, function_ref<InFlightDiagnostic()> emitError) {
456456
OpBuilder::InsertionGuard guard(b);
457-
b.create<linalg::YieldOp>(b.getLoc(), block.getArgument(0));
457+
linalg::YieldOp::create(b, b.getLoc(), block.getArgument(0));
458458
}
459459

460460
static std::function<void(mlir::ImplicitLocOpBuilder &, mlir::Block &,
@@ -528,7 +528,7 @@ def BroadcastOp : LinalgStructuredBase_Op<"broadcast", [
528528
mlir::ArrayRef<mlir::NamedAttribute>,
529529
function_ref<InFlightDiagnostic()> emitError) {
530530
OpBuilder::InsertionGuard guard(b);
531-
b.create<linalg::YieldOp>(b.getLoc(), block.getArgument(0));
531+
linalg::YieldOp::create(b, b.getLoc(), block.getArgument(0));
532532
}
533533

534534
static std::function<void(mlir::ImplicitLocOpBuilder &, mlir::Block &,

mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorType.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class SparseTensorType {
131131
/// ambiguity whenever passing a `SparseTensorType` directly to a
132132
/// function which is overloaded to accept either `Type` or `TypeRange`.
133133
/// In particular, this includes `RewriterBase::replaceOpWithNewOp<OpTy>`
134-
/// and `OpBuilder::create<OpTy>` whenever the `OpTy::build` is overloaded
134+
/// and `OpTy::create` whenever the `OpTy::build` is overloaded
135135
/// thus. This happens because the `TypeRange<T>(T&&)` ctor is implicit
136136
/// as well, and there's no SFINAE we can add to this method that would
137137
/// block subsequent application of that ctor. The only way to fix the

mlir/include/mlir/Dialect/Tosa/Utils/ConversionUtils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ checkHasDynamicBatchDims(PatternRewriter &rewriter, Op op,
7070
}
7171

7272
dynamicDims.push_back(
73-
rewriter.create<tensor::DimOp>(op->getLoc(), params[0], 0));
73+
tensor::DimOp::create(rewriter, op->getLoc(), params[0], 0));
7474
return dynamicDims;
7575
}
7676

@@ -91,7 +91,7 @@ namespace {
9191
template <typename TosaOp, typename... Args>
9292
TosaOp createOpAndInferShape(ImplicitLocOpBuilder &builder, Type resultTy,
9393
Args &&...args) {
94-
auto op = builder.create<TosaOp>(resultTy, args...);
94+
auto op = TosaOp::create(builder, resultTy, args...);
9595

9696
InferShapedTypeOpInterface shapeInterface =
9797
dyn_cast<InferShapedTypeOpInterface>(op.getOperation());

mlir/include/mlir/Dialect/Tosa/Utils/QuantUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Value getConstTensorInt(OpBuilder &builder, Location loc,
4747
mlir::RankedTensorType const_type =
4848
RankedTensorType::get({count}, element_type);
4949
mlir::DenseElementsAttr const_attr = DenseElementsAttr::get(const_type, vec);
50-
auto const_op = builder.create<tosa::ConstOp>(loc, const_type, const_attr);
50+
auto const_op = tosa::ConstOp::create(builder, loc, const_type, const_attr);
5151
return const_op.getResult();
5252
}
5353

mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,11 @@ struct ComposeCollapseOfExpandOp : public OpRewritePattern<CollapseOpTy> {
332332
// the first dynamic size.
333333
Value result = dynamicSizes[0];
334334
for (Value v : llvm::drop_begin(dynamicSizes))
335-
result = rewriter.create<arith::MulIOp>(loc, result, v);
335+
result = arith::MulIOp::create(rewriter, loc, result, v);
336336
if (numStaticElems != 1) {
337-
result = rewriter.create<arith::MulIOp>(
338-
loc, result,
339-
rewriter.create<arith::ConstantIndexOp>(loc, numStaticElems));
337+
result = arith::MulIOp::create(
338+
rewriter, loc, result,
339+
arith::ConstantIndexOp::create(rewriter, loc, numStaticElems));
340340
}
341341
newOutputShape.push_back(result);
342342
}

mlir/include/mlir/Dialect/Vector/Utils/VectorUtils.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,10 @@ inline auto makeVscaleConstantBuilder(PatternRewriter &rewriter, Location loc) {
118118
Value vscale = nullptr;
119119
return [loc, vscale, &rewriter](int64_t multiplier) mutable {
120120
if (!vscale)
121-
vscale = rewriter.create<vector::VectorScaleOp>(loc);
122-
return rewriter.create<arith::MulIOp>(
123-
loc, vscale, rewriter.create<arith::ConstantIndexOp>(loc, multiplier));
121+
vscale = vector::VectorScaleOp::create(rewriter, loc);
122+
return arith::MulIOp::create(
123+
rewriter, loc, vscale,
124+
arith::ConstantIndexOp::create(rewriter, loc, multiplier));
124125
};
125126
}
126127

mlir/include/mlir/Interfaces/ViewLikeInterface.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ class OpWithOffsetSizesAndStridesConstantArgumentFolder final
109109

110110
// Create the new op in canonical form.
111111
auto newOp =
112-
rewriter.create<OpType>(op.getLoc(), resultType, op.getSource(),
113-
mixedOffsets, mixedSizes, mixedStrides);
112+
OpType::create(rewriter, op.getLoc(), resultType, op.getSource(),
113+
mixedOffsets, mixedSizes, mixedStrides);
114114
CastOpFunc()(rewriter, op, newOp);
115115

116116
return success();

0 commit comments

Comments
 (0)