Skip to content

Add a JointMatrix test case and necessary patch #1386

Add a JointMatrix test case and necessary patch

Add a JointMatrix test case and necessary patch #1386

Workflow file for this run

name: Cross-compile IMEX on CPUs
on:
push:
branches:
- main
- refactor
pull_request:
branches:
- main
- refactor
jobs:
build_linux:
name: Builds IMEX on Linux
runs-on: ubuntu-latest
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:
matrix:
python: [3.9]
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python }}
activate-environment: imex-devel
- name: Conda info
shell: bash -l {0}
run: conda info
- name: Install Build tools
shell: bash -l {0}
run: |
conda install cmake ninja graphviz conda-forge::lit conda-forge::doxygen
conda list
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Cache Vars
run: |
echo 'LLVM_SHA<<EOF' >> $GITHUB_ENV
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
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: 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}
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 --branch main --single-branch || exit 1
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 \
-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
popd
- name: Build IMEX
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
- 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