Skip to content

Commit

Permalink
Update our version of enzyme from 0.0.36 to 0.0.95. (#674)
Browse files Browse the repository at this point in the history
Remove the patch we had on top and limit the versions where the enzyme backend
is supported. Enzyme does not work on llvm older than 9 and newer than 12.
  • Loading branch information
vgvassilev authored Dec 8, 2023
1 parent ed3e7d6 commit 20e4b9c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 86 deletions.
78 changes: 0 additions & 78 deletions patches/enzyme.patch

This file was deleted.

20 changes: 12 additions & 8 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ if (NOT CLAD_BUILD_STATIC_ONLY)
# Add Enzyme as a backend.
if (ENABLE_ENZYME_BACKEND)

if (LLVM_VERSION_MAJOR VERSION_LESS 9 OR LLVM_VERSION_MAJOR VERSION_GREATER 12)
message(FATAL_ERROR "The enzyme backend is supported only in LLVM versions 9 to 12")
endif()

if (NOT UNIX)
message(FATAL_ERROR "The enzyme backend is only supported on Unix platforms")
endif()
Expand All @@ -40,17 +44,18 @@ if (NOT CLAD_BUILD_STATIC_ONLY)
)

# Set build byproducts only needed by Ninja.
set(_enzyme_static_archive_name ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}${CMAKE_STATIC_LIBRARY_PREFIX}LLVMEnzyme-${CLANG_VERSION_MAJOR}${CMAKE_STATIC_LIBRARY_SUFFIX})
set(_enzyme_static_target EnzymeStatic-${CLANG_VERSION_MAJOR})
set(_enzyme_static_archive_name ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}${CMAKE_STATIC_LIBRARY_PREFIX}${_enzyme_static_target}${CMAKE_STATIC_LIBRARY_SUFFIX})
if("${CMAKE_GENERATOR}" STREQUAL "Ninja")
set(ENZYME_BYPRODUCTS ${_enzyme_static_archive_name})
endif()

ExternalProject_Add(
Enzyme
GIT_REPOSITORY https://github.com/wsmoses/Enzyme
GIT_TAG v0.0.36
GIT_TAG v0.0.95
GIT_SHALLOW 1 # Do not clone the history
PATCH_COMMAND ${_enzyme_patch_command}
PATCH_COMMAND #${_enzyme_patch_command}
UPDATE_COMMAND ""
CMAKE_ARGS -G ${CMAKE_GENERATOR}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
Expand All @@ -61,14 +66,13 @@ if (NOT CLAD_BUILD_STATIC_ONLY)
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}
-DLLVM_DIR=${LLVM_DIR}
-DENZYME_CLANG=OFF
-DENZYME_BUILD_STATIC_ONLY=On
-DENZYME_ENABLE_BENCHMARKS=Off
-DENZYME_STATIC_LIB=On
-DLLVM_EXTERNAL_LIT=${LLVM_EXTERNAL_LIT}
SOURCE_SUBDIR enzyme
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${_enzyme_build_type} -- -j8
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${_enzyme_build_type} --target ${_enzyme_static_target} -- -j8
#TEST_COMMAND ${CMAKE_COMMAND} --build . --config ${_enzyme_build_type} --target check-enzyme
#TEST_BEFORE_INSTALL 1
INSTALL_COMMAND ${CMAKE_COMMAND} --install .
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config ${_enzyme_build_type} --target install-${_enzyme_static_target} -- -j8
BUILD_BYPRODUCTS ${ENZYME_BYPRODUCTS}
${_enzyme_cmake_logging_settings}
DEPENDS LLVMSupport
Expand All @@ -92,4 +96,4 @@ if (NOT CLAD_BUILD_STATIC_ONLY)
add_dependencies(clad LLVMEnzyme)
endif(ENABLE_ENZYME_BACKEND)
endif()
set_source_files_properties(ClangPlugin.cpp PROPERTIES COMPILE_DEFINITIONS CLANG_MAJOR_VERSION="${CLANG_VERSION_MAJOR}")
set_source_files_properties(ClangPlugin.cpp PROPERTIES COMPILE_DEFINITIONS CLANG_MAJOR_VERSION="${CLANG_VERSION_MAJOR}")

0 comments on commit 20e4b9c

Please sign in to comment.