File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -698,7 +698,11 @@ function distribute_tasks!(queue::DataDepsTaskQueue)
698698 @assert our_proc in all_procs
699699 our_space = only(memory_spaces(our_proc))
700700 our_procs = filter(proc-> proc in all_procs, collect(processors(our_space)))
701- our_scope = UnionScope(map(ExactScope, our_procs). .. )
701+ task_scope = get(spec. options, :scope, AnyScope())
702+ our_scope = constrain(UnionScope(map(ExactScope, our_procs). .. ), task_scope)
703+ if our_scope isa InvalidScope
704+ throw(Sch. SchedulingException(" Scopes are not compatible: $(our_scope. x) , $(our_scope. y) " ))
705+ end
702706
703707 spec. f = move(ThreadProc(myid(), 1 ), our_proc, spec. f)
704708 @dagdebug nothing :spawn_datadeps " ($(repr(spec. f)) ) Scheduling: $our_proc ($our_space )"
Original file line number Diff line number Diff line change @@ -408,7 +408,7 @@ function test_datadeps(;args_chunks::Bool,
408408
409409 # FIXME : Deps
410410
411- # Scope
411+ # Outer Scope
412412 exec_procs = fetch.(Dagger. spawn_datadeps(;aliasing) do
413413 [Dagger. @spawn Dagger. task_processor() for i in 1 : 10 ]
414414 end )
@@ -424,6 +424,11 @@ function test_datadeps(;args_chunks::Bool,
424424 @test proc in exec_procs
425425 end
426426
427+ # Inner Scope
428+ @test_throws Dagger. Sch. SchedulingException Dagger. spawn_datadeps() do
429+ Dagger. @spawn scope= Dagger. ExactScope(Dagger. ThreadProc(1 , 5000 )) 1 + 1
430+ end
431+
427432 # Add-to-copy
428433 A = rand(1000 )
429434 B = rand(1000 )
You can’t perform that action at this time.
0 commit comments