-
Notifications
You must be signed in to change notification settings - Fork 10
771 lines (674 loc) · 28.3 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
# SPDX-FileCopyrightText: 2022 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: Cross-compile Numba-MLIR on CPUs
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
TBB_VER: 2021.10.0
LLVM_SHA_FILE: llvm-sha.txt
NUMBA_DISABLE_ERROR_MESSAGE_HIGHLIGHTING: "1"
NUMBA_DISABLE_PERFORMANCE_WARNINGS: "1"
jobs:
build_win:
env:
CORE_ENV_FILE: scripts/core-env-win.yml
name: Builds Windows Numba-MLIR core
runs-on: windows-2019
timeout-minutes: 450
steps:
- name: Disable Defender
shell: powershell
run: |
Set-MpPreference -DisableRealtimeMonitoring $true
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache conda packages
uses: actions/cache@v3
env:
CACHE_NUMBER: 1 # Increase to reset cache
with:
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles(env.CORE_ENV_FILE) }}
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
run-post: false
miniforge-variant: Mambaforge
miniforge-version: latest
channel-priority: "disabled"
activate-environment: test-env
environment-file: ${{ env.CORE_ENV_FILE }}
python-version: "3.10"
channels: conda-forge,https://software.repos.intel.com/python/conda/
- name: Setup Cache Vars
run: |
$sha = (cat "$env:GITHUB_WORKSPACE\$env:LLVM_SHA_FILE")
echo "LLVM_SHA=$sha" >> $env:GITHUB_ENV
$wspath = (Resolve-Path "$env:GITHUB_WORKSPACE\..\")
echo "WORKSPACE=$wspath" >> $env:GITHUB_ENV
cat $env:GITHUB_ENV
- name: Cache LLLVM-MLIR
id: cache-llvm-mlir
uses: actions/cache@v3
env:
LLVM_CACHE_NUMBER: 1 # Increase to reset cache
with:
path: |
D:\a\numba-mlir\llvm-mlir\_mlir_install\**
key: ${{ runner.os }}-build-llvm-${{ env.LLVM_CACHE_NUMBER }}-${{ env.LLVM_SHA }}
- name: Build LLVM-MLIR
if: steps.cache-llvm-mlir.outputs.cache-hit != 'true'
timeout-minutes: 420
run: |
$env:vcvarsPath = (Resolve-Path "$env:GITHUB_WORKSPACE\scripts")
pushd $env:vcvarsPath
./vcvars.ps1
popd
conda list
cd $env:WORKSPACE
mkdir -ea 0 -p llvm-mlir
pushd llvm-mlir
echo "INFO: Need to rebuild LLVM-MLIR. Previous installation for MLIR not found"
git clone https://github.com/llvm/llvm-project
cd llvm-project
git checkout $env:LLVM_SHA
mkdir _build
cd _build
$env:CXX="cl.exe"
$env:CC="cl.exe"
cmake ../llvm `
-GNinja `
-DCMAKE_BUILD_TYPE=Release `
-DLLVM_ENABLE_PROJECTS=mlir `
-DLLVM_ENABLE_ASSERTIONS=ON `
-DLLVM_ENABLE_RTTI=ON `
-DLLVM_INSTALL_UTILS=ON `
-DLLVM_TARGETS_TO_BUILD=X86 `
-DLLVM_ENABLE_BINDINGS=OFF `
-DLLVM_ENABLE_ZSTD=OFF `
-DLLVM_DISTRIBUTION_COMPONENTS="llvm-headers;llvm-libraries;cmake-exports;FileCheck;count;not;mlir-headers;mlir-libraries;mlir-cmake-exports;mlir-tblgen;mlir-cpu-runner" `
-DCMAKE_INSTALL_PREFIX="$env:WORKSPACE/llvm-mlir/_mlir_install"
ninja install-distribution-stripped
cp bin/FileCheck.exe $env:WORKSPACE/llvm-mlir/_mlir_install/bin/
cp bin/count.exe $env:WORKSPACE/llvm-mlir/_mlir_install/bin/
cp bin/not.exe $env:WORKSPACE/llvm-mlir/_mlir_install/bin/
popd
- name: Build Numba-MLIR
run: |
$env:vcvarsPath = (Resolve-Path "$env:GITHUB_WORKSPACE\scripts")
pushd $env:vcvarsPath
./vcvars.ps1
popd
$external_lit="$env:GITHUB_WORKSPACE\scripts\runlit.py"
mkdir -p _build
cd _build
$env:LEVEL_ZERO_VERSION_CHECK_OFF="1"
$env:LLVM_DIR=(Resolve-Path "$env:WORKSPACE/llvm-mlir/_mlir_install")
cmake "$env:GITHUB_WORKSPACE" `
-GNinja `
-DCMAKE_BUILD_TYPE=Release `
-DLLVM_DIR="$env:LLVM_DIR/lib/cmake/llvm" `
-DMLIR_DIR="$env:LLVM_DIR/lib/cmake/mlir" `
-DNUMBA_MLIR_ENABLE_IGPU_DIALECT=ON `
-DNUMBA_MLIR_ENABLE_TESTS=ON `
-DNUMBA_MLIR_ENABLE_TBB_SUPPORT=ON `
-DLLVM_EXTERNAL_LIT="$external_lit"
ninja all
- name: Run Numba-MLIR core test cases
run: |
cd _build
ninja check-numba-mlir
build_win_python:
name: Builds Windows Numba-MLIR
runs-on: windows-2019
timeout-minutes: 450
needs: build_win
strategy:
fail-fast: false
matrix:
python: ["3.9", "3.10", "3.11"]
steps:
- name: Disable Defender
shell: powershell
run: |
Set-MpPreference -DisableRealtimeMonitoring $true
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
run-post: false
miniforge-variant: Mambaforge
miniforge-version: latest
channels: conda-forge,https://software.repos.intel.com/python/conda/
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Cache Vars
run: |
$sha = (cat "$env:GITHUB_WORKSPACE\$env:LLVM_SHA_FILE")
echo "LLVM_SHA=$sha" >> $env:GITHUB_ENV
$wspath = (Resolve-Path "$env:GITHUB_WORKSPACE\..\")
echo "WORKSPACE=$wspath" >> $env:GITHUB_ENV
cat $env:GITHUB_ENV
- name: Cache LLLVM-MLIR
id: cache-llvm-mlir
uses: actions/cache@v3
env:
LLVM_CACHE_NUMBER: 1 # Increase to reset cache
with:
path: |
D:\a\numba-mlir\llvm-mlir\_mlir_install\**
key: ${{ runner.os }}-build-llvm-${{ env.LLVM_CACHE_NUMBER }}-${{ env.LLVM_SHA }}
- name: Build Python frontend
run: |
$env:vcvarsPath = (Resolve-Path "$env:GITHUB_WORKSPACE\scripts")
pushd $env:vcvarsPath
./vcvars.ps1
popd
cd numba_mlir
conda create -y -n test-env python=${{ matrix.python }} --file ../scripts/numba-mlir.env -c conda-forge
conda info
conda activate test-env
conda install dpcpp_win-64=2024.2 --file ../scripts/mkl.env -c https://software.repos.intel.com/python/conda/
echo "Conda prefix: $env:CONDA_PREFIX"
echo "Patch broken Windows MKLConfig.cmake"
cp "$env:GITHUB_WORKSPACE/numba_mlir/conda-recipe/MKLConfig.cmake" "$env:CONDA_PREFIX/Library/lib/cmake/mkl" -Force
conda list
python -c "import numba; print('numba', numba.__version__)"
python -c "import numpy; print(numpy.get_include())"
cmake --version
$env:LEVEL_ZERO_VERSION_CHECK_OFF="1"
$env:LLVM_PATH=(Resolve-Path "$env:WORKSPACE/llvm-mlir/_mlir_install")
$env:NUMBA_MLIR_USE_SYCL="ON"
$env:LIB = "$env:CONDA_PREFIX\Library\lib;$env:CONDA_PREFIX\compiler\lib;$env:LIB"
$env:INCLUDE = "$env:CONDA_PREFIX\include;$env:INCLUDE"
$env:CXX="cl.exe"
$env:CC="cl.exe"
python setup.py develop
- name: Test Python frontend
run: |
cd numba_mlir
conda activate test-env
python "$env:GITHUB_WORKSPACE/numba_mlir/conda-recipe/run_package_tests.py" verbose
python "$env:GITHUB_WORKSPACE/numba_mlir/conda-recipe/run_package_tests.py" verbose replace_parfors
- name: Run offload tests
if: false # Doesn't work
run: |
cd numba_mlir
conda activate test-env
conda install greenlet "dpctl=0.18" dpcpp-cpp-rt -c dppy/label/dev -c conda-forge -c https://software.repos.intel.com/python/conda/
conda list
$env:NUMBA_MLIR_DEFAULT_DEVICE="opencl:cpu:0"
python "$env:GITHUB_WORKSPACE/numba_mlir/conda-recipe/run_package_tests.py" verbose gpu
- name: Test bench
# TODO: investigate
if: matrix.python != '3.9'
run: |
cd benchmarks
conda activate test-env
conda install asv=0.6 py-cpuinfo -c conda-forge
conda list
python runner.py machine
python runner.py test .numba_mlir.
python runner.py test .numba_replace_parfor.
- name: Build wheels
run: |
$env:vcvarsPath = (Resolve-Path "$env:GITHUB_WORKSPACE\scripts")
pushd $env:vcvarsPath
./vcvars.ps1
popd
mkdir numba_mlir_wheels
pushd numba_mlir_wheels
conda activate test-env
$env:LEVEL_ZERO_VERSION_CHECK_OFF="1"
$env:LLVM_PATH=(Resolve-Path "$env:WORKSPACE/llvm-mlir/_mlir_install")
$env:NUMBA_MLIR_USE_SYCL="ON"
$env:LIB = "$env:CONDA_PREFIX\Library\lib;$env:CONDA_PREFIX\compiler\lib;$env:LIB"
$env:INCLUDE = "$env:CONDA_PREFIX\include;$env:INCLUDE"
$env:CXX="cl.exe"
$env:CC="cl.exe"
pip wheel --no-deps -v ../numba_mlir
ls .
popd
rm -r numba_mlir_cmake_build
- name: Test wheels
run: |
cd numba_mlir_wheels
conda create -y -n wheels-test-env python=${{ matrix.python }} --file ../scripts/numba-mlir.env -c conda-forge
conda info
conda activate wheels-test-env
conda install dpcpp_win-64=2024.2 --file ../scripts/mkl.env -c https://software.repos.intel.com/python/conda/
conda list
ls .
ls *.whl | Foreach-Object { pip install $_.FullName }
python "$env:GITHUB_WORKSPACE/numba_mlir/conda-recipe/run_package_tests.py" verbose smoke
build_win_conda_package:
name: Builds Windows Numba-MLIR conda package
runs-on: windows-2019
timeout-minutes: 450
needs: build_win
strategy:
fail-fast: false
matrix:
python: ["3.9", "3.10", "3.11"]
is_main:
- ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Disable Defender
shell: powershell
run: |
Set-MpPreference -DisableRealtimeMonitoring $true
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
run-post: false
miniforge-variant: Mambaforge
miniforge-version: latest
channels: conda-forge,https://software.repos.intel.com/python/conda/
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Cache Vars
run: |
$sha = (cat "$env:GITHUB_WORKSPACE\$env:LLVM_SHA_FILE")
echo "LLVM_SHA=$sha" >> $env:GITHUB_ENV
$wspath = (Resolve-Path "$env:GITHUB_WORKSPACE\..\")
echo "WORKSPACE=$wspath" >> $env:GITHUB_ENV
cat $env:GITHUB_ENV
- name: Cache LLLVM-MLIR
id: cache-llvm-mlir
uses: actions/cache@v3
env:
LLVM_CACHE_NUMBER: 1 # Increase to reset cache
with:
path: |
D:\a\numba-mlir\llvm-mlir\_mlir_install\**
key: ${{ runner.os }}-build-llvm-${{ env.LLVM_CACHE_NUMBER }}-${{ env.LLVM_SHA }}
- name: Build conda package
run: |
conda create -y -n test-env python=${{ matrix.python }} conda-build conda-verify boa -c conda-forge
conda info
mkdir numba_mlir_conda
pushd numba_mlir_conda
conda activate test-env
Rename-Item -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\vsdevcmd\ext\vsicvars.bat" -NewName "vsicvars.bat.bak"
Rename-Item -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\vsdevcmd\ext\ConnectionManagerExe.bat" -NewName "ConnectionManagerExe.bat.bak"
Rename-Item -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\vsdevcmd\ext\clang_cl.bat" -NewName "clang_cl.bat.bak"
Rename-Item -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\vsdevcmd\ext\fsharp.bat" -NewName "fsharp.bat.bak"
Rename-Item -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\vsdevcmd\ext\html_help.bat" -NewName "html_help.bat.bak"
Rename-Item -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\vsdevcmd\ext\perf_tools.bat" -NewName "perf_tools.bat.bak"
Rename-Item -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\vsdevcmd\ext\vssdk.bat" -NewName "vssdk.bat.bak"
$env:LEVEL_ZERO_VERSION_CHECK_OFF="1"
$env:LLVM_PATH=(Resolve-Path "$env:WORKSPACE/llvm-mlir/_mlir_install")
$env:NUMBA_MLIR_USE_SYCL="ON"
$env:CXX="cl.exe"
$env:CC="cl.exe"
$env:VSCMD_DEBUG = 3
conda build --output-folder=. ../numba_mlir/conda-recipe --python=${{ matrix.python }} -c https://software.repos.intel.com/python/conda/ -c conda-forge -c numba --override-channels
cd win-64
ls .
popd
- name: Upload artifact
if: matrix.is_main
uses: actions/upload-artifact@v2
with:
name: numba-mlir ${{ runner.os }} Python ${{ matrix.python }} SHA ${{ github.sha }}
path: numba_mlir_conda/win-64/*.tar.bz2
retention-days: 30
build_linux:
env:
CORE_ENV_FILE: scripts/core-env-linux.yml
name: Builds Linux Numba-MLIR core
runs-on: ubuntu-20.04
timeout-minutes: 450
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache conda packages
uses: actions/cache@v3
env:
CACHE_NUMBER: 1 # Increase to reset cache
with:
path: ~/.conda/pkgs
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles(env.CORE_ENV_FILE) }}
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
run-post: false
miniforge-variant: Mambaforge
miniforge-version: latest
channel-priority: "disabled"
activate-environment: test-env
environment-file: ${{ env.CORE_ENV_FILE }}
python-version: "3.10"
channels: conda-forge,https://software.repos.intel.com/python/conda/
- name: Setup Cache Vars
run: |
echo 'LLVM_SHA<<EOF' >> $GITHUB_ENV
cat $GITHUB_WORKSPACE/$LLVM_SHA_FILE >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Cache LLLVM-MLIR
id: cache-llvm-mlir
uses: actions/cache@v3
env:
LLVM_CACHE_NUMBER: 1 # Increase to reset cache
with:
path: |
/home/runner/work/llvm-mlir/_mlir_install/**
key: ${{ runner.os }}-build-llvm-${{ env.LLVM_CACHE_NUMBER }}-${{ env.LLVM_SHA }}
- name: Build LLVM-MLIR
if: steps.cache-llvm-mlir.outputs.cache-hit != 'true'
shell: bash -l {0}
timeout-minutes: 420
run: |
mkdir -p /home/runner/work/llvm-mlir
pushd /home/runner/work/llvm-mlir
echo "INFO: Need to rebuild LLVM-MLIR. Previous installation for MLIR not found"
np=`nproc`
echo "INFO: nproc $np"
git clone https://github.com/llvm/llvm-project || exit 1
cd llvm-project || exit 1
git checkout $LLVM_SHA || exit 1
mkdir _build || exit 1
cd _build || exit 1
export CC=$CONDA_PREFIX/bin/x86_64-conda-linux-gnu-cc
export CXX=$CONDA_PREFIX/bin/x86_64-conda-linux-gnu-c++
cmake ../llvm \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS=mlir \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_INSTALL_UTILS=ON \
-DLLVM_TARGETS_TO_BUILD=X86 \
-DLLVM_ENABLE_BINDINGS=OFF \
-DLLVM_ENABLE_ZSTD=OFF \
-DLLVM_DISTRIBUTION_COMPONENTS="llvm-headers;llvm-libraries;cmake-exports;FileCheck;count;not;mlir-headers;mlir-libraries;mlir-cmake-exports;mlir-tblgen;mlir-cpu-runner" \
-DCMAKE_INSTALL_PREFIX=/home/runner/work/llvm-mlir/_mlir_install || exit 1
ninja install-distribution-stripped || exit 1
cp bin/FileCheck /home/runner/work/llvm-mlir/_mlir_install/bin/
cp bin/count /home/runner/work/llvm-mlir/_mlir_install/bin/
cp bin/not /home/runner/work/llvm-mlir/_mlir_install/bin/
popd
- name: Build Numba-MLIR
shell: bash -l {0}
run: |
mkdir -p _build
cd _build
source $CONDA/bin/activate test-env
export EXTERNAL_LIT=${GITHUB_WORKSPACE}/scripts/runlit.py
export LEVEL_ZERO_VERSION_CHECK_OFF=1
export LLVM_DIR=/home/runner/work/llvm-mlir/_mlir_install
export CC=${CONDA_PREFIX}/bin/x86_64-conda-linux-gnu-cc
export CXX=${CONDA_PREFIX}/bin/x86_64-conda-linux-gnu-c++
cmake ${GITHUB_WORKSPACE} \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_DIR=${LLVM_DIR}/lib/cmake/llvm \
-DMLIR_DIR=${LLVM_DIR}/lib/cmake/mlir \
-DNUMBA_MLIR_ENABLE_IGPU_DIALECT=ON \
-DNUMBA_MLIR_ENABLE_TESTS=ON \
-DNUMBA_MLIR_ENABLE_TBB_SUPPORT=ON \
-DLLVM_EXTERNAL_LIT=${EXTERNAL_LIT} \
|| exit 1
ninja all || exit 1
- name: Run Numba-MLIR core test cases
shell: bash -l {0}
run: |
cd _build || exit 1
ninja check-numba-mlir || exit 1
build_linux_python:
name: Builds Linux Numba-MLIR
runs-on: ubuntu-20.04
timeout-minutes: 450
needs: build_linux
strategy:
fail-fast: false
matrix:
python: ["3.9", "3.10", "3.11"]
is_main:
- ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
run-post: false
miniforge-variant: Mambaforge
miniforge-version: latest
channels: conda-forge,https://software.repos.intel.com/python/conda/
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Cache Vars
run: |
echo 'LLVM_SHA<<EOF' >> $GITHUB_ENV
cat $GITHUB_WORKSPACE/$LLVM_SHA_FILE >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Cache LLLVM-MLIR
id: cache-llvm-mlir
uses: actions/cache@v3
env:
LLVM_CACHE_NUMBER: 1 # Increase to reset cache
with:
path: |
/home/runner/work/llvm-mlir/_mlir_install/**
key: ${{ runner.os }}-build-llvm-${{ env.LLVM_CACHE_NUMBER }}-${{ env.LLVM_SHA }}
- name: Build Python frontend
shell: bash -l {0}
run: |
cd numba_mlir
conda create -y -n test-env python=${{ matrix.python }} --file ../scripts/numba-mlir.env -c conda-forge
conda info
source $CONDA/bin/activate test-env
conda install dpcpp_linux-64=2024.2 --file ../scripts/mkl.env -c https://software.repos.intel.com/python/conda/
conda install gxx_linux-64 -c conda-forge
conda list
python -c "import numba; print('numba', numba.__version__)"
python -c "import numpy; print(numpy.get_include())"
cmake --version
export LLVM_PATH=/home/runner/work/llvm-mlir/_mlir_install
export LEVEL_ZERO_VERSION_CHECK_OFF=1
export NUMBA_MLIR_USE_SYCL=ON
export CC=$CONDA_PREFIX/bin/x86_64-conda-linux-gnu-cc
export CXX=$CONDA_PREFIX/bin/x86_64-conda-linux-gnu-c++
python setup.py develop
- name: Test Python frontend
shell: bash -l {0}
run: |
cd numba_mlir
source $CONDA/bin/activate test-env
python $GITHUB_WORKSPACE/numba_mlir/conda-recipe/run_package_tests.py verbose
python $GITHUB_WORKSPACE/numba_mlir/conda-recipe/run_package_tests.py verbose replace_parfors
- name: Run offload tests
shell: bash -l {0}
run: |
cd numba_mlir
source $CONDA/bin/activate test-env
conda install greenlet "dpctl=0.18" dpcpp-cpp-rt -c dppy/label/dev -c conda-forge -c https://software.repos.intel.com/python/conda/
conda list
export NUMBA_MLIR_DEFAULT_DEVICE=opencl:cpu:0
python $GITHUB_WORKSPACE/numba_mlir/conda-recipe/run_package_tests.py verbose gpu
- name: Test bench
shell: bash -l {0}
# TODO: investigate
if: matrix.python != '3.9'
run: |
cd benchmarks
source $CONDA/bin/activate test-env
conda install asv=0.6 py-cpuinfo -c conda-forge
conda list
python runner.py machine
python runner.py test .numba_mlir.
python runner.py test .numba_replace_parfor.
- name: Build wheels
shell: bash -l {0}
run: |
mkdir numba_mlir_wheels
pushd numba_mlir_wheels
source $CONDA/bin/activate test-env
export LLVM_PATH=/home/runner/work/llvm-mlir/_mlir_install
export LEVEL_ZERO_VERSION_CHECK_OFF=1
export NUMBA_MLIR_USE_SYCL=ON
export CC=$CONDA_PREFIX/bin/x86_64-conda-linux-gnu-cc
export CXX=$CONDA_PREFIX/bin/x86_64-conda-linux-gnu-c++
pip wheel --no-deps -v ../numba_mlir
ls -l --block-size=M
popd
rm -rf numba_mlir_cmake_build
- name: Test wheels
shell: bash -l {0}
run: |
cd numba_mlir_wheels
conda create -y -n wheels-test-env python=${{ matrix.python }} --file ../scripts/numba-mlir.env -c conda-forge
conda info
source $CONDA/bin/activate wheels-test-env
conda install dpcpp_linux-64=2024.2 --file ../scripts/mkl.env -c https://software.repos.intel.com/python/conda/
conda list
pip install *.whl
python $GITHUB_WORKSPACE/numba_mlir/conda-recipe/run_package_tests.py verbose smoke
build_linux_conda_package:
name: Builds Linux Numba-MLIR conda package
runs-on: ubuntu-latest
timeout-minutes: 450
needs: build_linux
strategy:
fail-fast: false
matrix:
python: ["3.9", "3.10", "3.11"]
is_main:
- ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
run-post: false
miniforge-variant: Mambaforge
miniforge-version: latest
channels: conda-forge,https://software.repos.intel.com/python/conda/
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Cache Vars
run: |
echo 'LLVM_SHA<<EOF' >> $GITHUB_ENV
cat $GITHUB_WORKSPACE/$LLVM_SHA_FILE >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Cache LLLVM-MLIR
id: cache-llvm-mlir
uses: actions/cache@v3
env:
LLVM_CACHE_NUMBER: 1 # Increase to reset cache
with:
path: |
/home/runner/work/llvm-mlir/_mlir_install/**
key: ${{ runner.os }}-build-llvm-${{ env.LLVM_CACHE_NUMBER }}-${{ env.LLVM_SHA }}
- name: Build conda package
shell: bash -l {0}
run: |
mkdir numba_mlir_conda
pushd numba_mlir_conda
conda create -y -n conda-build-env python=${{ matrix.python }} conda-build conda-verify boa -c conda-forge
conda activate conda-build-env
export LLVM_PATH=/home/runner/work/llvm-mlir/_mlir_install
export LEVEL_ZERO_VERSION_CHECK_OFF=1
export NUMBA_MLIR_USE_SYCL=ON
# conda build --output-folder=. ../numba_mlir/conda-recipe --python=${{ matrix.python }} -c conda-forge -c numba -c https://software.repos.intel.com/python/conda/ || exit 1
conda build --output-folder=. ../numba_mlir/conda-recipe --python=${{ matrix.python }} -c https://software.repos.intel.com/python/conda/ -c conda-forge -c numba --override-channels || exit 1
cd linux-64
ls -l --block-size=M
popd
rm -rf numba_mlir_cmake_build
- name: Upload artifact
if: matrix.is_main
uses: actions/upload-artifact@v2
with:
name: numba-mlir ${{ runner.os }} Python ${{ matrix.python }} SHA ${{ github.sha }}
path: numba_mlir_conda/linux-64/*.tar.bz2
retention-days: 30
upload_packages:
name: Upload conda packages
if: ${{ github.ref == 'refs/heads/main' }}
timeout-minutes: 450
needs: [build_win_python, build_win_conda_package, build_linux_python, build_linux_conda_package]
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-latest]
python: ["3.9", "3.10", "3.11"]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -el {0}
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: numba-mlir ${{ runner.os }} Python ${{ matrix.python }} SHA ${{ github.sha }}
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
run-post: false
auto-activate-base: true
activate-environment: ""
miniforge-variant: Mambaforge
miniforge-version: latest
channel-priority: "disabled"
channels: conda-forge,https://software.repos.intel.com/python/conda/
- name: Install anaconda-client
run: conda install anaconda-client
- name: Add conda to system path
if: matrix.os == 'ubuntu-20.04'
run: echo $CONDA/bin >> $GITHUB_PATH
- name: Upload
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
run: |
anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev numba-mlir-*.tar.bz2
cleanup_packages:
name: Clean up anaconda packages
needs: [upload_packages]
runs-on: 'ubuntu-latest'
defaults:
run:
shell: bash -el {0}
steps:
- uses: conda-incubator/setup-miniconda@v2
with:
run-post: false
channel-priority: "disabled"
channels: conda-forge
python-version: '3.11'
- name: Install anaconda-client
run: conda install anaconda-client
- name: Checkout repo
uses: actions/checkout@v4
with:
repository: IntelPython/devops-tools
fetch-depth: 0
- name: Cleanup old packages
run: |
python scripts/cleanup-old-packages.py \
--verbose --force --token ${{ secrets.ANACONDA_TOKEN }} \
--package dppy/numba-mlir --label dev