Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7936070
cleaned up some tests
Kivooeo Jun 8, 2025
1c9f795
Check CoerceUnsized impl validity before coercing
compiler-errors Jun 24, 2025
066ae4c
submodule update
KMJ-007 Jun 25, 2025
7b1c89f
added PrintTAFn flag for autodiff
KMJ-007 Jun 25, 2025
35deb5b
compiler: Trim the misleading C from ExternAbi::CCmse*
workingjubilee Jun 7, 2025
4bdf1c5
compiler: remove misleading 'c' from `abi_c_cmse_nonsecure_call` feature
workingjubilee Jun 24, 2025
383d761
compiler: Trim the misleading C of C-cmse from errors
workingjubilee Jun 7, 2025
1400e2d
tests: s/C-cmse/cmse/
workingjubilee Jun 7, 2025
02a00df
tests: bless s/C-cmse/cmse/
workingjubilee Jun 9, 2025
9cfee73
move unstable book page and account for it
workingjubilee Jun 24, 2025
3beed38
unstable-book: Update cmse feature descriptions
workingjubilee Jun 7, 2025
586a9d1
tests: split out unsupported-in-impls.rs
workingjubilee Jun 24, 2025
12d05d8
tests: migrate unsupported-abi-transmute.rs to extern "rust-invalid"
workingjubilee Jun 24, 2025
78652b7
tests: specify why extern "rust-invalid" cannot be used in varargs test
workingjubilee Jun 24, 2025
087dabf
Sprinkle breadcrumbs around to lead people to the rust-invalid ABI
workingjubilee Jun 25, 2025
c24914e
compiler: fussily sort the huge AbiMap match
workingjubilee Jun 25, 2025
09295af
Add Sub, Mul, Div, Rem as const_traits
SciMind2460 Jun 25, 2025
d2d17c6
Add runtime check to avoid overwrite arg easily in diag and store and…
xizheyin Jun 21, 2025
8825997
Rollup merge of #142146 - workingjubilee:doubt-that-cmse-nonsecure-ab…
jdonszelmann Jun 25, 2025
131a2e4
Rollup merge of #142200 - Kivooeo:tf8, r=jieyouxu
jdonszelmann Jun 25, 2025
63c5a84
Rollup merge of #142724 - xizheyin:avoid_overwrite_args, r=oli-obk
jdonszelmann Jun 25, 2025
69b11c6
Rollup merge of #142809 - KMJ-007:ad-type-analysis-flag, r=ZuseZ4
jdonszelmann Jun 25, 2025
da42289
Rollup merge of #142976 - compiler-errors:coerce-ice, r=fee1-dead
jdonszelmann Jun 25, 2025
20e47aa
Rollup merge of #142992 - workingjubilee:dont-validate-naughty-abis, …
jdonszelmann Jun 25, 2025
c001128
Rollup merge of #143000 - SciMind2460:master, r=jhpratt
jdonszelmann Jun 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion compiler/rustc_codegen_llvm/src/back/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ fn thin_lto(
}

