Skip to content

Commit e0bb34b

Browse files
committed
rewrite generator using clangast
1 parent a175c1d commit e0bb34b

File tree

20 files changed

+637
-4240
lines changed

20 files changed

+637
-4240
lines changed

.github/workflows/build_test_release_eudsl.yml

Lines changed: 8 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,18 @@ jobs:
9595
else
9696
export RELEASE_PREFIX="mlir_${{ matrix.name }}"
9797
fi
98-
RELEASE_URL=$(gh release view latest --json assets -q '.assets |= sort_by(.createdAt) | .assets | map(select(.name | contains(env.RELEASE_PREFIX))) | .[-1] | .url')
98+
RELEASE_URL=$(gh release view llvm --json assets -q '.assets |= sort_by(.createdAt) | .assets | map(select(.name | contains(env.RELEASE_PREFIX))) | .[-1] | .url')
9999
curl -sLO $RELEASE_URL
100100
tar xf $RELEASE_PREFIX*.tar.gz
101101
102102
if [[ "${{ matrix.os }}" == "ubuntu" ]]; then
103103
echo "LLVM_DIR=/host/$PWD/llvm-install/lib/cmake/llvm" >> $GITHUB_ENV
104104
echo "MLIR_DIR=/host/$PWD/llvm-install/lib/cmake/mlir" >> $GITHUB_ENV
105+
echo "Clang_DIR=/host/$PWD/llvm-install/lib/cmake/clang" >> $GITHUB_ENV
105106
else
106107
echo "LLVM_DIR=$PWD/llvm-install/lib/cmake/llvm" >> $GITHUB_ENV
107108
echo "MLIR_DIR=$PWD/llvm-install/lib/cmake/mlir" >> $GITHUB_ENV
109+
echo "Clang_DIR=$PWD/llvm-install/lib/cmake/clang" >> $GITHUB_ENV
108110
fi
109111
110112
# these have to match the deployment targets of the LLVM build runners
@@ -139,7 +141,7 @@ jobs:
139141
limit-access-to-actor: true
140142
install-dependencies: ${{ startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'ubuntu') }}
141143

142-
test-eudsl:
144+
test-eudsl-tblgen:
143145

144146
needs: [build-eudsl]
145147

@@ -196,7 +198,7 @@ jobs:
196198
release-eudsl-tblgen:
197199

198200
if: ${{ github.event_name == 'workflow_dispatch' }}
199-
needs: [test-eudsl]
201+
needs: [test-eudsl-tblgen]
200202

201203
strategy:
202204
fail-fast: false
@@ -230,105 +232,9 @@ jobs:
230232
makeLatest: true
231233
omitBody: true
232234

