This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Linalg] Enable fusion of std.constant (producer) with linalg.indexed_generic (consumer) with tensor arguments.
ClosedPublic

Authored by mravishankar on Jul 24 2020, 4:29 PM.

Details

Summary

The implementation of fusing std.constant producer with a
linalg.indexed_generic consumer was already in place. It is exposed
with this change. Also cleaning up some of the patterns that implement
the fusion to not be templated, thereby avoiding lot of conditional
checks for calling the right instantiation.

Diff Detail

Event Timeline

mravishankar created this revision.Jul 24 2020, 4:29 PM
rriddle added inline comments.Jul 24 2020, 4:32 PM
mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
750

nit: Drop trivial braces here.

757

nit: Use llvm_unreachable instead of assert.

781

Does fusedOperands(getOperands())not work here? (same below)

mravishankar marked 3 inline comments as done.

Addressing comments

mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
781

No it doesnt. SmalLVector doesnt have a constructor that accepts a range.

rriddle added inline comments.Jul 26 2020, 3:00 PM
mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
781

OperandRange implicitly converts to SmallVector though, so I would have expected it to just work.

e.g. https://github.com/llvm/llvm-project/blob/3382b7177f0410144d70154aee9b2031221ba838/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp#L408

hanchung accepted this revision.Jul 27 2020, 12:32 AM

Thanks Mahesh! Just few nits.

mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
769

prefer having a argument comment for magic true/false value here.

Replace "true" with "/*asProducer=*/true".

831–834

ditto

This revision is now accepted and ready to land.Jul 27 2020, 12:32 AM
mravishankar marked 3 inline comments as done.

Addressing comments

This revision was automatically updated to reflect the committed changes.