This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse][bufferization] refine bufferization assumption enforcement
ClosedPublic

Authored by aartbik on Jun 27 2022, 5:05 PM.

Details

Summary

Enforce the assumption made on tensor buffers explicitly. When in-place,
reuse the buffer, but fill with all zeroes for the non-update case, since
the kernel assumes all elements are written to. When not in-place, zero
out the new buffer when materializing or when no-updates occur. Copy the
original tensor value when updates occur. This prepares migrating to the
new bufferization strategy, where these assumptions must be made explicit.

Diff Detail

Event Timeline

aartbik created this revision.Jun 27 2022, 5:05 PM
aartbik requested review of this revision.Jun 27 2022, 5:05 PM
springerm accepted this revision.Jun 27 2022, 11:55 PM
springerm added inline comments.
mlir/test/Dialect/SparseTensor/dense.mlir
44–46

Looks like many test case are a bit more efficient now: A fill instead of a copy.

This revision is now accepted and ready to land.Jun 27 2022, 11:55 PM
aartbik marked an inline comment as done.Jun 28 2022, 9:35 AM
aartbik added inline comments.
mlir/test/Dialect/SparseTensor/dense.mlir
44–46

Yeah, I made two improvements:
(1) when in place, but not updated, add a fill
(2) otherwise use a copy for updates, a fill otherwise

most tests turned out to be (2) only, and that is a good change.
But I also added more cases for (1).

This revision was automatically updated to reflect the committed changes.
aartbik marked an inline comment as done.