[PR #4406] [Engine] build v0.2.7 with nvcc 12.0: leave out the opt-in WideBatch prefill kernels (kernel parameters over 4096 bytes) #5035

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4406
Author: @nomishbhardwaj
Created: 10/28/2026
Status: 🔄 Open

Base: main ← Head: fix/cuda120-prefill-wide-params


📝 Commits (1)

  • 6d81f39 prefill fused IQ: build with nvcc 12.0 (kernel parameters over 4096 bytes)

📊 Changes

1 file changed (+22 additions, -0 deletions)

View changed files

📝 src/prefill/moe_fused_iq.cu (+22 -0)

📄 Description

Problem and result

v0.2.7 (5e8a4cca) no longer compiles with nvcc 12.0. src/prefill/moe_fused_iq.cu fails for every WideBatch instance of native_kernel (NT = 256) and native_ws_kernel:

src/prefill/moe_fused_iq.cu(565): Error: Formal parameter space overflowed (4216 bytes required, max 4096 bytes allowed) in function ..._native_kernelILi16ELb1ELi2ELi256ELb1EE...
src/prefill/moe_fused_iq.cu(908): Error: Formal parameter space overflowed (4216 bytes required, max 4096 bytes allowed) in function ..._native_ws_kernelILi16ELb1EE...

nvcc before 12.1 caps kernel parameters at 4096 bytes; 12.1 raised the limit to 32764. The WideBatch + NativeGeom + Tables parameters of these kernels take 4216. setup.sh --setup --build stops and keeps the previous engine binary. v0.2.6 built fine on the same machine. This is the same class as #2322 / #3368 (CUDA 12.0/12.1 builds), in a new file.

With this change, v0.2.7 builds and runs with nvcc 12.0.140. The default prefill kernels are unchanged. Only the opt-in WideBatch kernels (STRATA_PF_FUSED_NT=256, STRATA_PF_FUSED_F16=1, STRATA_PF_FUSED_WS=1) are left out of such a build. Asking for them prints the existing "... is not available here" line and the engine keeps the default path.

none (focused build fix)

Approach

STRATA_PF_WIDE_PARAMS is 0 when compiling with nvcc older than 12.1 (__CUDACC_VER_MAJOR__ / __CUDACC_VER_MINOR__) and 1 otherwise. It is defined outside the CUDA-only host block, so HIP and nvcc 12.1+ builds see 1 and compile exactly as before. When it is 0:

  • setup_nt() and setup_ws() return false, so occ_nt stays 0 and ws stays false. native_wide() is false, and the wide launch() overload is never reached.
  • The wide launch() body is compiled out, so the WideBatch instances are never instantiated.

I picked this over shrinking the parameter block (moving Tables or WideBatch to constant memory or behind a pointer) because that would change the default kernels and their launch path for every toolchain. Older toolkits only lose opt-in kernels.

Validation

Passed:

  • Build: ./setup.sh --setup --build --yes --no-start --model IQ2_XS --vision gpu on v0.2.7 + this commit. Ubuntu 24.04, nvcc 12.0.140 (Ubuntu nvidia-cuda-toolkit), driver 580.159.03, RTX 3090 (sm_86), i7-10700F, 62 GB RAM. engine/strata --version reports strata 0.1.52, BUILD.json archs [86]. The same build without this commit fails with the errors above.
  • Opt-in fallback: Qwen3.8-Flash-Next GSQ-RCO IQ2_XS, 262144 context, int8 KV with --kv-resident 32768. One server life per setting, with STRATA_PF_FUSED_NT=256, STRATA_PF_FUSED_WS=1 and STRATA_PF_FUSED_F16=1 each set alone. The log prints prefill fused experts (native): STRATA_PF_FUSED_NT=256 is not available here, and ... STRATA_PF_FUSED_WS=1 is not available here. In each setting, 8 greedy prompts (160 tokens, one with a ~3K-token prompt) gave output byte-identical to the default setting.
  • Same model and config, as a regression check against v0.2.6 (engine 0.1.51) on the same machine:
    • needle bench 12/12 at 1K/32K/128K/250K and depth 10/50/90 % (tools/needle_bench.py)
    • a 266-item local arithmetic/retrieval/instruction suite: 253/266 vs 258/266 on 0.1.51. The spiral-prone categories were re-run twice per version in alternating order: 104/135 vs 110/135 pooled, Fisher p 0.45, so within run-to-run spread.
    • tool calls 6/7 on both versions (the same item fails on both)
    • vision colours + OCR exact
    • decode at depth 0 / 32K / 123K 128.2 / 122.0 / 116.0 tok/s vs 126.5 / 123.7 / 115.2 on 0.1.51 (3 fresh engine starts each, 300 W cap)

Failed:
none observed

Not run:

  • nvcc 12.1 or newer, HIP and SYCL builds. The macro evaluates to 1 there, so the code is token-for-token unchanged, but I did not compile it.
  • tests/cuda/prefill_fused_iq_test (I built with STRATA_BUILD_TESTS=OFF).
  • The WideBatch kernels themselves, since this toolchain cannot compile them.

Limits

A build with nvcc 12.0 has no STRATA_PF_FUSED_NT=256 / _F16 / _WS. Getting them back on 12.0 would need the parameter block below 4096 bytes. If you would rather do that, or drop 12.0 support, I'm happy to close this.


🔄 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/4406 **Author:** [@nomishbhardwaj](https://github.com/nomishbhardwaj) **Created:** 10/28/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/cuda120-prefill-wide-params` --- ### 📝 Commits (1) - [`6d81f39`](https://github.com/Niko1221/Strata/commit/6d81f3979f023d266f4718ee417b8faf62b12d2d) prefill fused IQ: build with nvcc 12.0 (kernel parameters over 4096 bytes) ### 📊 Changes **1 file changed** (+22 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/prefill/moe_fused_iq.cu` (+22 -0) </details> ### 📄 Description ## Problem and result v0.2.7 (`5e8a4cca`) no longer compiles with nvcc 12.0. `src/prefill/moe_fused_iq.cu` fails for every WideBatch instance of `native_kernel` (NT = 256) and `native_ws_kernel`: ``` src/prefill/moe_fused_iq.cu(565): Error: Formal parameter space overflowed (4216 bytes required, max 4096 bytes allowed) in function ..._native_kernelILi16ELb1ELi2ELi256ELb1EE... src/prefill/moe_fused_iq.cu(908): Error: Formal parameter space overflowed (4216 bytes required, max 4096 bytes allowed) in function ..._native_ws_kernelILi16ELb1EE... ``` nvcc before 12.1 caps kernel parameters at 4096 bytes; 12.1 raised the limit to 32764. The `WideBatch` + `NativeGeom` + `Tables` parameters of these kernels take 4216. `setup.sh --setup --build` stops and keeps the previous engine binary. v0.2.6 built fine on the same machine. This is the same class as #2322 / #3368 (CUDA 12.0/12.1 builds), in a new file. With this change, v0.2.7 builds and runs with nvcc 12.0.140. The default prefill kernels are unchanged. Only the opt-in WideBatch kernels (`STRATA_PF_FUSED_NT=256`, `STRATA_PF_FUSED_F16=1`, `STRATA_PF_FUSED_WS=1`) are left out of such a build. Asking for them prints the existing "... is not available here" line and the engine keeps the default path. ## Related discussion none (focused build fix) ## Approach `STRATA_PF_WIDE_PARAMS` is 0 when compiling with nvcc older than 12.1 (`__CUDACC_VER_MAJOR__` / `__CUDACC_VER_MINOR__`) and 1 otherwise. It is defined outside the CUDA-only host block, so HIP and nvcc 12.1+ builds see 1 and compile exactly as before. When it is 0: - `setup_nt()` and `setup_ws()` return false, so `occ_nt` stays 0 and `ws` stays false. `native_wide()` is false, and the wide `launch()` overload is never reached. - The wide `launch()` body is compiled out, so the WideBatch instances are never instantiated. I picked this over shrinking the parameter block (moving `Tables` or `WideBatch` to constant memory or behind a pointer) because that would change the default kernels and their launch path for every toolchain. Older toolkits only lose opt-in kernels. ## Validation **Passed:** - Build: `./setup.sh --setup --build --yes --no-start --model IQ2_XS --vision gpu` on v0.2.7 + this commit. Ubuntu 24.04, nvcc 12.0.140 (Ubuntu `nvidia-cuda-toolkit`), driver 580.159.03, RTX 3090 (sm_86), i7-10700F, 62 GB RAM. `engine/strata --version` reports `strata 0.1.52`, BUILD.json archs [86]. The same build without this commit fails with the errors above. - Opt-in fallback: Qwen3.8-Flash-Next GSQ-RCO IQ2_XS, 262144 context, int8 KV with `--kv-resident 32768`. One server life per setting, with `STRATA_PF_FUSED_NT=256`, `STRATA_PF_FUSED_WS=1` and `STRATA_PF_FUSED_F16=1` each set alone. The log prints `prefill fused experts (native): STRATA_PF_FUSED_NT=256 is not available here`, and `... STRATA_PF_FUSED_WS=1 is not available here`. In each setting, 8 greedy prompts (160 tokens, one with a ~3K-token prompt) gave output byte-identical to the default setting. - Same model and config, as a regression check against v0.2.6 (engine 0.1.51) on the same machine: - needle bench 12/12 at 1K/32K/128K/250K and depth 10/50/90 % (`tools/needle_bench.py`) - a 266-item local arithmetic/retrieval/instruction suite: 253/266 vs 258/266 on 0.1.51. The spiral-prone categories were re-run twice per version in alternating order: 104/135 vs 110/135 pooled, Fisher p 0.45, so within run-to-run spread. - tool calls 6/7 on both versions (the same item fails on both) - vision colours + OCR exact - decode at depth 0 / 32K / 123K 128.2 / 122.0 / 116.0 tok/s vs 126.5 / 123.7 / 115.2 on 0.1.51 (3 fresh engine starts each, 300 W cap) **Failed:** none observed **Not run:** - nvcc 12.1 or newer, HIP and SYCL builds. The macro evaluates to 1 there, so the code is token-for-token unchanged, but I did not compile it. - `tests/cuda/prefill_fused_iq_test` (I built with `STRATA_BUILD_TESTS=OFF`). - The WideBatch kernels themselves, since this toolchain cannot compile them. ## Limits A build with nvcc 12.0 has no `STRATA_PF_FUSED_NT=256` / `_F16` / `_WS`. Getting them back on 12.0 would need the parameter block below 4096 bytes. If you would rather do that, or drop 12.0 support, I'm happy to close this. --- <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#5035
No description provided.