@@ -141,7 +141,7 @@ mod target_feature;
141141
142142use builder:: Builder ;
143143use codegen_cx:: CodegenCx ;
144- use maybe_pqp_cg_ssa:: back:: lto:: { LtoModuleCodegen , SerializedModule , ThinModule } ;
144+ use maybe_pqp_cg_ssa:: back:: lto:: { SerializedModule , ThinModule } ;
145145use maybe_pqp_cg_ssa:: back:: write:: {
146146 CodegenContext , FatLtoInput , ModuleConfig , OngoingCodegen , TargetMachineFactoryConfig ,
147147} ;
@@ -170,7 +170,7 @@ use std::any::Any;
170170use std:: fs;
171171use std:: io:: Cursor ;
172172use std:: io:: Write ;
173- use std:: path:: Path ;
173+ use std:: path:: { Path , PathBuf } ;
174174use std:: sync:: Arc ;
175175use tracing:: { error, warn} ;
176176
@@ -333,7 +333,7 @@ impl WriteBackendMethods for SpirvCodegenBackend {
333333 type ThinBuffer = SpirvModuleBuffer ;
334334
335335 // FIXME(eddyb) reuse the "merge" stage of `crate::linker` for this, or even
336- // delegate to `run_fat_lto ` (although `-Zcombine-cgu` is much more niche).
336+ // delegate to `run_and_optimize_fat_lto ` (although `-Zcombine-cgu` is much more niche).
337337 fn run_link (
338338 cgcx : & CodegenContext < Self > ,
339339 diag_handler : DiagCtxtHandle < ' _ > ,
@@ -351,24 +351,29 @@ impl WriteBackendMethods for SpirvCodegenBackend {
351351 // consider setting `requires_lto = true` in the target specs and moving the
352352 // entirety of `crate::linker` into this stage (lacking diagnostics may be
353353 // an issue - it's surprising `CodegenBackend::link` has `Session` at all).
354- fn run_fat_lto (
354+ fn run_and_optimize_fat_lto (
355355 cgcx : & CodegenContext < Self > ,
356+ _exported_symbols_for_lto : & [ String ] ,
357+ _each_linked_rlib_for_lto : & [ PathBuf ] ,
356358 _modules : Vec < FatLtoInput < Self > > ,
357- _cached_modules : Vec < ( SerializedModule < Self :: ModuleBuffer > , WorkProduct ) > ,
358- ) -> Result < LtoModuleCodegen < Self > , FatalError > {
359+ _diff_fncs : Vec < AutoDiffItem > ,
360+ ) -> Result < ModuleCodegen < Self :: Module > , FatalError > {
359361 assert ! (
360362 cgcx. lto == rustc_session:: config:: Lto :: Fat ,
361- "`run_fat_lto ` (for `WorkItemResult::NeedsFatLto`) should \
363+ "`run_and_optimize_fat_lto ` (for `WorkItemResult::NeedsFatLto`) should \
362364 only be invoked due to `-Clto` (or equivalent)"
363365 ) ;
364366 unreachable ! ( "Rust-GPU does not support fat LTO" )
365367 }
366368
367369 fn run_thin_lto (
368370 cgcx : & CodegenContext < Self > ,
371+ // FIXME(bjorn3): Limit LTO exports to these symbols
372+ _exported_symbols_for_lto : & [ String ] ,
373+ _each_linked_rlib_for_lto : & [ PathBuf ] , // njn: ?
369374 modules : Vec < ( String , Self :: ThinBuffer ) > ,
370375 cached_modules : Vec < ( SerializedModule < Self :: ModuleBuffer > , WorkProduct ) > ,
371- ) -> Result < ( Vec < LtoModuleCodegen < Self > > , Vec < WorkProduct > ) , FatalError > {
376+ ) -> Result < ( Vec < ThinModule < Self > > , Vec < WorkProduct > ) , FatalError > {
372377 link:: run_thin ( cgcx, modules, cached_modules)
373378 }
374379
@@ -409,16 +414,8 @@ impl WriteBackendMethods for SpirvCodegenBackend {
409414 Ok ( module)
410415 }
411416
412- fn optimize_fat (
413- cgcx : & CodegenContext < Self > ,
414- module : & mut ModuleCodegen < Self :: Module > ,
415- ) -> Result < ( ) , FatalError > {
416- Self :: optimize_common ( cgcx, module)
417- }
418-
419417 fn codegen (
420418 cgcx : & CodegenContext < Self > ,
421- _diag_handler : DiagCtxtHandle < ' _ > ,
422419 module : ModuleCodegen < Self :: Module > ,
423420 _config : & ModuleConfig ,
424421 ) -> Result < CompiledModule , FatalError > {
@@ -457,15 +454,6 @@ impl WriteBackendMethods for SpirvCodegenBackend {
457454 SpirvModuleBuffer ( module. module_llvm . assemble ( ) ) ,
458455 )
459456 }
460-
461- fn autodiff (
462- _cgcx : & CodegenContext < Self > ,
463- _module : & ModuleCodegen < Self :: Module > ,
464- _diff_fncs : Vec < AutoDiffItem > ,
465- _config : & ModuleConfig ,
466- ) -> Result < ( ) , FatalError > {
467- unreachable ! ( "Rust-GPU does not support autodiff" )
468- }
469457}
470458
471459impl ExtraBackendMethods for SpirvCodegenBackend {
0 commit comments