Rollup merge of #138627 - EnzymeAD:autodiff-cleanups, r=oli-obk

Autodiff cleanups

Splitting out some cleanups to reduce the size of my batching PR and simplify ``@haenoe`` 's [PR](https://github.com/rust-lang/rust/pull/138314).

r? ``@oli-obk``

Tracking:

- https://github.com/rust-lang/rust/issues/124509
This commit is contained in:
Matthias Krüger 2025-03-21 15:48:55 +01:00 committed by GitHub
commit 0c594da55f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 209 additions and 176 deletions

View file

@ -53,7 +53,7 @@ pub fn df2(x: &[f64], bx: &[f64], y: f64) -> f64 {
pub fn f3(x: &[f64], y: f64) -> f64 {
::core::panicking::panic("not implemented")
}
#[rustc_autodiff(ForwardFirst, Dual, Const, Const,)]
#[rustc_autodiff(Forward, Dual, Const, Const,)]
#[inline(never)]
pub fn df3(x: &[f64], bx: &[f64], y: f64) -> f64 {
unsafe { asm!("NOP", options(pure, nomem)); };
@ -73,10 +73,6 @@ pub fn df4() {
}
#[rustc_autodiff]
#[inline(never)]
#[rustc_autodiff]
#[inline(never)]
#[rustc_autodiff]
#[inline(never)]
pub fn f5(x: &[f64], y: f64) -> f64 {
::core::panicking::panic("not implemented")
}

View file

@ -19,7 +19,7 @@ pub fn f2(x: &[f64], y: f64) -> f64 {
unimplemented!()
}
#[autodiff(df3, ForwardFirst, Dual, Const, Const)]
#[autodiff(df3, Forward, Dual, Const, Const)]
pub fn f3(x: &[f64], y: f64) -> f64 {
unimplemented!()
}

View file

@ -51,7 +51,7 @@ pub fn df2() {
pub fn f3(x: &[f64], y: f64) -> f64 {
::core::panicking::panic("not implemented")
}
#[rustc_autodiff(ReverseFirst, Duplicated, Const, Active,)]
#[rustc_autodiff(Reverse, Duplicated, Const, Active,)]
#[inline(never)]
pub fn df3(x: &[f64], dx: &mut [f64], y: f64, dret: f64) -> f64 {
unsafe { asm!("NOP", options(pure, nomem)); };

View file

@ -18,7 +18,7 @@ pub fn f1(x: &[f64], y: f64) -> f64 {
#[autodiff(df2, Reverse)]
pub fn f2() {}
#[autodiff(df3, ReverseFirst, Duplicated, Const, Active)]
#[autodiff(df3, Reverse, Duplicated, Const, Active)]
pub fn f3(x: &[f64], y: f64) -> f64 {
unimplemented!()
}