@@ -8,7 +8,6 @@ use std::{fs, io, mem, str, thread};
88
99use rustc_abi:: Size ;
1010use rustc_ast:: attr;
11- use rustc_ast:: expand:: autodiff_attrs:: AutoDiffItem ;
1211use rustc_data_structures:: fx:: { FxHashMap , FxIndexMap } ;
1312use rustc_data_structures:: jobserver:: { self , Acquired } ;
1413use rustc_data_structures:: memmap:: Mmap ;
@@ -41,7 +40,7 @@ use tracing::debug;
4140use super :: link:: { self , ensure_removed} ;
4241use super :: lto:: { self , SerializedModule } ;
4342use super :: symbol_export:: symbol_name_for_instance_in_crate;
44- use crate :: errors:: { AutodiffWithoutLto , ErrorCreatingRemarkDir } ;
43+ use crate :: errors:: ErrorCreatingRemarkDir ;
4544use crate :: traits:: * ;
4645use crate :: {
4746 CachedModuleCodegen , CodegenResults , CompiledModule , CrateInfo , ModuleCodegen , ModuleKind ,
@@ -399,7 +398,6 @@ impl<B: WriteBackendMethods> CodegenContext<B> {
399398
400399fn generate_lto_work < B : ExtraBackendMethods > (
401400 cgcx : & CodegenContext < B > ,
402- autodiff : Vec < AutoDiffItem > ,
403401 needs_fat_lto : Vec < FatLtoInput < B > > ,
404402 needs_thin_lto : Vec < ( String , B :: ThinBuffer ) > ,
405403 import_only_modules : Vec < ( SerializedModule < B :: ModuleBuffer > , WorkProduct ) > ,
@@ -413,10 +411,6 @@ fn generate_lto_work<B: ExtraBackendMethods>(
413411 // We are adding a single work item, so the cost doesn't matter.
414412 vec ! [ ( WorkItem :: LTO ( module) , 0 ) ]
415413 } else {
416- if !autodiff. is_empty ( ) {
417- let dcx = cgcx. create_dcx ( ) ;
418- dcx. handle ( ) . emit_fatal ( AutodiffWithoutLto { } ) ;
419- }
420414 assert ! ( needs_fat_lto. is_empty( ) ) ;
421415 let ( lto_modules, copy_jobs) = B :: run_thin_lto ( cgcx, needs_thin_lto, import_only_modules)
422416 . unwrap_or_else ( |e| e. raise ( ) ) ;
@@ -1027,9 +1021,6 @@ pub(crate) enum Message<B: WriteBackendMethods> {
10271021 /// Sent from a backend worker thread.
10281022 WorkItem { result : Result < WorkItemResult < B > , Option < WorkerFatalError > > , worker_id : usize } ,
10291023
1030- /// A vector containing all the AutoDiff tasks that we have to pass to Enzyme.
1031- AddAutoDiffItems ( Vec < AutoDiffItem > ) ,
1032-
10331024 /// The frontend has finished generating something (backend IR or a
10341025 /// post-LTO artifact) for a codegen unit, and it should be passed to the
10351026 /// backend. Sent from the main thread.
@@ -1357,7 +1348,6 @@ fn start_executing_work<B: ExtraBackendMethods>(
13571348
13581349 // This is where we collect codegen units that have gone all the way
13591350 // through codegen and LLVM.
1360- let mut autodiff_items = Vec :: new ( ) ;
13611351 let mut compiled_modules = vec ! [ ] ;
13621352 let mut compiled_allocator_module = None ;
13631353 let mut needs_link = Vec :: new ( ) ;
@@ -1469,13 +1459,9 @@ fn start_executing_work<B: ExtraBackendMethods>(
14691459 let needs_thin_lto = mem:: take ( & mut needs_thin_lto) ;
14701460 let import_only_modules = mem:: take ( & mut lto_import_only_modules) ;
14711461
1472- for ( work, cost) in generate_lto_work (
1473- & cgcx,
1474- autodiff_items. clone ( ) ,
1475- needs_fat_lto,
1476- needs_thin_lto,
1477- import_only_modules,
1478- ) {
1462+ for ( work, cost) in
1463+ generate_lto_work ( & cgcx, needs_fat_lto, needs_thin_lto, import_only_modules)
1464+ {
14791465 let insertion_index = work_items
14801466 . binary_search_by_key ( & cost, |& ( _, cost) | cost)
14811467 . unwrap_or_else ( |e| e) ;
@@ -1611,10 +1597,6 @@ fn start_executing_work<B: ExtraBackendMethods>(
16111597 main_thread_state = MainThreadState :: Idle ;
16121598 }
16131599
1614- Message :: AddAutoDiffItems ( mut items) => {
1615- autodiff_items. append ( & mut items) ;
1616- }
1617-
16181600 Message :: CodegenComplete => {
16191601 if codegen_state != Aborted {
16201602 codegen_state = Completed ;
@@ -2077,10 +2059,6 @@ impl<B: ExtraBackendMethods> OngoingCodegen<B> {
20772059 drop ( self . coordinator . sender . send ( Box :: new ( Message :: CodegenComplete :: < B > ) ) ) ;
20782060 }
20792061
2080- pub ( crate ) fn submit_autodiff_items ( & self , items : Vec < AutoDiffItem > ) {
2081- drop ( self . coordinator . sender . send ( Box :: new ( Message :: < B > :: AddAutoDiffItems ( items) ) ) ) ;
2082- }
2083-
20842062 pub ( crate ) fn check_for_errors ( & self , sess : & Session ) {
20852063 self . shared_emitter_main . check ( sess, false ) ;
20862064 }
0 commit comments