Repository navigation
Conversation
Contributor
Author
|
Fixed zig-b in 5e689a3: the Windows cross-compile failed at |
The speech server holds /tmp/tensorfold-speech.lock shared while it synthesizes; the H3 tools (tf-h3-dit, tf-h3-image, the prompt encoder, the decoder and tf-h3-image-server) wait between blocks and stages while it is held, and every timed step prints timing_valid. (cherry picked from commit 980b5d5)
…rge render 72.9 s -> 9.4-9.8 s (cherry picked from commit f84c1dd)
…drain every committed buffer; the lock refuses planted paths The speech server's turn now ends with its output lane, when the engine's work ends, so a slow client no longer holds a render back. H3's forward and prompt passes keep committed command buffers in gpu_turn.Queue, which returns a failure only after every buffer committed with it has completed. The lock is opened without following symlinks and created only when absent, and speech waits at most a second behind an exclusive hold before it synthesizes without the turn.
…tall or redirect the speech turn; speech arriving as the last blocks drain goes before the output heads gpu_turn opens an existing lock or stamp nonblocking and without following links, and uses it only when it is one regular file with a single name: a FIFO no longer blocks speak() or yield(), and a hard link no longer receives the stamp's bytes. Speech only shares the lock, so a hold that also refuses a shared probe is not waited for. H3's forward yields once more after draining the last blocks, before the final norm and output heads are committed.
…sts in their own files
…eech stamping between the read and the probe no longer certifies it
…d buffer completes The yield after the output heads were waited deferred no GPU work; it only held a finished render for a whole speech request. Speech arriving then now only marks the step's timing invalid.
ashhart
force-pushed
the
feat/107-upstream-pr-long-image-renders-give-way-
branch
from
November 24, 2026 00:36
ced4069 to
13ee02d
Compare
Owner
|
Thank you @plotarmordev. 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. |
ashhart
added a commit
to AbrahamCete/TensorFold
that referenced
this pull request
Nov 24, 2026
ashhart
added a commit
that referenced
this pull request
Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Before, a long H3 image render on a Mac kept the GPU for its whole run, so a live voice reply sent mid-render waited behind it: 72.854 s for one note during a large render. With this change the speech server holds
/tmp/tensorfold-speech.lockshared while it speaks. The H3 tools (tf-h3-dit,tf-h3-image, the prompt encoder, the decoder andtf-h3-image-server) yield between blocks and stages while it is held, and each timed step printstiming_validso a step that waited is marked. Under the same load the voice reply took 9.397-9.774 s, and the render bytes did not change.-x. It builds on h3: MiniMax-H3-Image's prompt encoder, transformer and decoder resident across pictures #3718, which is merged.11b815e376ce122026f3c4011029ada2a56da53c. This PR adds eight commits:3b0c3e4eh3, server: long image renders give way to live speech on the Mac's GPU1308131adocs: the live speech server must publish the lock; voice during a large render 72.9 s -> 9.4-9.8 s35889ed8server, h3: speech frees the GPU turn before client writes; failures drain every committed buffer; the lock refuses planted paths7904411aserver, h3: planted FIFOs, hard links and exclusive holds no longer stall or redirect the speech turn; speech arriving as the last blocks drain goes before the output heads4969f287server, h3: one-line comments; speech voices and H3 speech-arrival tests in their own files1ee76e25server: speech_voices_test reaches the byte tokenizer's encoded842428bserver: a timed step's stamp is read under the exclusive probe, so speech stamping between the read and the probe no longer certifies it5e689a34server: the speech lock builds for Windows, which has no mode bits to widen or checkatc overlap --json: no overlaps reported, but the result was incomplete (complete: false; limits: pull files, other pull requests and time).How to check
Base:
11b815e376ce122026f3c4011029ada2a56da53c(main under this branch). Head:5e689a34f213b5c2cbb1bb059e1e9da830b112aa.Machine: Apple M5 Ultra Mac Studio, 256 GiB, macOS 27.0, Zig 0.17.0 (
.zig-version). No extra env vars or flags.zig test zig/src/server/gpu_turn.zig: 6 passed, 0 failed, 0 skipped. The forced stamp-between-read-and-probe regression fails (5 passed, 1 failed) when I restore the previous read-then-probe ordering in a scratch copy at this head.nice -n 10 zig build test test-golden --summary failures --cache-dir "$(mktemp -d)", uncached at the head: 17444 passed, 4 failed, 146 skipped of 17594, plus the_memcpylink-check step (977/984 steps; exit 1). Golden: no unexpected differences. Every failure is in code this PR does not touch, and all fail on the base too:persistence_identity_test: tokenizer and template edits reuse only identical canonical token prefixesnet: an unknown host is refused, and a connect with no listener times outvisionandfamilies.deepseek_v41.metal.vision: the release's vision_config parses to the defaults (the same test in two binaries)tensorfold-native_memcpylink check (nm -m … external _memcpy (from libSystem))serve_steps_testpassed in this run. It is flaky: it failed in an earlier run at7904411a, and it fails on the base. On base11b815e3the same command gave 17429 passed, 5 failed, 146 skipped of 17580, failing the same four tests plusserve_steps_testand the same link check.nice -n 10 zig build test-h3-image-server --summary all --cache-dir "$(mktemp -d)", uncached at the head: 43/43 steps, 7/7 tests passed. These tests run the resident server on a synthetic checkpoint, with speech arriving during each stage.Voice during a render: the procedure, workload and probes are in
docs/recipes/minimax-h3-image-metal.md, "Large resident renders and a live speech server". The renderer was built withzig build tf-h3-image-server -Dcpu=apple_m1 -Doptimize=ReleaseFastand drew 5472x3072 at seed 2201 (183 prompt tokens, six steps). The voice request usedmodel="fishaudio/drama-3"and the public sentence quoted in the recipe. Each request was sent after the render'sdrawn online and timed to the complete audio response. While it ran, a separate process tried a nonblocking exclusiveflockon/tmp/tensorfold-speech.lockevery 20 ms, and I compared/tmp/tensorfold-speech.lock.stampbefore and after.Before / after (measured at
1308131a)Same Mac, renderer executable (same SHA-256), workload and voice text on both sides.
timing_valid=false.1308131a.35889ed8and7904411aonly change when speech hands back the GPU turn, how failures drain and how the lock file is opened.4969f287and1ee76e25only touch comments and move tests between files,d842428bonly changes the probe/read ordering and adds its regression test, and5e689a34only lets the lock build on Windows. None changes the arithmetic, so I did not repeat the GPU run. These are contention numbers, not a speech-free throughput comparison.Checks on this head
5e689a34f213b5c2cbb1bb059e1e9da830b112aapython3 tools/zig/lean_check.py, on the base and on this head: 165 and 165, 0 new.Receipt
/tmp/tensorfold-speech.lock, and with no speech server holding it the render never waits.11b815e3, head5e689a34(timings at1308131a), Zig 0.17.0, Metal, Apple M5 Ultra, 256 GiB, macOS 27.0, MiniMax H3 image checkpoint per the recipe.tf-h3-image-server, and the speech server's synthesis turn. I ran these on M5 Ultra only; M1-M4 are not run.Checklist
For a change that reaches inference:
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (n/a: this PR touches no drafting, prompt resume or LLM batching. For the H3 tools, output with speech arriving mid-stage equals output without it, intest-h3-image-serverand in the 17/17 SHA-256 replay above.)--drafter, no slower than without it, greedy and sampled. (n/a: LLM decode and prompt processing are not reached. With no speech server holding the lock, each yield between blocks and stages is one open of the lock file and one nonblockingflock.)Before (voice-during-render)
https://raw.githubusercontent.com/plotarmordev/TensorFold/15270ce92983f6911d72dc56dd259152d4675411/media/before-0.mp4
After (voice-during-render)
https://raw.githubusercontent.com/plotarmordev/TensorFold/15270ce92983f6911d72dc56dd259152d4675411/media/after-0.mp4
How to check
11b815e376ce122026f3c4011029ada2a56da53cced40693b6b48e8fdff6221357320f6127eeae73Test results:
nice -n 10 zig build test test-golden --summary failuresat1308131aeef5(older head): 1905 passed, 4 failed, 30 skippednice -n 10 zig build test test-goldenat35889ed80bad(older head): 3791 passed, 4 failed, 45 skippedzig build test test-golden --cache-dir <fresh empty dir> --summary failuresat7904411a50d0(older head): 17440 passed, 5 failed, 146 skippedzig build test test-golden --summary failuresat11b815e376ce(older head): 17429 passed, 5 failed, 146 skippednice -n 10 zig build test test-golden --cache-dir <empty dir>at7904411a50d0(older head): 17441 passed, 4 failed, 146 skippednice -n 10 zig build test-h3-image-server --summary all --cache-dir <empty dir>at7904411a50d0(older head): 6 passed, 0 failed, 0 skippednice -n 10 zig build test test-golden --summary line --cache-dir .zig-cache/b2-fresh2at1ee76e250722(older head): 17441 passed, 5 failed, 146 skippedzig test zig/src/server/gpu_turn.zigatced40693b6b4: 6 passed, 0 failed, 0 skippednice -n 10 zig build test test-golden --cache-dir "$(mktemp -d)"atd842428b1439(older head): 17444 passed, 4 failed, 146 skippednice -n 10 zig build test-h3-image-server --summary all --cache-dir "$(mktemp -d)"atced40693b6b4: 7 passed, 0 failed, 0 skippednice -n 10 zig build test-server-cpu --summary allat5e689a34f213(older head): 1850 passed, 0 failed, 15 skippednice -n 10 zig build test-h3-image-server --summary allat5e689a34f213(older head): 7 passed, 0 failed, 0 skippednice -n 10 zig build test test-golden --summary failures --cache-dir "$(mktemp -d)"at5e689a34f213(older head): 17444 passed, 4 failed, 146 skippednice -n 10 zig build test test-golden --summary allatced40693b6b4: 17443 passed, 5 failed, 146 skipped