This is an archive of the discontinued LLVM Phabricator instance.

[mlir][tosa] Fix segmentation fault in case of folding unranked tensor
ClosedPublic

Authored by Lewuathe on Jan 31 2023, 4:56 PM.

Details

Summary

Trying to fold the unranked tensor for "tosa.equal" crashes due to null reference. We need to check the dynamic cast result beforehand. This is reported in https://github.com/llvm/llvm-project/issues/60192.

Diff Detail

Event Timeline

Lewuathe created this revision.Jan 31 2023, 4:56 PM
Lewuathe requested review of this revision.Jan 31 2023, 4:56 PM

@nicolasvasilache @NatashaKnk @rsuderman Sorry for pinging you them all. Could you review this diff if you get a chance?

While waiting for the others to review, you might want to remove the extra include.

mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
796

This looks like a leftover temporary include.

rsuderman added inline comments.Feb 8 2023, 4:56 PM
mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
796

Ditto. Remove the debug code and I'll approve and land.

rsuderman requested changes to this revision.Feb 8 2023, 4:56 PM
This revision now requires changes to proceed.Feb 8 2023, 4:56 PM
Lewuathe added inline comments.Feb 8 2023, 8:31 PM
mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
796

@eric-k256 @rsuderman Sorry for keeping unnecessary code. My bad. I'll remove it.

Lewuathe updated this revision to Diff 496016.Feb 8 2023, 8:52 PM

Delete unused debug code.

Lewuathe marked 2 inline comments as done.Feb 8 2023, 8:52 PM

@rsuderman Sorry for bothering you again. I deleted the debug code accordingly. Could you review this change when you get a chance?

rsuderman accepted this revision.Feb 13 2023, 10:58 AM

Yup, I can try to land this week.

This revision is now accepted and ready to land.Feb 13 2023, 10:58 AM