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 @@ -22,7 +22,7 @@ use rustc_target::callconv::PassMode;
2222use rustc_target:: spec:: Os ;
2323use tracing:: debug;
2424
25- use crate :: abi:: FnAbiLlvmExt ;
25+ use crate :: abi:: { FnAbiLlvmExt , LlvmType } ;
2626use crate :: builder:: Builder ;
2727use crate :: builder:: autodiff:: { adjust_activity_to_abi, generate_enzyme_call} ;
2828use crate :: builder:: gpu_offload:: TgtOffloadEntry ;
@@ -1273,12 +1273,14 @@ fn codegen_offload<'ll, 'tcx>(
12731273 let metadata = inputs. iter ( ) . map ( |ty| OffloadMetadata :: from_ty ( tcx, * ty) ) . collect :: < Vec < _ > > ( ) ;
12741274 let llfn = bx. llfn ( ) ;
12751275
1276+ let types = inputs. iter ( ) . map ( |ty| cx. layout_of ( * ty) . llvm_type ( cx) ) . collect :: < Vec < _ > > ( ) ;
1277+
12761278 // TODO(Sa4dUs): separate globals from call-independent headers and use typetrees to reserve the correct amount of memory
12771279 let ( memtransfer_type, region_id) = crate :: builder:: gpu_offload:: gen_define_handling (
12781280 cx,
1279- llfn,
12801281 offload_entry_ty,
12811282 & metadata,
1283+ & types,
12821284 & target_symbol,
12831285 ) ;
12841286
@@ -1290,6 +1292,7 @@ fn codegen_offload<'ll, 'tcx>(
12901292 & [ memtransfer_type] ,
12911293 & [ region_id] ,
12921294 llfn,
1295+ & types,
12931296 & metadata,
12941297 ) ;
12951298}
You can’t perform that action at this time.
0 commit comments