Skip to content

Commit aba31b8

Browse files
committed
Auto merge of rust-lang#140064 - EnzymeAD:enable-autodiff-in-ci, r=<try>
[DO NOT MERGE] start building Enzyme in CI My goal is to put this in CI on April 26, to have a week to land some of the outstanding PRs (removed # in front of it to avoid spamming them every time I do a try build in this PR): 139700 [Landed] 139308 [Landed] 140104 [Landed] 140030 [Landed] 140049 [Almost ready] 140244 [Closed due to design changes] 140697[WIP] The autodiff flags PR should land first, but otherwise they don't overlap and are mostly ready, so it shouldn't be too hard to land them. In the meantime, I'll experiment here with some builders. There are some related CMake PRs which I also made in the Enzyme repo. I can temporarily merge them into the r-l/Enzyme fork, so we are not blocked on them. A fix for 140137 (Apple CI) would be nice, but I'm also happy to start with the working linux (x86-64 + aarch) as the most common target, and expand from there. r? `@oli-obk` Tracking: - 124509 **Linux** succeeded try with plugins and without plugins & with llvm-enzyme enabled: dist-x86_64-linux succeeded try with plugins and without plugins & with llvm-enzyme enabled: dist-aarch64-linux **MacOS** failed try with plugins & llvm-enzyme enabled: dist-x86_64-apple (rust-lang#140064 (comment)) failed try with plugins & llvm-enzyme enabled: dist-apple-various (rust-lang#140064 (comment)) failed try with plugins & llvm-enzyme enabled: dist-aarch64-apple (rust-lang#140064 (comment)) **Windows** failed try with plugins & llvm-enzyme enabled: dist-x86_64-mingw (rust-lang#140064 (comment)) try-job: dist-aarch64-apple
2 parents 59372f2 + 5334926 commit aba31b8

File tree

12 files changed

+16
-119
lines changed

12 files changed

+16
-119
lines changed

src/bootstrap/src/core/build_steps/compile.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,11 +1188,12 @@ pub fn rustc_cargo(
11881188
if builder.config.llvm_enzyme {
11891189
let arch = builder.build.build;
11901190
let enzyme_dir = builder.build.out.join(arch).join("enzyme").join("lib");
1191-
cargo.rustflag("-L").rustflag(enzyme_dir.to_str().expect("Invalid path"));
1191+
let abs_path = enzyme_dir.join("libEnzymeStatic-20.a");
11921192

11931193
if let Some(llvm_config) = builder.llvm_config(builder.config.build) {
1194-
let llvm_version_major = llvm::get_llvm_version_major(builder, &llvm_config);
1195-
cargo.rustflag("-l").rustflag(&format!("Enzyme-{llvm_version_major}"));
1194+
//let llvm_version_major = llvm::get_llvm_version_major(builder, &llvm_config);
1195+
//cargo.rustflag("-l").rustflag(&format!("EnzymeStatic-{llvm_version_major}"));
1196+
cargo.rustflag(abs_path);
11961197
}
11971198
}
11981199

@@ -2065,8 +2066,8 @@ impl Step for Assemble {
20652066
let enzyme_install = builder.ensure(llvm::Enzyme { target: build_compiler.host });
20662067
let llvm_config = builder.llvm_config(builder.config.build).unwrap();
20672068
let llvm_version_major = llvm::get_llvm_version_major(builder, &llvm_config);
2068-
let lib_ext = std::env::consts::DLL_EXTENSION;
2069-
let libenzyme = format!("libEnzyme-{llvm_version_major}");
2069+
let lib_ext = "a";
2070+
let libenzyme = format!("libEnzymeStatic-{llvm_version_major}");
20702071
let src_lib =
20712072
enzyme_install.join("build/Enzyme").join(&libenzyme).with_extension(lib_ext);
20722073
let libdir = builder.sysroot_target_libdir(build_compiler, build_compiler.host);

src/bootstrap/src/core/build_steps/llvm.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,8 @@ impl Step for Enzyme {
970970
.env("LLVM_CONFIG_REAL", &llvm_config)
971971
.define("LLVM_ENABLE_ASSERTIONS", "ON")
972972
.define("ENZYME_EXTERNAL_SHARED_LIB", "ON")
973-
.define("LLVM_DIR", builder.llvm_out(target));
973+
.define("ENZYME_STATIC_LIB", "ON")
974+
.define("LLVM_DIR", builder.llvm_out(target).join("build"));
974975

975976
cfg.build();
976977

src/ci/docker/host-aarch64/dist-aarch64-linux/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ ENV RUST_CONFIGURE_ARGS \
8989
--set llvm.thin-lto=true \
9090
--set llvm.libzstd=true \
9191
--set llvm.ninja=false \
92+
--set llvm.enzyme=true \
9293
--set rust.debug-assertions=false \
9394
--set rust.jemalloc \
9495
--set rust.use-lld=true \

src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ ENV RUST_CONFIGURE_ARGS \
9090
--set target.x86_64-unknown-linux-gnu.ranlib=/rustroot/bin/llvm-ranlib \
9191
--set llvm.thin-lto=true \
9292
--set llvm.ninja=false \
93+
--set llvm.enzyme=true \
9394
--set llvm.libzstd=true \
9495
--set rust.jemalloc \
9596
--set rust.use-lld=true \

src/ci/docker/host-x86_64/x86_64-gnu/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ ENV RUST_CONFIGURE_ARGS \
3030
--enable-profiler \
3131
--enable-compiler-docs \
3232
--set llvm.libzstd=true
33+
--set llvm.enzyme=true \
3334
ENV SCRIPT python3 ../x.py --stage 2 test

src/ci/github-actions/jobs.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ auto:
390390
- name: dist-x86_64-apple
391391
env:
392392
SCRIPT: ./x.py dist bootstrap --include-default-paths --host=x86_64-apple-darwin --target=x86_64-apple-darwin
393-
RUST_CONFIGURE_ARGS: --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc --set rust.lto=thin --set rust.codegen-units=1
393+
RUST_CONFIGURE_ARGS: --enable-full-tools --enable-sanitizers --enable-profiler --set llvm.enzyme=true --set rust.jemalloc --set rust.lto=thin --set rust.codegen-units=1
394394
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
395395
# Ensure that host tooling is built to support our minimum support macOS version.
396396
MACOSX_DEPLOYMENT_TARGET: 10.12
@@ -408,7 +408,7 @@ auto:
408408
SCRIPT: ./x.py dist bootstrap --include-default-paths --host='' --target=aarch64-apple-ios,x86_64-apple-ios,aarch64-apple-ios-sim,aarch64-apple-ios-macabi,x86_64-apple-ios-macabi
409409
# Mac Catalyst cannot currently compile the sanitizer:
410410
# https://github.com/rust-lang/rust/issues/129069
411-
RUST_CONFIGURE_ARGS: --enable-sanitizers --enable-profiler --set rust.jemalloc --set target.aarch64-apple-ios-macabi.sanitizers=false --set target.x86_64-apple-ios-macabi.sanitizers=false
411+
RUST_CONFIGURE_ARGS: --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.enzyme=true --set target.aarch64-apple-ios-macabi.sanitizers=false --set target.x86_64-apple-ios-macabi.sanitizers=false
412412
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
413413
# Ensure that host tooling is built to support our minimum support macOS version.
414414
# FIXME(madsmtm): This might be redundant, as we're not building host tooling here (?)
@@ -440,6 +440,7 @@ auto:
440440
--enable-profiler
441441
--set rust.jemalloc
442442
--set llvm.ninja=false
443+
--set llvm.enzyme=true
443444
--set rust.lto=thin
444445
--set rust.codegen-units=1
445446
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
@@ -626,6 +627,7 @@ auto:
626627
SCRIPT: python x.py dist bootstrap --include-default-paths
627628
RUST_CONFIGURE_ARGS: >-
628629
--build=x86_64-pc-windows-gnu
630+
--set llvm.enzyme=true
629631
--enable-full-tools
630632
DIST_REQUIRE_ALL_TOOLS: 1
631633
CODEGEN_BACKENDS: llvm,cranelift

src/tools/enzyme

Submodule enzyme updated 128 files

tests/ui/autodiff/visibility.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

tests/ui/autodiff/visibility.std_autodiff.stderr

Lines changed: 0 additions & 24 deletions
This file was deleted.

tests/ui/feature-gates/feature-gate-autodiff-use.has_support.stderr

Lines changed: 0 additions & 23 deletions
This file was deleted.

tests/ui/feature-gates/feature-gate-autodiff-use.no_support.stderr

Lines changed: 0 additions & 29 deletions
This file was deleted.

tests/ui/feature-gates/feature-gate-autodiff-use.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)