-
Notifications
You must be signed in to change notification settings - Fork 24.2k
[SDPA] Add testing to ensure stride order exactly matches #152894
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
base: gh/drisspg/149/base
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/152894
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Update mem eff striding |
test/test_transformers.py
Outdated
@@ -2469,6 +2469,73 @@ def test_cudnn_attention_different_dk_dv(self, device): | |||
|
|||
self.assertEqual(actual.contiguous(), math_ref.contiguous().to(dtype), atol=1e-3, rtol=1e-2) | |||
|
|||
@unittest.skipIf(not PLATFORM_SUPPORTS_FUSED_ATTENTION, "Fused SDPA was not built for this system") | |||
@parametrize("backend", PLATFORM_SPECIFIC_SDPA, name_fn=lambda x: x.name) | |||
@parametrize("compile_mode", ["eager", "inductor"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So locally all test pass but that doesn't seem possible, since i didnt even update the meta for mem eff yet
i wonder if there are too many recompiles and then just falls back to eager..
test/test_transformers.py
Outdated
if compile_mode == "inductor": | ||
run_sdpa = torch.compile(run_sdpa, backend="inductor", fullgraph=True) | ||
|
||
with sdpa_kernel(backends=[backend]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if compile_mode == "eager", can you enable CrossRefFakeMode
?
grad_q = at::empty(query.sizes(), query.options()); | ||
grad_k = at::empty(key.sizes(), key.options()); | ||
grad_v = at::empty(value.sizes(), value.options()); | ||
grad_q = at::empty_like(query); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure flash attention used to have the same bug, I guess it was copied and pasted from here and never fixed here.
Stack from ghstack (oldest at bottom):
Currently results
TODO update meta before land for mem eff
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @chenyang78 @kadeng @muchulee8 @amjames @chauhang @aakhundov