Repository navigation
qwen27: a refusal that no --parallel or --context fixes names the wired-limit raise - #2123
Conversation
|
Thanks @devopsfortunato, this turns a refusal that pointed at the wrong knob into one that names the right one, and the pure functions make it testable on Linux. One change: |
|
Thanks, done in I used a fixed 4 GiB instead of what macOS keeps by default. Below about 96 GB, macOS's default limit is two thirds of RAM, so it keeps a third. On a 32 GB Mac that's about 10.7 GiB, which would cap the suggestion at the default limit, and a raise could never be suggested there. With 4 GiB, the issue's 8K case still gets 23449 MB, which leaves 9.1 GiB. The test now pins the edge: at RAM = limit + 4 GiB it suggests the value, and one byte less returns null. Another case fits in RAM but not above the floor, and the advice table has a 26 GiB row where only the floor rules a raise out. |
|
Thanks @devopsfortunato. A fixed 4 GiB floor is a sensible choice, and your reasoning about macOS's default limit on 32 GB Macs is right. The edge test pins it. Ready to land. @ghaslbe, if your M1 Max run happens, it'll show whether the suggested value starts the server as is. |
…ed-limit raise (ashhart#2101) When even one stream does not fit beside the weights and the 8 GiB margin, the startup refusal now names Metal's working set and the iogpu.wired_limit_mb value that fits one stream at this context, or says no raise fits this Mac's RAM. The text is unchanged when fewer streams would fit or TF_QWEN27_WORKING_SET_BYTES caps the set. The qwen27 memory host tests now run under zig build test.
2f8a13c to
7106eae
Compare
|
Thank you @devopsfortunato. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
|
Thanks @devopsfortunato! This is in TensorFold 1.2.4, out now: https://github.com/ashhart/TensorFold/releases/tag/v1.2.4 |
What this changes
On a 32 GB Mac with the default
iogpu.wired_limit_mb=0, the Qwen3.8-27B startup refusal tells you to lower--parallelor--contexteven when that can't help, because one stream at the smallest context still doesn't fit under Metal's working set. Now, when even one stream doesn't fit, the refusal names Metal's working set and theiogpu.wired_limit_mbvalue that fits one stream at the requested context. With numbers like the issue's 8K case (the new test uses them):A raise is suggested only when the suggested limit still leaves 4 GiB of RAM outside the GPU's share for macOS and other processes. Otherwise it says
no wired-limit raise fits one stream and leaves 4 GiB of this Mac's 16.0 GiB of RAM to the system: lower --contextinstead. The old text stays byte-for-byte when fewer streams would fit, or whenTF_QWEN27_WORKING_SET_BYTESlowers the working set (the sysctl advice would be wrong there).prompt_memory.zig: the 8 GiB margin is one constant now;wiredRaise(used + need + margin, rounded up to MiB, null unless that limit leaves a 4 GiB floor) andadvice/Advicechoose and format the refusal's tail. They're pure functions, so Linux CI tests them.qwen27_served.zig: the refusal adds that tail.room()and the advice read the cap through onecap()helper, so the "Metal lets this Mac use" figure is the same working set the "remains" figure came from.zig/build/qwen27_host.zig:test-qwen27-memory-hostnow also runs underzig build test(it was a named step only, so CI didn't run it).iogpu.wired_limit_mbraised, and that the refusal names the value (suggestion 2 in the issue).Suggestion 3 in the issue, the prompt cache holding nothing at a 32K window, is left out. It's a separate change.
mainb331731e6(two commits:76a9084c5, and2f8a13cd2for the review's RAM floor)atc overlap --json: 66 overlap entries: 7clean, 56unknown(pullFilesUnavailable,timeLimit), 3conflicts: Living Weights on the dense Qwen3.8-27B on Metal: the pocket and the native trainer (#1568) #2023, qwen27: document two-Mac 27B serving and the row split's exactness #1437 and qwen27: add the pair acceptance and supervision scripts #1436. All three conflict withmainitself on the same files (git merge-treegives the same conflict list againstmainas against this head), and none of them touches the lines this PR changes, so this PR adds no conflict.Checks on this head
2f8a13cd2(baseb331731e6). The full suite below ran on76a9084c5;2f8a13cd2changes onlyprompt_memory.zigand its tests, and for it I rerantest-qwen27-memory-host(9/9; the new floor edge fails on the old code withexpected null, found 23552),zig fmt --checkand the lean checker (425, 0 new). CI covers the rest.python3 tools/zig/lean_check.py, on the base and on this head: base 425 problems, head 425 problems;lean_new.py: 0 new.zig build test --test-timeout 10m: 532/532 steps succeeded, 0 failed (base: 530/530; the two new steps are the memory test's compile and run). Test count on this run: 6865/6924 passed, 59 skipped, the same as the base run.zig build test-qwen27-memory-host: 9/9 (3 new tests). Red before the change: the new tests don't compile against the oldprompt_memory.zig(no member named 'wiredRaise','Advice').zig build test-kernel-contract: 22/22 steps, 179/179zig build test-golden: 5/5 steps, no golden changedzig build test-server-security test-pull-security: 14/14 steps, 28/28zig build fuzz-cortheon: 3/3 steps, 19/19zig build(plain): 31/31 stepspython3 -m unittest discover -s tools/tests -p "test_bench*.py": 74 OK;flashnext_batch_serve_test.py: 8 OK;build_options_test.py: 5 OK;cuda_common_check.py: exit 0zig fmt --check build.zig zig: clean;git diff --check: cleanqwen27_served.zigonly builds on macOS, so I type-checked it with a throwaway build step (not committed). The step compiledzig/qwen27_speed_compile.zig, which reachesopen→attach, foraarch64-macos, wired likecompileHostbut without frameworks: success. Renamingmemory.advicein that copy made the same step fail at the refusal line, so the step does compile this branch.qwen27_served.zigfor real. I also skipped the NFKD table check, which needs Python 3.14'sunicodedata; this change doesn't touch the tables.Receipt
n/a: the change is only the text of a startup refusal plus a host test, and it never reaches inference. No token, kernel, precision, scheduling or memory-admission decision changes. The refusal fires in exactly the same cases as before.
Floor: a fixed 4 GiB. macOS's own default keeps a third of RAM below about 96 GB, so using that as the floor would rule out any raise on a 32 GB Mac. The issue's case still gets a value: 23449 MB, which leaves 9.1 GiB. The reporter's 29696 left 3 GiB, under the floor, but one stream there needs much less than that.
Known limitation: the suggested value is the exact MiB ceiling of what
room()counts (weights and buffers allocated so far, one stream's scratch, the 8 GiB margin). If macOS reports a working set slightly under the sysctl value, the next 128 MiB up would cover it. @ghaslbe offered to test on the M1 Max 32 GB, and that run would show whether23449-style values start the server as they are.Checklist