[PR #4699] [CLOSED] [Engine] use fused grouped experts on DGX Spark #5140

Closed
opened 2026-11-07 16:33:00 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4699
Author: @InB4DevOps
Created: 10/30/2026
Status: ❌ Closed

Base: main ← Head: perf/sm121-fused-expert-mode8


📄 Description

Problem and result

DGX Spark's sm_121 decode path kept grouped native experts on mode 0 even though the existing mode 8 kernels reduce the dominant expert work on GB10. This change selects mode 8 by default only on sm_121 when the sm_121 performance defaults are enabled.

On one NVIDIA GB10, a fixed-work 512-token Qwen3.8-Flash-Next IQ3_S full-engine decode measured +11.69% paired median throughput and +11.23% geometric mean over eight balanced pairs, with 6/8 wins. Both execution orders exceeded 3% (AB +15.98% median, BA +10.04%). Every run had the same output hash and the same verifier work (T1:1 T4:124 T6:3); no errors or OOMs occurred.

Approach

Reuse the existing mode 8 grouped-expert implementation, which keeps each group's activations in shared memory and fuses SwiGLU and q8_1 work. No kernel arithmetic changes.

The selection is limited to compute capability 12.1 and preserves the existing controls:

  • STRATA_SM121_PERF=0 restores mode 0.
  • STRATA_DEFAULTS=026 restores mode 0.
  • Explicit STRATA_EXP_MODE remains the highest-priority override.
  • Other CUDA architectures keep their existing selection.

No matching open or closed issue/PR was found for sm_121 mode 8, fused experts, or DGX Spark q8_1 expert dispatch.

Performance validation

Environment: Linux 7.0.0-1019-nvidia aarch64, NVIDIA GB10 (sm_121), driver 580.178.04. Model: Qwen3.8-Flash-Next IQ3_S, 64K context, INT8 KV with 32K resident KV, MTP/speculation, all 24,576 experts resident, RAM PLE I/O, greedy output.

The fixed-work benchmark used base 870aedd9 plus a temporary measurement-only oracle-precedence change, with explicit STRATA_EXP_MODE=0 and 8. Mode 8's kernel code was unchanged by this PR; this PR only selects it on sm_121. MTP still ran while oracle drafts forced identical verifier work. The instrumentation was removed before this commit. Runs alternated AB/BA on the same day and binary. Throughput is decode tokens/s.

Each arm used this invocation, substituting 0 or 8 for MODE:

STRATA_SM121_PERF=1 STRATA_EXP_MODE=MODE STRATA_SPEC_T_CYCLE=4 \
  /tmp/opencode/strata_fullcache_expmode8_oraclebench \
  --pack /home/admin/.local/share/strata/Strata-data/packs/iq3_s \
  --tokens 1,2,3,4,5,6,7,8 \
  --native /home/admin/.local/share/strata/Strata-data/models/IQ3_S/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00001-of-00002.gguf \
  --ple-gguf /home/admin/.local/share/strata/Strata-data/models/IQ3_S/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00002-of-00002.gguf \
  --expert-profile /home/admin/.local/share/strata/terminal/0.1.54/data/expert-profile.bin \
  --expert-cache auto --prefill auto:32768 --spec 4 --spec-min-p 0.5 \
  --mtp /home/admin/.local/share/strata/Strata-data/mtp/rt \
  --max-context 65536 --kv int8 --mmap-experts --mtp-q4 all \
  --mtp-hnorm stream --ple-io ram --kv-resident 32768 --max-new 512 \
  --greedy --adapt-every 0 --spec-follow /tmp/opencode/iq3s_follow_512.txt \
  --spec-oracle /tmp/opencode/iq3s_follow_512.txt
Pair Mode 0 Mode 8 Change
1 78.59 61.39 -21.89%
2 64.91 70.47 +8.57%
3 64.08 76.95 +20.08%
4 78.61 58.40 -25.71%
5 51.23 81.66 +59.40%
6 45.38 70.67 +55.73%
7 66.30 74.17 +11.87%
8 66.78 74.47 +11.52%

On submitted commit 76c0aa60, focused G=90/T=4 expert measurements confirmed that automatic sm_121 dispatch selects mode 8 and remains bitwise equal:

Format Mode 0 Automatic Change
IQ2_S 860.4 us 797.2 us +7.9%
IQ3_XXS 1100.6 us 1148.7 us -4.2%
IQ3_S 1206.4 us 1171.9 us +2.9%
IQ4_XS 1234.5 us 1119.5 us +10.3%

The off switches reproduced mode 0 within ±0.4% and remained bitwise equal.

Validation

Passed

cmake --build build-spark --target native_expert_bench strata nv_defaults_test -j 20

CUDA production, benchmark, and defaults targets built successfully.

cmake -S . -B build-hip -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DSTRATA_ENABLE_HIP=ON \
  -DSTRATA_ENABLE_CUDA=OFF \
  -DSTRATA_BUILD_TESTS=OFF \
  -DCMAKE_HIP_ARCHITECTURES=gfx1100
cmake --build build-hip --target strata -j2

HIP engine compilation passed in the rocm/dev-ubuntu-24.04:10.1.0-full container on an x86_64 GitHub runner. The tested tree was submitted source commit 76c0aa60 plus only the disposable workflow file: Actions run 41050903589.

ctest --test-dir build-spark --output-on-failure \
  -R '^(nv_defaults_test|native_grouped_parity|native_multi_parity|verify_parity|spec_verify_parity)$'

5/5 tests passed.

git diff origin/main...HEAD --check

Passed.

Failed

cmake --build build-spark -j 20

The broad build reached an unrelated existing ARM configuration failure: mmq_nvfp4_parity passes unsupported -mf16c. The affected CUDA library and focused targets above built successfully.

The first disposable HIP CI attempt stopped before configuration because the ROCm container did not include CMake. After installing the standard build tools, the unchanged source passed in the linked run above.

Not run

HIP runtime execution was not run because no AMD GPU was available. The changed dispatch is gated to NVIDIA compute capability 12.1; no AMD runtime behavior is selected.

Limits

The default change applies only to measured sm_121 hardware. IQ3_XXS regressed 4.2% in the focused G=90/T=4 microbenchmark, while the mixed production IQ3_S model improved in the fixed-work full-engine test. No performance claim is made for other architectures or workloads.


🔄 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/4699 **Author:** [@InB4DevOps](https://github.com/InB4DevOps) **Created:** 10/30/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `perf/sm121-fused-expert-mode8` --- ### 📄 Description ## Problem and result DGX Spark's sm_121 decode path kept grouped native experts on mode 0 even though the existing mode 8 kernels reduce the dominant expert work on GB10. This change selects mode 8 by default only on sm_121 when the sm_121 performance defaults are enabled. On one NVIDIA GB10, a fixed-work 512-token Qwen3.8-Flash-Next IQ3_S full-engine decode measured **+11.69% paired median throughput** and **+11.23% geometric mean** over eight balanced pairs, with 6/8 wins. Both execution orders exceeded 3% (AB +15.98% median, BA +10.04%). Every run had the same output hash and the same verifier work (`T1:1 T4:124 T6:3`); no errors or OOMs occurred. ## Approach Reuse the existing mode 8 grouped-expert implementation, which keeps each group's activations in shared memory and fuses SwiGLU and q8_1 work. No kernel arithmetic changes. The selection is limited to compute capability 12.1 and preserves the existing controls: - `STRATA_SM121_PERF=0` restores mode 0. - `STRATA_DEFAULTS=026` restores mode 0. - Explicit `STRATA_EXP_MODE` remains the highest-priority override. - Other CUDA architectures keep their existing selection. No matching open or closed issue/PR was found for sm_121 mode 8, fused experts, or DGX Spark q8_1 expert dispatch. ## Performance validation Environment: Linux 7.0.0-1019-nvidia aarch64, NVIDIA GB10 (sm_121), driver 580.178.04. Model: Qwen3.8-Flash-Next IQ3_S, 64K context, INT8 KV with 32K resident KV, MTP/speculation, all 24,576 experts resident, RAM PLE I/O, greedy output. The fixed-work benchmark used base `870aedd9` plus a temporary measurement-only oracle-precedence change, with explicit `STRATA_EXP_MODE=0` and `8`. Mode 8's kernel code was unchanged by this PR; this PR only selects it on sm_121. MTP still ran while oracle drafts forced identical verifier work. The instrumentation was removed before this commit. Runs alternated AB/BA on the same day and binary. Throughput is decode tokens/s. Each arm used this invocation, substituting `0` or `8` for `MODE`: ```sh STRATA_SM121_PERF=1 STRATA_EXP_MODE=MODE STRATA_SPEC_T_CYCLE=4 \ /tmp/opencode/strata_fullcache_expmode8_oraclebench \ --pack /home/admin/.local/share/strata/Strata-data/packs/iq3_s \ --tokens 1,2,3,4,5,6,7,8 \ --native /home/admin/.local/share/strata/Strata-data/models/IQ3_S/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00001-of-00002.gguf \ --ple-gguf /home/admin/.local/share/strata/Strata-data/models/IQ3_S/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00002-of-00002.gguf \ --expert-profile /home/admin/.local/share/strata/terminal/0.1.54/data/expert-profile.bin \ --expert-cache auto --prefill auto:32768 --spec 4 --spec-min-p 0.5 \ --mtp /home/admin/.local/share/strata/Strata-data/mtp/rt \ --max-context 65536 --kv int8 --mmap-experts --mtp-q4 all \ --mtp-hnorm stream --ple-io ram --kv-resident 32768 --max-new 512 \ --greedy --adapt-every 0 --spec-follow /tmp/opencode/iq3s_follow_512.txt \ --spec-oracle /tmp/opencode/iq3s_follow_512.txt ``` | Pair | Mode 0 | Mode 8 | Change | |---:|---:|---:|---:| | 1 | 78.59 | 61.39 | -21.89% | | 2 | 64.91 | 70.47 | +8.57% | | 3 | 64.08 | 76.95 | +20.08% | | 4 | 78.61 | 58.40 | -25.71% | | 5 | 51.23 | 81.66 | +59.40% | | 6 | 45.38 | 70.67 | +55.73% | | 7 | 66.30 | 74.17 | +11.87% | | 8 | 66.78 | 74.47 | +11.52% | On submitted commit `76c0aa60`, focused G=90/T=4 expert measurements confirmed that automatic sm_121 dispatch selects mode 8 and remains bitwise equal: | Format | Mode 0 | Automatic | Change | |---|---:|---:|---:| | IQ2_S | 860.4 us | 797.2 us | +7.9% | | IQ3_XXS | 1100.6 us | 1148.7 us | -4.2% | | IQ3_S | 1206.4 us | 1171.9 us | +2.9% | | IQ4_XS | 1234.5 us | 1119.5 us | +10.3% | The off switches reproduced mode 0 within ±0.4% and remained bitwise equal. ## Validation ### Passed ```sh cmake --build build-spark --target native_expert_bench strata nv_defaults_test -j 20 ``` CUDA production, benchmark, and defaults targets built successfully. ```sh cmake -S . -B build-hip -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DSTRATA_ENABLE_HIP=ON \ -DSTRATA_ENABLE_CUDA=OFF \ -DSTRATA_BUILD_TESTS=OFF \ -DCMAKE_HIP_ARCHITECTURES=gfx1100 cmake --build build-hip --target strata -j2 ``` HIP engine compilation passed in the `rocm/dev-ubuntu-24.04:10.1.0-full` container on an x86_64 GitHub runner. The tested tree was submitted source commit `76c0aa60` plus only the disposable workflow file: [Actions run 41050903589](https://github.com/InB4DevOps/Strata/actions/runs/41050903589). ```sh ctest --test-dir build-spark --output-on-failure \ -R '^(nv_defaults_test|native_grouped_parity|native_multi_parity|verify_parity|spec_verify_parity)$' ``` 5/5 tests passed. ```sh git diff origin/main...HEAD --check ``` Passed. ### Failed ```sh cmake --build build-spark -j 20 ``` The broad build reached an unrelated existing ARM configuration failure: `mmq_nvfp4_parity` passes unsupported `-mf16c`. The affected CUDA library and focused targets above built successfully. The first disposable HIP CI attempt stopped before configuration because the ROCm container did not include CMake. After installing the standard build tools, the unchanged source passed in the linked run above. ### Not run HIP runtime execution was not run because no AMD GPU was available. The changed dispatch is gated to NVIDIA compute capability 12.1; no AMD runtime behavior is selected. ## Limits The default change applies only to measured sm_121 hardware. IQ3_XXS regressed 4.2% in the focused G=90/T=4 microbenchmark, while the mixed production IQ3_S model improved in the fixed-work full-engine test. No performance claim is made for other architectures or workloads. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:33:00 +07:00
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#5140
No description provided.