mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #530] [CLOSED] DeepSeek: opt-in full zero-copy routes and no CPU wait #585
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#585
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/mw00/project-maya/pull/530
Author: @handmade0octopus
Created: 10/26/2026
Status: ❌ Closed
Base:
main← Head:pr/ds4-zc-all📝 Commits (1)
51f5be8DeepSeek: opt-in full zero-copy routes and no CPU wait📊 Changes
5 files changed (+125 additions, -22 deletions)
View changed files
📝
CMakeLists.txt(+2 -0)📝
docs/SETTINGS.md(+2 -0)📝
src/ds4/ds4_model.cu(+69 -22)📝
src/ds4/ds4_pcie.hpp(+15 -0)➕
tests/ds4_pcie_test.cpp(+37 -0)📄 Description
Summary
Add two opt-in DeepSeek decode settings for experts with pinned, device-readable RAM copies:
DS4_STREAM_ZC_ALL: an ordinary one-token route whose non-VRAM picks all have pinned copies streams the whole route instead of using the measured partial split.DS4_STREAM_ZC_NOWAIT: when every possible non-VRAM expert in such a layer is pinned, skip the empty CPU response and its wait.The baseline PCIe-lane allocation and expert placement happen first and are never overridden by these settings. The experiment becomes active only after a real pinned copy exists. Persisted device
lane=off,DS4_STREAM_ZC=0, no RAM copy, zero pinning, forced routing, and stream-hold mode therefore retain the original behavior. A host-side regression test covers those gates.DSpark
T > 1verify windows keep their original, separate eligibility. Uncovered routes and the whole-step CPU-only/fallback A/B arms stay on the original path. Both settings are off by default; neither skips an expert or route nor adds an approximation.Motivation
On Windows with pinned expert copies, the measured lane split can leave ordinary one-token routes partially on the CPU even when every pick is device-readable. Full pinned coverage lets the existing zero-copy path serve that route without staged reads. Once the whole layer is covered, there is no CPU result for that arm to wait for.
Measurements
Test system: Windows 11, RTX 4090 D 48 GiB, Ryzen 5 3600, 128 GiB RAM; DeepSeek-V4.1-Flash IQ1_M.
Fresh engine per run, matched greedy code/prose prompts, 384 generated tokens per prompt, frozen learned inputs, and engine-reported decode timing. Each control and candidate used the same binary, with only the candidate setting toggled, avoiding recalibration from the binary-timestamped lane-calibration key. The first non-DSpark prompt includes whole-step A/B warm-up; the second is the steady measurement.
ZC-allcode / proseZC-all + no-waitcode / prosenoneonMean code/prose throughput changes from the same-build control:
ZC-all: +4.0% non-DSpark, +18.1% DSpark-on.Separate fresh-engine sustained runs of the full candidate generated 1,024 tokens for each of code and prose: 22.59 / 24.46 t/s non-DSpark and 36.01 / 33.06 t/s DSpark-on. Both parent-pipe/QUIT shutdowns exited cleanly with no engine left behind. These are single-machine opt-in results, not a claim for every GPU, quant, or pinning layout.
Correctness and fallback coverage
zc_ok; no-wait uses the stronger layer-wide coverage predicate because the device decides before the host returns the route mask.DS4_STREAM_ZC_NOWAIT=1alone does not imply or widen ZC-all.ds4_pcie_testcovers persistedlane=off, no/zero/partial pinned slots, ZC disabled, forced routing, and hold mode. It needs neither a GPU nor a model.8b4b39f) branch: Windows CUDA build,ds4_pcie_test, HIP name-compatibility scan,git diff --check, and 133 server/DS4-conformance tests (3 platform skips).Relation to #495
#495's device self-answer is complementary but does not remove this wait for the target routes. Its
cpu_anyis computed from non-VRAM routing before the host split. A route whose non-VRAM picks are subsequently all streamed still hascpu_any=1, so #495 does not generate the empty response for it.This PR's no-wait is intentionally narrower: it requires layer-wide pinned coverage and preserves the original response/wait for every fallback or mixed route. It is therefore included rather than relying on #495's pre-split flag.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.