[GH-ISSUE #479] Pascal (sm_61) build fails in v1.1.27: set_mix_kernel exceeds the 4 KB kernel-parameter limit ("Formal parameter space overflowed") #193

Closed
opened 2026-10-29 21:22:24 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @autemetry-james on GitHub (Oct 25, 2026).
Original GitHub issue: https://github.com/mw00/project-maya/issues/479

On a Tesla P40, ./setup.sh on v1.1.27 stops in step 4 (the engine build). Since v1.1.14 the setup accepts Pascal,
but the EXL3 mixed-layer kernel no longer builds there.

Setup

  • Maya v1.1.27 (4615f34), ./setup.sh --plain --yes --download-model --model Maya-S24 --gpu 0 --context 32768 --no-vision
  • 1x Tesla P40 (sm_61), driver 580.178.04, CUDA 12.9.86, g++ 14.2.0, Debian 13
  • CMake configures -arch=native and adds -Xptxas -dlcm=ca as expected

Error (6 instantiations, all set_mix_kernel<cb, gate_up>):

src/kernels/cuda/exl3.cu(1430): Error: Formal parameter space overflowed (5828 bytes required, max 4096 bytes allowed)
in function ..._ZN6strata7kernels4exl3...14set_mix_kernelILi0ELb1EEEvNS1_7SetArgsENS2_4KMixEPKfiPKiPtiPfi
ninja: build stopped: subcommand failed.

The setup's automatic retry fails in the same place.

Cause (as far as I can tell): set_mix_kernel takes SetArgs and KMix (~1.8 KB for 32 classes) by value, which
comes to 5,828 bytes of parameters. CUDA 12.1+ allows 32,764 bytes on Volta and newer but still 4,096 on Pascal. The
mixed-layer path seems to have arrived after Pascal support (#212 / v1.1.14), so a 6.x build hadn't hit it yet.
wmma_set_mix_kernel has the same signature but is only instantiated under STRATA_USE_HIP.

Local workaround (works for GGUF models): leave the kernel out of Pascal builds. EXL3 quants aren't offered on
Pascal anyway. The CMake Pascal branch adds add_compile_definitions(MAYA_NO_EXL3_MIX); in exl3.cu the
set_mix_kernel template and its two launches in set_gate_up / set_down go inside #if !defined(MAYA_NO_EXL3_MIX),
with an error message in the #else. The full diff is 12 lines (below). With it, the engine builds and Maya-S24 runs:
6.4 tok/s decode and 162 / 203 tok/s prefill (2k / 8k) on one P40 (speed report to follow separately).

A cleaner fix might be to pass KMix through device or constant memory (or by pointer), so the kernel builds
everywhere, or to guard on the architecture as above.

Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ec314a4..19ab0ff 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -104,6 +104,7 @@ if(STRATA_ENABLE_CUDA)
     if(_base MATCHES "^6[0-9]$")
       string(APPEND CMAKE_CUDA_FLAGS " -Xptxas -dlcm=ca")
       message(STATUS "Maya: Pascal (sm_${_base}): global loads cached in L1 (-Xptxas -dlcm=ca)")
+      add_compile_definitions(MAYA_NO_EXL3_MIX)
       break()
     endif()
   endforeach()
diff --git a/src/kernels/cuda/exl3.cu b/src/kernels/cuda/exl3.cu
index e8a9544..bff5195 100644
--- a/src/kernels/cuda/exl3.cu
+++ b/src/kernels/cuda/exl3.cu
@@ -1426,6 +1426,7 @@ __global__ void __launch_bounds__(kThreads) hip_set_kernel(SetArgs a, const floa
 }
 
 // hip_set_kernel for a mixed-precision layer: expert e's blob at a.eptr[e], each part at its class's K
+#if !defined(MAYA_NO_EXL3_MIX)
 template <int cb, bool gate_up>
 __global__ void __launch_bounds__(kThreads) set_mix_kernel(SetArgs a, KMix mx, const float* x, int ldx,
                                                         const int* idx, uint16_t* h, int ldh,
@@ -1476,6 +1477,7 @@ __global__ void __launch_bounds__(kThreads) set_mix_kernel(SetArgs a, KMix mx, c
                       y + (size_t) (row + warp) * ldy + g * kCols);
     }
 }
+#endif
 
 // ---------------------------------------------------------------- the prompt path on RDNA 3's matrix cores
 // gfx11's v_wmma_f32_16x16x16_f16: hip_set_kernel's work with NR (16 or 32) routed rows a block - each weight tile
@@ -2325,12 +2327,16 @@ void set_gate_up(const SetArgs& sa, const float* x, int ldx, const int* row_idx,
             return;
         }
 #endif
+#if !defined(MAYA_NO_EXL3_MIX)
         mix_launch(sa.mix, [&](auto cb) {
             set_mix_kernel<decltype(cb)::value, true>
                 <<<dim3((sa.max_rows + kTok - 1) / kTok, sa.n_ff / kCols, sa.n_exp), kThreads, 0, s>>>(
                     sa, k, x, ldx, row_idx, h16, ldh, nullptr, 0);
         });
         launch_check("set_gate_up (mixed)");
+#else
+        std::fprintf(stderr, "exl3 set_gate_up: mixed EXL3 layers are not built for Pascal\n");
+#endif
         return;
     }
 #if !defined(STRATA_USE_HIP)
