This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Linalg] Add comprehensive bufferization support for TiledLoopOp (14/n)
ClosedPublic

Authored by nicolasvasilache on Jul 2 2021, 1:11 AM.

Diff Detail

Event Timeline

nicolasvasilache requested review of this revision.Jul 2 2021, 1:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 2 2021, 1:11 AM
ftynse requested changes to this revision.Jul 2 2021, 2:16 AM

I have a suspicion that operand insertion may write out of bounds. Please add a test for a tiled loop that has a mix of tensors and non-tensors as inputs.

Tests for user-visible error messages are also welcome, as usual.

mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp
1784–1787

Nit: expand auto here.

1785

The indexing here looks suspicious in case of non-tensor operands. Such operands will be skipped at entry of the loop, but index is still contiguous. So it will not insert the new input operand after the last inserted input operand, but later, potentially out of bounds.

1788

Same indexing question as above.

1793

Shouldn't this also remove the original tensor inputs from the loop? Or a canonicalization is expected to handle that later? If the latter, it is worth mentioning in the comment.

This revision now requires changes to proceed.Jul 2 2021, 2:16 AM

Address comments.

nicolasvasilache marked 4 inline comments as done.Jul 2 2021, 5:19 AM
nicolasvasilache added inline comments.
mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp
1785

Good point, I rewrote the logic here (@pifon2a FYI) to spell it more verbosely and minimize surprise.

This would benefit from a bunch of helpers to hide impl. details.

1793

added close to the yields.

nicolasvasilache marked 2 inline comments as done.

Better usage of assertions and new negative tests for legitimate errors.

gysit accepted this revision.Jul 2 2021, 7:17 AM
This revision was not accepted when it landed; it landed in state Needs Review.Jul 2 2021, 7:21 AM
This revision was automatically updated to reflect the committed changes.