mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #627] [CLOSED] opt for sm_70(just test V100-16g*1 or 2) #2728
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#2728
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/627
Author: @ATIVX928
Created: 10/3/2026
Status: ❌ Closed
Base:
main← Head:v100-opt📝 Commits (10+)
7d57a82kernels: the QSA prompt attention on Volta (sm_70) tensor cores (#371)4672cf9kernels (sm_70): the prompt attention's latency pipeline - 2.2x over the FP32 kernel at 32K09c1087s2 qpn8: the V100 load-time repack + m8n8k4 expert GEMV (STRATA_QPN8=1, measured)c167221expert cache: the QPN8 dual-form slot at admission (STRATA_QPN8=1)b278c57prefill gemm: BF16 GEMM through FP16 on cc<8.0 (V100 has no BF16 ALUs)8332c42V100: operator fusions for the decode GEMV / MoE paths, bitwisef0783a8prefill (v100): the chunked GDN prompt recurrence (FlashQLA gdn-chunk) + Volta recurrence variants4bec900tests (v100): gdn_chunk_parity - the chunked and Volta GDN recurrences vs a double-precision host referencee78684fbench (v100): gdn_chunk_bench - the GDN prompt recurrence variants and the chunked path, real shapes587c6a9mtp: the batch decode attention's scratch is one stride per ROW (audit)📊 Changes
59 files changed (+8140 additions, -173 deletions)
View changed files
📝
CMakeLists.txt(+99 -4)➕
bench/bf16_gemm_bench.cu(+432 -0)➕
bench/gdn_chunk_bench.cpp(+143 -0)➕
bench/micro/fusions_parity.cu(+424 -0)➕
bench/micro/s2_unpack_bench.cu(+927 -0)➕
bench/qsa_prompt_attn_sm70_bench.cpp(+198 -0)➕
bench/results/2026-10-02-gdn-chunk/RESULTS.md(+36 -0)➕
bench/results/2026-10-02-skinny-expert/README.md(+87 -0)➕
bench/results/2026-10-02-v100-split-p2p/README.md(+78 -0)➕
bench/results/2026-10-02-v100-split-p2p/data/bench.txt(+26 -0)➕
bench/results/2026-10-03-qpn8-prep/README.md(+55 -0)➕
bench/results/2026-10-03-v100-kv-int8-read/README.md(+67 -0)➕
bench/split_p2p_bench.cu(+292 -0)📝
docs/MULTI_GPU.md(+20 -4)📝
include/strata/core/device.hpp(+9 -0)📝
include/strata/core/expert_cache.hpp(+4 -0)📝
include/strata/hip_compat/cuda_runtime.h(+1 -0)📝
include/strata/kernels/bf16_bits.hpp(+30 -0)📝
include/strata/kernels/bf16_gemv.hpp(+8 -0)📝
include/strata/kernels/elementwise.hpp(+6 -0)...and 39 more files
📄 Description
This branch adds a set of runtime optimizations for the Tesla V100 (compute capability 7.0) and puts all of them behind one CMake switch,
STRATA_EXPERIMENTAL_V100, in the same style as the existingSTRATA_EXPERIMENTAL_SM60. The switch defaults to OFF: the optimization sources are not compiled, every entry point takes the original path, and trunk behavior (including numerics) stays bit-for-bit unchanged. With the switch ON all optimizations are active, and-DSTRATA_EXPERIMENTAL_V100=ONalone gives a runnable optimized sm_70 build (it also admits sm_70, equivalent to enablingSTRATA_EXPERIMENTAL_SM60alongside). Each optimization keeps a fine-grained runtime A/B knob (STRATA_QPN8,STRATA_SPLIT_P2P,STRATA_GROUPED_ATTN,STRATA_GDN_CHUNK,STRATA_PREFILL_BF16_F16, ...) so any one of them can be verified alone.How to build
or through the installer (mirroring the #295
STRATA_EXPERIMENTAL_SM60=1flow):A CUDA 12.x toolkit is required (CUDA 13 dropped offline compilation for sm_70).
Optimizations and measurements
qsa_prompt_attn_sm70.cu(new), dispatch gated to 70≤cc<75gemm.cu,bf16_bits.hpps_gemv_pair.cu(new),quantize_act.cu,bf16_gemv.cu,layer.cppqsa_grouped_attn.cu(new)device.cu, the hand-off buffers inverify.cpp/prefill.cppkv_q8.cuprefill/kernels.cu,gdn_chunk.cuSTRATA_QPN8=1)s2_qpn8.cu(new),expert_cache.cppTwo bugs fixed along the way (always on, not gated):
mtp.cppallocated one row stride too few for the batch attention scratch (overrun risk); the grouped attention cached its shared-memory opt-in per process, so under--layer-splitdevice1 reused device0's result and graph capture failed.32k-context benchmarks
Model Swift 1.5 Qwen3.8-Flash-Next GSQ-RCO IQ2_XS (the two shards in ~/Qwen/ukisai), context 32768 (32504 prompt tokens), int8 KV,
--prefill auto,--spec 4 --spec-min-p 0.5with the MTP draft layer, greedy,--expert-cache auto; the two-card runs use--layer-split auto. Hardware: 2× Tesla V100-SXM2-16GB (NVLink nv2), AMD EPYC 7F52, 114 GB RAM, CUDA 12.8, driver 580.173.02. Protocol: one warm-up round per engine, then 5 rounds, median reported; prefill counts fresh tokens (prompt cache off); decode is the median of the rounds that ran the full 256 tokens.prefill vs main: +32.7% on one card, +29.2% on two; two cards vs one card (this branch) +41.7%. decode between the two builds falls inside the measurement noise (see below).
A note on the decode numbers: greedy generation is not round-deterministic in this configuration — expert-cache admission is timing-dependent (the CPU pool and the GPU cache round the same expert differently; bench/results/2026-09-29-layer-split documents the effect), so rounds generate different text, the MTP draft acceptance rate swings between 58% and 94%, and end-to-end decode tok/s varies about ±15% between sessions. The table therefore reports full-length rounds only, and the single-card figures rest on few such rounds (most rounds hit EOS early); treat them as magnitude references. The per-phase kernel gains (measured column above) are solid, but at 32k the end-to-end decode is bounded by expert bandwidth and the CPU pool, so the improvement is hidden inside that variance. Short prompts, long generations, or
STRATA_QPN8=1show the decode gains more clearly.Numerics summary
Bitwise: the operator fusions, the int8 KV gather, the NVLink P2P hand-off, QPN8's quantized intermediates. FP32-level (summation order differs; bounds in the headers and parity tests): Volta prompt attention, BF16→FP16 GEMM, GDN chain-split, grouped verify attention (≤1e-3× output scale). Every sm_75/80+ path is bit-for-bit unchanged.
Tried and dropped (negative results, recorded so nobody repeats them)
--kv int8.CUBLAS_COMPUTE_16Ffor the BF16 GEMMs: rejected by cuBLAS on CUDA 12.8;CUBLAS_GEMM_DEFAULT_TENSOR_OPmatches the default in speed, defaults unchanged.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.