[Relax] Fix divide-by-zero in reshape pattern detection#19958
Conversation
There was a problem hiding this comment.
Code Review
This pull request prevents division-by-zero crashes during reshape pattern analysis by skipping checks on blocks with zero-extent iterators, and adds a unit test to verify this behavior. The reviewer suggested using the analyzer's CanProveEqual method instead of is_zero to robustly handle symbolic zero extents as well as constant ones.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
9f3ab2a to
141d4fb
Compare
141d4fb to
c0fc7be
Compare
cchung100m
left a comment
There was a problem hiding this comment.
LGTM, thanks to @guan404ming
|
Thanks @cchung100m! |
|
cc @tlopex |
Why
Fixes #17745.
has_reshape_patternbuilds an inverse index map that divides by each iter extent, so a zero-extent iter crashed with divide-by-zero.How
test_reshape_pattern_zero_extentintests/python/relax/test_analysis.py.