[NFC] simplify matching
This commit is contained in:
parent
f4c297802f
commit
47c07ed963
1 changed files with 3 additions and 12 deletions
|
@ -150,9 +150,6 @@ fn generate_enzyme_call<'ll>(
|
||||||
outer_fn: &'ll Value,
|
outer_fn: &'ll Value,
|
||||||
attrs: AutoDiffAttrs,
|
attrs: AutoDiffAttrs,
|
||||||
) {
|
) {
|
||||||
let inputs = attrs.input_activity;
|
|
||||||
let output = attrs.ret_activity;
|
|
||||||
|
|
||||||
// We have to pick the name depending on whether we want forward or reverse mode autodiff.
|
// We have to pick the name depending on whether we want forward or reverse mode autodiff.
|
||||||
let mut ad_name: String = match attrs.mode {
|
let mut ad_name: String = match attrs.mode {
|
||||||
DiffMode::Forward => "__enzyme_fwddiff",
|
DiffMode::Forward => "__enzyme_fwddiff",
|
||||||
|
@ -240,18 +237,12 @@ fn generate_enzyme_call<'ll>(
|
||||||
args.push(fn_to_diff);
|
args.push(fn_to_diff);
|
||||||
|
|
||||||
let enzyme_primal_ret = cx.create_metadata("enzyme_primal_return".to_string()).unwrap();
|
let enzyme_primal_ret = cx.create_metadata("enzyme_primal_return".to_string()).unwrap();
|
||||||
match output {
|
if matches!(attrs.ret_activity, DiffActivity::Dual | DiffActivity::Active) {
|
||||||
DiffActivity::Dual => {
|
|
||||||
args.push(cx.get_metadata_value(enzyme_primal_ret));
|
args.push(cx.get_metadata_value(enzyme_primal_ret));
|
||||||
}
|
}
|
||||||
DiffActivity::Active => {
|
|
||||||
args.push(cx.get_metadata_value(enzyme_primal_ret));
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
|
|
||||||
let outer_args: Vec<&llvm::Value> = get_params(outer_fn);
|
let outer_args: Vec<&llvm::Value> = get_params(outer_fn);
|
||||||
match_args_from_caller_to_enzyme(&cx, &mut args, &inputs, &outer_args);
|
match_args_from_caller_to_enzyme(&cx, &mut args, &attrs.input_activity, &outer_args);
|
||||||
|
|
||||||
let call = builder.call(enzyme_ty, ad_fn, &args, None);
|
let call = builder.call(enzyme_ty, ad_fn, &args, None);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue