Skip to content

Remove over-strict softmax mask divisibility assert#19903

Open
ethansfng wants to merge 1 commit into
pytorch:mainfrom
ethansfng:export-D106957459
Open

Remove over-strict softmax mask divisibility assert#19903
ethansfng wants to merge 1 commit into
pytorch:mainfrom
ethansfng:export-D106957459

Conversation

@ethansfng
Copy link
Copy Markdown
Contributor

Summary: SoftmaxPattern.fuse() asserts mask_shape[-1] % 16 == 0. The softmax mask passed to the fused op is a dummy (mask_type=0, no masking is applied), so its trailing dimension does not affect numerics, and the historical QuantFusion simply floor-divided without asserting. The assert rejects otherwise-valid shapes (e.g. softmax over a last dim of 17 or 33) and fails test_quantized_softmax_out_* (T273477740). Remove the assert and floor-divide the mask shape like before, in both the fbcode/ and xplat/ cells.

Differential Revision: D106957459

Summary: `SoftmaxPattern.fuse()` asserts `mask_shape[-1] % 16 == 0`. The softmax mask passed to the fused op is a dummy (`mask_type=0`, no masking is applied), so its trailing dimension does not affect numerics, and the historical `QuantFusion` simply floor-divided without asserting. The assert rejects otherwise-valid shapes (e.g. softmax over a last dim of 17 or 33) and fails `test_quantized_softmax_out_*` (T273477740). Remove the assert and floor-divide the mask shape like before, in both the `fbcode/` and `xplat/` cells.

Differential Revision: D106957459
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented May 30, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19903

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 5a3b3cd with merge base ec31735 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 30, 2026
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented May 30, 2026

@ethansfng has exported this pull request. If you are a Meta employee, you can view the originating Diff in D106957459.

@github-actions
Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants