Skip to content

Commit

Permalink
[mlir][linalg] BufferizeToAllocationOp: fix side effects (#72986)
Browse files Browse the repository at this point in the history
`bufferize_to_allocation` does not bufferize/replace targeted ops if
`bufferize_destination_only` is set.

Fixes #72931.
  • Loading branch information
matthias-springer committed Nov 23, 2023
1 parent 147c5d6 commit 6367677
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,13 @@ DiagnosedSilenceableFailure transform::BufferizeToAllocationOp::apply(

void transform::BufferizeToAllocationOp::getEffects(
SmallVectorImpl<MemoryEffects::EffectInstance> &effects) {
consumesHandle(getTarget(), effects);
if (getBufferizeDestinationOnly()) {
// The destination is replaced with a newly allocated buffer, but the op
// itself remains in place.
onlyReadsHandle(getTarget(), effects);
} else {
consumesHandle(getTarget(), effects);
}
producesHandle(getAllocatedBuffer(), effects);
producesHandle(getNewOps(), effects);
modifiesPayload(effects);
Expand Down

0 comments on commit 6367677

Please sign in to comment.