[PR #4376] [Engine] dsv41: the WMMA expert kernels compile on pre-Volta cards #5027

Open
opened 2026-11-07 16:32:08 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4376
Author: @lyesrock
Created: 10/27/2026
Status: 🔄 Open

Base: main ← Head: feature/dsv41-pascal-sm61


📝 Commits (1)

  • 5484f76 DeepSeek engine: the WMMA expert kernels compile on Pascal and other pre-Volta cards - crt/mma.h declares nvcuda::wmma only for sm_70+, so the wmma bodies of mx_set_tc_kernel and set_tc_kernel sit under an CUDA_ARCH >= 700 guard inside the kernel (the device passes below 700 compile an empty one, the same guard as src/prefill/gdn_chunk.cu's); tc_ok() already keeps those cards on the F32 paths, so answers are unchanged; builds strata-dsv41 on sm_61 (2x Tesla P40)

📊 Changes

2 files changed (+15 additions, -6 deletions)

View changed files

📝 src/dsv41/ds4_gguf.cu (+9 -4)
📝 src/dsv41/ds4_iq.cu (+6 -2)

📄 Description

Problem and result

The DeepSeek-V4.1 engine (strata-dsv41) does not compile on pre-Volta cards: mx_set_tc_kernel (src/dsv41/ds4_gguf.cu) and set_tc_kernel (src/dsv41/ds4_iq.cu) name nvcuda::wmma with no arch guard, and crt/mma.h declares those names only for __CUDA_ARCH__ >= 700. On sm_61 (e.g. 2x Tesla P40) the build fails on the nvcuda::wmma declarations before producing any binary. With this change the same source builds on sm_61 and the engine starts and answers there.

none

Approach

The wmma body of the two kernels sits under #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 700 inside the kernel, so device passes below sm_70 compile an empty one; the namespace wm alias and the kLdT constant move inside the guard. This is the pattern src/prefill/gemm.cu and src/prefill/gdn_chunk.cu already use. No values change: tc_ok() (ds4_gguf.cu, ds4_iq.cu) already keeps cards below sm_70 on the F32 kernels (mx_set_kernel, set_kernel), so the tensor-core kernels are never launched there. It is a compilation fix, not a perf change.

Validation

All runs ours, one box: 2x Tesla P40 (sm_61), Xeon E5-2620 v4, 92 GiB RAM, Linux; revision 9e0a7319 (this branch, rebased on 5e8a4cca).

Passed:

  • sm_61 build, CUDA 12.9 + gcc-14: cmake -G Ninja -S . -B build-dsv41-sm61 -DCMAKE_BUILD_TYPE=Release -DSTRATA_ENABLE_CUDA=ON -DSTRATA_BUILD_TESTS=OFF -DSTRATA_BUILD_DSV41=ON -DSTRATA_EXPERIMENTAL_SM60=ON -DSTRATA_NATIVE_EXPERTS=ON -DSTRATA_PORTABLE=ON -DCMAKE_CUDA_ARCHITECTURES=61 -DCMAKE_CUDA_COMPILER=/usr/local/cuda-12.9/bin/nvcc -DCUDAToolkit_ROOT=/usr/local/cuda-12.9 -DSTRATA_GGML_DIR=third_party/llama.cpp '-DCMAKE_INSTALL_RPATH=$ORIGIN' then ninja -C build-dsv41-sm61 strata-dsv41: links with 0 errors; build-dsv41-sm61/strata-dsv41 --version prints strata-dsv41 0.1.52 build 9e0a73199.
  • sm_89 build (the normal path, guard compiles the full wmma body), CUDA 13.0: same cmake with -DCMAKE_CUDA_ARCHITECTURES=89-real -DCMAKE_CUDA_COMPILER=/usr/local/cuda-13.0/bin/nvcc -DCUDAToolkit_ROOT=/usr/local/cuda-13.0 (no STRATA_EXPERIMENTAL_SM60) then ninja ... strata-dsv41: links with 0 errors.
  • Smoke test on the P40s with the sm_61 binary, pack deepseek-v4.1-flash-ist-das-2.25bpw, context 16384, --tp 2: one OpenAI chat request (temperature 0, max_tokens 64) answered "The capital of France is Paris." Coherent output: compilable and functional, not a speed measurement.

Failed: none observed. (The same sm_61 build without the guard is the failure described under Problem and result: nvcuda::wmma is not declared by crt/mma.h below sm_70.)

Not run: HIP and SYCL builds (the touched code sits inside #if !defined(STRATA_USE_HIP), CUDA only); speed measurements (the guarded kernels are never launched on these cards, so nothing measurable changes); a real sm_70 card (the guard covers it, none at hand).

Limits

On a device pass below sm_70 the two kernels compile to empty bodies; launching one there would be a silent no-op, but tc_ok() keeps those cards on the F32 paths, so that launch cannot happen. Running the pack on 2x P40 stays bound by the rules and memory bandwidth of a Pascal box; this PR only makes the build possible.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4376 **Author:** [@lyesrock](https://github.com/lyesrock) **Created:** 10/27/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feature/dsv41-pascal-sm61` --- ### 📝 Commits (1) - [`5484f76`](https://github.com/Niko1221/Strata/commit/5484f76e94a2ba601c49ccd19c71ec4c846a7c41) DeepSeek engine: the WMMA expert kernels compile on Pascal and other pre-Volta cards - crt/mma.h declares nvcuda::wmma only for sm_70+, so the wmma bodies of mx_set_tc_kernel and set_tc_kernel sit under an __CUDA_ARCH__ >= 700 guard inside the kernel (the device passes below 700 compile an empty one, the same guard as src/prefill/gdn_chunk.cu's); tc_ok() already keeps those cards on the F32 paths, so answers are unchanged; builds strata-dsv41 on sm_61 (2x Tesla P40) ### 📊 Changes **2 files changed** (+15 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `src/dsv41/ds4_gguf.cu` (+9 -4) 📝 `src/dsv41/ds4_iq.cu` (+6 -2) </details> ### 📄 Description ## Problem and result The DeepSeek-V4.1 engine (`strata-dsv41`) does not compile on pre-Volta cards: `mx_set_tc_kernel` (`src/dsv41/ds4_gguf.cu`) and `set_tc_kernel` (`src/dsv41/ds4_iq.cu`) name `nvcuda::wmma` with no arch guard, and `crt/mma.h` declares those names only for `__CUDA_ARCH__ >= 700`. On sm_61 (e.g. 2x Tesla P40) the build fails on the `nvcuda::wmma` declarations before producing any binary. With this change the same source builds on sm_61 and the engine starts and answers there. ## Related discussion none ## Approach The wmma body of the two kernels sits under `#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 700` inside the kernel, so device passes below sm_70 compile an empty one; the `namespace wm` alias and the `kLdT` constant move inside the guard. This is the pattern `src/prefill/gemm.cu` and `src/prefill/gdn_chunk.cu` already use. No values change: `tc_ok()` (`ds4_gguf.cu`, `ds4_iq.cu`) already keeps cards below sm_70 on the F32 kernels (`mx_set_kernel`, `set_kernel`), so the tensor-core kernels are never launched there. It is a compilation fix, not a perf change. ## Validation All runs ours, one box: 2x Tesla P40 (sm_61), Xeon E5-2620 v4, 92 GiB RAM, Linux; revision 9e0a7319 (this branch, rebased on 5e8a4cca). **Passed:** - sm_61 build, CUDA 12.9 + gcc-14: `cmake -G Ninja -S . -B build-dsv41-sm61 -DCMAKE_BUILD_TYPE=Release -DSTRATA_ENABLE_CUDA=ON -DSTRATA_BUILD_TESTS=OFF -DSTRATA_BUILD_DSV41=ON -DSTRATA_EXPERIMENTAL_SM60=ON -DSTRATA_NATIVE_EXPERTS=ON -DSTRATA_PORTABLE=ON -DCMAKE_CUDA_ARCHITECTURES=61 -DCMAKE_CUDA_COMPILER=/usr/local/cuda-12.9/bin/nvcc -DCUDAToolkit_ROOT=/usr/local/cuda-12.9 -DSTRATA_GGML_DIR=third_party/llama.cpp '-DCMAKE_INSTALL_RPATH=$ORIGIN'` then `ninja -C build-dsv41-sm61 strata-dsv41`: links with 0 errors; `build-dsv41-sm61/strata-dsv41 --version` prints `strata-dsv41 0.1.52 build 9e0a73199`. - sm_89 build (the normal path, guard compiles the full wmma body), CUDA 13.0: same cmake with `-DCMAKE_CUDA_ARCHITECTURES=89-real -DCMAKE_CUDA_COMPILER=/usr/local/cuda-13.0/bin/nvcc -DCUDAToolkit_ROOT=/usr/local/cuda-13.0` (no `STRATA_EXPERIMENTAL_SM60`) then `ninja ... strata-dsv41`: links with 0 errors. - Smoke test on the P40s with the sm_61 binary, pack `deepseek-v4.1-flash-ist-das-2.25bpw`, context 16384, `--tp 2`: one OpenAI chat request (`temperature 0`, `max_tokens 64`) answered "The capital of France is Paris." Coherent output: compilable and functional, not a speed measurement. **Failed:** none observed. (The same sm_61 build without the guard is the failure described under Problem and result: `nvcuda::wmma` is not declared by `crt/mma.h` below sm_70.) **Not run:** HIP and SYCL builds (the touched code sits inside `#if !defined(STRATA_USE_HIP)`, CUDA only); speed measurements (the guarded kernels are never launched on these cards, so nothing measurable changes); a real sm_70 card (the guard covers it, none at hand). ## Limits On a device pass below sm_70 the two kernels compile to empty bodies; launching one there would be a silent no-op, but `tc_ok()` keeps those cards on the F32 paths, so that launch cannot happen. Running the pack on 2x P40 stays bound by the rules and memory bandwidth of a Pascal box; this PR only makes the build possible. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#5027
No description provided.