This op is needed for unit testing in a subsequent revision. (This is the first op that has a block that yields equivalent values via the op's results.)
Note: Bufferization of scf.execute_region ops with multiple blocks is not yet supported.
Differential D117424
[mlir][linalg][bufferize] Support scf.execute_region bufferization springerm on Jan 16 2022, 4:14 AM. Authored by
Details This op is needed for unit testing in a subsequent revision. (This is the first op that has a block that yields equivalent values via the op's results.) Note: Bufferization of scf.execute_region ops with multiple blocks is not yet supported.
Diff Detail
Event TimelineComment Actions Why are these tests (and the correspoding implementation) being added here instead of in the scf-bufferize pass? Many of the tests already added appear to do just with bufferization of scf.execute_region. You already have this in SCF bufferization pass in lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp. void mlir::scf::populateSCFStructuralTypeConversionsAndLegality( TypeConverter &typeConverter, RewritePatternSet &patterns, ConversionTarget &target) { patterns.add<ConvertForOpTypes, ConvertIfOpTypes, ConvertYieldOpTypes, ConvertWhileOpTypes, ConvertConditionOpTypes>( typeConverter, patterns.getContext()); target.addDynamicallyLegalOp<ForOp, IfOp>([&](Operation *op) { return typeConverter.isLegal(op->getResultTypes()); }); target.addDynamicallyLegalOp<scf::YieldOp>([&](scf::YieldOp op) { // We only have conversions for a subset of ops that use scf.yield // terminators. if (!isa<ForOp, IfOp, WhileOp>(op->getParentOp())) return true; return typeConverter.isLegal(op.getOperandTypes()); }); target.addDynamicallyLegalOp<WhileOp, ConditionOp>( [&](Operation *op) { return typeConverter.isLegal(op); }); }
Comment Actions This is part of of "One-Shot Bufferization", a new bufferization with an analysis to produce fewer buffer copies. I will move it to the bufferization dialect in the next weeks and merge it with the existing passes (such as tensor-bufferize, scf-bufferize, etc.) . For more details see: https://llvm.discourse.group/t/open-mlir-meeting-1-13-2021-one-shot-function-bufferization-of-tensor-programs/5197 |
Likewise.