Skip to content

docker: stop downgrading cuDNN below what torch ships - #1808

Merged
yueming-yuan merged 3 commits into
mainfrom
cudnn-9.22-for-te-2.17
Jul 27, 2026
Merged

docker: stop downgrading cuDNN below what torch ships#1808
yueming-yuan merged 3 commits into
mainfrom
cudnn-9.22-for-te-2.17

Conversation

@yueming-yuan

@yueming-yuan yueming-yuan commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Status: do not merge yet. The original premise of this PR — that cuDNN 9.22.0
fixes TE 2.17's CUDNN_ATTR_OPERATION_RESHAPE_MODE failure — has been disproven.
See "What this does not fix" below. The remaining change is still defensible on its
own terms, but the root cause is unresolved and the final version is undecided.

What is still true: the pin is an obsolete downgrade

docker/Dockerfile pins nvidia-cudnn-cu13==9.16.0.29 under a bare link to
pytorch/pytorch#168167 (Conv3D bf16
~40,000x slowdown on H200). Both of that pin's reasons have expired:

original purpose today
dodge the Conv3D regression maintainer nWEIdia: "wait for 2.10 for the fix" — this image runs torch 2.11.0
raise cuDNN to the workaround floor maintainer eqy: "manually install a newer version of cuDNN (9.15+)" — torch 2.11 already ships 9.19.0.56

The pin was originally an upgrade (the base image sat below 9.15). Now that torch ships
9.19.0.56 it has inverted into a downgrade, visible in every build log:

Found existing installation: nvidia-cudnn-cu13 9.19.0.56
Uninstalling nvidia-cudnn-cu13-9.19.0.56
Successfully installed nvidia-cudnn-cu13-9.16.0.29

What this does not fix

I claimed 9.22.0.52 resolves the fused_attn_bwd failure. It does not. With
9.22.0.52 installed (confirmed in the build log of #1795 run
30237617317), the identical error still fires:

cuDNN Error: detail::set_attribute(reshape_operation.get_raw_desc(),
             CUDNN_ATTR_OPERATION_RESHAPE_MODE, CUDNN_TYPE_RESHAPE_MODE, 1,
             &cudnn_reshape_mode) failed ... code: CUDNN_STATUS_BAD_PARAM

4 occurrences in test_qwen3_5_35b_a3b_lora_ci (h100), 6 in test_lora_qwen2.5_0.5B
(h200).

Why this PR's own CI looked clean. It branches off main, which does not carry
radixark/Megatron-Bridge#24. Both affected LoRA tests therefore died earlier, at
ValueError: not enough values to unpack (expected 21, got 16), and never reached the
attention backward at all. Zero cuDNN errors here meant the path was never executed,
not that it was fixed. Only #1795 — which pins the merged Megatron-Bridge — gets far
enough to exercise it.

Open

The real requirement is unknown. Candidates still to test: a higher cuDNN (9.23 / 9.24 /
9.25 are on PyPI); or that this is not a version floor at all — transformer_engine_cu13
ships as a prebuilt binary and may not be loading the pip-installed cuDNN it appears to.
Needs a minimal repro on a devbox and a bisect, not another inference from release notes.

Note that TE declares no cuDNN dependency whatsoever (transformer-engine-cu13 requires
only pydantic / importlib-metadata / packaging), so whatever the constraint is, no
metadata check can enforce it.

TE 2.17's fused attention calls cudnn-frontend's
Reshape_attributes::set_reshape_mode, which sets the backend attribute
CUDNN_ATTR_OPERATION_RESHAPE_MODE. That attribute exists from cuDNN 9.22.0.
Against the pinned 9.16.0.29 it comes back BAD_PARAM and TE raises out of
fused_attn_bwd:

    fused_attn_f16_arbitrary_seqlen.cu:934 cuDNN Error:
      set_attribute(..., CUDNN_ATTR_OPERATION_RESHAPE_MODE, ...)
      ... CUDNN_STATUS_BAD_PARAM

It killed test_qwen3_5_35b_a3b_lora_ci (h100) and test_lora_qwen2.5_0.5B
(h200) in #1795, and reaches only configs where TE does not select FA3, so
most tests never touch it.

The old pin is obsolete in both of its purposes. It existed for
pytorch/pytorch#168167 (Conv3D bf16 collapse on H200), whose maintainers say
the fix landed in PyTorch 2.10 and whose stated workaround for 2.9.x was to
install a *newer* cuDNN, 9.15+. This image runs torch 2.11.0, and torch 2.11
already ships 9.19.0.56, so the pin now only drags cuDNN backwards.

Dropping the pin is not enough: 9.19.0.56 is still below 9.22.0. 9.22.0.52 is
the lowest release that satisfies TE, chosen over the newer 9.23-9.25 to keep
the change minimal.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@yueming-yuan yueming-yuan added run-ci-image bypass-fastfail Disable CI fast-fail: run all stages and all tests to surface every failure labels Jul 27, 2026
#1796 switched TransformerEngine to the rolling wheels installed with
--no-deps. That pins the three TE dists to exactly those wheels, which is the
point, but it also drops transformer_engine_torch's own runtime requirements:
einops, onnx, onnxscript, pydantic, nvdlfw-inspect.

transformer_engine.pytorch imports onnxscript unconditionally on its core
import path (module/__init__ -> layernorm_linear -> base -> _common -> export
-> onnx_extensions), so every image built since #1796 fails at

    ModuleNotFoundError: No module named 'onnxscript'

as soon as anything touches TE -- which is every GPU test.

verify_transformer_engine.py did not catch it because it only compared
versions and metadata and called find_spec('transformer_engine'), which
resolves the package directory without importing it. Check that every non-TE
requirement of transformer_engine_torch is actually installed, so the build
fails at the layer that introduced the gap instead of shipping a green image.

@guapisolo guapisolo 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.

LGTM

@yueming-yuan
yueming-yuan merged commit cf78a76 into main Jul 27, 2026
35 of 40 checks passed
@yueming-yuan
yueming-yuan deleted the cudnn-9.22-for-te-2.17 branch July 27, 2026 07:28
@yueming-yuan yueming-yuan changed the title docker: raise cuDNN to 9.22.0 for transformer_engine 2.17 docker: stop downgrading cuDNN below what torch ships Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bypass-fastfail Disable CI fast-fail: run all stages and all tests to surface every failure run-ci-image

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants