This is an archive of the discontinued LLVM Phabricator instance.

[mlir][OpDSL] Add support for basic rank polymorphism.
ClosedPublic

Authored by gysit on Feb 4 2022, 8:06 AM.

Details

Summary

Previously, OpDSL did not support rank polymorphism, which required a separate implementation of linalg.fill. This revision extends OpDSL to support rank polymorphism for a limited class of operations that access only scalars and tensors of rank zero. At operation instantiation time, it scales these scalar computations to multi-dimensional pointwise computations by replacing the empty indexing maps with identity index maps. The revision does not change the DSL itself, instead it adapts the Python emitter and the YAML generator to generate different indexing maps and and iterators depending on the rank of the first output.

Additionally, the revision introduces a linalg.fill_tensor operation that in a future revision shall replace the current handwritten linalg.fill operation. linalg.fill_tensor is thus only temporarily available and will be renamed to linalg.fill.

Diff Detail

Event Timeline

gysit created this revision.Feb 4 2022, 8:06 AM
gysit requested review of this revision.Feb 4 2022, 8:06 AM
gysit updated this revision to Diff 405975.Feb 4 2022, 8:17 AM

Add missing newline.

gysit updated this revision to Diff 407557.Feb 10 2022, 8:48 AM

Minor formatting fixes.

This revision is now accepted and ready to land.Feb 10 2022, 8:56 AM

+1 LG thanks!

This revision was landed with ongoing or failed builds.Feb 11 2022, 12:28 AM
This revision was automatically updated to reflect the committed changes.