Skip to content
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

GPU Pallas decode_attention improvements #24602

Merged
merged 1 commit into from
Nov 6, 2024

Conversation

rdyro
Copy link
Collaborator

@rdyro rdyro commented Oct 29, 2024

Changes:

  • adding start_idx and kv_seq_len to support fixed-sized cache decode and sliding window decode attention
  • fixing a bug where q_heads // kv_heads > block_h would cause out-of-bound indexing
  • skipping work before start_idx and after kv_seq_len
  • changing default sm_scale to 1 / math.sqrt(q.shape[-1]) to match jax.nn.dot_product_attention default

@rdyro rdyro changed the title Decode attention improvements GPU Pallas decode_attention improvements Oct 29, 2024
@rdyro rdyro force-pushed the rdyro-decode-attention-mask branch from ec63f1c to 50f71ab Compare October 30, 2024 01:41
@rdyro rdyro changed the title GPU Pallas decode_attention improvements [WIP] GPU Pallas decode_attention improvements Oct 31, 2024
@rdyro rdyro force-pushed the rdyro-decode-attention-mask branch 2 times, most recently from 8b0912b to 4e6527a Compare October 31, 2024 19:32
@rdyro rdyro changed the title [WIP] GPU Pallas decode_attention improvements GPU Pallas decode_attention improvements Oct 31, 2024
@rdyro rdyro requested a review from mattjj November 5, 2024 23:06
@rdyro rdyro force-pushed the rdyro-decode-attention-mask branch from 2a3d19b to d62510b Compare November 5, 2024 23:52
@google-ml-butler google-ml-butler bot added kokoro:force-run pull ready Ready for copybara import and testing labels Nov 6, 2024
@copybara-service copybara-service bot merged commit 37af100 into jax-ml:main Nov 6, 2024
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pull ready Ready for copybara import and testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants