Update README.md #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
jobs: | |
build: | |
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. | |
# You can convert this to a matrix build if you need cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9.16"] | |
steps: | |
- uses: actions/checkout@v3 | |
# install transformers and specific versions of torch and torch-mlir | |
- name: install dependencies | |
working-directory: ${{github.workspace}} | |
run: | | |
sudo apt-get install python3.9 | |
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py | |
python3.9 get-pip.py | |
pip3.9 --version | |
pip3.9 install transformers | |
wget https://github.com/llvm/torch-mlir/releases/download/snapshot-20221015.627/torch-1.14.0.dev20221014+cpu-cp39-cp39-linux_x86_64.whl | |
wget https://github.com/llvm/torch-mlir/releases/download/snapshot-20221015.627/torch_mlir-20221015.627-cp39-cp39-linux_x86_64.whl | |
pip3.9 install torch-1.14.0.dev20221014+cpu-cp39-cp39-linux_x86_64.whl | |
pip3.9 install torch_mlir-20221015.627-cp39-cp39-linux_x86_64.whl | |
# install ninja | |
- name: install ninja for LLVM build | |
run: sudo apt-get install ninja-build | |
# setup LLVM | |
- name: install a specific version of LLVM | |
working-directory: ${{github.workspace}} | |
run: | | |
git clone https://github.com/llvm/llvm-project.git | |
cd llvm-project | |
git checkout 99020b3c73c1e22fa388be8fd0c44391d40b3a38 | |
mkdir build | |
cd build | |
cmake -G Ninja ../llvm \ | |
-DLLVM_ENABLE_PROJECTS=mlir \ | |
-DLLVM_BUILD_EXAMPLES=ON \ | |
-DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DLLVM_ENABLE_ASSERTIONS=ON \ | |
-DLLVM_INSTALL_UTILS=ON | |
cmake --build . --target check-mlir | |
# setup mlir-cgra | |
- name: setup mlir-cgra | |
working-directory: ${{github.workspace}} | |
run: | | |
export BUILD_DIR="${{github.workspace}}/llvm-project/build" | |
export PREFIX="${{github.workspace}}/llvm-project/build" | |
mkdir build && cd build | |
cmake -G Ninja .. \ | |
-DLLVM_EXTERNAL_LIT=$BUILD_DIR/bin/llvm-lit \ | |
-DMLIR_DIR=$PREFIX/lib/cmake/mlir | |
cmake --build . --target check-soda | |
# install clang-12/opt-12 | |
- name: install LLVM and Clang for scripts/experiment | |
uses: egor-tensin/setup-clang@v1 | |
with: | |
version: 12 | |
platform: x64 | |
# add path | |
- name: add paths | |
working-directory: ${{github.workspace}} | |
run: | | |
echo "${{github.workspace}}/llvm-project/build/bin" >> $GITHUB_PATH | |
echo "${{github.workspace}}/build/bin" >> $GITHUB_PATH | |
# run demo baseline | |
- name: run demo baseline | |
working-directory: ${{github.workspace}} | |
run: | | |
cd ./experiments/demo/baseline | |
sh script.sh | |
./simulate | |
# run demo cgra | |
- name: run demo cgra | |
working-directory: ${{github.workspace}} | |
run: | | |
cd ./experiments/demo/cgra | |
sh script.sh | |
./simulate | |