From 86a6580a76b4d48ad376abac9857b1d05ffc4e95 Mon Sep 17 00:00:00 2001 From: Jose Lopes Date: Mon, 19 Aug 2024 10:50:37 +0100 Subject: [PATCH 1/7] Experiment with CI --- .github/workflows/build-llvm-image.yml | 94 +++++++++++--------------- .gitmodules | 3 + llvm-project | 1 + 3 files changed, 45 insertions(+), 53 deletions(-) create mode 100644 .gitmodules create mode 160000 llvm-project diff --git a/.github/workflows/build-llvm-image.yml b/.github/workflows/build-llvm-image.yml index 973e9aee..66e7bffb 100644 --- a/.github/workflows/build-llvm-image.yml +++ b/.github/workflows/build-llvm-image.yml @@ -4,67 +4,55 @@ name: Build x86 LLVM-Nightly Image on: - # Allow manually triggering rebuild. + pull_request: workflow_dispatch: # Run every week (on Sunday). schedule: - cron: '0 0 * * SUN' -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read jobs: - build-llvm-image: + buildandtest: + name: Build & Test runs-on: ubuntu-latest - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - name: Get Repo - uses: actions/checkout@v2 - with: - fetch-depth: 2 - submodules: "true" - - - name: Ccache for C++ compilation - uses: hendrikmuhs/ccache-action@4687d037e4d7cf725512d9b819137a3af34d39b3 - with: - key: ${{ runner.os }}-clangreleaseasserts-${{ steps.get-submodule-hash.outputs.hash }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta-llvm - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-llvm + steps: + - uses: actions/checkout@v4 - - name: Build and push LLVM image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + - name: Setup ccache + uses: hendrikmuhs/ccache-action@v1 with: - context: . - push: true - tags: ${{ steps.meta-llvm.outputs.tags }} - labels: ${{ steps.meta-llvm.outputs.labels }} - file: .github/workflows/llvmmlir.Dockerfile - - # env: - # DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }} - # run: | - # # Swaps utils/clone-mlir for a different shell script that clones the latest version of llvm/mlir. - # mv $GITHUB_WORKSPACE/utils/clone-mlir.sh $GITHUB_WORKSPACE/utils/clone-mlir-backup.sh - # cp $GITHUB_WORKSPACE/utils/clone-mlir-master.sh $GITHUB_WORKSPACE/utils/clone-mlir.sh - # # Build docker image for x86 arch, with the latest llvm/mlir and subsequently publish it. - # docker build --tag onnxmlirczar/onnx-mlir-llvmimage:x86-nightly -f $GITHUB_WORKSPACE/.github/workflows/prereq.Dockerfile $GITHUB_WORKSPACE/utils - # docker login -u onnxmlirczar -p "$DOCKER_HUB_TOKEN" - # docker push onnxmlirczar/onnx-mlir-llvmimage:x86-nightly - - - \ No newline at end of file + key: ${{ matrix.os }} + variant: sccache + + - name: Install Ninja + uses: llvm/actions/install-ninja@main + + - name: Build and Test + shell: bash + id: build-llvm + run: | + cmake -G Ninja \ + -Bbuild \ + llvm-project/llvm \ + -DCMAKE_BUILD_TYPE=Relase \ + -DCMAKE_C_COMPILER=clang \ + -DCMAKE_CXX_COMPILER=clang++ \ + -DLLVM_USE_LINKER=lld \ + -DLLVM_ENABLE_PROJECTS=mlir \ + -DLLVM_TARGETS_TO_BUILD=host \ + -DLLVM_BUILD_TOOLS=OFF \ + -DLLVM_BUILD_UTILS=OFF \ + -DLLVM_BUILD_RUNTIMES=OFF \ + -DCMAKE_C_COMPILER_LAUNCHER=sccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ + -DLLVM_EXTERNAL_PROJECTS=mlir-xten \ + -DMLIR_XTEN_ENABLE_TORCH=OFF \ + -DLLVM_EXTERNAL_MLIR_XTEN_SOURCE_DIR=. + ninja -C build check-xten-all \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..6db9a4f8 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "llvm-project"] + path = llvm-project + url = https://github.com/Xilinx/llvm-project.git diff --git a/llvm-project b/llvm-project new file mode 160000 index 00000000..647a14d4 --- /dev/null +++ b/llvm-project @@ -0,0 +1 @@ +Subproject commit 647a14d4717f1ec708fb32764d4098a7a5f1a5a1 From 20aca782218733493b5d11693f84db5b5af6e455 Mon Sep 17 00:00:00 2001 From: Jose Lopes Date: Mon, 19 Aug 2024 12:36:31 +0100 Subject: [PATCH 2/7] Use the requirements from MLIR --- .github/workflows/build-llvm-image.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-llvm-image.yml b/.github/workflows/build-llvm-image.yml index 66e7bffb..4c3d092f 100644 --- a/.github/workflows/build-llvm-image.yml +++ b/.github/workflows/build-llvm-image.yml @@ -24,6 +24,8 @@ jobs: steps: - uses: actions/checkout@v4 + with: + submodules: true - name: Setup ccache uses: hendrikmuhs/ccache-action@v1 @@ -31,6 +33,15 @@ jobs: key: ${{ matrix.os }} variant: sccache + - name: Set virtual env + run: | + python3 -m venv .venv + source .venv/bin/activate + + - name: Install requirements.txt + run: | + pip install -r ./llvm-project/mlir/python/requirements.txt + - name: Install Ninja uses: llvm/actions/install-ninja@main @@ -41,7 +52,7 @@ jobs: cmake -G Ninja \ -Bbuild \ llvm-project/llvm \ - -DCMAKE_BUILD_TYPE=Relase \ + -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_COMPILER=clang \ -DCMAKE_CXX_COMPILER=clang++ \ -DLLVM_USE_LINKER=lld \ From efb436c74aac17c19c150a2e70aaa3f4fd70a673 Mon Sep 17 00:00:00 2001 From: Jose Lopes Date: Mon, 19 Aug 2024 12:50:58 +0100 Subject: [PATCH 3/7] Add tracked branch to .gitmodules --- .github/workflows/build-llvm-image.yml | 6 ++++-- .gitmodules | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-llvm-image.yml b/.github/workflows/build-llvm-image.yml index 4c3d092f..a6b6395b 100644 --- a/.github/workflows/build-llvm-image.yml +++ b/.github/workflows/build-llvm-image.yml @@ -38,6 +38,8 @@ jobs: python3 -m venv .venv source .venv/bin/activate + # Reuse the requirements from mlir + # mlir-xten is an extension to mlir and should work under the same environment. - name: Install requirements.txt run: | pip install -r ./llvm-project/mlir/python/requirements.txt @@ -49,7 +51,7 @@ jobs: shell: bash id: build-llvm run: | - cmake -G Ninja \ + cmake -GNinja \ -Bbuild \ llvm-project/llvm \ -DCMAKE_BUILD_TYPE=Release \ @@ -66,4 +68,4 @@ jobs: -DLLVM_EXTERNAL_PROJECTS=mlir-xten \ -DMLIR_XTEN_ENABLE_TORCH=OFF \ -DLLVM_EXTERNAL_MLIR_XTEN_SOURCE_DIR=. - ninja -C build check-xten-all \ No newline at end of file + ninja -C build check-xten-all diff --git a/.gitmodules b/.gitmodules index 6db9a4f8..f6e676dd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "llvm-project"] path = llvm-project url = https://github.com/Xilinx/llvm-project.git + branch = feature/fused-ops From f08d034ff7101c9f1400e91be23c028e9b29d30c Mon Sep 17 00:00:00 2001 From: Jose Lopes Date: Mon, 19 Aug 2024 14:02:57 +0100 Subject: [PATCH 4/7] Use pwd instead of dot for readability --- .github/workflows/build-llvm-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-llvm-image.yml b/.github/workflows/build-llvm-image.yml index a6b6395b..d23e59ce 100644 --- a/.github/workflows/build-llvm-image.yml +++ b/.github/workflows/build-llvm-image.yml @@ -67,5 +67,5 @@ jobs: -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ -DLLVM_EXTERNAL_PROJECTS=mlir-xten \ -DMLIR_XTEN_ENABLE_TORCH=OFF \ - -DLLVM_EXTERNAL_MLIR_XTEN_SOURCE_DIR=. + -DLLVM_EXTERNAL_MLIR_XTEN_SOURCE_DIR="$PWD" ninja -C build check-xten-all From 0a645284aa0390d98816fcee73e22054baa30c26 Mon Sep 17 00:00:00 2001 From: Jose Lopes Date: Mon, 19 Aug 2024 14:37:24 +0100 Subject: [PATCH 5/7] Add dependency to fix compilation issues --- lib/Conversion/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Conversion/CMakeLists.txt b/lib/Conversion/CMakeLists.txt index ee1e0a22..3e252c86 100644 --- a/lib/Conversion/CMakeLists.txt +++ b/lib/Conversion/CMakeLists.txt @@ -21,6 +21,7 @@ add_mlir_library(XTenConversionPasses DEPENDS XTenConversionIncGen + MLIRLinalgOpsIncGen LINK_COMPONENTS Core From 4bbc1e1d89415a7f70cfb2cd324650c66ec5f2e2 Mon Sep 17 00:00:00 2001 From: josel-amd <166385423+josel-amd@users.noreply.github.com> Date: Tue, 20 Aug 2024 13:15:53 +0200 Subject: [PATCH 6/7] Update .github/workflows/build-llvm-image.yml Co-authored-by: Matthias Gehre --- .github/workflows/build-llvm-image.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build-llvm-image.yml b/.github/workflows/build-llvm-image.yml index d23e59ce..56e0aab6 100644 --- a/.github/workflows/build-llvm-image.yml +++ b/.github/workflows/build-llvm-image.yml @@ -5,6 +5,9 @@ name: Build x86 LLVM-Nightly Image on: pull_request: + push: + branches: + - feature/fused-ops workflow_dispatch: # Run every week (on Sunday). schedule: From 33c2c9776c1bc4c6c8d6b59422373ef232306d76 Mon Sep 17 00:00:00 2001 From: Jose Lopes Date: Tue, 20 Aug 2024 12:21:10 +0100 Subject: [PATCH 7/7] Move the code to buildAndTest.yml and remove all other workflows --- .github/workflows/build-llvm-image.yml | 74 ------ .github/workflows/build-prereq-image.yml | 65 ------ .github/workflows/buildAndTest.yml | 281 +++++------------------ .github/workflows/generateDocs.yml | 106 --------- .github/workflows/llvmmlir.Dockerfile | 22 -- .github/workflows/prereq.Dockerfile | 28 --- .github/workflows/torch-mlir.Dockerfile | 17 -- 7 files changed, 63 insertions(+), 530 deletions(-) delete mode 100644 .github/workflows/build-llvm-image.yml delete mode 100644 .github/workflows/build-prereq-image.yml delete mode 100644 .github/workflows/generateDocs.yml delete mode 100644 .github/workflows/llvmmlir.Dockerfile delete mode 100644 .github/workflows/prereq.Dockerfile delete mode 100644 .github/workflows/torch-mlir.Dockerfile diff --git a/.github/workflows/build-llvm-image.yml b/.github/workflows/build-llvm-image.yml deleted file mode 100644 index 56e0aab6..00000000 --- a/.github/workflows/build-llvm-image.yml +++ /dev/null @@ -1,74 +0,0 @@ -# (c) Copyright 2021 Xilinx, Inc. All Rights reserved. -# (c) Copyright 2022 - 2024 Advanced Micro Devices, Inc. All Rights reserved. - -name: Build x86 LLVM-Nightly Image - -on: - pull_request: - push: - branches: - - feature/fused-ops - workflow_dispatch: - # Run every week (on Sunday). - schedule: - - cron: '0 0 * * SUN' - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -permissions: - contents: read - -jobs: - buildandtest: - name: Build & Test - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - - name: Setup ccache - uses: hendrikmuhs/ccache-action@v1 - with: - key: ${{ matrix.os }} - variant: sccache - - - name: Set virtual env - run: | - python3 -m venv .venv - source .venv/bin/activate - - # Reuse the requirements from mlir - # mlir-xten is an extension to mlir and should work under the same environment. - - name: Install requirements.txt - run: | - pip install -r ./llvm-project/mlir/python/requirements.txt - - - name: Install Ninja - uses: llvm/actions/install-ninja@main - - - name: Build and Test - shell: bash - id: build-llvm - run: | - cmake -GNinja \ - -Bbuild \ - llvm-project/llvm \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_C_COMPILER=clang \ - -DCMAKE_CXX_COMPILER=clang++ \ - -DLLVM_USE_LINKER=lld \ - -DLLVM_ENABLE_PROJECTS=mlir \ - -DLLVM_TARGETS_TO_BUILD=host \ - -DLLVM_BUILD_TOOLS=OFF \ - -DLLVM_BUILD_UTILS=OFF \ - -DLLVM_BUILD_RUNTIMES=OFF \ - -DCMAKE_C_COMPILER_LAUNCHER=sccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ - -DLLVM_EXTERNAL_PROJECTS=mlir-xten \ - -DMLIR_XTEN_ENABLE_TORCH=OFF \ - -DLLVM_EXTERNAL_MLIR_XTEN_SOURCE_DIR="$PWD" - ninja -C build check-xten-all diff --git a/.github/workflows/build-prereq-image.yml b/.github/workflows/build-prereq-image.yml deleted file mode 100644 index 0c642bf6..00000000 --- a/.github/workflows/build-prereq-image.yml +++ /dev/null @@ -1,65 +0,0 @@ -# (c) Copyright 2021 Xilinx, Inc. All Rights reserved. -# (c) Copyright 2022 - 2024 Advanced Micro Devices, Inc. All Rights reserved. - -name: Build x86 LLVM-Nightly Prereq Image - -on: - # Allow manually triggering rebuild. - workflow_dispatch: - # Run every week (on Sunday). - schedule: - - cron: '0 0 * * SUN' - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - build-prereq-image: - runs-on: ubuntu-latest - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - name: Get Repo - uses: actions/checkout@v2 - with: - fetch-depth: 2 - submodules: "true" - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-base - - - name: Build and push base image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - file: .github/workflows/prereq.Dockerfile - - # env: - # DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }} - # run: | - # # Swaps utils/clone-mlir for a different shell script that clones the latest version of llvm/mlir. - # mv $GITHUB_WORKSPACE/utils/clone-mlir.sh $GITHUB_WORKSPACE/utils/clone-mlir-backup.sh - # cp $GITHUB_WORKSPACE/utils/clone-mlir-master.sh $GITHUB_WORKSPACE/utils/clone-mlir.sh - # # Build docker image for x86 arch, with the latest llvm/mlir and subsequently publish it. - # docker build --tag onnxmlirczar/onnx-mlir-llvmimage:x86-nightly -f $GITHUB_WORKSPACE/.github/workflows/prereq.Dockerfile $GITHUB_WORKSPACE/utils - # docker login -u onnxmlirczar -p "$DOCKER_HUB_TOKEN" - # docker push onnxmlirczar/onnx-mlir-llvmimage:x86-nightly - - - \ No newline at end of file diff --git a/.github/workflows/buildAndTest.yml b/.github/workflows/buildAndTest.yml index 14a0d520..eda56b3d 100644 --- a/.github/workflows/buildAndTest.yml +++ b/.github/workflows/buildAndTest.yml @@ -1,229 +1,74 @@ # (c) Copyright 2021 Xilinx, Inc. All Rights reserved. # (c) Copyright 2022 - 2024 Advanced Micro Devices, Inc. All Rights reserved. -name: Build and Test +# (c) Copyright 2021 Xilinx, Inc. All Rights reserved. +# (c) Copyright 2022 - 2024 Advanced Micro Devices, Inc. All Rights reserved. -on: +name: Build & Test + +on: + pull_request: push: branches: - - main - pull_request: - types: [assigned, opened, synchronize, reopened] + - feature/fused-ops workflow_dispatch: -jobs: - # Build repo and run its tests. - build-repo: - name: Build and Test - runs-on: ubuntu-latest - steps: - - name: Configure Environment - run: echo "$GITHUB_WORKSPACE/llvm/install/bin" >> $GITHUB_PATH - - # Clone the repo and its submodules. Do shallow clone to save clone - # time. - - name: Get repo - uses: actions/checkout@v2 - with: - fetch-depth: 2 - submodules: "true" - - - name: Hello world action step - uses: ./.github/actions/build-with-llvm/ # Uses an action in the root directory - id: hello - with: - who-to-greet: 'Mona the Octocat' - - # We'll be running clang-tidy later in this flow. - # - name: Install clang-tidy - # run: | - # sudo apt-get install -y clang-tidy-9 - # sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy \ - # /usr/bin/clang-tidy-9 100 - - # - name: Install libboost - # run: sudo apt-get install -y libboost-all-dev - - # - name: Install psutil - # run: sudo pip install psutil - - # # -------- - # # Restore LLVM from cache and build if it's not in there. - # # -------- - - # - name: Get cmakeModules - # id: clone-cmakeModules - # run: git clone --depth 1 https://github.com/Xilinx/cmakeModules.git - # shell: bash +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true - # - name: Get LLVM - # id: clone-llvm - # run: utils/clone-llvm.sh - # shell: bash - - # # Extract the LLVM submodule hash for use in the cache key. - # - name: Get LLVM Hash - # id: get-llvm-hash - # run: | - # cd llvm - # echo "::set-output name=hash::$(git rev-parse @:./llvm)" - # shell: bash +permissions: + contents: read - # # Try to fetch LLVM from the cache. - # - name: Cache LLVM - # id: cache-llvm - # uses: actions/cache@v2 - # with: - # path: llvm - # key: ${{ runner.os }}-llvm-install-${{ steps.get-llvm-hash.outputs.hash }} - - # # Build LLVM if we didn't hit in the cache. Even though we build it in - # # the previous job, there is a low chance that it'll have been evicted by - # # the time we get here. - # - name: Rebuild and Install LLVM - # if: steps.cache-llvm.outputs.cache-hit != 'true' - # run: utils/build-llvm.sh - - # -------- - # Build and test repo in both debug and release mode. - # -------- - - # Build the repo test target in debug mode to build and test. - # - name: Build (Assert) - # run: | - # mkdir build_assert - # cd build_assert - # cmake .. \ - # -DCMAKE_BUILD_TYPE=Debug \ - # -DLLVM_ENABLE_ASSERTIONS=ON \ - # -DCMAKE_MODULE_PATH=`pwd`/../cmakeModules \ - # -DMLIR_DIR=/build/build/lib/cmake/mlir/ \ - # -DLLVM_DIR=/build/build/lib/cmake/llvm/ \ - # -DCMAKE_LINKER=lld \ - # -DCMAKE_C_COMPILER=clang \ - # -DCMAKE_CXX_COMPILER=clang++ \ - # -DLLVM_EXTERNAL_LIT=/build/build/bin/llvm-lit \ - # -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - # make -j$(nproc) - - # Build the repo test target in release mode to build and test. - # - name: Build (Release) - # run: | - # mkdir build_release - # cd build_release - # cmake .. \ - # -DCMAKE_BUILD_TYPE=Release \ - # -DLLVM_ENABLE_ASSERTIONS=OFF \ - # -DCMAKE_MODULE_PATH=../cmakeModules \ - # -DMLIR_DIR=../llvm/install/lib/cmake/mlir/ \ - # -DLLVM_DIR=../llvm/install/lib/cmake/llvm/ \ - # -DCMAKE_LINKER=lld \ - # -DCMAKE_C_COMPILER=clang \ - # -DCMAKE_CXX_COMPILER=clang++ \ - # -DLLVM_EXTERNAL_LIT=`pwd`/../llvm/build/bin/llvm-lit - # make -j$(nproc) - - # # -------- - # # Lint the code. - # # ------- - - # # Choose the git commit to diff against for the purposes of linting. - # # Since this workflow is triggered on both pushes and pull requests, we - # # have to determine if the pull request target branch is set (which it - # # will only be on the PR triggered flow). If it's not, then compare - # # against the last commit. - # - name: choose-commit - # if: ${{ always() }} - # env: - # # Base ref is the target branch, in text form (not hash) - # PR_BASE: ${{ github.base_ref }} - # run: | - # # Run clang-format - # if [[ -z "$PR_BASE" ]]; then - # DIFF_COMMIT_NAME="HEAD^" - # else - # DIFF_COMMIT_NAME="$PR_BASE" - # fi - # echo "DIFF_COMMIT_NAME=$DIFF_COMMIT_NAME" >> $GITHUB_ENV - - # # Since we did a shallow fetch for this repo, we must fetch the commit - # # upon which we be diff'ing. The last step set the ref name in the - # # $DIFF_COMMIT_NAME environment variable. When running the fetch, resolve - # # it to the commit hash and pass that hash along to subsequent steps. - # - name: git fetch base commit - # continue-on-error: true - # run: | - # if [[ ! "$DIFF_COMMIT_NAME" == *"HEAD"* ]]; then - # git fetch --recurse-submodules=no origin $DIFF_COMMIT_NAME - # DIFF_COMMIT_SHA=$( git rev-parse origin/$DIFF_COMMIT_NAME ) - # else - # DIFF_COMMIT_SHA=$( git rev-parse $DIFF_COMMIT_NAME ) - # fi - # echo "DIFF_COMMIT=$DIFF_COMMIT_SHA" >> $GITHUB_ENV - - # # Run 'git clang-format', comparing against the target commit hash. If - # # clang-format fixed anything, fail and output a patch. - # - name: clang-format - # if: ${{ always() }} - # run: | - # # Run clang-format - # git clang-format-11 $DIFF_COMMIT - # git diff --ignore-submodules > clang-format.patch - # if [ -s clang-format.patch ]; then - # echo "Clang-format found formatting problems in the following " \ - # "files. See diff in the clang-format.patch artifact." - # git diff --ignore-submodules --name-only - # git checkout . - # exit 1 - # fi - # echo "Clang-format found no formatting problems" - # exit 0 - - # # Run clang-tidy against only the changes. The 'clang-tidy-diff' script - # # does this if supplied with the diff. - # - name: clang-tidy - # if: ${{ always() }} - # run: | - # git diff -U0 $DIFF_COMMIT | \ - # clang-tidy-diff-9.py -path build_assert -p1 -fix - # git diff --ignore-submodules > clang-tidy.patch - # if [ -s clang-tidy.patch ]; then - # echo "Clang-tidy problems in the following files. " \ - # "See diff in the clang-tidy.patch artifact." - # git diff --ignore-submodules --name-only - # git checkout . - # exit 1 - # fi - # echo "Clang-tidy found no problems" - # exit 0 - - # # Upload the format and tidy patches to an artifact (zip'd) associated - # # with the workflow run. Only run this on a failure. - # - name: Upload format and tidy patches - # uses: actions/upload-artifact@v2 - # continue-on-error: true - # if: ${{ failure() }} - # with: - # name: clang-format-tidy-patches - # path: clang-*.patch - - # # Unfortunately, artifact uploads are always zips so display the diff as - # # well to provide feedback at a glance. - # - name: clang format and tidy patches display - # if: ${{ failure() }} - # continue-on-error: true - # run: | - # # Display patches - # if [ ! -z clang-format.patch ]; then - # echo "Clang-format patch" - # echo "================" - # cat clang-format.patch - # echo "================" - # fi - # if [ ! -z clang-tidy.patch ]; then - # echo "Clang-tidy patch" - # echo "================" - # cat clang-tidy.patch - # echo "================" - # fi +jobs: + buildandtest: + name: Build & Test (no torch-mlir) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Setup ccache + uses: hendrikmuhs/ccache-action@v1 + with: + key: ${{ matrix.os }} + variant: sccache + + - name: Set virtual env + run: | + python3 -m venv .venv + source .venv/bin/activate + + # Reuse the requirements from mlir + # mlir-xten is an extension to mlir and should work under the same environment. + - name: Install requirements.txt + run: | + pip install -r ./llvm-project/mlir/python/requirements.txt + + - name: Install Ninja + uses: llvm/actions/install-ninja@main + + - name: Build and Test + shell: bash + id: build-llvm + run: | + cmake -GNinja \ + -Bbuild \ + llvm-project/llvm \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_COMPILER=clang \ + -DCMAKE_CXX_COMPILER=clang++ \ + -DLLVM_USE_LINKER=lld \ + -DLLVM_ENABLE_PROJECTS=mlir \ + -DLLVM_TARGETS_TO_BUILD=host \ + -DLLVM_BUILD_TOOLS=OFF \ + -DLLVM_BUILD_UTILS=OFF \ + -DLLVM_BUILD_RUNTIMES=OFF \ + -DCMAKE_C_COMPILER_LAUNCHER=sccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ + -DLLVM_EXTERNAL_PROJECTS=mlir-xten \ + -DMLIR_XTEN_ENABLE_TORCH=OFF \ + -DLLVM_EXTERNAL_MLIR_XTEN_SOURCE_DIR="$PWD" + ninja -C build check-xten-all diff --git a/.github/workflows/generateDocs.yml b/.github/workflows/generateDocs.yml deleted file mode 100644 index 8f546c00..00000000 --- a/.github/workflows/generateDocs.yml +++ /dev/null @@ -1,106 +0,0 @@ -# (c) Copyright 2021 Xilinx, Inc. All Rights reserved. -# (c) Copyright 2022 - 2024 Advanced Micro Devices, Inc. All Rights reserved. - -name: Generate Github Pages - -on: - push: - branches: - - main - workflow_dispatch: - -jobs: - build-docs: - name: Generate Documentation - runs-on: ubuntu-latest - steps: - - name: Configure Environment - run: echo "$GITHUB_WORKSPACE/llvm/install/bin" >> $GITHUB_PATH - - # Clone the repo and its submodules. Do shallow clone to save clone - # time. - - name: Get repo - uses: actions/checkout@v2 - with: - fetch-depth: 2 - submodules: "true" - - - name: Install libboost - run: sudo apt-get install -y libboost-all-dev clang-8 lld-8 - - - name: Install psutil - run: sudo pip install psutil - - - name: Install Ninja - uses: llvm/actions/install-ninja@55d844821959226fab4911f96f37071c1d4c3268 - - - name: Get Submodule Hash - id: get-submodule-hash - run: echo "::set-output name=hash::$(md5sum $(echo utils/clone-llvm.sh))" - shell: bash - - - name: Ccache for C++ compilation - uses: hendrikmuhs/ccache-action@4687d037e4d7cf725512d9b819137a3af34d39b3 - with: - key: ${{ runner.os }}-clangreleaseasserts-${{ steps.get-submodule-hash.outputs.hash }} - max-size: 1G - - - name: Get cmakeModules - id: clone-cmakeModules - run: git clone --depth 1 https://github.com/Xilinx/cmakeModules.git - shell: bash - - - name: Get LLVM - id: clone-llvm - run: utils/clone-llvm.sh - shell: bash - - - name: Install MLIR Python depends - run: | - python -m pip install -r $GITHUB_WORKSPACE/llvm/mlir/python/requirements.txt - - - name: Install PyTorch nightly depends - run: | - python -m pip install --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html - - - name: Rebuild and Install LLVM - run: utils/build-llvm.sh - - - name: Build Torch-mLIR - run: utils/build-torch-mlir.sh - - # Build the repo test target in release mode to build and test. - - name: Build Docs - run: | - mkdir build_release - pushd build_release - cmake .. \ - -DCMAKE_BUILD_TYPE=Release \ - -DLLVM_ENABLE_ASSERTIONS=OFF \ - -DCMAKE_MODULE_PATH=`pwd`/../cmakeModules \ - -DMLIR_DIR=`pwd`/../install/lib/cmake/mlir/ \ - -DLLVM_DIR=`pwd`/../install/lib/cmake/llvm/ \ - -DTORCH_MLIR_BINARY_DIR=`pwd`/../torch-mlir-build \ - -DTORCH_MLIR_SOURCE_DIR=`pwd`/../torch-mlir \ - -DCMAKE_LINKER=lld \ - -DCMAKE_C_COMPILER=clang \ - -DCMAKE_CXX_COMPILER=clang++ \ - -DLLVM_EXTERNAL_LIT=`pwd`/../build/bin/llvm-lit - make docs - popd - cp -r docs/* build_release/docs - - - name: Save LLVM Version - run: | - cd llvm; set VER=`git rev-parse HEAD` - echo "{" > ../build_release/docs/build_info.json - echo "llvm-version: \"$(VER)\"," >> ../build_release/docs/build_info.json - echo "}" > ../build_release/docs/build_info.json - - - name: Publish to github-pages - uses: peaceiris/actions-gh-pages@v3.6.1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./build_release/docs - enable_jekyll: true - diff --git a/.github/workflows/llvmmlir.Dockerfile b/.github/workflows/llvmmlir.Dockerfile deleted file mode 100644 index 1a9d6dd1..00000000 --- a/.github/workflows/llvmmlir.Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -FROM ghcr.io/xilinx/mlir-xten-base:main AS builder - -WORKDIR /build - -# first install MLIR in llvm-project -RUN mkdir bin -ENV PATH=$PATH:/build/bin -COPY utils/clone-llvm.sh bin/clone-llvm.sh -RUN chmod a+x bin/clone-llvm.sh -RUN clone-llvm.sh - -COPY utils/build-llvm.sh bin/build-llvm.sh -RUN chmod a+x bin/build-llvm.sh -RUN build-llvm.sh - -# FROM ghcr.io/stephenneuendorffer/mlir-xten-base:main -# WORKDIR /build -# RUN mkdir install -# COPY --from=builder /build/install install -# COPY --from=builder /build/llvm llvm - -# RUN cmake --build . --target check-mlir diff --git a/.github/workflows/prereq.Dockerfile b/.github/workflows/prereq.Dockerfile deleted file mode 100644 index 1699f35a..00000000 --- a/.github/workflows/prereq.Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -FROM ubuntu:focal - -WORKDIR /build - -# install stuff that is needed for compiling LLVM, MLIR and ONNX -RUN apt-get update -RUN DEBIAN_FRONTEND=noninteractive apt-get install -y git cmake ninja-build libprotobuf-dev protobuf-compiler -RUN DEBIAN_FRONTEND=noninteractive \ - apt-get update && \ - apt-get -y install \ - make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev \ - libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils \ - libffi-dev liblzma-dev - -RUN apt-get install python3 python3-dev python3-pip --assume-yes - -RUN apt-get install clang-8 lld-8 git ninja-build --assume-yes - -RUN pip3 install pybind11 numpy - -RUN pip3 install --pre torch==1.12.0.dev20220426 torchvision==0.13.0.dev20220426 -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html - -RUN curl -L https://github.com/Kitware/CMake/releases/download/v3.20.6/cmake-3.20.6-linux-x86_64.tar.gz > cmake.tgz -RUN tar -xvf cmake.tgz -RUN cp -r cmake*x86_64/bin/* /usr/bin -RUN cp -r cmake*x86_64/share/* /usr/share - -RUN apt-get install ccache --assume-yes \ No newline at end of file diff --git a/.github/workflows/torch-mlir.Dockerfile b/.github/workflows/torch-mlir.Dockerfile deleted file mode 100644 index 43071c57..00000000 --- a/.github/workflows/torch-mlir.Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM ghcr.io/xilinx/mlir-xten-llvm:main AS builder - -WORKDIR /build - -# first install MLIR in llvm-project -ENV PATH=$PATH:/build/bin -COPY utils/build-torch-mlir.sh bin/build-torch-mlir.sh -RUN chmod a+x bin/build-torch-mlir.sh -RUN build-torch-mlir.sh - -# FROM ghcr.io/stephenneuendorffer/mlir-xten-base:main -# WORKDIR /build -# RUN mkdir install -# COPY --from=builder /build/install install -# COPY --from=builder /build/llvm llvm - -# RUN cmake --build . --target check-mlir