[PyT] Guard THD learnable dSink on older cuDNN - #3470
Conversation
Signed-off-by: Kshitij Janardan Lakhani <klakhani@nvidia.com>
|
/te-ci pytorch L0 L1 |
Greptile SummaryThe PR protects non-FP8 packed-THD learnable-softmax training from a known pre-cuDNN-9.26 backward defect.
Confidence Score: 4/5The PR appears safe to merge, with the non-blocking concern that its narrow backend-selection boundary is not protected by automated regression coverage. The guard correctly removes the known-bad fused path while preserving supported configurations and existing fallback behavior; the remaining concern is future regression detection. Files Needing Attention: transformer_engine/pytorch/attention/dot_product_attention/utils.py Important Files Changed
Reviews (1): Last reviewed commit: "Guard THD learnable dSink on older cuDNN" | Re-trigger Greptile |
| elif ( | ||
| use_fused_attention | ||
| and is_training | ||
| and qkv_format == "thd" | ||
| and softmax_type == "learnable" | ||
| and cudnn_version < (9, 26, 0) | ||
| and head_dim_v not in (64, 128, 256) | ||
| ): |
There was a problem hiding this comment.
Backend guard lacks regression coverage
The new cuDNN-version and head-dimension guard has no automated coverage for either the affected fallback branch or the 9.26 boundary. A regression in condition ordering, version handling, or the specialized-dimension allowlist can therefore re-enable the incorrect-gradient path or unnecessarily disable supported fused execution without CI detecting it.
Knowledge Base Used:
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Description
cuDNN versions before 9.26 have a known backward-pass issue for learnable softmax with packed THD inputs. The generic kernel can incorrectly index ragged softmax statistics, producing an incorrect dSink or a potential out-of-bounds read.
Fixes #3249 (potentially)
Validation
Type of change
Changes
The change in this PR disables FusedAttention when all the following apply:
When the guard is triggered, TE warns the user to upgrade to cuDNN 9.26 or later. TE falls back to UnfusedDotProductAttention when available; otherwise, the existing “no backend available” error is raised.
Note: Inference, non-THD layouts, other softmax types, and cuDNN 9.26+ are unchanged.
Checklist: