Skip to content

Commit fcff991

Browse files
committed
Sch: Allow occupancy key to be Any
1 parent ebdfda4 commit fcff991

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/sch/util.jl

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -406,12 +406,19 @@ function has_capacity(state, p, gp, time_util, alloc_util, occupancy, sig)
406406
else
407407
get(state.signature_alloc_cost, sig, UInt64(0))
408408
end::UInt64
409-
est_occupancy = if occupancy !== nothing && haskey(occupancy, T)
410-
# Clamp to 0-1, and scale between 0 and `typemax(UInt32)`
411-
Base.unsafe_trunc(UInt32, clamp(occupancy[T], 0, 1) * typemax(UInt32))
412-
else
413-
typemax(UInt32)
414-
end::UInt32
409+
est_occupancy::UInt32 = typemax(UInt32)
410+
if occupancy !== nothing
411+
occ = nothing
412+
if haskey(occupancy, T)
413+
occ = occupancy[T]
414+
elseif haskey(occupancy, Any)
415+
occ = occupancy[Any]
416+
end
417+
if occ !== nothing
418+
# Clamp to 0-1, and scale between 0 and `typemax(UInt32)`
419+
est_occupancy = Base.unsafe_trunc(UInt32, clamp(occ, 0, 1) * typemax(UInt32))
420+
end
421+
end
415422
#= FIXME: Estimate if cached data can be swapped to storage
416423
storage = storage_resource(p)
417424
real_alloc_util = state.worker_storage_pressure[gp][storage]

0 commit comments

Comments
 (0)