This is an archive of the discontinued LLVM Phabricator instance.

[mlir][linalg] Add makeComposedPadHighOp.
ClosedPublic

Authored by gysit on Nov 18 2021, 10:31 AM.

Details

Summary

Add the makeComposedPadHighOp method which creates a new PadTensorOp if necessary. If the source to pad is actually the result of a sequence of padded LinalgOps, the method checks if padding is needed or if we can use the padded result of the padded LinalgOp sequence directly.

Example:

%0 = tensor.extract_slice %arg0 [%iv0, %iv1] [%sz0, %sz1]
%1 = linalg.pad_tensor %0 low[0, 0] high[...] { linalg.yield %cst }
%2 = linalg.matmul ins(...) outs(%1)
%3 = tensor.extract_slice %2 [0, 0] [%sz0, %sz1]

when padding %3 return %2 instead of introducing

%4 = linalg.pad_tensor %3 low[0, 0] high[...] { linalg.yield %cst }

Depends On D114161

Diff Detail

Event Timeline

gysit created this revision.Nov 18 2021, 10:31 AM
gysit requested review of this revision.Nov 18 2021, 10:31 AM
gysit updated this revision to Diff 388422.Nov 19 2021, 1:38 AM

Improve test.

gysit edited the summary of this revision. (Show Details)Nov 19 2021, 1:47 AM
nicolasvasilache accepted this revision.Nov 22 2021, 1:17 AM
nicolasvasilache added inline comments.
mlir/lib/Dialect/Linalg/Utils/Utils.cpp
343

please move the early exit condition for sliceOp at the place of definition.

This revision is now accepted and ready to land.Nov 22 2021, 1:17 AM
pifon2a accepted this revision.Nov 22 2021, 1:33 AM

Nice!

gysit updated this revision to Diff 388836.Nov 22 2021, 2:50 AM

Address comment.

gysit updated this revision to Diff 388944.Nov 22 2021, 9:11 AM

Rebase.

gysit updated this revision to Diff 388948.Nov 22 2021, 9:27 AM

Rebase.

This revision was landed with ongoing or failed builds.Nov 24 2021, 11:19 AM
This revision was automatically updated to reflect the committed changes.