Repository navigation
native: Qwen3.5-2B on Metal attests the execution witness's path, every weight byte with the kernel sources this OS compiles - #4908
Conversation
…ove to weights_witness.zig, and CUDA keeps its kernels, GPU and components
…ry weight byte with the kernel sources this OS compiles
|
I checked the stack at I also applied Ash's overlapping build-fixture PR #4987 ( Igor Lessio - AIFLOW LABS |
What this changes
With
--execution-witness, native Qwen3.5-2B on a Mac attests its path,qwen3_5-2b/metal/tp1/mlx-q4g64/text, instead of readingunsupported_path. The engine stamps the checkpoint's files before the load and reads every shard byte once the server is ready, as on CUDA. In place of kernel images and the GPU's facts, it binds the Metal sources the load compiles, this OS's compile options, the OS build and chip, tensor units, the resolved profile and the served shape. Without the flag nothing changes: the witness is never opened.metal_witness.zig(105 lines) is aMetalbackend for native: the execution witness's stamps, weight read and hash thread move to weights_witness.zig, and CUDA keeps its kernels, GPU and components #4907'sweights_witness.Witness.keephashes these, in order:kernels(): one SHA-256 over every libraryq.kernels.loadcompiles, with its source, its functions in pipeline order, and a projection's tile (columns, threads).q.kernels.options(): math mode, math functions and language version.disk_identity.machine: the OS build and the chip, read as Metal's kept states key them (no second reader).disk_identity.profilefor the family and backend.tail: the window, the streams, the prompt step (TF_QWEN35_CHUNK's value), the lane rows the load's exactness check left, and whether the caches are paged.families/qwen3_5/kernels.zignames its libraries once, inlibraries: eachsources.allentry, then layout, then paged.loadloops over that list, andoptions()is theCompileOptions.mlx()every library takes, so the witness hashes exactly what the load compiles. A test checks that the libraries' functions add up toq.kernels.total, so a pipeline outsidelibrariescan't load unhashed.native/qwen35.zigopens the witness beforeModel.loadwhenmetal_witness.wanted(o). After the load it binds the device and shape, passes the source to the lane host, and adopts the witness once the host starts; a refusal or failure releases it.wantedis native: the execution witness's stamps, weight read and hash thread move to weights_witness.zig, and CUDA keeps its kernels, GPU and components #4907's shared condition: the flag, one rank, text, and no drafter,--slide,--record,--learn,--recallor MTP drafts.docs/api.mdnames the Metal path and itscomponents.enginelist next to the CUDA one.test-execution-witness-metal-hostis a new host step, also run byzig build test. The build stand-ins forresidency_host,drama3_metal,slide_hostandqwen35_cache_hostexportdigest_cacheandcheckpoint_identity, whichweights_witnessimports.Issue: Refs Execution witness: Qwen3.5-2B on Metal #4630 (part 2 of 2: the Metal path).
Stacked on: main at ea57d96, then native: the execution witness's stamps, weight read and hash thread move to weights_witness.zig, and CUDA keeps its kernels, GPU and components #4907 (1705275); this PR adds 5bcc339.
atc overlap --json: run on this head against main;complete: false(otherPullRequestsLimit,pullFilesUnavailable,pullRequestsLimit,timeLimit).tensorfold.zig's export lines, adjacent edits.CHANGELOG.md's Unreleased top.unknown.Checks on this head
python3 tools/pr_check.py --base upstream/main --pr 4908: lean 165 and 165 on the base and this head, 0 new; 0 errors.zig build test-execution-witness-metal-host: 6 passed, 0 failed, 0 skipped.q.kernels.total, and the kernel digest is stable.files_changed; a reload hashes again to the same digest.hash_failedand the load goes on.zig build test-execution-witness-cuda-host: 22 passed.test-execution-witness-host: 54.test-disk-identity-host: 39.test-metal-residency-host: 11.compile-disk-identity-metal-hostbuilds.compile-metal-residency-hostfails on main too since ec277c1:inkling2.zigimportsengine_api, which the stand-in'scoremodule lacks.zig build test -Dcpu=apple_m1: 1029 of 1033 steps; 16742 passed, 2 failed, 128 skipped in the steps that ran (steps cached from an earlier run aren't counted). The same 4 steps fail on main at ea57d96:uocr/serve.zig:288'sstd.mem.zeroeson aDecoderwith a non-nullable pointer (76200b6);qwen27/mtp_pick.zig'sbf16_topkimport;info's Qwen3.8-27B pricing test, which expects "not priced" where this Mac fits it; and thestartCLI's managed-log tests (one KR67 test here, three of them on main). This PR touches none of them.q.configrefuses on this path.Receipt
--execution-witness.--execution-witnessflag andexecution_witnessrequest field; there's no new profile row.zig build native -Doptimize=ReleaseFast -Dcpu=apple_m1for both;mlx-community/Qwen3.5-2B-MLX-4bit@93760be4f1f69842a46bc13dbdc0f19e291392a3,serve --context 8192 --no-thinking --api-key, a fresh process per start.--execution-witnessand"execution_witness": trueon every request, measured afterknown; D branch with the flag and no field. Order rotated ABCD, BCDA, CDAB, DABC. C's field goes through a small proxy that adds it and records each object, since the repo's tools have no extra-body option; D measures the same server without the proxy. Each cell is the median of its runs./health200, s (n=4)known, s (n=4)ttft_s(n=4)bench_openai, n=4)bench_openai, n=4)B reads lowest in most rows, though C and D run B's binary with more work. Chat's 1-stream runs: A 146.4–153.2, B 134.2–141.5, C 138.2–144.5, D 136.1–147.6. The code prompt drafts and spreads widely in every arm: A 277.7–380.4, B 291.5–328.1, C 362.5–408.0, D 361.5–402.6. To check flag off against main directly, 8 more alternating rounds of A and B (
bench_openai, greedy) gave chat 148.6 and 148.5 tok/s and code 332.7 and 363.5 (medians), with the same tokens; the lower of each round's pair is A in four rounds and B in four for chat.bench_concurrent.py --levels 1,8 --tokens 256 --alone --serial, sampled at 1.0 with seeds and greedy, code and chat. All 4 arms passed: 108/108 alone and 36/36 serial equal each, 0 unequal, 0 failed, and every 8-stream cell overlapped. Chat's serial cells accepted no draft, so the drafted-against-plain check is code's. Each prompt gave onetoken_shaacross A, B, C and D: codebc1513a7f13c, chatf5c2a018d77d, the cold 7,680-token prompt4fe11ea07e60…. At 1 and 8 streams, a 128-token greedy reply wasca9f285b473f…on A, B and C.knownon the path; 350 objects through C's proxy, allknown, eachtoken_sha256equal totensorfold.token_sha256.pendingat ready.contentandcomponentswith a new instance.model.safetensorswhile the hash runs: the snapshot and replies readfiles_changed.--idle-unload 5:parked; the next request reloads at epoch 2 and readspending, thenknownwith the same content.--recall:feature_excluded, feature--recall.--prompt-cache-gib 4(this model keeps prompt states only with it): a second turn resumed from 7,552 of 7,738 tokens gives the sameprompt_sha256,request_sha256andtoken_sha256as the same turn on a fresh server, and the same binding when repeated. The bindings differ only through the witness (a new instance).tools/bench_cache.py --require-cold --expected-prompt-tokens 7680, above; every run cold (0 cached) and qualified.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.