Repository navigation
Tooling: link [native] package sources on flow run, gate proof doc drift, build benchmarks on macOS - #1085
Merged
Conversation
The hand-written C called clock_gettime_nsec_np on Apple, which _POSIX_C_SOURCE hides, so none of benchmarks/publish/c built on macOS. Both the C and the Flow programs now use one static helper, bench_now_ns, built on the POSIX clock that Linux and macOS share. scripts/check_bench_publish.sh builds each benchmark in C and in Flow with implicit declarations as errors, runs them and compares results. It fails on all five before this change on macOS and passes after. run_publish.sh --quick now runs end to end on macOS. Fixes #964
full_adder, ring_buffer_fifo and matmul_vectorize had .proof.md and
.proof.tex that no generator reproduces (hand edits, an older renderer,
and a Ripple4 theorem the source no longer has). They are now what
`./flow doc proof <file>` writes. The diff is the current renderer's
output: numbering restarts at 1 per file, every binder is quantified,
multi-word names render as \text{...}, and steps cite "step N".
parity_proofs.sh compared the checked-in documents but only reported
the count. A document that differs from what flowc writes is now a
failure that names the file and the command that regenerates it.
Before: 2102/2108, FAIL (6). After: 2108/2108, PASS.
The Graphviz kernel plot (item 2) is a note and needs no change.
Fixes #1011
`flow run` and `flow compile` on the flowc host linked only the Flow C and the runtime archive, so programs using registry packages with [native] C sources (sqlite, http, compress, ...) failed to link. The package manager has a new `native-link` command. It finds the program's project, collects the [native] sources, cflags, frameworks, libs and ldflags of the installed dependencies and of the project, the same set build-native uses, and compiles each source into build/flow_native/<stem>-<key>.o. The key covers the compiler, flags, path and source contents, so an unchanged source is compiled once. C++ sources go to the C++ compiler and add the C++ library to the link. flowc_link_c asks for these objects and flags when a flow.toml in the project or in flow_packages/ declares [native], and links them ahead of the runtime archive. check_run_without_python.sh now runs examples/ecosystem sqlite_demo and app_cache from a fresh copy with python stubbed out, runs sqlite_demo twice to prove the object cache, and checks the output. Before: 4 failures (undefined _flow_sqlite_*). After: 31/31 pass. Fixes #991
godofecht
added a commit
that referenced
this pull request
Sep 30, 2026
scripts/check_bench_publish.sh (from #1085) runs in the native-tools job after the shell tests. It passes on Linux in this PR's CI.
This was referenced Sep 30, 2026
godofecht
added a commit
that referenced
this pull request
Oct 1, 2026
…-driver flowc_link_c asks the package manager (native-link) for the objects and flags of the project's and installed packages' [native] sources when a flow.toml declares [native], and links them ahead of the runtime archive. check_run_without_python.sh: 31 of 31, including sqlite_demo and app_cache.
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.
Three tooling fixes, one commit each. Each comes with a check that fails before the change and passes after.
#991:
flow runbuilds and links[native]package sourcesThe package manager has a new command,
native-link, incompiler/src/pkg.flowandpkg_main.flow. It finds the program's project and collects the[native]sources, cflags, frameworks, libs and ldflags of the installed dependencies and of the project itself. This is the same set thatbuild-nativeand the oldpackage.pyused. Each source compiles intobuild/flow_native/<stem>-<key>.o. The key covers the compiler, the flags, the path and the source contents, so an unchanged source is compiled only once. C++ sources go to the C++ compiler and add the C++ library to the link.flowc_link_cin flow-driver calls the command only when aflow.tomlin the project or inflow_packages/declares[native]. It links the objects and flags ahead of the runtime archive.scripts/check_run_without_python.shnow runs fresh copies ofexamples/ecosystem/sqlite_demoandapp_cachewith python stubbed out. It runs sqlite_demo twice to check the object cache.Undefined symbols: _flow_sqlite_*.#1011: six stale proof documents regenerated, drift is now a gate
./flow doc proof <file>regenerated full_adder, ring_buffer_fifo and matmul_vectorize. The diff matches what the current renderer writes:\text{...}compiler/scripts/parity_proofs.shused to only report the document count. It now fails on any checked-in document that differs from what flowc writes, and names the file and the command that regenerates it.#964: the published benchmarks build on macOS
The C and Flow benchmark programs now share one static helper,
bench_now_ns, built onclock_gettime(CLOCK_MONOTONIC). Linux and macOS both have it under_POSIX_C_SOURCE.The new
scripts/check_bench_publish.shbuilds each benchmark in C and in Flow with implicit declarations treated as errors, runs both, and compares their results.benchmarks/run_publish.sh --quickruns end to end on macOS, and all results agree across C, Flow, Python and Rust.Gates (macOS)
These pass: bootstrap_from_c.sh --verify, self_host_full.sh, roundtrip.sh, parse_coverage.sh --check, fmt_check.sh --check, tests/cgen/run.sh, flow test-lang, corpus_parity.sh --check, parity_typecheck.sh --check, typecheck_rules.sh, parity_{dap,dynamics_dsl,effects,field_dsl,flow_blocks,lowering,mlir,project_test,proofs,targets}.sh, python_ratchet.sh, check_pkg_commands.sh and check_pkg_parity.sh.
parity_shader_dsl.sh passes everything except the Metal e2e step, which needs the Metal Toolchain and is not installed on this machine.
The bootstrap C needs no regeneration. pkg.flow is not part of the main.flow bundle.
Fixes #991
Fixes #1011
Fixes #964