Page MenuHomePhabricator

[mlir][linalg] Add a pattern to split linalg.pad_tensor ops
ClosedPublic

Authored by antiagainst on Jan 11 2022, 5:50 AM.

Details

Summary

This commit adds a pattern to wrap a linalg.pad_tensor op with
an scf.if op to separate the cases where we don't need padding
(all pad sizes are actually zeros) and where we indeed need
padding.

This pattern is meant to handle padding inside tiled loops.
Under such cases the padding sizes typically depend on the
loop induction variables. Splitting them would allow treating
perfect tiles and edge tiles separately.

Depends On D117017

Diff Detail

Event Timeline

antiagainst created this revision.Jan 11 2022, 5:50 AM
antiagainst requested review of this revision.Jan 11 2022, 5:50 AM
nicolasvasilache accepted this revision.Feb 16 2022, 7:40 AM
nicolasvasilache added inline comments.
mlir/include/mlir/Dialect/Tensor/Transforms/Passes.td
19 ↗(On Diff #406201)

This is very limited in terms of control and heuristics.
Should this just be a test pass?

20 ↗(On Diff #406201)

Can we improve the terminology?

mlir/include/mlir/Dialect/Tensor/Transforms/Transforms.h
19

It is now called tensor.pad

mlir/lib/Dialect/Tensor/Transforms/SplitPadding.cpp
78

trivial braces

This revision is now accepted and ready to land.Feb 16 2022, 7:40 AM
antiagainst marked 4 inline comments as done.

Address comments

mlir/include/mlir/Dialect/Tensor/Transforms/Passes.td
19 ↗(On Diff #406201)

Good point. Converted into an uber pass for testing various tensor patterns.

Fix BUILD.bazel

This revision was landed with ongoing or failed builds.Feb 16 2022, 10:44 AM
This revision was automatically updated to reflect the committed changes.