233-
build-eudsl-py:
234-
235-
strategy:
236-
fail-fast: false
237-
matrix:
238-
include:
239-
- name: "ubuntu_x86_64"
240-
runs-on: "ubuntu-22.04"
241-
os: "ubuntu"
242-
- name: "windows_x86_64"
243-
runs-on: "windows-2019"
244-
os: "windows"
245-
- name: "macos_arm64"
246-
runs-on: "macos-14"
247-
os: "macos"
248-
- name: "macos_x86_64"
249-
runs-on: "macos-13"
250-
os: "macos"
251-
252-
runs-on: ${{ matrix.runs-on }}
253-
254-
name: "Build eudsl-py ${{ matrix.name }}"
255-
256-
defaults:
257-
run:
258-
shell: bash
259-
260-
permissions:
261-
id-token: write
262-
contents: write
263-
264-
env:
265-
# either the PR number or `branch-N` where N always increments
266-
cache-key: eudsl_${{ matrix.name }}_clang_${{ format('{0}-{1}', github.ref_name, github.run_number) }}
267-
268-
container:
269-
image: ${{ matrix.container }}
270-
271-
steps:
272-
- name: "Check out repository"
273-
uses: actions/[email protected]
274-
275-
- name: "Setup base"
276-
uses: ./.github/actions/setup_base
277-
id: setup_base
278-
with:
279-
cache-key: ${{ env.cache-key }}
280-
restore-key: "eudsl_${{ matrix.name }}_clang"
281-
os: ${{ matrix.os }}
282-
arch: ${{ matrix.arch }}
283-
284-
- name: "Download MLIR"
285-
env:
286-
GH_TOKEN: ${{ github.token }}
287-
run: |
288-
289-
if [[ "${{ matrix.os }}" == "almalinux" ]] || [[ "${{ matrix.os }}" == "ubuntu" ]]; then
290-
export RELEASE_PREFIX="mlir_manylinux_x86_64"
291-
else
292-
export RELEASE_PREFIX="mlir_${{ matrix.name }}"
293-
fi
294-
RELEASE_URL=$(gh release view latest --json assets -q '.assets |= sort_by(.createdAt) | .assets | map(select(.name | contains(env.RELEASE_PREFIX))) | .[-1] | .url')
295-
curl -sLO $RELEASE_URL
296-
tar xf $RELEASE_PREFIX*.tar.gz
297-
echo "LLVM_DIR=$PWD/llvm-install/lib/cmake/llvm" >> $GITHUB_ENV
298-
echo "MLIR_DIR=$PWD/llvm-install/lib/cmake/mlir" >> $GITHUB_ENV
299-
300-
- name: "Build eudsl-py"
301-
id: build
302-
run: |
303-
pip install cibuildwheel
304-
if [[ "${{ matrix.os }}" == "ubuntu" ]]; then
305-
export LLVM_DIR="/host/$LLVM_DIR"
306-
export MLIR_DIR="/host/$MLIR_DIR"
307-
fi
308-
if [[ "${{ matrix.runs-on }}" == "macos-14" ]]; then
309-
export MACOSX_DEPLOYMENT_TARGET=14.0
310-
elif [[ "${{ matrix.runs-on }}" == "macos-13" ]]; then
311-
export MACOSX_DEPLOYMENT_TARGET=13.7
312-
fi
313-
$python3_command -m cibuildwheel "$PWD/projects/eudsl-py" --output-dir wheelhouse
314-
315-
- name: Upload artifacts
316-
uses: actions/upload-artifact@v4
317-
with:
318-
name: eudsl_py_${{ matrix.name }}_artifact
319-
path: wheelhouse/*.whl
320-
if-no-files-found: warn
321-
322-
- name: "Setup tmate session"
323-
if: ${{ (failure() && inputs.debug_with_tmate) || inputs.force_debug_with_tmate }}
324-
uses: mxschmitt/[email protected]
325-
with:
326-
limit-access-to-actor: true
327-
install-dependencies: ${{ startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'ubuntu') }}
328-
329235
test-eudsl-py:
330236

331-
needs: [build-eudsl-py]
237+
needs: [build-eudsl]
332238

333239
strategy:
334240
fail-fast: false
@@ -380,10 +286,10 @@ jobs:
380286
python -m pytest -rA --capture=tee-sys $TESTS_DIR
381287
fi
382288
383-
release-eudsl:
289+
release-eudsl-py:
384290

385291
if: ${{ github.event_name == 'workflow_dispatch' }}
386-
needs: [test-eudsl]
292+
needs: [test-eudsl-tblgen, test-eudsl-py]
387293
runs-on: "ubuntu-22.04"
388294
name: "Release eudsl"
389295

build_tools/cmake/llvm_cache.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ set(LLVM_BUILD_UTILS ON CACHE BOOL "")
99
set(LLVM_INCLUDE_TOOLS ON CACHE BOOL "")
1010
set(LLVM_INSTALL_UTILS ON CACHE BOOL "")
1111

12-
# All the tools will use libllvm shared library
1312
set(LLVM_BUILD_LLVM_DYLIB ON CACHE BOOL "")
13+
# All the tools will use libllvm shared library
1414
# (but doesn't work on windows)
1515
if (NOT WIN32)
1616
set(LLVM_LINK_LLVM_DYLIB ON CACHE BOOL "")
@@ -103,6 +103,7 @@ set(LLVM_MlirDevelopment_DISTRIBUTION_COMPONENTS
103103

104104
FileCheck
105105
not
106+
MLIR
106107
MLIRPythonModules
107108
# triggers MLIRMlirDevelopmentTargets.cmake
108109
mlir-mlirdevelopment-cmake-exports

projects/eudsl-py/pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[build-system]
22
requires = [
33
"scikit-build-core==0.10.7",
4-
"nanobind==2.2.0",
4+
"nanobind==2.4.0",
55
"typing_extensions==4.12.2",
66
"numpy==2.0.2"
77
]
@@ -27,7 +27,9 @@ cmake.source-dir = "src"
2727
[tool.scikit-build.cmake.define]
2828
LLVM_DIR = {env="LLVM_DIR", default="EMPTY"}
2929
MLIR_DIR = {env="MLIR_DIR", default="EMPTY"}
30+
Clang_DIR = {env="Clang_DIR", default="EMPTY"}
3031
CMAKE_CXX_VISIBILITY_PRESET = "hidden"
32+
CMAKE_VERBOSE_MAKEFILE = "ON"
3133

3234
[tool.cibuildwheel]
3335
build-verbosity = 1
@@ -37,5 +39,6 @@ manylinux-x86_64-image = "manylinux_2_28"
3739
environment-pass = [
3840
"LLVM_DIR",
3941
"MLIR_DIR",
42+
"Clang_DIR",
4043
"CMAKE_GENERATOR"
4144
]

projects/eudsl-py/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
pytest==8.3.3
2-
nanobind==2.2.0
2+
nanobind==2.4.0
3+
numpy==2.0.2

0 commit comments

Comments
 (0)