Skip to content

Commit 7c07a62

Browse files
authored
Don't evict memory before freeing it. (#459)
Memory eviction is not queue ordered, so unsafe to perform here. But it's probably not needed as we're freeing the memory anyway. This was triggered by the recent resize implementation, which frees quickly after issueing a copy operation.
1 parent b1ba771 commit 7c07a62

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/pool.jl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,17 @@ end
5555
function release(buf::oneL0.AbstractBuffer)
5656
sizeof(buf) == 0 && return
5757

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

6470
free(buf; policy=oneL0.ZE_DRIVER_MEMORY_FREE_POLICY_EXT_FLAG_BLOCKING_FREE)
6571

0 commit comments

Comments
 (0)