Repository navigation
Conversation
…eduler set_adapters_lora marked the scheduler for a full re-reserve on every change of set: drain the GPU, drop every cached graph, create a new scheduler, reserve the worst-case graphs. Residents with and without genes alternate every few tokens on one context, so each switch paid it. The allocator already grows its buffers when a graph needs more (ggml_backend_sched_alloc_splits), so a change of set only needs the graph rebuilt; the scheduler is re-reserved only when the set's nodes could exceed the budget it was reserved for (sched_max_nodes, recorded at reserve). Measured on the M5, Metal, idle GPU, Qwen3.6-35B-A3B Q4_K_M, the serving shape (n_ubatch 2048, flash attention, Q4_0 K/V), single-token decodes at 512 (test-walk-exact WALK_ADAPTER_SWITCH_BENCH, the set changing between none and one adapter every token, twice each): before: 14.08 / 14.05 ms/token fixed, 20.56 / 20.66 alternating (a change: 6.6 ms) after: 14.06 / 13.98 ms/token fixed, 15.77 / 15.76 alternating (a change: 1.8 ms, the rebuild) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
force-pushed
the
fable/adapter-switch
branch
from
November 28, 2026 02:09
27030ed to
35dd70c
Compare
joelteply
changed the base branch from
fable/context-memory-rows
to
fable/lived-routing
November 28, 2026 02:09
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.
set_adapters_lora marked the scheduler for a full re-reserve on every change of set: drain the GPU, drop
every cached graph, create a new scheduler, reserve the worst-case graphs. Residents with and without
genes alternate every few tokens on one context, so each switch paid it. The allocator already grows its
buffers when a graph needs more (ggml_backend_sched_alloc_splits), so a change of set only needs the
graph rebuilt; the scheduler is re-reserved only when the set's nodes could exceed the budget it was
reserved for (sched_max_nodes, recorded at reserve).
Measured on the M5, Metal, idle GPU, Qwen3.6-35B-A3B Q4_K_M, the serving shape (n_ubatch 2048, flash
attention, Q4_0 K/V), single-token decodes at 512 (test-walk-exact WALK_ADAPTER_SWITCH_BENCH, the set
changing between none and one adapter every token, twice each):
before: 14.08 / 14.05 ms/token fixed, 20.56 / 20.66 alternating (a change: 6.6 ms)
after: 14.06 / 13.98 ms/token fixed, 15.77 / 15.76 alternating (a change: 1.8 ms, the rebuild)
Found by profiling the M5's live core (
sample, 20 s while residents decoded): of 2,498 samples in llama_decode, ~570 weresched_reserveand 974opt_alloc_graph, while the driver waited for the GPU ~70% of the time.🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo