Skip to content

Override cuBLAS with 13.6.1.10 for preparation - #420

Closed
yatesdr wants to merge 1 commit into
NVIDIA:mainfrom
yatesdr:fix/cublas-13.6-override
Closed

yatesdr wants to merge 1 commit into
NVIDIA:mainfrom
yatesdr:fix/cublas-13.6-override

Conversation

@yatesdr

@yatesdr yatesdr commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Closed without merging. The review asked for the seven-case reproduction and the TP4 preparation to be repeated on a main that includes #331, with cuBLAS 13.4.1.3 and 13.6.1.10. No GPU host is free for that now, and the existing evidence does not justify an override that sets aside cuda-toolkit's requirement: TP4 preparations of local-inference-lab/GLM-5.3-Flash-NVFP4 with the locked 13.4.1.3 failed once in eight runs, and the only repeatable failure is the test sequence below, measured on ba42481a before #331. docs/TODO.txt on main already records both failures with their close conditions. If 13.4.1.3 still fails that sequence on current main, this will come back with that evidence.

Re-run on current main (a2bf7860, which includes #331 and FlashInfer 1d76585b), four SM120 GPUs with CUDA_VISIBLE_DEVICES=0,1, NVIDIA's GLM-5.3-Flash-FP4-Local snapshot at 76348ddb, one pytest process per run: with the locked cuBLAS 13.4.1.3 (libcublas sha256 d089edf0…, the build that crashed on ba42481a) the seven-case sequence passed 7/7 in three complete runs, with no CUBLAS_STATUS error and no illegal address; a fourth run, the first on a cold kernel cache, failed one case with "planned Triton program has not been compiled", unrelated to cuBLAS. With 13.6.1.10 (f7e672d9…) it passed 7/7 twice. The override is not needed on current main.


Preparation fails inside cuBLAS 13.4.1.3, the version uv.lock pins, in a
strided batched GEMM that GLM-5.3-Flash's MLA path calls through torch.bmm.
cuBLAS 13.6.1.10 does not fail in the same conditions. This change overrides
nvidia-cublas to 13.6.1.10 for preparation. The cause of the failure in
13.4.1.3 is not established.

Why

Upstream main at ba42481a, NVIDIA's GLM-5.3-Flash snapshot and cuBLAS
13.4.1.3, on four SM120 GPUs. These seven cases, run in one pytest process in
this order with FLARE_RUN_CUDA_TESTS=1 and FLARE_GLM53_SNAPSHOT pointing at
the snapshot, end with a CUDA error:

pytest \
  tests/recipes/test_glm53_moe_overlap.py::test_autotuned_shared_routed_graph[2-True-False-False-1] \
  tests/recipes/test_glm53_mla_cuda.py::test_glm_mla_checkpoint_native_replay[1-decode-2-True] \
  tests/recipes/test_glm53_mla_cuda.py::test_glm_mla_checkpoint_native_replay[1-decode-1-False] \
  tests/recipes/test_glm53_mla_cuda.py::test_glm_mla_checkpoint_native_replay[1-decode-2-False] \
  tests/recipes/test_glm53_mla_cuda.py::test_glm_mla_checkpoint_native_replay[1-prefill-65-True] \
  tests/recipes/test_glm53_mla_cuda.py::test_glm_mla_checkpoint_native_replay[2-decode-1-True] \
  tests/recipes/test_glm53_mla_cuda.py::test_glm_mla_checkpoint_native_replay[2-decode-2-True]

The last case raises CUBLAS_STATUS_INTERNAL_ERROR in
cublasGemmStridedBatchedEx, called by torch.bmm in _bmm_out
(ignition/components/linear.py) and reached through the MLA query absorb,
followed by CUDA_ERROR_ILLEGAL_ADDRESS. Removing any one of the five TP1 and
TP2 replay cases removes the error, so the failure depends on state
accumulated in the process. It reproduced twice. With the cuBLAS 13.6.1.10
libraries in place of 13.4.1.3 (same tree, same FlashInfer 598c8547) the
sequence raises no cuBLAS or CUDA error.

The same torch.bmm call failed one TP4 preparation of
local-inference-lab/GLM-5.3-Flash-NVFP4 (revision
378ca54585c46542bad1f3cb3ed0d73ae51cdb62) at warmup 44 of 108, the
speculative verification graph of two requests with six rows each, with
13.4.1.3. Six other preparations with 13.4.1.3 passed, and preparations with
13.6.1.10 pass. Whether the two failures are the same defect is not
established.

The cuBLAS "Patch Release 13.6.1" notes list fixes for out-of-bounds reads in
strided batched GEMMs whose shared operand has zero or overlapping strides on
SM120 and SM121. That could explain the failures, but the operand layout that
triggers them has not been identified. Isolated single-call torch.bmm probes
do not reproduce the failure; the multi-case sequence does. Pinning the fixed
release removes the failure without waiting for the cause.

What changes

  • pyproject.toml overrides nvidia-cublas to 13.6.1.10 and uv.lock records
    its wheels. The lock file differs from main's only in the nvidia-cublas
    entries (13.4.1.3 to 13.6.1.10, x86_64 and aarch64 wheels) and the override in
    its manifest.
  • cuda-toolkit 13.2.2, which torch 2.14.1+cu132 requires, depends on
    nvidia-cublas==13.4.1.3.*, so a direct requirement conflicts with it; the
    override replaces that dependency.
  • The override is unconditional: the package publishes wheels for x86_64 and
    aarch64 only, and re-locking without a platform marker selects the same
    wheels. It applies to the preparation of every recipe on both architectures,
    with uv only.
  • docs/model-preparation.md states the requirement.
  • Two docs/TODO.txt entries, whose close condition is a locked cuBLAS that
    no longer fails, are removed: "Resolve the CUDA illegal memory access of the GLM MLA replay tests with
    cuBLAS 13.4.1.3" (with 13.6.1.10 the sequence raised no error on ba42481a) and "Explain the
    one TP4 preparation failure of glm-5.3-flash-nvfp4 at warmup 44" (preparations
    with 13.6.1.10 pass).

