This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Use getAffineExprFromFlatForm for simplifying flatten cases.
AbandonedPublic

Authored by hanchung on Oct 26 2022, 2:49 PM.

Details

Summary

There is a bug in getSemiAffineExprFromFlatForm. The
getAffineExprFromFlatForm method can handle the case, but the other
fails. Switch to working method to unblock developments of downstream
projects.

Minimized test case:

#map2 = affine_map<()[s0] -> (((s0 floordiv 2) * s0) + (s0 mod 2))>
module {
  func.func @dynamic_unpack_simple_dispatch_0(%arg3: index) {
    %3 = affine.apply #map2()[%arg3] {__d__}
    vector.print %3 : index
    return
  }
}

See https://github.com/llvm/llvm-project/issues/58419 for more details.

Diff Detail

Event Timeline

hanchung created this revision.Oct 26 2022, 2:49 PM
Herald added a project: Restricted Project. · View Herald Transcript
hanchung requested review of this revision.Oct 26 2022, 2:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 26 2022, 2:49 PM

There are three failed tests. I can fix the tests if we can land the change.

Failed Tests (3):
  MLIR :: Dialect/Affine/simplify-structures.mlir
  MLIR :: Dialect/Tensor/fold-consecutive-insert-extract-slice.mlir
  MLIR :: Examples/standalone/test.toy

This patch fixes the repeating index issue.

hanchung abandoned this revision.Oct 31 2022, 11:20 AM