@@ -2408,12 +2414,16 @@ void set_down(const SetArgs& sa, const uint16_t* h16, int ldh, float* y, int ldy
             return;
         }
 #endif
+#if !defined(MAYA_NO_EXL3_MIX)
         mix_launch(sa.mix, [&](auto cb) {
             set_mix_kernel<decltype(cb)::value, false>
                 <<<dim3((sa.max_rows + kTok - 1) / kTok, sa.n_embd / kCols, sa.n_exp), kThreads, 0, s>>>(
                     sa, k, nullptr, 0, nullptr, const_cast<uint16_t*>(h16), ldh, y, ldy);
         });
         launch_check("set_down (mixed)");
+#else
+        std::fprintf(stderr, "exl3 set_down: mixed EXL3 layers are not built for Pascal\n");
+#endif
         return;
     }
 #if !defined(STRATA_USE_HIP)
Originally created by @autemetry-james on GitHub (Oct 25, 2026). Original GitHub issue: https://github.com/mw00/project-maya/issues/479 On a Tesla P40, `./setup.sh` on v1.1.27 stops in step 4 (the engine build). Since v1.1.14 the setup accepts Pascal, but the EXL3 mixed-layer kernel no longer builds there. **Setup** - Maya v1.1.27 (`4615f34`), `./setup.sh --plain --yes --download-model --model Maya-S24 --gpu 0 --context 32768 --no-vision` - 1x Tesla P40 (sm_61), driver 580.178.04, CUDA 12.9.86, g++ 14.2.0, Debian 13 - CMake configures `-arch=native` and adds `-Xptxas -dlcm=ca` as expected **Error** (6 instantiations, all `set_mix_kernel<cb, gate_up>`): ``` src/kernels/cuda/exl3.cu(1430): Error: Formal parameter space overflowed (5828 bytes required, max 4096 bytes allowed) in function ..._ZN6strata7kernels4exl3...14set_mix_kernelILi0ELb1EEEvNS1_7SetArgsENS2_4KMixEPKfiPKiPtiPfi ninja: build stopped: subcommand failed. ``` The setup's automatic retry fails in the same place. **Cause (as far as I can tell):** `set_mix_kernel` takes `SetArgs` and `KMix` (~1.8 KB for 32 classes) by value, which comes to 5,828 bytes of parameters. CUDA 12.1+ allows 32,764 bytes on Volta and newer but still 4,096 on Pascal. The mixed-layer path seems to have arrived after Pascal support (#212 / v1.1.14), so a 6.x build hadn't hit it yet. `wmma_set_mix_kernel` has the same signature but is only instantiated under `STRATA_USE_HIP`. **Local workaround (works for GGUF models):** leave the kernel out of Pascal builds. EXL3 quants aren't offered on Pascal anyway. The CMake Pascal branch adds `add_compile_definitions(MAYA_NO_EXL3_MIX)`; in `exl3.cu` the `set_mix_kernel` template and its two launches in `set_gate_up` / `set_down` go inside `#if !defined(MAYA_NO_EXL3_MIX)`, with an error message in the `#else`. The full diff is 12 lines (below). With it, the engine builds and Maya-S24 runs: 6.4 tok/s decode and 162 / 203 tok/s prefill (2k / 8k) on one P40 (speed report to follow separately). A cleaner fix might be to pass `KMix` through device or constant memory (or by pointer), so the kernel builds everywhere, or to guard on the architecture as above. <details><summary>Diff</summary> ```diff diff --git a/CMakeLists.txt b/CMakeLists.txt index ec314a4..19ab0ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,6 +104,7 @@ if(STRATA_ENABLE_CUDA) if(_base MATCHES "^6[0-9]$") string(APPEND CMAKE_CUDA_FLAGS " -Xptxas -dlcm=ca") message(STATUS "Maya: Pascal (sm_${_base}): global loads cached in L1 (-Xptxas -dlcm=ca)") + add_compile_definitions(MAYA_NO_EXL3_MIX) break() endif() endforeach() diff --git a/src/kernels/cuda/exl3.cu b/src/kernels/cuda/exl3.cu index e8a9544..bff5195 100644 --- a/src/kernels/cuda/exl3.cu +++ b/src/kernels/cuda/exl3.cu @@ -1426,6 +1426,7 @@ __global__ void __launch_bounds__(kThreads) hip_set_kernel(SetArgs a, const floa } // hip_set_kernel for a mixed-precision layer: expert e's blob at a.eptr[e], each part at its class's K +#if !defined(MAYA_NO_EXL3_MIX) template <int cb, bool gate_up> __global__ void __launch_bounds__(kThreads) set_mix_kernel(SetArgs a, KMix mx, const float* x, int ldx, const int* idx, uint16_t* h, int ldh, @@ -1476,6 +1477,7 @@ __global__ void __launch_bounds__(kThreads) set_mix_kernel(SetArgs a, KMix mx, c y + (size_t) (row + warp) * ldy + g * kCols); } } +#endif // ---------------------------------------------------------------- the prompt path on RDNA 3's matrix cores // gfx11's v_wmma_f32_16x16x16_f16: hip_set_kernel's work with NR (16 or 32) routed rows a block - each weight tile @@ -2325,12 +2327,16 @@ void set_gate_up(const SetArgs& sa, const float* x, int ldx, const int* row_idx, return; } #endif +#if !defined(MAYA_NO_EXL3_MIX) mix_launch(sa.mix, [&](auto cb) { set_mix_kernel<decltype(cb)::value, true> <<<dim3((sa.max_rows + kTok - 1) / kTok, sa.n_ff / kCols, sa.n_exp), kThreads, 0, s>>>( sa, k, x, ldx, row_idx, h16, ldh, nullptr, 0); }); launch_check("set_gate_up (mixed)"); +#else + std::fprintf(stderr, "exl3 set_gate_up: mixed EXL3 layers are not built for Pascal\n"); +#endif return; } #if !defined(STRATA_USE_HIP) @@ -2408,12 +2414,16 @@ void set_down(const SetArgs& sa, const uint16_t* h16, int ldh, float* y, int ldy return; } #endif +#if !defined(MAYA_NO_EXL3_MIX) mix_launch(sa.mix, [&](auto cb) { set_mix_kernel<decltype(cb)::value, false> <<<dim3((sa.max_rows + kTok - 1) / kTok, sa.n_embd / kCols, sa.n_exp), kThreads, 0, s>>>( sa, k, nullptr, 0, nullptr, const_cast<uint16_t*>(h16), ldh, y, ldy); }); launch_check("set_down (mixed)"); +#else + std::fprintf(stderr, "exl3 set_down: mixed EXL3 layers are not built for Pascal\n"); +#endif return; } #if !defined(STRATA_USE_HIP) ``` </details>
Author
Owner

