Skip to content

Commit

Permalink
Merge branch 'main' into origin/ftynse/move
Browse files Browse the repository at this point in the history
  • Loading branch information
pengmai authored Feb 27, 2024
2 parents e1f9a94 + 8d75756 commit e4f58c2
Show file tree
Hide file tree
Showing 312 changed files with 14,199 additions and 4,800 deletions.
8 changes: 5 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// available ubuntu versions: [20, 22]
// available llvm versions: [9, 10, 11, 12, 13, 14, 15]
// available llvm versions: [11, 12, 13, 14, 15, 16, 17, 18]
{
"name": "Enzyme",
"image": "ghcr.io/enzymead/enzyme-dev-docker/ubuntu-20-llvm-12:latest",
"image": "ghcr.io/enzymead/enzyme-dev-docker/ubuntu-22-llvm-16:latest",
"mounts": [
"source=enzyme-bashhistory,target=/commandhistory,type=volume",
"source=enzyme-extensions,target=/home/vscode/.vscode-server/extensions,type=volume",
Expand All @@ -14,7 +14,9 @@
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools-extension-pack"
"llvm-vs-code-extensions.vscode-clangd",
"BazelBuild.vscode-bazel",
"twxs.cmake"
]
}
}
Expand Down
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
2 changes: 1 addition & 1 deletion .github/workflows/bcload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
sudo sed -i 's/add_executable(llvm-omp-device-info IMPORTED)//g' /usr/lib/llvm-${{matrix.llvm}}/lib/cmake/llvm/LLVMExports*.cmake
sudo sed -i 's/llvm-omp-device-info//g' /usr/lib/llvm-${{matrix.llvm}}/lib/cmake/llvm/LLVMExports*.cmake
fi
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: mkdir
run: cd enzyme && rm -rf build && mkdir build
- name: cmake
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
llvm: ["11", "12", "13", "14", "15", "16"]
llvm: ["13", "14", "15", "16"]
build: ["Release", "Debug"] # "RelWithDebInfo"
os: [openstack18]
timeout-minutes: 120
Expand All @@ -30,14 +30,14 @@ jobs:
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 python-pip autoconf cmake gcc g++ libtool gfortran libblas-dev llvm-${{ matrix.llvm }}-dev clang-${{ matrix.llvm }} libeigen3-dev libboost-dev
sudo pip install lit pathlib
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
sudo python3 -m pip install lit pathlib
sudo touch /usr/lib/llvm-${{ matrix.llvm }}/bin/yaml-bench
if [[ '${{ matrix.llvm }}' == '13' ]]; then
sudo sed -i 's/add_executable(llvm-omp-device-info IMPORTED)//g' /usr/lib/llvm-${{matrix.llvm}}/lib/cmake/llvm/LLVMExports*.cmake
sudo sed -i 's/llvm-omp-device-info//g' /usr/lib/llvm-${{matrix.llvm}}/lib/cmake/llvm/LLVMExports*.cmake
fi
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: mkdir
run: rm -rf build && mkdir build
- name: cmake
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
sudo sed -i 's/add_executable(llvm-omp-device-info IMPORTED)//g' /usr/lib/llvm-${{matrix.llvm}}/lib/cmake/llvm/LLVMExports*.cmake
sudo sed -i 's/llvm-omp-device-info//g' /usr/lib/llvm-${{matrix.llvm}}/lib/cmake/llvm/LLVMExports*.cmake
fi
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: mkdir
run: rm -rf build && mkdir build
- name: cmake
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/doxygen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
docs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: mattnotmitt/doxygen-action@v1.9.2
- uses: mattnotmitt/doxygen-action@v1.9.8
with:
working-directory: 'enzyme/'
doxyfile-path: 'doxygen.cfg'
Expand Down
33 changes: 16 additions & 17 deletions .github/workflows/enzyme-bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
- main
merge_group:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build-linux:
name: Bazel ${{ matrix.build }} ${{ matrix.os }}
Expand All @@ -21,31 +25,26 @@ jobs:
matrix:
build: ["Release"]
llbuild: ["Release"]
os: [openstack22]
os: [ubuntu-latest]

timeout-minutes: 500
steps:
- name: add llvm

