Repository navigation
A histogram bench: bend-parallel's parallel histogram over one shared Array<U32>, with C, TS and Lean twins - #1278
Merged
Conversation
… Array<U32>, 128 fresh batches of 2^24 keys into 256 buckets with every round checksummed, with C, TS and Lean twins and its apple_m4 pins Co-Authored-By: Claude Opus 5.5 (1M context) <[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.
The bench
bench/runtime/histogram: a parallel histogram over one flatArray<U32>. It's the suite's first shared-array, multi-pass case: every other bench is one fork tree over tree-shaped data or independent items.histogram.bendat 45a161a (Apache-2.0, the same license as Bend). It's ported as is, except that its sort-only path (sc,ins.go) is dropped andScan.halfis inlined. The header credits it.!, and handed from round to round as the library intends.main.c,main.tsandmain.lean, single-threaded and doing the same steps, including the two-step column pass the library uses from 2^12 rows up.@unsafeArray.forkandArray.join, as bend-parallel does. Bend has no safe way to give lanes disjoint slices of one array. So--check-onlylists the 13 defs that rely on them and exits 1.bend main.bend -o main, which the perf gate runs, builds and runs normally.Correctness
Pins
apple_m4.txtgains the histogram row. It was measured with the perf gate's own cell script for this bench only, three runs a cell, medians, the same way--pintakes them; the other rows are untouched.apple_m4_max.txt(the record pins, fromgen_pins.tson the M4 Max) has no row yet, so the bench is not on the charts until that machine repins.Against C
On the cluster, single-threaded: Bend 1.72 s, the C twin 1.07 s. On 16 threads: Bend 0.367 s, against 0.248 s for a pthreads C version (per-thread private histograms, written for the comparison and not in the tree). Both scale about 4.6–4.7x, and both are near the minis' memory bandwidth.
Most of the single-thread gap is in two places:
Gates
bend2/comp.ts's cap, as main does today (64,274 > 64,000 since 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). This PR doesn't touchcomp.ts.Not run
🤖 Generated with Claude Code