@mw00 commented on GitHub (Oct 27, 2026):

Thank you for the exact diagnosis and the workaround. v1.1.30 fixes it at the source: set_mix_kernel now takes only the six fields of SetArgs it reads instead of the whole struct, so its parameters are about 1.9 KB instead of 5.8 KB and it compiles for Pascal again. Nothing is stubbed out. On V100 and newer the kernel's results are bit-identical to v1.1.29 (we compared the output bits of the mixed-layer test). In an sm_61 build, v1.1.29's exl3.cu stops with your exact error, while v1.1.30's compiles and the GLM engine (maya) links. You can drop the local patch after updating; a quick note on how the P40 build goes would be welcome.

<!-- gh-comment-id:6436261318 --> @mw00 commented on GitHub (Oct 27, 2026): Thank you for the exact diagnosis and the workaround. v1.1.30 fixes it at the source: `set_mix_kernel` now takes only the six fields of `SetArgs` it reads instead of the whole struct, so its parameters are about 1.9 KB instead of 5.8 KB and it compiles for Pascal again. Nothing is stubbed out. On V100 and newer the kernel's results are bit-identical to v1.1.29 (we compared the output bits of the mixed-layer test). In an sm_61 build, v1.1.29's `exl3.cu` stops with your exact error, while v1.1.30's compiles and the GLM engine (`maya`) links. You can drop the local patch after updating; a quick note on how the P40 build goes would be welcome.
Sign in to join this conversation.
No labels
pull-request
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
mw00/project-maya#193
No description provided.