Skip to content
This repository was archived by the owner on Jul 20, 2026. It is now read-only.

[repo] bump buddy-compiler to the latest version#6

Merged
shirohasuki merged 68 commits into
buckyballfrom
main
Apr 27, 2026
Merged

[repo] bump buddy-compiler to the latest version#6
shirohasuki merged 68 commits into
buckyballfrom
main

Conversation

@shirohasuki

Copy link
Copy Markdown
Member

No description provided.

zhanghb97 and others added 30 commits March 22, 2026 15:12
…ligned lowering. (buddy-compiler#724)

* [IME] Add FP16 matmul support for Linalg->IME and unify aligned/non-aligned lowering.

* trigger CI
sched.h api are not avaliable in macOS
1. ccache is not enabled, `brew install ccache` failed on our local machine macOS 12.6
2. use python=3.12 in macos, because
- py314 doesn't support pytorch 2.10.0
- py313 doesn't support sentencepiece
…#748)

* [example] Add Gemma4-E2B end-to-end inference example
Add a new end-to-end example for the google/gemma-4-E2B-it model with
hybrid attention (sliding window + full attention) and shared KV cache.
New files:
- examples/BuddyGemma4/: AOT import script, C++ inference driver,
  CMakeLists, vocabulary, and a post-import MLIR patch for fixing
  constant-folded cumulative_length in the decode subgraph.
Modified files:
- TextContainer.h: add tokenizeGemma4() and setTokenCnt() for Gemma4
  SentencePiece tokenization with chat template support.
- func.py: fix scalar param extraction to produce rank-0 memref instead
  of memref<1xf32>, resolving type mismatch with subgraph declarations.
- examples/CMakeLists.txt: register BuddyGemma4 subdirectory.

* [example] Add Gemma4-E2B end-to-end inference example
Add a new end-to-end example for the google/gemma-4-E2B-it model with
hybrid attention (sliding window + full attention) and shared KV cache.
New files:
- examples/BuddyGemma4/: AOT import script, C++ inference driver,
  CMakeLists, vocabulary, and a post-import MLIR patch for fixing
  constant-folded cumulative_length in the decode subgraph.
Modified files:
- TextContainer.h: add tokenizeGemma4() and setTokenCnt() for Gemma4
  SentencePiece tokenization with chat template support.
- func.py: fix scalar param extraction to produce rank-0 memref instead
  of memref<1xf32>, resolving type mismatch with subgraph declarations.
- examples/CMakeLists.txt: register BuddyGemma4 subdirectory.

* Add a new end-to-end example for the google/gemma-4-E2B-it model with
hybrid attention (sliding window + full attention) and shared KV cache.
New files:

examples/BuddyGemma4/: AOT import script, C++ inference driver,
CMakeLists, vocabulary, and a post-import MLIR patch for fixing
constant-folded cumulative_length in the decode subgraph.
Modified files:
TextContainer.h: add tokenizeGemma4() and setTokenCnt() for Gemma4
SentencePiece tokenization with chat template support.
func.py: fix scalar param extraction to produce rank-0 memref instead
of memref<1xf32>, resolving type mismatch with subgraph declarations.
examples/CMakeLists.txt: register BuddyGemma4 subdirectory.

Made-with: Cursor

* Add a new end-to-end example for the google/gemma-4-E2B-it model with
hybrid attention (sliding window + full attention) and shared KV cache.
New files:

examples/BuddyGemma4/: AOT import script, C++ inference driver,
CMakeLists, vocabulary, and a post-import MLIR patch for fixing
constant-folded cumulative_length in the decode subgraph.
Modified files:
TextContainer.h: add tokenizeGemma4() and setTokenCnt() for Gemma4
SentencePiece tokenization with chat template support.
func.py: fix scalar param extraction to produce rank-0 memref instead
of memref<1xf32>, resolving type mismatch with subgraph declarations.
examples/CMakeLists.txt: register BuddyGemma4 subdirectory.

* Add a new end-to-end example for the google/gemma-4-E2B-it model with
hybrid attention (sliding window + full attention) and shared KV cache.
New files:

examples/BuddyGemma4/: AOT import script, C++ inference driver,
CMakeLists, vocabulary, and a post-import MLIR patch for fixing
constant-folded cumulative_length in the decode subgraph.
Modified files:
TextContainer.h: add tokenizeGemma4() and setTokenCnt() for Gemma4
SentencePiece tokenization with chat template support.
func.py: fix scalar param extraction to produce rank-0 memref instead
of memref<1xf32>, resolving type mismatch with subgraph declarations.
examples/CMakeLists.txt: register BuddyGemma4 subdirectory.

* Add a new end-to-end example for the google/gemma-4-E2B-it model with
hybrid attention (sliding window + full attention) and shared KV cache.
New files:

examples/BuddyGemma4/: AOT import script, C++ inference driver,
CMakeLists, vocabulary, and a post-import MLIR patch for fixing
constant-folded cumulative_length in the decode subgraph.
Modified files:
TextContainer.h: add tokenizeGemma4() and setTokenCnt() for Gemma4
SentencePiece tokenization with chat template support.
func.py: fix scalar param extraction to produce rank-0 memref instead
of memref<1xf32>, resolving type mismatch with subgraph declarations.
examples/CMakeLists.txt: register BuddyGemma4 subdirectory.
  This commit advances the Triton-to-VIR lowering pipeline by addressing two gaps:
  (1) end-to-end support from linalg to VIR (LinalgToVIRPass.cpp), and
  (2) end-to-end support from VIR to vector (VIRToVectorPass.cpp).

  It now supports linalg.matmul on the main path, supports linalg.reduce through scalar fallback, and enhances the corresponding VIR->vector lowering. Details are listed as follows.

Part 1: LinalgToVIR updates (LinalgToVIRPass.cpp)
  - Expanded linalg.generic coverage, including broader arith/math ops (i.e., `arith.constant/add/sub/mul/div/rem/cmp/select/bitwise/shift/minmax/maxnum` and `math.exp`).
  - Added `linalg.matmul` lowering and vectorization with broadcast.
  - Added linalg.reduce lowering via scalar fallback.
  - Strengthened fallback index-only generic and simple cast generic via scalar fallback.
  - Improved lowering robustness with yield/store handling.
  - In short, linalg2vir-report-summary.md now reflects a larger supported set of
    linalg ops/shapes and their corresponding lowering functions.

Part 2: VIRToVector updates (VIRToVectorPass.cpp)
  - Enhanced mixed-dialect lowering inside vir.set_vl.
  - Added vir.select op and lowering.
  - Improved vir.load/vir.store index semantics (including empty-index conventions) to
    match LinalgToVIR-generated IR.
  - Improved recursive affine.for lowering and vector/tail-scalar coherence.

Part 3: New/updated test coverage
  - Added structural lowering tests for linalg->VIR patterns (set_vl/load/store/
    broadcast and related forms).
  - Added fallback tests for reduce (addf/maxnumf), index-only generic, and cast generic.
  - Added runtime-validated linalg->VIR->vector tests for elementwise families
    (1D/2D, i32/f32, scalar broadcast, mask/select).
  - Added runtime-validated generic-family tests (arith chains, bitwise/shift, cmp/select,
    min/max, math.exp).
  - Added runtime-validated matmul-family tests (basic / accumulate / tail).
xlinsist and others added 29 commits April 13, 2026 16:38
The VIR-related conversion tests now live under tests/Conversion/LinalgToVIR so the coverage is easier to find and maintain as one surface; Apply clang-format for core cpp files.
- Refactored build-mlir into a reusable step. Now TestBuild.yml is just a wrapper around ci-common/action.yml.
- Added a new CI workflow test-example.yml that attempts to compile and run all the examples.
- The tests themselves are built on ctest, where each test case asserts the result of command execution.
- test-example is not triggered automatically because it takes a long time and requires downloading models. However, GitHub does not provide a convenient manual trigger method. So the approach taken here is: allow users with appropriate permissions to trigger the workflow by commenting /run-example in a PR. Also, due to GitHub's limitations, this workflow must be merged into main before it can be triggered. Therefore, we must merge first before we can test.
…mension (buddy-compiler#751)

* [VIR] Force the last dimension of VIR to be generated as a dynamic dimension, and change the lowering target for non-unit-stride vir.vec

* [VIR] Fix test_gather_scatter bug

* [VIR] Add temporary support for linalg.map

* [VIR] Add support for arith.maxnumf/minnumf

* [VIR] Format code
@shirohasuki
shirohasuki merged commit ce66e6f into buckyball Apr 27, 2026
0 of 5 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.