Repository navigation
Run the recipe on macOS, and cache a voice reference's prefill on Metal - #17
BobClawblaw wants to merge 1 commit into
Conversation
Adds a macOS path that leaves the GB10 path unchanged, and one engine patch that removes the repeated reference prefill from Drama 3 speech. - scripts/build-engine.sh: on Darwin, omit -Dnvcc (the option is only declared for the CUDA steps) and use shasum where sha256sum is absent. The Linux branch is the previous code. - recipe/pilot_macos.py: the guarded pilot without systemd. Same shared GPU lock, admission check, port check, DRAMA_PILOT_READY and evidence files; vm_stat replaces /proc/meminfo and process-group signals replace systemd-run. --host defaults to 0.0.0.0, --host 127.0.0.1 available. - recipe/README-macos.md: the macOS procedure, measurements and the voice cloning steps. - recipe/build_voice.py: builds a drama3-http-voice/1 catalog from an encoded reference clip and its transcript. - engine/patches/0012: the Metal host prefills a voice reference once per lane, snapshots the recurrent state and reuses it. Measured 3.59 s to 1.37 s first audio on a short line and 4.68 s to 2.41 s on a 454 character paragraph, with byte-identical audio. It stacks on 0005 and is proposed upstream once that lands. - engine/patches/SHA256SUMS and the patch table updated.
ac417dd to
e77d80a
Compare
Independent verifier: builds and happy path work, but do not merge as-isI independently checked out and ran The target is this repository's What I actually ran
Blocking finding 1: A → default → A changes the audioWith the same text and unchanged request settings, issue PCM requests in order: Text:
All these responses were HTTP 200 with Source explanation: 0012's hit/miss branch preserves Needed before merge: invalidate the cached snapshot whenever an uncached/different-prefix prefill can overwrite its dependent live state, including interruption/error paths, or snapshot/restore all required state. Add baseline-parity regressions for A→default→A and prefill cancellation/voice transitions. The existing same-voice/same-text test demonstrably passes despite this defect. Blocking finding 2: voice switches grow retained allocation rather than reaching a plateauIn the candidate, every A/B switch rebuilt a snapshot and added 62,880 KiB = 61.40625 MiB to observed process RSS. Eight consecutive switches added 491.25 MiB. The baseline stayed flat across all six corresponding ordinary requests.
Each of the eight adjacent deltas was exactly 62,880 KiB. These are process RSS observations, not direct Metal allocation telemetry. Source ownership confirms the problem: Needed before merge: reuse one snapshot buffer pair per lane or implement correct replacement ownership, with an alternating-voice allocation-plateau regression. Simply dropping the struct handles is not enough; a global allocator-tail release also needs care when lanes interleave allocations. Launcher/helper findings reproduced separately without modelsThese used the actual Python CLI with a harmless, bounded subprocess fixture and private temporary files—not production services. They are separate from the successful real native execution above.
Positive launcher checks: an occupied verifier lock, occupied test port, and deliberately impossible admission floor each refused before child spawn. No foreign process was displaced. Actual native shutdowns also completed cleanly; the child-cleanup bug above is from the separate adversarial lifecycle fixture, not an assertion that the real native batch leaked processes. Additional source-review concern, not a runtime-confirmed result[INFERENCE] The reusable boundary/key needs a more complete definition: Evidence, scope and recommendationRetained report SHA-256:
The native batch took 105.38 seconds, under a separately coordinated window with an independent external Studio-priority/memory/deadline guard. Three server activations, one codec encode, and all original clients/pilots/native groups settled; the hold is released. No production Studio/runtime/model changes were made. This is cooperative scheduling, not whole-host exclusivity. Not run: CUDA/GB10, the full 24-item corpus gate, sglang-omni qualification, a formal A/B/A2 performance study, multi-lane stress, or independent transcript/voice-quality scoring. Passing the targeted checks does not imply these gates passed. I am making no speedup claim. Recommendation: request changes. The macOS build and normal cached speech path work, but the reproduced audio-identity regression and unbounded per-switch snapshot growth mean this head should not be merged yet. Fix those and the launcher/provenance defects, add the transition/ownership regressions, then reverify the new head. |
Repair implemented and live-retested on MacI implemented the fixes and submitted them directly to this PR's source branch through BobClawblaw/drama-tensorfold#1. GitHub reports that contribution MERGEABLE. My account cannot push directly to either repository, so the author/maintainer must merge that contribution to update PR17. Tested repair head: What changed
Observed results
Machine-readable results and paired hashes · Reproducible Mac instructions The native run used the same pinned full checkpoint and retained synthetic reference, with unchanged prompt-seeded sampling. No model conversion/substitution, Studio restart/deployment, speed claim, or whole-host exclusivity claim. RSS is not direct device-memory telemetry. Initial setup/linkage failures and their corrections are retained in the report. Merge assessment: the reproduced Mac blockers are fixed in the contribution. Do not merge the unchanged |
Description and motivation
Runs this recipe on macOS and removes the repeated voice-reference prefill from Drama 3 speech. The GB10 path is untouched;
scripts/build-engine.shkeeps its previous code on every non-Darwin host.Contents:
scripts/build-engine.sh: on Darwin, omit-Dnvccand useshasumwheresha256sumis absent.-Dnvcccannot be passed on macOS because the option is declared only inside the CUDA build steps, so the script failed withinvalid option: "nvcc"before this change.recipe/pilot_macos.py: the guarded pilot without systemd. It keeps the shared GPU lock, admission check, port check,DRAMA_PILOT_READYand the same evidence files (session.json,ready.json,memory.jsonl,server.log,completion.json);vm_statreplaces/proc/meminfo, process-group signals replacesystemd-run, and--hostdefaults to0.0.0.0(--host 127.0.0.1available). There is no cgroup, so the 54 GiB engine cap has no macOS equivalent; admission is weights + 30 GiB or an explicit--min-available-gib.recipe/README-macos.md: the macOS procedure, the measurements behind it, the voice-cloning steps and service supervision.recipe/build_voice.py: builds adrama3-http-voice/1catalog from an encoded reference clip and its transcript. It lives inrecipe/because.gitignoreexcludesvoices/(they hold a person's voice).engine/patches/0012: the Metal host prefills a voice reference once per lane, snapshots the recurrent state and counters, and on a later request with the same reference restores that snapshot and prefills only the per-request rows. It addsreference_rowstoSpeechRequest, logs the cache build/hit so the behaviour is observable, and leaves the CUDA path alone. It stacks on 0005 (voice catalogs) and is proposed upstream once 0005 lands.bench/reference_cache_test.py: the deterministic test for 0012.engine/patches/SHA256SUMSregenerated and the patch table extended.Testing
Host: Mac Studio, Apple M5 Ultra, 256 GiB, macOS 27.0.1, Zig 0.17.0, no CUDA toolkit. Checkpoint
fishaudio/drama-3ate0a9218a; all ten files verified againstrecipe/checksums/checkpoint.sha256. Engine:d1018b3+ 12 patches; baseline buildd1018b3+ 11 patches (no 0012).scripts/build-engine.shfrom a clean checkout: applies the whole series and buildstensorfold-nativeanddrama3-generate.zig build test-nativeon the patched tree: 31 passed, 1 skipped, 0 failed.bench/reference_cache_test.pyagainst a freshly started server:{"built": "drama3: reference cache built (222 rows)", "hit": "drama3: reference cache hit (222 rows restored)", "identical": true, "bytes": 385024}. It fails on an engine without the patch, because neither line is ever logged and the second reply would still be a full prefill.corpus_capture.py ... --passes 2), thencompare_gate.py base base new out.json:{"identical": true, "normal_mismatches": [], "long05_clipped_identical": [true, true], "base_rtf": 0.977, "new_rtf": 0.683, "speedup_vs_base": 1.43}.The clipped directory is the baseline capture itself: long-05 does not reach the frame cap at the default 1024 frames, so its own baseline reply is the reference.
bench/stream_check.pyagainst the same server:{"passed": true, ...}with all nine checks true (whole WAV 200, PCM equals WAV data, stream head, stream complete, whole frames, stream equals whole PCM, abandoned stream incomplete, slot free after abandon, repeat whole unchanged).GET /health200; WAV and streamed PCM;X-Finish-Reasonstopandlength;400forresponse_format: mp3;503on capacity; the launcher refuses on an occupied lock, an occupied port and below its admission floor.whisper-cli(ggml small.en) transcribes replies back to the requested text.Performance or quality claim
None formal. The numbers above are single-host observations from one A and one B capture, not the recipe's A/B/A2 protocol. On this host the reference prefill was 3.3 s of a 4.7 s first-audio time, and caching it removes that work from every request after the first for a given voice; the corpus gate measured 1.43x on the same replies, byte for byte. The first request after a start, and the first request for a newly selected voice, still pay the full prefill.
Checklist
SHA256SUMSandengine/patches/README.mdupdatedscripts/build-engine.shapplies the whole series and builds from a clean checkoutbench/reference_cache_test.py; the macOS launcher and build guard are covered by running them, which is how the failure they fix was found)compare_gate.pyreports"identical": trueandstream_check.pypassesEvidence (only with a claim)
n/a: no formal claim. Stated anyway: hardware, OS, Zig and checkpoint revision are above; the two engine HEADs are named; the capture commands were
python3 bench/corpus_capture.py http://127.0.0.1:18795 captures/<base|new> --passes 2againstrecipe/pilot_macos.pyon port 18795 with--voices,--default-voice jones, the silence guard and one redraw.