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

cuDNN SDPA executor does not support batched broadcast across attention heads mask #1799

Open
IvanYashchuk opened this issue Feb 25, 2025 · 0 comments
Labels

Comments

@IvanYashchuk
Copy link
Collaborator

IvanYashchuk commented Feb 25, 2025

🐛 Bug

To reproduce:

  1. Pull the branch of Update cuDNN SDPA execution functions to use the strides of attn_mask #1798 if not merged yet.
  2. Run the test added in Update cuDNN SDPA execution functions to use the strides of attn_mask #1798 (pytest thunder/tests/test_cudnn_executor.py::test_make_cudnn_sdpa_backward_graph_with_mask):
    # "B1TS" case is not working
    mask = torch.ones(batch_size, 1, sequence_length, sequence_length, dtype=torch.bool, device="cuda")
    mask = torch.where(mask, 0.0, float("-inf")).to(torch.bfloat16)
    # Reason: dbias cannot be reduced just across heads.
    # Supported reduction patterns are [1,1,T,S], [1,H,T,S], [B,H,T,S] at: (!batch_dim_reduction_requested) && head_dim_reduction_requested
    # See issue: ...
    with pytest.raises(cudnn.cudnnGraphNotSupportedError, match="No valid engine configs"):
    _make_cudnn_sdpa_backward_graph(q, k, v, mask, 0.0, None)

Supporting this case is required for batched packed sequences (#1758).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant