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

Don't evict memory before freeing it. #459

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Changes from all commits
Commits
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
16 changes: 11 additions & 5 deletions src/pool.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,17 @@ end
function release(buf::oneL0.AbstractBuffer)
sizeof(buf) == 0 && return

if buf isa oneL0.DeviceBuffer || buf isa oneL0.SharedBuffer
ctx = oneL0.context(buf)
dev = oneL0.device(buf)
evict(ctx, dev, buf)
end
# XXX: is it necessary to evice memory if we are going to free it?
# this is racy, because eviction is not queue-ordered, and
# we don't want to synchronize inside what could have been a
# GC-driven finalizer. if we need to, port the stream/queue
# tracking from CUDA.jl so that we can synchronize only the
# queue that's associated with the buffer.
#if buf isa oneL0.DeviceBuffer || buf isa oneL0.SharedBuffer
# ctx = oneL0.context(buf)
# dev = oneL0.device(buf)
# evict(ctx, dev, buf)
#end

free(buf; policy=oneL0.ZE_DRIVER_MEMORY_FREE_POLICY_EXT_FLAG_BLOCKING_FREE)

Expand Down