mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 19:04:50 +07:00
[PR #449] [CLOSED] DeepSeek copy mode: DS4_COPY_SWAP - the RAM copies follow the routes (DISK_SKIP_W leaves out 25-30% fewer experts, same speed) #530
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#530
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/449
Author: @cryptedy
Created: 10/24/2026
Status: ❌ Closed
Base:
main← Head:pr/ds4-copy-swap📝 Commits (2)
e2b6ea6DeepSeek copy mode: DS4_COPY_SWAP - the RAM copies follow the routes, as the RAM tier's do2432777DS4_COPY_SWAP: the MAYA_DS4_COPY_SWAP name (read as STRATA_DS4_), docs/SETTINGS.md📊 Changes
2 files changed (+156 additions, -3 deletions)
View changed files
📝
docs/SETTINGS.md(+21 -0)📝
src/ds4/ds4_model.cu(+135 -3)📄 Description
What
With
--mmap-experts offthe CPU lane's most-routed experts are copied into RAM at the start and stay there; the rest are read in place from the model's files.DISK_SKIP_Wnever computes an expert it leaves out, so that expert's pages never come off the SSD, and it is left out again wherever it is picked light - all through a conversation. Its heat does count those picks.MAYA_DS4_COPY_SWAP=1(opt-in) lets the copies follow the routes, as the RAM tier's do:MAYA_DS4_COPY_SWAP_MARGINx + 1 (default 1.25, as the RAM tier's moves);MAYA_DS4_COPY_SWAP_EVERYtokens (default 8).The copies keep their RAM, so nothing else leaves the page cache for them. With
DISK_SKIP_Wset, the log gets a line every 512 decoded tokens: the experts a token left out, and the copy swaps.The idea is Abyss's RAM fill for its disk tail skip (zephel01/Abyss v1.3.46, issue #8 there), which in turn came from @sh-Tx2Lym's reading of that code - thanks to both. A first try here that read the skipped experts into the page cache instead (no fixed slots) cut the skips by 60-80% but cost 10-25% of the decode speed on a machine whose RAM was full: every read pushed other experts out. The fixed slots avoid that.
The settings are documented in
docs/SETTINGS.md("DeepSeek: skipping light experts the SSD would read"); they are read asSTRATA_DS4_COPY_SWAP*(a config'sMAYA_DS4_COPY_SWAP*), withDS4_COPY_SWAP*as a fallback.Measured
Ryzen 7 9700X (8 cores, 4x DDR5-3600), 128 GB RAM, RTX 3090 24 GB, Windows 11, NVMe; DeepSeek-V4.1-Flash-1017 Maya-S,
--mmap-experts off,DS4_COPY_GB=96(about 2/3 of the CPU lane's experts copied),MAYA_DS4_DISK_SKIP_W=0.20, v1.1.26.8,192-token answers (one request each, sampled, two runs each way, alternated):
MAYA_DS4_COPY_SWAP=1Quality after a 4,096-token answer (the conversation warm), 6 prompts x 256 greedy tokens, KL against the same build without skipping (the reference reads each token alone):
DISK_SKIP_W=0.20DISK_SKIP_W=0.20,MAYA_DS4_COPY_SWAP=1(With the swaps the difference to no skip is within the noise; the swaps change only where experts sit, not the arithmetic.)
Chat decode (calibrate_ds4's workload) with it on: 18.6 tok/s, as before.
Not tested
Linux / AMD builds; NUMA with two parts (the read follows
copy_experts' per-part layout, but only one part was run); a pack where the copies hold every expert (then there is nothing to swap in and nothing changes).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.