Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add caching allocator interface #576

Merged
merged 28 commits into from
Jan 9, 2025
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update src/host/alloc_cache.jl
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and maleadt committed Jan 9, 2025
commit 36ced8346987fd442466adccfc7f333fab75c150
8 changes: 5 additions & 3 deletions src/host/alloc_cache.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ mutable struct AllocCache{T <: AbstractGPUArray}
free::Dict{UInt64, Vector{T}}

function AllocCache(::Type{T}) where {T <: AbstractGPUArray}
cache = new{T}(ReentrantLock(),
cache = new{T}(
ReentrantLock(),
Dict{UInt64, Vector{T}}(),
Dict{UInt64, Vector{T}}())
finalizer(unsafe_free!, cache)
Dict{UInt64, Vector{T}}()
)
return finalizer(unsafe_free!, cache)
end
end

Expand Down