Skip to content

Commit 9e6c5a5

Browse files
committed
Repeatedly attempt to fetch buffer from caching allocator
1 parent fba207f commit 9e6c5a5

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "AMDGPU"
22
uuid = "21141c5a-9bdb-4563-92ae-f87d6854732e"
33
authors = ["Julian P Samaroo <jpsamaroo@jpsamaroo.me>", "Valentin Churavy <v.churavy@gmail.com>", "Anton Smirnov <tonysmn97@gmail.com>"]
4-
version = "1.1.4"
4+
version = "1.1.5"
55

66
[deps]
77
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"

src/caching_allocator.jl

+8-4
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,15 @@ function alloc!(
4848
free_pool = get_free_pool(alloc, uid)
4949
isempty(free_pool) && return nothing
5050

51-
# @info "Cache hit"
5251
busy_pool = get_busy_pool(alloc, uid)
53-
x = pop!(free_pool)
54-
# Array was manually freed via `unsafe_free!`.
55-
x.buf.freed && return nothing
52+
x = nothing
53+
while !isempty(free_pool) && x nothing
54+
tmp = pop!(free_pool)
55+
# Array was manually freed via `unsafe_free!`.
56+
tmp.buf.freed && continue
57+
x = tmp
58+
end
59+
x nothing && return nothing
5660

5761
push!(busy_pool, x)
5862
return x

0 commit comments

Comments
 (0)