Repository navigation
The host's column grows to a LINE of tasks a thread again, a drain splits its rows into units of 32 a thread, and rings rewind between turns (stacked on #1092) - #1269
Merged
Conversation
…nt rows, the main thread takes rows, and a turn visits only the rows that can hold a task bendlang#1092's five commits, squashed onto main. The emitter cleanups its last commit carried are already on main (bendlang#1235); the column grow keeps bendlang#1171's row per thread, and a column grow still opens every row to the turns. Co-Authored-By: Nicolas Abril <[email protected]> Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… row bound says why it holds pool_turn waited for the last rows with a sched_yield loop that never slept; on macOS that is a busy core for as long as the slowest row runs. The main thread now yields 128 times and then sleeps on pool_join, which the last finisher signals; a short turn still ends inside the yields and pays no wake. cube_run's comment states the invariant the turn bound rests on: a drain deals task g to a row at most g, a row grows into itself, and only a column grow reaches any row. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…n splits its rows into units fine enough to keep 32 a thread Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ot 0, so a ring's planes are the tasks it held at once, not every push of the run Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ng an overflow left past RING_LEN; a column grow's bound is the rows 0 to cur - 1 it reached; pool_step is taken once per claim Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…rewind's comment is one line Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This was referenced Oct 2, 2026
U32 division and remainder halve the dividend only on Metal; the host and CUDA divide directly
#1277
Merged
Lorenzobattistela
added a commit
that referenced
this pull request
Oct 3, 2026
36 commits since 2.0.34: the M1/M2 Metal pipeline crash (#1154), names keyed ns:name so a library's CID(None) means its own None (#1045), less CPU memory from the host's column and a spin's lent variable (#1171, #1269, #1243), equality-proof arrays (#1130), timers firing under a busy loop (#1122), and the CLI and --verdict fixes listed in CHANGELOG.md. Gates on 5e56772 over the bastion: repo 49/49, ping 46/46, test 1540/1540, perf 121/124. CHANGELOG.md and VERSION name 2.0.35. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This was referenced Oct 5, 2026
nicolas-abril
added a commit
to nicolas-abril/bend
that referenced
this pull request
Nov 5, 2026
… park case The JS io_sys bound pread for the old file_read.js, which moved to readvSync in bendlang#1881. ALC's extra row was for the old ALC[1 + arg] indexing; the main thread uses ALC[0] and workers ALC[1..pool_size-1] since bendlang#1269. io_park_add's w->next == w case writes what the next line writes anyway. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Stacked on #1092. This branch carries #1092's two commits (
c3b3485a,869f3208) plus four of its own:eca79903,4443868d,c419a203and3e8f8a97. Review those four only. They need #1092's row-bounded turns and its claim word, so this should merge after #1092. The numbers below compare main (57b6c15) with the whole branch, #1092 included.What changes
eca79903). The host grows its column to a row per thread, so a 10-thread pool drains 80 units, not 16 #1171 grew the column topool_sizerows of 128 tasks: 2,048 at 16 threads. On tree-matmul that starts all 384 rounds at once, each holding its own matrices. The column now grows back to aLINEof tasks a thread. To keep The host grows its column to a row per thread, so a 10-thread pool drains 80 units, not 16 #1171's balance gain, a drain splits its rows into finer units instead (pool_step: as few lanes as leave 32 units a thread). After a column grow, a turn's row bound is the rows that grow reached.4443868d). Ring positions only ever increased, so over a run a ring touched a new plane, a 16 KB page, for every push. Each plane holds one slot for 2,048 lanes, so this reached 14–43 MB on kmeans and tree-bitonic. Between turns no lane runs, so the host now moves each ring of the turn's rows back to slot 0. It re-pushes the ring's pending tasks and clears the slots it wrote, because their lap bit would otherwise read as written. The GPU path and the slot protocol are unchanged.c419a203,3e8f8a97).ring_rewindre-pushes throughring_push, so the slot format lives in one place.ERR_RINGoverflow left pastRING_LEN, which would otherwise overflow its buffer.pool_stepis computed once per claim.row_growandpool_stepare dropped, andring_rewind's is one line.comp.ts63,399 → 63,821 ttok over A forking call no longer pays a condvar wake per pool turn: turns count rows, the main thread takes rows, and a turn visits only the rows that can hold a task #1092 (+422; 179 under the cap).Main vs this branch
Paired A/B on the cluster. Each bench and mode ran on one mini: both builds use the perf gate's cc line and flags, with one warm run each, then 5 alternating timed runs, and each value is the median. Every output matches.
RSS (MB):
PAR-GPU RSS is unchanged: 13.4–14.0 MB on both.
Time (branch / main, median of the 5 paired ratios):
Gates
gates/repo.tspasses, 50 / 50.gates/test.tspasses, 1514 / 1514.gates/perf.tspasses 113 / 117 on this branch, against 106 / 117 on main.Cells that pass here and fail on main:
Still failing:
Not run
🤖 Generated with Claude Code