Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/22958
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit d4699dc with merge base bb2683b ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@ethansfng has exported this pull request. If you are a Meta employee, you can view the originating Diff in D120615213. |
This PR needs a
|
Summary: `test_emg_cascade_detector_fp32` failed four consecutive times because `RemovePermutesAroundElementwiseOps` generated an invalid view for a lower-rank broadcast constant. The affected graph permutes an input shaped `[1, 256, 1, 1]` to channel-last layout, multiplies it by a `[256]` vector, and then permutes the result back. While removing the surrounding permutes, the pass padded the vector shape to `[1, 1, 1, 256]`, applied the output permutation, and then blindly discarded the three dimensions originally added for broadcast alignment. Because the permutation moved the non-singleton `256` dimension into that discarded prefix, the pass derived `[1]` and attempted to reshape a 256-element layer-norm weight to it. Export then failed with `RuntimeError: shape [1] is invalid for input of size 256`. This change computes the prospective constant view before rewriting and verifies that every dimension which would be discarded remains a singleton after permutation. If a non-singleton dimension moved into that prefix, the optimization is skipped and the original permutes are preserved. Safe scalar and lower-rank constant rewrites continue to be optimized. A regression test covers the failing vector-broadcast pattern. Differential Revision: D120615213
fd65085 to
6e96da7
Compare
Summary: `test_emg_cascade_detector_fp32` failed four consecutive times because `RemovePermutesAroundElementwiseOps` generated an invalid view for a lower-rank broadcast constant. The affected graph permutes an input shaped `[1, 256, 1, 1]` to channel-last layout, multiplies it by a `[256]` vector, and then permutes the result back. While removing the surrounding permutes, the pass padded the vector shape to `[1, 1, 1, 256]`, applied the output permutation, and then blindly discarded the three dimensions originally added for broadcast alignment. Because the permutation moved the non-singleton `256` dimension into that discarded prefix, the pass derived `[1]` and attempted to reshape a 256-element layer-norm weight to it. Export then failed with `RuntimeError: shape [1] is invalid for input of size 256`. This change computes the prospective constant view before rewriting and verifies that every dimension which would be discarded remains a singleton after permutation. If a non-singleton dimension moved into that prefix, the optimization is skipped and the original permutes are preserved. Safe scalar and lower-rank constant rewrites continue to be optimized. A regression test covers the failing vector-broadcast pattern. Differential Revision: D120615213
6e96da7 to
92827c4
Compare
Summary: Pull Request resolved: pytorch#22958 `test_emg_cascade_detector_fp32` failed four consecutive times because `RemovePermutesAroundElementwiseOps` generated an invalid view for a lower-rank broadcast constant. The affected graph permutes an input shaped `[1, 256, 1, 1]` to channel-last layout, multiplies it by a `[256]` vector, and then permutes the result back. While removing the surrounding permutes, the pass padded the vector shape to `[1, 1, 1, 256]`, applied the output permutation, and then blindly discarded the three dimensions originally added for broadcast alignment. Because the permutation moved the non-singleton `256` dimension into that discarded prefix, the pass derived `[1]` and attempted to reshape a 256-element layer-norm weight to it. Export then failed with `RuntimeError: shape [1] is invalid for input of size 256`. This change computes the prospective constant view before rewriting and verifies that every dimension which would be discarded remains a singleton after permutation. If a non-singleton dimension moved into that prefix, the optimization is skipped and the original permutes are preserved. Safe scalar and lower-rank constant rewrites continue to be optimized. A regression test covers the failing vector-broadcast pattern. Differential Revision: D120615213
92827c4 to
0081db9
Compare
Summary: `test_emg_cascade_detector_fp32` failed four consecutive times because `RemovePermutesAroundElementwiseOps` generated an invalid view for a lower-rank broadcast constant. The affected graph permutes an input shaped `[1, 256, 1, 1]` to channel-last layout, multiplies it by a `[256]` vector, and then permutes the result back. While removing the surrounding permutes, the pass padded the vector shape to `[1, 1, 1, 256]`, applied the output permutation, and then blindly discarded the three dimensions originally added for broadcast alignment. Because the permutation moved the non-singleton `256` dimension into that discarded prefix, the pass derived `[1]` and attempted to reshape a 256-element layer-norm weight to it. Export then failed with `RuntimeError: shape [1] is invalid for input of size 256`. This change computes the prospective constant view before rewriting and verifies that every dimension which would be discarded remains a singleton after permutation. If a non-singleton dimension moved into that prefix, the optimization is skipped and the original permutes are preserved. Safe scalar and lower-rank constant rewrites continue to be optimized. A regression test covers the failing vector-broadcast pattern. Differential Revision: D120615213
0081db9 to
9028f77
Compare
Summary: Pull Request resolved: pytorch#22958 `test_emg_cascade_detector_fp32` failed four consecutive times because `RemovePermutesAroundElementwiseOps` generated an invalid view for a lower-rank broadcast constant. The affected graph permutes an input shaped `[1, 256, 1, 1]` to channel-last layout, multiplies it by a `[256]` vector, and then permutes the result back. While removing the surrounding permutes, the pass padded the vector shape to `[1, 1, 1, 256]`, applied the output permutation, and then blindly discarded the three dimensions originally added for broadcast alignment. Because the permutation moved the non-singleton `256` dimension into that discarded prefix, the pass derived `[1]` and attempted to reshape a 256-element layer-norm weight to it. Export then failed with `RuntimeError: shape [1] is invalid for input of size 256`. This change computes the prospective constant view before rewriting and verifies that every dimension which would be discarded remains a singleton after permutation. If a non-singleton dimension moved into that prefix, the optimization is skipped and the original permutes are preserved. Safe scalar and lower-rank constant rewrites continue to be optimized. A regression test covers the failing vector-broadcast pattern. Differential Revision: D120615213
9028f77 to
d4699dc
Compare
Summary:
The affected graph permutes an input shaped
[1, 256, 1, 1]to channel-last layout, multiplies it by a[256]vector, and then permutes the result back. While removing the surrounding permutes, the pass padded the vector shape to[1, 1, 1, 256], applied the output permutation, and then blindly discarded the three dimensions originally added for broadcast alignment. Because the permutation moved the non-singleton256dimension into that discarded prefix, the pass derived[1]and attempted to reshape a 256-element layer-norm weight to it. Export then failed withRuntimeError: shape [1] is invalid for input of size 256.This change computes the prospective constant view before rewriting and verifies that every dimension which would be discarded remains a singleton after permutation. If a non-singleton dimension moved into that prefix, the optimization is skipped and the original permutes are preserved. Safe scalar and lower-rank constant rewrites continue to be optimized. A regression test covers the failing vector-broadcast pattern.
Differential Revision: D120615213