test_mhas_v2: extend bwd random head-dim coverage to d=256#425
Conversation
The bwd suites already listed (256,256) in with_high_probability, but the random-draw branch was still capped at d_qk_max=192 / d_v_max=128, so backward configs with 128 < d <= 256 outside the fixed high-probability shapes were never generated. Raise the caps to 256/256 for the dense, ragged, and bias bwd suites (matching the fwd suites), and increase test_sdpa_random_bwd_L0 from 256 to 384 seeds to keep sampling density over the larger space. With this change test_sdpa_random_bwd_L0 draws d_qk=d_v=256 in 66/384 configs and d>128 in 206/384. Backends without d=256 bprop support waive these configs through the existing cudnnGraphNotSupportedError handling, so no new failures are introduced on older cuDNN versions.
📝 WalkthroughWalkthroughThe cuDNN SDPA backward tests now generate 384 cases instead of 256 and sample ChangesSDPA backward test coverage
Estimated code review effort: 2 (Simple) | ~8 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/python/test_mhas_v2.py`:
- Line 192: Reformat the three modified RandomHiddenDimSize(...) calls,
including the occurrences near lines 192, 481, and 654, with Black using a
160-character line length. Keep all arguments and values unchanged while
applying consistent Black formatting.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: a8d880d5-77fe-4677-8d61-b43f72f07fda
📒 Files selected for processing (1)
test/python/test_mhas_v2.py
| batches=RandomBatchSize(min=8, max=16), | ||
| s_q_s_kv = RandomSequenceLength(s_q_min=1, s_q_max=4096, s_kv_min=1, s_kv_max=4096, s_q_distribution={"s_q=1":0, "s_q=s_kv":5, "s_q=random":10, "s_q>s_kv":3}), | ||
| d_qk_d_v=RandomHiddenDimSize(d_qk_min=1, d_qk_max=192, d_v_min=1, d_v_max=128, head_dim_distribution={"d_qk=d_v":5, "d_qk=random":1}, with_high_probability=[(64,64), (128,128), (192,128), (256,256)]), | ||
| d_qk_d_v=RandomHiddenDimSize(d_qk_min=1, d_qk_max=256, d_v_min=1, d_v_max=256, head_dim_distribution={"d_qk=d_v":5, "d_qk=random":1}, with_high_probability=[(64,64), (128,128), (192,128), (256,256)]), |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Format the changed calls with Black’s 160-character limit.
These modified RandomHiddenDimSize(...) calls exceed the configured line length. Reformat the arguments consistently in all three locations.
Proposed formatting
- d_qk_d_v=RandomHiddenDimSize(d_qk_min=1, d_qk_max=256, d_v_min=1, d_v_max=256, head_dim_distribution={"d_qk=d_v":5, "d_qk=random":1}, with_high_probability=[(64,64), (128,128), (192,128), (256,256)]),
+ d_qk_d_v=RandomHiddenDimSize(
+ d_qk_min=1,
+ d_qk_max=256,
+ d_v_min=1,
+ d_v_max=256,
+ head_dim_distribution={"d_qk=d_v": 5, "d_qk=random": 1},
+ with_high_probability=[(64, 64), (128, 128), (192, 128), (256, 256)],
+ ),Apply the same formatting to Lines 481 and 654.
As per coding guidelines, **/*.{py,ipynb} files must be formatted with Black using a line length of 160.
Also applies to: 481-481, 654-654
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@test/python/test_mhas_v2.py` at line 192, Reformat the three modified
RandomHiddenDimSize(...) calls, including the occurrences near lines 192, 481,
and 654, with Black using a 160-character line length. Keep all arguments and
values unchanged while applying consistent Black formatting.
Source: Coding guidelines
|
@cudnn-ci-bot run |
|
🚀 Running mirror pipeline Branch: cudnn-gh/pr-425-5ade219 |
Anerudhan
left a comment
There was a problem hiding this comment.
Please fix the failing pipeline
What
Extends the randomized SDPA backward test coverage in
test/python/test_mhas_v2.pyto head dims up to 256:test_sdpa_random_bwd_L0,test_sdpa_random_bwd_ragged_L0,test_sdpa_random_bwd_bias_L0) already listed(256,256)inwith_high_probability, but their random-draw branch was still capped atd_qk_max=192, d_v_max=128— so backward configs with 128 < d <= 256 outside the fixed high-probability shapes were never generated. This raises the caps to 256/256, matching the fwd suites.test_sdpa_random_bwd_L0from 256 to 384 seeds to keep sampling density over the larger shape space.Why
A head_dim=256 dense backward plan-build failure recently escaped to PyTorch integration testing (
test_cudnn_attention_dense_d256_sm90_sm10x) because the FE test suites never exercised d=256 backward: v2's random ranges were capped as above, and v1'stest_sdpa_backwardsamples d only from [32, 56, 64, 128]. A cuDNN backend fix is in flight; this change closes the test-coverage side.Validation
test_sdpa_random_bwd_L0drawsd_qk=d_v=256in 66/384 configs and d>128 in 206/384 (previously 0 outside the three fixed shapes).cudnnGraphNotSupportedErrorhandling, so no new failures are introduced on older cuDNN versions.🤖 Generated with Claude Code
Summary by CodeRabbit