mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-15 20:45:45 +03:00
Rollup merge of #152768 - ZuseZ4:autodiff-in-ci-for-all-os, r=Kobzol
Enable autodiff in ci for all major os *[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/152768)* Follow-up attempt to https://github.com/rust-lang/rust/pull/140064 after moving autodiff to dlopen. It covers Linux (x86_64+aarch64), MacOS (aarch64), Windows (mingw-llvm aarch64+x86_64) The extra build time for Enzyme are 180.27s on our slowest runner (aarch64-apple). The follow-up distribution via rustup probably still needs a small fix, see https://github.com/rust-lang/rust/pull/151063#issuecomment-3778937008 Placing the downloaded libEnzyme artifact on my local linux under `~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib` enables my nightly compiler to run autodiff. r? @Kobzol closes: https://github.com/rust-lang/rust/pull/140064 closes: https://github.com/rust-lang/rust/pull/151243 closes: https://github.com/rust-lang/rust/pull/151063
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
use crate::utils::build_stamp::{BuildStamp, generate_smart_stamp_hash};
|
||||
use crate::utils::exec::command;
|
||||
use crate::utils::helpers::{
|
||||
self, exe, get_clang_cl_resource_dir, t, unhashed_basename, up_to_date,
|
||||
self, exe, get_clang_cl_resource_dir, libdir, t, unhashed_basename, up_to_date,
|
||||
};
|
||||
use crate::{CLang, GitRepo, Kind, trace};
|
||||
|
||||
@@ -561,7 +561,6 @@ fn run(self, builder: &Builder<'_>) -> LlvmResult {
|
||||
}
|
||||
};
|
||||
|
||||
// FIXME(ZuseZ4): Do we need that for Enzyme too?
|
||||
// When building LLVM with LLVM_LINK_LLVM_DYLIB for macOS, an unversioned
|
||||
// libLLVM.dylib will be built. However, llvm-config will still look
|
||||
// for a versioned path like libLLVM-14.dylib. Manually create a symbolic
|
||||
@@ -1167,7 +1166,7 @@ fn run(self, builder: &Builder<'_>) -> Self::Output {
|
||||
let llvm_version_major = llvm::get_llvm_version_major(builder, &host_llvm_config);
|
||||
let lib_ext = std::env::consts::DLL_EXTENSION;
|
||||
let libenzyme = format!("libEnzyme-{llvm_version_major}");
|
||||
let build_dir = out_dir.join("lib");
|
||||
let build_dir = out_dir.join(libdir(target));
|
||||
let dylib = build_dir.join(&libenzyme).with_extension(lib_ext);
|
||||
|
||||
trace!("checking build stamp to see if we need to rebuild enzyme artifacts");
|
||||
@@ -1205,7 +1204,16 @@ fn run(self, builder: &Builder<'_>) -> Self::Output {
|
||||
// hard to spot more relevant issues.
|
||||
let mut cflags = CcFlags::default();
|
||||
cflags.push_all("-Wno-deprecated");
|
||||
configure_cmake(builder, target, &mut cfg, true, LdFlags::default(), cflags, &[]);
|
||||
|
||||
// Logic copied from `configure_llvm`
|
||||
// ThinLTO is only available when building with LLVM, enabling LLD is required.
|
||||
// Apple's linker ld64 supports ThinLTO out of the box though, so don't use LLD on Darwin.
|
||||
let mut ldflags = LdFlags::default();
|
||||
if builder.config.llvm_thin_lto && !target.contains("apple") {
|
||||
ldflags.push_all("-fuse-ld=lld");
|
||||
}
|
||||
|
||||
configure_cmake(builder, target, &mut cfg, true, ldflags, cflags, &[]);
|
||||
|
||||
// Re-use the same flags as llvm to control the level of debug information
|
||||
// generated by Enzyme.
|
||||
|
||||
Reference in New Issue
Block a user