Skip to content

Commit 1624d86

Browse files
committed
add enzyme distribution step
1 parent e3e432d commit 1624d86

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

src/bootstrap/src/core/build_steps/dist.rs

+35
Original file line numberDiff line numberDiff line change
@@ -2599,3 +2599,38 @@ impl Step for Gcc {
25992599
tarball.generate()
26002600
}
26012601
}
2602+
2603+
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
2604+
pub struct Enzyme {
2605+
pub target: TargetSelection,
2606+
}
2607+
2608+
impl Step for Enzyme {
2609+
type Output = GeneratedTarball;
2610+
const DEFAULT: bool = false;
2611+
const ONLY_HOSTS: bool = true;
2612+
2613+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
2614+
run.alias("enzyme")
2615+
}
2616+
2617+
fn make_run(run: RunConfig<'_>) {
2618+
run.builder.ensure(Enzyme { target: run.target });
2619+
}
2620+
2621+
fn run(self, builder: &Builder<'_>) -> Self::Output {
2622+
let mut tarball = Tarball::new(builder, "enzyme", &self.target.triple);
2623+
let enzyme = builder.ensure(super::llvm::Enzyme { target: self.target });
2624+
tarball.set_overlay(OverlayKind::Enzyme);
2625+
tarball.is_preview(true);
2626+
if let Some(llvm_config) = builder.llvm_config(builder.config.build) {
2627+
let llvm_version_major = llvm::get_llvm_version_major(builder, &llvm_config);
2628+
let lib_ext = std::env::consts::DLL_EXTENSION;
2629+
let libenzyme = format!("libEnzyme-{llvm_version_major}");
2630+
let src_lib = enzyme.join("build/Enzyme").join(&libenzyme).with_extension(lib_ext);
2631+
tarball.add_file(src_lib, "", FileType::NativeLibrary);
2632+
}
2633+
tarball.add_legal_and_readme_to("share/doc/enzyme");
2634+
tarball.generate()
2635+
}
2636+
}

src/bootstrap/src/core/builder/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,8 @@ impl<'a> Builder<'a> {
10841084
dist::PlainSourceTarball,
10851085
dist::BuildManifest,
10861086
dist::ReproducibleArtifacts,
1087-
dist::Gcc
1087+
dist::Gcc,
1088+
dist::Enzyme
10881089
),
10891090
Kind::Install => describe!(
10901091
install::Docs,

src/bootstrap/src/utils/tarball.rs

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pub(crate) enum OverlayKind {
2626
RustAnalyzer,
2727
RustcCodegenCranelift,
2828
LlvmBitcodeLinker,
29+
Enzyme
2930
}
3031

3132
impl OverlayKind {
@@ -72,6 +73,7 @@ impl OverlayKind {
7273
"LICENSE-MIT",
7374
"src/tools/llvm-bitcode-linker/README.md",
7475
],
76+
OverlayKind::Enzyme => &["src/tools/enzyme/Readme.md", "src/tools/enzyme/LICENSE"]
7577
}
7678
}
7779

@@ -94,6 +96,7 @@ impl OverlayKind {
9496
.version(builder, &builder.release_num("rust-analyzer/crates/rust-analyzer")),
9597
OverlayKind::RustcCodegenCranelift => builder.rust_version(),
9698
OverlayKind::LlvmBitcodeLinker => builder.rust_version(),
99+
OverlayKind::Enzyme => builder.rust_version()
97100
}
98101
}
99102
}

0 commit comments

Comments
 (0)