-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix potential out-of-bound access #1751
base: main
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/1751
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 1 PendingAs of commit 46fc72b with merge base 1c76736 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
cc @Jokeren |
@mark14wu A clearer fix can be done using |
Thank you for the interest! Didn't know there are people looking at this code 😄. I copied this code from PyTorch Inductor though. Does that mean Inductor is susceptible to this bug too? (or inductor allocates padded tensors so it's not an issue?) Like @Jokeren said, Another question. It seems like we might do out-of-bound reads for M and N dims too? |
Yes indeed, but our tool, a triton sanitizer, cannot work for pytorch inductor at this moment. Hao may want to explore this direction when he starts intern at meta this summer.
M and N dims are safe because we have protections with @mark14wu please go ahead refactor the code with triton.heuristic |
There are ways to turn inductor code into triton only repos |
This PR fixes a bug in
_scaled_int8_mm_kernel
allowing unmaskedtl.load()
calls whenK
was even, but not necessarily a multiple ofBLOCK_K
, causing out-of-bounds reads. The fix changes the check toK % BLOCK_K == 0
, ensuring unmasked loads occur only when the last block is fully valid.