mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4239] [Engine] Metal: hot kernel reload - POST /reload_kernels rebuilds the window without a restart #4969
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4969
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/Niko1221/Strata/pull/4239
Author: @catalinb13
Created: 10/26/2026
Status: 🔄 Open
Base:
main← Head:metal-reload-kernels📝 Commits (10+)
b158818metal: the request's sampling (the CUDA sampler's chain, on the CPU over the window's head logits)0d6e5batests: tools/metal_sampling_test.py (the request's sampling through --serve: reproducible seeds, picks draw for draw against a reference sampler on the dumped logits, penalties, logit_bias) and metal/tests/engine/host_sampler_parity.cpp3a49b02docs: Mac sampling (MAC.md Sampling: the keys, the order, seeds, the host pick's cost, greedy vs sampled decode)093ed30metal: release prompt scratch buffers before workspace growth02e9f27fix(serve): stop reporting stale cache occupancy after refused parkingb9252edMerge current main and exercise prompt growth without caller autorelease pools9844762conversation cache: --conversation-cache-min-tokens WRITE[,READ] gates parked reads1be9c7dmetal: opt-in fp16-slab expert path (mpp) for streaming prompt chunks1d7f1b5gap harness + attribution rounds 1-4; kprof gate reverted to baselinea9b951bmetal: M1 Max A/B hooks (STRATA_METAL_GEMV_TILE/MOE_TILE/GDN_SCAN); decode copy-overlap on by default on Metal📊 Changes
341 files changed (+53789 additions, -1723 deletions)
View changed files
📝
.gitignore(+3 -0)📝
docs/BATCHING.md(+77 -2)➕
docs/DECODE_2X_PLAN.md(+179 -0)📝
docs/DETAILS.md(+2414 -1196)📝
docs/MAC.md(+257 -238)➕
gap/arms-base.txt(+13 -0)➕
gap/arms-final.txt(+7 -0)➕
gap/arms-kprof.txt(+2 -0)➕
gap/arms-needle.txt(+5 -0)➕
gap/arms-needle2.txt(+7 -0)➕
gap/arms-needle3.txt(+2 -0)➕
gap/arms-profile.txt(+9 -0)➕
gap/arms-round10.txt(+9 -0)➕
gap/arms-round11.txt(+9 -0)➕
gap/arms-round12.txt(+7 -0)➕
gap/arms-round13.txt(+15 -0)➕
gap/arms-round14.txt(+13 -0)➕
gap/arms-round15.txt(+13 -0)➕
gap/arms-round16.txt(+17 -0)➕
gap/arms-round17.txt(+15 -0)...and 80 more files
📄 Description
Problem and result. Iterating on a .metal kernel meant a full engine restart: the Mac's 40-plus GB of resident state takes minutes to come back, and the conversation with it.
POST /reload_kernelsnow recompiles every kernel source from disk and rebuilds the window's pipelines without a restart - 5-7 ms when the sources are unchanged (the Metal compiler service answers identical source from cache), about 20 s for one real kernel edit, conversation and session intact. Measured on the live M1 Max host:RELOAD->RELOADED 9.6 ms.Approach.
Context::recompile_all(mtl_rt) recompiles each library source it registered at startup and swaps the functions in place; the window'sreloadthen drops its pipeline and program caches (pcache_,pkey_of_,wcache_,bcache_,gemv_has_) and refetches the queue/step pipelines; the serve route posts the engine'sRELOADcontrol line. Before the window exists the glue answers false with "the Metal window is not up".Validation (passed). Reload on unchanged sources (9.6 ms round trip on the 204800-context host), a real kernel edit picked up without a restart (the deep-dive tile probes above were landed this way), session restore after reload. Harness suite 17/18 as in the tile PR.
Limits. Metal only; the reload covers the window's own caches - the session's parked checkpoints are untouched by design. Not wired into the TUI, only the serve route and the engine control line.
Stacked on the fork's open Metal PR series (#2645/#3783/#3287).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.