Page MenuHomePhabricator

[mlir][linalg] update tiling to support linalg index operations.
ClosedPublic

Authored by gysit on Apr 13 2021, 5:25 AM.

Details

Summary

The patch updates the tiling pass to add the tile offsets to the indices returned by the linalg operations.

Diff Detail

Event Timeline

gysit created this revision.Apr 13 2021, 5:25 AM
gysit requested review of this revision.Apr 13 2021, 5:25 AM

Note that the tile-indexed.mlir test is the counterpart to the tile-indexed-generic.mlir test.

nicolasvasilache accepted this revision.Apr 13 2021, 6:01 AM

thanks!

Accepting conditioned on using affine.apply

mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
244

We have been using affine.apply ops for such purposes as they compose and canonicalize more nicely with other parts of the IR.
You can use dim for both (i.e. d0 + d1).

Bonus points to write it in an idiomatic fashion, something like:

AffineExpr i, j;
bindDims(context, i, j);
b.create<affine::ApplyOp>(indexOp.getLoc(), ArrayRef<AffineExpr>{i + j}, ValueRange{indexOp.getResult(), ivs[rangeIndex->second]});
This revision is now accepted and ready to land.Apr 13 2021, 6:01 AM
gysit updated this revision to Diff 337138.Apr 13 2021, 7:01 AM

Use affine apply to perform index computations.

gysit marked an inline comment as done.Apr 13 2021, 7:02 AM
This revision was landed with ongoing or failed builds.Apr 13 2021, 7:37 AM
This revision was automatically updated to reflect the committed changes.