[PR #4362] [Engine] dsv41: charge the context to RAM only on an integrated GPU #5023

Open
opened 2026-11-07 16:32:06 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4362
Author: @makefunstuff
Created: 10/27/2026
Status: 🔄 Open

Base: main ← Head: fix/dsv41-store-uma-discrete


📝 Commits (1)

  • 62eeb1c [Engine] dsv41: charge the context to RAM only on an integrated GPU

📊 Changes

1 file changed (+8 additions, -1 deletions)

View changed files

📝 src/dsv41/ds4_model.cu (+8 -1)

📄 Description

Problem and result. On a PC with discrete GPUs, DeepSeek V4.1's automatic RAM store (no --ssd-cache, no DS4_STORE_GB) is sized as if the GPU shared system RAM. store_gb_now() treats a RAM drop of 4 GB or more during the weight upload as its sign of a unified-memory GPU, then charges 1.1e-4 GB per context token past 16K to RAM. Two discrete RTX 5060 Ti cards on Linux lose about 12 GB of RAM during the upload, so the check fires. At --max-context 262144 that took about 27 GB off a store whose context caches live in VRAM:

before: ds4: RAM store: 101.0 GB of RAM free after the GPU's weights: store sized 62.0 GB, not 100.3
after:  ds4: RAM store: 103.3 GB of RAM free after the GPU's weights: store sized 91.3 GB, not 99.8

Approach. The context charge now also requires cudaDeviceProp::integrated, the same test that ring_mb_auto() and alloc_chunks() already use to recognise a unified-memory GPU. The size is unchanged on integrated GPUs and with an explicit --ssd-cache / DS4_STORE_GB. On discrete GPUs, the auto store is RAM free after the upload less the existing 12 GB margin.

Validation

Environment: v0.2.7 (5e8a4cca, the same as main today) plus this commit. Arch Linux with kernel 7.2, Ryzen 5 9600X, 128 GB DDR5-5600, 2× RTX 5060 Ti 16 GB, CUDA sm_120. The model is the IST-DAS 2.00 bpw set packed with the mmproj and read from a 990 PRO.

Build (passed):

cmake -S . -B build-pr -G Ninja -DCMAKE_BUILD_TYPE=Release -DSTRATA_ENABLE_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=120 \
  -DSTRATA_NATIVE_EXPERTS=ON -DSTRATA_MMQ_KQUANTS=ON -DSTRATA_BUILD_DSV41=ON -DSTRATA_BUILD_TESTS=OFF
cmake --build build-pr --target strata-dsv41

Run (passed): both binaries use the same arguments as Strata's server config: strata-dsv41 --serve --pack <pack> --max-context 262144 --eos 1 --dspark auto --dspark-conf 0.65 --experts 5 --layer-split auto. Each load got 8 different chat prompts (code, history, chemistry, French fiction, networking, meal plan, primes, a Russian SQL request), each as GEN 256 <ids>. The arms alternated orig, fixed, orig, fixed. Decode tok/s comes from the engine's generated in … ms line:

arm store decode tok/s, prompts 1-8 median
orig 1 61.4 GB 16.80 16.38 16.64 17.89 16.01 16.67 15.85 14.89 16.5
fixed 1 89.2 GB 16.19 16.99 18.01 19.12 17.65 17.73 17.06 16.11 17.4
orig 2 64.1 GB 16.87 16.42 17.54 18.27 16.11 16.65 15.62 15.02 16.5
fixed 2 89.0 GB 15.31 17.59 18.44 18.86 17.64 17.90 17.18 15.94 17.6

One prompt repeated 7 times gave no measurable difference (orig 24.5-28.8, fixed 25.2-27.6 tok/s after the first), because one prompt's experts fit both stores. MemAvailable stayed above 10 GB with the bigger store.

Not run:

  • HIP and SYCL builds. The change uses cudaGetDeviceProperties exactly as the two existing call sites in this file do.
  • An integrated GPU (Strix Halo). The behaviour there depends on integrated being reported, which the existing unified-memory paths already rely on. A Strix Halo check of the store sized line at a context past 16K would confirm it is unchanged.
  • Windows.

Limits. The speed gain is one machine and one workload, with modest gains (about +6% median on varied prompts). The default margins are unchanged.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4362 **Author:** [@makefunstuff](https://github.com/makefunstuff) **Created:** 10/27/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/dsv41-store-uma-discrete` --- ### 📝 Commits (1) - [`62eeb1c`](https://github.com/Niko1221/Strata/commit/62eeb1c629cc6d4ddcccd9b1c37845de68f746cb) [Engine] dsv41: charge the context to RAM only on an integrated GPU ### 📊 Changes **1 file changed** (+8 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/dsv41/ds4_model.cu` (+8 -1) </details> ### 📄 Description **Problem and result.** On a PC with discrete GPUs, DeepSeek V4.1's automatic RAM store (no `--ssd-cache`, no `DS4_STORE_GB`) is sized as if the GPU shared system RAM. `store_gb_now()` treats a RAM drop of 4 GB or more during the weight upload as its sign of a unified-memory GPU, then charges 1.1e-4 GB per context token past 16K to RAM. Two discrete RTX 5060 Ti cards on Linux lose about 12 GB of RAM during the upload, so the check fires. At `--max-context 262144` that took about 27 GB off a store whose context caches live in VRAM: ``` before: ds4: RAM store: 101.0 GB of RAM free after the GPU's weights: store sized 62.0 GB, not 100.3 after: ds4: RAM store: 103.3 GB of RAM free after the GPU's weights: store sized 91.3 GB, not 99.8 ``` **Approach.** The context charge now also requires `cudaDeviceProp::integrated`, the same test that `ring_mb_auto()` and `alloc_chunks()` already use to recognise a unified-memory GPU. The size is unchanged on integrated GPUs and with an explicit `--ssd-cache` / `DS4_STORE_GB`. On discrete GPUs, the auto store is RAM free after the upload less the existing 12 GB margin. **Validation** Environment: v0.2.7 (5e8a4cca, the same as main today) plus this commit. Arch Linux with kernel 7.2, Ryzen 5 9600X, 128 GB DDR5-5600, 2× RTX 5060 Ti 16 GB, CUDA sm_120. The model is the IST-DAS 2.00 bpw set packed with the mmproj and read from a 990 PRO. Build (passed): ``` cmake -S . -B build-pr -G Ninja -DCMAKE_BUILD_TYPE=Release -DSTRATA_ENABLE_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=120 \ -DSTRATA_NATIVE_EXPERTS=ON -DSTRATA_MMQ_KQUANTS=ON -DSTRATA_BUILD_DSV41=ON -DSTRATA_BUILD_TESTS=OFF cmake --build build-pr --target strata-dsv41 ``` Run (passed): both binaries use the same arguments as Strata's server config: `strata-dsv41 --serve --pack <pack> --max-context 262144 --eos 1 --dspark auto --dspark-conf 0.65 --experts 5 --layer-split auto`. Each load got 8 different chat prompts (code, history, chemistry, French fiction, networking, meal plan, primes, a Russian SQL request), each as `GEN 256 <ids>`. The arms alternated orig, fixed, orig, fixed. Decode tok/s comes from the engine's `generated in … ms` line: | arm | store | decode tok/s, prompts 1-8 | median | |---|---:|---|---:| | orig 1 | 61.4 GB | 16.80 16.38 16.64 17.89 16.01 16.67 15.85 14.89 | 16.5 | | fixed 1 | 89.2 GB | 16.19 16.99 18.01 19.12 17.65 17.73 17.06 16.11 | 17.4 | | orig 2 | 64.1 GB | 16.87 16.42 17.54 18.27 16.11 16.65 15.62 15.02 | 16.5 | | fixed 2 | 89.0 GB | 15.31 17.59 18.44 18.86 17.64 17.90 17.18 15.94 | 17.6 | One prompt repeated 7 times gave no measurable difference (orig 24.5-28.8, fixed 25.2-27.6 tok/s after the first), because one prompt's experts fit both stores. MemAvailable stayed above 10 GB with the bigger store. Not run: - HIP and SYCL builds. The change uses `cudaGetDeviceProperties` exactly as the two existing call sites in this file do. - An integrated GPU (Strix Halo). The behaviour there depends on `integrated` being reported, which the existing unified-memory paths already rely on. A Strix Halo check of the `store sized` line at a context past 16K would confirm it is unchanged. - Windows. **Limits.** The speed gain is one machine and one workload, with modest gains (about +6% median on varied prompts). The default margins are unchanged. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#5023
No description provided.