Skip to content

Commit 6d32d33

Browse files
committed
tests still failing, but logic working
1 parent ed46c12 commit 6d32d33

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

library/core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ optimize_for_size = []
2323
# Make `RefCell` store additional debugging information, which is printed out when
2424
# a borrow error occurs
2525
debug_refcell = []
26+
llvm_enzyme = []
2627

2728
[lints.rust.unexpected_cfgs]
2829
level = "warn"

library/core/src/macros/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,8 +1513,8 @@ pub(crate) mod builtin {
15131513
///
15141514
/// ### Usage examples:
15151515
///
1516-
#[cfg_attr(llvm_enzyme, doc = " ```rust")]
1517-
#[cfg_attr(not(llvm_enzyme), doc = " ```rust,compile_fail")]
1516+
#[cfg_attr(feature = "llvm_enzyme", doc = " ```rust")]
1517+
#[cfg_attr(not(feature = "llvm_enzyme"), doc = " ```rust,compile_fail")]
15181518
/// use std::autodiff::*;
15191519
/// #[autodiff_forward(rb_fwd1, Dual, Const, Dual)]
15201520
/// #[autodiff_forward(rb_fwd2, Const, Dual, Dual)]
@@ -1538,6 +1538,8 @@ pub(crate) mod builtin {
15381538
/// let mut dout = 0.0;
15391539
/// let x4 = rb_inp_fwd(1.0, 1.0, 3.0, 1.0, &mut out, &mut dout);
15401540
/// // (out, dout) == (400.0, -400.0)
1541+
/// //assert_eq!(x0, x1);
1542+
/// //assert_eq!(x0, dxy);
15411543
/// }
15421544
/// ```
15431545
///
@@ -1584,8 +1586,8 @@ pub(crate) mod builtin {
15841586
///
15851587
/// ### Usage examples:
15861588
///
1587-
#[cfg_attr(llvm_enzyme, doc = " ```rust")]
1588-
#[cfg_attr(not(llvm_enzyme), doc = " ```rust,compile_fail")]
1589+
#[cfg_attr(feature = "llvm_enzyme", doc = " ```rust")]
1590+
#[cfg_attr(not(feature = "llvm_enzyme"), doc = " ```rust,compile_fail")]
15891591
/// use std::autodiff::*;
15901592
/// #[autodiff_reverse(rb_rev, Active, Active, Active)]
15911593
/// fn rosenbrock(x: f64, y: f64) -> f64 {

library/std/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ optimize_for_size = ["core/optimize_for_size", "alloc/optimize_for_size"]
126126
# a borrow error occurs
127127
debug_refcell = ["core/debug_refcell"]
128128

129+
llvm_enzyme = ["core/llvm_enzyme"]
129130

130131
# Enable std_detect features:
131132
std_detect_file_io = ["std_detect/std_detect_file_io"]

library/sysroot/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ profiler = ["dep:profiler_builtins"]
3535
std_detect_file_io = ["std/std_detect_file_io"]
3636
std_detect_dlsym_getauxval = ["std/std_detect_dlsym_getauxval"]
3737
windows_raw_dylib = ["std/windows_raw_dylib"]
38+
llvm_enzyme = ["std/llvm_enzyme"]

src/bootstrap/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,10 @@ impl Build {
846846
features.insert("compiler-builtins-mem");
847847
}
848848

849+
if self.config.llvm_enzyme {
850+
features.insert("llvm_enzyme");
851+
}
852+
849853
features.into_iter().collect::<Vec<_>>().join(" ")
850854
}
851855

0 commit comments

Comments
 (0)