mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3983] [Other] mac_fit: decide resident vs streaming with the engine's rule (Gyro-S looped on a 48 GB Mac) #4864
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#4864
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/3983
Author: @Thomas-Zenkel
Created: 10/24/2026
Status: 🔄 Open
Base:
main← Head:fix/mac-fit-stream-rule📝 Commits (3)
358cc5emac_fit: setup decides resident vs streaming with the engine's rule (12 GiB beside the weights, resident_cap)4d56071docs/MAC.md: Gyro-S on 64 GB is resident by the rule but runs out of Metal memory there (#3784)d66f731Merge Niko1221/Strata main into fix/mac-fit-stream-rule📊 Changes
3 files changed (+34 additions, -17 deletions)
View changed files
📝
docs/MAC.md(+12 -9)📝
strata_control/mac_fit.py(+11 -7)📝
tools/test_setup_mac.py(+11 -1)📄 Description
Problem and result
On a 48 GB Mac (Apple M4 Pro, macOS 27.0, Strata 0.2.3, engine 0.1.48 metal), Gyro-S at 32K never answered. Setup wrote
STRATA_METAL_STREAM=0into the run config, so the engine kept the model resident instead of streaming it. The weights were paged in and out (7.5 GB swap). A 53-token prompt did not finish in 60 s. The watchdog stopped the engine (no progress for 60 s … reading the prompt, exit -6), and the server started it again, in a loop.Cause: setup (
strata_control/mac_fit.py) and the engine (metal/src/engine/stream.cpp,ExpertStream::wanted) decide "resident or stream" with different numbers. The engine follows setup's value.0)resident_cap(here the working set, 40.2 GB on this Mac)After: setup uses the engine's rule. With
STRATA_METAL_STREAM=1on the same Mac the engine loaded in 15 s, filled a 19.5 GB expert arena and answered a short question (59 prompt tokens, 48 completion tokens) in 4 s.Related discussion
#3784 is related: Gyro-S resident on a 64 GB Mac runs out of Metal memory, because the whole 58.5 GB file is wrapped. This PR does not fix that (see Limits). No scope was agreed in an issue for this change.
Approach
OVERHEAD_GBis 12 GiB, the engine's figure, instead of 8 GB. On the 48 GB Mac the process held 10.8 GB beside the weights, without the draft layer.gpu_budget_gbalso leaves macOS 7 GB or 15% of the RAM on a small Mac, asresident_capinarena_budget.hdoes.Compatibility: I compared setup's decision before and after for every pack at 16, 24, 32, 36, 48, 64, 96, 128, 192 and 256 GB. Three cases change, each to what the engine itself decides when no value is set:
STREAM_MTP_FROM_GB = 96)This changes a default on 64 GB Macs (Q2_0) without a measurement there. On 64 GB Macs the old resident start of Q2_0 was 50.5 GB against a cap of 48.1 GB by the engine's own rule.
docs/MAC.md: the "needs about" and "recommended from" columns are recomputed with the new overhead. The Gyro-S row points to #3784.Validation
Passed:
python3 tools/test_setup_mac.pyat4d56071aon macOS (M4 Pro): 27 tests OK. The newtest_setup_decides_streaming_as_the_engine_doesand the updatedtest_by_memoryfail on the oldmac_fit.py(checked by stashing it).STRATA_METAL_STREAM=1(set by hand in the installed config, the same value this change makes setup write), Gyro-S 32K loaded and answered as above; no more watchdog restarts.Failed:
python3 tools/test_picture_defaults.py: 2 failures (test_pictures_off_stays_available,test_yes_means_pictures_on_for_qwen_swift_and_coder). They fail the same way without this change.python3 tools/test_strata_mcp.py: 7 failures, 3 errors (Install, StartStop, MixedGraphics, Validation). Same set without this change; the StartStop tests ran while a Strata server was on port 8080.Not run:
python -m pytest tests/terminalandnpm testinapps/host: not run.Limits
GPU_SHARE); the engine reads the real value (40.2 GB = 78% on this Mac). Both gave the same decision for every pack and size in the comparison above, at 75% and 78%.file_gb) in setup would be the fix on this side; it is left out to keep this PR to one problem.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.