mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #646] [CLOSED] perf(cuda,decode): zero-doorbell resident verify graph, sub-warp expert packing & shared-mem staging (+39-72% tok/s) #2740
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#2740
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/646
Author: @stuchapin909
Created: 10/3/2026
Status: ❌ Closed
Base:
main← Head:perf/cuda-decode-optimizations📝 Commits (2)
1612f2bperf(cuda,decode): zero-doorbell verify graph, sub-warp expert packing, shared-mem staging, and batched PLE/MTPee5a0bffix(cuda,decode): resolve sm_120 IQ3_S generic-pointer fault and restore 100% bit-exactness with main📊 Changes
23 files changed (+1347 additions, -327 deletions)
View changed files
📝
include/strata/core/mtp.hpp(+2 -0)📝
include/strata/core/verify.hpp(+8 -0)📝
include/strata/kernels/cpu/expert_layout.hpp(+2 -0)📝
include/strata/kernels/elementwise.hpp(+3 -1)📝
include/strata/kernels/native_mmvq.hpp(+3 -0)📝
include/strata/kernels/ngram.hpp(+3 -0)📝
include/strata/kernels/ple.hpp(+4 -0)📝
include/strata/kernels/shared_expert.hpp(+2 -0)📝
src/core/expert_source.cpp(+23 -12)📝
src/core/mtp.cpp(+126 -28)📝
src/core/verify.cpp(+251 -102)📝
src/kernels/cpu/expert_layout.cpp(+32 -0)📝
src/kernels/cpu/native_expert.cpp(+2 -2)📝
src/kernels/cuda/elementwise.cu(+32 -1)📝
src/kernels/cuda/fused_gr.cu(+40 -34)📝
src/kernels/cuda/iq_kernels.cu(+368 -46)📝
src/kernels/cuda/native_mmvq.cu(+35 -3)📝
src/kernels/cuda/ple.cu(+18 -0)📝
src/kernels/cuda/qsa_select.cu(+68 -4)📝
src/kernels/cuda/shared_expert.cu(+79 -41)...and 3 more files
📄 Description
Summary
This PR contributes a set of 100% bit-exact CUDA kernel, verify graph, and multi-GPU pipeline optimizations for speculative decode (Verifier + MtpDrafter), profiled and verified on dual NVIDIA RTX 3090s (sm_86, 48 GB VRAM) running Swift 1.5 IQ2_XS at 256K context (K8V4).
All optimizations preserve exact IEEE-754 floating-point summation trees and produce bit-identical token trajectories and MTP draft acceptance counts at emperature=0.0.
Key Optimizations
1. Routed Expert CUDA Kernels (src/kernels/cuda/iq_kernels.cu)
ative_down_multi_kernel (
_ff == 640):
ow_dot_40_sub8 achieves 100% active lanes, cuts launched blocks and shared activation staging by 4x (80 blocks/group), and matches the 32-lane warp_sum addition tree bit-for-bit via __fadd_rn.
ow_dot_20_sub16 cuts launched blocks/staging by 2x (160 blocks/group) with bit-for-bit parity.
== 1,
== 2) Group Specialization: Added emplate<int TY, int NC, bool EXACT_N = false> to
ow_dot_multi,
ow_dot_40_sub8, and
ow_dot_20_sub16. Since ~80-86% of routed expert groups in a speculative window have = 1$ and ~10% have = 2$, dispatching <TY, 1, true> and <TY, 2, true> removes inner-loop predication (if (c < n)) and eliminates 75% of warp_sum reductions on single-token groups.
ative_gu_multi_kernel to eliminate constant cache bank conflicts across divergent warp lanes.
ative_down_multi_kernel.
2. Zero-Doorbell Multi-Layer Verify Graph (src/core/verify.cpp)
3. Shared Expert, PLE, GDN, Fused GR & MTP (shared_expert.cu, ple.cu, erify_kernels.cu, used_gr.cu, mtp.cpp)
window tokens via ple_block_projected / f16_gemv_fp32_mmvf_multi, reading 65.5 MB of BF16 weights once per window instead oftimes.gram.cpp): Fused contiguous q_proj + q_idx and gate + up projections in MtpDrafter and overlapped NVMe/mmap PLE row prefetches with draft steps.
Benchmark Results (Dual RTX 3090 sm_86, Swift 1.5 IQ2_XS, 256K K8V4, --spec 4, emp=0)
Every prompt was verified to produce the exact same token sequence, window count, and draft acceptance count (125/133, 141/185, 189/242) before and after:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.