Skip to content

Commit 3717982

Browse files
committed
GraphVizExt, TaskDependencies: Various fixes
1 parent ce80375 commit 3717982

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

ext/GraphVizExt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ end
99
import Dagger
1010
import Dagger: EagerThunk, Chunk, Processor
1111
import Dagger.TimespanLogging: Timespan
12-
import Graphs: SimpleDiGraph, add_edge!, add_vertex!, inneighbors, outneighbors, vertices, is_directed, edges, nv
12+
import Graphs: SimpleDiGraph, add_edge!, add_vertex!, inneighbors, outneighbors, vertices, is_directed, edges, nv, src, dst
1313

1414
function pretty_time(t; digits=3)
1515
r(t) = round(t; digits)

src/sch/dynamic.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ struct ThunkID
77
ref::Union{DRef,Nothing}
88
end
99
ThunkID(id::Int) = ThunkID(id, nothing)
10+
Dagger.istask(::ThunkID) = true
1011

1112
"A handle to the scheduler, used by dynamic thunks."
1213
struct SchedulerHandle

src/utils/logging-events.jl

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,20 +181,27 @@ Records the dependencies of each submitted task.
181181
"""
182182
struct TaskDependencies end
183183
function (::TaskDependencies)(ev::Event{:start})
184-
if ev.category == :add_thunk
185-
deps = Int[]
186-
for dep in get(Set, ev.timeline.options, :syncdeps)
184+
local deps_tids::Vector{Int}
185+
function get_deps!(deps)
186+
for dep in deps
187187
dep = Dagger.unwrap_weak_checked(dep)
188188
if dep isa Dagger.Thunk || dep isa Dagger.Sch.ThunkID
189-
push!(deps, dep.id)
190-
elseif dep isa Dagger.EagerThunk
191-
# FIXME: Get TID
192-
#push!(deps, dep.uid)
189+
push!(deps_tids, dep.id)
190+
elseif dep isa Dagger.EagerThunk && myid() == 1
191+
tid = lock(Dagger.Sch.EAGER_ID_MAP) do id_map
192+
id_map[dep.uid]
193+
end
194+
push!(deps_tids, tid)
193195
else
194196
@warn "Unexpected dependency type: $dep"
195197
end
196198
end
197-
return ev.id.thunk_id => deps
199+
end
200+
if ev.category == :add_thunk
201+
deps_tids = Int[]
202+
get_deps!(Iterators.filter(Dagger.istask, Iterators.map(last, ev.timeline.args)))
203+
get_deps!(get(Set, ev.timeline.options, :syncdeps))
204+
return ev.id.thunk_id => deps_tids
198205
end
199206
return
200207
end

0 commit comments

Comments
 (0)