Skip to content

Commit e4f6349

Browse files
Make shared outs of scf.forall have read semantics.
Signed-off-by: MaheshRavishankar <[email protected]>
1 parent e167d94 commit e4f6349

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,17 +1207,11 @@ struct ForallOpInterface
12071207
ForallOp> {
12081208
bool bufferizesToMemoryRead(Operation *op, OpOperand &opOperand,
12091209
const AnalysisState &state) const {
1210-
auto forallOp = cast<ForallOp>(op);
1211-
1212-
// If the loop has zero iterations, the results of the op are their
1213-
// corresponding shared_outs, meaning that the shared_outs bufferize to a
1214-
// read.
1215-
if (mayHaveZeroIterations(forallOp))
1216-
return true;
1217-
1218-
// scf::ForallOp alone doesn't bufferize to a memory read, one of the
1219-
// uses of its matching bbArg may.
1220-
return state.isValueRead(forallOp.getTiedBlockArgument(&opOperand));
1210+
// All tensor operands to `scf.forall` are `shared_outs` and all
1211+
// shared outs are assumed to be read by the loop. This does not
1212+
// account for the case where the entire value is over-written,
1213+
// but being conservative here.
1214+
return true;
12211215
}
12221216

12231217
bool bufferizesToMemoryWrite(Operation *op, OpOperand &opOperand,

0 commit comments

Comments
 (0)