Skip to content

Force reschedule in adjust_pressure! #284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/sch/eager.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ function init_eager()
end
end

"Adjusts the scheduler's cached pressure indicator for the specified worker by
the specified amount."
"Adjusts the scheduler's cached pressure indicators for the specified worker by
the specified amount, and signals the scheduler to try scheduling again if
pressure decreased."
function adjust_pressure!(h::SchedulerHandle, proc::Processor, pressure)
uid = Dagger.get_tls().sch_uid
lock(TASK_SYNC) do
Expand All @@ -44,6 +45,9 @@ function adjust_pressure!(h::SchedulerHandle, proc::Processor, pressure)
end
function _adjust_pressure!(ctx, state, task, tid, (pid, proc, pressure))
state.worker_pressure[pid][proc] += pressure
if pressure < 0
put!(state.chan, RescheduleSignal())
end
nothing
end

Expand Down
8 changes: 8 additions & 0 deletions test/thunk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,12 @@ end
@test a.f.scope isa NodeScope
end
end
@testset "parent fetch child, one thread" begin
# Issue #282

s = p -> p == Dagger.ThreadProc(1, 1)
f = (x) -> 10 + x
g = (x) -> fetch(Dagger.spawn(f, x; proclist=s))
fetch(Dagger.spawn(g, 10; proclist=s))
end
end