This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][Tensor] Add ValueBoundsOpInterface for tensor::CollapseShapeOp
AcceptedPublic

Authored by Groverkss on Aug 25 2023, 9:24 PM.

Details

Summary

This patch teaches ValueBoundOpInterface how to handle tensor::CollapseShapeOp.
This cannot reason about two dynamic dimensions being collapsed into
a single dimension, as Presburger lib cannot represent multiplication of
variables.

Diff Detail

Event Timeline

Groverkss created this revision.Aug 25 2023, 9:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2023, 9:24 PM
Groverkss requested review of this revision.Aug 25 2023, 9:24 PM
springerm accepted this revision.Aug 25 2023, 11:57 PM
springerm added inline comments.
mlir/lib/Dialect/Tensor/IR/ValueBoundsOpInterfaceImpl.cpp
129

If I remember correctly, multiplication of two symbols is currently not supported in ValueBoundsOpInterface because there is no flat representation in the FlatAffineValueConstraints, so cstr.bound() may not do anything. The implementation here is good, but maybe we should add a note/TODO as a comment.

mlir/test/Dialect/Tensor/value-bounds-op-interface-impl.mlir
242

You could add this:

// TODO: Bounds that are a multiplication of two symbols are not supported.
// expected-error @below{{could not reify bound}}
%0 = "test.reify_bound"(%out) {dim = 0} : (tensor<?x?xf32>) -> (index)
This revision is now accepted and ready to land.Aug 25 2023, 11:57 PM