mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #5246] [Engine] Support capacity-aware block-aligned GGUF tensor parallelism and fix K-quant head slicing #5364
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#5364
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/5246
Author: @Moeblack
Created: 11/4/2026
Status: 🔄 Open
Base:
main← Head:feat/dsv41-gguf-tp📝 Commits (1)
4168fc3[dsv41] Support capacity-aware block-aligned GGUF tensor parallelism and fix K-quant head slicing📊 Changes
6 files changed (+593 additions, -139 deletions)
View changed files
📝
src/dsv41/ds4_gguf.cu(+10 -4)📝
src/dsv41/ds4_kernels.cu(+5 -4)📝
src/dsv41/ds4_main.cpp(+4 -1)📝
src/dsv41/ds4_model.cu(+417 -129)➕
src/dsv41/ds4_tp_plan.hpp(+156 -0)📝
strata_control/dsv41_fit.py(+1 -1)📄 Description
Problem and result
GGUF DeepSeek-V4.1 packs whose expert intermediate width (
n_ff = 2304) is not evenly divisible into equal 256-value quantization blocks across devices (such as the 2.25 bpwIQ2_XSset, where2304 = 9 * 256) previously downgraded--tp 2and--tp 4totp = 1layer splitting:In addition, when
head.weightuses a K-quant type (Q4_K,Q5_K,Q6_K),mat()/mat_gg()loaded evenly divided vocabulary slices (g.vocab / nm = 32320rows per member ontp = 4), whereashead_cols()only checkedBF16andQ8_0and fell back tosplit128(129280, 4)(32384 / 32384 / 32256 / 32256), shifting gathered logits and DSpark Markov head rows fortp = 4.With this change,
--tp 2and--tp 4run natively on 256-block GGUF packs using block-aligned uneven FFN slices (1280/1024ontp = 2,768/512/512/512or256/768/768/512ontp = 4) with capacity-aware block placement across devices and aligned K-quant head slicing. On 4 x RTX 4090 48 GB (sm_89) at 1M context (--parallel 4), all 15,360 trunk experts and 384 MTP experts fit in VRAM with 0 GB spilled to the CPU lane, increasing single-stream code decode throughput from 122.8 tok/s (tp = 1) to 186.6 tok/s (tp = 4, +52.0%).Related discussion
none
Approach
Block-aligned uneven GGUF FFN sharding (
src/dsv41/ds4_model.cu,src/dsv41/ds4_main.cpp,strata_control/dsv41_fit.py)n_ffalong whole quantization and alignment blocks (LCM(64, DS4_TP_ALIGN, routed/shared down block)), assigning contiguous[ff0, ff0 + ffn)ranges per TP member so routed and shared experts share identical column boundaries.ff0andffnbyte spans.Capacity-aware TP block placement (
src/dsv41/ds4_tp_plan.hpp,src/dsv41/ds4_model.cu)n_ff = 2304on TP4) so devices with higher fixed overhead hold fewer trunk FFN blocks.DS4_TP_BALANCE=0falls back to uniform round-robin rotation.K-quant LM head vocabulary partition alignment (
src/dsv41/ds4_model.cu)dense_gguf_matrix()predicate betweenmat()andhead_cols()coveringBF16,Q8_0,Q4_K,Q5_K, andQ6_K, and verifiesd.head.n == vnafter loading.Runtime scratch isolation (
src/dsv41/ds4_gguf.cu,src/dsv41/ds4_kernels.cu)(device, stream)and split-attention scratch buffers by(device, stream, heads).Validation
Passed:
strata-dsv41from source at commit4168fc3e(rebased onmainffa80d73) on Ubuntu 22.04.5 LTS (Linux 6.8.0-138-generic, 2 x Intel Xeon Gold 6330, 251 GiB RAM, 4 x NVIDIA RTX 4090 48 GBsm_89, driver 595.99.02, CUDA 13.0.88, GCC 11.4).strata-dsv41 --serve --pack /data/deepseek-v41/Strata-data/packs/deepseek-v4.1-flash-ist-das-2.25bpw --max-context 1048576 --eos 1 --vision on --vision-resident --dspark auto --dspark-conf 0.65 --tp 4 --reserve-mib 900 --parallel 4:max_in_flight = 1,temperature = 0,enable_thinking = false,max_tokens = 768) throughput across--tp 1,--tp 2, and--tp 4ondeepseek-v4.1-flash-ist-das-2.25bpw:123 * 456): returned56088.186.6 tok/sdecode (--tp 4capacity-balanced) vs158.4 tok/s(--tp 2) vs141.6 tok/s(--tp 4round-robin) vs122.8 tok/s(--tp 1).118.4 tok/s(Chinese) and122.2 tok/s(English DB transactions) on--tp 4, TTFT119.8-147.2 ms, short-prompt prefill314.5-364.0 tok/s.cache_n = 0):729.1 tok/s(2,870.8 ms) on--tp 4.Failed:
Not run:
ROCm), SYCL, and Metal builds and runtime checks (tested on Linux CUDAsm_89hardware only).Limits
768vs512or256ontp = 4) leaves per-layer compute bounded by the widest member (768), while capacity balancing equalizes VRAM usage across the full 40-layer stack.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.