-
Notifications
You must be signed in to change notification settings - Fork 24.2k
[pytorch][triton] Enabling TMA for flex-attention for supported device types #153662
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: main
Are you sure you want to change the base?
Conversation
…e types Summary: Currently flex-attention defaults to `USE_TMA=False`. We can enable TMA on devices which support it based on `has_triton_tma_device`. Test Plan: # Tritonbench results ``` buck2 run mode/opt //pytorch/tritonbench:run -- --op flex_attention --use-tma --mod-type all . . . (B, Hq, M, Hkv, N, D) | Mask Type compiled-latency compiled-tflops - USE_TMA = False (8, 16, 128, 16, 128, 128) | noop 0.027936 (±5.61%) 38.5859 (8, 16, 128, 16, 128, 128) | causal 0.017760 (±3.42%) 60.6946 (8, 16, 128, 16, 128, 128) | rel 0.028384 (±5.07%) 37.9769 (8, 16, 128, 16, 128, 128) | head_bias 0.027712 (±4.27%) 38.8978 (8, 16, 128, 16, 128, 128) | alibi 0.017920 (±3.21%) 60.1527 - USE_TMA = True (8, 16, 128, 16, 128, 128) | noop 0.025632 (±5.74%) 42.0543 (8, 16, 128, 16, 128, 128) | causal 0.015328 (±3.97%) 70.3246 (8, 16, 128, 16, 128, 128) | rel 0.025824 (±4.96%) 41.7416 (8, 16, 128, 16, 128, 128) | head_bias 0.025472 (±4.90%) 42.3185 (8, 16, 128, 16, 128, 128) | alibi 0.015392 (±3.74%) 70.0322 ``` Differential Revision: D74841543
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/153662
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 83d37fd with merge base ea17cd0 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This pull request was exported from Phabricator. Differential Revision: D74841543 |
Can you also do a perf bench w/ larger sequen lengths, I am curious Copying over comments: |
https://www.internalfb.com/intern/paste/P1813676625/ Some failing tests |
Summary:
Currently flex-attention defaults to
USE_TMA=False
.We can enable TMA on devices which support it based on
has_triton_tma_device
.Test Plan:
Tritonbench results
Differential Revision: D74841543
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @chenyang78 @kadeng @muchulee8 @amjames @chauhang @aakhundov