Skip to content

Commit 4730adc

Browse files
committed
[wip] add eudsl-tblgen
1 parent 05ba987 commit 4730adc

35 files changed

+22447
-2
lines changed

.github/workflows/build_llvm.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ jobs:
193193
echo "*********************** SMOKE TEST *********************************"
194194
195195
pushd $LLVM_SOURCE_DIR && LLVM_SHA_SHORT=$(git rev-parse --short HEAD) && popd
196-
tar -czf mlir_${{ matrix.name }}_$LLVM_SHA_SHORT.tar.gz "$LLVM_INSTALL_DIR"
196+
tar -czf mlir_${{ matrix.name }}_$LLVM_SHA_SHORT.tar.gz -C "$LLVM_INSTALL_DIR/.." llvm-install
197197
rm -rf "$LLVM_BUILD_DIR" "$LLVM_SOURCE_DIR"
198198
199199
- name: Upload artifacts
@@ -205,7 +205,8 @@ jobs:
205205
if-no-files-found: warn
206206

207207
- name: Release current commit
208-
if: ${{ !cancelled() && github.event_name == 'push' && github.ref_name == 'main' }}
208+
# if: ${{ !cancelled() && github.event_name == 'push' && github.ref_name == 'main' }}
209+
if: ${{ !cancelled() }}
209210
uses: ncipollo/[email protected]
210211
with:
211212
artifacts: "*.tar.gz"

.github/workflows/test.yml

