This is an archive of the discontinued LLVM Phabricator instance.

[mlir][tensor][bufferize] Support memory_space for tensor.pad
ClosedPublic

Authored by springerm on Oct 19 2022, 9:03 AM.

Details

Summary

This change adds memory space support to tensor.pad. (tensor.generate and tensor.from_elements do not support memory spaces yet.)

The memory space is inferred from the buffer of the source tensor.

Instead of lowering tensor.pad to tensor.generate + tensor.insert_slice, it is now lowered to bufferization.alloc_tensor (with the correct memory space) + scf.parallel + tensor.insert_slice.

Memory space support for the remaining two tensor ops is left for a later point, as this requires some more design discussions.

Depends On D136767

Diff Detail

Event Timeline

springerm created this revision.Oct 19 2022, 9:03 AM
springerm requested review of this revision.Oct 19 2022, 9:03 AM
KoolJBlack accepted this revision.Oct 24 2022, 3:09 PM

Awesome, thanks for setting this up.

This revision is now accepted and ready to land.Oct 24 2022, 3:09 PM
nicolasvasilache requested changes to this revision.Oct 25 2022, 2:40 AM

This triggers all sorts of red flags for me (lowering to loops directly during bufferization, increasing the number of uses of ToMemref/ToTensor, having to choose a loop type) and I don't see this as a good path forward.

This revision now requires changes to proceed.Oct 25 2022, 2:40 AM
springerm updated this revision to Diff 470810.Oct 26 2022, 7:14 AM

address comments

Awesome, thanks for improving this!

This revision is now accepted and ready to land.Oct 27 2022, 12:42 AM
This revision was landed with ongoing or failed builds.Oct 27 2022, 3:30 AM
This revision was automatically updated to reflect the committed changes.