[GH-ISSUE #4637] [Engine] DS4_UMA_HEADROOM_GIB holds nothing back on a DGX Spark when the page cache is small #2102

Open
opened 2026-11-04 01:56:42 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @chestercs on GitHub (Oct 29, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4637

Area

[Engine]

Desktop app, Terminal or source?

Docker: the release engine package, with the server from a v0.2.7.1 checkout.

What happened

On a DGX Spark, DS4_UMA_HEADROOM_GIB does not hold back memory when the page cache is small. When we set it to 16 GB and then 30 GB, the engine placed the same experts on the GPU both times. During the load MemAvailable fell to between 0.2 and 3.2 GB.

uma_free() (src/dsv41/ds4_model.cu, line 236 at 46c152a1) returns MemAvailable less the headroom only when that number is larger than cudaMemGetInfo's free. Otherwise it returns cudaMemGetInfo's free.

On the GB10, cudaMemGetInfo's free is MemFree. With the engine loaded we read:

Source MiB
cudaMemGetInfo free 3,261
MemFree 3,261
MemAvailable 9,458
Page cache 14,748

When the page cache is small, MemFree is close to MemAvailable. The function then returns MemFree, and the headroom is not applied. The page cache is small right after a boot, or after the model files' pages have been dropped. We drop them before each start, so that the placement is not sized against cached pages.

The four starts, on 2026-10-29. The first column is the engine's own log line, ds4: the experts VRAM leaves over (~X GB) ... (Y GB of RAM free ...):

DS4_UMA_HEADROOM_GIB Experts left to the CPU lane, RAM free MemAvailable when stopped
16 ~17.7 GB, 103.8 GB 3.2 GB
16, --ssd-cache 0 ~17.9 GB, 103.6 GB 1.8 GB
30, --ssd-cache 0 ~17.0 GB, 104.4 GB 0.34 GB
16, --ssd-cache 0 ~17.0 GB, 104.3 GB 0.16 GB

The experts total ~122 GB, so about 104 GB of experts were placed. Our memory guard stopped each load; it polls MemAvailable and kills below 6 GB, and the last column is its reading. The engine did not report an error before that.

Expected: the placement stays at or below MemAvailable less DS4_UMA_HEADROOM_GIB, as the comment above uma_free() describes.

Workaround: pass --vram-experts F, with F = (MemAvailable − margin) / (MemFree − reserve), computed in a wrapper before the start. With a 16 GB margin the same start placed 11,488 of 15,744 experts (90.3 GB) on the GPU. MemAvailable stayed at 10.3 GB or more during the load.

A possible change: on an integrated GPU, return MemAvailable less the headroom whenever MemAvailable is larger than the headroom, not only when that is above cudaMemGetInfo's free. With a large page cache this is the same larger number as today. I can open a PR if that shape is fine with you.

Smallest steps or command that reproduce it

  1. Use a DGX Spark with other processes holding memory. Ours held ~15-20 GB beside Strata: an agent gateway, embeddings, Whisper and a browser.

  2. Make the page cache small, so that MemFree is close to MemAvailable. A boot does this, as does posix_fadvise(POSIX_FADV_DONTNEED) on the model files or echo 1 > /proc/sys/vm/drop_caches.

  3. Start the engine with DS4_UMA_HEADROOM_GIB=16 and then 30, without --vram-experts or --reserve-mib, and watch MemAvailable during the load:

    strata-dsv41 --serve --pack <pack> --max-context 131072 --eos 1 --vision off --dspark auto --dspark-conf 0.65 --prefill-chunk 16384 --ssd-cache 0 --cpu-threads 10
    

Not tested: Strata alone on the Spark. After a boot its page cache is small as well, so we expect the same placement there, but we have not measured it.

Reproduction status

Reproduced locally. Four loads, and the headroom at 16 and 30 GB gave the same placement. The link from uma_free() to that result is our reading of the code, supported by the cudaMemGetInfo = MemFree measurement above.

Strata version

Strata 0.2.7.1 (46c152a1) · engine 0.1.53 (strata-dsv41-0.1.53-linux-aarch64-cuda-cuda13)

Graphics card, memory and system

DGX Spark (GB10), 128 GB unified · Ubuntu (DGX OS), driver 580, CUDA 13.0

Model, size and settings

DeepSeek-V4.1-Flash-1017, ISTA-DASLab GSQ-RCO IQ1_M (1.75 bpw) with the DSpark drafter · 131,072 context · Faster mode (5 experts) · 10 CPU-lane threads pinned to the Cortex-A725 cores

Originally created by @chestercs on GitHub (Oct 29, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4637 ### Area [Engine] ### Desktop app, Terminal or source? Docker: the release engine package, with the server from a v0.2.7.1 checkout. ### What happened On a DGX Spark, `DS4_UMA_HEADROOM_GIB` does not hold back memory when the page cache is small. When we set it to 16 GB and then 30 GB, the engine placed the same experts on the GPU both times. During the load MemAvailable fell to between 0.2 and 3.2 GB. `uma_free()` (`src/dsv41/ds4_model.cu`, line 236 at 46c152a1) returns MemAvailable less the headroom only when that number is larger than `cudaMemGetInfo`'s free. Otherwise it returns `cudaMemGetInfo`'s free. On the GB10, `cudaMemGetInfo`'s free is MemFree. With the engine loaded we read: | Source | MiB | |---|---| | `cudaMemGetInfo` free | 3,261 | | MemFree | 3,261 | | MemAvailable | 9,458 | | Page cache | 14,748 | When the page cache is small, MemFree is close to MemAvailable. The function then returns MemFree, and the headroom is not applied. The page cache is small right after a boot, or after the model files' pages have been dropped. We drop them before each start, so that the placement is not sized against cached pages. The four starts, on 2026-10-29. The first column is the engine's own log line, `ds4: the experts VRAM leaves over (~X GB) ... (Y GB of RAM free ...)`: | `DS4_UMA_HEADROOM_GIB` | Experts left to the CPU lane, RAM free | MemAvailable when stopped | |---|---|---| | 16 | ~17.7 GB, 103.8 GB | 3.2 GB | | 16, `--ssd-cache 0` | ~17.9 GB, 103.6 GB | 1.8 GB | | 30, `--ssd-cache 0` | ~17.0 GB, 104.4 GB | 0.34 GB | | 16, `--ssd-cache 0` | ~17.0 GB, 104.3 GB | 0.16 GB | The experts total ~122 GB, so about 104 GB of experts were placed. Our memory guard stopped each load; it polls MemAvailable and kills below 6 GB, and the last column is its reading. The engine did not report an error before that. Expected: the placement stays at or below MemAvailable less `DS4_UMA_HEADROOM_GIB`, as the comment above `uma_free()` describes. Workaround: pass `--vram-experts F`, with F = (MemAvailable − margin) / (MemFree − reserve), computed in a wrapper before the start. With a 16 GB margin the same start placed 11,488 of 15,744 experts (90.3 GB) on the GPU. MemAvailable stayed at 10.3 GB or more during the load. A possible change: on an integrated GPU, return MemAvailable less the headroom whenever MemAvailable is larger than the headroom, not only when that is above `cudaMemGetInfo`'s free. With a large page cache this is the same larger number as today. I can open a PR if that shape is fine with you. ### Smallest steps or command that reproduce it 1. Use a DGX Spark with other processes holding memory. Ours held ~15-20 GB beside Strata: an agent gateway, embeddings, Whisper and a browser. 2. Make the page cache small, so that MemFree is close to MemAvailable. A boot does this, as does `posix_fadvise(POSIX_FADV_DONTNEED)` on the model files or `echo 1 > /proc/sys/vm/drop_caches`. 3. Start the engine with `DS4_UMA_HEADROOM_GIB=16` and then `30`, without `--vram-experts` or `--reserve-mib`, and watch MemAvailable during the load: ``` strata-dsv41 --serve --pack <pack> --max-context 131072 --eos 1 --vision off --dspark auto --dspark-conf 0.65 --prefill-chunk 16384 --ssd-cache 0 --cpu-threads 10 ``` Not tested: Strata alone on the Spark. After a boot its page cache is small as well, so we expect the same placement there, but we have not measured it. ### Reproduction status Reproduced locally. Four loads, and the headroom at 16 and 30 GB gave the same placement. The link from `uma_free()` to that result is our reading of the code, supported by the `cudaMemGetInfo` = MemFree measurement above. ### Strata version Strata 0.2.7.1 (46c152a1) · engine 0.1.53 (`strata-dsv41-0.1.53-linux-aarch64-cuda-cuda13`) ### Graphics card, memory and system DGX Spark (GB10), 128 GB unified · Ubuntu (DGX OS), driver 580, CUDA 13.0 ### Model, size and settings DeepSeek-V4.1-Flash-1017, ISTA-DASLab GSQ-RCO IQ1_M (1.75 bpw) with the DSpark drafter · 131,072 context · Faster mode (5 experts) · 10 CPU-lane threads pinned to the Cortex-A725 cores
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#2102
No description provided.