Skip to content

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

Merged
godofecht merged 7 commits into
mainfrom
feat-math-vectorization-13522931439501081923
Oct 4, 2026
Merged

godofecht merged 7 commits into
mainfrom
feat-math-vectorization-13522931439501081923

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

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.


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

@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.

…ernels 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]>
@cursor
cursor Bot force-pushed the feat-math-vectorization-13522931439501081923 branch from b5c0792 to 7674ac3 Compare October 3, 2026 22:04
godofecht and others added 5 commits October 4, 2026 00:21
#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]>
#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
godofecht merged commit c1bc2ad into main Oct 4, 2026
34 checks passed
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]>
@godofecht
godofecht deleted the feat-math-vectorization-13522931439501081923 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