Pad to a multiple of 128 by default with SDPA on H100 and B200 GPUs #8554
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 414 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.361
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #8554"
general
weight: 0.35
qgallouedec
This PR makes
pad_to_multiple_of="auto"pad to a multiple of 128 with SDPA attention on NVIDIA GPUs of compute capability 9.x and 10.x (H100, H200, B200, B300), as it already does on Neuron, in SFT, DPO, KTO, Reward, GRPO, RLOO and Distillation.Tracking issue:
Motivation
On these GPUs, PyTorch runs SDPA with cuDNN, which keeps a graph in host memory for every new sequence length and never frees it (pytorch/pytorch#202607). With the script of #8439 on an H100 (torch 2.14.1), host memory ends at 3.54 GB with today's default and at 2.13 GB with this PR, flat from step 100. Padding to 128 also keeps clear of the cuDNN NaN at
seq_len % 128 == 64on torch < 2.15 (pytorch/pytorch#196678), and #7724 measured +3% to +57% throughput with SDPA on H100/H200.Solution
The configs still resolve
"auto"in__post_init__, except on CUDA (not ROCm) GPUs of compute capability 9.x/10.x, where the trainers resolve it once the model is loaded: to 128 if the model uses SDPA, and toNoneotherwise, e.g. with FA2/FA3, which #7724 measured 2 to 6% slower when padded. Resolving it from the loaded model also covers the CLI, where--attn_implementationreachesmodel_init_kwargsonly after the config is built, and models passed as objects. Generation with transformers still hits the cache; the docs cover that case (#8440).On an H100, the test files of the seven trainers pass with this PR and #8553 (without #8553, the vision-language tests of SFT, DPO and KTO hit #8551).
Changes
pad_to_multiple_of="auto"for the trainer to resolve on compute capability 9.x/10.x in the seven configs, and update their docstrings and help texts.require_cudnn_sdpaandrequire_no_cudnn_sdpatest markers, skip the CLI"auto"case on these GPUs, and add a test of the new default to each trainer.This PR depends on:
<!-- CURSOR_SUMMARY -->
---
<!-- /CURSOR_SUMMARY -->