Skip to content

Add native attribution baselines to benchmark harness - #1265

Merged
godofecht merged 6 commits into
mainfrom
devin/native-baselines
Oct 7, 2026
Merged

godofecht merged 6 commits into
mainfrom
devin/native-baselines

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

Summary

  • Discover hand-written C twins under benchmarks/baselines/native/cross_harness.
  • Compile them with the same clang -O3 -march=native -lm flags used by the Flow C backend harness.
  • Record native_command, native_metrics and flow_vs_python, flow_vs_native, python_vs_native ratios.
  • Add native C twins for the eight existing runtime workload primitives.

Test plan

  • flow tool tests/bench_harness/run.flow
  • flow tool bench_harness --smoke --out /tmp/flow-native-bench.json
  • Compiled every native baseline with clang -O3 -march=native -lm

Smoke evidence

  • Harness test: bench_harness: pass=47 fail=0
  • Native commands were discovered for all eight runtime workloads.
  • Smoke ratios were emitted for every runtime workload.

Refs #745

@godofecht

Copy link
Copy Markdown
Contributor Author

Rebased onto main 97fc916 for merge. Conflicts in docs/nav.json and CHANGELOG kept both sides. main gained the #737 FFI runtime rows (ffi_scalar, ffi_batch, ffi_buffer) after this branch was cut, so --check-runtime-natives failed; added C twins for those three (f163857). Local gates: tests/bench_harness/run.flow pass=55 fail=0, bench_harness --smoke ok, test-lang 274/274, test-runtime 34/34, python/shell ratchets and script_refs pass. tests/cli shows jit_hello and test_mlir failing locally, and they fail identically on main here, so they are environment drift.

godofecht and others added 6 commits October 7, 2026 10:31
The cross-harness now discovers hand-written C twins under
benchmarks/baselines/native, compiles them with the Flow C backend's
optimization flags, and records their metrics beside the Flow and CPython
subjects. Each row reports flow_vs_python, flow_vs_native and
python_vs_native ratios so runtime losses can be attributed to generated
code instead of folded into an interpreter comparison.

Initial native subjects cover the eight runtime primitives. The harness
test checks the extended JSON shape.

Refs #745
Fill native C twins so they do the same work as Flow, add hashmap,
heapsort+search and reduction rows, and teach the harness to require a
native twin and classify flow_vs_native tax. hash_string is djb2;
hash_i64 is an fmix mix; the i64 map grows before load 1/2.

Part of #745

Co-authored-by: Abhishek Shivakumar <[email protected]>
Enable FLOW_MEM_PROFILE only on the memory suite, scale allocation and
array rows so they are not startup noise, and type collections.flow
calloc as i64 so the hashmap lang test typechecks.

Part of #745

Co-authored-by: Abhishek Shivakumar <[email protected]>
main gained runtime/ffi_scalar, ffi_batch and ffi_buffer (#1352) after
this branch was cut, so --check-runtime-natives failed on the rebase.
Each twin makes the same noinline call from C, so flow_vs_native is the
cost of the Flow side of the crossing. Also rewords four sentences in
runtime-primitive-attribution.md that the prose lint rejects.
install-stdlib and add-stdlib pin the cksum of lib/stdlib/collections.flow,
which this branch rewrites. scripts/check_pkg_parity.flow: pass=134 fail=0.
…orkloads

allocation, arrays, numerical and sorting under
benchmarks/cross_harness/runtime changed on this branch, so their
recorded MLIR digests in compiler/fixtures/mlir/corpus.txt changed too.
Only those four lines move. parity_mlir: corpus programs=2526 fail=0.
@godofecht
godofecht force-pushed the devin/native-baselines branch from 546c2fe to cd54266 Compare October 7, 2026 09:31
@godofecht
godofecht merged commit 9328e2d into main Oct 7, 2026
37 checks passed
godofecht added a commit that referenced this pull request Oct 7, 2026
Port of the startup cohort from the original #1410 branch onto main after
#1265 (native baselines). The startup_* rows reuse the cold sources and
twins, build the Flow program before timing, and every row now carries a
timing_scope. The draft's profile flag is dropped: main already profiles
only the memory suite (#1341).
@godofecht
godofecht deleted the devin/native-baselines branch October 12, 2026 23:02
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