This is an archive of the discontinued LLVM Phabricator instance.

[mlir][tensor][bufferize] Bufferize tensor.splat op
ClosedPublic

Authored by springerm on May 19 2023, 3:11 AM.

Details

Summary

The op bufferizes similarly to tensor.generate: it is lowered to a linalg.map, which may then lower to a loop nest that fills the buffer.

Diff Detail

Event Timeline

springerm created this revision.May 19 2023, 3:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 19 2023, 3:11 AM
springerm requested review of this revision.May 19 2023, 3:11 AM
ingomueller-net accepted this revision.May 19 2023, 6:05 AM

I wouldn't be able to catch many, even easy flaws, but from what I can judge, all looks good, and I do see the splat op in my own example being bufferized with the patch. Thanks!

This revision is now accepted and ready to land.May 19 2023, 6:05 AM

Actually, do we really need the MapOp with an empty body? Can we not just allocate the tensor and that's it?

Actually, do we really need the MapOp with an empty body? Can we not just allocate the tensor and that's it?

The body of the linalg.map is not empty. It has a linalg.yield terminator. The reason why I used linalg.map is because it can lower to a loop or vectorize. Alternatively, I could've generated a loop nest that fills the allocation, but then the op would not vectorize anymore.

Actually, do we really need the MapOp with an empty body? Can we not just allocate the tensor and that's it?

The body of the linalg.map is not empty. It has a linalg.yield terminator. The reason why I used linalg.map is because it can lower to a loop or vectorize. Alternatively, I could've generated a loop nest that fills the allocation, but then the op would not vectorize anymore.

What's the semantic of yielding nothing?

What's the semantic of yielding nothing?

It does yield something: the operand of the tensor.splat.

This revision was landed with ongoing or failed builds.May 22 2023, 5:32 AM
This revision was automatically updated to reflect the committed changes.

What's the semantic of yielding nothing?

It does yield something: the operand of the tensor.splat.

Thanks for clarifying and insisting ;) Indeed, it does yield something. I don't know how I got to the impression it did not... All good now :)