mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1744] [CLOSED] CUDA SM86: opt-in IQ3 two-stage prefill build #3647
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3647
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/1744
Author: @InB4DevOps
Created: 10/9/2026
Status: ❌ Closed
Base:
main← Head:perf/cuda-prefill-iq3-two-stage📝 Commits (3)
29a442aCUDA prefill: opt-in two-stage buffering for IQ3 pairs19bcd91CUDA prefill: isolate IQ3 stage tuning in an SM86 build0701e61setup: offer opt-in SM86 IQ3 prefill builds📊 Changes
16 files changed (+5660 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-iq3-stage2/README.md(+128 -0)➕
docs/benchmarks/2026-10-09-rtx3060-iq3-stage2/cuda-only-evidence.json(+2016 -0)➕
docs/benchmarks/2026-10-09-rtx3060-iq3-stage2/cuda-only-parity.log(+369 -0)➕
docs/benchmarks/2026-10-09-rtx3060-iq3-stage2/evidence.json(+2014 -0)➕
docs/benchmarks/2026-10-09-rtx3060-iq3-stage2/isolated-parity.log(+227 -0)➕
docs/benchmarks/2026-10-09-rtx3060-iq3-stage2/prompts.json(+14 -0)📝
setup.py(+166 -15)➕
src/prefill/cuda/moe_fused_iq_stage2_sm86.cu(+72 -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_IQ3_STAGE2CMake option, requiring anexplicit CUDA architecture 86 target. It builds a CUDA-only specialization; runtime
opt-in remains
STRATA_PF_FUSED=1 STRATA_PF_IQ3_STAGE2=1. Only IQ3_S/IQ4_NL and IQ3_XXS/IQ4_NLgate/up–down pairs use two activation stages. Every other pair and the default
retain four stages.
Updated scope: the shared kernel and C++ test edits from the initial draft have
been fully reverted. The specialization is selected only in the CUDA CMake branch
and only executes on runtime SM86. HIP's source/build branch and SYCL's build are
unchanged, so the original missing-ROCm gate no longer applies to this patch.
Other CUDA devices use the original implementation. SM86 includes other Ampere
cards, but only the RTX 3060 was measured. Windows/other hardware remain untested.
What changed
Installer integration (separate commit
0701e617)Eligible NVIDIA users now get an off-by-default setup question, or can use:
Setup uses the detected architecture, selects the build option, bypasses plain
prebuilt engines, and writes the fused/runtime settings. It remembers the model's
choice for starts and updates, with separate engine/build caches and variant-aware
metadata.
--sm86-prefill offreturns to normal engine selection and restores theprevious fused setting.
--yesalone leaves a new install off. The normal engineand other models' variants are not overwritten. See
docs/INSTALL_SM86_PREFILL.md.98 relevant setup tests pass, including default-config goldens and simulated
Windows/Linux policy. Cache reuse/invalidation, disabling, config preservation,
starts and updates are covered without GPU/model downloads. Two checksum-caller
failures found by full discovery on the sibling integration also reproduce on the
untouched base (unmocked HTTP HEAD/404); the affected code is unchanged here.
Kernel and measurement commits
depth and launch attributes; conversion/routing helpers and the fallback are
reused from the unchanged original implementation. The specialized kernel body
must keep its arithmetic in sync with the original.
only when both formats of the layer match the measured pairs.
The blanket two-stage experiment is not included: it regressed IQ2_S by
4.8–5.8% at some sizes. Those kernels retain four stages. Weight prefetch distance,
tile/grid selection, residency, decode, setup defaults and HIP policy are unchanged.
This branch is independently based on
fb58e0db, with no prefetch/head experiments.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:
All 18 pairs had identical output IDs and draft counts and were repeatable.
The clearer effect is in the IQ3 expert-layer workload: +2.65–17.02% across
six format/size combinations, all 18 process-level shape pairs faster. Untouched
IQ2 kernels stayed near baseline, rather than showing the global policy's regressions.
These are prototype measurements of the same selective policy. Final isolated
validation is separately recorded, not pooled into that series. The whole-engine
effect is modest; A/A controls include roughly +/-1.5% individual outliers. This
is a targeted kernel-tuning proposal, not a substantial general inference speedup.
No occupancy increase was measured, and no combined-prefetch claim is made.
Validation
strataandprefill_fused_iq_test.comparison against the default-off build, retaining the existing FP64/MMQ checks.
and repeatability.
git diff --check.Details:
docs/benchmarks/2026-10-09-rtx3060-iq3-stage2/README.md. Current validationis in
cuda-only-evidence.json/cuda-only-parity.log; earlier evidence remainsseparately recorded, with the exact public-source prompts.
The separate one-superblock prefetch proposal (#1742) touches the same kernel but is not
a dependency. Combining or merging both policies needs additional validation.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.