Skip to content

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
nicolas-abril merged 6 commits into
bendlang:mainfrom
nicolas-abril:pool-lane-units
Oct 2, 2026

Conversation

@nicolas-abril

@nicolas-abril nicolas-abril commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #1092. This branch carries #1092's two commits (c3b3485a, 869f3208) plus four of its own: eca79903, 4443868d, c419a203 and 3e8f8a97. 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

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):

bench SEQ-CPU main → branch PAR-CPU main → branch
tree-matmul 2.7 → 2.3 68.5 → 14.5
tree-radix 651.3 → 650.5 825.1 → 656.5
tree-bitonic 146.9 → 132.1 178.1 → 141.7
kmeans 20.8 → 9.3 22.9 → 10.8
merkle 130.0 → 129.7 131.1 → 130.3
hashmap 2.3 → 2.0 9.5 → 8.6
the other 10 1.9–2.2 → 1.6–1.7 2.8–4.1 → 2.1–2.9

PAR-GPU RSS is unchanged: 13.4–14.0 MB on both.

Time (branch / main, median of the 5 paired ratios):

SEQ-CPU PAR-CPU PAR-GPU
geomean 1.001 0.985 0.995
range 0.999 to 1.009 0.929 to 0.999 0.965 to 1.024
  • PAR-CPU: no bench is slower. The largest gains are on tree-radix (0.929), tree-matmul (0.953), kmeans (0.970) and tree-bitonic (0.982).
  • SEQ-CPU is within 0.4% everywhere except tree-radix, which is +0.9%.
  • PAR-GPU has no cell whose 95% interval excludes 1.

Gates

  • Repo gate: gates/repo.ts passes, 50 / 50.
  • Test gate: gates/test.ts passes, 1514 / 1514.
  • Perf gate: gates/perf.ts passes 113 / 117 on this branch, against 106 / 117 on main.

Cells that pass here and fail on main:

PAR-CPU space main branch
tree-matmul 4.35x 0.94x
mandelbrot 1.47x 0.85x
tree-radix 1.33x 1.07x
nbody 1.27x 0.87x
gameoflife 1.21x 0.85x
raytrace 1.18x 0.84x
kmeans 1.16x 0.53x

Still failing:

  • PAR-GPU time on mandelbrot, merkle and nbody. These fail on both main and the branch. They're the 60–100 ms cells, which vary from run to run.
  • tree-matmul SEQ-CPU time reads 1.24x on the branch and 1.05x on main. This is the node, not the code. The paired A/B ran main and the branch on the same mini and measured 2.30 s for both. A rerun of that cell alone, on another mini, measured 1.94–1.97 s for both. Both scripts give this cell the same job index, so it lands on the same mini, which looks about 18% slower here.

Not run

🤖 Generated with Claude Code

costamatheus97 and others added 4 commits October 1, 2026 17:10
…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]>
@nicolas-abril nicolas-abril changed the title The host's column grows to a LINE of tasks a thread again, and a drain splits its rows into units fine enough to keep 32 a thread (stacked on #1092) 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) Oct 2, 2026
nicolas-abril and others added 2 commits October 2, 2026 16:08
…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]>
@nicolas-abril
nicolas-abril merged commit fb6f32a into bendlang:main Oct 2, 2026
@nicolas-abril
nicolas-abril deleted the pool-lane-units branch October 2, 2026 15:02
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]>
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants