Skip to content

Commit

Permalink
Replace usage of build_imex.py (#672)
Browse files Browse the repository at this point in the history
* Replace usage of build_imex.py
* Update build.yml
  • Loading branch information
silee2 authored Dec 2, 2023
1 parent 93d5efd commit 5799e2e
Showing 1 changed file with 16 additions and 95 deletions.
111 changes: 16 additions & 95 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ on:
push:
branches:
- main
- refactor
pull_request:
branches:
- main
- refactor

jobs:
build_linux:
Expand All @@ -17,9 +15,6 @@ jobs:
timeout-minutes: 450

env:
LEVEL_ZERO_VER: v1.6.2
TBB_VER: 2021.5.0
TBB_URL_PREFIX: https://github.com/oneapi-src/oneTBB/releases/download/
LLVM_SHA_FILE: /home/runner/work/mlir-extensions/mlir-extensions/build_tools/llvm_version.txt

strategy:
Expand All @@ -28,12 +23,12 @@ jobs:

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.6.0
uses: styfle/cancel-workflow-action@0.12.0
with:
access_token: ${{ github.token }}

- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.python }}
Expand All @@ -46,11 +41,11 @@ jobs:
- name: Install Build tools
shell: bash -l {0}
run: |
conda install cmake ninja graphviz conda-forge::lit conda-forge::doxygen
conda install cmake ninja conda-forge::lit conda-forge::doxygen
conda list
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

Expand All @@ -60,22 +55,6 @@ jobs:
cat $LLVM_SHA_FILE >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Cache TBB
id: cache-tbb
uses: actions/cache@v3
with:
path: |
/home/runner/work/tbb/*
key: ${{ runner.os }}-build-tbb-${{ env.TBB_VER }}

- name: Cache Level-Zero
id: cache-level-zero
uses: actions/cache@v3
with:
path: |
/home/runner/work/level-zero/**
key: ${{ runner.os }}-build-l0-${{ env.LEVEL_ZERO_VER }}

- name: Cache LLLVM-MLIR
id: cache-llvm-mlir
uses: actions/cache@v3
Expand All @@ -86,53 +65,6 @@ jobs:
/home/runner/work/llvm-mlir/_mlir_install/**
key: ${{ runner.os }}-build-llvm-${{ env.LLVM_CACHE_NUMBER }}-${{ env.LLVM_SHA }}

- name: Download TBB
if: steps.cache-tbb.outputs.cache-hit != 'true'
shell: bash -l {0}
run: |
cd /home/runner/work
mkdir -p tbb
pushd tbb
if [[ -f bundle_id.txt && ( "$(cat bundle_id.txt)" == "${TBB_VER}" ) ]]; then
echo "INFO: Using cached download of TBB ${TBB_VER}"
else
echo "INFO: Downloading TBB ${TBB_VER}"
rm -rf *
export TBB_FN=oneapi-tbb-${TBB_VER}-lin.tgz
wget ${TBB_URL_PREFIX}/v${TBB_VER}/${TBB_FN} || exit 1
tar xf ${TBB_FN} -C . || exit 1
cat $(find . -name tbb.pc) | grep Version: | cut -d " " -f 2 > bundle_id.txt || rm -rf bundle_id.txt
[ -f bundle_id.txt ] || exit 1
fi
popd
- name: Download and Build Level-Zero
if: steps.cache-level-zero.outputs.cache-hit != 'true'
shell: bash -l {0}
run: |
cd /home/runner/work
mkdir -p level-zero
pushd level-zero
tree
if [[ -f bundle_id.txt && ( "$(cat bundle_id.txt)" == "${LEVEL_ZERO_VER}" ) ]]; then
echo "INFO: Using cached build of Level-Zero ${LEVEL_ZERO_VER}"
else
echo "INFO: Downloading and building Level-Zero ${LEVEL_ZERO_VER}"
rm -rf *
echo ${LEVEL_ZERO_VER} > bundle_id.txt || rm -rf bundle_id.txt
cat bundle_id.txt || exit 1
[ -f bundle_id.txt ] || exit 1
git clone https://github.com/oneapi-src/level-zero.git --branch ${LEVEL_ZERO_VER} --single-branch || exit 1
pushd level-zero || exit 1
mkdir level_zero_install || exit 1
mkdir build || exit 1
cd build || exit 1
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../level_zero_install .. || exit 1
make install || exit 1
popd
fi
popd
- name: Build LLVM-MLIR
if: steps.cache-llvm-mlir.outputs.cache-hit != 'true'
shell: bash -l {0}
Expand All @@ -147,44 +79,33 @@ jobs:
cd llvm-project || exit 1
git checkout ${LLVM_SHA} || exit 1
if [ -d "/home/runner/work/mlir-extensions/mlir-extensions/build_tools/patches" ]; then git apply /home/runner/work/mlir-extensions/mlir-extensions/build_tools/patches/*.patch; fi
mkdir _build || exit 1
cd _build || exit 1
cmake ../llvm \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
cmake G Ninja -B _build -S llvm \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DLLVM_ENABLE_PROJECTS=mlir \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_USE_LINKER=gold \
-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
cmake --build _build --target install || exit 1
popd
- name: Build IMEX
- name: Build IMEX and run lit tests
shell: bash -l {0}
run: |
external_lit=`which lit`
echo ${external_lit}
# make the llvm-mlir working dir
mkdir -p /home/runner/work/tmpdir
python build_tools/build_imex.py \
--working-dir /home/runner/work/tmpdir \
--llvm-install /home/runner/work/llvm-mlir/_mlir_install \
--external-lit ${external_lit}
- name: Run lit tests
shell: bash -l {0}
run: |
cd /home/runner/work/mlir-extensions/mlir-extensions/_build || exit 1
cmake --build . --target check-imex || exit 1
cd /home/runner/work/mlir-extensions/mlir-extensions || exit 1
cmake -S . -B _build -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_EXTERNAL_LIT=${external_lit} \
-DMLIR_DIR=/home/runner/work/llvm-mlir/_mlir_install/lib/cmake/mlir || exit 1
cmake --build _build --target check-imex || exit 1
- name: Build doxygen docs
shell: bash -l {0}
run: |
cd /home/runner/work/mlir-extensions/mlir-extensions/_build || exit 1
cmake --build . --target doc_doxygen || exit 1
cd /home/runner/work/mlir-extensions/mlir-extensions || exit 1
cmake --build _build --target doc_doxygen || exit 1

0 comments on commit 5799e2e

Please sign in to comment.