- name: Prep
run: |
sudo rm -f /etc/apt/sources.list.d/*llvm*.list
sudo apt-get update
sudo apt-get install -y ninja-build git autoconf cmake gcc g++ libtool python3 python3-dev
- uses: actions/checkout@v3
- uses: actions/checkout@v3
python -m pip install lit
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: 'llvm/llvm-project'
path: 'llvm-project'
submodules: true


- name: Install bazelisk
- name: Build
run: |
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.1.0/bazelisk-linux-amd64"
mkdir -p "${GITHUB_WORKSPACE}/bin/"
mv bazelisk-linux-amd64 "${GITHUB_WORKSPACE}/bin/bazel"
chmod +x "${GITHUB_WORKSPACE}/bin/bazel"
- name: cmake
cd enzyme
bazel build :EnzymeStatic :enzymemlir-opt
- name: Test
run: |
cd enzyme
"${GITHUB_WORKSPACE}/bin/bazel" build :EnzymeStatic
bazel test --test_output=errors ...
8 changes: 4 additions & 4 deletions .github/workflows/enzyme-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
sudo sed -i 's/add_executable(llvm-omp-device-info IMPORTED)//g' /usr/lib/llvm-${{matrix.llvm}}/lib/cmake/llvm/LLVMExports*.cmake
sudo sed -i 's/llvm-omp-device-info//g' /usr/lib/llvm-${{matrix.llvm}}/lib/cmake/llvm/LLVMExports*.cmake
fi
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: mkdir
run: rm -rf build && mkdir build
- name: cmake
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
strategy:
fail-fast: false
matrix:
llvm: ["11", "12", "13", "14", "15"]
llvm: ["12", "13", "14", "15", "16"]
build: ["Release", "Debug"] # "RelWithDebInfo"

timeout-minutes: 30
Expand All @@ -71,7 +71,7 @@ jobs:
brew update
brew install llvm@${{ matrix.llvm }} make cmake
sudo python3 -m pip install --upgrade pip lit requests
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: mkdir
run: rm -rf build && mkdir build
- name: cmake
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
run: |
brew install llvm@${{ matrix.llvm }} make cmake gcc
sudo python3 -m pip install --upgrade pip lit
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: mkdir
run: rm -rf build && mkdir build
- name: cmake
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/enzyme-julia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
- x64
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: 'wsmoses/Enzyme.jl'
path: ./jl
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/enzyme-mlir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ jobs:
sudo apt-get update
sudo apt-get install -y binutils ninja-build cmake gcc g++ python3 python3-dev
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: 'Enzyme'

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: 'llvm/llvm-project'
ref: '5ed11e767c0c39a3bc8e035588e7a383849d46a8'
ref: '2c9b6c1b36b8185299de083c3058e0c1e7760442'
path: 'llvm-project'

- name: Get MLIR commit hash
Expand All @@ -46,7 +46,7 @@ jobs:

- name: Cache MLIR
id: cache-mlir
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: llvm-project/mlir-build
key: ${{ matrix.llbuild }}-${{ matrix.os }}-mlir-${{ steps.mlir-commit.outputs.sha_short }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: DoozyX/clang-format-lint-action@v0.16.2
with:
source: 'enzyme/Enzyme enzyme/tools/enzyme-tblgen'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fortran.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
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@v3
- uses: actions/checkout@v4
- name: generate build system
run: |
rm -rf build && mkdir build && cd build
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/tagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ jobs:
name: Enzyme Tag CI
runs-on: ubuntu-latest
steps:
- uses: tibdex/github-app-token@v1
- uses: actions/create-github-app-token@v1
id: generate_token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
repository: JuliaPackaging/Yggdrasil
repositories: JuliaPackaging/Yggdrasil

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: 'JuliaPackaging/Yggdrasil'
path: ygg

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: enz
- name: replace
Expand All @@ -37,7 +37,7 @@ jobs:
git add .
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v6
with:
path: ygg
commit-message: "Upgrade enzyme to ${{ github.ref }}"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ enzyme/benchmarks/ReverseMode/*/*.o
enzyme/benchmarks/ReverseMode/*/*.exe
enzyme/benchmarks/ReverseMode/*/results.txt
enzyme/benchmarks/ReverseMode/*/results.json
.cache
25 changes: 19 additions & 6 deletions .packaging/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ platforms = expand_cxxstring_abis(supported_platforms(; experimental=true))
script = raw"""
cd Enzyme
if [[ "${bb_full_target}" == x86_64-apple-darwin*llvm_version+15.asserts* ]]; then
if [[ "${bb_full_target}" == x86_64-apple-darwin*llvm_version+15* ]] || [[ "${bb_full_target}" == x86_64-apple-darwin*llvm_version+16* ]]; then
# LLVM 15 requires macOS SDK 10.14.
pushd $WORKSPACE/srcdir/MacOSX10.*.sdk
rm -rf /opt/${target}/${target}/sys-root/System
Expand All @@ -54,30 +54,42 @@ cmake -B build-native -S enzyme -GNinja "${NATIVE_CMAKE_FLAGS[@]}"
# Only build blasheaders and tblgen
ninja -C build-native -j ${nproc} blasheaders enzyme-tblgen
# 2. Cross-compile
CMAKE_FLAGS=()
CMAKE_FLAGS+=(-DENZYME_EXTERNAL_SHARED_LIB=ON)
CMAKE_FLAGS+=(-DBC_LOAD_HEADER=`pwd`/build-native/BCLoad/gsl/blas_headers.h)
CMAKE_FLAGS+=(-DEnzyme_TABLEGEN=`pwd`/build-native/tools/enzyme-tblgen/enzyme-tblgen)
CMAKE_FLAGS+=(-DEnzyme_TABLEGEN_EXE=`pwd`/build-native/tools/enzyme-tblgen/enzyme-tblgen)
CMAKE_FLAGS+=(-DENZYME_CLANG=OFF)
# RelWithDebInfo for decent performance, with debugability
CMAKE_FLAGS+=(-DCMAKE_BUILD_TYPE=RelWithDebInfo)
# Install things into $prefix
CMAKE_FLAGS+=(-DCMAKE_INSTALL_PREFIX=${prefix})
# Explicitly use our cmake toolchain file and tell CMake we're cross-compiling
CMAKE_FLAGS+=(-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN})
if [[ "${target}" == *mingw* && "${bb_full_target}" == *llvm_version+16* ]]; then
CMAKE_FLAGS+=(-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN%.*}_clang.cmake)
else
CMAKE_FLAGS+=(-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN})
fi
CMAKE_FLAGS+=(-DCMAKE_CROSSCOMPILING:BOOL=ON)
# Tell CMake where LLVM is
CMAKE_FLAGS+=(-DLLVM_DIR="${prefix}/lib/cmake/llvm")
# Force linking against shared lib
CMAKE_FLAGS+=(-DLLVM_LINK_LLVM_DYLIB=ON)
# Build the library
CMAKE_FLAGS+=(-DBUILD_SHARED_LIBS=ON)
if [[ "${bb_full_target}" == x86_64-apple-darwin*llvm_version+15* ]] || [[ "${bb_full_target}" == x86_64-apple-darwin*llvm_version+16* ]]; then
if [[ "${target}" == x86_64-apple* ]]; then
CMAKE_FLAGS+=(-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.14)
fi
else
if [[ "${target}" == x86_64-apple* ]]; then
CMAKE_FLAGS+=(-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.12)
fi
fi
echo ${CMAKE_FLAGS[@]}
cmake -B build -S enzyme -GNinja ${CMAKE_FLAGS[@]}
ninja -C build -j ${nproc} install
Expand Down Expand Up @@ -113,15 +125,16 @@ for llvm_version in llvm_versions, llvm_assertions in (false, true)
# We don't build LLVM 15 for i686-linux-musl.
filter!(p -> !(arch(p) == "i686" && libc(p) == "musl"), platforms)
end

for platform in platforms
augmented_platform = deepcopy(platform)
augmented_platform[LLVM.platform_name] = LLVM.platform(llvm_version, llvm_assertions)

gcc_version = llvm_version > v"15" ? v"10" : v"8"
should_build_platform(triplet(augmented_platform)) || continue
push!(builds, (;
dependencies, products,
platforms=[augmented_platform],
gcc_version,
))
end
end
Expand All @@ -137,6 +150,6 @@ for (i,build) in enumerate(builds)
build_tarballs(i == lastindex(builds) ? non_platform_ARGS : non_reg_ARGS,
name, version, sources, script,
build.platforms, build.products, build.dependencies;
preferred_gcc_version=v"8", julia_compat="1.6",
preferred_gcc_version=build.gcc_version, julia_compat="1.6",
augment_platform_block, lazy_artifacts=true) # drop when julia_compat >= 1.7
end
Loading

0 comments on commit e4f58c2

Please sign in to comment.