Result

Preparation uses cuBLAS 13.6.1.10 and the seven-case sequence raises no cuBLAS
or CUDA error. Native serving (flare run) does not load cuBLAS, so existing
cores are unchanged. Cores exported with this change can select different BF16
GEMM algorithms.

Evidence

All with 13.6.1.10 libraries on SM120 unless stated.

  • With 13.4.1.3 the seven cases above end in the cuBLAS error, twice; with
    13.6.1.10 they raise no cuBLAS or CUDA error. On ba42481a six of them also
    fail an output comparison of the replay test with either version.
  • A TP4 export of local-inference-lab/GLM-5.3-Flash-NVFP4 at the revision
    above, with the libraries mounted read-only over a validation environment that
    also carried unmerged changes, passes all 108 warmups and graph-memory
    captures and exports; all four ranks map the new library. With 13.4.1.3 the
    same export fails at warmup 44.
  • An isolated installation of the locked package passes a Gemma 4 E2B TP1
    export (concurrency 1, prefill 128, no MTP, Inductor compilation disabled).
  • A TP4 export of nvidia/GLM-5.3-Flash-FP4-Local at revision
    76348ddb2be2e35e39ecfc00e75dc07703f4f3d5 with --autotune-effort off exits
    0 in 3319 s. A check that every kernel argument that looks like a device
    address lies inside a recorded allocation finds 0 violations in 114 graphs on
    each of the four ranks.
  • A TP4 export of DeepSeek V4.1 Flash completes every warmup and capture. That
    recipe does not call torch.bmm, so the export shows only that the new wheel
    does not break its preparation. The same address check on its core finds 0
    violations in 149 graphs on each of four ranks.
  • uv lock --check passes, and a dry run of
    uv sync --locked --extra prepare --extra test resolves nvidia-cublas
    13.6.1.10.

Relation to #331

#331 moves warmup execution in capture_forwards onto a dedicated stream that
does not capture, and changes which stream's cuBLAS workspace is cached and
where it is allocated. It does not change the operands of the GEMM, and the
seven test cases above capture their graphs without calling capture_forwards.
The sequence has not been re-run on a main that includes #331.

Not verified

Every other recipe, SM103, SM121, aarch64, any numerical comparison of exported
cores between the two versions, generation accuracy, a re-run of the sequence on
a main that includes #331, and installation by uv sync --locked from this
branch beyond the dry run.

Discord: D-Rock

