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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

rdyro
Copy link
Collaborator

@rdyro rdyro commented Oct 29, 2024

Changes:

  • adding mask and bias arguments to decode attention
  • fixing a bug where q_heads // kv_heads > block_h would cause out-of-bound indexing
  • adding variable work dispatch (by computing fori_loop max iteration) when mask is present
  • 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 from 50f71ab to 8b0912b Compare October 31, 2024 19:31
@rdyro rdyro force-pushed the rdyro-decode-attention-mask branch 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant