This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Linalg : do not forward memrefs to outputs when do bufferization
ClosedPublic

Authored by ezhulenev on Apr 20 2021, 7:50 PM.

Details

Summary

Example:

%0 = linalg.init_tensor : tensor<...>
%1 = linalg.generic ... outs(%0: tensor<...>)
%2 = linalg.generic ... outs(%0: tensor<...>)

Memref allocated as a result of init_tensor bufferization can be incorrectly overwritten by the second linalg.generic operation

Diff Detail

Event Timeline

ezhulenev created this revision.Apr 20 2021, 7:50 PM
ezhulenev requested review of this revision.Apr 20 2021, 7:50 PM
ezhulenev edited the summary of this revision. (Show Details)Apr 20 2021, 7:52 PM
ezhulenev added a reviewer: silvas.
silvas accepted this revision.Apr 20 2021, 9:52 PM
silvas added inline comments.
mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp
61–62

you might be able to just delete this code block. I think the code below can handle it.

This revision is now accepted and ready to land.Apr 20 2021, 9:52 PM
ezhulenev updated this revision to Diff 339418.Apr 21 2021, 3:53 PM

Do not forward memrefs to outputs when do bufferization

ezhulenev retitled this revision from [mlir] Linalg : clone output buffers allocated by AllocOp to [mlir] Linalg : do not forward memrefs to outputs when do bufferization.Apr 21 2021, 3:54 PM
ezhulenev edited the summary of this revision. (Show Details)