+215
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
name: "Test"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
force_debug_with_tmate:
7+
type: boolean
8+
description: 'Run the build with tmate session'
9+
required: false
10+
default: false
11+
debug_with_tmate:
12+
type: boolean
13+
description: 'Run the build with a tmate session ONLY in case of failure'
14+
required: false
15+
default: false
16+
pull_request:
17+
merge_group:
18+
push:
19+
branches:
20+
- main
21+
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
24+
cancel-in-progress: true
25+
26+
jobs:
27+
test-eudsl-tblgen:
28+
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
include:
33+
- name: "manylinux_x86_64"
34+
runs-on: "ubuntu-22.04"
35+
- name: "windows_x86_64"
36+
runs-on: "windows-2019"
37+
- name: "macos_arm64"
38+
runs-on: "macos-14"
39+
- name: "macos_x86_64"
40+
runs-on: "macos-13"
41+
42+
runs-on: ${{ matrix.runs-on }}
43+
44+
name: ${{ matrix.name }}
45+
46+
defaults:
47+
run:
48+
shell: bash
49+
50+
permissions:
51+
id-token: write
52+
contents: write
53+
54+
env:
55+
# either the PR number or `branch-N` where N always increments
56+
CACHE_KEY: test_${{ matrix.name }}_clang_${{ format('{0}-{1}', github.ref_name, github.run_number) }}
57+
58+
steps:
59+
60+
- name: "Set unified TZ"
61+
uses: szenius/[email protected]
62+
with:
63+
# this is an arbitrary choice
64+
timezoneLinux: "Asia/Singapore"
65+
timezoneMacos: "Asia/Singapore"
66+
timezoneWindows: "Singapore Standard Time"
67+
68+
- name: "Canonicalize cache dir"
69+
id: canonicalize-cache-dir
70+
run: |
71+
if [[ "${{ matrix.runs-on }}" == ubuntu* ]]; then
72+
echo "CACHE_DIR=/tmp/.container-cache" >> $GITHUB_OUTPUT
73+
elif [[ "${{ matrix.runs-on }}" == macos* ]]; then
74+
echo "CACHE_DIR=/tmp/.container-cache" >> $GITHUB_OUTPUT
75+
elif [[ "${{ matrix.runs-on }}" == windows* ]]; then
76+
echo "CACHE_DIR=D:\a\.container-cache" >> $GITHUB_OUTPUT
77+
fi
78+
79+
- name: "Restore cache"
80+
uses: actions/cache/restore@v3
81+
with:
82+
path: ${{ steps.canonicalize-cache-dir.outputs.CACHE_DIR }}
83+
key: ${{ env.CACHE_KEY }}
84+
restore-keys: test_${{ matrix.name }}_clang
85+
86+
- name: "Check out repository"
87+
uses: actions/[email protected]
88+
with:
89+
submodules: false
90+
91+
- name: "Install OS deps"
92+
run: |
93+
if [[ "${{ matrix.runs-on }}" == macos* ]]; then
94+
brew install ccache ninja curl
95+
fi
96+
97+
- name: "Install Python"
98+
uses: actions/setup-python@v4
99+
if: ${{ startsWith(matrix.runs-on, 'macos') || startsWith(matrix.runs-on, 'windows') }}
100+
with:
101+
python-version: '3.12'
102+
103+
- name: "Setup compiler/toolchain"
104+
uses: aminya/setup-cpp@v1
105+
if: ${{ startsWith(matrix.runs-on, 'ubuntu') || startsWith(matrix.runs-on, 'windows') }}
106+
with:
107+
compiler: llvm-18
108+
cmake: true
109+
ninja: true
110+
ccache: true
111+
vcvarsall: ${{ startsWith(matrix.runs-on, 'windows') }}
112+
113+
- name: "Set CC/CXX"
114+
run: |
115+
if [[ "${{ matrix.runs-on }}" == ubuntu* ]]; then
116+
echo "CC=/github/home/llvm/bin/clang" >> $GITHUB_ENV
117+
echo "CXX=/github/home/llvm/bin/clang++" >> $GITHUB_ENV
118+
elif [[ "${{ matrix.runs-on }}" == windows* ]]; then
119+
echo "CC=/C/Users/runneradmin/llvm/bin/clang-cl.exe" >> $GITHUB_ENV
120+
echo "CXX=/C/Users/runneradmin/llvm/bin/clang-cl.exe" >> $GITHUB_ENV
121+
elif [[ "${{ matrix.runs-on }}" == macos* ]]; then
122+
echo "CC=/usr/bin/clang" >> $GITHUB_ENV
123+
echo "CXX=/usr/bin/clang++" >> $GITHUB_ENV
124+
fi
125+
126+
- name: "Python deps"
127+
run: |
128+
python3_command=""
129+
if (command -v python3.12 &> /dev/null); then
130+
python3_command="python3.12"
131+
elif (command -v python3 &> /dev/null); then
132+
python3_command="python3"
133+
elif (command -v python &> /dev/null); then
134+
python3_command="python"
135+
fi
136+
echo "Python3_EXECUTABLE=$(which $python3_command)" >> $GITHUB_ENV
137+
138+
- name: "Download MLIR"
139+
env:
140+
GH_TOKEN: ${{ github.token }}
141+
run: |
142+
export RELEASE_PREFIX="mlir_${{ matrix.name }}"
143+
RELEASE_URL=$(gh release view latest --json assets -q '.assets |= sort_by(.createdAt) | .assets | map(select(.name | contains(env.RELEASE_PREFIX))) | .[-1] | .url')
144+
curl -sLO $RELEASE_URL
145+
tar xf $RELEASE_PREFIX*.tar.gz
146+
ls -lah
147+
148+
# - name: "Build eudsl-tblgen"
149+
# id: build
150+
# run: |
151+
# export CCACHE_DIR="${{ steps.canonicalize-cache-dir.outputs.CACHE_DIR }}/ccache"
152+
# export CCACHE_COMPILERCHECK="string:$($CC --version)"
153+
# export CCACHE_MAXSIZE=700M
154+
# export CCACHE_SLOPPINESS=include_file_ctime,include_file_mtime,time_macros
155+
# export CCACHE_CPP2=true
156+
# export CCACHE_UMASK=002
157+
#
158+
# export CMAKE_C_COMPILER_LAUNCHER=ccache
159+
# export CMAKE_CXX_COMPILER_LAUNCHER=ccache
160+
# export CMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld"
161+
# export CMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld"
162+
# export CMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld"
163+
# export Python3_EXECUTABLE="$Python3_EXECUTABLE"
164+
#
165+
# export LLVM_SOURCE_DIR="$PWD/third_party/llvm-project"
166+
# export LLVM_BUILD_DIR="$PWD/llvm-build"
167+
# # double nested so that upload artifacts uploads a folder
168+
# export LLVM_INSTALL_DIR="$PWD/llvm-install/llvm-install"
169+
#
170+
# ccache -z
171+
# build_tools/cmake/build_llvm.sh
172+
# ccache -s
173+
#
174+
# echo "*********************** SMOKE TEST *********************************"
175+
# "$LLVM_INSTALL_DIR/bin/mlir-tblgen" --version
176+
# echo "*********************** SMOKE TEST *********************************"
177+
#
178+
# pushd $LLVM_SOURCE_DIR && LLVM_SHA_SHORT=$(git rev-parse --short HEAD) && popd
179+
# tar -czf mlir_${{ matrix.name }}_$LLVM_SHA_SHORT.tar.gz -C "$LLVM_INSTALL_DIR/.." llvm-install
180+
# rm -rf "$LLVM_BUILD_DIR" "$LLVM_SOURCE_DIR"
181+
#
182+
# - name: Upload artifacts
183+
# uses: actions/upload-artifact@v4
184+
# if: ${{ !cancelled() }}
185+
# with:
186+
# name: mlir_${{ matrix.name }}_artifact
187+
# path: llvm-install
188+
# if-no-files-found: warn
189+
#
190+
# - name: Release current commit
191+
# if: ${{ !cancelled() && github.event_name == 'push' && github.ref_name == 'main' }}
192+
# uses: ncipollo/[email protected]
193+
# with:
194+
# artifacts: "*.tar.gz"
195+
# token: "${{ secrets.GITHUB_TOKEN }}"
196+
# tag: "latest"
197+
# name: "latest"
198+
# removeArtifacts: false
199+
# allowUpdates: true
200+
# replacesArtifacts: true
201+
# makeLatest: true
202+
#
203+
# - name: "Save cache"
204+
# uses: actions/cache/save@v3
205+
# if: ${{ !cancelled() && github.event_name == 'push' && github.ref_name == 'main' }}
206+
# with:
207+
# path: ${{ steps.canonicalize-cache-dir.outputs.CACHE_DIR }}
208+
# key: ${{ env.CACHE_KEY }}
209+
#
210+
# - name: "Setup tmate session"
211+
# if: ${{ (failure() && inputs.debug_with_tmate) || inputs.force_debug_with_tmate }}
212+
# uses: mxschmitt/[email protected]
213+
# with:
214+
# limit-access-to-actor: true
215+
# install-dependencies: ${{ startsWith(matrix.runs-on, 'macos') || startsWith(matrix.runs-on, 'windows') }}

build_tools/cmake/llvm_cache.cmake

+5
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ set(LLVM_MlirDevelopment_DISTRIBUTION_COMPONENTS
6969
not
7070
MLIRPythonModules
7171
MLIRPythonModules
72+
# triggers LLVMMlirDevelopmentExports.cmake
73+
mlirdevelopment-cmake-exports
74+
# triggers MLIRMlirDevelopmentTargets.cmake
75+
mlir-mlirdevelopment-cmake-exports
76+
# triggers MLIRConfig.cmake and etc
7277
mlir-cmake-exports
7378
mlir-headers
7479
mlir-libraries

0 commit comments

Comments
 (0)