From c314d0b48f5451a5349ba341e0575a3efc2fe30c Mon Sep 17 00:00:00 2001 From: I-Al-Istannen Date: Wed, 22 Oct 2025 13:45:53 +0200 Subject: [PATCH 01/12] Add CI --- .github/workflows/enzyme-rust.yml | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/enzyme-rust.yml diff --git a/.github/workflows/enzyme-rust.yml b/.github/workflows/enzyme-rust.yml new file mode 100644 index 000000000000..84170af02f19 --- /dev/null +++ b/.github/workflows/enzyme-rust.yml @@ -0,0 +1,49 @@ +name: Rust Enzyme CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + merge_group: + +jobs: + build: + name: Enzyme CI Rust ${{ matrix.os }} - ${{ matrix.rust-version }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - macOS-latest + rust-version: + - master + - b2ee1b333aea9951c3eefa4967098cc763de59ca + steps: + - name: Clone rust + run: | + git clone --depth=1 https://github.com/rust-lang/rust . + - name: Adjust git settings + run: | + git config --global user.email "ci@example.org" + git config --global user.name "CI" + - name: Init enzyme submodule + run: | + git submodule update --init src/tools/enzyme + - name: Update enzyme submodule + run: | + pushd src/tools/enzyme || exit 1 + git fetch origin $GITHUB_SHA + git checkout $GITHUB_SHA + popd || exit 1 + + git add src/tools/enzyme && git commit -m "Set Enzyme version" + - name: Configure + run: | + ./configure --release-channel=nightly --enable-llvm-enzyme --enable-llvm-assertions --enable-option-checking --disable-docs --set llvm.download-ci-llvm=true + - name: Build + run: | + ./x build --stage 1 library From af54c7d4efb2f2485f95cacb2e778c59d81355fc Mon Sep 17 00:00:00 2001 From: I-Al-Istannen Date: Wed, 22 Oct 2025 14:01:43 +0200 Subject: [PATCH 02/12] We do not test anything --- .github/workflows/bcload.yml | 34 --------- .github/workflows/benchmark.yml | 49 ------------- .github/workflows/ccpp.yml | 47 ------------ .github/workflows/doxygen.yml | 41 ----------- .github/workflows/enzyme-bazel.yml | 78 -------------------- .github/workflows/enzyme-ci.yml | 111 ----------------------------- .github/workflows/enzyme-julia.yml | 57 --------------- .github/workflows/enzyme-mlir.yml | 88 ----------------------- .github/workflows/format.yml | 20 ------ .github/workflows/fortran.yml | 80 --------------------- .github/workflows/tagger.yml | 54 -------------- 11 files changed, 659 deletions(-) delete mode 100644 .github/workflows/bcload.yml delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/ccpp.yml delete mode 100644 .github/workflows/doxygen.yml delete mode 100644 .github/workflows/enzyme-bazel.yml delete mode 100644 .github/workflows/enzyme-ci.yml delete mode 100644 .github/workflows/enzyme-julia.yml delete mode 100644 .github/workflows/enzyme-mlir.yml delete mode 100644 .github/workflows/format.yml delete mode 100644 .github/workflows/fortran.yml delete mode 100644 .github/workflows/tagger.yml diff --git a/.github/workflows/bcload.yml b/.github/workflows/bcload.yml deleted file mode 100644 index c278f0621b28..000000000000 --- a/.github/workflows/bcload.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Bitcode loading CI - -on: [push] - -jobs: - build: - name: Bitcode loading CI LLVM ${{ matrix.llvm }} ${{ matrix.build }} ${{ matrix.os }} - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - # BCLoad tests only run with old pass manager [aka up to and including 13] - llvm: ["15"] - build: ["Release"] # "RelWithDebInfo" - os: [ubuntu-22.04] - - timeout-minutes: 30 - steps: - - name: add llvm - run: | - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - - sudo apt-add-repository "deb http://apt.llvm.org/`lsb_release -c | cut -f2`/ llvm-toolchain-`lsb_release -c | cut -f2`-${{ matrix.llvm }} main" || true - sudo apt-get install -y cmake gcc g++ llvm-${{ matrix.llvm }}-dev clang-${{ matrix.llvm }} libclang-${{ matrix.llvm }}-dev - sudo python3 -m pip install --upgrade pip lit - - uses: actions/checkout@v4 - - name: mkdir - run: cd enzyme && rm -rf build && mkdir build - - name: cmake - run: | - cd enzyme/build - cmake .. -DLLVM_EXTERNAL_LIT=`which lit` -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DLLVM_DIR=/usr/lib/llvm-${{ matrix.llvm }}/lib/cmake/llvm - - name: make check-bcpass - run: cd enzyme/build && make -j `nproc` check-bcpass diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 1d875a6aace1..000000000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Benchmarking - -on: - push: - branches: - - main - pull_request: - branches: - - main - merge_group: - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - build: - name: Benchmark Test on os ${{ matrix.os }} and llvm ${{ matrix.llvm }} mode ${{ matrix.build }} - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - llvm: ["16", "17", "18"] - build: ["Release"] #, "Debug" "RelWithDebInfo" - os: [] # [openstack22] - timeout-minutes: 120 - steps: - - name: add llvm - run: | - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - - sudo apt-add-repository "deb http://apt.llvm.org/`lsb_release -c | cut -f2`/ llvm-toolchain-`lsb_release -c | cut -f2`-${{ matrix.llvm }} main" || true - sudo apt-get install -y python3-pip autoconf cmake gcc g++ libtool gfortran libblas-dev llvm-${{ matrix.llvm }}-dev clang-${{ matrix.llvm }} libeigen3-dev libboost-dev libzstd-dev - sudo python3 -m pip install lit pathlib - sudo touch /usr/lib/llvm-${{ matrix.llvm }}/bin/yaml-bench - - uses: actions/checkout@v4 - - name: mkdir - run: rm -rf build && mkdir build - - name: cmake - working-directory: build - run: cmake ../enzyme -DLLVM_EXTERNAL_LIT=`which lit` -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DLLVM_DIR=/usr/lib/llvm-${{ matrix.llvm }}/lib/cmake/llvm - - name: make - working-directory: build - run: make -j `nproc` LLVMEnzyme-${{ matrix.llvm }} - - name: make bench-enzyme - working-directory: build - run: make bench-enzyme - - name: results - run: cat enzyme/benchmarks/*/*/results.txt diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml deleted file mode 100644 index 212090991ab7..000000000000 --- a/.github/workflows/ccpp.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: C/C++ CI - -on: - push: - branches: - - main - pull_request: - branches: - - main - merge_group: - -jobs: - build: - name: Integration CI LLVM ${{ matrix.llvm }} ${{ matrix.build }} ${{ matrix.os }} - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - llvm: ["15", "16", "17", "18", "19", "20", "21"] - build: ["Release"] # "RelWithDebInfo" - os: [ubuntu-22.04] - - timeout-minutes: 45 - - steps: - - name: add llvm - run: | - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - - sudo apt-get install -y libmpfr-dev - sudo apt-add-repository "deb http://apt.llvm.org/`lsb_release -c | cut -f2`/ llvm-toolchain-`lsb_release -c | cut -f2`-${{ matrix.llvm }} main" || true - sudo apt-get install -y cmake gcc g++ llvm-${{ matrix.llvm }}-dev libomp-${{ matrix.llvm }}-dev lld-${{ matrix.llvm }} clang-${{ matrix.llvm }} libclang-${{ matrix.llvm }}-dev libeigen3-dev libboost-dev libzstd-dev - sudo python3 -m pip install --upgrade pip lit - - uses: actions/checkout@v4 - - name: mkdir - run: rm -rf build && mkdir build - - name: cmake - working-directory: build - run: cmake ../enzyme -DLLVM_EXTERNAL_LIT=`which lit` -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DLLVM_DIR=/usr/lib/llvm-${{ matrix.llvm }}/lib/cmake/llvm - - name: make - run: cd build && make -j `nproc` LLVMEnzyme-${{ matrix.llvm }} ClangEnzyme-${{ matrix.llvm }} LLDEnzyme-${{ matrix.llvm }} - - name: make test-cmake - working-directory: build - run: make -j `nproc` test-cmake - - name: make check-enzyme-integration - working-directory: build - run: make -j `nproc` check-enzyme-integration diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml deleted file mode 100644 index 722fbe6b14a4..000000000000 --- a/.github/workflows/doxygen.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Build and deploy Doxygen to Scripts - -on: - push: - branches: - - main - -jobs: - build-docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: mattnotmitt/doxygen-action@v1.12.0 - with: - working-directory: 'enzyme/' - doxyfile-path: 'doxygen.cfg' - - - name: Upload static files as artifact - id: deployment - uses: actions/upload-pages-artifact@v3 # or specific "vX.X.X" version tag for this action - with: - path: enzyme/doxygen/html - - deploy-docs: - # Grant GITHUB_TOKEN the permissions required to make a Pages deployment - permissions: - pages: write # to deploy to Pages - id-token: write # to verify the deployment originates from an appropriate source - - # Deploy to the github-pages environment - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - - needs: build-docs - runs-on: ubuntu-latest - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action diff --git a/.github/workflows/enzyme-bazel.yml b/.github/workflows/enzyme-bazel.yml deleted file mode 100644 index d41fdedb7f59..000000000000 --- a/.github/workflows/enzyme-bazel.yml +++ /dev/null @@ -1,78 +0,0 @@ -name: Bazel - -on: - schedule: - - cron: 0 0 * * * - push: - branches: - - main - paths: - - '.github/workflows/enzyme-bazel.yml' - - 'enzyme/Enzyme/**' - - 'enzyme/includes/**' - - 'enzyme/test/**' - - 'enzyme/tools/**' - - 'enzyme/BUILD' - - 'enzyme/WORKSPACE' - pull_request: - branches: - - main - paths: - - '.github/workflows/enzyme-bazel.yml' - - 'enzyme/Enzyme/**' - - 'enzyme/includes/**' - - 'enzyme/test/**' - - 'enzyme/tools/**' - - 'enzyme/BUILD' - - 'enzyme/WORKSPACE' - merge_group: - -concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} - -jobs: - build: - name: Enzyme Bazel Build - ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - - linux-x86-n2-32 - build: - - Release - llbuild: - - Release - timeout-minutes: 500 - - container: - image: ${{ (contains(matrix.os, 'linux') && 'ghcr.io/enzymead/reactant-docker-images@sha256:91e1edb7a7c869d5a70db06e417f22907be0e67ca86641d48adcea221fedc674' ) || '' }} - - steps: - - name: Install Python dependencies - run: python -m pip install lit - - uses: actions/checkout@v4 - - uses: actions/checkout@v4 - with: - repository: 'llvm/llvm-project' - path: 'llvm-project' - - uses: bazel-contrib/setup-bazel@0.14.0 - name: Set up Bazel - with: - # Avoid downloading Bazel every time. - bazelisk-cache: true - # Store build cache per workflow. - disk-cache: ${{ github.workflow }}-${{ matrix.os }}-${{ matrix.build }}-${{ matrix.llbuild }} - # Share repository cache between workflows. - repository-cache: true - bazelisk-version: 1.x - - name: Build Enzyme - run: | - cd enzyme - bazel build --color=yes :EnzymeStatic :enzymemlir-opt - - name: Test Enzyme - run: | - cd enzyme - bazel test --color=yes --test_output=errors ... diff --git a/.github/workflows/enzyme-ci.yml b/.github/workflows/enzyme-ci.yml deleted file mode 100644 index 56c84bf8c2f7..000000000000 --- a/.github/workflows/enzyme-ci.yml +++ /dev/null @@ -1,111 +0,0 @@ -name: Enzyme CI - -on: - push: - branches: - - main - pull_request: - merge_group: - -jobs: - build-linux: - name: Enzyme CI LLVM ${{ matrix.llvm }} ${{ matrix.build }} ${{ matrix.os }} - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - llvm: ["15", "16"] - build: ["Release", "Debug"] # "RelWithDebInfo" - os: [ubuntu-22.04] - - timeout-minutes: 30 - - steps: - - name: add llvm - run: | - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - - sudo apt-add-repository "deb http://apt.llvm.org/`lsb_release -c | cut -f2`/ llvm-toolchain-`lsb_release -c | cut -f2`-${{ matrix.llvm }} main" || true - sudo apt-get install -y cmake gcc g++ llvm-${{ matrix.llvm }}-dev libzstd-dev - sudo python3 -m pip install --upgrade pip lit - - uses: actions/checkout@v4 - - name: mkdir - run: rm -rf build && mkdir build - - name: cmake - working-directory: build - run: cmake ../enzyme -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DLLVM_EXTERNAL_LIT=`which lit` -DLLVM_DIR=/usr/lib/llvm-${{ matrix.llvm }}/lib/cmake/llvm - - name: make - working-directory: build - run: make -j `nproc` - - name: make check-typeanalysis - working-directory: build - run: make -j `nproc` check-typeanalysis - - name: make check-activityanalysis - working-directory: build - run: make -j `nproc` check-activityanalysis - - name: make check-enzyme - working-directory: build - run: make -j `nproc` check-enzyme-bench - - build-macos: - name: Enzyme CI LLVM ${{ matrix.llvm }} ${{ matrix.build }} macOS - runs-on: macos-latest - - strategy: - fail-fast: false - matrix: - llvm: ["15", "16"] - build: ["Release", "Debug"] # "RelWithDebInfo" - - timeout-minutes: 30 - steps: - - name: add llvm - run: | - brew update - brew uninstall cmake - brew install llvm@${{ matrix.llvm }} make cmake - sudo python3 -m pip install --upgrade --break-system-packages --user pip lit requests - - uses: actions/checkout@v4 - - name: mkdir - run: rm -rf build && mkdir build - - name: cmake - working-directory: build - run: cmake ../enzyme -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DLLVM_EXTERNAL_LIT=`find /Users/runner/Library/Python/ -iname lit` -DLLVM_DIR=`brew --prefix llvm@${{ matrix.llvm }}`/lib/cmake/llvm - - name: make - working-directory: build - run: make -j 3 - - name: make check-typeanalysis - working-directory: build - run: make -j 3 check-typeanalysis - - name: make check-activityanalysis - working-directory: build - run: make -j 3 check-activityanalysis - - name: make check-enzyme - working-directory: build - run: make -j3 check-enzyme-bench - - build-xcode: - name: Enzyme CI LLVM ${{ matrix.llvm }} ${{ matrix.build }} macOS XCode - runs-on: macos-latest - - strategy: - fail-fast: false - matrix: - llvm: ["16"] - build: ["Release"] # "RelWithDebInfo" - - timeout-minutes: 30 - steps: - - name: add llvm - run: | - brew uninstall cmake - brew install llvm@${{ matrix.llvm }} make cmake gcc - sudo python3 -m pip install --upgrade --break-system-packages --user pip lit - - uses: actions/checkout@v4 - - name: mkdir - run: rm -rf build && mkdir build - - name: cmake - working-directory: build - run: | - cmake ../enzyme -GXcode -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DLLVM_EXTERNAL_LIT=`which lit` -DLLVM_DIR=`brew --prefix llvm@${{ matrix.llvm }}`/lib/cmake/llvm - cmake --build . --parallel 3 diff --git a/.github/workflows/enzyme-julia.yml b/.github/workflows/enzyme-julia.yml deleted file mode 100644 index 6ae9f3d0ff5a..000000000000 --- a/.github/workflows/enzyme-julia.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Julia Enzyme CI - -on: - push: - branches: - - main - pull_request: - branches: - - main - merge_group: - -jobs: - build: - name: Enzyme CI Julia ${{ matrix.version }} ${{ matrix.os }} - runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.version == 'nightly' }} - strategy: - fail-fast: false - matrix: - version: - - '1.10' - os: - - ubuntu-latest - - macOS-latest - arch: - - x64 - timeout-minutes: 60 - steps: - - uses: actions/checkout@v4 - - uses: actions/checkout@v4 - with: - repository: 'EnzymeAD/Enzyme.jl' - path: ./jl - ref: main - - uses: julia-actions/setup-julia@v1 - with: - version: ${{ matrix.version }} - arch: ${{ matrix.arch }} - - - name: Build libEnzyme - if: ${{ matrix.os != 'macOS-latest'}} - run: | - julia --project=jl/deps -e 'using Pkg; Pkg.instantiate()' - julia --project=jl/deps jl/deps/build_local.jl ./enzyme - - name: Build libEnzyme MacOS - if: ${{ matrix.os == 'macOS-latest'}} - run: | - julia --project=jl/deps -e 'using Pkg; Pkg.instantiate()' - SDKROOT=`xcrun --show-sdk-path` julia --project=jl/deps jl/deps/build_local.jl ./enzyme - - name: Dev EnzymeCore - run: julia --project=jl -e 'using Pkg; Pkg.develop(path="jl/lib/EnzymeCore")' - - uses: julia-actions/julia-buildpkg@v1 - with: - project: jl - - uses: julia-actions/julia-runtest@v1 - with: - project: jl diff --git a/.github/workflows/enzyme-mlir.yml b/.github/workflows/enzyme-mlir.yml deleted file mode 100644 index db3d96e4fd24..000000000000 --- a/.github/workflows/enzyme-mlir.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: MLIR - -on: - push: - branches: - - main - pull_request: - branches: - - main - merge_group: - -jobs: - build-linux: - name: MLIR ${{ matrix.build }} ${{ matrix.os }} - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - build: ["Release", "Debug"] # "RelWithDebInfo" - llbuild: ["Release"] - os: [linux-x86-n2-32] - - timeout-minutes: 500 - - container: - image: ${{ (contains(matrix.os, 'linux') && 'ghcr.io/enzymead/reactant-docker-images@sha256:91e1edb7a7c869d5a70db06e417f22907be0e67ca86641d48adcea221fedc674' ) || '' }} - - steps: - - name: Install dependencies - run: | - apt-get update - apt-get install -y binutils ninja-build cmake gcc g++ python3 python3-dev - - - uses: actions/checkout@v4 - with: - path: 'Enzyme' - - - uses: actions/checkout@v4 - with: - repository: 'llvm/llvm-project' - ref: 'fc44a4fcd3c54be927c15ddd9211aca1501633e7' - path: 'llvm-project' - - - name: Set BASE_DIR - # We have to use `${GITHUB_WORKSPACE}` instead of `github.workspace` because GitHub - # is terrible and the two don't match inside containers: - # https://github.com/actions/runner/issues/2058 - run: | - BASE_DIR=${GITHUB_WORKSPACE} - # Make sure this directory exists, for good measure - ls -lhrt "${BASE_DIR}"/Enzyme - ls -lhrt "${BASE_DIR}"/llvm-project - echo "BASE_DIR=${BASE_DIR}" >> ${GITHUB_ENV} - - - name: Get MLIR commit hash - id: mlir-commit - working-directory: 'llvm-project' - run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - - name: Cache MLIR - id: cache-mlir - uses: actions/cache@v4 - with: - path: ${{ env.BASE_DIR }}/llvm-project/mlir-build - key: ${{ matrix.llbuild }}-${{ matrix.os }}-mlir-${{ steps.mlir-commit.outputs.sha_short }} - - - name: MLIR build - if: steps.cache-mlir.outputs.cache-hit != 'true' - working-directory: ${{ env.BASE_DIR }}/'llvm-project' - run: | - mkdir mlir-build && cd mlir-build && cmake ../llvm -GNinja -DLLVM_ENABLE_PROJECTS="llvm;clang;mlir" -DLLVM_ENABLE_RUNTIMES=openmp -DCMAKE_BUILD_TYPE=${{ matrix.llbuild }} \ - -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_TARGETS_TO_BUILD=X86 \ - -DLLVM_USE_LINKER=gold -DLLVM_PARALLEL_LINK_JOBS=2 \ - -DCLANG_ENABLE_STATIC_ANALYZER=OFF -DCLANG_ENABLE_ARCMT=OFF \ - -DLLVM_OPTIMIZED_TABLEGEN=ON && ninja || echo "already built" - - - name: Enzyme build - working-directory: ${{ env.BASE_DIR }}/'Enzyme' - run: | - mkdir enzyme-build && cd enzyme-build - cmake ../enzyme -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DLLVM_DIR=${{ env.BASE_DIR }}/llvm-project/mlir-build -DENZYME_MLIR=ON - ninja - - - name: Check enzyme-mlir - working-directory: 'Enzyme/enzyme-build' - run: ninja check-enzymemlir - diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml deleted file mode 100644 index 93468da2bdf6..000000000000 --- a/.github/workflows/format.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Clang-Format - -on: - push: - pull_request: - merge_group: - -jobs: - build: - name: Format - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - uses: DoozyX/clang-format-lint-action@v0.20 - with: - source: 'enzyme/Enzyme enzyme/tools/enzyme-tblgen' - exclude: './CMakeLists.txt enzyme/Enzyme/SCEV' - style: 'llvm' - clangFormatVersion: 16 diff --git a/.github/workflows/fortran.yml b/.github/workflows/fortran.yml deleted file mode 100644 index 94ef0d17451e..000000000000 --- a/.github/workflows/fortran.yml +++ /dev/null @@ -1,80 +0,0 @@ -name: Fortran - -on: - push: - branches: - - main - paths: - - '.github/workflows/fortran.yml' - - 'enzyme/Enzyme/**' - - 'enzyme/includes/**' - - 'enzyme/test/**' - - 'enzyme/tools/**' - - 'enzyme/benchmarks/**' - - 'enzyme/cmake/**' - - 'enzyme/CMakeLists.txt' - - 'enzyme/CMakePresets.json' - pull_request: - branches: - - main - paths: - - '.github/workflows/fortran.yml' - - 'enzyme/Enzyme/**' - - 'enzyme/includes/**' - - 'enzyme/test/**' - - 'enzyme/tools/**' - - 'enzyme/benchmarks/**' - - 'enzyme/cmake/**' - - 'enzyme/CMakeLists.txt' - - 'enzyme/CMakePresets.json' - merge_group: - -concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} - -jobs: - build-and-test-fortran: - name: Fortran ${{matrix.build}} ${{matrix.os}} - runs-on: ${{matrix.os}} - strategy: - fail-fast: false - matrix: - build: ["Release", "Debug"] - os: [ubuntu-22.04] - llvm: [15] - include: - - llvm: 15 - ifx: 2023.0.0 - mpi: 2021.7.1 - timeout-minutes: 60 - steps: - - name: add llvm - run: | - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - - sudo apt-add-repository "deb http://apt.llvm.org/`lsb_release -c | cut -f2`/ llvm-toolchain-`lsb_release -c | cut -f2`-${{ matrix.llvm }} main" - sudo apt-get update && sudo apt-get install -y cmake gcc g++ llvm-${{ matrix.llvm }}-dev ninja-build pip - sudo python3 -m pip install --upgrade pip lit - - name: add intel tools - run: | - wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB - sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB - rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB - sudo echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list - sudo apt-get update && sudo apt-get install -y intel-oneapi-compiler-fortran-${{ matrix.ifx }} intel-oneapi-mpi-${{ matrix.mpi }} intel-oneapi-mpi-devel-${{ matrix.mpi }} - source /opt/intel/oneapi/setvars.sh - printenv >> $GITHUB_ENV - - uses: actions/checkout@v4 - - name: generate build system - run: | - rm -rf build && mkdir build && cd build - cmake ../enzyme -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DLLVM_DIR=/usr/lib/llvm-${{ matrix.llvm }}/lib/cmake/llvm -DLLVM_EXTERNAL_LIT=`which lit` -DENZYME_IFX=ON - - name: build enzyme - working-directory: 'build' - run: ninja LLVMEnzyme-${{ matrix.llvm }} - - name: run Fortran tests - working-directory: 'build' - run: ninja check-enzyme-fortran - diff --git a/.github/workflows/tagger.yml b/.github/workflows/tagger.yml deleted file mode 100644 index 187f72e48f25..000000000000 --- a/.github/workflows/tagger.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Tag CI - -on: - release: - types: - - created - -jobs: - build: - name: Enzyme Tag CI - runs-on: ubuntu-latest - steps: - - uses: actions/create-github-app-token@v2 - id: generate_token - with: - app-id: ${{ secrets.APP_ID }} - private-key: ${{ secrets.APP_PRIVATE_KEY }} - owner: JuliaPackaging - repositories: | - Yggdrasil - - - uses: actions/checkout@v5 - with: - repository: 'JuliaPackaging/Yggdrasil' - path: ygg - - - uses: actions/checkout@v5 - with: - path: enz - - name: replace - run: | - cd ygg - git rm -rf E/Enzyme - mkdir -p E/Enzyme/ - cd E/Enzyme - cp ../../../enz/.packaging/build_tarballs.jl build_tarballs.jl - sed "s~%ENZYME_VERSION%~${GITHUB_REF}~g" build_tarballs.jl -i - sed "s~%ENZYME_HASH%~${GITHUB_SHA}~g" build_tarballs.jl -i - git add . - - name: Create Pull Request - id: cpr - uses: peter-evans/create-pull-request@v7 - with: - path: ygg - commit-message: "Upgrade enzyme to ${{ github.ref }}" - title: "Upgrade enzyme to ${{ github.ref }}" - token: ${{ steps.generate_token.outputs.token }} - reviewers: vchuravy - branch: enzyme/${{ github.ref }} - body: "Automatic PR generated for https://github.com/EnzymeAD/Enzyme " - - name: Check outputs - run: | - echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" - echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" From e21493085acb3faa7e089e3f4b24f349d55a49d2 Mon Sep 17 00:00:00 2001 From: I-Al-Istannen Date: Wed, 22 Oct 2025 14:26:35 +0200 Subject: [PATCH 03/12] Debug with SSH --- .github/workflows/enzyme-rust.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/enzyme-rust.yml b/.github/workflows/enzyme-rust.yml index 84170af02f19..c8953b4a40da 100644 --- a/.github/workflows/enzyme-rust.yml +++ b/.github/workflows/enzyme-rust.yml @@ -44,6 +44,8 @@ jobs: - name: Configure run: | ./configure --release-channel=nightly --enable-llvm-enzyme --enable-llvm-assertions --enable-option-checking --disable-docs --set llvm.download-ci-llvm=true + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 - name: Build run: | ./x build --stage 1 library From 86508be91c0259919958774c755c389b03d3ab57 Mon Sep 17 00:00:00 2001 From: I-Al-Istannen Date: Fri, 24 Oct 2025 19:38:58 +0200 Subject: [PATCH 04/12] Revert "Debug with SSH" This reverts commit e21493085acb3faa7e089e3f4b24f349d55a49d2. --- .github/workflows/enzyme-rust.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/enzyme-rust.yml b/.github/workflows/enzyme-rust.yml index c8953b4a40da..84170af02f19 100644 --- a/.github/workflows/enzyme-rust.yml +++ b/.github/workflows/enzyme-rust.yml @@ -44,8 +44,6 @@ jobs: - name: Configure run: | ./configure --release-channel=nightly --enable-llvm-enzyme --enable-llvm-assertions --enable-option-checking --disable-docs --set llvm.download-ci-llvm=true - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - name: Build run: | ./x build --stage 1 library From 646bc07b5c903942430710cd5fb1e812739af2d7 Mon Sep 17 00:00:00 2001 From: I-Al-Istannen Date: Fri, 24 Oct 2025 19:42:13 +0200 Subject: [PATCH 05/12] Use ccache --- .github/workflows/enzyme-rust.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/enzyme-rust.yml b/.github/workflows/enzyme-rust.yml index 84170af02f19..4547bdbd3128 100644 --- a/.github/workflows/enzyme-rust.yml +++ b/.github/workflows/enzyme-rust.yml @@ -43,7 +43,25 @@ jobs: git add src/tools/enzyme && git commit -m "Set Enzyme version" - name: Configure run: | - ./configure --release-channel=nightly --enable-llvm-enzyme --enable-llvm-assertions --enable-option-checking --disable-docs --set llvm.download-ci-llvm=true + ./configure --release-channel=nightly --enable-llvm-enzyme --enable-llvm-assertions --enable-option-checking --disable-docs --enable-ccache + - name: Cache ccache + id: cache-ccache + uses: actions/cache@v4 + with: + path: ~/.cache/ccache + key: ${{ runner.os }}-primes + - name: Setup ccache + run: | + sudo apt update && sudo apt install -y ccache + - name: Inspect ccache + run: | + ccache --show-config + ccache --show-stats + ccache --zero-stats - name: Build run: | ./x build --stage 1 library + - name: Inspect ccache + run: | + ccache --show-config + ccache --show-stats From c90f58afe1303b06dc6c18eaa7fdc121d8a2b248 Mon Sep 17 00:00:00 2001 From: I-Al-Istannen Date: Fri, 24 Oct 2025 19:52:19 +0200 Subject: [PATCH 06/12] Limit matrix --- .github/workflows/enzyme-rust.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/enzyme-rust.yml b/.github/workflows/enzyme-rust.yml index 4547bdbd3128..f34f890eeb69 100644 --- a/.github/workflows/enzyme-rust.yml +++ b/.github/workflows/enzyme-rust.yml @@ -18,9 +18,9 @@ jobs: matrix: os: - ubuntu-latest - - macOS-latest + #- macOS-latest rust-version: - - master + #- master - b2ee1b333aea9951c3eefa4967098cc763de59ca steps: - name: Clone rust From 38f6b7903ce25937b11adca5eaff0fb0dfcb393a Mon Sep 17 00:00:00 2001 From: I-Al-Istannen Date: Fri, 24 Oct 2025 21:39:13 +0200 Subject: [PATCH 07/12] Trigger CI and hopefully inherit the cache :^) From ad002c7e7148ae6df8862edb32d4287a8f14757d Mon Sep 17 00:00:00 2001 From: I-Al-Istannen Date: Fri, 24 Oct 2025 22:28:53 +0200 Subject: [PATCH 08/12] Document a bit, fix cache key --- .github/workflows/enzyme-rust.yml | 104 ++++++++++++++++++------------ 1 file changed, 62 insertions(+), 42 deletions(-) diff --git a/.github/workflows/enzyme-rust.yml b/.github/workflows/enzyme-rust.yml index f34f890eeb69..42ae0f0c038b 100644 --- a/.github/workflows/enzyme-rust.yml +++ b/.github/workflows/enzyme-rust.yml @@ -18,50 +18,70 @@ jobs: matrix: os: - ubuntu-latest - #- macOS-latest + - macOS-latest rust-version: #- master - b2ee1b333aea9951c3eefa4967098cc763de59ca steps: - - name: Clone rust - run: | - git clone --depth=1 https://github.com/rust-lang/rust . - - name: Adjust git settings - run: | - git config --global user.email "ci@example.org" - git config --global user.name "CI" - - name: Init enzyme submodule - run: | - git submodule update --init src/tools/enzyme - - name: Update enzyme submodule - run: | - pushd src/tools/enzyme || exit 1 - git fetch origin $GITHUB_SHA - git checkout $GITHUB_SHA - popd || exit 1 + - name: Clone rust + run: | + git clone --depth=1 https://github.com/rust-lang/rust . + - name: Adjust git settings + run: | + git config --global user.email "ci@example.org" + git config --global user.name "CI" - git add src/tools/enzyme && git commit -m "Set Enzyme version" - - name: Configure - run: | - ./configure --release-channel=nightly --enable-llvm-enzyme --enable-llvm-assertions --enable-option-checking --disable-docs --enable-ccache - - name: Cache ccache - id: cache-ccache - uses: actions/cache@v4 - with: - path: ~/.cache/ccache - key: ${{ runner.os }}-primes - - name: Setup ccache - run: | - sudo apt update && sudo apt install -y ccache - - name: Inspect ccache - run: | - ccache --show-config - ccache --show-stats - ccache --zero-stats - - name: Build - run: | - ./x build --stage 1 library - - name: Inspect ccache - run: | - ccache --show-config - ccache --show-stats + # Infra: Setup caching using ccache + - name: Install ccache + run: | + sudo apt update && sudo apt install -y ccache + - name: Get LLVM project commit SHA for use as cache key + id: llvm-commit + run: | + COMMIT_HASH="$(git ls-tree --object-only HEAD src/llvm-project)" + echo "LLVM should be on commit: '$COMMIT_HASH'" + echo "::set-output name=commit_hash::$COMMIT_HASH" + - name: Cache ccache + id: cache-ccache + uses: actions/cache@v4 + with: + path: ~/.cache/ccache + key: ${{ runner.os }}-ccache-${{ steps['llvm-commit'].outputs.commit_hash }} + # We fall back to *any* cache. It is ccache, it can handle invalidation + # and eviction on its own. TODO: We might want to limit its size / use + # evict-older-than? + restore-keys: | + ${{ runner.os }}-ccache-${{ steps['llvm-commit'].outputs.commit_hash }} + ${{ runner.os }}-ccache- + ${{ runner.os }}-primes + + # Now we get to the actual meat. Initialize enzyme at $GITHUB_SHA to ensure we + # actually test the right commit :) + - name: Init enzyme submodule + run: | + git submodule update --init src/tools/enzyme + - name: Update enzyme submodule + run: | + pushd src/tools/enzyme || exit 1 + git fetch origin $GITHUB_SHA + git checkout $GITHUB_SHA + popd || exit 1 + + git add src/tools/enzyme && git commit -m "Set Enzyme version" + + # And now we build! + - name: Configure + run: | + ./configure --release-channel=nightly --enable-llvm-enzyme --enable-llvm-assertions --enable-option-checking --disable-docs --enable-ccache + - name: Inspect ccache + run: | + ccache --show-config + ccache --show-stats + ccache --zero-stats # rebaseline + - name: Build + run: | + ./x build --stage 1 library + - name: Inspect ccache + run: | + ccache --show-config + ccache --show-stats From a574459090741cedaaeffe5d82455ff052131be0 Mon Sep 17 00:00:00 2001 From: I-Al-Istannen Date: Fri, 24 Oct 2025 22:33:41 +0200 Subject: [PATCH 09/12] Install ccache via brew on macos --- .github/workflows/enzyme-rust.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/enzyme-rust.yml b/.github/workflows/enzyme-rust.yml index 42ae0f0c038b..c5d731853873 100644 --- a/.github/workflows/enzyme-rust.yml +++ b/.github/workflows/enzyme-rust.yml @@ -32,9 +32,14 @@ jobs: git config --global user.name "CI" # Infra: Setup caching using ccache - - name: Install ccache + - name: Install ccache (Linux) + if: runner.os == 'Linux' run: | sudo apt update && sudo apt install -y ccache + - name: Install ccache (macOS) + if: runner.os == 'macOS' + run: | + brew install ccache - name: Get LLVM project commit SHA for use as cache key id: llvm-commit run: | From a0b2d301f995b05aef927deb72c07d17e1bf84be Mon Sep 17 00:00:00 2001 From: I-Al-Istannen Date: Fri, 24 Oct 2025 22:34:45 +0200 Subject: [PATCH 10/12] Use non-deprecated syntax for step outputs --- .github/workflows/enzyme-rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/enzyme-rust.yml b/.github/workflows/enzyme-rust.yml index c5d731853873..67febb7510f6 100644 --- a/.github/workflows/enzyme-rust.yml +++ b/.github/workflows/enzyme-rust.yml @@ -45,7 +45,7 @@ jobs: run: | COMMIT_HASH="$(git ls-tree --object-only HEAD src/llvm-project)" echo "LLVM should be on commit: '$COMMIT_HASH'" - echo "::set-output name=commit_hash::$COMMIT_HASH" + echo "commit_hash=$COMMIT_HASH" >> $GITHUB_OUTPUT - name: Cache ccache id: cache-ccache uses: actions/cache@v4 From 4d2e5995a3e4d4beaf5b57e3bd0f829bb262b5a7 Mon Sep 17 00:00:00 2001 From: I-Al-Istannen Date: Sat, 25 Oct 2025 00:04:48 +0200 Subject: [PATCH 11/12] Disable macos for now --- .github/workflows/enzyme-rust.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/enzyme-rust.yml b/.github/workflows/enzyme-rust.yml index 67febb7510f6..25ecf6d1b71e 100644 --- a/.github/workflows/enzyme-rust.yml +++ b/.github/workflows/enzyme-rust.yml @@ -18,9 +18,9 @@ jobs: matrix: os: - ubuntu-latest - - macOS-latest + #- macOS-latest # broken: https://github.com/rust-lang/enzyme/actions/runs/18791780110/job/53623553780?pr=30 rust-version: - #- master + - master - b2ee1b333aea9951c3eefa4967098cc763de59ca steps: - name: Clone rust @@ -58,7 +58,6 @@ jobs: restore-keys: | ${{ runner.os }}-ccache-${{ steps['llvm-commit'].outputs.commit_hash }} ${{ runner.os }}-ccache- - ${{ runner.os }}-primes # Now we get to the actual meat. Initialize enzyme at $GITHUB_SHA to ensure we # actually test the right commit :) From e46d4cdc1c91d623b0ca2b641b5121a91792b309 Mon Sep 17 00:00:00 2001 From: I-Al-Istannen Date: Sat, 25 Oct 2025 00:04:53 +0200 Subject: [PATCH 12/12] Revert "We do not test anything" This reverts commit af54c7d4efb2f2485f95cacb2e778c59d81355fc. --- .github/workflows/bcload.yml | 34 +++++++++ .github/workflows/benchmark.yml | 49 +++++++++++++ .github/workflows/ccpp.yml | 47 ++++++++++++ .github/workflows/doxygen.yml | 41 +++++++++++ .github/workflows/enzyme-bazel.yml | 78 ++++++++++++++++++++ .github/workflows/enzyme-ci.yml | 111 +++++++++++++++++++++++++++++ .github/workflows/enzyme-julia.yml | 57 +++++++++++++++ .github/workflows/enzyme-mlir.yml | 88 +++++++++++++++++++++++ .github/workflows/format.yml | 20 ++++++ .github/workflows/fortran.yml | 80 +++++++++++++++++++++ .github/workflows/tagger.yml | 54 ++++++++++++++ 11 files changed, 659 insertions(+) create mode 100644 .github/workflows/bcload.yml create mode 100644 .github/workflows/benchmark.yml create mode 100644 .github/workflows/ccpp.yml create mode 100644 .github/workflows/doxygen.yml create mode 100644 .github/workflows/enzyme-bazel.yml create mode 100644 .github/workflows/enzyme-ci.yml create mode 100644 .github/workflows/enzyme-julia.yml create mode 100644 .github/workflows/enzyme-mlir.yml create mode 100644 .github/workflows/format.yml create mode 100644 .github/workflows/fortran.yml create mode 100644 .github/workflows/tagger.yml diff --git a/.github/workflows/bcload.yml b/.github/workflows/bcload.yml new file mode 100644 index 000000000000..c278f0621b28 --- /dev/null +++ b/.github/workflows/bcload.yml @@ -0,0 +1,34 @@ +name: Bitcode loading CI + +on: [push] + +jobs: + build: + name: Bitcode loading CI LLVM ${{ matrix.llvm }} ${{ matrix.build }} ${{ matrix.os }} + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + # BCLoad tests only run with old pass manager [aka up to and including 13] + llvm: ["15"] + build: ["Release"] # "RelWithDebInfo" + os: [ubuntu-22.04] + + timeout-minutes: 30 + steps: + - name: add llvm + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - + sudo apt-add-repository "deb http://apt.llvm.org/`lsb_release -c | cut -f2`/ llvm-toolchain-`lsb_release -c | cut -f2`-${{ matrix.llvm }} main" || true + sudo apt-get install -y cmake gcc g++ llvm-${{ matrix.llvm }}-dev clang-${{ matrix.llvm }} libclang-${{ matrix.llvm }}-dev + sudo python3 -m pip install --upgrade pip lit + - uses: actions/checkout@v4 + - name: mkdir + run: cd enzyme && rm -rf build && mkdir build + - name: cmake + run: | + cd enzyme/build + cmake .. -DLLVM_EXTERNAL_LIT=`which lit` -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DLLVM_DIR=/usr/lib/llvm-${{ matrix.llvm }}/lib/cmake/llvm + - name: make check-bcpass + run: cd enzyme/build && make -j `nproc` check-bcpass diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 000000000000..1d875a6aace1 --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,49 @@ +name: Benchmarking + +on: + push: + branches: + - main + pull_request: + branches: + - main + merge_group: + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + build: + name: Benchmark Test on os ${{ matrix.os }} and llvm ${{ matrix.llvm }} mode ${{ matrix.build }} + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + llvm: ["16", "17", "18"] + build: ["Release"] #, "Debug" "RelWithDebInfo" + os: [] # [openstack22] + timeout-minutes: 120 + steps: + - name: add llvm + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - + sudo apt-add-repository "deb http://apt.llvm.org/`lsb_release -c | cut -f2`/ llvm-toolchain-`lsb_release -c | cut -f2`-${{ matrix.llvm }} main" || true + sudo apt-get install -y python3-pip autoconf cmake gcc g++ libtool gfortran libblas-dev llvm-${{ matrix.llvm }}-dev clang-${{ matrix.llvm }} libeigen3-dev libboost-dev libzstd-dev + sudo python3 -m pip install lit pathlib + sudo touch /usr/lib/llvm-${{ matrix.llvm }}/bin/yaml-bench + - uses: actions/checkout@v4 + - name: mkdir + run: rm -rf build && mkdir build + - name: cmake + working-directory: build + run: cmake ../enzyme -DLLVM_EXTERNAL_LIT=`which lit` -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DLLVM_DIR=/usr/lib/llvm-${{ matrix.llvm }}/lib/cmake/llvm + - name: make + working-directory: build + run: make -j `nproc` LLVMEnzyme-${{ matrix.llvm }} + - name: make bench-enzyme + working-directory: build + run: make bench-enzyme + - name: results + run: cat enzyme/benchmarks/*/*/results.txt diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml new file mode 100644 index 000000000000..212090991ab7 --- /dev/null +++ b/.github/workflows/ccpp.yml @@ -0,0 +1,47 @@ +name: C/C++ CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + merge_group: + +jobs: + build: + name: Integration CI LLVM ${{ matrix.llvm }} ${{ matrix.build }} ${{ matrix.os }} + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + llvm: ["15", "16", "17", "18", "19", "20", "21"] + build: ["Release"] # "RelWithDebInfo" + os: [ubuntu-22.04] + + timeout-minutes: 45 + + steps: + - name: add llvm + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - + sudo apt-get install -y libmpfr-dev + sudo apt-add-repository "deb http://apt.llvm.org/`lsb_release -c | cut -f2`/ llvm-toolchain-`lsb_release -c | cut -f2`-${{ matrix.llvm }} main" || true + sudo apt-get install -y cmake gcc g++ llvm-${{ matrix.llvm }}-dev libomp-${{ matrix.llvm }}-dev lld-${{ matrix.llvm }} clang-${{ matrix.llvm }} libclang-${{ matrix.llvm }}-dev libeigen3-dev libboost-dev libzstd-dev + sudo python3 -m pip install --upgrade pip lit + - uses: actions/checkout@v4 + - name: mkdir + run: rm -rf build && mkdir build + - name: cmake + working-directory: build + run: cmake ../enzyme -DLLVM_EXTERNAL_LIT=`which lit` -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DLLVM_DIR=/usr/lib/llvm-${{ matrix.llvm }}/lib/cmake/llvm + - name: make + run: cd build && make -j `nproc` LLVMEnzyme-${{ matrix.llvm }} ClangEnzyme-${{ matrix.llvm }} LLDEnzyme-${{ matrix.llvm }} + - name: make test-cmake + working-directory: build + run: make -j `nproc` test-cmake + - name: make check-enzyme-integration + working-directory: build + run: make -j `nproc` check-enzyme-integration diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml new file mode 100644 index 000000000000..722fbe6b14a4 --- /dev/null +++ b/.github/workflows/doxygen.yml @@ -0,0 +1,41 @@ +name: Build and deploy Doxygen to Scripts + +on: + push: + branches: + - main + +jobs: + build-docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: mattnotmitt/doxygen-action@v1.12.0 + with: + working-directory: 'enzyme/' + doxyfile-path: 'doxygen.cfg' + + - name: Upload static files as artifact + id: deployment + uses: actions/upload-pages-artifact@v3 # or specific "vX.X.X" version tag for this action + with: + path: enzyme/doxygen/html + + deploy-docs: + # Grant GITHUB_TOKEN the permissions required to make a Pages deployment + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + + # Deploy to the github-pages environment + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + needs: build-docs + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action diff --git a/.github/workflows/enzyme-bazel.yml b/.github/workflows/enzyme-bazel.yml new file mode 100644 index 000000000000..d41fdedb7f59 --- /dev/null +++ b/.github/workflows/enzyme-bazel.yml @@ -0,0 +1,78 @@ +name: Bazel + +on: + schedule: + - cron: 0 0 * * * + push: + branches: + - main + paths: + - '.github/workflows/enzyme-bazel.yml' + - 'enzyme/Enzyme/**' + - 'enzyme/includes/**' + - 'enzyme/test/**' + - 'enzyme/tools/**' + - 'enzyme/BUILD' + - 'enzyme/WORKSPACE' + pull_request: + branches: + - main + paths: + - '.github/workflows/enzyme-bazel.yml' + - 'enzyme/Enzyme/**' + - 'enzyme/includes/**' + - 'enzyme/test/**' + - 'enzyme/tools/**' + - 'enzyme/BUILD' + - 'enzyme/WORKSPACE' + merge_group: + +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + +jobs: + build: + name: Enzyme Bazel Build - ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + - linux-x86-n2-32 + build: + - Release + llbuild: + - Release + timeout-minutes: 500 + + container: + image: ${{ (contains(matrix.os, 'linux') && 'ghcr.io/enzymead/reactant-docker-images@sha256:91e1edb7a7c869d5a70db06e417f22907be0e67ca86641d48adcea221fedc674' ) || '' }} + + steps: + - name: Install Python dependencies + run: python -m pip install lit + - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + with: + repository: 'llvm/llvm-project' + path: 'llvm-project' + - uses: bazel-contrib/setup-bazel@0.14.0 + name: Set up Bazel + with: + # Avoid downloading Bazel every time. + bazelisk-cache: true + # Store build cache per workflow. + disk-cache: ${{ github.workflow }}-${{ matrix.os }}-${{ matrix.build }}-${{ matrix.llbuild }} + # Share repository cache between workflows. + repository-cache: true + bazelisk-version: 1.x + - name: Build Enzyme + run: | + cd enzyme + bazel build --color=yes :EnzymeStatic :enzymemlir-opt + - name: Test Enzyme + run: | + cd enzyme + bazel test --color=yes --test_output=errors ... diff --git a/.github/workflows/enzyme-ci.yml b/.github/workflows/enzyme-ci.yml new file mode 100644 index 000000000000..56c84bf8c2f7 --- /dev/null +++ b/.github/workflows/enzyme-ci.yml @@ -0,0 +1,111 @@ +name: Enzyme CI + +on: + push: + branches: + - main + pull_request: + merge_group: + +jobs: + build-linux: + name: Enzyme CI LLVM ${{ matrix.llvm }} ${{ matrix.build }} ${{ matrix.os }} + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + llvm: ["15", "16"] + build: ["Release", "Debug"] # "RelWithDebInfo" + os: [ubuntu-22.04] + + timeout-minutes: 30 + + steps: + - name: add llvm + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - + sudo apt-add-repository "deb http://apt.llvm.org/`lsb_release -c | cut -f2`/ llvm-toolchain-`lsb_release -c | cut -f2`-${{ matrix.llvm }} main" || true + sudo apt-get install -y cmake gcc g++ llvm-${{ matrix.llvm }}-dev libzstd-dev + sudo python3 -m pip install --upgrade pip lit + - uses: actions/checkout@v4 + - name: mkdir + run: rm -rf build && mkdir build + - name: cmake + working-directory: build + run: cmake ../enzyme -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DLLVM_EXTERNAL_LIT=`which lit` -DLLVM_DIR=/usr/lib/llvm-${{ matrix.llvm }}/lib/cmake/llvm + - name: make + working-directory: build + run: make -j `nproc` + - name: make check-typeanalysis + working-directory: build + run: make -j `nproc` check-typeanalysis + - name: make check-activityanalysis + working-directory: build + run: make -j `nproc` check-activityanalysis + - name: make check-enzyme + working-directory: build + run: make -j `nproc` check-enzyme-bench + + build-macos: + name: Enzyme CI LLVM ${{ matrix.llvm }} ${{ matrix.build }} macOS + runs-on: macos-latest + + strategy: + fail-fast: false + matrix: + llvm: ["15", "16"] + build: ["Release", "Debug"] # "RelWithDebInfo" + + timeout-minutes: 30 + steps: + - name: add llvm + run: | + brew update + brew uninstall cmake + brew install llvm@${{ matrix.llvm }} make cmake + sudo python3 -m pip install --upgrade --break-system-packages --user pip lit requests + - uses: actions/checkout@v4 + - name: mkdir + run: rm -rf build && mkdir build + - name: cmake + working-directory: build + run: cmake ../enzyme -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DLLVM_EXTERNAL_LIT=`find /Users/runner/Library/Python/ -iname lit` -DLLVM_DIR=`brew --prefix llvm@${{ matrix.llvm }}`/lib/cmake/llvm + - name: make + working-directory: build + run: make -j 3 + - name: make check-typeanalysis + working-directory: build + run: make -j 3 check-typeanalysis + - name: make check-activityanalysis + working-directory: build + run: make -j 3 check-activityanalysis + - name: make check-enzyme + working-directory: build + run: make -j3 check-enzyme-bench + + build-xcode: + name: Enzyme CI LLVM ${{ matrix.llvm }} ${{ matrix.build }} macOS XCode + runs-on: macos-latest + + strategy: + fail-fast: false + matrix: + llvm: ["16"] + build: ["Release"] # "RelWithDebInfo" + + timeout-minutes: 30 + steps: + - name: add llvm + run: | + brew uninstall cmake + brew install llvm@${{ matrix.llvm }} make cmake gcc + sudo python3 -m pip install --upgrade --break-system-packages --user pip lit + - uses: actions/checkout@v4 + - name: mkdir + run: rm -rf build && mkdir build + - name: cmake + working-directory: build + run: | + cmake ../enzyme -GXcode -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DLLVM_EXTERNAL_LIT=`which lit` -DLLVM_DIR=`brew --prefix llvm@${{ matrix.llvm }}`/lib/cmake/llvm + cmake --build . --parallel 3 diff --git a/.github/workflows/enzyme-julia.yml b/.github/workflows/enzyme-julia.yml new file mode 100644 index 000000000000..6ae9f3d0ff5a --- /dev/null +++ b/.github/workflows/enzyme-julia.yml @@ -0,0 +1,57 @@ +name: Julia Enzyme CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + merge_group: + +jobs: + build: + name: Enzyme CI Julia ${{ matrix.version }} ${{ matrix.os }} + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.version == 'nightly' }} + strategy: + fail-fast: false + matrix: + version: + - '1.10' + os: + - ubuntu-latest + - macOS-latest + arch: + - x64 + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + with: + repository: 'EnzymeAD/Enzyme.jl' + path: ./jl + ref: main + - uses: julia-actions/setup-julia@v1 + with: + version: ${{ matrix.version }} + arch: ${{ matrix.arch }} + + - name: Build libEnzyme + if: ${{ matrix.os != 'macOS-latest'}} + run: | + julia --project=jl/deps -e 'using Pkg; Pkg.instantiate()' + julia --project=jl/deps jl/deps/build_local.jl ./enzyme + - name: Build libEnzyme MacOS + if: ${{ matrix.os == 'macOS-latest'}} + run: | + julia --project=jl/deps -e 'using Pkg; Pkg.instantiate()' + SDKROOT=`xcrun --show-sdk-path` julia --project=jl/deps jl/deps/build_local.jl ./enzyme + - name: Dev EnzymeCore + run: julia --project=jl -e 'using Pkg; Pkg.develop(path="jl/lib/EnzymeCore")' + - uses: julia-actions/julia-buildpkg@v1 + with: + project: jl + - uses: julia-actions/julia-runtest@v1 + with: + project: jl diff --git a/.github/workflows/enzyme-mlir.yml b/.github/workflows/enzyme-mlir.yml new file mode 100644 index 000000000000..db3d96e4fd24 --- /dev/null +++ b/.github/workflows/enzyme-mlir.yml @@ -0,0 +1,88 @@ +name: MLIR + +on: + push: + branches: + - main + pull_request: + branches: + - main + merge_group: + +jobs: + build-linux: + name: MLIR ${{ matrix.build }} ${{ matrix.os }} + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + build: ["Release", "Debug"] # "RelWithDebInfo" + llbuild: ["Release"] + os: [linux-x86-n2-32] + + timeout-minutes: 500 + + container: + image: ${{ (contains(matrix.os, 'linux') && 'ghcr.io/enzymead/reactant-docker-images@sha256:91e1edb7a7c869d5a70db06e417f22907be0e67ca86641d48adcea221fedc674' ) || '' }} + + steps: + - name: Install dependencies + run: | + apt-get update + apt-get install -y binutils ninja-build cmake gcc g++ python3 python3-dev + + - uses: actions/checkout@v4 + with: + path: 'Enzyme' + + - uses: actions/checkout@v4 + with: + repository: 'llvm/llvm-project' + ref: 'fc44a4fcd3c54be927c15ddd9211aca1501633e7' + path: 'llvm-project' + + - name: Set BASE_DIR + # We have to use `${GITHUB_WORKSPACE}` instead of `github.workspace` because GitHub + # is terrible and the two don't match inside containers: + # https://github.com/actions/runner/issues/2058 + run: | + BASE_DIR=${GITHUB_WORKSPACE} + # Make sure this directory exists, for good measure + ls -lhrt "${BASE_DIR}"/Enzyme + ls -lhrt "${BASE_DIR}"/llvm-project + echo "BASE_DIR=${BASE_DIR}" >> ${GITHUB_ENV} + + - name: Get MLIR commit hash + id: mlir-commit + working-directory: 'llvm-project' + run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + + - name: Cache MLIR + id: cache-mlir + uses: actions/cache@v4 + with: + path: ${{ env.BASE_DIR }}/llvm-project/mlir-build + key: ${{ matrix.llbuild }}-${{ matrix.os }}-mlir-${{ steps.mlir-commit.outputs.sha_short }} + + - name: MLIR build + if: steps.cache-mlir.outputs.cache-hit != 'true' + working-directory: ${{ env.BASE_DIR }}/'llvm-project' + run: | + mkdir mlir-build && cd mlir-build && cmake ../llvm -GNinja -DLLVM_ENABLE_PROJECTS="llvm;clang;mlir" -DLLVM_ENABLE_RUNTIMES=openmp -DCMAKE_BUILD_TYPE=${{ matrix.llbuild }} \ + -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_TARGETS_TO_BUILD=X86 \ + -DLLVM_USE_LINKER=gold -DLLVM_PARALLEL_LINK_JOBS=2 \ + -DCLANG_ENABLE_STATIC_ANALYZER=OFF -DCLANG_ENABLE_ARCMT=OFF \ + -DLLVM_OPTIMIZED_TABLEGEN=ON && ninja || echo "already built" + + - name: Enzyme build + working-directory: ${{ env.BASE_DIR }}/'Enzyme' + run: | + mkdir enzyme-build && cd enzyme-build + cmake ../enzyme -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DLLVM_DIR=${{ env.BASE_DIR }}/llvm-project/mlir-build -DENZYME_MLIR=ON + ninja + + - name: Check enzyme-mlir + working-directory: 'Enzyme/enzyme-build' + run: ninja check-enzymemlir + diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 000000000000..93468da2bdf6 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,20 @@ +name: Clang-Format + +on: + push: + pull_request: + merge_group: + +jobs: + build: + name: Format + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: DoozyX/clang-format-lint-action@v0.20 + with: + source: 'enzyme/Enzyme enzyme/tools/enzyme-tblgen' + exclude: './CMakeLists.txt enzyme/Enzyme/SCEV' + style: 'llvm' + clangFormatVersion: 16 diff --git a/.github/workflows/fortran.yml b/.github/workflows/fortran.yml new file mode 100644 index 000000000000..94ef0d17451e --- /dev/null +++ b/.github/workflows/fortran.yml @@ -0,0 +1,80 @@ +name: Fortran + +on: + push: + branches: + - main + paths: + - '.github/workflows/fortran.yml' + - 'enzyme/Enzyme/**' + - 'enzyme/includes/**' + - 'enzyme/test/**' + - 'enzyme/tools/**' + - 'enzyme/benchmarks/**' + - 'enzyme/cmake/**' + - 'enzyme/CMakeLists.txt' + - 'enzyme/CMakePresets.json' + pull_request: + branches: + - main + paths: + - '.github/workflows/fortran.yml' + - 'enzyme/Enzyme/**' + - 'enzyme/includes/**' + - 'enzyme/test/**' + - 'enzyme/tools/**' + - 'enzyme/benchmarks/**' + - 'enzyme/cmake/**' + - 'enzyme/CMakeLists.txt' + - 'enzyme/CMakePresets.json' + merge_group: + +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + +jobs: + build-and-test-fortran: + name: Fortran ${{matrix.build}} ${{matrix.os}} + runs-on: ${{matrix.os}} + strategy: + fail-fast: false + matrix: + build: ["Release", "Debug"] + os: [ubuntu-22.04] + llvm: [15] + include: + - llvm: 15 + ifx: 2023.0.0 + mpi: 2021.7.1 + timeout-minutes: 60 + steps: + - name: add llvm + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - + sudo apt-add-repository "deb http://apt.llvm.org/`lsb_release -c | cut -f2`/ llvm-toolchain-`lsb_release -c | cut -f2`-${{ matrix.llvm }} main" + sudo apt-get update && sudo apt-get install -y cmake gcc g++ llvm-${{ matrix.llvm }}-dev ninja-build pip + sudo python3 -m pip install --upgrade pip lit + - name: add intel tools + run: | + wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB + sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB + rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB + sudo echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list + sudo apt-get update && sudo apt-get install -y intel-oneapi-compiler-fortran-${{ matrix.ifx }} intel-oneapi-mpi-${{ matrix.mpi }} intel-oneapi-mpi-devel-${{ matrix.mpi }} + source /opt/intel/oneapi/setvars.sh + printenv >> $GITHUB_ENV + - uses: actions/checkout@v4 + - name: generate build system + run: | + rm -rf build && mkdir build && cd build + cmake ../enzyme -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DLLVM_DIR=/usr/lib/llvm-${{ matrix.llvm }}/lib/cmake/llvm -DLLVM_EXTERNAL_LIT=`which lit` -DENZYME_IFX=ON + - name: build enzyme + working-directory: 'build' + run: ninja LLVMEnzyme-${{ matrix.llvm }} + - name: run Fortran tests + working-directory: 'build' + run: ninja check-enzyme-fortran + diff --git a/.github/workflows/tagger.yml b/.github/workflows/tagger.yml new file mode 100644 index 000000000000..187f72e48f25 --- /dev/null +++ b/.github/workflows/tagger.yml @@ -0,0 +1,54 @@ +name: Tag CI + +on: + release: + types: + - created + +jobs: + build: + name: Enzyme Tag CI + runs-on: ubuntu-latest + steps: + - uses: actions/create-github-app-token@v2 + id: generate_token + with: + app-id: ${{ secrets.APP_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} + owner: JuliaPackaging + repositories: | + Yggdrasil + + - uses: actions/checkout@v5 + with: + repository: 'JuliaPackaging/Yggdrasil' + path: ygg + + - uses: actions/checkout@v5 + with: + path: enz + - name: replace + run: | + cd ygg + git rm -rf E/Enzyme + mkdir -p E/Enzyme/ + cd E/Enzyme + cp ../../../enz/.packaging/build_tarballs.jl build_tarballs.jl + sed "s~%ENZYME_VERSION%~${GITHUB_REF}~g" build_tarballs.jl -i + sed "s~%ENZYME_HASH%~${GITHUB_SHA}~g" build_tarballs.jl -i + git add . + - name: Create Pull Request + id: cpr + uses: peter-evans/create-pull-request@v7 + with: + path: ygg + commit-message: "Upgrade enzyme to ${{ github.ref }}" + title: "Upgrade enzyme to ${{ github.ref }}" + token: ${{ steps.generate_token.outputs.token }} + reviewers: vchuravy + branch: enzyme/${{ github.ref }} + body: "Automatic PR generated for https://github.com/EnzymeAD/Enzyme " + - name: Check outputs + run: | + echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"