Skip to content

feat: FFI zero-copy buffer handoff ABI and benchmarks - #1277

Merged
godofecht merged 11 commits into
mainfrom
issue-737-ffi-buffer-430039128528191396
Oct 4, 2026
Merged

godofecht merged 11 commits into
mainfrom
issue-737-ffi-buffer-430039128528191396

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

Defines a stable zero-copy buffer ABI (ffi_buffer_handoff.flow) for contiguous FFI data:

  • ffi_buffer_owned: transfers ownership and deallocation responsibility.
  • ffi_buffer_borrowed: retains ownership for zero-copy access.
  • Includes FFIInstrumentation for copy vs zero-copy instrumentation tracking.
  • Adds benchmarks/micro/ffi_boundary_benchmark.flow to measure and prove break-even batching overhead.
  • Includes tests and documentation.

PR created automatically by Jules for task 430039128528191396 started by @godofecht

Part of #737

Defines a stable zero-copy buffer ABI (`ffi_buffer_handoff.flow`) for contiguous FFI data:
- `ffi_buffer_owned`: transfers ownership and deallocation responsibility.
- `ffi_buffer_borrowed`: retains ownership for zero-copy access.
- Includes `FFIInstrumentation` for copy vs zero-copy instrumentation tracking.
- Adds `benchmarks/micro/ffi_boundary_benchmark.flow` to measure and prove break-even batching overhead.
- Includes tests and documentation.

Co-authored-by: godofecht <[email protected]>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@godofecht
godofecht merged commit 7d79d0b into main Oct 4, 2026
34 checks passed
cursor Bot pushed a commit that referenced this pull request Oct 4, 2026
#1277 added README.md and src/buffer_handoff.flow and grew src/lib.flow
in registry/packages/ffi, but left the install/sync/add snapshots stale.
That made flowc self-host fail on Package dependency goldens. Record the
new file list and checksums only.

Co-authored-by: Abhishek Shivakumar <[email protected]>
cursor Bot pushed a commit that referenced this pull request Oct 4, 2026
#1277 added registry/packages/ffi/README.md and src/buffer_handoff.flow
and grew src/lib.flow, but left tests/pkg_parity checksums stale. The
self-host "Package dependency goldens" step failed install-ffi, sync-ffi,
add-ffi, and add-at-ffi (130 pass / 4 fail).

Co-authored-by: Abhishek Shivakumar <[email protected]>
cursor Bot pushed a commit that referenced this pull request Oct 4, 2026
#1277 added README.md and buffer_handoff.flow and grew lib.flow, which
stales the install/sync/add ffi snapshots used by check_pkg_parity.
Same class of CI failure already patched on #1334/#1318.

Co-authored-by: Abhishek Shivakumar <[email protected]>
godofecht added a commit that referenced this pull request Oct 4, 2026
* perf: establish benchmark guardrails and publish helpers (#648)

Publishes Completed Jules session 6095442969705476919 for issue #648:
refresh RESULTS.md, extend run_benchmarks.flow, and improve bench_publish.

* fix: refresh MLIR corpus digests after #1291 bench expansions

#1291 replaced dummy return-0 stubs in file_transform, json_parse, and
strings with real programs but left the recorded MLIR digests. That made
flowc self-host fail on PRs that run the full corpus. Update only those
three hashes to the current flowc output.

Co-authored-by: Abhishek Shivakumar <[email protected]>

* fix: refresh ffi package-dependency goldens after #1277

#1277 added README.md and src/buffer_handoff.flow and grew src/lib.flow
in registry/packages/ffi, but left the install/sync/add snapshots stale.
That made flowc self-host fail on Package dependency goldens. Record the
new file list and checksums only.

Co-authored-by: Abhishek Shivakumar <[email protected]>

---------

Co-authored-by: Abhishek Shivakumar <[email protected]>
Co-authored-by: Cursor Agent <[email protected]>
godofecht added a commit that referenced this pull request Oct 4, 2026
…ernels across C/MLIR backends (#1318)

* feat(mlir): Vectorize transcendental math and RBF-style elementwise kernels across C/MLIR backends

Closes #751.

Implemented direct lowering of transcendental math functions (e.g. `exp`, `log`, `sin`, `pow`, etc.)
to the MLIR `math` dialect for the `mlir` backend. They are properly typed and mapped when declared
as `extern` functions in the source file.

C backend utilizes `#pragma clang loop vectorize` hints along with `-fveclib=libmvec` flags
which were already partially implemented in `cgen.flow` and `tools/run/main.flow`.

Added elementwise benchmarks for RBF-style operations (`rbf_kernel.flow`) and
a Gaussian Naive Bayes likelihood (`gaussian_nb.flow`) calculation to ensure
accuracy bounds (testing against expected analytical values to avoid semantic bugs)
and to track performance baselines in `benchmarks/cross_harness/tests/`.

Generated the bootstrap C sources and ensured self-hosting works.

Co-authored-by: godofecht <[email protected]>

* test: refresh MLIR corpus digests for #1291 harness programs

#1291 replaced the file_transform, json_parse, and strings cross-harness
stubs with real programs but left the MLIR corpus goldens at the empty
main() digest. Self-host then failed those three entries. Record the
current flowc MLIR for the new sources.

Co-authored-by: Abhishek Shivakumar <[email protected]>

* test: refresh ffi package-dependency goldens after #1277

#1277 added registry/packages/ffi/README.md and src/buffer_handoff.flow
and grew src/lib.flow, but left tests/pkg_parity checksums stale. The
self-host "Package dependency goldens" step failed install-ffi, sync-ffi,
add-ffi, and add-at-ffi (130 pass / 4 fail).

Co-authored-by: Abhishek Shivakumar <[email protected]>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: godofecht <[email protected]>
Co-authored-by: Cursor Agent <[email protected]>
godofecht added a commit that referenced this pull request Oct 4, 2026
* feat(pygments): add missing tokens and corpus verification

- Added `«»∪∩σ@"?$\` to the lexer punctuation/operators.
- Updated `test_lexer.py` to recursively test all repository Flow files.
- Documented in `ecosystem-recognition.md` that upstreaming is blocked per Pygments external community size requirements.
- Added GitHub Actions CI job to verify the pygments tests locally.

Co-authored-by: godofecht <[email protected]>

* fix: refresh MLIR corpus digests for rewritten cross-harness programs

#1291 replaced dummy return-0 stubs in three cross-harness benchmarks
with real programs but left compiler/fixtures/mlir/corpus.txt on the
old stub digests. The self-host MLIR parity job was skipped on that
main push, so the drift only showed up when this PR touched ci.yml.

Co-authored-by: Abhishek Shivakumar <[email protected]>

* fix: refresh ffi pkg_parity goldens after buffer handoff files

#1277 added README.md and buffer_handoff.flow and grew lib.flow, which
stales the install/sync/add ffi snapshots used by check_pkg_parity.
Same class of CI failure already patched on #1334/#1318.

Co-authored-by: Abhishek Shivakumar <[email protected]>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: godofecht <[email protected]>
Co-authored-by: Cursor Agent <[email protected]>
cursor Bot pushed a commit that referenced this pull request Oct 4, 2026
Bring the branch onto 29f4d86 so self-host picks up the #1277 ffi
package goldens and #1291 MLIR corpus digests already refreshed on main.
Keep main's bootstrap C here; regenerate after the math-intrinsic source
is settled.

Co-authored-by: Abhishek Shivakumar <[email protected]>
@godofecht
godofecht deleted the issue-737-ffi-buffer-430039128528191396 branch October 12, 2026 23:03
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.

1 participant