We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 64482de commit b6bf8daCopy full SHA for b6bf8da
src/host/alloc_cache.jl
@@ -33,15 +33,15 @@ end
33
function cached_alloc(f, key)
34
cache = ALLOC_CACHE[]
35
if cache === nothing
36
- return f()
+ return f()::AbstractGPUArray
37
end
38
39
x = nothing
40
uid = hash(key)
41
42
busy_pool = get_pool!(cache, :busy, uid)
43
free_pool = get_pool!(cache, :free, uid)
44
- isempty(free_pool) && (x = f())
+ isempty(free_pool) && (x = f()::AbstractGPUArray)
45
46
while !isempty(free_pool) && x ≡ nothing
47
tmp = Base.@lock cache.lock pop!(free_pool)
@@ -50,7 +50,7 @@ function cached_alloc(f, key)
50
x = tmp
51
52
53
- x ≡ nothing && (x = f())
+ x ≡ nothing && (x = f()::AbstractGPUArray)
54
Base.@lock cache.lock push!(busy_pool, x)
55
return x
56
0 commit comments