Why. Upstream main at ba42481, NVIDIA's GLM-5.3-Flash snapshot and the
locked cuBLAS 13.4.1.3, on four SM120 GPUs: these seven cases, run in
one pytest process in this order with FLARE_RUN_CUDA_TESTS=1 and
FLARE_GLM53_SNAPSHOT pointing at the snapshot,

  pytest \
    tests/recipes/test_glm53_moe_overlap.py::test_autotuned_shared_routed_graph[2-True-False-False-1] \
    tests/recipes/test_glm53_mla_cuda.py::test_glm_mla_checkpoint_native_replay[1-decode-2-True] \
    tests/recipes/test_glm53_mla_cuda.py::test_glm_mla_checkpoint_native_replay[1-decode-1-False] \
    tests/recipes/test_glm53_mla_cuda.py::test_glm_mla_checkpoint_native_replay[1-decode-2-False] \
    tests/recipes/test_glm53_mla_cuda.py::test_glm_mla_checkpoint_native_replay[1-prefill-65-True] \
    tests/recipes/test_glm53_mla_cuda.py::test_glm_mla_checkpoint_native_replay[2-decode-1-True] \
    tests/recipes/test_glm53_mla_cuda.py::test_glm_mla_checkpoint_native_replay[2-decode-2-True]

end with the last case raising CUBLAS_STATUS_INTERNAL_ERROR in
cublasGemmStridedBatchedEx, called by torch.bmm in _bmm_out
(ignition/components/linear.py) and reached through the MLA query
absorb, followed by CUDA_ERROR_ILLEGAL_ADDRESS. Removing any one of the
five TP1 and TP2 replay cases removes the error, so the failure depends
on state accumulated in the process. It reproduced twice. With the
cuBLAS 13.6.1.10 libraries in place of 13.4.1.3 (same tree, same
FlashInfer 598c8547) the sequence raises no cuBLAS or CUDA error.

The same torch.bmm call failed one TP4 preparation of
local-inference-lab/GLM-5.3-Flash-NVFP4 at revision
378ca54585c46542bad1f3cb3ed0d73ae51cdb62 at warmup 44 of 108, the
speculative verification graph of two requests with six rows each, with
13.4.1.3. Six other preparations with 13.4.1.3 passed, and preparations
with 13.6.1.10 pass. Whether the two failures are the same defect is not
established.

The cause is not established either. The cuBLAS "Patch Release 13.6.1"
notes list fixes for out-of-bounds reads in strided batched GEMMs whose
shared operand has zero or overlapping strides on SM120 and SM121, which
could explain it; the operand layout that triggers this failure has not
been identified. Isolated single-call torch.bmm probes do not reproduce
it; the multi-case sequence does. Pinning the fixed release removes the
failure without waiting for the cause.

What changed. pyproject.toml overrides nvidia-cublas to 13.6.1.10 and
uv.lock records its wheels; the lock file differs from main's only in
the nvidia-cublas entries and the override in its manifest. cuda-toolkit
13.2.2, which torch 2.14.1+cu132 requires, depends on
nvidia-cublas==13.4.1.3.*, so a direct requirement conflicts with it and
the override replaces that dependency. The override is unconditional:
the package publishes wheels for x86_64 and aarch64 only, and re-locking
without a platform marker selects the same wheels. It applies to the
preparation of every recipe on both architectures, uv only.
docs/model-preparation.md states the requirement. Two docs/TODO.txt
entries, whose close condition is a locked cuBLAS that no longer fails,
are removed: "Resolve the CUDA illegal memory access of the GLM MLA
replay tests with cuBLAS 13.4.1.3" and "Explain the one TP4 preparation
failure of glm-5.3-flash-nvfp4 at warmup 44".

Result. Preparation uses cuBLAS 13.6.1.10 and the seven-case sequence
raises no cuBLAS or CUDA error. Native serving (flare run) does not load
cuBLAS, so existing cores are unchanged; cores exported with this change
can select different BF16 GEMM algorithms.

