Skip to content

Commit

Permalink
Repeatedly attempt to fetch buffer from caching allocator
Browse files Browse the repository at this point in the history
  • Loading branch information
pxl-th committed Dec 7, 2024
1 parent fba207f commit 9e6c5a5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "AMDGPU"
uuid = "21141c5a-9bdb-4563-92ae-f87d6854732e"
authors = ["Julian P Samaroo <[email protected]>", "Valentin Churavy <[email protected]>", "Anton Smirnov <[email protected]>"]
version = "1.1.4"
version = "1.1.5"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
Expand Down
12 changes: 8 additions & 4 deletions src/caching_allocator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

2 comments on commit 9e6c5a5

@pxl-th
Copy link
Member Author

@pxl-th pxl-th commented on 9e6c5a5 Dec 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/120877

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.1.5 -m "<description of version>" 9e6c5a50a34ca04297deabddf7666cb1ed0016fa
git push origin v1.1.5

Please sign in to comment.