From 40d1c1fc63266f7c4b7dec5282c3899a8baa4dd5 Mon Sep 17 00:00:00 2001 From: yatesdr <6937857+yatesdr@users.noreply.github.com> Date: Wed, 18 Nov 2026 22:53:12 -0500 Subject: [PATCH] Override cuBLAS with 13.6.1.10 for preparation Why. Upstream main at ba42481a, 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 #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. Signed-off-by: yatesdr <6937857+yatesdr@users.noreply.github.com> Design-Signed-Off-By: yatesdr; design-review=1af4 --- docs/TODO.txt | 21 --------------------- docs/model-preparation.md | 14 ++++++++++++++ pyproject.toml | 3 +++ uv.lock | 13 ++++++++----- 4 files changed, 25 insertions(+), 26 deletions(-) diff --git a/docs/TODO.txt b/docs/TODO.txt index b45b98b32..5faf893be 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -463,27 +463,6 @@ six test_actual_dense_and_attention_shards cases with NVIDIA's snapshot read .weight of grouped projections, which have none. Close when they pass. -[ ] Resolve the CUDA illegal memory access of the GLM MLA replay tests with - cuBLAS 13.4.1.3, which uv.lock pins. After test_autotuned_shared_routed_graph - [2-True-False-False-1] and the replay cases [1-decode-2-True], - [1-decode-1-False], [1-decode-2-False], [1-prefill-65-True] and - [2-decode-1-True] in one process, [2-decode-2-True] raises - CUBLAS_STATUS_INTERNAL_ERROR in cublasGemmStridedBatchedEx, called by torch.bmm - in _bmm_out (ignition/components/linear.py), and the CUDA error then persists - in the process. Upstream main fails the same sequence with NVIDIA's snapshot - and the locked cuBLAS, and passes it with cuBLAS 13.6.1.10. Close when the - locked cuBLAS passes this sequence, or the operand layout that triggers the - error is found. - -[ ] Explain the one TP4 preparation failure of glm-5.3-flash-nvfp4 at warmup 44 - with cuBLAS 13.4.1.3, which the lock file pins. Six later preparation runs - with 13.4.1.3 passed every warmup, one of them at default tuning, and no - operand layout of the failing batched matrix multiplication was found - unusual. The failing call, torch.bmm in _bmm_out, is the call that fails in - the MLA replay sequence above with 13.4.1.3; whether it is the same defect - is not established. Close when the cause of both failures is found, or when - the locked cuBLAS no longer fails either. - [ ] Run the host offload isolation measurements for the memory tier and the composite store with qualify/host_cache_isolation.py. Every threshold in prefix-cache-offload.md section 4 must hold before derived host-store diff --git a/docs/model-preparation.md b/docs/model-preparation.md index 9cd2f6e6a..0c1861c4f 100644 --- a/docs/model-preparation.md +++ b/docs/model-preparation.md @@ -74,6 +74,20 @@ uv sync --locked --extra prepare --extra test cargo build --release --manifest-path flare-cli/Cargo.toml ``` +`pyproject.toml` overrides the cuBLAS requirement of the locked CUDA 13.2 +packages and pins `nvidia-cublas` 13.6.1.10, which publishes wheels for x86_64 +and aarch64; the override applies to `uv` only. `cuda-toolkit` 13.2.2, which +PyTorch requires, depends on `nvidia-cublas==13.4.1.3.*`, so a direct +requirement conflicts with it. Preparation of every recipe uses this version; +native serving (`flare run`) does not load cuBLAS. cuBLAS 13.4.1.3 is not +supported for preparation: on SM120 its strided batched GEMM, called by the +BF16 `torch.bmm` in `ignition/components/linear.py`, has returned +`CUBLAS_STATUS_INTERNAL_ERROR` in GLM-5.3-Flash tests and in one TP4 +preparation of `local-inference-lab/GLM-5.3-Flash-NVFP4`; the cause is not +established. Only x86_64 with SM120 is qualified with 13.6.1.10. SM103, SM121 +and aarch64, and the numerical difference between the two versions, are not +qualified. + `ignition.runtime_patches` installs process-local fixes for PyTorch 2.14.1+cu132 and Triton 3.8.0. Preparation commands set dependency paths and GPU visibility before installation. Spawned ranks, tuning replicas, b12x compiler workers, and diff --git a/pyproject.toml b/pyproject.toml index 352dd621b..1eb79a296 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,6 +35,9 @@ prepare = [ "rich>=13", ] +[tool.uv] +override-dependencies = ["nvidia-cublas==13.6.1.10"] + [[tool.uv.index]] name = "pytorch-cu132" url = "https://download.pytorch.org/whl/cu132" diff --git a/uv.lock b/uv.lock index 9e3097c51..1a814bc39 100644 --- a/uv.lock +++ b/uv.lock @@ -2,6 +2,9 @@ version = 1 revision = 3 requires-python = "==3.12.*" +[manifest] +overrides = [{ name = "nvidia-cublas", specifier = "==13.6.1.10" }] + [[package]] name = "accelerate" version = "1.14.0" @@ -302,7 +305,7 @@ wheels = [ [package.optional-dependencies] cublas = [ - { name = "nvidia-cublas", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, + { name = "nvidia-cublas" }, { name = "nvidia-cuda-nvrtc", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, ] cudart = [ @@ -322,7 +325,7 @@ curand = [ { name = "nvidia-curand", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, ] cusolver = [ - { name = "nvidia-cublas", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, + { name = "nvidia-cublas" }, { name = "nvidia-cusolver", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, { name = "nvidia-cusparse", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, { name = "nvidia-nvjitlink", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, @@ -767,14 +770,14 @@ wheels = [ [[package]] name = "nvidia-cublas" -version = "13.4.1.3" +version = "13.6.1.10" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "nvidia-cuda-nvrtc" }, ] wheels = [ - { url = "https://files.pythonhosted.org/packages/d0/a0/5cd9d4b08a8320f7ca150ee0d66c97e98092922e338336cb4b62da7500c3/nvidia_cublas-13.4.1.3-py3-none-manylinux_2_27_aarch64.whl", hash = "sha256:4eb1472bf92b741e7cf24da7978dde251b58ddec2092d9f6a04f3623eb4e9a15", size = 513048232, upload-time = "2026-07-16T09:45:07.751Z" }, - { url = "https://files.pythonhosted.org/packages/e1/97/d483a41da34df5c88727c57319576967f6d7befba5028d70928d2999635e/nvidia_cublas-13.4.1.3-py3-none-manylinux_2_27_x86_64.whl", hash = "sha256:a5917cb642cfb07f4a0231ee16aec7e2e0357d8cb8b1b78a0c9c68dba3e6afc7", size = 404870805, upload-time = "2026-07-16T09:46:05.62Z" }, + { url = "https://files.pythonhosted.org/packages/42/51/a174a0e79793e528ef4645a9d554e3aa48fd8da3f9c9cf523c0176bb121b/nvidia_cublas-13.6.1.10-py3-none-manylinux_2_27_aarch64.whl", hash = "sha256:e05a431062a17cb9b02e2f37e67817b637051ce8fad57b388482c594396ddbb4", size = 518610411, upload-time = "2026-07-30T18:18:32.969Z" }, + { url = "https://files.pythonhosted.org/packages/dd/e9/288a93d8234b8f8ea0ccac7b8cc5d7aa4c663d9676c64f4a2eb3a1f9ffc4/nvidia_cublas-13.6.1.10-py3-none-manylinux_2_27_x86_64.whl", hash = "sha256:feb2ed8a1e211bc5774413efc0f1a08c4d5269b56f68b4ac6fe5408e57f7dc1c", size = 410475904, upload-time = "2026-07-30T18:19:26.388Z" }, ] [[package]]