@@ -3157,6 +3157,40 @@ pub const unsafe fn copysignf64(x: f64, y: f64) -> f64;
31573157#[ rustc_intrinsic]
31583158pub const unsafe fn copysignf128 ( x : f128 , y : f128 ) -> f128 ;
31593159
3160+ /// Generates the LLVM body for the automatic differentiation of `f` using Enzyme,
3161+ /// with `df` as the derivative function and `args` as its arguments.
3162+ ///
3163+ /// Used internally as the body of `df` when expanding the `#[autodiff_forward]`
3164+ /// and `#[autodiff_reverse]` attribute macros.
3165+ ///
3166+ /// Type Parameters:
3167+ /// - `F`: The original function to differentiate. Must be a function item.
3168+ /// - `G`: The derivative function. Must be a function item.
3169+ /// - `T`: A tuple of arguments passed to `df`.
3170+ /// - `R`: The return type of the derivative function.
3171+ ///
3172+ /// This shows where the `autodiff` intrinsic is used during macro expansion:
3173+ ///
3174+ /// ```rust,ignore (macro example)
3175+ /// #[autodiff_forward(df1, Dual, Const, Dual)]
3176+ /// pub fn f1(x: &[f64], y: f64) -> f64 {
3177+ /// unimplemented!()
3178+ /// }
3179+ /// ```
3180+ ///
3181+ /// expands to:
3182+ ///
3183+ /// ```rust,ignore (macro example)
3184+ /// #[rustc_autodiff]
3185+ /// #[inline(never)]
3186+ /// pub fn f1(x: &[f64], y: f64) -> f64 {
3187+ /// ::core::panicking::panic("not implemented")
3188+ /// }
3189+ /// #[rustc_autodiff(Forward, 1, Dual, Const, Dual)]
3190+ /// pub fn df1(x: &[f64], bx_0: &[f64], y: f64) -> (f64, f64) {
3191+ /// ::core::intrinsics::autodiff(f1::<>, df1::<>, (x, bx_0, y))
3192+ /// }
3193+ /// ```
31603194#[ rustc_nounwind]
31613195#[ rustc_intrinsic]
31623196pub const fn autodiff < F , G , T : crate :: marker:: Tuple , R > ( f : F , df : G , args : T ) -> R ;
0 commit comments