[All] Guard THD learnable dSink on older cuDNN - #3470
Conversation
|
/te-ci pytorch L0 L1 |
Greptile SummaryThe PR prevents affected FP16/BF16 packed-THD learnable-softmax training configurations from selecting fused attention on cuDNN versions older than 9.26.
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains. No blocking failure remains. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Attention request] --> B{Training + THD + learnable softmax}
B -->|No| F[Fused backend capability checks continue]
B -->|Yes| C{cuDNN before 9.26}
C -->|No| F
C -->|Yes| D{head_dim_v is 64, 128, or 256}
D -->|Yes| F
D -->|No| E[Return No Backend]
E --> G[Framework warning and fallback]
Reviews (4): Last reviewed commit: "Merge branch 'main' into klakhani/fix/ds..." | 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!
| 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.
Is this for Hopper only, or all arches?
There was a problem hiding this comment.
I confirmed with @vedaanta and it is not Hopper specific
Signed-off-by: Kshitij Janardan Lakhani <klakhani@nvidia.com>
5f5f4e4 to
4fc35a5
Compare
Signed-off-by: Kshitij Lakhani <klakhani@nvidia.com>
a967b8e to
d930129
Compare
|
/te-ci L0 L1 |
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.
Common C++ change: implements the actual guard. It makes nvte_get_fused_attn_backend() return NVTE_No_Backend for the affected configuration. This protects PyTorch, JAX, and direct common callers.
PyTorch/Jax change: only recognizes why common returned No_Backend and prints the targeted cuDNN 9.26 warning. It does not independently guard the fused backend.
Checklist: