@@ -15,15 +15,14 @@ use anyhow::{Result, anyhow};
15
15
use auto_hash_map:: AutoMap ;
16
16
use rustc_hash:: FxHasher ;
17
17
use serde:: { Deserialize , Serialize } ;
18
- use smallvec:: SmallVec ;
19
18
use tokio:: { select, sync:: mpsc:: Receiver , task_local} ;
20
19
use tokio_util:: task:: TaskTracker ;
21
- use tracing:: { Instrument , Level , instrument, trace_span } ;
20
+ use tracing:: { Instrument , Level , instrument} ;
22
21
23
22
use crate :: {
24
23
Completion , InvalidationReason , InvalidationReasonSet , OutputContent , ReadCellOptions ,
25
- ResolvedVc , SharedReference , TaskId , TaskIdSet , TraitMethod , ValueTypeId , Vc , VcRead ,
26
- VcValueTrait , VcValueType ,
24
+ ResolvedVc , SharedReference , TaskId , TraitMethod , ValueTypeId , Vc , VcRead , VcValueTrait ,
25
+ VcValueType ,
27
26
backend:: {
28
27
Backend , CachedTaskType , CellContent , TaskCollectiblesMap , TaskExecutionSpec ,
29
28
TransientTaskType , TurboTasksExecutionError , TypedCellContent ,
@@ -102,10 +101,6 @@ pub trait TurboTasksApi: TurboTasksCallApi + Sync + Send {
102
101
103
102
fn invalidate_serialization ( & self , task : TaskId ) ;
104
103
105
- /// Eagerly notifies all tasks that were scheduled for notifications via
106
- /// `schedule_notify_tasks_set()`
107
- fn notify_scheduled_tasks ( & self ) ;
108
-
109
104
fn try_read_task_output (
110
105
& self ,
111
106
task : TaskId ,
@@ -264,14 +259,6 @@ pub trait TurboTasksBackendApi<B: Backend + 'static>: TurboTasksCallApi + Sync +
264
259
/// idle even with active background jobs.
265
260
fn schedule_backend_background_job ( & self , job : B :: BackendJob ) ;
266
261
267
- /// Enqueues tasks for notification of changed dependencies. This will
268
- /// eventually call `invalidate_tasks()` on all tasks.
269
- fn schedule_notify_tasks ( & self , tasks : & [ TaskId ] ) ;
270
-
271
- /// Enqueues tasks for notification of changed dependencies. This will
272
- /// eventually call `invalidate_tasks()` on all tasks.
273
- fn schedule_notify_tasks_set ( & self , tasks : & TaskIdSet ) ;
274
-
275
262
/// Returns the duration from the start of the program to the given instant.
276
263
fn program_duration_until ( & self , instant : Instant ) -> Duration ;
277
264
@@ -403,11 +390,6 @@ struct CurrentTaskState {
403
390
task_id : TaskId ,
404
391
execution_id : ExecutionId ,
405
392
406
- /// Affected tasks, that are tracked during task execution. These tasks will
407
- /// be invalidated when the execution finishes or before reading a cell
408
- /// value.
409
- tasks_to_notify : SmallVec < [ TaskId ; 4 ] > ,
410
-
411
393
/// True if the current task has state in cells
412
394
stateful : bool ,
413
395
@@ -439,7 +421,6 @@ impl CurrentTaskState {
439
421
Self {
440
422
task_id,
441
423
execution_id,
442
- tasks_to_notify : SmallVec :: new ( ) ,
443
424
stateful : false ,
444
425
has_invalidator : false ,
445
426
cell_counters : Some ( AutoMap :: default ( ) ) ,
@@ -749,18 +730,15 @@ impl<B: Backend + 'static> TurboTasks<B> {
749
730
} = this. finish_current_task_state ( ) ;
750
731
let cell_counters = CURRENT_TASK_STATE
751
732
. with ( |ts| ts. write ( ) . unwrap ( ) . cell_counters . take ( ) . unwrap ( ) ) ;
752
- let schedule_again = this. backend . task_execution_completed (
733
+ this. backend . task_execution_completed (
753
734
task_id,
754
735
duration,
755
736
alloc_info. memory_usage ( ) ,
756
737
& cell_counters,
757
738
stateful,
758
739
has_invalidator,
759
740
& * this,
760
- ) ;
761
- // task_execution_completed might need to notify tasks
762
- this. notify_scheduled_tasks ( ) ;
763
- schedule_again
741
+ )
764
742
}
765
743
. instrument ( span)
766
744
. await
@@ -1123,19 +1101,15 @@ impl<B: Backend + 'static> TurboTasks<B> {
1123
1101
}
1124
1102
1125
1103
fn finish_current_task_state ( & self ) -> FinishedTaskState {
1126
- let ( stateful, has_invalidator, tasks ) = CURRENT_TASK_STATE . with ( |cell| {
1104
+ let ( stateful, has_invalidator) = CURRENT_TASK_STATE . with ( |cell| {
1127
1105
let CurrentTaskState {
1128
- tasks_to_notify,
1129
1106
stateful,
1130
1107
has_invalidator,
1131
1108
..
1132
1109
} = & mut * cell. write ( ) . unwrap ( ) ;
1133
- ( * stateful, * has_invalidator, take ( tasks_to_notify ) )
1110
+ ( * stateful, * has_invalidator)
1134
1111
} ) ;
1135
1112
1136
- if !tasks. is_empty ( ) {
1137
- self . backend . invalidate_tasks ( & tasks, self ) ;
1138
- }
1139
1113
FinishedTaskState {
1140
1114
stateful,
1141
1115
has_invalidator,
@@ -1245,21 +1219,6 @@ impl<B: Backend + 'static> TurboTasksApi for TurboTasks<B> {
1245
1219
self . backend . invalidate_serialization ( task, self ) ;
1246
1220
}
1247
1221
1248
- fn notify_scheduled_tasks ( & self ) {
1249
- let _ = CURRENT_TASK_STATE . try_with ( |cell| {
1250
- let tasks = {
1251
- let CurrentTaskState {
1252
- tasks_to_notify, ..
1253
- } = & mut * cell. write ( ) . unwrap ( ) ;
1254
- take ( tasks_to_notify)
1255
- } ;
1256
- if tasks. is_empty ( ) {
1257
- return ;
1258
- }
1259
- self . backend . invalidate_tasks ( & tasks, self ) ;
1260
- } ) ;
1261
- }
1262
-
1263
1222
fn try_read_task_output (
1264
1223
& self ,
1265
1224
task : TaskId ,
@@ -1475,36 +1434,6 @@ impl<B: Backend + 'static> TurboTasksBackendApi<B> for TurboTasks<B> {
1475
1434
} )
1476
1435
}
1477
1436
1478
- /// Enqueues tasks for notification of changed dependencies. This will
1479
- /// eventually call `dependent_cell_updated()` on all tasks.
1480
- fn schedule_notify_tasks ( & self , tasks : & [ TaskId ] ) {
1481
- let result = CURRENT_TASK_STATE . try_with ( |cell| {
1482
- let CurrentTaskState {
1483
- tasks_to_notify, ..
1484
- } = & mut * cell. write ( ) . unwrap ( ) ;
1485
- tasks_to_notify. extend ( tasks. iter ( ) . copied ( ) ) ;
1486
- } ) ;
1487
- if result. is_err ( ) {
1488
- let _guard = trace_span ! ( "schedule_notify_tasks" , count = tasks. len( ) ) . entered ( ) ;
1489
- self . backend . invalidate_tasks ( tasks, self ) ;
1490
- }
1491
- }
1492
-
1493
- /// Enqueues tasks for notification of changed dependencies. This will
1494
- /// eventually call `dependent_cell_updated()` on all tasks.
1495
- fn schedule_notify_tasks_set ( & self , tasks : & TaskIdSet ) {
1496
- let result = CURRENT_TASK_STATE . try_with ( |cell| {
1497
- let CurrentTaskState {
1498
- tasks_to_notify, ..
1499
- } = & mut * cell. write ( ) . unwrap ( ) ;
1500
- tasks_to_notify. extend ( tasks. iter ( ) . copied ( ) ) ;
1501
- } ) ;
1502
- if result. is_err ( ) {
1503
- let _guard = trace_span ! ( "schedule_notify_tasks_set" , count = tasks. len( ) ) . entered ( ) ;
1504
- self . backend . invalidate_tasks_set ( tasks, self ) ;
1505
- } ;
1506
- }
1507
-
1508
1437
#[ track_caller]
1509
1438
fn schedule ( & self , task : TaskId ) {
1510
1439
self . schedule ( task)
@@ -1730,11 +1659,6 @@ pub fn prevent_gc() {
1730
1659
mark_stateful ( ) ;
1731
1660
}
1732
1661
1733
- /// Notifies scheduled tasks for execution.
1734
- pub fn notify_scheduled_tasks ( ) {
1735
- with_turbo_tasks ( |tt| tt. notify_scheduled_tasks ( ) )
1736
- }
1737
-
1738
1662
pub fn emit < T : VcValueTrait + ?Sized > ( collectible : ResolvedVc < T > ) {
1739
1663
with_turbo_tasks ( |tt| {
1740
1664
let raw_vc = collectible. node . node ;
0 commit comments