This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Linalg] SplitReduction implementation without tensor::ExpandShapeOp
ClosedPublic

Authored by nicolasvasilache on Jun 21 2022, 5:30 AM.

Details

Summary

This revision proposes a different implementation of the SplitReductoin transformation that does
not rely on tensor::ExpandShapeOp.

Previously, a dimension [k] would be split into [k][kk] via an ExpandShapeOp.
Instead, this revision proposes to rewrite [k] into [factor * k + kk].

There are different tradeoffs involved but the proposed implementation is more general because
the affine rewrite is well-defined. In particular, it works naturally with ? parallel dimensions and
non-trivial indexing maps.

A further rewrite of [factor * k + kk] + ExpandShapeOp is possible as a followup.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald Transcript
nicolasvasilache requested review of this revision.Jun 21 2022, 5:30 AM

Allow both transformations side by side.

Relax one dimension to ? in the test.

springerm accepted this revision.Jun 22 2022, 6:52 AM
springerm added inline comments.
mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td
263

%arg5 is not used in the computation. Is this intentional?

285

Purpose of this arg is not mentioned in the op description

mlir/include/mlir/IR/AffineMap.h
253

nit: Any particular reason why the default insertion point is at the beginning instead of at the end?

This revision is now accepted and ready to land.Jun 22 2022, 6:52 AM
ThomasRaoux accepted this revision.Jun 22 2022, 9:21 AM
nicolasvasilache marked 3 inline comments as done.

Address comments and rebase.

This revision was landed with ongoing or failed builds.Jun 22 2022, 12:08 PM
This revision was automatically updated to reflect the committed changes.