[PR #1742] [CLOSED] CUDA SM86: opt-in one-superblock prefetch build #3642

Closed
opened 2026-11-07 15:29:45 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: perf/cuda-prefill-prefetch-one


📝 Commits (3)

  • 93dcf97 CUDA prefill: opt-in one-superblock weight prefetch
  • fee8346 CUDA prefill: isolate SM86 prefetch behind a build option
  • fab43d0 setup: offer opt-in SM86 prefill builds

📊 Changes

16 files changed (+5674 additions, -16 deletions)

View changed files

📝 .gitignore (+4 -0)
📝 CMakeLists.txt (+14 -1)
📝 docs/DETAILS.md (+9 -0)
📝 docs/INSTALL.md (+5 -0)
➕ docs/INSTALL_SM86_PREFILL.md (+102 -0)
➕ docs/benchmarks/2026-10-09-rtx3060-prefetch-one/README.md (+133 -0)
➕ docs/benchmarks/2026-10-09-rtx3060-prefetch-one/cuda-only-evidence.json (+2016 -0)
➕ docs/benchmarks/2026-10-09-rtx3060-prefetch-one/cuda-only-parity.log (+369 -0)
➕ docs/benchmarks/2026-10-09-rtx3060-prefetch-one/evidence.json (+2014 -0)
➕ docs/benchmarks/2026-10-09-rtx3060-prefetch-one/isolated-parity.log (+227 -0)
➕ docs/benchmarks/2026-10-09-rtx3060-prefetch-one/prompts.json (+14 -0)
📝 setup.py (+166 -15)
➕ src/prefill/cuda/moe_fused_iq_prefetch_sm86.cu (+81 -0)
➕ src/prefill/cuda/native_fused_iq_sm86.cuh (+244 -0)
➕ tools/test_cuda_prefill_variant.py (+47 -0)
➕ tools/test_setup_sm86_prefill.py (+229 -0)

📄 Description

Summary

Add the off-by-default STRATA_CUDA_SM86_PREFETCH_ONE CMake option. With an
explicit CUDA architecture 86 target, it builds a CUDA-only specialization for the
existing native fused path. Runtime opt-in remains STRATA_PF_FUSED=1 STRATA_PF_PREFETCH_ONE=1.
Gate/up weights are prefetched one superblock ahead instead of two.

Updated scope: the initial draft edited shared CUDA/HIP source. That edit and
the shared C++ test change have now been completely reverted. The new translation
unit is selected only inside the CUDA CMake branch, with an additional runtime
SM86 check. HIP's implementation/build branch and SYCL's build remain unchanged;
there is no HIP change to build. Other CUDA devices use the original implementation.
SM86 includes more cards than the 3060; measurements remain 3060-specific. Windows
and other GPU hardware have not been tested.

What changed

Installer integration (separate commit fab43d04)

Eligible NVIDIA users now get an off-by-default setup question, or can use:

./setup.sh --setup --model IQ3_XXS --sm86-prefill prefetch-one
# Windows: START-HERE.bat --setup --model IQ3_XXS --sm86-prefill prefetch-one

Setup detects architecture 86 as before, selects the build option, bypasses plain
prebuilt engines, and writes the required fused/runtime settings. It keeps the
choice through starts and updates. Dedicated engine/build directories avoid
replacing another model's engine; the build metadata/cache includes the variant.
--sm86-prefill off returns to normal engine selection and restores the earlier
fused-path setting. --yes alone does not enable it. No manual CMake/env editing
is needed for installer users. Details: docs/INSTALL_SM86_PREFILL.md.

Installer validation: 98 relevant setup tests pass, including default-config
goldens, simulated Windows/Linux behavior, cache invalidation, opt-out, starts and
updates. Full setup discovery also found two existing checksum-caller test failures
from an unmocked HTTP HEAD/404; both reproduce on untouched fb58e0db and are not
introduced by this integration.

Kernel and measurement commits

  • CUDA-only kernel specialization for gate/up, reusing conversion/routing helpers
    and the fallback by including the unchanged original implementation. Down keeps
    its original instance. The specialized body must retain the original arithmetic.
  • A fresh-process numerical parity wrapper for six format pairs and both tile sizes.
  • Scoped benchmark report, exact public-source prompts, per-pair timing/output-hash
    evidence, and final isolated validation results.

No activation-stage, tile/grid, residency, decode, model/setup-default or HIP-kernel
policy change. This branch is independently based on fb58e0db and contains none
of the other experimental engine patches.

Measured evidence

RTX 3060 12 GB / 100 W, i7-12700KF AVX2, Linux, CUDA 13.4.92, native IQ3_XXS,
explicit 4096-token prefill and static residency. Six balanced pairs per realistic
prompt, 128 generated tokens:

Prompt Input tokens Median paired prompt-speed gain Faster pairs
Parser/test review 12,247 +0.548% 5/6
Runtime documentation 20,324 +0.813% 6/6
C++ prefill review 30,757 +0.802% 6/6

All 18 pairs had identical token IDs and draft counts, with within-arm repeatability.
Three independent fixed-work process pairs per shape gave +1.71–6.52% across
twelve format/size combinations; all 36 shape/process pairs were faster with matching hashes.

These are prototype measurements of the same policy, not inflated to represent
the separate MMQ-to-fused speedup. The isolated extraction's tests/smoke pairs are
reported separately. A/A controls had near-zero medians but individual outliers up
to about +/-1.5%; all outliers remain in the evidence. No broad GPU/model/default
or quality-equivalence claim is made.

Validation

  • CUDA SM86 Release: default-off build and opt-in build of strata and prefill_fused_iq_test.
  • Configuration rejects the opt-in without architecture 86 and rejects combining the two build variants.
  • Shared kernel/test files verified byte-identical to upstream; HIP CMake branch and SYCL build file unchanged.
  • Isolated off/on outputs: six formats × both tiles, plus prior disabled-build
    default-build fingerprint comparison; existing FP64/MMQ numerical checks retained.
  • Isolated two-pair whole-engine checks on the same three realistic prompts;
    token IDs, draft counts and repeatability checked.
  • git diff --check.
  • Non-SM86 dispatch predicate checked at compile time; other GPU hardware/Windows runtime untested.

Details and commands: docs/benchmarks/2026-10-09-rtx3060-prefetch-one/README.md.
Current validation: cuda-only-evidence.json and cuda-only-parity.log; historical
prototype/initial extraction: evidence.json and isolated-parity.log. Exact prompts are included.

The separate IQ3-only stage-buffering proposal (#1744) touches the same kernel but is not
a dependency. Combining the two opt-ins requires its own validation.


🔄 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/1742 **Author:** [@InB4DevOps](https://github.com/InB4DevOps) **Created:** 10/9/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `perf/cuda-prefill-prefetch-one` --- ### 📝 Commits (3) - [`93dcf97`](https://github.com/Niko1221/Strata/commit/93dcf974abd789e0076be11fe7fee7179ec3b33a) CUDA prefill: opt-in one-superblock weight prefetch - [`fee8346`](https://github.com/Niko1221/Strata/commit/fee8346617fcf6b5911d6e55acfee5fb833d8e52) CUDA prefill: isolate SM86 prefetch behind a build option - [`fab43d0`](https://github.com/Niko1221/Strata/commit/fab43d049ebb57a2cdac25ca34de7dcb089f4993) setup: offer opt-in SM86 prefill builds ### 📊 Changes **16 files changed** (+5674 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+4 -0) 📝 `CMakeLists.txt` (+14 -1) 📝 `docs/DETAILS.md` (+9 -0) 📝 `docs/INSTALL.md` (+5 -0) ➕ `docs/INSTALL_SM86_PREFILL.md` (+102 -0) ➕ `docs/benchmarks/2026-10-09-rtx3060-prefetch-one/README.md` (+133 -0) ➕ `docs/benchmarks/2026-10-09-rtx3060-prefetch-one/cuda-only-evidence.json` (+2016 -0) ➕ `docs/benchmarks/2026-10-09-rtx3060-prefetch-one/cuda-only-parity.log` (+369 -0) ➕ `docs/benchmarks/2026-10-09-rtx3060-prefetch-one/evidence.json` (+2014 -0) ➕ `docs/benchmarks/2026-10-09-rtx3060-prefetch-one/isolated-parity.log` (+227 -0) ➕ `docs/benchmarks/2026-10-09-rtx3060-prefetch-one/prompts.json` (+14 -0) 📝 `setup.py` (+166 -15) ➕ `src/prefill/cuda/moe_fused_iq_prefetch_sm86.cu` (+81 -0) ➕ `src/prefill/cuda/native_fused_iq_sm86.cuh` (+244 -0) ➕ `tools/test_cuda_prefill_variant.py` (+47 -0) ➕ `tools/test_setup_sm86_prefill.py` (+229 -0) </details> ### 📄 Description ## Summary Add the off-by-default **`STRATA_CUDA_SM86_PREFETCH_ONE` CMake option**. With an explicit CUDA architecture 86 target, it builds a CUDA-only specialization for the existing native fused path. Runtime opt-in remains `STRATA_PF_FUSED=1 STRATA_PF_PREFETCH_ONE=1`. Gate/up weights are prefetched one superblock ahead instead of two. **Updated scope:** the initial draft edited shared CUDA/HIP source. That edit and the shared C++ test change have now been completely reverted. The new translation unit is selected only inside the CUDA CMake branch, with an additional runtime SM86 check. HIP's implementation/build branch and SYCL's build remain unchanged; there is no HIP change to build. Other CUDA devices use the original implementation. SM86 includes more cards than the 3060; measurements remain 3060-specific. Windows and other GPU hardware have not been tested. ## What changed ### Installer integration (separate commit `fab43d04`) Eligible NVIDIA users now get an off-by-default setup question, or can use: ```sh ./setup.sh --setup --model IQ3_XXS --sm86-prefill prefetch-one # Windows: START-HERE.bat --setup --model IQ3_XXS --sm86-prefill prefetch-one ``` Setup detects architecture 86 as before, selects the build option, bypasses plain prebuilt engines, and writes the required fused/runtime settings. It keeps the choice through starts and updates. Dedicated engine/build directories avoid replacing another model's engine; the build metadata/cache includes the variant. `--sm86-prefill off` returns to normal engine selection and restores the earlier fused-path setting. `--yes` alone does not enable it. No manual CMake/env editing is needed for installer users. Details: `docs/INSTALL_SM86_PREFILL.md`. Installer validation: **98 relevant setup tests pass**, including default-config goldens, simulated Windows/Linux behavior, cache invalidation, opt-out, starts and updates. Full setup discovery also found two existing checksum-caller test failures from an unmocked HTTP HEAD/404; both reproduce on untouched `fb58e0db` and are not introduced by this integration. ### Kernel and measurement commits - CUDA-only kernel specialization for gate/up, reusing conversion/routing helpers and the fallback by including the unchanged original implementation. Down keeps its original instance. The specialized body must retain the original arithmetic. - A fresh-process numerical parity wrapper for six format pairs and both tile sizes. - Scoped benchmark report, exact public-source prompts, per-pair timing/output-hash evidence, and final isolated validation results. No activation-stage, tile/grid, residency, decode, model/setup-default or HIP-kernel policy change. This branch is independently based on `fb58e0db` and contains none of the other experimental engine patches. ## Measured evidence RTX 3060 **12 GB / 100 W**, i7-12700KF AVX2, Linux, CUDA 13.4.92, native IQ3_XXS, explicit 4096-token prefill and static residency. Six balanced pairs per realistic prompt, 128 generated tokens: | Prompt | Input tokens | Median paired prompt-speed gain | Faster pairs | |---|---:|---:|---:| | Parser/test review | 12,247 | +0.548% | 5/6 | | Runtime documentation | 20,324 | +0.813% | 6/6 | | C++ prefill review | 30,757 | +0.802% | 6/6 | All 18 pairs had identical token IDs and draft counts, with within-arm repeatability. Three independent fixed-work process pairs per shape gave **+1.71–6.52%** across twelve format/size combinations; all 36 shape/process pairs were faster with matching hashes. These are **prototype measurements of the same policy**, not inflated to represent the separate MMQ-to-fused speedup. The isolated extraction's tests/smoke pairs are reported separately. A/A controls had near-zero medians but individual outliers up to about +/-1.5%; all outliers remain in the evidence. No broad GPU/model/default or quality-equivalence claim is made. ## Validation - CUDA SM86 Release: default-off build and opt-in build of `strata` and `prefill_fused_iq_test`. - Configuration rejects the opt-in without architecture 86 and rejects combining the two build variants. - Shared kernel/test files verified byte-identical to upstream; HIP CMake branch and SYCL build file unchanged. - Isolated off/on outputs: six formats × both tiles, plus prior disabled-build default-build fingerprint comparison; existing FP64/MMQ numerical checks retained. - Isolated two-pair whole-engine checks on the same three realistic prompts; token IDs, draft counts and repeatability checked. - `git diff --check`. - Non-SM86 dispatch predicate checked at compile time; other GPU hardware/Windows runtime untested. Details and commands: `docs/benchmarks/2026-10-09-rtx3060-prefetch-one/README.md`. Current validation: `cuda-only-evidence.json` and `cuda-only-parity.log`; historical prototype/initial extraction: `evidence.json` and `isolated-parity.log`. Exact prompts are included. The separate IQ3-only stage-buffering proposal (#1744) touches the same kernel but is not a dependency. Combining the two opt-ins requires its own validation. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:29:45 +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#3642
No description provided.