Skip to content

Commit 4b270a8

Browse files
committed
TEMP datadeps: Overhaul Datadeps tests
1 parent 02d0e50 commit 4b270a8

File tree

3 files changed

+332
-83
lines changed

3 files changed

+332
-83
lines changed

src/datadeps/queue.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,10 @@ function distribute_task!(queue::DataDepsTaskQueue, state::DataDepsState, all_pr
520520
new_spec.options.scope = our_scope
521521
new_spec.options.exec_scope = our_scope
522522
new_spec.options.occupancy = Dict(Any=>0)
523+
ctx = Sch.eager_context()
524+
@maybelog ctx timespan_start(ctx, :datadeps_execute, (;thunk_id=task.uid), (;))
523525
enqueue!(queue.upper_queue, DTaskPair(new_spec, task))
526+
@maybelog ctx timespan_finish(ctx, :datadeps_execute, (;thunk_id=task.uid), (;space=our_space, deps=task_arg_ws, args=remote_args))
524527

525528
# Update read/write tracking for arguments
526529
map_or_ntuple(task_arg_ws) do idx

src/datadeps/remainders.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,11 @@ function enqueue_remainder_copy_to!(state::DataDepsState, dest_space::MemorySpac
306306
@dagdebug nothing :spawn_datadeps "($(repr(f)))[$(idx-1)][$dep_mod] Remainder copy-to has $(length(remainder_syncdeps)) syncdeps"
307307

308308
# Launch the remainder copy task
309+
ctx = Sch.eager_context()
310+
id = rand(UInt)
311+
@maybelog ctx timespan_start(ctx, :datadeps_copy, (;id), (;))
309312
copy_task = Dagger.@spawn scope=dest_scope exec_scope=dest_scope syncdeps=remainder_syncdeps meta=true Dagger.move!(remainder_aliasing, dest_space, source_space, arg_dest, arg_source)
313+
@maybelog ctx timespan_finish(ctx, :datadeps_copy, (;id), (;thunk_id=copy_task.uid, from_space=source_space, to_space=dest_space, arg_w, from_arg=arg_source, to_arg=arg_dest))
310314

311315
# This copy task becomes a new writer for the target region
312316
add_writer!(state, arg_w, dest_space, target_ainfo, copy_task, write_num)
@@ -351,7 +355,11 @@ function enqueue_remainder_copy_from!(state::DataDepsState, dest_space::MemorySp
351355
@dagdebug nothing :spawn_datadeps "($(typeof(arg_w.arg)))[$dep_mod] Remainder copy-from has $(length(remainder_syncdeps)) syncdeps"
352356

353357
# Launch the remainder copy task
358+
ctx = Sch.eager_context()
359+
id = rand(UInt)
360+
@maybelog ctx timespan_start(ctx, :datadeps_copy, (;id), (;))
354361
copy_task = Dagger.@spawn scope=dest_scope exec_scope=dest_scope syncdeps=remainder_syncdeps meta=true Dagger.move!(remainder_aliasing, dest_space, source_space, arg_dest, arg_source)
362+
@maybelog ctx timespan_finish(ctx, :datadeps_copy, (;id), (;thunk_id=copy_task.uid, from_space=source_space, to_space=dest_space, arg_w, from_arg=arg_source, to_arg=arg_dest))
355363

356364
# This copy task becomes a new writer for the target region
357365
add_writer!(state, arg_w, dest_space, target_ainfo, copy_task, write_num)
@@ -380,7 +388,11 @@ function enqueue_copy_to!(state::DataDepsState, dest_space::MemorySpace, arg_w::
380388
@dagdebug nothing :spawn_datadeps "($(repr(f)))[$(idx-1)][$dep_mod] Full copy-to has $(length(copy_syncdeps)) syncdeps"
381389

382390
# Launch the remainder copy task
391+
ctx = Sch.eager_context()
392+
id = rand(UInt)
393+
@maybelog ctx timespan_start(ctx, :datadeps_copy, (;id), (;))
383394
copy_task = Dagger.@spawn scope=dest_scope exec_scope=dest_scope syncdeps=copy_syncdeps meta=true Dagger.move!(dep_mod, dest_space, source_space, arg_dest, arg_source)
395+
@maybelog ctx timespan_finish(ctx, :datadeps_copy, (;id), (;thunk_id=copy_task.uid, from_space=source_space, to_space=dest_space, arg_w, from_arg=arg_source, to_arg=arg_dest))
384396

385397
# This copy task becomes a new writer for the target region
386398
add_writer!(state, arg_w, dest_space, target_ainfo, copy_task, write_num)
@@ -407,7 +419,11 @@ function enqueue_copy_from!(state::DataDepsState, dest_space::MemorySpace, arg_w
407419
@dagdebug nothing :spawn_datadeps "($(typeof(arg_w.arg)))[$dep_mod] Full copy-from has $(length(copy_syncdeps)) syncdeps"
408420

409421
# Launch the remainder copy task
422+
ctx = Sch.eager_context()
423+
id = rand(UInt)
424+
@maybelog ctx timespan_start(ctx, :datadeps_copy, (;id), (;))
410425
copy_task = Dagger.@spawn scope=dest_scope exec_scope=dest_scope syncdeps=copy_syncdeps meta=true Dagger.move!(dep_mod, dest_space, source_space, arg_dest, arg_source)
426+
@maybelog ctx timespan_finish(ctx, :datadeps_copy, (;id), (;thunk_id=copy_task.uid, from_space=source_space, to_space=dest_space, arg_w, from_arg=arg_source, to_arg=arg_dest))
411427

412428
# This copy task becomes a new writer for the target region
413429
add_writer!(state, arg_w, dest_space, target_ainfo, copy_task, write_num)

0 commit comments

Comments
 (0)