This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse][NFC] Switch InitOp to bufferization::AllocTensorOp
ClosedPublic

Authored by springerm on May 22 2022, 5:14 PM.

Details

Summary

Now that we have an AllocTensorOp (previously InitTensorOp) in the bufferization dialect, the InitOp in the sparse dialect is no longer needed.

Depends On D126179

Diff Detail

Event Timeline

springerm created this revision.May 22 2022, 5:14 PM
springerm requested review of this revision.May 22 2022, 5:14 PM

I really like the direction this is going in, so we have one centralized mechanism to reason on allocation (and deallocation) of the buffers for tensors!
In the long run, it would be nice to have bufferization.de_alloc_tensor() as well, and have one mechanism that inserts those, independent of dense/sparse tensors.

mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td
57–60

can we move some of this explanation and the example into the doc of bufferization.alloc_tensor?

springerm marked an inline comment as done.May 31 2022, 9:36 AM
aartbik accepted this revision.Jun 1 2022, 11:29 AM

I really like the unification, since the original separation felt artificial!

Once this goes in, you will probably give a heads up to some of the other projects that depend on this, but outside this source tree.

mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td
37

This comment ("helper") feels a bit too strong. Right now, it is the only way to materialize a tensor into a computation. Can we just say something like, the reason for this op is ....., (something like that)

This revision is now accepted and ready to land.Jun 1 2022, 11:29 AM