mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #5170] [Engine] DeepSeek V4.1 on a DGX Spark: a decoded token waits 29 ms for the CPU lane; compute those experts on the GPU when it shares the memory? #3076
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#3076
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?
Originally created by @R-Okauchi on GitHub (Nov 4, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5170
Area
[Engine]
What do you want to do?
I'm trying DeepSeek-V4.1-Flash-1017 IQ2_XS on my DGX Spark as the main model of a coding agent, and I would like its decode
to get closer to what the box allows. The 2.25 bpw set does not fit in the Spark's 128 GB: the engine places about 10,200 of 15,360 experts on the GPU and
runs the other 5,100 (50 GB) on the CPU lane, read in place from the model files. On a GB10 the CPU and the GPU share that
memory, so the CPU lane's experts are in memory the GPU can read as well.
Measured on my DGX Spark (GB10, driver 580.178.04, CUDA 13.0, Ubuntu 24.04 container), the release package
strata-dsv41-0.1.56-linux-aarch64-cuda-cuda13, standalone:strata-dsv41 --pack <IQ2_XS pack> --ids @<ids> --n 256 --max-context 262144 --eos 1 --vision on --experts 6 --dspark none,DS4_PROF=1 DS4_PROF_SYNC=1 DS4_UMA_HEADROOM_GIB=12(12: the Spark also runs a few other containers), after a 1,308-token chat prompt:
DS4_LANE_SKIP=1(the timing oracle: wrong answers)--experts 52.13 ms, 1.17 experts a call). So 3% of the picks are 31% of the token.
--dspark auto --dspark-conf 0.65without the profiler: 12.24 tok/s (the drafter's experts move about 1,000 more experts tothe CPU lane).
DS4_FAST_ATTN=1changed nothing on this CUDA device(657 tok/s). The prompt table of the long prompt (with #5127, which makes
DS4_PROFwork on chunked prompts): experts incl.waits 43%, sparse attention 19%, q_b + rope 13%, ffn mHC + router + sort 10%.
What I would like to agree on before writing code:
but only for MXFP4 layers (
lane_layer_ok) and only withDS4_STREAM=1; for the ISTA-DAS sets every non-resident pick iscomputed by the CPU. On a GB10 the GPU could compute those picks where the files' pages already are (zero-copy, or a copy
inside the same memory), so a decoded token would not wait for the CPU at all. The oracle bounds the gain at about +55%
for this set. Would a change like this be welcome, opt-in first (the default path unchanged) and measured with paired
runs and output hashes? Is it already planned?
profiled it per kernel yet.
Related: #4637 (
DS4_UMA_HEADROOM_GIBon a Spark), #5061 (Strix Halo: with every expert on the GPU, 45 tok/s).What do you do today instead?
For now I run
--experts 5with the drafter, the fastest setting I found here: 13.5 tok/s inserve/server.py(a 924-tokenanswer), against 11.0 with 6 experts. I found nothing faster that keeps the quality.
@R-Okauchi commented on GitHub (Nov 5, 2026):
A correction to my report above, with measurements.
I wrote that the PCIe lane serves only MXFP4 layers. That was wrong: every GGUF expert layer has
lay.fmt == kFmtMXFP4(the low-bit ones keep their types in
lay.K), solane_layer_okpasses the ISTA-DAS sets' IQ layers too, and the lanealready has an in-place mode for an integrated GPU (
DS4_STREAM_DIRECT).So I measured it on the same Spark: 0.1.57 (v0.2.11's release package), the IQ2_XS pack, standalone with the same
1,308-token prompt,
--n 256 --experts 6 --dspark none,DS4_UMA_HEADROOM_GIB=12 DS4_LANE_CAL=none, one run each:DS4_STREAM=2(the lane's slots kept, nothing streamed)DS4_STREAM=1DS4_STREAM=1 DS4_STREAM_DIRECT=1DS4_STREAM=1 DS4_STREAM_DIRECT=0DS4_STREAM=1 DS4_STREAM_THREADS=4--dspark auto --dspark-conf 0.65DS4_STREAM=1(of 61,200 picks, 70-73K with the drafter; from the engine's
decode:line)Within the spread between runs, the lane changes nothing here. The engine's own timings say why. At load the lane plans
with an expert at 0.15-0.20 ms on the CPU lane, 0.3-0.7 ms streamed and 2.1-2.6 ms from the disk, so it streams at most
one of a layer's six picks, and only when four or more of them are in RAM; in decode it times the CPU lane again at
2.1-3.0 ms an expert, the disk's time. The start-up lines show where that comes from:
The GPU's experts take the unified memory the CPU lane's experts would be cached in (1-5 GB of RAM left for ~50 GB of
them in these runs), so most CPU-lane picks are read from the SSD, and that read is the wait (
DS4_PROFwith the laneon: waiting for the CPU lane 39.6 of 103.9 ms a token). Computing those picks on the GPU would still have to read them,
so my first question does not stand as I asked it: streaming the CPU lane's picks to the GPU cannot shorten a wait that
is the SSD's.
DS4_STREAM=1 DS4_LANE_CHECK=1put each of the pack's ten expert formats through both lanes at load: max |diff|0.198-0.276, 2.8-3.3% of the largest output, none bit-identical (the lanes round the activations differently).
What does help here is one tier instead of two. With
--vram-experts 0the RAM store (ds4_store.hpp) gets the memorythe GPU's expert tier had (72.7 GB here, where the CPU lane had 1-5 GB), and 92% of the picks are then found in RAM. The
CPU lane computing all of them is already a little faster than the default.
DS4_STORE_ZC=1has the GPU compute thestore's experts, but it copies each one into a staging slot first, which on a Spark is a second pass over the same RAM.
Pointing the plan at the slot itself on an integrated GPU (a small change: a
zc_pointbesidezc_stage, chosen bycudaDevAttrIntegrated; I can open it as a draft) is faster, and more so with a bigger store. Same prompt and settingsas above, one run each, 256 tokens:
--vram-experts 0(the CPU lane on the RAM store)DS4_STORE_ZC=1 DS4_STORE_ZC_FRAC=100(the staging copy)--max-context 65536(a 94.5 GB store)Each run's answer reads correctly (its first 64 tokens, decoded). With the drafter it does not help yet (9.27 tok/s):
the verify windows do not take the store's experts on the GPU. The startup warning that ZC on a GPU sharing the RAM will
likely fault did not come true here (94.5 GB registered, no fault).
Would an opt-in setting for an integrated GPU along these lines be welcome: no expert tier in the GPU's own allocations,
the store sized to the memory and read by the GPU in place for decoded tokens and verify windows, and the CPU lane for
the misses? I would measure it with paired runs before asking to change any default.
@R-Okauchi commented on GitHub (Nov 7, 2026):
I've opened #5453 as a draft: the opt-in setting I asked about above (
DS4_UMA_TIER=1), with what it needed to payoff: the RAM store in slot classes, the prompt path reading the store in place, and the store's regrowth moved out of
the read path.
The same Spark, prompt and command as above, main (
9f7d977d) and the PR built from source the same way, runsinterleaved, 256 tokens:
--dspark none(3 runs)DS4_UMA_TIER=1(3 runs)--dspark auto --dspark-conf 0.65(2 runs)DS4_UMA_TIER=1, the same (2 runs)Without the variable nothing changes. The PR lists what I checked and what I could not. Would you take this as an
opt-in setting for an integrated GPU? I'll keep the PR a draft until we agree on the scope here.