From 67cbce51ae262b06a1cd2bf575ff2d676a74107c Mon Sep 17 00:00:00 2001 From: "Lee, Sang Ik" Date: Thu, 30 Nov 2023 11:51:08 -0800 Subject: [PATCH 1/4] Replace usage of build_imex.py --- .github/workflows/build.yml | 109 ++++++------------------------------ 1 file changed, 16 insertions(+), 93 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b17180693..90d1bb8a3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,11 +4,9 @@ on: push: branches: - main - - refactor pull_request: branches: - main - - refactor jobs: build_linux: @@ -17,23 +15,20 @@ 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: matrix: - python: [3.9] + python: [3.10] 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 }} @@ -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 @@ -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 @@ -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} @@ -147,10 +79,7 @@ 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 \ + cmake G Ninja -B _build -S llvm \ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_ENABLE_PROJECTS=mlir \ -DLLVM_ENABLE_ASSERTIONS=ON \ @@ -162,29 +91,23 @@ jobs: -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-distribution-stripped || 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 From 7ea14718cf8296158c2fad2a1ae8460356ae344b Mon Sep 17 00:00:00 2001 From: "Lee, Sang Ik" Date: Thu, 30 Nov 2023 11:53:26 -0800 Subject: [PATCH 2/4] Revert python version. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 90d1bb8a3..149fc2723 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: strategy: matrix: - python: [3.10] + python: [3.9] steps: - name: Cancel Previous Runs From c92a2bd23bab5bf13f516304e02e052623a1997c Mon Sep 17 00:00:00 2001 From: "Lee, Sang Ik" Date: Thu, 30 Nov 2023 20:51:22 -0800 Subject: [PATCH 3/4] Add llvm_vcsrevision_h to LLVM_DISTRIBUTION_COMPONENTS --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 149fc2723..793076a75 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -89,7 +89,7 @@ jobs: -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" \ + -DLLVM_DISTRIBUTION_COMPONENTS="llvm_vcsrevision_h;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 cmake --build _build --target install-distribution-stripped || exit 1 popd From e05ee5612fcd0c76e80f9db89e2bc9fef1e81dd3 Mon Sep 17 00:00:00 2001 From: Sang Ik Lee Date: Fri, 1 Dec 2023 13:01:53 -0800 Subject: [PATCH 4/4] Update build.yml --- .github/workflows/build.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 793076a75..ca05e690c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -80,18 +80,16 @@ jobs: 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 cmake G Ninja -B _build -S llvm \ - -DCMAKE_BUILD_TYPE=Release \ + -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_vcsrevision_h;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 - cmake --build _build --target install-distribution-stripped || exit 1 + cmake --build _build --target install || exit 1 popd - name: Build IMEX and run lit tests