This is an archive of the discontinued LLVM Phabricator instance.

[mlir][memref] Fix crash in SubViewReturnTypeCanonicalizer
ClosedPublic

Authored by springerm on Aug 24 2023, 3:21 AM.

Details

Summary

SubViewReturnTypeCanonicalizer is used by OpWithOffsetSizesAndStridesConstantArgumentFolder, which folds constant SSA value (dynamic) sizes into static sizes. The previous implementation crashed when a dynamic size was folded into a static 1 dimension, which was then mistaken as a rank reduction.

Diff Detail

Event Timeline

springerm created this revision.Aug 24 2023, 3:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2023, 3:21 AM
springerm requested review of this revision.Aug 24 2023, 3:21 AM

Fixes https://github.com/llvm/llvm-project/issues/60091 ? (if so can you put it in the description)

mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
3106

Can droppedDims be empty here? And if so should we bail out early?

springerm updated this revision to Diff 553407.Aug 25 2023, 1:25 AM

address comments

#60091 is still broken with this change. That is because SubViewOp::getDroppedDims (which is also called in this revision) is still broken and returns a wrong result in some cases (not in the test case from this change).

springerm marked an inline comment as done.Aug 25 2023, 1:26 AM
mehdi_amini accepted this revision.Aug 25 2023, 3:36 AM
This revision is now accepted and ready to land.Aug 25 2023, 3:36 AM