fn enable_autodiff_settings(ad: &[config::AutoDiff]) {
for &val in ad {
for val in ad {
// We intentionally don't use a wildcard, to not forget handling anything new.
match val {
config::AutoDiff::PrintPerf => {
Expand All @@ -599,6 +599,10 @@ fn enable_autodiff_settings(ad: &[config::AutoDiff]) {
config::AutoDiff::PrintTA => {
llvm::set_print_type(true);
}
config::AutoDiff::PrintTAFn(fun) => {
llvm::set_print_type(true); // Enable general type printing
llvm::set_print_type_fun(&fun); // Set specific function to analyze
}
config::AutoDiff::Inline => {
llvm::set_inline(true);
}
Expand Down
17 changes: 17 additions & 0 deletions compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,19 @@ pub(crate) use self::Enzyme_AD::*;

#[cfg(llvm_enzyme)]
pub(crate) mod Enzyme_AD {
use std::ffi::{CString, c_char};

use libc::c_void;

unsafe extern "C" {
pub(crate) fn EnzymeSetCLBool(arg1: *mut ::std::os::raw::c_void, arg2: u8);
pub(crate) fn EnzymeSetCLString(arg1: *mut ::std::os::raw::c_void, arg2: *const c_char);
}
unsafe extern "C" {
static mut EnzymePrintPerf: c_void;
static mut EnzymePrintActivity: c_void;
static mut EnzymePrintType: c_void;
static mut EnzymeFunctionToAnalyze: c_void;
static mut EnzymePrint: c_void;
static mut EnzymeStrictAliasing: c_void;
static mut looseTypeAnalysis: c_void;
Expand All @@ -86,6 +91,15 @@ pub(crate) mod Enzyme_AD {
EnzymeSetCLBool(std::ptr::addr_of_mut!(EnzymePrintType), print as u8);
}
}
pub(crate) fn set_print_type_fun(fun_name: &str) {
let c_fun_name = CString::new(fun_name).unwrap();
unsafe {
EnzymeSetCLString(
std::ptr::addr_of_mut!(EnzymeFunctionToAnalyze),
c_fun_name.as_ptr() as *const c_char,
);
}
}
pub(crate) fn set_print(print: bool) {
unsafe {
EnzymeSetCLBool(std::ptr::addr_of_mut!(EnzymePrint), print as u8);
Expand Down Expand Up @@ -132,6 +146,9 @@ pub(crate) mod Fallback_AD {
pub(crate) fn set_print_type(print: bool) {
unimplemented!()
}
pub(crate) fn set_print_type_fun(fun_name: &str) {
unimplemented!()
}
pub(crate) fn set_print(print: bool) {
unimplemented!()
}
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,15 @@ pub enum CoverageLevel {
}

/// The different settings that the `-Z autodiff` flag can have.
#[derive(Clone, Copy, PartialEq, Hash, Debug)]
#[derive(Clone, PartialEq, Hash, Debug)]
pub enum AutoDiff {
/// Enable the autodiff opt pipeline
Enable,

/// Print TypeAnalysis information
PrintTA,
/// Print TypeAnalysis information for a specific function
PrintTAFn(String),
/// Print ActivityAnalysis Information
PrintAA,
/// Print Performance Warnings from Enzyme
Expand Down
17 changes: 15 additions & 2 deletions compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ mod desc {
pub(crate) const parse_list: &str = "a space-separated list of strings";
pub(crate) const parse_list_with_polarity: &str =
"a comma-separated list of strings, with elements beginning with + or -";
pub(crate) const parse_autodiff: &str = "a comma separated list of settings: `Enable`, `PrintSteps`, `PrintTA`, `PrintAA`, `PrintPerf`, `PrintModBefore`, `PrintModAfter`, `PrintModFinal`, `PrintPasses`, `NoPostopt`, `LooseTypes`, `Inline`";
pub(crate) const parse_autodiff: &str = "a comma separated list of settings: `Enable`, `PrintSteps`, `PrintTA`, `PrintTAFn`, `PrintAA`, `PrintPerf`, `PrintModBefore`, `PrintModAfter`, `PrintModFinal`, `PrintPasses`, `NoPostopt`, `LooseTypes`, `Inline`";
pub(crate) const parse_comma_list: &str = "a comma-separated list of strings";
pub(crate) const parse_opt_comma_list: &str = parse_comma_list;
pub(crate) const parse_number: &str = "a number";
Expand Down Expand Up @@ -1365,9 +1365,22 @@ pub mod parse {
let mut v: Vec<&str> = v.split(",").collect();
v.sort_unstable();
for &val in v.iter() {
let variant = match val {
// Split each entry on '=' if it has an argument
let (key, arg) = match val.split_once('=') {
Some((k, a)) => (k, Some(a)),
None => (val, None),
};

let variant = match key {
"Enable" => AutoDiff::Enable,
"PrintTA" => AutoDiff::PrintTA,
"PrintTAFn" => {
if let Some(fun) = arg {
AutoDiff::PrintTAFn(fun.to_string())
} else {
return false;
}
}
"PrintAA" => AutoDiff::PrintAA,
"PrintPerf" => AutoDiff::PrintPerf,
"PrintSteps" => AutoDiff::PrintSteps,
Expand Down
1 change: 1 addition & 0 deletions src/doc/rustc-dev-guide/src/autodiff/flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ To support you while debugging or profiling, we have added support for an experi

```text
PrintTA // Print TypeAnalysis information
PrintTAFn // Print TypeAnalysis information for a specific function
PrintAA // Print ActivityAnalysis information
Print // Print differentiated functions while they are being generated and optimized
PrintPerf // Print AD related Performance warnings
Expand Down
1 change: 1 addition & 0 deletions src/doc/unstable-book/src/compiler-flags/autodiff.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Multiple options can be separated with a comma. Valid options are:

`Enable` - Required flag to enable autodiff
`PrintTA` - print Type Analysis Information
`PrintTAFn` - print Type Analysis Information for a specific function
`PrintAA` - print Activity Analysis Information
`PrintPerf` - print Performance Warnings from Enzyme
`PrintSteps` - prints all intermediate transformations
Expand Down
2 changes: 1 addition & 1 deletion src/tools/enzyme
Submodule enzyme updated 113 files