-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[mlir][NFC] update mlir/Dialect
create APIs (33/n)
#150659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[mlir][NFC] update mlir/Dialect
create APIs (33/n)
#150659
Conversation
@llvm/pr-subscribers-mlir-shape @llvm/pr-subscribers-mlir Author: Maksim Levental (makslevental) ChangesSee #147168 for more info. Patch is 30.68 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/150659.diff 23 Files Affected:
diff --git a/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp b/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp
index 748ff1edbfeb2..8c1786d3fbeae 100644
--- a/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp
+++ b/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp
@@ -96,8 +96,7 @@ static Value getStride(Location loc, MemRefType mType, Value base,
MemRefDescriptor memrefDescriptor(base);
auto attr = rewriter.getI64IntegerAttr(bytes);
Value scale = LLVM::ConstantOp::create(rewriter, loc, llvmInt64Type, attr);
- return rewriter
- .create<LLVM::MulOp>(loc, llvmInt64Type, scale,
+ return LLVM::MulOp::create(rewriter, loc, llvmInt64Type, scale,
memrefDescriptor.stride(rewriter, loc, preLast))
.getResult();
}
diff --git a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
index 994d48505d24f..3a49bf01a0c06 100644
--- a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
+++ b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
@@ -688,8 +688,7 @@ FailureOr<Value> bufferization::getBuffer(RewriterBase &rewriter, Value value,
if (failed(bufferType))
return failure();
ensureToBufferOpIsValid(value, *bufferType);
- return rewriter
- .create<bufferization::ToBufferOp>(value.getLoc(), *bufferType, value)
+ return bufferization::ToBufferOp::create(rewriter, value.getLoc(), *bufferType, value)
.getResult();
}
@@ -772,8 +771,7 @@ FailureOr<Value> BufferizationOptions::createAlloc(OpBuilder &b, Location loc,
// Default bufferallocation via AllocOp.
if (bufferAlignment != 0)
- return b
- .create<memref::AllocOp>(loc, type, dynShape,
+ return memref::AllocOp::create(b, loc, type, dynShape,
b.getI64IntegerAttr(bufferAlignment))
.getResult();
return memref::AllocOp::create(b, loc, type, dynShape).getResult();
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp b/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp
index f0d65b04ee447..8b8f1445603c5 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp
@@ -483,8 +483,7 @@ func::FuncOp mlir::bufferization::buildDeallocationLibraryFunction(
// Build the first for loop that computes aliasing with retained
// memrefs.
Value noRetainAlias =
- builder
- .create<scf::ForOp>(
+ scf::ForOp::create(builder,
loc, c0, toRetainSize, c1, trueValue,
[&](OpBuilder &builder, Location loc, Value i,
ValueRange iterArgs) {
@@ -517,8 +516,7 @@ func::FuncOp mlir::bufferization::buildDeallocationLibraryFunction(
// Build the second for loop that adds aliasing with previously
// deallocated memrefs.
Value noAlias =
- builder
- .create<scf::ForOp>(
+ scf::ForOp::create(builder,
loc, c0, outerIter, c1, noRetainAlias,
[&](OpBuilder &builder, Location loc, Value i,
ValueRange iterArgs) {
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp b/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp
index 64c178dfe76d8..5af63d4787087 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp
@@ -750,8 +750,7 @@ Value BufferDeallocation::materializeMemrefWithGuaranteedOwnership(
// Insert a runtime check and only clone if we still don't have ownership at
// runtime.
- Value maybeClone = builder
- .create<scf::IfOp>(
+ Value maybeClone = scf::IfOp::create(builder,
memref.getLoc(), condition,
[&](OpBuilder &builder, Location loc) {
scf::YieldOp::create(builder, loc, newMemref);
diff --git a/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp b/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp
index d88f4d56d9009..dd0ae6a047f5b 100644
--- a/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp
@@ -60,13 +60,11 @@ struct GpuShuffleRewriter : public OpRewritePattern<gpu::ShuffleOp> {
// Shuffle the values.
ValueRange loRes =
- rewriter
- .create<gpu::ShuffleOp>(op.getLoc(), lo, op.getOffset(),
+ gpu::ShuffleOp::create(rewriter, op.getLoc(), lo, op.getOffset(),
op.getWidth(), op.getMode())
.getResults();
ValueRange hiRes =
- rewriter
- .create<gpu::ShuffleOp>(op.getLoc(), hi, op.getOffset(),
+ gpu::ShuffleOp::create(rewriter, op.getLoc(), hi, op.getOffset(),
op.getWidth(), op.getMode())
.getResults();
diff --git a/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp b/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp
index b9e2dd5b19a6f..37fd0bf32191d 100644
--- a/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp
@@ -197,8 +197,7 @@ Value createSubgroupShuffleReduction(OpBuilder &builder, Location loc,
// Parallel reduction using butterfly shuffles.
for (unsigned i = ci.clusterStride; i < ci.clusterStride * ci.clusterSize;
i <<= 1) {
- Value shuffled = builder
- .create<gpu::ShuffleOp>(loc, packFn(laneVal), i,
+ Value shuffled = gpu::ShuffleOp::create(builder, loc, packFn(laneVal), i,
/*width=*/ci.subgroupSize,
/*mode=*/gpu::ShuffleMode::XOR)
.getShuffleResult();
diff --git a/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp b/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
index 66c1aa6bf3fe1..d5e2b97e501e6 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
@@ -56,9 +56,8 @@ FailureOr<Value> memref::buildIndependentOp(OpBuilder &b,
// Create a memref::SubViewOp.
SmallVector<OpFoldResult> offsets(newSizes.size(), b.getIndexAttr(0));
SmallVector<OpFoldResult> strides(newSizes.size(), b.getIndexAttr(1));
- return b
- .create<SubViewOp>(loc, newAllocaOp, offsets, allocaOp.getMixedSizes(),
- strides)
+ return SubViewOp::create(b, loc, newAllocaOp, offsets,
+ allocaOp.getMixedSizes(), strides)
.getResult();
}
diff --git a/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp b/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
index 1f03e9ae8d6a1..d3a77c026379e 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
@@ -185,9 +185,8 @@ struct CopyOpInterface
int64_t dim) -> Value {
return type.isDynamicDim(dim)
? DimOp::create(builder, loc, memRef, dim).getResult()
- : builder
- .create<arith::ConstantIndexOp>(loc,
- type.getDimSize(dim))
+ : arith::ConstantIndexOp::create(builder, loc,
+ type.getDimSize(dim))
.getResult();
};
Value sourceDim = getDimSize(copyOp.getSource(), rankedSourceType, i);
diff --git a/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp b/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp
index 58cd160948f7f..9e37bc5163f71 100644
--- a/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp
+++ b/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp
@@ -148,16 +148,14 @@ flattenUnrankedTensorAroundAxis(OpBuilder &builder, Location loc, Value input,
auto axisValue = arith::ConstantIndexOp::create(builder, loc, axis);
auto axisNextValue = arith::ConstantIndexOp::create(builder, loc, axis + 1);
auto shapeLeft =
- builder
- .create<shape::SplitAtOp>(loc, TypeRange{shapeType, shapeType},
- inputShape, axisValue)
+ shape::SplitAtOp::create(builder, loc, TypeRange{shapeType, shapeType},
+ inputShape, axisValue)
.getResult(0);
auto sizeLeft =
shape::NumElementsOp::create(builder, loc, indexType, shapeLeft);
auto shapeRight =
- builder
- .create<shape::SplitAtOp>(loc, TypeRange{shapeType, shapeType},
- inputShape, axisNextValue)
+ shape::SplitAtOp::create(builder, loc, TypeRange{shapeType, shapeType},
+ inputShape, axisNextValue)
.getResult(1);
auto sizeRight =
shape::NumElementsOp::create(builder, loc, indexType, shapeRight);
@@ -557,25 +555,24 @@ Value convertPerChannelRanked(OpBuilder &builder, Location loc, Operation *op,
SmallVector<AffineMap> indexingMaps{
builder.getMultiDimIdentityMap(inputRank), channelAxisAffineMap,
channelAxisAffineMap, builder.getMultiDimIdentityMap(inputRank)};
- auto result = builder
- .create<linalg::GenericOp>(
- loc,
- init.getType(), // resultType
- ValueRange{input, scales, zeroPoints}, // inputs
- ValueRange{init}, // outputs
- indexingMaps, iteratorTypes,
- [&](OpBuilder &builder, Location loc, ValueRange args) {
- assert(args.size() == 4);
- auto input = args[0];
- auto scale = args[1];
- auto zeroPoint = args[2];
-
- auto result =
- convertRanked(builder, loc, op, input, {}, scale,
- zeroPoint, quantizedType);
-
- linalg::YieldOp::create(builder, loc, result);
- })
+ auto result = linalg::GenericOp::create(
+ builder, loc,
+ init.getType(), // resultType
+ ValueRange{input, scales, zeroPoints}, // inputs
+ ValueRange{init}, // outputs
+ indexingMaps, iteratorTypes,
+ [&](OpBuilder &builder, Location loc, ValueRange args) {
+ assert(args.size() == 4);
+ auto input = args[0];
+ auto scale = args[1];
+ auto zeroPoint = args[2];
+
+ auto result =
+ convertRanked(builder, loc, op, input, {}, scale,
+ zeroPoint, quantizedType);
+
+ linalg::YieldOp::create(builder, loc, result);
+ })
.getResult(0);
return result;
@@ -660,25 +657,24 @@ Value convertSubChannel(OpBuilder &builder, Location loc, Operation *op,
SmallVector<AffineMap> indexingMaps{
builder.getMultiDimIdentityMap(inputRank), affineMap, affineMap,
builder.getMultiDimIdentityMap(inputRank)};
- auto result = builder
- .create<linalg::GenericOp>(
- loc,
- init.getType(), // resultType
- ValueRange{input, scales, zeroPoints}, // inputs
- ValueRange{init}, // outputs
- indexingMaps, iteratorTypes,
- [&](OpBuilder &builder, Location loc, ValueRange args) {
- assert(args.size() == 4);
- auto input = args[0];
- auto scale = args[1];
- auto zeroPoint = args[2];
-
- auto result =
- convertRanked(builder, loc, op, input, {}, scale,
- zeroPoint, quantizedType);
-
- linalg::YieldOp::create(builder, loc, result);
- })
+ auto result = linalg::GenericOp::create(
+ builder, loc,
+ init.getType(), // resultType
+ ValueRange{input, scales, zeroPoints}, // inputs
+ ValueRange{init}, // outputs
+ indexingMaps, iteratorTypes,
+ [&](OpBuilder &builder, Location loc, ValueRange args) {
+ assert(args.size() == 4);
+ auto input = args[0];
+ auto scale = args[1];
+ auto zeroPoint = args[2];
+
+ auto result =
+ convertRanked(builder, loc, op, input, {}, scale,
+ zeroPoint, quantizedType);
+
+ linalg::YieldOp::create(builder, loc, result);
+ })
.getResult(0);
return result;
diff --git a/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
index 64c4d607e3fb9..f8799c52e8797 100644
--- a/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
@@ -497,10 +497,10 @@ getBbArgReplacements(RewriterBase &rewriter, Block::BlockArgListType bbArgs,
size_t idx = it.index();
Value val = it.value();
if (tensorIndices.contains(idx)) {
- result.push_back(rewriter
- .create<bufferization::ToTensorOp>(
- val.getLoc(), oldBbArgs[idx].getType(), val)
- .getResult());
+ result.push_back(
+ bufferization::ToTensorOp::create(rewriter, val.getLoc(),
+ oldBbArgs[idx].getType(), val)
+ .getResult());
} else {
result.push_back(val);
}
diff --git a/mlir/lib/Dialect/SCF/Utils/Utils.cpp b/mlir/lib/Dialect/SCF/Utils/Utils.cpp
index 5b0c60415a6c4..57317951d609c 100644
--- a/mlir/lib/Dialect/SCF/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/SCF/Utils/Utils.cpp
@@ -827,9 +827,8 @@ static Value getProductOfIntsOrIndexes(RewriterBase &rewriter, Location loc,
productOf = v;
}
if (!productOf) {
- productOf = rewriter
- .create<arith::ConstantOp>(
- loc, rewriter.getOneAttr(getType(values.front())))
+ productOf = arith::ConstantOp::create(
+ rewriter, loc, rewriter.getOneAttr(getType(values.front())))
.getResult();
}
return productOf.value();
diff --git a/mlir/lib/Dialect/Shape/IR/Shape.cpp b/mlir/lib/Dialect/Shape/IR/Shape.cpp
index e24f0f87e781d..50985c1c131f5 100644
--- a/mlir/lib/Dialect/Shape/IR/Shape.cpp
+++ b/mlir/lib/Dialect/Shape/IR/Shape.cpp
@@ -1702,8 +1702,7 @@ struct ShapeOfOpToConstShapeOp : public OpRewritePattern<shape::ShapeOfOp> {
return failure();
Location loc = op.getLoc();
Value constShape =
- rewriter
- .create<ConstShapeOp>(loc,
+ ConstShapeOp::create(rewriter, loc,
rewriter.getIndexTensorAttr(type.getShape()))
.getResult();
if (constShape.getType() != op.getResult().getType())
diff --git a/mlir/lib/Dialect/Shard/Transforms/Partition.cpp b/mlir/lib/Dialect/Shard/Transforms/Partition.cpp
index 5fe55669c90db..3e3d4768853e5 100644
--- a/mlir/lib/Dialect/Shard/Transforms/Partition.cpp
+++ b/mlir/lib/Dialect/Shard/Transforms/Partition.cpp
@@ -70,10 +70,8 @@ splitLastAxisInResharding(ImplicitLocOpBuilder &builder,
TypedValue<ShapedType> sourceShard, GridOp grid,
int64_t splitTensorAxis, GridAxis splitGridAxis) {
TypedValue<ShapedType> targetShard = cast<TypedValue<ShapedType>>(
- builder
- .create<AllSliceOp>(sourceShard, grid,
- ArrayRef<GridAxis>(splitGridAxis),
- splitTensorAxis)
+ AllSliceOp::create(builder, sourceShard, grid,
+ ArrayRef<GridAxis>(splitGridAxis), splitTensorAxis)
.getResult());
Sharding targetSharding = targetShardingInSplitLastAxis(
builder.getContext(), sourceSharding, splitTensorAxis, splitGridAxis);
@@ -420,16 +418,15 @@ tryUpdateHaloInResharding(ImplicitLocOpBuilder &builder, GridOp grid,
// Finally update the halo.
auto updateHaloResult =
- builder
- .create<UpdateHaloOp>(
- sourceShard.getLoc(),
- RankedTensorType::get(outShape,
- sourceShard.getType().getElementType()),
- initOprnd, grid.getSymName(),
- GridAxesArrayAttr::get(builder.getContext(),
- sourceSharding.getSplitAxes()),
- targetSharding.getDynamicHaloSizes(),
- targetSharding.getStaticHaloSizes())
+ UpdateHaloOp::create(
+ builder, sourceShard.getLoc(),
+ RankedTensorType::get(outShape,
+ sourceShard.getType().getElementType()),
+ initOprnd, grid.getSymName(),
+ GridAxesArrayAttr::get(builder.getContext(),
+ sourceSharding.getSplitAxes()),
+ targetSharding.getDynamicHaloSizes(),
+ targetSharding.getStaticHaloSizes())
.getResult();
return std::make_tuple(cast<TypedValue<ShapedType>>(updateHaloResult),
targetSharding);
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
index a52872dd093d8..3b4140edd1641 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
@@ -931,10 +931,9 @@ createQuickSort(OpBuilder &builder, ModuleOp module, func::FuncOp func,
FlatSymbolRefAttr partitionFunc = getMangledSortHelperFunc(
builder, func, {IndexType::get(context)}, kPartitionFuncNamePrefix, xPerm,
ny, args.drop_back(nTrailingP), createPartitionFunc);
- Value p = builder
- .create<func::CallOp>(loc, partitionFunc,
- TypeRange{IndexType::get(context)},
- args.drop_back(nTrailingP))
+ Value p = func::CallOp::create(builder, loc, partitionFunc,
+ TypeRange{IndexType::get(context)},
+ args.drop_back(nTrailingP))
.getResult(0);
Value lenLow = arith::SubIOp::create(builder, loc, p, lo);
@@ -1028,9 +1027,8 @@ static void createSortStableFunc(OpBuilder &builder, ModuleOp module,
FlatSymbolRefAttr searchFunc = getMangledSortHelperFunc(
builder, func, {IndexType::get(context)}, kBinarySearchFuncNamePrefix,
xPerm, ny, operands, createBinarySearchFunc);
- Value p = builder
- .create<func::CallOp>(loc, searchFunc, TypeRange{c1.getType()},
- operands)
+ Value p = func::CallOp::create(builder, loc, searchFunc,
+ TypeRange{c1.getType()}, operands)
.getResult(0);
// Move the value at data[i] to a temporary location.
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
index a317abd6c560b..0bd1d34c3504b 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
@@ -98,10 +98,10 @@ static Value genLaunchGPUFunc(OpBuilder &builder, gpu::GPUFuncOp gpuFunc,
Value...
[truncated]
|
@llvm/pr-subscribers-mlir-gpu Author: Maksim Levental (makslevental) ChangesSee #147168 for more info. Patch is 30.68 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/150659.diff 23 Files Affected:
diff --git a/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp b/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp
index 748ff1edbfeb2..8c1786d3fbeae 100644
--- a/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp
+++ b/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp
@@ -96,8 +96,7 @@ static Value getStride(Location loc, MemRefType mType, Value base,
MemRefDescriptor memrefDescriptor(base);
auto attr = rewriter.getI64IntegerAttr(bytes);
Value scale = LLVM::ConstantOp::create(rewriter, loc, llvmInt64Type, attr);
- return rewriter
- .create<LLVM::MulOp>(loc, llvmInt64Type, scale,
+ return LLVM::MulOp::create(rewriter, loc, llvmInt64Type, scale,
memrefDescriptor.stride(rewriter, loc, preLast))
.getResult();
}
diff --git a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
index 994d48505d24f..3a49bf01a0c06 100644
--- a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
+++ b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
@@ -688,8 +688,7 @@ FailureOr<Value> bufferization::getBuffer(RewriterBase &rewriter, Value value,
if (failed(bufferType))
return failure();
ensureToBufferOpIsValid(value, *bufferType);
- return rewriter
- .create<bufferization::ToBufferOp>(value.getLoc(), *bufferType, value)
+ return bufferization::ToBufferOp::create(rewriter, value.getLoc(), *bufferType, value)
.getResult();
}
@@ -772,8 +771,7 @@ FailureOr<Value> BufferizationOptions::createAlloc(OpBuilder &b, Location loc,
// Default bufferallocation via AllocOp.
if (bufferAlignment != 0)
- return b
- .create<memref::AllocOp>(loc, type, dynShape,
+ return memref::AllocOp::create(b, loc, type, dynShape,
b.getI64IntegerAttr(bufferAlignment))
.getResult();
return memref::AllocOp::create(b, loc, type, dynShape).getResult();
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp b/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp
index f0d65b04ee447..8b8f1445603c5 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp
@@ -483,8 +483,7 @@ func::FuncOp mlir::bufferization::buildDeallocationLibraryFunction(
// Build the first for loop that computes aliasing with retained
// memrefs.
Value noRetainAlias =
- builder
- .create<scf::ForOp>(
+ scf::ForOp::create(builder,
loc, c0, toRetainSize, c1, trueValue,
[&](OpBuilder &builder, Location loc, Value i,
ValueRange iterArgs) {
@@ -517,8 +516,7 @@ func::FuncOp mlir::bufferization::buildDeallocationLibraryFunction(
// Build the second for loop that adds aliasing with previously
// deallocated memrefs.
Value noAlias =
- builder
- .create<scf::ForOp>(
+ scf::ForOp::create(builder,
loc, c0, outerIter, c1, noRetainAlias,
[&](OpBuilder &builder, Location loc, Value i,
ValueRange iterArgs) {
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp b/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp
index 64c178dfe76d8..5af63d4787087 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp
@@ -750,8 +750,7 @@ Value BufferDeallocation::materializeMemrefWithGuaranteedOwnership(
// Insert a runtime check and only clone if we still don't have ownership at
// runtime.
- Value maybeClone = builder
- .create<scf::IfOp>(
+ Value maybeClone = scf::IfOp::create(builder,
memref.getLoc(), condition,
[&](OpBuilder &builder, Location loc) {
scf::YieldOp::create(builder, loc, newMemref);
diff --git a/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp b/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp
index d88f4d56d9009..dd0ae6a047f5b 100644
--- a/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp
@@ -60,13 +60,11 @@ struct GpuShuffleRewriter : public OpRewritePattern<gpu::ShuffleOp> {
// Shuffle the values.
ValueRange loRes =
- rewriter
- .create<gpu::ShuffleOp>(op.getLoc(), lo, op.getOffset(),
+ gpu::ShuffleOp::create(rewriter, op.getLoc(), lo, op.getOffset(),
op.getWidth(), op.getMode())
.getResults();
ValueRange hiRes =
- rewriter
- .create<gpu::ShuffleOp>(op.getLoc(), hi, op.getOffset(),
+ gpu::ShuffleOp::create(rewriter, op.getLoc(), hi, op.getOffset(),
op.getWidth(), op.getMode())
.getResults();
diff --git a/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp b/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp
index b9e2dd5b19a6f..37fd0bf32191d 100644
--- a/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp
@@ -197,8 +197,7 @@ Value createSubgroupShuffleReduction(OpBuilder &builder, Location loc,
// Parallel reduction using butterfly shuffles.
for (unsigned i = ci.clusterStride; i < ci.clusterStride * ci.clusterSize;
i <<= 1) {
- Value shuffled = builder
- .create<gpu::ShuffleOp>(loc, packFn(laneVal), i,
+ Value shuffled = gpu::ShuffleOp::create(builder, loc, packFn(laneVal), i,
/*width=*/ci.subgroupSize,
/*mode=*/gpu::ShuffleMode::XOR)
.getShuffleResult();
diff --git a/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp b/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
index 66c1aa6bf3fe1..d5e2b97e501e6 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
@@ -56,9 +56,8 @@ FailureOr<Value> memref::buildIndependentOp(OpBuilder &b,
// Create a memref::SubViewOp.
SmallVector<OpFoldResult> offsets(newSizes.size(), b.getIndexAttr(0));
SmallVector<OpFoldResult> strides(newSizes.size(), b.getIndexAttr(1));
- return b
- .create<SubViewOp>(loc, newAllocaOp, offsets, allocaOp.getMixedSizes(),
- strides)
+ return SubViewOp::create(b, loc, newAllocaOp, offsets,
+ allocaOp.getMixedSizes(), strides)
.getResult();
}
diff --git a/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp b/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
index 1f03e9ae8d6a1..d3a77c026379e 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
@@ -185,9 +185,8 @@ struct CopyOpInterface
int64_t dim) -> Value {
return type.isDynamicDim(dim)
? DimOp::create(builder, loc, memRef, dim).getResult()
- : builder
- .create<arith::ConstantIndexOp>(loc,
- type.getDimSize(dim))
+ : arith::ConstantIndexOp::create(builder, loc,
+ type.getDimSize(dim))
.getResult();
};
Value sourceDim = getDimSize(copyOp.getSource(), rankedSourceType, i);
diff --git a/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp b/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp
index 58cd160948f7f..9e37bc5163f71 100644
--- a/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp
+++ b/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp
@@ -148,16 +148,14 @@ flattenUnrankedTensorAroundAxis(OpBuilder &builder, Location loc, Value input,
auto axisValue = arith::ConstantIndexOp::create(builder, loc, axis);
auto axisNextValue = arith::ConstantIndexOp::create(builder, loc, axis + 1);
auto shapeLeft =
- builder
- .create<shape::SplitAtOp>(loc, TypeRange{shapeType, shapeType},
- inputShape, axisValue)
+ shape::SplitAtOp::create(builder, loc, TypeRange{shapeType, shapeType},
+ inputShape, axisValue)
.getResult(0);
auto sizeLeft =
shape::NumElementsOp::create(builder, loc, indexType, shapeLeft);
auto shapeRight =
- builder
- .create<shape::SplitAtOp>(loc, TypeRange{shapeType, shapeType},
- inputShape, axisNextValue)
+ shape::SplitAtOp::create(builder, loc, TypeRange{shapeType, shapeType},
+ inputShape, axisNextValue)
.getResult(1);
auto sizeRight =
shape::NumElementsOp::create(builder, loc, indexType, shapeRight);
@@ -557,25 +555,24 @@ Value convertPerChannelRanked(OpBuilder &builder, Location loc, Operation *op,
SmallVector<AffineMap> indexingMaps{
builder.getMultiDimIdentityMap(inputRank), channelAxisAffineMap,
channelAxisAffineMap, builder.getMultiDimIdentityMap(inputRank)};
- auto result = builder
- .create<linalg::GenericOp>(
- loc,
- init.getType(), // resultType
- ValueRange{input, scales, zeroPoints}, // inputs
- ValueRange{init}, // outputs
- indexingMaps, iteratorTypes,
- [&](OpBuilder &builder, Location loc, ValueRange args) {
- assert(args.size() == 4);
- auto input = args[0];
- auto scale = args[1];
- auto zeroPoint = args[2];
-
- auto result =
- convertRanked(builder, loc, op, input, {}, scale,
- zeroPoint, quantizedType);
-
- linalg::YieldOp::create(builder, loc, result);
- })
+ auto result = linalg::GenericOp::create(
+ builder, loc,
+ init.getType(), // resultType
+ ValueRange{input, scales, zeroPoints}, // inputs
+ ValueRange{init}, // outputs
+ indexingMaps, iteratorTypes,
+ [&](OpBuilder &builder, Location loc, ValueRange args) {
+ assert(args.size() == 4);
+ auto input = args[0];
+ auto scale = args[1];
+ auto zeroPoint = args[2];
+
+ auto result =
+ convertRanked(builder, loc, op, input, {}, scale,
+ zeroPoint, quantizedType);
+
+ linalg::YieldOp::create(builder, loc, result);
+ })
.getResult(0);
return result;
@@ -660,25 +657,24 @@ Value convertSubChannel(OpBuilder &builder, Location loc, Operation *op,
SmallVector<AffineMap> indexingMaps{
builder.getMultiDimIdentityMap(inputRank), affineMap, affineMap,
builder.getMultiDimIdentityMap(inputRank)};
- auto result = builder
- .create<linalg::GenericOp>(
- loc,
- init.getType(), // resultType
- ValueRange{input, scales, zeroPoints}, // inputs
- ValueRange{init}, // outputs
- indexingMaps, iteratorTypes,
- [&](OpBuilder &builder, Location loc, ValueRange args) {
- assert(args.size() == 4);
- auto input = args[0];
- auto scale = args[1];
- auto zeroPoint = args[2];
-
- auto result =
- convertRanked(builder, loc, op, input, {}, scale,
- zeroPoint, quantizedType);
-
- linalg::YieldOp::create(builder, loc, result);
- })
+ auto result = linalg::GenericOp::create(
+ builder, loc,
+ init.getType(), // resultType
+ ValueRange{input, scales, zeroPoints}, // inputs
+ ValueRange{init}, // outputs
+ indexingMaps, iteratorTypes,
+ [&](OpBuilder &builder, Location loc, ValueRange args) {
+ assert(args.size() == 4);
+ auto input = args[0];
+ auto scale = args[1];
+ auto zeroPoint = args[2];
+
+ auto result =
+ convertRanked(builder, loc, op, input, {}, scale,
+ zeroPoint, quantizedType);
+
+ linalg::YieldOp::create(builder, loc, result);
+ })
.getResult(0);
return result;
diff --git a/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
index 64c4d607e3fb9..f8799c52e8797 100644
--- a/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
@@ -497,10 +497,10 @@ getBbArgReplacements(RewriterBase &rewriter, Block::BlockArgListType bbArgs,
size_t idx = it.index();
Value val = it.value();
if (tensorIndices.contains(idx)) {
- result.push_back(rewriter
- .create<bufferization::ToTensorOp>(
- val.getLoc(), oldBbArgs[idx].getType(), val)
- .getResult());
+ result.push_back(
+ bufferization::ToTensorOp::create(rewriter, val.getLoc(),
+ oldBbArgs[idx].getType(), val)
+ .getResult());
} else {
result.push_back(val);
}
diff --git a/mlir/lib/Dialect/SCF/Utils/Utils.cpp b/mlir/lib/Dialect/SCF/Utils/Utils.cpp
index 5b0c60415a6c4..57317951d609c 100644
--- a/mlir/lib/Dialect/SCF/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/SCF/Utils/Utils.cpp
@@ -827,9 +827,8 @@ static Value getProductOfIntsOrIndexes(RewriterBase &rewriter, Location loc,
productOf = v;
}
if (!productOf) {
- productOf = rewriter
- .create<arith::ConstantOp>(
- loc, rewriter.getOneAttr(getType(values.front())))
+ productOf = arith::ConstantOp::create(
+ rewriter, loc, rewriter.getOneAttr(getType(values.front())))
.getResult();
}
return productOf.value();
diff --git a/mlir/lib/Dialect/Shape/IR/Shape.cpp b/mlir/lib/Dialect/Shape/IR/Shape.cpp
index e24f0f87e781d..50985c1c131f5 100644
--- a/mlir/lib/Dialect/Shape/IR/Shape.cpp
+++ b/mlir/lib/Dialect/Shape/IR/Shape.cpp
@@ -1702,8 +1702,7 @@ struct ShapeOfOpToConstShapeOp : public OpRewritePattern<shape::ShapeOfOp> {
return failure();
Location loc = op.getLoc();
Value constShape =
- rewriter
- .create<ConstShapeOp>(loc,
+ ConstShapeOp::create(rewriter, loc,
rewriter.getIndexTensorAttr(type.getShape()))
.getResult();
if (constShape.getType() != op.getResult().getType())
diff --git a/mlir/lib/Dialect/Shard/Transforms/Partition.cpp b/mlir/lib/Dialect/Shard/Transforms/Partition.cpp
index 5fe55669c90db..3e3d4768853e5 100644
--- a/mlir/lib/Dialect/Shard/Transforms/Partition.cpp
+++ b/mlir/lib/Dialect/Shard/Transforms/Partition.cpp
@@ -70,10 +70,8 @@ splitLastAxisInResharding(ImplicitLocOpBuilder &builder,
TypedValue<ShapedType> sourceShard, GridOp grid,
int64_t splitTensorAxis, GridAxis splitGridAxis) {
TypedValue<ShapedType> targetShard = cast<TypedValue<ShapedType>>(
- builder
- .create<AllSliceOp>(sourceShard, grid,
- ArrayRef<GridAxis>(splitGridAxis),
- splitTensorAxis)
+ AllSliceOp::create(builder, sourceShard, grid,
+ ArrayRef<GridAxis>(splitGridAxis), splitTensorAxis)
.getResult());
Sharding targetSharding = targetShardingInSplitLastAxis(
builder.getContext(), sourceSharding, splitTensorAxis, splitGridAxis);
@@ -420,16 +418,15 @@ tryUpdateHaloInResharding(ImplicitLocOpBuilder &builder, GridOp grid,
// Finally update the halo.
auto updateHaloResult =
- builder
- .create<UpdateHaloOp>(
- sourceShard.getLoc(),
- RankedTensorType::get(outShape,
- sourceShard.getType().getElementType()),
- initOprnd, grid.getSymName(),
- GridAxesArrayAttr::get(builder.getContext(),
- sourceSharding.getSplitAxes()),
- targetSharding.getDynamicHaloSizes(),
- targetSharding.getStaticHaloSizes())
+ UpdateHaloOp::create(
+ builder, sourceShard.getLoc(),
+ RankedTensorType::get(outShape,
+ sourceShard.getType().getElementType()),
+ initOprnd, grid.getSymName(),
+ GridAxesArrayAttr::get(builder.getContext(),
+ sourceSharding.getSplitAxes()),
+ targetSharding.getDynamicHaloSizes(),
+ targetSharding.getStaticHaloSizes())
.getResult();
return std::make_tuple(cast<TypedValue<ShapedType>>(updateHaloResult),
targetSharding);
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
index a52872dd093d8..3b4140edd1641 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
@@ -931,10 +931,9 @@ createQuickSort(OpBuilder &builder, ModuleOp module, func::FuncOp func,
FlatSymbolRefAttr partitionFunc = getMangledSortHelperFunc(
builder, func, {IndexType::get(context)}, kPartitionFuncNamePrefix, xPerm,
ny, args.drop_back(nTrailingP), createPartitionFunc);
- Value p = builder
- .create<func::CallOp>(loc, partitionFunc,
- TypeRange{IndexType::get(context)},
- args.drop_back(nTrailingP))
+ Value p = func::CallOp::create(builder, loc, partitionFunc,
+ TypeRange{IndexType::get(context)},
+ args.drop_back(nTrailingP))
.getResult(0);
Value lenLow = arith::SubIOp::create(builder, loc, p, lo);
@@ -1028,9 +1027,8 @@ static void createSortStableFunc(OpBuilder &builder, ModuleOp module,
FlatSymbolRefAttr searchFunc = getMangledSortHelperFunc(
builder, func, {IndexType::get(context)}, kBinarySearchFuncNamePrefix,
xPerm, ny, operands, createBinarySearchFunc);
- Value p = builder
- .create<func::CallOp>(loc, searchFunc, TypeRange{c1.getType()},
- operands)
+ Value p = func::CallOp::create(builder, loc, searchFunc,
+ TypeRange{c1.getType()}, operands)
.getResult(0);
// Move the value at data[i] to a temporary location.
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
index a317abd6c560b..0bd1d34c3504b 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
@@ -98,10 +98,10 @@ static Value genLaunchGPUFunc(OpBuilder &builder, gpu::GPUFuncOp gpuFunc,
Value...
[truncated]
|
@llvm/pr-subscribers-mlir-bufferization Author: Maksim Levental (makslevental) ChangesSee #147168 for more info. Patch is 30.68 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/150659.diff 23 Files Affected:
diff --git a/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp b/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp
index 748ff1edbfeb2..8c1786d3fbeae 100644
--- a/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp
+++ b/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp
@@ -96,8 +96,7 @@ static Value getStride(Location loc, MemRefType mType, Value base,
MemRefDescriptor memrefDescriptor(base);
auto attr = rewriter.getI64IntegerAttr(bytes);
Value scale = LLVM::ConstantOp::create(rewriter, loc, llvmInt64Type, attr);
- return rewriter
- .create<LLVM::MulOp>(loc, llvmInt64Type, scale,
+ return LLVM::MulOp::create(rewriter, loc, llvmInt64Type, scale,
memrefDescriptor.stride(rewriter, loc, preLast))
.getResult();
}
diff --git a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
index 994d48505d24f..3a49bf01a0c06 100644
--- a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
+++ b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
@@ -688,8 +688,7 @@ FailureOr<Value> bufferization::getBuffer(RewriterBase &rewriter, Value value,
if (failed(bufferType))
return failure();
ensureToBufferOpIsValid(value, *bufferType);
- return rewriter
- .create<bufferization::ToBufferOp>(value.getLoc(), *bufferType, value)
+ return bufferization::ToBufferOp::create(rewriter, value.getLoc(), *bufferType, value)
.getResult();
}
@@ -772,8 +771,7 @@ FailureOr<Value> BufferizationOptions::createAlloc(OpBuilder &b, Location loc,
// Default bufferallocation via AllocOp.
if (bufferAlignment != 0)
- return b
- .create<memref::AllocOp>(loc, type, dynShape,
+ return memref::AllocOp::create(b, loc, type, dynShape,
b.getI64IntegerAttr(bufferAlignment))
.getResult();
return memref::AllocOp::create(b, loc, type, dynShape).getResult();
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp b/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp
index f0d65b04ee447..8b8f1445603c5 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp
@@ -483,8 +483,7 @@ func::FuncOp mlir::bufferization::buildDeallocationLibraryFunction(
// Build the first for loop that computes aliasing with retained
// memrefs.
Value noRetainAlias =
- builder
- .create<scf::ForOp>(
+ scf::ForOp::create(builder,
loc, c0, toRetainSize, c1, trueValue,
[&](OpBuilder &builder, Location loc, Value i,
ValueRange iterArgs) {
@@ -517,8 +516,7 @@ func::FuncOp mlir::bufferization::buildDeallocationLibraryFunction(
// Build the second for loop that adds aliasing with previously
// deallocated memrefs.
Value noAlias =
- builder
- .create<scf::ForOp>(
+ scf::ForOp::create(builder,
loc, c0, outerIter, c1, noRetainAlias,
[&](OpBuilder &builder, Location loc, Value i,
ValueRange iterArgs) {
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp b/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp
index 64c178dfe76d8..5af63d4787087 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp
@@ -750,8 +750,7 @@ Value BufferDeallocation::materializeMemrefWithGuaranteedOwnership(
// Insert a runtime check and only clone if we still don't have ownership at
// runtime.
- Value maybeClone = builder
- .create<scf::IfOp>(
+ Value maybeClone = scf::IfOp::create(builder,
memref.getLoc(), condition,
[&](OpBuilder &builder, Location loc) {
scf::YieldOp::create(builder, loc, newMemref);
diff --git a/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp b/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp
index d88f4d56d9009..dd0ae6a047f5b 100644
--- a/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp
@@ -60,13 +60,11 @@ struct GpuShuffleRewriter : public OpRewritePattern<gpu::ShuffleOp> {
// Shuffle the values.
ValueRange loRes =
- rewriter
- .create<gpu::ShuffleOp>(op.getLoc(), lo, op.getOffset(),
+ gpu::ShuffleOp::create(rewriter, op.getLoc(), lo, op.getOffset(),
op.getWidth(), op.getMode())
.getResults();
ValueRange hiRes =
- rewriter
- .create<gpu::ShuffleOp>(op.getLoc(), hi, op.getOffset(),
+ gpu::ShuffleOp::create(rewriter, op.getLoc(), hi, op.getOffset(),
op.getWidth(), op.getMode())
.getResults();
diff --git a/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp b/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp
index b9e2dd5b19a6f..37fd0bf32191d 100644
--- a/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp
@@ -197,8 +197,7 @@ Value createSubgroupShuffleReduction(OpBuilder &builder, Location loc,
// Parallel reduction using butterfly shuffles.
for (unsigned i = ci.clusterStride; i < ci.clusterStride * ci.clusterSize;
i <<= 1) {
- Value shuffled = builder
- .create<gpu::ShuffleOp>(loc, packFn(laneVal), i,
+ Value shuffled = gpu::ShuffleOp::create(builder, loc, packFn(laneVal), i,
/*width=*/ci.subgroupSize,
/*mode=*/gpu::ShuffleMode::XOR)
.getShuffleResult();
diff --git a/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp b/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
index 66c1aa6bf3fe1..d5e2b97e501e6 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
@@ -56,9 +56,8 @@ FailureOr<Value> memref::buildIndependentOp(OpBuilder &b,
// Create a memref::SubViewOp.
SmallVector<OpFoldResult> offsets(newSizes.size(), b.getIndexAttr(0));
SmallVector<OpFoldResult> strides(newSizes.size(), b.getIndexAttr(1));
- return b
- .create<SubViewOp>(loc, newAllocaOp, offsets, allocaOp.getMixedSizes(),
- strides)
+ return SubViewOp::create(b, loc, newAllocaOp, offsets,
+ allocaOp.getMixedSizes(), strides)
.getResult();
}
diff --git a/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp b/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
index 1f03e9ae8d6a1..d3a77c026379e 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
@@ -185,9 +185,8 @@ struct CopyOpInterface
int64_t dim) -> Value {
return type.isDynamicDim(dim)
? DimOp::create(builder, loc, memRef, dim).getResult()
- : builder
- .create<arith::ConstantIndexOp>(loc,
- type.getDimSize(dim))
+ : arith::ConstantIndexOp::create(builder, loc,
+ type.getDimSize(dim))
.getResult();
};
Value sourceDim = getDimSize(copyOp.getSource(), rankedSourceType, i);
diff --git a/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp b/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp
index 58cd160948f7f..9e37bc5163f71 100644
--- a/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp
+++ b/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp
@@ -148,16 +148,14 @@ flattenUnrankedTensorAroundAxis(OpBuilder &builder, Location loc, Value input,
auto axisValue = arith::ConstantIndexOp::create(builder, loc, axis);
auto axisNextValue = arith::ConstantIndexOp::create(builder, loc, axis + 1);
auto shapeLeft =
- builder
- .create<shape::SplitAtOp>(loc, TypeRange{shapeType, shapeType},
- inputShape, axisValue)
+ shape::SplitAtOp::create(builder, loc, TypeRange{shapeType, shapeType},
+ inputShape, axisValue)
.getResult(0);
auto sizeLeft =
shape::NumElementsOp::create(builder, loc, indexType, shapeLeft);
auto shapeRight =
- builder
- .create<shape::SplitAtOp>(loc, TypeRange{shapeType, shapeType},
- inputShape, axisNextValue)
+ shape::SplitAtOp::create(builder, loc, TypeRange{shapeType, shapeType},
+ inputShape, axisNextValue)
.getResult(1);
auto sizeRight =
shape::NumElementsOp::create(builder, loc, indexType, shapeRight);
@@ -557,25 +555,24 @@ Value convertPerChannelRanked(OpBuilder &builder, Location loc, Operation *op,
SmallVector<AffineMap> indexingMaps{
builder.getMultiDimIdentityMap(inputRank), channelAxisAffineMap,
channelAxisAffineMap, builder.getMultiDimIdentityMap(inputRank)};
- auto result = builder
- .create<linalg::GenericOp>(
- loc,
- init.getType(), // resultType
- ValueRange{input, scales, zeroPoints}, // inputs
- ValueRange{init}, // outputs
- indexingMaps, iteratorTypes,
- [&](OpBuilder &builder, Location loc, ValueRange args) {
- assert(args.size() == 4);
- auto input = args[0];
- auto scale = args[1];
- auto zeroPoint = args[2];
-
- auto result =
- convertRanked(builder, loc, op, input, {}, scale,
- zeroPoint, quantizedType);
-
- linalg::YieldOp::create(builder, loc, result);
- })
+ auto result = linalg::GenericOp::create(
+ builder, loc,
+ init.getType(), // resultType
+ ValueRange{input, scales, zeroPoints}, // inputs
+ ValueRange{init}, // outputs
+ indexingMaps, iteratorTypes,
+ [&](OpBuilder &builder, Location loc, ValueRange args) {
+ assert(args.size() == 4);
+ auto input = args[0];
+ auto scale = args[1];
+ auto zeroPoint = args[2];
+
+ auto result =
+ convertRanked(builder, loc, op, input, {}, scale,
+ zeroPoint, quantizedType);
+
+ linalg::YieldOp::create(builder, loc, result);
+ })
.getResult(0);
return result;
@@ -660,25 +657,24 @@ Value convertSubChannel(OpBuilder &builder, Location loc, Operation *op,
SmallVector<AffineMap> indexingMaps{
builder.getMultiDimIdentityMap(inputRank), affineMap, affineMap,
builder.getMultiDimIdentityMap(inputRank)};
- auto result = builder
- .create<linalg::GenericOp>(
- loc,
- init.getType(), // resultType
- ValueRange{input, scales, zeroPoints}, // inputs
- ValueRange{init}, // outputs
- indexingMaps, iteratorTypes,
- [&](OpBuilder &builder, Location loc, ValueRange args) {
- assert(args.size() == 4);
- auto input = args[0];
- auto scale = args[1];
- auto zeroPoint = args[2];
-
- auto result =
- convertRanked(builder, loc, op, input, {}, scale,
- zeroPoint, quantizedType);
-
- linalg::YieldOp::create(builder, loc, result);
- })
+ auto result = linalg::GenericOp::create(
+ builder, loc,
+ init.getType(), // resultType
+ ValueRange{input, scales, zeroPoints}, // inputs
+ ValueRange{init}, // outputs
+ indexingMaps, iteratorTypes,
+ [&](OpBuilder &builder, Location loc, ValueRange args) {
+ assert(args.size() == 4);
+ auto input = args[0];
+ auto scale = args[1];
+ auto zeroPoint = args[2];
+
+ auto result =
+ convertRanked(builder, loc, op, input, {}, scale,
+ zeroPoint, quantizedType);
+
+ linalg::YieldOp::create(builder, loc, result);
+ })
.getResult(0);
return result;
diff --git a/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
index 64c4d607e3fb9..f8799c52e8797 100644
--- a/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
@@ -497,10 +497,10 @@ getBbArgReplacements(RewriterBase &rewriter, Block::BlockArgListType bbArgs,
size_t idx = it.index();
Value val = it.value();
if (tensorIndices.contains(idx)) {
- result.push_back(rewriter
- .create<bufferization::ToTensorOp>(
- val.getLoc(), oldBbArgs[idx].getType(), val)
- .getResult());
+ result.push_back(
+ bufferization::ToTensorOp::create(rewriter, val.getLoc(),
+ oldBbArgs[idx].getType(), val)
+ .getResult());
} else {
result.push_back(val);
}
diff --git a/mlir/lib/Dialect/SCF/Utils/Utils.cpp b/mlir/lib/Dialect/SCF/Utils/Utils.cpp
index 5b0c60415a6c4..57317951d609c 100644
--- a/mlir/lib/Dialect/SCF/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/SCF/Utils/Utils.cpp
@@ -827,9 +827,8 @@ static Value getProductOfIntsOrIndexes(RewriterBase &rewriter, Location loc,
productOf = v;
}
if (!productOf) {
- productOf = rewriter
- .create<arith::ConstantOp>(
- loc, rewriter.getOneAttr(getType(values.front())))
+ productOf = arith::ConstantOp::create(
+ rewriter, loc, rewriter.getOneAttr(getType(values.front())))
.getResult();
}
return productOf.value();
diff --git a/mlir/lib/Dialect/Shape/IR/Shape.cpp b/mlir/lib/Dialect/Shape/IR/Shape.cpp
index e24f0f87e781d..50985c1c131f5 100644
--- a/mlir/lib/Dialect/Shape/IR/Shape.cpp
+++ b/mlir/lib/Dialect/Shape/IR/Shape.cpp
@@ -1702,8 +1702,7 @@ struct ShapeOfOpToConstShapeOp : public OpRewritePattern<shape::ShapeOfOp> {
return failure();
Location loc = op.getLoc();
Value constShape =
- rewriter
- .create<ConstShapeOp>(loc,
+ ConstShapeOp::create(rewriter, loc,
rewriter.getIndexTensorAttr(type.getShape()))
.getResult();
if (constShape.getType() != op.getResult().getType())
diff --git a/mlir/lib/Dialect/Shard/Transforms/Partition.cpp b/mlir/lib/Dialect/Shard/Transforms/Partition.cpp
index 5fe55669c90db..3e3d4768853e5 100644
--- a/mlir/lib/Dialect/Shard/Transforms/Partition.cpp
+++ b/mlir/lib/Dialect/Shard/Transforms/Partition.cpp
@@ -70,10 +70,8 @@ splitLastAxisInResharding(ImplicitLocOpBuilder &builder,
TypedValue<ShapedType> sourceShard, GridOp grid,
int64_t splitTensorAxis, GridAxis splitGridAxis) {
TypedValue<ShapedType> targetShard = cast<TypedValue<ShapedType>>(
- builder
- .create<AllSliceOp>(sourceShard, grid,
- ArrayRef<GridAxis>(splitGridAxis),
- splitTensorAxis)
+ AllSliceOp::create(builder, sourceShard, grid,
+ ArrayRef<GridAxis>(splitGridAxis), splitTensorAxis)
.getResult());
Sharding targetSharding = targetShardingInSplitLastAxis(
builder.getContext(), sourceSharding, splitTensorAxis, splitGridAxis);
@@ -420,16 +418,15 @@ tryUpdateHaloInResharding(ImplicitLocOpBuilder &builder, GridOp grid,
// Finally update the halo.
auto updateHaloResult =
- builder
- .create<UpdateHaloOp>(
- sourceShard.getLoc(),
- RankedTensorType::get(outShape,
- sourceShard.getType().getElementType()),
- initOprnd, grid.getSymName(),
- GridAxesArrayAttr::get(builder.getContext(),
- sourceSharding.getSplitAxes()),
- targetSharding.getDynamicHaloSizes(),
- targetSharding.getStaticHaloSizes())
+ UpdateHaloOp::create(
+ builder, sourceShard.getLoc(),
+ RankedTensorType::get(outShape,
+ sourceShard.getType().getElementType()),
+ initOprnd, grid.getSymName(),
+ GridAxesArrayAttr::get(builder.getContext(),
+ sourceSharding.getSplitAxes()),
+ targetSharding.getDynamicHaloSizes(),
+ targetSharding.getStaticHaloSizes())
.getResult();
return std::make_tuple(cast<TypedValue<ShapedType>>(updateHaloResult),
targetSharding);
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
index a52872dd093d8..3b4140edd1641 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
@@ -931,10 +931,9 @@ createQuickSort(OpBuilder &builder, ModuleOp module, func::FuncOp func,
FlatSymbolRefAttr partitionFunc = getMangledSortHelperFunc(
builder, func, {IndexType::get(context)}, kPartitionFuncNamePrefix, xPerm,
ny, args.drop_back(nTrailingP), createPartitionFunc);
- Value p = builder
- .create<func::CallOp>(loc, partitionFunc,
- TypeRange{IndexType::get(context)},
- args.drop_back(nTrailingP))
+ Value p = func::CallOp::create(builder, loc, partitionFunc,
+ TypeRange{IndexType::get(context)},
+ args.drop_back(nTrailingP))
.getResult(0);
Value lenLow = arith::SubIOp::create(builder, loc, p, lo);
@@ -1028,9 +1027,8 @@ static void createSortStableFunc(OpBuilder &builder, ModuleOp module,
FlatSymbolRefAttr searchFunc = getMangledSortHelperFunc(
builder, func, {IndexType::get(context)}, kBinarySearchFuncNamePrefix,
xPerm, ny, operands, createBinarySearchFunc);
- Value p = builder
- .create<func::CallOp>(loc, searchFunc, TypeRange{c1.getType()},
- operands)
+ Value p = func::CallOp::create(builder, loc, searchFunc,
+ TypeRange{c1.getType()}, operands)
.getResult(0);
// Move the value at data[i] to a temporary location.
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
index a317abd6c560b..0bd1d34c3504b 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
@@ -98,10 +98,10 @@ static Value genLaunchGPUFunc(OpBuilder &builder, gpu::GPUFuncOp gpuFunc,
Value...
[truncated]
|
@llvm/pr-subscribers-mlir-tosa Author: Maksim Levental (makslevental) ChangesSee #147168 for more info. Patch is 30.68 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/150659.diff 23 Files Affected:
diff --git a/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp b/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp
index 748ff1edbfeb2..8c1786d3fbeae 100644
--- a/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp
+++ b/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp
@@ -96,8 +96,7 @@ static Value getStride(Location loc, MemRefType mType, Value base,
MemRefDescriptor memrefDescriptor(base);
auto attr = rewriter.getI64IntegerAttr(bytes);
Value scale = LLVM::ConstantOp::create(rewriter, loc, llvmInt64Type, attr);
- return rewriter
- .create<LLVM::MulOp>(loc, llvmInt64Type, scale,
+ return LLVM::MulOp::create(rewriter, loc, llvmInt64Type, scale,
memrefDescriptor.stride(rewriter, loc, preLast))
.getResult();
}
diff --git a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
index 994d48505d24f..3a49bf01a0c06 100644
--- a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
+++ b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
@@ -688,8 +688,7 @@ FailureOr<Value> bufferization::getBuffer(RewriterBase &rewriter, Value value,
if (failed(bufferType))
return failure();
ensureToBufferOpIsValid(value, *bufferType);
- return rewriter
- .create<bufferization::ToBufferOp>(value.getLoc(), *bufferType, value)
+ return bufferization::ToBufferOp::create(rewriter, value.getLoc(), *bufferType, value)
.getResult();
}
@@ -772,8 +771,7 @@ FailureOr<Value> BufferizationOptions::createAlloc(OpBuilder &b, Location loc,
// Default bufferallocation via AllocOp.
if (bufferAlignment != 0)
- return b
- .create<memref::AllocOp>(loc, type, dynShape,
+ return memref::AllocOp::create(b, loc, type, dynShape,
b.getI64IntegerAttr(bufferAlignment))
.getResult();
return memref::AllocOp::create(b, loc, type, dynShape).getResult();
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp b/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp
index f0d65b04ee447..8b8f1445603c5 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp
@@ -483,8 +483,7 @@ func::FuncOp mlir::bufferization::buildDeallocationLibraryFunction(
// Build the first for loop that computes aliasing with retained
// memrefs.
Value noRetainAlias =
- builder
- .create<scf::ForOp>(
+ scf::ForOp::create(builder,
loc, c0, toRetainSize, c1, trueValue,
[&](OpBuilder &builder, Location loc, Value i,
ValueRange iterArgs) {
@@ -517,8 +516,7 @@ func::FuncOp mlir::bufferization::buildDeallocationLibraryFunction(
// Build the second for loop that adds aliasing with previously
// deallocated memrefs.
Value noAlias =
- builder
- .create<scf::ForOp>(
+ scf::ForOp::create(builder,
loc, c0, outerIter, c1, noRetainAlias,
[&](OpBuilder &builder, Location loc, Value i,
ValueRange iterArgs) {
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp b/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp
index 64c178dfe76d8..5af63d4787087 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp
@@ -750,8 +750,7 @@ Value BufferDeallocation::materializeMemrefWithGuaranteedOwnership(
// Insert a runtime check and only clone if we still don't have ownership at
// runtime.
- Value maybeClone = builder
- .create<scf::IfOp>(
+ Value maybeClone = scf::IfOp::create(builder,
memref.getLoc(), condition,
[&](OpBuilder &builder, Location loc) {
scf::YieldOp::create(builder, loc, newMemref);
diff --git a/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp b/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp
index d88f4d56d9009..dd0ae6a047f5b 100644
--- a/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp
@@ -60,13 +60,11 @@ struct GpuShuffleRewriter : public OpRewritePattern<gpu::ShuffleOp> {
// Shuffle the values.
ValueRange loRes =
- rewriter
- .create<gpu::ShuffleOp>(op.getLoc(), lo, op.getOffset(),
+ gpu::ShuffleOp::create(rewriter, op.getLoc(), lo, op.getOffset(),
op.getWidth(), op.getMode())
.getResults();
ValueRange hiRes =
- rewriter
- .create<gpu::ShuffleOp>(op.getLoc(), hi, op.getOffset(),
+ gpu::ShuffleOp::create(rewriter, op.getLoc(), hi, op.getOffset(),
op.getWidth(), op.getMode())
.getResults();
diff --git a/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp b/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp
index b9e2dd5b19a6f..37fd0bf32191d 100644
--- a/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp
@@ -197,8 +197,7 @@ Value createSubgroupShuffleReduction(OpBuilder &builder, Location loc,
// Parallel reduction using butterfly shuffles.
for (unsigned i = ci.clusterStride; i < ci.clusterStride * ci.clusterSize;
i <<= 1) {
- Value shuffled = builder
- .create<gpu::ShuffleOp>(loc, packFn(laneVal), i,
+ Value shuffled = gpu::ShuffleOp::create(builder, loc, packFn(laneVal), i,
/*width=*/ci.subgroupSize,
/*mode=*/gpu::ShuffleMode::XOR)
.getShuffleResult();
diff --git a/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp b/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
index 66c1aa6bf3fe1..d5e2b97e501e6 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
@@ -56,9 +56,8 @@ FailureOr<Value> memref::buildIndependentOp(OpBuilder &b,
// Create a memref::SubViewOp.
SmallVector<OpFoldResult> offsets(newSizes.size(), b.getIndexAttr(0));
SmallVector<OpFoldResult> strides(newSizes.size(), b.getIndexAttr(1));
- return b
- .create<SubViewOp>(loc, newAllocaOp, offsets, allocaOp.getMixedSizes(),
- strides)
+ return SubViewOp::create(b, loc, newAllocaOp, offsets,
+ allocaOp.getMixedSizes(), strides)
.getResult();
}
diff --git a/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp b/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
index 1f03e9ae8d6a1..d3a77c026379e 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
@@ -185,9 +185,8 @@ struct CopyOpInterface
int64_t dim) -> Value {
return type.isDynamicDim(dim)
? DimOp::create(builder, loc, memRef, dim).getResult()
- : builder
- .create<arith::ConstantIndexOp>(loc,
- type.getDimSize(dim))
+ : arith::ConstantIndexOp::create(builder, loc,
+ type.getDimSize(dim))
.getResult();
};
Value sourceDim = getDimSize(copyOp.getSource(), rankedSourceType, i);
diff --git a/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp b/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp
index 58cd160948f7f..9e37bc5163f71 100644
--- a/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp
+++ b/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp
@@ -148,16 +148,14 @@ flattenUnrankedTensorAroundAxis(OpBuilder &builder, Location loc, Value input,
auto axisValue = arith::ConstantIndexOp::create(builder, loc, axis);
auto axisNextValue = arith::ConstantIndexOp::create(builder, loc, axis + 1);
auto shapeLeft =
- builder
- .create<shape::SplitAtOp>(loc, TypeRange{shapeType, shapeType},
- inputShape, axisValue)
+ shape::SplitAtOp::create(builder, loc, TypeRange{shapeType, shapeType},
+ inputShape, axisValue)
.getResult(0);
auto sizeLeft =
shape::NumElementsOp::create(builder, loc, indexType, shapeLeft);
auto shapeRight =
- builder
- .create<shape::SplitAtOp>(loc, TypeRange{shapeType, shapeType},
- inputShape, axisNextValue)
+ shape::SplitAtOp::create(builder, loc, TypeRange{shapeType, shapeType},
+ inputShape, axisNextValue)
.getResult(1);
auto sizeRight =
shape::NumElementsOp::create(builder, loc, indexType, shapeRight);
@@ -557,25 +555,24 @@ Value convertPerChannelRanked(OpBuilder &builder, Location loc, Operation *op,
SmallVector<AffineMap> indexingMaps{
builder.getMultiDimIdentityMap(inputRank), channelAxisAffineMap,
channelAxisAffineMap, builder.getMultiDimIdentityMap(inputRank)};
- auto result = builder
- .create<linalg::GenericOp>(
- loc,
- init.getType(), // resultType
- ValueRange{input, scales, zeroPoints}, // inputs
- ValueRange{init}, // outputs
- indexingMaps, iteratorTypes,
- [&](OpBuilder &builder, Location loc, ValueRange args) {
- assert(args.size() == 4);
- auto input = args[0];
- auto scale = args[1];
- auto zeroPoint = args[2];
-
- auto result =
- convertRanked(builder, loc, op, input, {}, scale,
- zeroPoint, quantizedType);
-
- linalg::YieldOp::create(builder, loc, result);
- })
+ auto result = linalg::GenericOp::create(
+ builder, loc,
+ init.getType(), // resultType
+ ValueRange{input, scales, zeroPoints}, // inputs
+ ValueRange{init}, // outputs
+ indexingMaps, iteratorTypes,
+ [&](OpBuilder &builder, Location loc, ValueRange args) {
+ assert(args.size() == 4);
+ auto input = args[0];
+ auto scale = args[1];
+ auto zeroPoint = args[2];
+
+ auto result =
+ convertRanked(builder, loc, op, input, {}, scale,
+ zeroPoint, quantizedType);
+
+ linalg::YieldOp::create(builder, loc, result);
+ })
.getResult(0);
return result;
@@ -660,25 +657,24 @@ Value convertSubChannel(OpBuilder &builder, Location loc, Operation *op,
SmallVector<AffineMap> indexingMaps{
builder.getMultiDimIdentityMap(inputRank), affineMap, affineMap,
builder.getMultiDimIdentityMap(inputRank)};
- auto result = builder
- .create<linalg::GenericOp>(
- loc,
- init.getType(), // resultType
- ValueRange{input, scales, zeroPoints}, // inputs
- ValueRange{init}, // outputs
- indexingMaps, iteratorTypes,
- [&](OpBuilder &builder, Location loc, ValueRange args) {
- assert(args.size() == 4);
- auto input = args[0];
- auto scale = args[1];
- auto zeroPoint = args[2];
-
- auto result =
- convertRanked(builder, loc, op, input, {}, scale,
- zeroPoint, quantizedType);
-
- linalg::YieldOp::create(builder, loc, result);
- })
+ auto result = linalg::GenericOp::create(
+ builder, loc,
+ init.getType(), // resultType
+ ValueRange{input, scales, zeroPoints}, // inputs
+ ValueRange{init}, // outputs
+ indexingMaps, iteratorTypes,
+ [&](OpBuilder &builder, Location loc, ValueRange args) {
+ assert(args.size() == 4);
+ auto input = args[0];
+ auto scale = args[1];
+ auto zeroPoint = args[2];
+
+ auto result =
+ convertRanked(builder, loc, op, input, {}, scale,
+ zeroPoint, quantizedType);
+
+ linalg::YieldOp::create(builder, loc, result);
+ })
.getResult(0);
return result;
diff --git a/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
index 64c4d607e3fb9..f8799c52e8797 100644
--- a/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
@@ -497,10 +497,10 @@ getBbArgReplacements(RewriterBase &rewriter, Block::BlockArgListType bbArgs,
size_t idx = it.index();
Value val = it.value();
if (tensorIndices.contains(idx)) {
- result.push_back(rewriter
- .create<bufferization::ToTensorOp>(
- val.getLoc(), oldBbArgs[idx].getType(), val)
- .getResult());
+ result.push_back(
+ bufferization::ToTensorOp::create(rewriter, val.getLoc(),
+ oldBbArgs[idx].getType(), val)
+ .getResult());
} else {
result.push_back(val);
}
diff --git a/mlir/lib/Dialect/SCF/Utils/Utils.cpp b/mlir/lib/Dialect/SCF/Utils/Utils.cpp
index 5b0c60415a6c4..57317951d609c 100644
--- a/mlir/lib/Dialect/SCF/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/SCF/Utils/Utils.cpp
@@ -827,9 +827,8 @@ static Value getProductOfIntsOrIndexes(RewriterBase &rewriter, Location loc,
productOf = v;
}
if (!productOf) {
- productOf = rewriter
- .create<arith::ConstantOp>(
- loc, rewriter.getOneAttr(getType(values.front())))
+ productOf = arith::ConstantOp::create(
+ rewriter, loc, rewriter.getOneAttr(getType(values.front())))
.getResult();
}
return productOf.value();
diff --git a/mlir/lib/Dialect/Shape/IR/Shape.cpp b/mlir/lib/Dialect/Shape/IR/Shape.cpp
index e24f0f87e781d..50985c1c131f5 100644
--- a/mlir/lib/Dialect/Shape/IR/Shape.cpp
+++ b/mlir/lib/Dialect/Shape/IR/Shape.cpp
@@ -1702,8 +1702,7 @@ struct ShapeOfOpToConstShapeOp : public OpRewritePattern<shape::ShapeOfOp> {
return failure();
Location loc = op.getLoc();
Value constShape =
- rewriter
- .create<ConstShapeOp>(loc,
+ ConstShapeOp::create(rewriter, loc,
rewriter.getIndexTensorAttr(type.getShape()))
.getResult();
if (constShape.getType() != op.getResult().getType())
diff --git a/mlir/lib/Dialect/Shard/Transforms/Partition.cpp b/mlir/lib/Dialect/Shard/Transforms/Partition.cpp
index 5fe55669c90db..3e3d4768853e5 100644
--- a/mlir/lib/Dialect/Shard/Transforms/Partition.cpp
+++ b/mlir/lib/Dialect/Shard/Transforms/Partition.cpp
@@ -70,10 +70,8 @@ splitLastAxisInResharding(ImplicitLocOpBuilder &builder,
TypedValue<ShapedType> sourceShard, GridOp grid,
int64_t splitTensorAxis, GridAxis splitGridAxis) {
TypedValue<ShapedType> targetShard = cast<TypedValue<ShapedType>>(
- builder
- .create<AllSliceOp>(sourceShard, grid,
- ArrayRef<GridAxis>(splitGridAxis),
- splitTensorAxis)
+ AllSliceOp::create(builder, sourceShard, grid,
+ ArrayRef<GridAxis>(splitGridAxis), splitTensorAxis)
.getResult());
Sharding targetSharding = targetShardingInSplitLastAxis(
builder.getContext(), sourceSharding, splitTensorAxis, splitGridAxis);
@@ -420,16 +418,15 @@ tryUpdateHaloInResharding(ImplicitLocOpBuilder &builder, GridOp grid,
// Finally update the halo.
auto updateHaloResult =
- builder
- .create<UpdateHaloOp>(
- sourceShard.getLoc(),
- RankedTensorType::get(outShape,
- sourceShard.getType().getElementType()),
- initOprnd, grid.getSymName(),
- GridAxesArrayAttr::get(builder.getContext(),
- sourceSharding.getSplitAxes()),
- targetSharding.getDynamicHaloSizes(),
- targetSharding.getStaticHaloSizes())
+ UpdateHaloOp::create(
+ builder, sourceShard.getLoc(),
+ RankedTensorType::get(outShape,
+ sourceShard.getType().getElementType()),
+ initOprnd, grid.getSymName(),
+ GridAxesArrayAttr::get(builder.getContext(),
+ sourceSharding.getSplitAxes()),
+ targetSharding.getDynamicHaloSizes(),
+ targetSharding.getStaticHaloSizes())
.getResult();
return std::make_tuple(cast<TypedValue<ShapedType>>(updateHaloResult),
targetSharding);
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
index a52872dd093d8..3b4140edd1641 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
@@ -931,10 +931,9 @@ createQuickSort(OpBuilder &builder, ModuleOp module, func::FuncOp func,
FlatSymbolRefAttr partitionFunc = getMangledSortHelperFunc(
builder, func, {IndexType::get(context)}, kPartitionFuncNamePrefix, xPerm,
ny, args.drop_back(nTrailingP), createPartitionFunc);
- Value p = builder
- .create<func::CallOp>(loc, partitionFunc,
- TypeRange{IndexType::get(context)},
- args.drop_back(nTrailingP))
+ Value p = func::CallOp::create(builder, loc, partitionFunc,
+ TypeRange{IndexType::get(context)},
+ args.drop_back(nTrailingP))
.getResult(0);
Value lenLow = arith::SubIOp::create(builder, loc, p, lo);
@@ -1028,9 +1027,8 @@ static void createSortStableFunc(OpBuilder &builder, ModuleOp module,
FlatSymbolRefAttr searchFunc = getMangledSortHelperFunc(
builder, func, {IndexType::get(context)}, kBinarySearchFuncNamePrefix,
xPerm, ny, operands, createBinarySearchFunc);
- Value p = builder
- .create<func::CallOp>(loc, searchFunc, TypeRange{c1.getType()},
- operands)
+ Value p = func::CallOp::create(builder, loc, searchFunc,
+ TypeRange{c1.getType()}, operands)
.getResult(0);
// Move the value at data[i] to a temporary location.
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
index a317abd6c560b..0bd1d34c3504b 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
@@ -98,10 +98,10 @@ static Value genLaunchGPUFunc(OpBuilder &builder, gpu::GPUFuncOp gpuFunc,
Value...
[truncated]
|
@llvm/pr-subscribers-mlir-memref Author: Maksim Levental (makslevental) ChangesSee #147168 for more info. Patch is 30.68 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/150659.diff 23 Files Affected:
diff --git a/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp b/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp
index 748ff1edbfeb2..8c1786d3fbeae 100644
--- a/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp
+++ b/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp
@@ -96,8 +96,7 @@ static Value getStride(Location loc, MemRefType mType, Value base,
MemRefDescriptor memrefDescriptor(base);
auto attr = rewriter.getI64IntegerAttr(bytes);
Value scale = LLVM::ConstantOp::create(rewriter, loc, llvmInt64Type, attr);
- return rewriter
- .create<LLVM::MulOp>(loc, llvmInt64Type, scale,
+ return LLVM::MulOp::create(rewriter, loc, llvmInt64Type, scale,
memrefDescriptor.stride(rewriter, loc, preLast))
.getResult();
}
diff --git a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
index 994d48505d24f..3a49bf01a0c06 100644
--- a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
+++ b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
@@ -688,8 +688,7 @@ FailureOr<Value> bufferization::getBuffer(RewriterBase &rewriter, Value value,
if (failed(bufferType))
return failure();
ensureToBufferOpIsValid(value, *bufferType);
- return rewriter
- .create<bufferization::ToBufferOp>(value.getLoc(), *bufferType, value)
+ return bufferization::ToBufferOp::create(rewriter, value.getLoc(), *bufferType, value)
.getResult();
}
@@ -772,8 +771,7 @@ FailureOr<Value> BufferizationOptions::createAlloc(OpBuilder &b, Location loc,
// Default bufferallocation via AllocOp.
if (bufferAlignment != 0)
- return b
- .create<memref::AllocOp>(loc, type, dynShape,
+ return memref::AllocOp::create(b, loc, type, dynShape,
b.getI64IntegerAttr(bufferAlignment))
.getResult();
return memref::AllocOp::create(b, loc, type, dynShape).getResult();
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp b/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp
index f0d65b04ee447..8b8f1445603c5 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp
@@ -483,8 +483,7 @@ func::FuncOp mlir::bufferization::buildDeallocationLibraryFunction(
// Build the first for loop that computes aliasing with retained
// memrefs.
Value noRetainAlias =
- builder
- .create<scf::ForOp>(
+ scf::ForOp::create(builder,
loc, c0, toRetainSize, c1, trueValue,
[&](OpBuilder &builder, Location loc, Value i,
ValueRange iterArgs) {
@@ -517,8 +516,7 @@ func::FuncOp mlir::bufferization::buildDeallocationLibraryFunction(
// Build the second for loop that adds aliasing with previously
// deallocated memrefs.
Value noAlias =
- builder
- .create<scf::ForOp>(
+ scf::ForOp::create(builder,
loc, c0, outerIter, c1, noRetainAlias,
[&](OpBuilder &builder, Location loc, Value i,
ValueRange iterArgs) {
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp b/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp
index 64c178dfe76d8..5af63d4787087 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp
@@ -750,8 +750,7 @@ Value BufferDeallocation::materializeMemrefWithGuaranteedOwnership(
// Insert a runtime check and only clone if we still don't have ownership at
// runtime.
- Value maybeClone = builder
- .create<scf::IfOp>(
+ Value maybeClone = scf::IfOp::create(builder,
memref.getLoc(), condition,
[&](OpBuilder &builder, Location loc) {
scf::YieldOp::create(builder, loc, newMemref);
diff --git a/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp b/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp
index d88f4d56d9009..dd0ae6a047f5b 100644
--- a/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp
@@ -60,13 +60,11 @@ struct GpuShuffleRewriter : public OpRewritePattern<gpu::ShuffleOp> {
// Shuffle the values.
ValueRange loRes =
- rewriter
- .create<gpu::ShuffleOp>(op.getLoc(), lo, op.getOffset(),
+ gpu::ShuffleOp::create(rewriter, op.getLoc(), lo, op.getOffset(),
op.getWidth(), op.getMode())
.getResults();
ValueRange hiRes =
- rewriter
- .create<gpu::ShuffleOp>(op.getLoc(), hi, op.getOffset(),
+ gpu::ShuffleOp::create(rewriter, op.getLoc(), hi, op.getOffset(),
op.getWidth(), op.getMode())
.getResults();
diff --git a/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp b/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp
index b9e2dd5b19a6f..37fd0bf32191d 100644
--- a/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp
@@ -197,8 +197,7 @@ Value createSubgroupShuffleReduction(OpBuilder &builder, Location loc,
// Parallel reduction using butterfly shuffles.
for (unsigned i = ci.clusterStride; i < ci.clusterStride * ci.clusterSize;
i <<= 1) {
- Value shuffled = builder
- .create<gpu::ShuffleOp>(loc, packFn(laneVal), i,
+ Value shuffled = gpu::ShuffleOp::create(builder, loc, packFn(laneVal), i,
/*width=*/ci.subgroupSize,
/*mode=*/gpu::ShuffleMode::XOR)
.getShuffleResult();
diff --git a/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp b/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
index 66c1aa6bf3fe1..d5e2b97e501e6 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
@@ -56,9 +56,8 @@ FailureOr<Value> memref::buildIndependentOp(OpBuilder &b,
// Create a memref::SubViewOp.
SmallVector<OpFoldResult> offsets(newSizes.size(), b.getIndexAttr(0));
SmallVector<OpFoldResult> strides(newSizes.size(), b.getIndexAttr(1));
- return b
- .create<SubViewOp>(loc, newAllocaOp, offsets, allocaOp.getMixedSizes(),
- strides)
+ return SubViewOp::create(b, loc, newAllocaOp, offsets,
+ allocaOp.getMixedSizes(), strides)
.getResult();
}
diff --git a/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp b/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
index 1f03e9ae8d6a1..d3a77c026379e 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
@@ -185,9 +185,8 @@ struct CopyOpInterface
int64_t dim) -> Value {
return type.isDynamicDim(dim)
? DimOp::create(builder, loc, memRef, dim).getResult()
- : builder
- .create<arith::ConstantIndexOp>(loc,
- type.getDimSize(dim))
+ : arith::ConstantIndexOp::create(builder, loc,
+ type.getDimSize(dim))
.getResult();
};
Value sourceDim = getDimSize(copyOp.getSource(), rankedSourceType, i);
diff --git a/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp b/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp
index 58cd160948f7f..9e37bc5163f71 100644
--- a/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp
+++ b/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp
@@ -148,16 +148,14 @@ flattenUnrankedTensorAroundAxis(OpBuilder &builder, Location loc, Value input,
auto axisValue = arith::ConstantIndexOp::create(builder, loc, axis);
auto axisNextValue = arith::ConstantIndexOp::create(builder, loc, axis + 1);
auto shapeLeft =
- builder
- .create<shape::SplitAtOp>(loc, TypeRange{shapeType, shapeType},
- inputShape, axisValue)
+ shape::SplitAtOp::create(builder, loc, TypeRange{shapeType, shapeType},
+ inputShape, axisValue)
.getResult(0);
auto sizeLeft =
shape::NumElementsOp::create(builder, loc, indexType, shapeLeft);
auto shapeRight =
- builder
- .create<shape::SplitAtOp>(loc, TypeRange{shapeType, shapeType},
- inputShape, axisNextValue)
+ shape::SplitAtOp::create(builder, loc, TypeRange{shapeType, shapeType},
+ inputShape, axisNextValue)
.getResult(1);
auto sizeRight =
shape::NumElementsOp::create(builder, loc, indexType, shapeRight);
@@ -557,25 +555,24 @@ Value convertPerChannelRanked(OpBuilder &builder, Location loc, Operation *op,
SmallVector<AffineMap> indexingMaps{
builder.getMultiDimIdentityMap(inputRank), channelAxisAffineMap,
channelAxisAffineMap, builder.getMultiDimIdentityMap(inputRank)};
- auto result = builder
- .create<linalg::GenericOp>(
- loc,
- init.getType(), // resultType
- ValueRange{input, scales, zeroPoints}, // inputs
- ValueRange{init}, // outputs
- indexingMaps, iteratorTypes,
- [&](OpBuilder &builder, Location loc, ValueRange args) {
- assert(args.size() == 4);
- auto input = args[0];
- auto scale = args[1];
- auto zeroPoint = args[2];
-
- auto result =
- convertRanked(builder, loc, op, input, {}, scale,
- zeroPoint, quantizedType);
-
- linalg::YieldOp::create(builder, loc, result);
- })
+ auto result = linalg::GenericOp::create(
+ builder, loc,
+ init.getType(), // resultType
+ ValueRange{input, scales, zeroPoints}, // inputs
+ ValueRange{init}, // outputs
+ indexingMaps, iteratorTypes,
+ [&](OpBuilder &builder, Location loc, ValueRange args) {
+ assert(args.size() == 4);
+ auto input = args[0];
+ auto scale = args[1];
+ auto zeroPoint = args[2];
+
+ auto result =
+ convertRanked(builder, loc, op, input, {}, scale,
+ zeroPoint, quantizedType);
+
+ linalg::YieldOp::create(builder, loc, result);
+ })
.getResult(0);
return result;
@@ -660,25 +657,24 @@ Value convertSubChannel(OpBuilder &builder, Location loc, Operation *op,
SmallVector<AffineMap> indexingMaps{
builder.getMultiDimIdentityMap(inputRank), affineMap, affineMap,
builder.getMultiDimIdentityMap(inputRank)};
- auto result = builder
- .create<linalg::GenericOp>(
- loc,
- init.getType(), // resultType
- ValueRange{input, scales, zeroPoints}, // inputs
- ValueRange{init}, // outputs
- indexingMaps, iteratorTypes,
- [&](OpBuilder &builder, Location loc, ValueRange args) {
- assert(args.size() == 4);
- auto input = args[0];
- auto scale = args[1];
- auto zeroPoint = args[2];
-
- auto result =
- convertRanked(builder, loc, op, input, {}, scale,
- zeroPoint, quantizedType);
-
- linalg::YieldOp::create(builder, loc, result);
- })
+ auto result = linalg::GenericOp::create(
+ builder, loc,
+ init.getType(), // resultType
+ ValueRange{input, scales, zeroPoints}, // inputs
+ ValueRange{init}, // outputs
+ indexingMaps, iteratorTypes,
+ [&](OpBuilder &builder, Location loc, ValueRange args) {
+ assert(args.size() == 4);
+ auto input = args[0];
+ auto scale = args[1];
+ auto zeroPoint = args[2];
+
+ auto result =
+ convertRanked(builder, loc, op, input, {}, scale,
+ zeroPoint, quantizedType);
+
+ linalg::YieldOp::create(builder, loc, result);
+ })
.getResult(0);
return result;
diff --git a/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
index 64c4d607e3fb9..f8799c52e8797 100644
--- a/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
@@ -497,10 +497,10 @@ getBbArgReplacements(RewriterBase &rewriter, Block::BlockArgListType bbArgs,
size_t idx = it.index();
Value val = it.value();
if (tensorIndices.contains(idx)) {
- result.push_back(rewriter
- .create<bufferization::ToTensorOp>(
- val.getLoc(), oldBbArgs[idx].getType(), val)
- .getResult());
+ result.push_back(
+ bufferization::ToTensorOp::create(rewriter, val.getLoc(),
+ oldBbArgs[idx].getType(), val)
+ .getResult());
} else {
result.push_back(val);
}
diff --git a/mlir/lib/Dialect/SCF/Utils/Utils.cpp b/mlir/lib/Dialect/SCF/Utils/Utils.cpp
index 5b0c60415a6c4..57317951d609c 100644
--- a/mlir/lib/Dialect/SCF/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/SCF/Utils/Utils.cpp
@@ -827,9 +827,8 @@ static Value getProductOfIntsOrIndexes(RewriterBase &rewriter, Location loc,
productOf = v;
}
if (!productOf) {
- productOf = rewriter
- .create<arith::ConstantOp>(
- loc, rewriter.getOneAttr(getType(values.front())))
+ productOf = arith::ConstantOp::create(
+ rewriter, loc, rewriter.getOneAttr(getType(values.front())))
.getResult();
}
return productOf.value();
diff --git a/mlir/lib/Dialect/Shape/IR/Shape.cpp b/mlir/lib/Dialect/Shape/IR/Shape.cpp
index e24f0f87e781d..50985c1c131f5 100644
--- a/mlir/lib/Dialect/Shape/IR/Shape.cpp
+++ b/mlir/lib/Dialect/Shape/IR/Shape.cpp
@@ -1702,8 +1702,7 @@ struct ShapeOfOpToConstShapeOp : public OpRewritePattern<shape::ShapeOfOp> {
return failure();
Location loc = op.getLoc();
Value constShape =
- rewriter
- .create<ConstShapeOp>(loc,
+ ConstShapeOp::create(rewriter, loc,
rewriter.getIndexTensorAttr(type.getShape()))
.getResult();
if (constShape.getType() != op.getResult().getType())
diff --git a/mlir/lib/Dialect/Shard/Transforms/Partition.cpp b/mlir/lib/Dialect/Shard/Transforms/Partition.cpp
index 5fe55669c90db..3e3d4768853e5 100644
--- a/mlir/lib/Dialect/Shard/Transforms/Partition.cpp
+++ b/mlir/lib/Dialect/Shard/Transforms/Partition.cpp
@@ -70,10 +70,8 @@ splitLastAxisInResharding(ImplicitLocOpBuilder &builder,
TypedValue<ShapedType> sourceShard, GridOp grid,
int64_t splitTensorAxis, GridAxis splitGridAxis) {
TypedValue<ShapedType> targetShard = cast<TypedValue<ShapedType>>(
- builder
- .create<AllSliceOp>(sourceShard, grid,
- ArrayRef<GridAxis>(splitGridAxis),
- splitTensorAxis)
+ AllSliceOp::create(builder, sourceShard, grid,
+ ArrayRef<GridAxis>(splitGridAxis), splitTensorAxis)
.getResult());
Sharding targetSharding = targetShardingInSplitLastAxis(
builder.getContext(), sourceSharding, splitTensorAxis, splitGridAxis);
@@ -420,16 +418,15 @@ tryUpdateHaloInResharding(ImplicitLocOpBuilder &builder, GridOp grid,
// Finally update the halo.
auto updateHaloResult =
- builder
- .create<UpdateHaloOp>(
- sourceShard.getLoc(),
- RankedTensorType::get(outShape,
- sourceShard.getType().getElementType()),
- initOprnd, grid.getSymName(),
- GridAxesArrayAttr::get(builder.getContext(),
- sourceSharding.getSplitAxes()),
- targetSharding.getDynamicHaloSizes(),
- targetSharding.getStaticHaloSizes())
+ UpdateHaloOp::create(
+ builder, sourceShard.getLoc(),
+ RankedTensorType::get(outShape,
+ sourceShard.getType().getElementType()),
+ initOprnd, grid.getSymName(),
+ GridAxesArrayAttr::get(builder.getContext(),
+ sourceSharding.getSplitAxes()),
+ targetSharding.getDynamicHaloSizes(),
+ targetSharding.getStaticHaloSizes())
.getResult();
return std::make_tuple(cast<TypedValue<ShapedType>>(updateHaloResult),
targetSharding);
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
index a52872dd093d8..3b4140edd1641 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
@@ -931,10 +931,9 @@ createQuickSort(OpBuilder &builder, ModuleOp module, func::FuncOp func,
FlatSymbolRefAttr partitionFunc = getMangledSortHelperFunc(
builder, func, {IndexType::get(context)}, kPartitionFuncNamePrefix, xPerm,
ny, args.drop_back(nTrailingP), createPartitionFunc);
- Value p = builder
- .create<func::CallOp>(loc, partitionFunc,
- TypeRange{IndexType::get(context)},
- args.drop_back(nTrailingP))
+ Value p = func::CallOp::create(builder, loc, partitionFunc,
+ TypeRange{IndexType::get(context)},
+ args.drop_back(nTrailingP))
.getResult(0);
Value lenLow = arith::SubIOp::create(builder, loc, p, lo);
@@ -1028,9 +1027,8 @@ static void createSortStableFunc(OpBuilder &builder, ModuleOp module,
FlatSymbolRefAttr searchFunc = getMangledSortHelperFunc(
builder, func, {IndexType::get(context)}, kBinarySearchFuncNamePrefix,
xPerm, ny, operands, createBinarySearchFunc);
- Value p = builder
- .create<func::CallOp>(loc, searchFunc, TypeRange{c1.getType()},
- operands)
+ Value p = func::CallOp::create(builder, loc, searchFunc,
+ TypeRange{c1.getType()}, operands)
.getResult(0);
// Move the value at data[i] to a temporary location.
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
index a317abd6c560b..0bd1d34c3504b 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
@@ -98,10 +98,10 @@ static Value genLaunchGPUFunc(OpBuilder &builder, gpu::GPUFuncOp gpuFunc,
Value...
[truncated]
|
@llvm/pr-subscribers-mlir-tensor Author: Maksim Levental (makslevental) ChangesSee #147168 for more info. Patch is 30.68 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/150659.diff 23 Files Affected:
diff --git a/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp b/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp
index 748ff1edbfeb2..8c1786d3fbeae 100644
--- a/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp
+++ b/mlir/lib/Dialect/AMX/IR/AMXDialect.cpp
@@ -96,8 +96,7 @@ static Value getStride(Location loc, MemRefType mType, Value base,
MemRefDescriptor memrefDescriptor(base);
auto attr = rewriter.getI64IntegerAttr(bytes);
Value scale = LLVM::ConstantOp::create(rewriter, loc, llvmInt64Type, attr);
- return rewriter
- .create<LLVM::MulOp>(loc, llvmInt64Type, scale,
+ return LLVM::MulOp::create(rewriter, loc, llvmInt64Type, scale,
memrefDescriptor.stride(rewriter, loc, preLast))
.getResult();
}
diff --git a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
index 994d48505d24f..3a49bf01a0c06 100644
--- a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
+++ b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
@@ -688,8 +688,7 @@ FailureOr<Value> bufferization::getBuffer(RewriterBase &rewriter, Value value,
if (failed(bufferType))
return failure();
ensureToBufferOpIsValid(value, *bufferType);
- return rewriter
- .create<bufferization::ToBufferOp>(value.getLoc(), *bufferType, value)
+ return bufferization::ToBufferOp::create(rewriter, value.getLoc(), *bufferType, value)
.getResult();
}
@@ -772,8 +771,7 @@ FailureOr<Value> BufferizationOptions::createAlloc(OpBuilder &b, Location loc,
// Default bufferallocation via AllocOp.
if (bufferAlignment != 0)
- return b
- .create<memref::AllocOp>(loc, type, dynShape,
+ return memref::AllocOp::create(b, loc, type, dynShape,
b.getI64IntegerAttr(bufferAlignment))
.getResult();
return memref::AllocOp::create(b, loc, type, dynShape).getResult();
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp b/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp
index f0d65b04ee447..8b8f1445603c5 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp
@@ -483,8 +483,7 @@ func::FuncOp mlir::bufferization::buildDeallocationLibraryFunction(
// Build the first for loop that computes aliasing with retained
// memrefs.
Value noRetainAlias =
- builder
- .create<scf::ForOp>(
+ scf::ForOp::create(builder,
loc, c0, toRetainSize, c1, trueValue,
[&](OpBuilder &builder, Location loc, Value i,
ValueRange iterArgs) {
@@ -517,8 +516,7 @@ func::FuncOp mlir::bufferization::buildDeallocationLibraryFunction(
// Build the second for loop that adds aliasing with previously
// deallocated memrefs.
Value noAlias =
- builder
- .create<scf::ForOp>(
+ scf::ForOp::create(builder,
loc, c0, outerIter, c1, noRetainAlias,
[&](OpBuilder &builder, Location loc, Value i,
ValueRange iterArgs) {
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp b/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp
index 64c178dfe76d8..5af63d4787087 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation.cpp
@@ -750,8 +750,7 @@ Value BufferDeallocation::materializeMemrefWithGuaranteedOwnership(
// Insert a runtime check and only clone if we still don't have ownership at
// runtime.
- Value maybeClone = builder
- .create<scf::IfOp>(
+ Value maybeClone = scf::IfOp::create(builder,
memref.getLoc(), condition,
[&](OpBuilder &builder, Location loc) {
scf::YieldOp::create(builder, loc, newMemref);
diff --git a/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp b/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp
index d88f4d56d9009..dd0ae6a047f5b 100644
--- a/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/ShuffleRewriter.cpp
@@ -60,13 +60,11 @@ struct GpuShuffleRewriter : public OpRewritePattern<gpu::ShuffleOp> {
// Shuffle the values.
ValueRange loRes =
- rewriter
- .create<gpu::ShuffleOp>(op.getLoc(), lo, op.getOffset(),
+ gpu::ShuffleOp::create(rewriter, op.getLoc(), lo, op.getOffset(),
op.getWidth(), op.getMode())
.getResults();
ValueRange hiRes =
- rewriter
- .create<gpu::ShuffleOp>(op.getLoc(), hi, op.getOffset(),
+ gpu::ShuffleOp::create(rewriter, op.getLoc(), hi, op.getOffset(),
op.getWidth(), op.getMode())
.getResults();
diff --git a/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp b/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp
index b9e2dd5b19a6f..37fd0bf32191d 100644
--- a/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp
@@ -197,8 +197,7 @@ Value createSubgroupShuffleReduction(OpBuilder &builder, Location loc,
// Parallel reduction using butterfly shuffles.
for (unsigned i = ci.clusterStride; i < ci.clusterStride * ci.clusterSize;
i <<= 1) {
- Value shuffled = builder
- .create<gpu::ShuffleOp>(loc, packFn(laneVal), i,
+ Value shuffled = gpu::ShuffleOp::create(builder, loc, packFn(laneVal), i,
/*width=*/ci.subgroupSize,
/*mode=*/gpu::ShuffleMode::XOR)
.getShuffleResult();
diff --git a/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp b/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
index 66c1aa6bf3fe1..d5e2b97e501e6 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
@@ -56,9 +56,8 @@ FailureOr<Value> memref::buildIndependentOp(OpBuilder &b,
// Create a memref::SubViewOp.
SmallVector<OpFoldResult> offsets(newSizes.size(), b.getIndexAttr(0));
SmallVector<OpFoldResult> strides(newSizes.size(), b.getIndexAttr(1));
- return b
- .create<SubViewOp>(loc, newAllocaOp, offsets, allocaOp.getMixedSizes(),
- strides)
+ return SubViewOp::create(b, loc, newAllocaOp, offsets,
+ allocaOp.getMixedSizes(), strides)
.getResult();
}
diff --git a/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp b/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
index 1f03e9ae8d6a1..d3a77c026379e 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
@@ -185,9 +185,8 @@ struct CopyOpInterface
int64_t dim) -> Value {
return type.isDynamicDim(dim)
? DimOp::create(builder, loc, memRef, dim).getResult()
- : builder
- .create<arith::ConstantIndexOp>(loc,
- type.getDimSize(dim))
+ : arith::ConstantIndexOp::create(builder, loc,
+ type.getDimSize(dim))
.getResult();
};
Value sourceDim = getDimSize(copyOp.getSource(), rankedSourceType, i);
diff --git a/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp b/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp
index 58cd160948f7f..9e37bc5163f71 100644
--- a/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp
+++ b/mlir/lib/Dialect/Quant/Transforms/LowerQuantOps.cpp
@@ -148,16 +148,14 @@ flattenUnrankedTensorAroundAxis(OpBuilder &builder, Location loc, Value input,
auto axisValue = arith::ConstantIndexOp::create(builder, loc, axis);
auto axisNextValue = arith::ConstantIndexOp::create(builder, loc, axis + 1);
auto shapeLeft =
- builder
- .create<shape::SplitAtOp>(loc, TypeRange{shapeType, shapeType},
- inputShape, axisValue)
+ shape::SplitAtOp::create(builder, loc, TypeRange{shapeType, shapeType},
+ inputShape, axisValue)
.getResult(0);
auto sizeLeft =
shape::NumElementsOp::create(builder, loc, indexType, shapeLeft);
auto shapeRight =
- builder
- .create<shape::SplitAtOp>(loc, TypeRange{shapeType, shapeType},
- inputShape, axisNextValue)
+ shape::SplitAtOp::create(builder, loc, TypeRange{shapeType, shapeType},
+ inputShape, axisNextValue)
.getResult(1);
auto sizeRight =
shape::NumElementsOp::create(builder, loc, indexType, shapeRight);
@@ -557,25 +555,24 @@ Value convertPerChannelRanked(OpBuilder &builder, Location loc, Operation *op,
SmallVector<AffineMap> indexingMaps{
builder.getMultiDimIdentityMap(inputRank), channelAxisAffineMap,
channelAxisAffineMap, builder.getMultiDimIdentityMap(inputRank)};
- auto result = builder
- .create<linalg::GenericOp>(
- loc,
- init.getType(), // resultType
- ValueRange{input, scales, zeroPoints}, // inputs
- ValueRange{init}, // outputs
- indexingMaps, iteratorTypes,
- [&](OpBuilder &builder, Location loc, ValueRange args) {
- assert(args.size() == 4);
- auto input = args[0];
- auto scale = args[1];
- auto zeroPoint = args[2];
-
- auto result =
- convertRanked(builder, loc, op, input, {}, scale,
- zeroPoint, quantizedType);
-
- linalg::YieldOp::create(builder, loc, result);
- })
+ auto result = linalg::GenericOp::create(
+ builder, loc,
+ init.getType(), // resultType
+ ValueRange{input, scales, zeroPoints}, // inputs
+ ValueRange{init}, // outputs
+ indexingMaps, iteratorTypes,
+ [&](OpBuilder &builder, Location loc, ValueRange args) {
+ assert(args.size() == 4);
+ auto input = args[0];
+ auto scale = args[1];
+ auto zeroPoint = args[2];
+
+ auto result =
+ convertRanked(builder, loc, op, input, {}, scale,
+ zeroPoint, quantizedType);
+
+ linalg::YieldOp::create(builder, loc, result);
+ })
.getResult(0);
return result;
@@ -660,25 +657,24 @@ Value convertSubChannel(OpBuilder &builder, Location loc, Operation *op,
SmallVector<AffineMap> indexingMaps{
builder.getMultiDimIdentityMap(inputRank), affineMap, affineMap,
builder.getMultiDimIdentityMap(inputRank)};
- auto result = builder
- .create<linalg::GenericOp>(
- loc,
- init.getType(), // resultType
- ValueRange{input, scales, zeroPoints}, // inputs
- ValueRange{init}, // outputs
- indexingMaps, iteratorTypes,
- [&](OpBuilder &builder, Location loc, ValueRange args) {
- assert(args.size() == 4);
- auto input = args[0];
- auto scale = args[1];
- auto zeroPoint = args[2];
-
- auto result =
- convertRanked(builder, loc, op, input, {}, scale,
- zeroPoint, quantizedType);
-
- linalg::YieldOp::create(builder, loc, result);
- })
+ auto result = linalg::GenericOp::create(
+ builder, loc,
+ init.getType(), // resultType
+ ValueRange{input, scales, zeroPoints}, // inputs
+ ValueRange{init}, // outputs
+ indexingMaps, iteratorTypes,
+ [&](OpBuilder &builder, Location loc, ValueRange args) {
+ assert(args.size() == 4);
+ auto input = args[0];
+ auto scale = args[1];
+ auto zeroPoint = args[2];
+
+ auto result =
+ convertRanked(builder, loc, op, input, {}, scale,
+ zeroPoint, quantizedType);
+
+ linalg::YieldOp::create(builder, loc, result);
+ })
.getResult(0);
return result;
diff --git a/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
index 64c4d607e3fb9..f8799c52e8797 100644
--- a/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
@@ -497,10 +497,10 @@ getBbArgReplacements(RewriterBase &rewriter, Block::BlockArgListType bbArgs,
size_t idx = it.index();
Value val = it.value();
if (tensorIndices.contains(idx)) {
- result.push_back(rewriter
- .create<bufferization::ToTensorOp>(
- val.getLoc(), oldBbArgs[idx].getType(), val)
- .getResult());
+ result.push_back(
+ bufferization::ToTensorOp::create(rewriter, val.getLoc(),
+ oldBbArgs[idx].getType(), val)
+ .getResult());
} else {
result.push_back(val);
}
diff --git a/mlir/lib/Dialect/SCF/Utils/Utils.cpp b/mlir/lib/Dialect/SCF/Utils/Utils.cpp
index 5b0c60415a6c4..57317951d609c 100644
--- a/mlir/lib/Dialect/SCF/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/SCF/Utils/Utils.cpp
@@ -827,9 +827,8 @@ static Value getProductOfIntsOrIndexes(RewriterBase &rewriter, Location loc,
productOf = v;
}
if (!productOf) {
- productOf = rewriter
- .create<arith::ConstantOp>(
- loc, rewriter.getOneAttr(getType(values.front())))
+ productOf = arith::ConstantOp::create(
+ rewriter, loc, rewriter.getOneAttr(getType(values.front())))
.getResult();
}
return productOf.value();
diff --git a/mlir/lib/Dialect/Shape/IR/Shape.cpp b/mlir/lib/Dialect/Shape/IR/Shape.cpp
index e24f0f87e781d..50985c1c131f5 100644
--- a/mlir/lib/Dialect/Shape/IR/Shape.cpp
+++ b/mlir/lib/Dialect/Shape/IR/Shape.cpp
@@ -1702,8 +1702,7 @@ struct ShapeOfOpToConstShapeOp : public OpRewritePattern<shape::ShapeOfOp> {
return failure();
Location loc = op.getLoc();
Value constShape =
- rewriter
- .create<ConstShapeOp>(loc,
+ ConstShapeOp::create(rewriter, loc,
rewriter.getIndexTensorAttr(type.getShape()))
.getResult();
if (constShape.getType() != op.getResult().getType())
diff --git a/mlir/lib/Dialect/Shard/Transforms/Partition.cpp b/mlir/lib/Dialect/Shard/Transforms/Partition.cpp
index 5fe55669c90db..3e3d4768853e5 100644
--- a/mlir/lib/Dialect/Shard/Transforms/Partition.cpp
+++ b/mlir/lib/Dialect/Shard/Transforms/Partition.cpp
@@ -70,10 +70,8 @@ splitLastAxisInResharding(ImplicitLocOpBuilder &builder,
TypedValue<ShapedType> sourceShard, GridOp grid,
int64_t splitTensorAxis, GridAxis splitGridAxis) {
TypedValue<ShapedType> targetShard = cast<TypedValue<ShapedType>>(
- builder
- .create<AllSliceOp>(sourceShard, grid,
- ArrayRef<GridAxis>(splitGridAxis),
- splitTensorAxis)
+ AllSliceOp::create(builder, sourceShard, grid,
+ ArrayRef<GridAxis>(splitGridAxis), splitTensorAxis)
.getResult());
Sharding targetSharding = targetShardingInSplitLastAxis(
builder.getContext(), sourceSharding, splitTensorAxis, splitGridAxis);
@@ -420,16 +418,15 @@ tryUpdateHaloInResharding(ImplicitLocOpBuilder &builder, GridOp grid,
// Finally update the halo.
auto updateHaloResult =
- builder
- .create<UpdateHaloOp>(
- sourceShard.getLoc(),
- RankedTensorType::get(outShape,
- sourceShard.getType().getElementType()),
- initOprnd, grid.getSymName(),
- GridAxesArrayAttr::get(builder.getContext(),
- sourceSharding.getSplitAxes()),
- targetSharding.getDynamicHaloSizes(),
- targetSharding.getStaticHaloSizes())
+ UpdateHaloOp::create(
+ builder, sourceShard.getLoc(),
+ RankedTensorType::get(outShape,
+ sourceShard.getType().getElementType()),
+ initOprnd, grid.getSymName(),
+ GridAxesArrayAttr::get(builder.getContext(),
+ sourceSharding.getSplitAxes()),
+ targetSharding.getDynamicHaloSizes(),
+ targetSharding.getStaticHaloSizes())
.getResult();
return std::make_tuple(cast<TypedValue<ShapedType>>(updateHaloResult),
targetSharding);
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
index a52872dd093d8..3b4140edd1641 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
@@ -931,10 +931,9 @@ createQuickSort(OpBuilder &builder, ModuleOp module, func::FuncOp func,
FlatSymbolRefAttr partitionFunc = getMangledSortHelperFunc(
builder, func, {IndexType::get(context)}, kPartitionFuncNamePrefix, xPerm,
ny, args.drop_back(nTrailingP), createPartitionFunc);
- Value p = builder
- .create<func::CallOp>(loc, partitionFunc,
- TypeRange{IndexType::get(context)},
- args.drop_back(nTrailingP))
+ Value p = func::CallOp::create(builder, loc, partitionFunc,
+ TypeRange{IndexType::get(context)},
+ args.drop_back(nTrailingP))
.getResult(0);
Value lenLow = arith::SubIOp::create(builder, loc, p, lo);
@@ -1028,9 +1027,8 @@ static void createSortStableFunc(OpBuilder &builder, ModuleOp module,
FlatSymbolRefAttr searchFunc = getMangledSortHelperFunc(
builder, func, {IndexType::get(context)}, kBinarySearchFuncNamePrefix,
xPerm, ny, operands, createBinarySearchFunc);
- Value p = builder
- .create<func::CallOp>(loc, searchFunc, TypeRange{c1.getType()},
- operands)
+ Value p = func::CallOp::create(builder, loc, searchFunc,
+ TypeRange{c1.getType()}, operands)
.getResult(0);
// Move the value at data[i] to a temporary location.
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
index a317abd6c560b..0bd1d34c3504b 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
@@ -98,10 +98,10 @@ static Value genLaunchGPUFunc(OpBuilder &builder, gpu::GPUFuncOp gpuFunc,
Value...
[truncated]
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
See llvm#147168 for more info.
9492a11
to
b063184
Compare
Taken from git history: 9e7834c Maksim Levental [mlir][NFC] update `mlir/lib` create APIs (35/n) (#150708) 284a5c2 Maksim Levental [mlir][NFC] update `mlir/examples` create APIs (31/n) (#150652) c090ed5 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (33/n) (#150659) fcbcfe4 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (32/n) (#150657) 258daf5 Maksim Levental [mlir][NFC] update `mlir` create APIs (34/n) (#150660) c610b24 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (27/n) (#150638) b58ad36 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (30/n) (#150643) 258d04c Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (28/n) (#150641) a6bf40d Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (29/n) (#150642) dcfc853 Maksim Levental [mlir][NFC] update `flang/lib` create APIs (12/n) (#149914) 3f74334 Maksim Levental [mlir][NFC] update `flang` create APIs (13/n) (#149913) a636b7b Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (18/n) (#149925) 75aa706 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (17/n) (#149924) 2f53125 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (15/n) (#149921) 967626b Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (14/n) (#149920) 588845d Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (20/n) (#149927) b043492 Maksim Levental [mlir][NFC] update `Conversion` create APIs (4/n) (#149879) 8fff238 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (23/n) (#149930) 38976a0 Maksim Levental [mlir][NFC] update `Conversion` create APIs (7/n) (#149889) eaa67a3 Maksim Levental [mlir][NFC] update `Conversion` create APIs (5/n) (#149887) b0312be Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (19/n) (#149926) 2736fbd Maksim Levental [mlir][NFC] update `mlir/lib` create APIs (26/n) (#149933) 4ae9fdc Maksim Levental [mlir][NFC] update `Conversion` create APIs (6/n) (#149888) f904cdd Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (24/n) (#149931) 972ac59 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (21/n) (#149928) 7b78796 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (25/n) (#149932) c3823af Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (22/n) (#149929) dce6679 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (16/n) (#149922) 9844ba6 Maksim Levental [mlir][NFC] update `flang/Optimizer/Builder` create APIs (9/n) (#149917) 5547c6c Maksim Levental [mlir][NFC] update `flang/Optimizer/Builder/Runtime` create APIs (10/n) (#149916) a3a007a Maksim Levental [mlir][NFC] update `flang/Lower` create APIs (8/n) (#149912) 46f6df0 Maksim Levental [mlir][NFC] update `flang/Optimizer/Transforms` create APIs (11/n) (#149915) b7e332d Maksim Levental [mlir][NFC] update `include` create APIs (3/n) (#149687) 6056f94 Maksim Levental [mlir][NFC] update LLVM create APIs (2/n) (#149667) 906295b Maksim Levental [mlir] update affine+arith create APIs (1/n) (#149656)
The update is most likely not what someone wants when looking at the blame for one of these lines. Taken from git history: ``` 9e7834c Maksim Levental [mlir][NFC] update `mlir/lib` create APIs (35/n) (#150708) 284a5c2 Maksim Levental [mlir][NFC] update `mlir/examples` create APIs (31/n) (#150652) c090ed5 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (33/n) (#150659) fcbcfe4 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (32/n) (#150657) 258daf5 Maksim Levental [mlir][NFC] update `mlir` create APIs (34/n) (#150660) c610b24 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (27/n) (#150638) b58ad36 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (30/n) (#150643) 258d04c Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (28/n) (#150641) a6bf40d Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (29/n) (#150642) dcfc853 Maksim Levental [mlir][NFC] update `flang/lib` create APIs (12/n) (#149914) 3f74334 Maksim Levental [mlir][NFC] update `flang` create APIs (13/n) (#149913) a636b7b Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (18/n) (#149925) 75aa706 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (17/n) (#149924) 2f53125 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (15/n) (#149921) 967626b Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (14/n) (#149920) 588845d Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (20/n) (#149927) b043492 Maksim Levental [mlir][NFC] update `Conversion` create APIs (4/n) (#149879) 8fff238 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (23/n) (#149930) 38976a0 Maksim Levental [mlir][NFC] update `Conversion` create APIs (7/n) (#149889) eaa67a3 Maksim Levental [mlir][NFC] update `Conversion` create APIs (5/n) (#149887) b0312be Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (19/n) (#149926) 2736fbd Maksim Levental [mlir][NFC] update `mlir/lib` create APIs (26/n) (#149933) 4ae9fdc Maksim Levental [mlir][NFC] update `Conversion` create APIs (6/n) (#149888) f904cdd Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (24/n) (#149931) 972ac59 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (21/n) (#149928) 7b78796 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (25/n) (#149932) c3823af Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (22/n) (#149929) dce6679 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (16/n) (#149922) 9844ba6 Maksim Levental [mlir][NFC] update `flang/Optimizer/Builder` create APIs (9/n) (#149917) 5547c6c Maksim Levental [mlir][NFC] update `flang/Optimizer/Builder/Runtime` create APIs (10/n) (#149916) a3a007a Maksim Levental [mlir][NFC] update `flang/Lower` create APIs (8/n) (#149912) 46f6df0 Maksim Levental [mlir][NFC] update `flang/Optimizer/Transforms` create APIs (11/n) (#149915) b7e332d Maksim Levental [mlir][NFC] update `include` create APIs (3/n) (#149687) 6056f94 Maksim Levental [mlir][NFC] update LLVM create APIs (2/n) (#149667) 906295b Maksim Levental [mlir] update affine+arith create APIs (1/n) (#149656) ```
See llvm#147168 for more info.
The update is most likely not what someone wants when looking at the blame for one of these lines. Taken from git history: ``` 9e7834c Maksim Levental [mlir][NFC] update `mlir/lib` create APIs (35/n) (llvm#150708) 284a5c2 Maksim Levental [mlir][NFC] update `mlir/examples` create APIs (31/n) (llvm#150652) c090ed5 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (33/n) (llvm#150659) fcbcfe4 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (32/n) (llvm#150657) 258daf5 Maksim Levental [mlir][NFC] update `mlir` create APIs (34/n) (llvm#150660) c610b24 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (27/n) (llvm#150638) b58ad36 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (30/n) (llvm#150643) 258d04c Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (28/n) (llvm#150641) a6bf40d Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (29/n) (llvm#150642) dcfc853 Maksim Levental [mlir][NFC] update `flang/lib` create APIs (12/n) (llvm#149914) 3f74334 Maksim Levental [mlir][NFC] update `flang` create APIs (13/n) (llvm#149913) a636b7b Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (18/n) (llvm#149925) 75aa706 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (17/n) (llvm#149924) 2f53125 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (15/n) (llvm#149921) 967626b Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (14/n) (llvm#149920) 588845d Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (20/n) (llvm#149927) b043492 Maksim Levental [mlir][NFC] update `Conversion` create APIs (4/n) (llvm#149879) 8fff238 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (23/n) (llvm#149930) 38976a0 Maksim Levental [mlir][NFC] update `Conversion` create APIs (7/n) (llvm#149889) eaa67a3 Maksim Levental [mlir][NFC] update `Conversion` create APIs (5/n) (llvm#149887) b0312be Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (19/n) (llvm#149926) 2736fbd Maksim Levental [mlir][NFC] update `mlir/lib` create APIs (26/n) (llvm#149933) 4ae9fdc Maksim Levental [mlir][NFC] update `Conversion` create APIs (6/n) (llvm#149888) f904cdd Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (24/n) (llvm#149931) 972ac59 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (21/n) (llvm#149928) 7b78796 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (25/n) (llvm#149932) c3823af Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (22/n) (llvm#149929) dce6679 Maksim Levental [mlir][NFC] update `mlir/Dialect` create APIs (16/n) (llvm#149922) 9844ba6 Maksim Levental [mlir][NFC] update `flang/Optimizer/Builder` create APIs (9/n) (llvm#149917) 5547c6c Maksim Levental [mlir][NFC] update `flang/Optimizer/Builder/Runtime` create APIs (10/n) (llvm#149916) a3a007a Maksim Levental [mlir][NFC] update `flang/Lower` create APIs (8/n) (llvm#149912) 46f6df0 Maksim Levental [mlir][NFC] update `flang/Optimizer/Transforms` create APIs (11/n) (llvm#149915) b7e332d Maksim Levental [mlir][NFC] update `include` create APIs (3/n) (llvm#149687) 6056f94 Maksim Levental [mlir][NFC] update LLVM create APIs (2/n) (llvm#149667) 906295b Maksim Levental [mlir] update affine+arith create APIs (1/n) (llvm#149656) ```
See #147168 for more info.