From 6ceb89745c8ac1c24f64f2ed615eab0c02d62427 Mon Sep 17 00:00:00 2001 From: Manuel Drehwald Date: Thu, 7 Aug 2025 16:04:50 -0700 Subject: [PATCH 1/4] Rust doesn't use the Bitcode loader, so don't build it --- enzyme/CMakeLists.txt | 5 ++++- enzyme/test/CMakeLists.txt | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/enzyme/CMakeLists.txt b/enzyme/CMakeLists.txt index 71fd95cf45be..54dfe25ddd40 100644 --- a/enzyme/CMakeLists.txt +++ b/enzyme/CMakeLists.txt @@ -32,6 +32,7 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) option(ENZYME_ENABLE_PLUGINS "Enable Clang/LLD/Opt plugins" ON) +option(ENZYME_BC_LOADER "Enable bitcode loader" ON) option(ENZYME_CLANG "Build enzyme clang plugin" ON) option(ENZYME_FLANG "Build enzyme flang symlink" OFF) option(ENZYME_MLIR "Build enzyme mlir plugin" OFF) @@ -286,7 +287,9 @@ include_directories("${CMAKE_CURRENT_BINARY_DIR}/include") add_subdirectory(tools) add_subdirectory(Enzyme) -add_subdirectory(BCLoad) +if (ENZYME_BC_LOADER) + add_subdirectory(BCLoad) +endif() if (ENZYME_ENABLE_PLUGINS) add_subdirectory(test) endif() diff --git a/enzyme/test/CMakeLists.txt b/enzyme/test/CMakeLists.txt index 9340c883eaa0..8f781a0f04cc 100644 --- a/enzyme/test/CMakeLists.txt +++ b/enzyme/test/CMakeLists.txt @@ -23,7 +23,9 @@ endif() if (ENZYME_IFX) add_subdirectory(Fortran) endif() -add_subdirectory(BCLoader) +if (ENZYME_BC_LOADER) + add_subdirectory(BCLoader) +endif() if (ENZYME_MLIR) add_subdirectory(MLIR) endif() From b34041e00f03584ea0fa60159e25b7e97c38bfa0 Mon Sep 17 00:00:00 2001 From: Manuel Drehwald Date: Sun, 24 Aug 2025 13:02:09 -0700 Subject: [PATCH 2/4] try bcloader fix for llvm 21 --- enzyme/BCLoad/BCLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enzyme/BCLoad/BCLoader.cpp b/enzyme/BCLoad/BCLoader.cpp index 70a220a9ea33..b8ccb7ebde30 100644 --- a/enzyme/BCLoad/BCLoader.cpp +++ b/enzyme/BCLoad/BCLoader.cpp @@ -132,7 +132,7 @@ bool provideDefinitions(Module &M, std::set ignoreFunctions, } toReplace.push_back(name.str()); } - BC->setTargetTriple(""); + BC->setTargetTriple(llvm::Triple("")); Linker L(M); L.linkInModule(std::move(BC)); for (auto name : toReplace) { From 9225129f79dfcf0a8186f6c8ddfa1d2c0f0b0a61 Mon Sep 17 00:00:00 2001 From: Manuel Drehwald Date: Sun, 24 Aug 2025 13:21:36 -0700 Subject: [PATCH 3/4] Solve Julia build issue --- enzyme/BCLoad/BCLoader.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/enzyme/BCLoad/BCLoader.cpp b/enzyme/BCLoad/BCLoader.cpp index b8ccb7ebde30..29122761fd54 100644 --- a/enzyme/BCLoad/BCLoader.cpp +++ b/enzyme/BCLoad/BCLoader.cpp @@ -132,7 +132,11 @@ bool provideDefinitions(Module &M, std::set ignoreFunctions, } toReplace.push_back(name.str()); } - BC->setTargetTriple(llvm::Triple("")); +#if LLVM_VERSION_MAJOR >= 21 + BC->setTargetTriple(llvm::Triple("")); +#else + BC->setTargetTriple(""); +#endif Linker L(M); L.linkInModule(std::move(BC)); for (auto name : toReplace) { From 6dbee0e88be02affffe8912e666c2a90c3378f5c Mon Sep 17 00:00:00 2001 From: Manuel Drehwald Date: Wed, 10 Sep 2025 19:53:38 -0400 Subject: [PATCH 4/4] update yml --- .github/workflows/ccpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 32189e606d00..212090991ab7 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - llvm: ["15", "16", "17", "18", "19", "20"] + llvm: ["15", "16", "17", "18", "19", "20", "21"] build: ["Release"] # "RelWithDebInfo" os: [ubuntu-22.04]