Evidence, with 13.6.1.10 libraries on SM120 unless stated. With 13.4.1.3
the seven cases above end in the cuBLAS error, twice; with 13.6.1.10
they raise no cuBLAS or CUDA error. A TP4 export of
local-inference-lab/GLM-5.3-Flash-NVFP4 at the revision above, with the
libraries mounted read-only over a validation environment that also
carried unmerged changes, passes all 108 warmups and graph-memory
captures and exports; all four ranks map the new library. With 13.4.1.3
the same export fails at warmup 44. An isolated installation of the
locked package passes a Gemma 4 E2B TP1 export (concurrency 1, prefill
128, no MTP, Inductor compilation disabled). A TP4 export of
nvidia/GLM-5.3-Flash-FP4-Local at revision
76348ddb2be2e35e39ecfc00e75dc07703f4f3d5 with --autotune-effort off
exits 0 in 3319 s; a check that every kernel argument that looks like a
device address lies inside a recorded allocation finds 0 violations in
114 graphs on each of the four ranks. A TP4 export of DeepSeek V4.1
Flash completes every warmup and capture; that recipe does not call
torch.bmm, so the export shows only that the new wheel does not break
its preparation; the same address check on its core finds 0 violations
in 149 graphs on each of four ranks. uv lock --check passes, and a dry
run of uv sync --locked --extra prepare --extra test resolves
nvidia-cublas 13.6.1.10.

Relation to NVIDIA#331. NVIDIA#331 moves warmup execution in capture_forwards onto a
dedicated stream that does not capture, and changes which stream's
cuBLAS workspace is cached and where it is allocated. It does not change
the operands of the GEMM, and the seven test cases above capture their
graphs without calling capture_forwards. The sequence has not been
re-run on a main that includes NVIDIA#331.

Not verified: every other recipe, SM103, SM121, aarch64, any numerical
comparison of exported cores between the two versions, generation
accuracy, a re-run of the sequence on a main that includes NVIDIA#331, and
installation by uv sync --locked from this branch beyond the dry run.

Signed-off-by: yatesdr <6937857+yatesdr@users.noreply.github.com>
Design-Signed-Off-By: yatesdr; design-review=1af4
@yatesdr

yatesdr commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

Checked 40d1c1f. The override is minimal and correct. The lock entries match PyPI's wheels for x86_64 and aarch64. uv lock --check passes, and the FlashInfer tracking workflow's uv lock --upgrade-package flashinfer-python keeps cuBLAS at 13.6.1.10. Serving loads no cuBLAS. It isn't ready to merge, because the evidence was taken on an older base.

Blocking

  1. The failures were measured on ba42481a, which lacks Isolate cuBLAS warmup workspaces from CUDA graph capture #331.
    • Isolate cuBLAS warmup workspaces from CUDA graph capture #331 (1eb61e81, "Isolate cuBLAS warmup workspaces from CUDA graph capture") is in this PR's base a2bf7860. It changes which stream and workspace cuBLAS calls use in capture_forwards' warmup loop, the loop where the TP4 preparation failed at warmup 44.
    • Between the two commits, tests/recipes/test_glm53_mla_cuda.py, ignition/components/linear.py and ignition/preparation/capture.py also changed, and the lock moved FlashInfer from 598c8547 to main's 1d76585b.
    • The doc's "cuBLAS 13.4.1.3 is not supported for preparation" and both TODO removals rest on that evidence.
    • Please run the seven-case sequence, and repeat the TP4 GLM-5.3-Flash-NVFP4 preparation, on a2bf7860 with 13.4.1.3 and with 13.6.1.10. If 13.4.1.3 no longer fails there, the override is not needed.

Should fix

  1. docs/model-preparation.md:77-89 reports occurrences of a defect. It says the strided batched GEMM "has returned CUBLAS_STATUS_INTERNAL_ERROR in GLM-5.3-Flash tests and in one TP4 preparation". AGENTS.md: record unresolved defects, unrun checks and pending measurements in docs/TODO.txt, not in design documents. State only the requirement there.
  2. "Only x86_64 with SM120 is qualified with 13.6.1.10" claims more than the runs show. Name the recipes and configurations that were exercised.
  3. docs/TODO.txt.
    • The PR removes both entries and adds none. The unrun checks it lists as unqualified (SM103, SM121, aarch64, and the numerical difference between versions) belong there.
    • So does a removal condition for the override itself, for example when the locked cuda-toolkit requires a cuBLAS that passes the sequence. An override ignores every other requirement on the package, and main has no precedent for one.
  4. The warmup-44 entry is closed on too little. 13.4.1.3 failed one preparation in seven, and the description gives no count for preparations with 13.6.1.10. Give that count, and the snapshot revision and CUDA_VISIBLE_DEVICES for the seven-case reproduction.

@yatesdr yatesdr closed this Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant