Skip to content

Add SDPA edge case test coverage#328

Open
hwanseoc wants to merge 4 commits into
NVIDIA:developfrom
hwanseoc:hwanseoc/sdpa-edge-cases
Open

Add SDPA edge case test coverage#328
hwanseoc wants to merge 4 commits into
NVIDIA:developfrom
hwanseoc:hwanseoc/sdpa-edge-cases

Conversation

@hwanseoc

@hwanseoc hwanseoc commented Jun 26, 2026

Copy link
Copy Markdown
Member

@coderabbitai ignore

Summary

  • Add deterministic packed SDPA zero-sequence coverage for both seq_len_* and prefix-sum cu_seq_len_* inputs.
  • Cover zero Q, zero KV, and zero QKV sequences; cu_seq_len_* cases are forward-only because backward plumbing is not supported.
  • Cover bottom-right causal empty rows and top-left causal empty columns without bias injection.
  • Exercise varied all-negative attention scores in both FP16 and BF16 with nonzero backward gradients.
  • Reuse the canonical SDPA execution/reference harness through narrow input and result hooks.

Validation

  • A100 SM80, backend 9.30: 7 passed, 3 skipped (packed seq_len_* backward unsupported)
  • H100 SM90, backend 9.30: 10 passed
  • B200 SM100, backend 9.30: 10 passed
  • Existing SDPA harness regression: test_sdpa_random_fwd_L0[test1] passed

@hwanseoc hwanseoc marked this pull request as ready for review June 26, 2026 22:42
@hwanseoc hwanseoc changed the title Add SDPA edge case coverage Add SDPA edge case test coverage Jun 26, 2026
@hwanseoc hwanseoc self-assigned this Jun 26, 2026
@hwanseoc hwanseoc added cat-enhancements open-todo Open work that is ready to be picked up, scheduled, or prioritized. mod-frontend cuDNN frontend APIs, operation graph construction, plans, and user-facing wrappers. orig-nv-eng Reported or requested by NVIDIA engineering. and removed open-todo Open work that is ready to be picked up, scheduled, or prioritized. labels Jun 26, 2026
@hwanseoc hwanseoc added this to the Frontend 1.27.0 milestone Jun 26, 2026

@jhjpark jhjpark left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to combine the edge case tester with test_mhas_v2.py? I think it would be nice if test_mhas_v2 could cover it by itself.

@hwanseoc

Copy link
Copy Markdown
Member Author

Is it possible to combine the edge case tester with test_mhas_v2.py? I think it would be nice if test_mhas_v2 could cover it by itself.

I'd prefer keeping the deterministic edge cases separate.

They already use the same tester and reference implementation as test_mhas_v2

Integrating them into random generation would either weaken coverage or add constrained combinations and unnecessary test expansion.

@Anerudhan

Copy link
Copy Markdown
Collaborator

@hwanseoc will submit after necessary waives. LGTM

@Anerudhan

Copy link
Copy Markdown
Collaborator

@cudnn-ci-bot run

@cudnn-ci-bot

Copy link
Copy Markdown

🚀 Running mirror pipeline

Branch: cudnn-gh/pr-328-be17996
Pipeline: 56518344

@hwanseoc

hwanseoc commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

@cudnn-ci-bot run

@cudnn-ci-bot

Copy link
Copy Markdown

🚀 Running mirror pipeline

Branch: cudnn-gh/pr-328-be17996
Pipeline: 56673003

@hwanseoc

hwanseoc commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

@cudnn-ci-bot run

@cudnn-ci-bot

Copy link
Copy Markdown

🚀 Running mirror pipeline

Branch: cudnn-gh/pr-328-be17996
Pipeline: 57024864

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat-enhancements mod-frontend cuDNN frontend APIs, operation graph construction, plans, and user-facing wrappers. orig-nv-eng Reported or requested by NVIDIA engineering.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants