-
Notifications
You must be signed in to change notification settings - Fork 712
[ET-VK][ez] Ensure that attn_weight buffers do not exceed GPU buffer numel limit #15651
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/SS-JIA/357/base
Are you sure you want to change the base?
Conversation
…numel limit
Title says it all!
To give a concrete example, Llama3.2-1B-Instruct will have attn weights with size `{1, 32, max_seq_len, max_context_len}`. Usually `max_seq_len == max_context_len`, and if `max_context_len = 2048` Then the attention weight tensors will have sizes `{1, 32, 2048, 2048}` which will contain 134217728 elements. The `maxStorageBufferRange` for Adreno 750 is also 134217728 (2^27), so using context length of 2048 will produce incorrect results on Adreno 750.
In practice, it is unlikely that the prompt sequence length will be equal to the context length, so the solution is to adjust down the `max_seq_len` dim of the attention weight tensors to ensure that the GPU buffer numel limit is not hit.
Differential Revision: [D86443407](https://our.internmc.facebook.com/intern/diff/D86443407/)
[ghstack-poisoned]
This PR needs a
|
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/15651
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (5 Unrelated Failures)As of commit 5250269 with merge base d361573 ( FLAKY - The following job failed but was likely due to flakiness present on trunk:
BROKEN TRUNK - The following jobs failed but was present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
…GPU buffer numel limit"
Title says it all!
To give a concrete example, Llama3.2-1B-Instruct will have attn weights with size `{1, 32, max_seq_len, max_context_len}`. Usually `max_seq_len == max_context_len`, and if `max_context_len = 2048` Then the attention weight tensors will have sizes `{1, 32, 2048, 2048}` which will contain 134217728 elements. The `maxStorageBufferRange` for Adreno 750 is also 134217728 (2^27), so using context length of 2048 will produce incorrect results on Adreno 750.
In practice, it is unlikely that the prompt sequence length will be equal to the context length, so the solution is to adjust down the `max_seq_len` dim of the attention weight tensors to ensure that the GPU buffer numel limit is not hit.
Differential Revision: [D86443407](https://our.internmc.facebook.com/intern/diff/D86443407/)
[ghstack-poisoned]
Stack from ghstack (oldest at bottom):
Title says it all!
To give a concrete example, Llama3.2-1B-Instruct will have attn weights with size
{1, 32, max_seq_len, max_context_len}. Usuallymax_seq_len == max_context_len, and ifmax_context_len = 2048Then the attention weight tensors will have sizes{1, 32, 2048, 2048}which will contain 134217728 elements. ThemaxStorageBufferRangefor Adreno 750 is also 134217728 (2^27), so using context length of 2048 will produce incorrect results on Adreno 750.In practice, it is unlikely that the prompt sequence length will be equal to the context length, so the solution is to adjust down the
max_seq_lendim of the attention weight tensors to ensure that the GPU buffer numel limit is not hit.Differential Revision: D86443407