mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-27 15:14:31 +00:00
[mlir][linalg] Cleanup LinalgOp usage in test passes.
Replace the uses of deprecated Structured Op Interface methods in TestLinalgElementwiseFusion.cpp, TestLinalgFusionTransforms.cpp, and Transforms.cpp. The patch is based on https://reviews.llvm.org/D103394. Differential Revision: https://reviews.llvm.org/D103528
This commit is contained in:
1 parent
929c54379a
commit
9f815cb578
3 files changed
+16
-16
No files matched your search
@@ -167,9 +167,9 @@ static LogicalResult rewriteAsPaddedOp(PatternRewriter &rewriter,
|
||||
|
||||
// If the op is fully static, it does not need padding.
|
||||
// TODO: there are cases where we may still want to pad to larger sizes.
|
||||
if (llvm::all_of(opToPad.getShapedOperands(), [](Value v) {
|
||||
return v.getType().cast<RankedTensorType>().hasStaticShape();
|
||||
}))
|
||||
assert(opToPad.hasTensorSemantics() &&
|
||||
"expected operation to have tensor semantics");
|
||||
if (!opToPad.hasDynamicShape())
|
||||
return success();
|
||||
|
||||
OpBuilder::InsertionGuard g(rewriter);
|
||||
@@ -177,16 +177,16 @@ static LogicalResult rewriteAsPaddedOp(PatternRewriter &rewriter,
|
||||
rewriter.setInsertionPointAfter(opToPad);
|
||||
// Make a copy of the shaped operands and update it.
|
||||
SmallVector<Value> newOperands;
|
||||
newOperands.reserve(opToPad.getNumShapedOperands());
|
||||
for (OpOperand &operand : opToPad.getShapedOpOperands()) {
|
||||
newOperands.reserve(opToPad.getNumInputsAndOutputs());
|
||||
for (OpOperand *opOperand : opToPad.getInputAndOutputOperands()) {
|
||||
Value paddedOperand;
|
||||
// If padding was requested but the shape cannot be bounded statically then
|
||||
// the pattern fails to apply.
|
||||
if (failed(padOperandToSmallestStaticBoundingBox(rewriter, opToPad, operand,
|
||||
options, paddedOperand))) {
|
||||
if (failed(padOperandToSmallestStaticBoundingBox(
|
||||
rewriter, opToPad, *opOperand, options, paddedOperand))) {
|
||||
return failure();
|
||||
}
|
||||
newOperands.push_back(paddedOperand ? paddedOperand : operand.get());
|
||||
newOperands.push_back(paddedOperand ? paddedOperand : opOperand->get());
|
||||
}
|
||||
|
||||
// Clone `opToPad` to operate on the statically padded shapes.
|
||||
|
||||
Reference in new issue
Block a user