Repository navigation
Conversation
On M5 Ultra (macOS 27) the driver drops an idle process GPU mappings after about 1 s, so the 1 s keepalive lost the race every ~6 s. With 205 GB of model views a request arriving during the rebuild waited 3-11 s instead of 0.4 s. At 500 ms and 250 ms no drop was seen in 60 s idle and decode speed is unchanged (56.7 t/s). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
maciekd
added a commit
to maciekd/Keep
that referenced
this pull request
Nov 12, 2026
The GPU Memory chart of the Dashboard dipped to zero every few seconds on the M5 Ultra. The dips were real: macOS unwires an idle process's GPU memory after about a second, and ds4's keepalive kernel runs once a second by default, so it lost that race every ~6 s and 209 GB of model was wired again. A request arriving in that window waited 3-11 s instead of 0.4 s (6 of 24 one-token requests in the probe). local_ds4_start.sh now starts the server with DS4_METAL_QUEUE_KEEPALIVE_MS=250 unless the caller sets it. Measured on the M5 Ultra (macOS 27): at 500 ms and at 250 ms no unwiring in 60 s idle and every request at its normal latency; decode speed unchanged (56.6 vs 56.8 t/s). The same value is proposed as ds4's default in antirez/ds4#1347; the export is redundant once the server's ds4 build has it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The main-queue keepalive runs once a second. On an M5 Ultra (256 GB, macOS 27.0) that is not quite often enough: the driver drops the idle process's GPU mappings after about 1 s, so the keepalive loses the race roughly every 6 s and the mappings are rebuilt.
With 205 GB of model views (DeepSeek V4.1 Flash, mixed Q4_K / IQ2_XXS / Q2_K quant, ctx 196608) a request that arrives during the rebuild is slow. Measured with a 1-token chat request repeated every 1.4 s, plus 60 s idle sampling "In use system memory" from
ioreg:DS4_METAL_QUEUE_KEEPALIVE_MSThis PR changes the default to 250 ms and updates the comment. Nothing else changes; the environment variable still overrides it.
Decode speed is unchanged: 56.8 t/s at 1000 ms vs 56.6 t/s at 250 ms (300-token generation, three runs each). I did not measure idle power.
Tests:
make testbuilds and passes up to./ds4_test../ds4_testwithDS4_TEST_MODELset to the mixed quant above reports 9 failures (the logprob-vector and SSD-streaming checks, which expect the standard quant, and theds4_think_mode_for_contextassertion atds4_server.c:18238). The same 9 fail withDS4_METAL_QUEUE_KEEPALIVE_MS=1000, so they are not from this change; I don't haveds4flash.ggufon this machine to run the vectors against.🤖 Generated with Claude Code