File tree 1 file changed +3
-12
lines changed
compiler/rustc_codegen_llvm/src/builder
1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -150,9 +150,6 @@ fn generate_enzyme_call<'ll>(
150
150
outer_fn : & ' ll Value ,
151
151
attrs : AutoDiffAttrs ,
152
152
) {
153
- let inputs = attrs. input_activity ;
154
- let output = attrs. ret_activity ;
155
-
156
153
// We have to pick the name depending on whether we want forward or reverse mode autodiff.
157
154
let mut ad_name: String = match attrs. mode {
158
155
DiffMode :: Forward => "__enzyme_fwddiff" ,
@@ -240,18 +237,12 @@ fn generate_enzyme_call<'ll>(
240
237
args. push ( fn_to_diff) ;
241
238
242
239
let enzyme_primal_ret = cx. create_metadata ( "enzyme_primal_return" . to_string ( ) ) . unwrap ( ) ;
243
- match output {
244
- DiffActivity :: Dual => {
245
- args. push ( cx. get_metadata_value ( enzyme_primal_ret) ) ;
246
- }
247
- DiffActivity :: Active => {
248
- args. push ( cx. get_metadata_value ( enzyme_primal_ret) ) ;
249
- }
250
- _ => { }
240
+ if matches ! ( attrs. ret_activity, DiffActivity :: Dual | DiffActivity :: Active ) {
241
+ args. push ( cx. get_metadata_value ( enzyme_primal_ret) ) ;
251
242
}
252
243
253
244
let outer_args: Vec < & llvm:: Value > = get_params ( outer_fn) ;
254
- match_args_from_caller_to_enzyme ( & cx, & mut args, & inputs , & outer_args) ;
245
+ match_args_from_caller_to_enzyme ( & cx, & mut args, & attrs . input_activity , & outer_args) ;
255
246
256
247
let call = builder. call ( enzyme_ty, ad_fn, & args, None ) ;
257
248
You can’t perform that action at this time.
0 commit comments