Skip to content

Commit 3dbdf0d

Browse files
authored
Merge branch 'buddy-compiler:main' into main
2 parents 07f12b8 + caaedbb commit 3dbdf0d

49 files changed

Lines changed: 9457 additions & 953 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/TestBuild.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ jobs:
7979
if: matrix.arch == 'x64' && steps.cache-llvm-source.outputs.cache-hit != 'true'
8080
run: |
8181
rm -rf llvm
82+
rm -rf .git/modules/llvm
8283
git submodule update --init --recursive llvm
8384
8485
# 5. Cache the LLVM build directory.

.github/workflows/build-manylinux.yml

Lines changed: 80 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,64 +13,121 @@ permissions:
1313

1414
jobs:
1515
wheel:
16-
runs-on: ubuntu-22.04
16+
name: Build (${{ matrix.arch }}, py${{ matrix.python }})
17+
timeout-minutes: 360
18+
continue-on-error: ${{ matrix.experimental }}
19+
20+
concurrency:
21+
group: buddy-mlir-manylinux-${{ matrix.arch }}-py${{ matrix.python }}
22+
cancel-in-progress: true
23+
1724
strategy:
1825
fail-fast: false
1926
matrix:
27+
arch: [x64, riscv64]
2028
python: ["3.10", "3.11", "3.12", "3.13"]
21-
torch_version: ["2.8"] # placeholder; not used in build, keeps matrix extensible
29+
include:
30+
- arch: x64
31+
target_arch: x86_64
32+
experimental: false
33+
- arch: riscv64
34+
target_arch: riscv64
35+
experimental: true
36+
37+
runs-on:
38+
- self-hosted
39+
- ${{ matrix.arch }}
40+
2241
steps:
23-
- name: Checkout
42+
- name: Checkout repository (x64)
43+
if: matrix.arch == 'x64'
2444
uses: actions/checkout@v4
2545
with:
26-
submodules: true
46+
submodules: false
47+
48+
- name: Checkout from local Gitea (riscv64)
49+
if: matrix.arch == 'riscv64'
50+
run: |
51+
# Self-hosted workspaces are dirty; reset remotes and force the exact GitHub SHA.
52+
git remote remove origin || true
53+
git remote remove github || true
54+
git remote add origin https://community-ci.openruyi.cn/RuyiAI-Stack/buddy-mlir
55+
git remote add github https://github.com/buddy-compiler/buddy-mlir.git
56+
git fetch --depth=1 origin
57+
git fetch github ${{ github.sha }}
58+
git checkout --force ${{ github.sha }}
59+
git clean -fdx
2760
28-
- name: Record LLVM submodule commit
29-
id: llvm_rev
30-
run: echo "sha=$(git -C llvm rev-parse HEAD)" >> "$GITHUB_OUTPUT"
61+
- name: Prepare variables
62+
id: vars
63+
run: |
64+
set -euo pipefail
65+
PY_VER="${{ matrix.python }}"
66+
PY_NODOT="${PY_VER//./}"
67+
PY_TAG="cp${PY_NODOT}-cp${PY_NODOT}"
68+
echo "py_tag=${PY_TAG}" >> "$GITHUB_OUTPUT"
69+
echo "llvm_sha=$(git rev-parse HEAD:llvm)" >> "$GITHUB_OUTPUT"
3170
3271
- name: Cache LLVM build tree
3372
id: cache-llvm-build
3473
uses: actions/cache@v4
3574
with:
36-
path: llvm/build.docker
37-
key: llvm-${{ runner.os }}-${{ matrix.python }}-${{ steps.llvm_rev.outputs.sha }}
75+
path: llvm/build-docker/${{ matrix.target_arch }}/${{ steps.vars.outputs.py_tag }}
76+
key: llvm-${{ runner.os }}-${{ matrix.target_arch }}-${{ matrix.python }}-${{ steps.vars.outputs.llvm_sha }}
77+
78+
- name: Prepare LLVM source
79+
id: llvm
80+
run: |
81+
set -euo pipefail
82+
LLVM_BUILD_DIR="llvm/build-docker/${{ matrix.target_arch }}/${{ steps.vars.outputs.py_tag }}"
83+
if [ "${{ steps.cache-llvm-build.outputs.cache-hit }}" = "true" ] && \
84+
[ -f "${LLVM_BUILD_DIR}/.manylinux-llvm-ready" ]; then
85+
echo "cache_hit=true" >> "$GITHUB_OUTPUT"
86+
else
87+
rm -rf "${LLVM_BUILD_DIR}"
88+
git submodule update --init --recursive llvm
89+
echo "cache_hit=false" >> "$GITHUB_OUTPUT"
90+
fi
91+
92+
- name: Clean package output
93+
run: |
94+
set -euo pipefail
95+
# Keep the cached LLVM install tree; only clear the previous buddy outputs.
96+
rm -rf "build-docker/${{ matrix.target_arch }}/${{ steps.vars.outputs.py_tag }}/dist"
97+
rm -rf "build-docker/${{ matrix.target_arch }}/${{ steps.vars.outputs.py_tag }}/target"
3898
3999
- name: Build manylinux wheel in container
40100
run: |
41101
set -euo pipefail
42-
PY_VER="${{ matrix.python }}"
43-
PY_NODOT="${PY_VER//./}"
44-
PY_TAG="cp${PY_NODOT}-cp${PY_NODOT}"
45-
export TORCH_VERSION="${{ matrix.torch_version }}"
46-
export LLVM_CACHE_HIT="${{ steps.cache-llvm-build.outputs.cache-hit }}"
47-
./scripts/release_wheel_manylinux.sh "${PY_TAG}"
102+
export LLVM_CACHE_HIT="${{ steps.llvm.outputs.cache_hit }}"
103+
./scripts/release_wheel_manylinux.sh "${{ steps.vars.outputs.py_tag }}" "${{ matrix.target_arch }}"
48104
49-
- name: Upload wheels
105+
- name: Upload build artifacts
50106
uses: actions/upload-artifact@v4
51107
with:
52-
name: wheels-py${{ matrix.python }}-torch${{ matrix.torch_version }}
53-
path: build.docker/dist/*.whl
108+
name: wheels-${{ matrix.target_arch }}-py${{ matrix.python }}
109+
path: |
110+
build-docker/${{ matrix.target_arch }}/${{ steps.vars.outputs.py_tag }}/target/*manylinux*.whl
111+
build-docker/${{ matrix.target_arch }}/${{ steps.vars.outputs.py_tag }}/target/*.tar.gz
54112
55113
release:
56114
needs: wheel
57115
runs-on: ubuntu-22.04
58116
steps:
59-
- name: Checkout
60-
uses: actions/checkout@v4
61-
62117
- name: Download wheels
63118
uses: actions/download-artifact@v4
64119
with:
65120
pattern: wheels-*
66-
path: dist
121+
path: dist/wheels
67122
merge-multiple: true
68123

69124
- name: Upload assets
70125
uses: softprops/action-gh-release@v2
71126
with:
72127
tag_name: ${{ inputs.version }}
73128
overwrite_files: true
74-
files: dist/*manylinux*.whl
129+
files: |
130+
dist/wheels/*manylinux*.whl
131+
dist/wheels/*.tar.gz
75132
env:
76133
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,9 @@ add_custom_target(check-buddy
243243
# Target install
244244
#-------------------------------------------------------------------------------
245245

246-
# Install frontend interfaces into include directory, so that the downstream project can use them in distribution
247-
install(DIRECTORY buddy/Core buddy/DAP buddy/DIP buddy/LLM
246+
# Install frontend interfaces into include directory, so that the downstream
247+
# project can use them in distribution.
248+
install(DIRECTORY frontend/Interfaces/buddy
248249
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/buddy-mlir
249250
COMPONENT buddy-mlir-interfaces-headers
250251
FILES_MATCHING
@@ -261,7 +262,7 @@ configure_package_config_file(
261262

262263
write_basic_package_version_file(
263264
${CMAKE_CURRENT_BINARY_DIR}/BuddyMLIRConfigVersion.cmake
264-
VERSION 0.1.0
265+
VERSION 0.0.1
265266
COMPATIBILITY AnyNewerVersion
266267
)
267268

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,26 @@ $ ninja check-e2e
8686
We use `setuptools` to bundle CMake outputs (Python packages, `bin/`, and
8787
`lib/`) into a single wheel.
8888

89-
run `./scripts/release_wheel_manylinux.sh`.
89+
Build x86_64 artifacts:
9090

91-
This script calls `docker run` internally to enter the manylinux container, builds LLVM and buddy_mlir, and writes the wheel to `./build.docker/dist`.
91+
```bash
92+
./scripts/release_wheel_manylinux.sh cp310-cp310 x86_64
93+
```
94+
95+
Build riscv64 artifacts:
96+
97+
```bash
98+
./scripts/release_wheel_manylinux.sh cp310-cp310 riscv64
99+
```
100+
101+
This script calls `docker run` internally to enter the offical manylinux container,
102+
builds LLVM and buddy_mlir, and writes artifacts to:
103+
104+
- `./build-docker/x86_64/<py_tag>/target`
105+
- `./build-docker/riscv64/<py_tag>/target`
106+
107+
See [Manylinux release notes](./docs/ManylinuxReleaseNotes.md) for current
108+
known build notes.
92109

93110
Install and test the wheel:
94111

0 commit comments

Comments
 (0)