This is an archive of the discontinued LLVM Phabricator instance.

[mlir][affine] Fix crash when composing affine_expr with symbol multiplying dim
AbandonedPublic

Authored by ThomasRaoux on Jan 15 2021, 3:57 PM.

Details

Summary

During composition we currently blindly convert symbols coming from affine_apply to dimensions. This may generate an affineexpr which multiply two dimensions. Currently this result into a crash in simplifyMul(). To fix it we just check and skip this simplifyMul for this case.
Another solution would be to detect this case an no convert symbols to dimension however this would block some transformations that are currently already enabled.

Diff Detail

Event Timeline

ThomasRaoux created this revision.Jan 15 2021, 3:57 PM
ThomasRaoux requested review of this revision.Jan 15 2021, 3:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 15 2021, 3:57 PM

I had another patch that would skip converting symbols to dimension when it is multiplied/divided by another dimension however this prevented the transformation in the original version of symbolic_semi_affine. Please let me know if you think there is a better solution as I'm not super familiar with affine expressions.

nicolasvasilache requested changes to this revision.Jan 18 2021, 3:40 AM

This is an unreasonable relaxation IMO.
I'm looking into rewriting the part that requires AffineNormalizer, stay tuned.

This revision now requires changes to proceed.Jan 18 2021, 3:40 AM

This is an unreasonable relaxation IMO.
I'm looking into rewriting the part that requires AffineNormalizer, stay tuned.

Makes sense to me. Thanks for looking into it!

ThomasRaoux abandoned this revision.Jan 18 2021, 9:10 PM