File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
compiler/rustc_codegen_llvm/src Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -261,12 +261,11 @@ pub(crate) fn add_global<'ll>(
261261// concatenated into the list of region_ids.
262262pub ( crate ) fn gen_define_handling < ' ll > (
263263 cx : & SimpleCx < ' ll > ,
264- llfn : & ' ll llvm:: Value ,
265264 offload_entry_ty : & ' ll llvm:: Type ,
266265 metadata : & Vec < OffloadMetadata > ,
266+ types : & Vec < & Type > ,
267267 symbol : & str ,
268268) -> ( & ' ll llvm:: Value , & ' ll llvm:: Value ) {
269- let types = cx. func_params_types ( cx. get_type_of_global ( llfn) ) ;
270269 // It seems like non-pointer values are automatically mapped. So here, we focus on pointer (or
271270 // reference) types.
272271 let ptr_meta = types
@@ -371,6 +370,7 @@ pub(crate) fn gen_call_handling<'ll>(
371370 memtransfer_types : & [ & ' ll llvm:: Value ] ,
372371 region_ids : & [ & ' ll llvm:: Value ] ,
373372 llfn : & ' ll Value ,
373+ types : & Vec < & Type > ,
374374 metadata : & Vec < OffloadMetadata > ,
375375) {
376376 let ( tgt_decl, tgt_target_kernel_ty) = generate_launcher ( & cx) ;
@@ -386,7 +386,6 @@ pub(crate) fn gen_call_handling<'ll>(
386386
387387 let mut builder = SBuilder :: build ( cx, bb) ;
388388
389- let types = cx. func_params_types ( cx. get_type_of_global ( llfn) ) ;
390389 let num_args = types. len ( ) as u64 ;
391390
392391 // Step 0)
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ use rustc_target::callconv::PassMode;
2323use rustc_target:: spec:: Os ;
2424use tracing:: debug;
2525
26- use crate :: abi:: FnAbiLlvmExt ;
26+ use crate :: abi:: { FnAbiLlvmExt , LlvmType } ;
2727use crate :: builder:: Builder ;
2828use crate :: builder:: autodiff:: { adjust_activity_to_abi, generate_enzyme_call} ;
2929use crate :: builder:: gpu_offload:: TgtOffloadEntry ;
@@ -1276,12 +1276,14 @@ fn codegen_offload<'ll, 'tcx>(
12761276 let metadata = inputs. iter ( ) . map ( |ty| OffloadMetadata :: from_ty ( tcx, * ty) ) . collect :: < Vec < _ > > ( ) ;
12771277 let llfn = bx. llfn ( ) ;
12781278
1279+ let types = inputs. iter ( ) . map ( |ty| cx. layout_of ( * ty) . llvm_type ( cx) ) . collect :: < Vec < _ > > ( ) ;
1280+
12791281 // TODO(Sa4dUs): separate globals from call-independent headers and use typetrees to reserve the correct amount of memory
12801282 let ( memtransfer_type, region_id) = crate :: builder:: gpu_offload:: gen_define_handling (
12811283 cx,
1282- llfn,
12831284 offload_entry_ty,
12841285 & metadata,
1286+ & types,
12851287 & target_symbol,
12861288 ) ;
12871289
@@ -1293,6 +1295,7 @@ fn codegen_offload<'ll, 'tcx>(
12931295 & [ memtransfer_type] ,
12941296 & [ region_id] ,
12951297 llfn,
1298+ & types,
12961299 & metadata,
12971300 ) ;
12981301}
You can’t perform that action at this time.
0 commit comments