diff --git a/Project.toml b/Project.toml index dbbe4c42..db3afc9b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "AMDGPU" uuid = "21141c5a-9bdb-4563-92ae-f87d6854732e" authors = ["Julian P Samaroo ", "Valentin Churavy ", "Anton Smirnov "] -version = "1.1.4" +version = "1.1.5" [deps] AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c" diff --git a/src/caching_allocator.jl b/src/caching_allocator.jl index 03880f44..716e0e1a 100644 --- a/src/caching_allocator.jl +++ b/src/caching_allocator.jl @@ -48,11 +48,15 @@ function alloc!( free_pool = get_free_pool(alloc, uid) isempty(free_pool) && return nothing - # @info "Cache hit" busy_pool = get_busy_pool(alloc, uid) - x = pop!(free_pool) - # Array was manually freed via `unsafe_free!`. - x.buf.freed && return nothing + x = nothing + while !isempty(free_pool) && x ≡ nothing + tmp = pop!(free_pool) + # Array was manually freed via `unsafe_free!`. + tmp.buf.freed && continue + x = tmp + end + x ≡ nothing && return nothing push!(busy_pool, x) return x