mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #421] [CLOSED] DeepSeek: add opt-in cache release and direct I/O for RAM expert copies #521
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#521
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/421
Author: @tctiger
Created: 10/23/2026
Status: ❌ Closed
Base:
main← Head:deepseek-expert-copy-cache-io📝 Commits (2)
6addc1bDeepSeek: add opt-in cache release and direct I/O for RAM expert copiesc6969bdMerge branch 'mw00:main' into deepseek-expert-copy-cache-io📊 Changes
6 files changed (+199 additions, -4 deletions)
View changed files
📝
README.md(+13 -0)📝
docs/SETTINGS.md(+32 -0)📝
src/ds4/ds4_model.cu(+38 -4)📝
src/ds4/ds4_os.hpp(+35 -0)➕
tests/ds4_copy_cache.cpp(+58 -0)➕
tools/test_ds4_copy_cache.py(+23 -0)📄 Description
This adds two opt-in Linux controls to reduce duplicate file-cache memory while copying DeepSeek GGUF CPU experts into RAM.
Changes
DS4_COPY_DROP_CACHE=1: after an expert's matrices and NUMA parts have copied successfully, issue POSIX_FADV_DONTNEED for complete source pages. Partial boundary pages are retained. Eviction is advisory.DS4_COPY_DIRECT=1: use direct I/O with reusable aligned staging buffers, then copy the exact bytes into the NUMA destinations. Unsupported or failed direct reads fall back to buffered reads, with byte counts reported in the startup log.Both options default off. They do not change routing, tensor arithmetic, Engram reads or installer defaults. No global cache clearing, memory compaction or ZFS changes are included in this patch.
Measurements
Tested on Linux with one NVIDIA A40, two Xeon Gold 5218 CPUs, 750 GiB RAM, two NUMA nodes and a Samsung NVMe SSD using XFS.
Model: DeepSeek-V4.1-Flash-1017 Kiwimaker abliterated UD-Q8_K_XL, 1M configured context, DSpark enabled. All 14,417 CPU experts (271 GB) were copied into RAM, and both Engram tables (202.758 GB) were locked.
Both modes used the same patched v1.1.24 executable. Each cold load used the same external cache-clearing and memory-preparation procedure, which is not part of this patch.
Direct I/O read 271.049 GB with zero buffered fallback. Cache-release mode issued accepted hints for 270.872 GB; this is not a measurement of bytes actually evicted.
A preceding same-day run without either control took 432 s to load, including 291.4 s copying experts. This is a reference observation, not a repeated matched-binary default/on benchmark.
Direct I/O did not clearly outperform buffered reads with cache release. The main observed benefit was avoiding source-cache accumulation and the severe slowdown near the end of loading.
Validation
Windows/HIP runtime, multi-GPU/V100 validation, repeated reversed-order loading pairs and full-model token parity were not tested. Generated token sequences differed between runs; no bit-for-bit generation parity claim is made.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.