mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #425] [MERGED] DeepSeek CPU lane: prefetch only the IQ experts' pages that are not in RAM (Windows: +6-7% decode, more on long answers) #522
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#522
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/425
Author: @cryptedy
Created: 10/23/2026
Status: ✅ Merged
Merged: 10/23/2026
Merged by: @mw00
Base:
main← Head:pr/ds4-iq-prefetch-cold📝 Commits (1)
0f44646DeepSeek CPU lane: prefetch only the IQ experts' pages not in RAM📊 Changes
1 file changed (+6 additions, -2 deletions)
View changed files
📝
src/ds4/ds4_model.cu(+6 -2)📄 Description
What
cpu_experts_iq(the GGUF low-bit experts - Maya-S's IQ2_XXS / IQ2_S / IQ3) calledos::prefetchfor every expert it reads from the files, resident or not. On WindowsPrefetchVirtualMemorywalks every page of each range - about 0.13 ms for a 10.6 MB IQ2_XXS expert - on the lane thread, before the first entry computes.cpu_experts_mxalready avoids this withos::prefetch_cold(only the ranges that do not look resident,resident_sampled). This PR does the same in the IQ path.prefetch_coldisprefetchthere - madvise on cached pages is cheap).DS4_IQ_PF_ALL=1: every range, as before.Speed
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 offwithDS4_COPY_GB=96(about 2/3 of the CPU lane's experts copied to RAM, the rest read in place), 1,187 of 15,360 experts in VRAM.Decode = calibrate_ds4's workload (a 512-token document, fresh questions, >= 1.5K tokens written, temp 1.0, thinking off), each run from the same copy of the expert profile; the same binary with
DS4_IQ_PF_ALL=1/ unset, alternated, two runs each:DS4_IQ_PF_ALL=1(as before)On v1.1.21 the same change measured 17.0 / 17.1 -> 18.4 / 18.3 tok/s for chat, and on 4K-token answers (where more experts come from the files) the slowest 256-token stretches went from ~7.4 to ~11.5 tok/s.
The gain grows with the share of experts a token reads from the files (copies capped, or more experts than RAM holds); with every CPU-lane expert copied to RAM there is nothing to prefetch and nothing changes.
Not tested
Linux and AMD (HIP) builds - the Linux path is the same call as before.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.