Initialize the taskflow dialect for multi-CGRA/spatial accelerator scenarios #687
Workflow file for this run
This file contains hidden or 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 | |
| LLVM_COMMIT: "6146a88f60492b520a36f8f8f3231e15f3cc6082" | |
| CCACHE_DIR: "${{ github.workspace }}/.ccache" | |
| CCACHE_COMPRESS: "true" | |
| CCACHE_MAXSIZE: "1G" | |
| 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-22.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.11.13"] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| # Update references | |
| - name: Git Submodule Update | |
| run: | | |
| git submodule update --init --recursive | |
| git submodule update --remote --recursive | |
| # install ninja | |
| - name: install ninja for LLVM build | |
| run: sudo apt-get install ninja-build | |
| # install ccache | |
| - name: install ccache & lld | |
| run: | | |
| sudo apt-get install ccache | |
| sudo apt-get install lld | |
| # Restores ccache directory. | |
| - name: ccache cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.CCACHE_DIR }} | |
| key: ${{ runner.os }}-ccache-llvm-${{ env.LLVM_COMMIT }}-${{ github.sha }} | |
| # Restores from the last successful build of this LLVM version. | |
| restore-keys: | | |
| ${{ runner.os }}-ccache-llvm-${{ env.LLVM_COMMIT }}- | |
| # install graphviz | |
| - name: install graphviz | |
| run: sudo apt-get install graphviz | |
| # setup LLVM | |
| - name: install a specific version of LLVM | |
| working-directory: ${{github.workspace}} | |
| run: | | |
| mkdir -p ${{ env.CCACHE_DIR }} | |
| git --version | |
| git clone --revision=${{ env.LLVM_COMMIT }} https://github.com/llvm/llvm-project.git | |
| cd llvm-project | |
| mkdir build && cd build | |
| cmake -G Ninja ../llvm \ | |
| -DLLVM_ENABLE_PROJECTS="mlir;clang" \ | |
| -DLLVM_BUILD_EXAMPLES=OFF \ | |
| -DLLVM_TARGETS_TO_BUILD="Native" \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DLLVM_ENABLE_ASSERTIONS=ON \ | |
| -DCMAKE_C_COMPILER=clang \ | |
| -DCMAKE_CXX_COMPILER=clang++ \ | |
| -DCMAKE_CXX_STANDARD=17 \ | |
| -DCMAKE_CXX_FLAGS="-std=c++17 -frtti" \ | |
| -DLLVM_ENABLE_LLD=ON \ | |
| -DMLIR_INSTALL_AGGREGATE_OBJECTS=ON \ | |
| -DLLVM_ENABLE_RTTI=ON \ | |
| -DLLVM_CCACHE_BUILD=ON \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache | |
| echo "CCache Status before build:" | |
| ccache -s | |
| cmake --build . | |
| echo "CCache Status after build:" | |
| ccache -s | |
| # Add LLVM tools to PATH | |
| echo "${{github.workspace}}/llvm-project/build/bin" >> $GITHUB_PATH | |
| # setup mlir-cgra | |
| - name: setup dataflow tool-chain | |
| working-directory: ${{github.workspace}} | |
| run: | | |
| mkdir build && cd build | |
| cmake -G Ninja .. \ | |
| -DLLVM_DIR=${{github.workspace}}/llvm-project/build/lib/cmake/llvm \ | |
| -DMLIR_DIR=${{github.workspace}}/llvm-project/build/lib/cmake/mlir \ | |
| -DMLIR_SOURCE_DIR=${{github.workspace}}/llvm-project/mlir \ | |
| -DMLIR_BINARY_DIR=${{github.workspace}}/llvm-project/build \ | |
| -DCMAKE_CXX_FLAGS="-std=c++17" | |
| ninja | |
| # # 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 | |
| # Sets up Python environment for torch-mlir | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # Installs NumPy 1.x first (compatable with torch-mlir) | |
| - name: Install NumPy 1.x | |
| run: pip install "numpy<2.0" | |
| - name: Install PyTorch | |
| run: | | |
| wget https://github.com/llvm/torch-mlir/releases/download/snapshot-20231229.1067/torch-2.2.0.dev20231204+cpu-cp311-cp311-linux_x86_64.whl | |
| pip install torch-2.2.0.dev20231204+cpu-cp311-cp311-linux_x86_64.whl | |
| - name: Install torch-mlir | |
| run: | | |
| wget https://github.com/llvm/torch-mlir/releases/download/snapshot-20231229.1067/torch_mlir-20231229.1067-cp311-cp311-linux_x86_64.whl | |
| pip install torch_mlir-20231229.1067-cp311-cp311-linux_x86_64.whl | |
| # shows ccache stats to verify it's working. | |
| - name: ccache stats | |
| run: ccache -s | |
| # run demo cgra | |
| - name: run test | |
| working-directory: ${{github.workspace}} | |
| run: | | |
| cd ${{github.workspace}}/test | |
| ${{github.workspace}}/llvm-project/build/bin/llvm-lit . -v | |