-
Notifications
You must be signed in to change notification settings - Fork 768
[UR][L0 v2] Port USM alloc to adapter v2 #18179
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
base: sycl
Are you sure you want to change the base?
Conversation
unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.cpp
Outdated
Show resolved
Hide resolved
unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.cpp
Outdated
Show resolved
Hide resolved
unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.cpp
Outdated
Show resolved
Hide resolved
8fc9615
to
4ac080d
Compare
unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.cpp
Outdated
Show resolved
Hide resolved
a25c7e7
to
803bf54
Compare
@staniewzki please also enable llvm tests for v2: https://github.com/intel/llvm/blob/sycl/sycl/test-e2e/AsyncAlloc/lit.local.cfg |
803bf54
to
ed39eb4
Compare
@@ -150,6 +150,8 @@ ur_result_t ur_queue_immediate_in_order_t::queueGetNativeHandle( | |||
ur_result_t ur_queue_immediate_in_order_t::queueFinish() { | |||
TRACK_SCOPE_LATENCY("ur_queue_immediate_in_order_t::queueFinish"); | |||
|
|||
hContext->getAsyncPool()->cleanupPoolsForQueue(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm considering the following scenario: enqueueAlloc->enqueue(Kernel/USMFill)->enqueueFree->queueFinish
.
In this case, enqueueFree
immediately places the allocation into the freelist along with the associated free event handle. When enqueueAlloc
retrieves the allocation from the freelist, it correctly appends a wait on the related free event, so that part works as expected.
But, during queueFinish
, the freelist cleanup starts before any synchronization occurs, which may free allocations that are still in use. I think we haven’t seen test failures because the allocations are returned to the UMF pool, which doesn’t release the memory immediately.
Maybe we should move the cleanup after ZE2UR_CALL(zeCommandListHostSynchronize, (commandListLocked->getZeCommandList(), UINT64_MAX));
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! :D We need to fix this in L0v1 as well (and cherry-pick this to xmain-rel).
ed39eb4
to
bcde052
Compare
bcde052
to
80ab937
Compare
80ab937
to
a4e8e50
Compare
This PR ports USM alloc enqueue API introduced to L0 adapter in #17112 to L0 adapter v2.