Skip to main content

Module autodiff

Module autodiff 

Source

Re-exportsยง

use std::ptr; ๐Ÿ”’
use rustc_ast::expand::autodiff_attrs::DiffActivity; ๐Ÿ”’
use rustc_ast::expand::autodiff_attrs::DiffMode; ๐Ÿ”’
use rustc_ast::expand::typetree::FncTree; ๐Ÿ”’
use rustc_attr_ir::RustcAutodiff; ๐Ÿ”’
use rustc_codegen_ssa::mir::IntrinsicResult; ๐Ÿ”’
use rustc_codegen_ssa::mir::operand::OperandRef; ๐Ÿ”’
use rustc_codegen_ssa::mir::operand::OperandValue; ๐Ÿ”’
use rustc_codegen_ssa::mir::place::PlaceValue; ๐Ÿ”’
use rustc_codegen_ssa::traits::BaseTypeCodegenMethods; ๐Ÿ”’
use rustc_codegen_ssa::traits::BuilderMethods; ๐Ÿ”’
use rustc_codegen_ssa::traits::ReturnSlot; ๐Ÿ”’
use rustc_data_structures::thin_vec::ThinVec; ๐Ÿ”’
use rustc_middle::ty; ๐Ÿ”’
use rustc_middle::ty::Ty; ๐Ÿ”’
use rustc_middle::ty::TyCtxt; ๐Ÿ”’
use rustc_middle::ty::TypingEnv; ๐Ÿ”’
use rustc_span::bug; ๐Ÿ”’
use rustc_target::callconv::PassMode; ๐Ÿ”’
use tracing::debug; ๐Ÿ”’
use crate::builder::Builder; ๐Ÿ”’
use crate::builder::UNNAMED; ๐Ÿ”’
use crate::context::SimpleCx; ๐Ÿ”’
use crate::declare::declare_simple_fn; ๐Ÿ”’
use crate::llvm; ๐Ÿ”’
use crate::llvm::TRUE; ๐Ÿ”’
use crate::llvm::Type; ๐Ÿ”’
use crate::llvm::TypeKind; ๐Ÿ”’
use crate::llvm::Value; ๐Ÿ”’

Functionsยง

adjust_activity_to_abi ๐Ÿ”’
generate_enzyme_call ๐Ÿ”’
When differentiating fn_to_diff, take a outer_fn and generate another function with expected naming and calling conventions which will be discovered by the enzyme LLVM pass and its body populated with the differentiated fn_to_diff. outer_fn is then modified to have a call to the generated function and handle the differences between the Rust calling convention and Enzyme.
match_args_from_caller_to_enzyme ๐Ÿ”’