Skip to content

[UR][L0][L0v2] Remove redundant cleanup from async alloc #19473

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

Merged
merged 1 commit into from
Jul 16, 2025
Merged
Show file tree
Hide file tree
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
15 changes: 4 additions & 11 deletions unified-runtime/source/adapters/level_zero/usm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1230,17 +1230,10 @@ ur_result_t ur_usm_pool_handle_t_::allocate(ur_context_handle_t Context,

*RetMem = umfPoolAlignedMalloc(UmfPool, Size, Alignment);
if (*RetMem == nullptr) {
if (Pool->AsyncPool.cleanup()) { // true means that objects were deallocated
// let's try again
*RetMem = umfPoolAlignedMalloc(UmfPool, Size, Alignment);
}
if (*RetMem == nullptr) {
auto UmfRet = umfPoolGetLastAllocationError(UmfPool);
UR_LOG(ERR,
"enqueueUSMAllocHelper: allocation from the UMF pool {} failed",
UmfPool);
return umf::umf2urResult(UmfRet);
}
auto UmfRet = umfPoolGetLastAllocationError(UmfPool);
UR_LOG(ERR, "enqueueUSMAllocHelper: allocation from the UMF pool {} failed",
UmfPool);
return umf::umf2urResult(UmfRet);
}

if (IndirectAccessTrackingEnabled) {
Expand Down
10 changes: 2 additions & 8 deletions unified-runtime/source/adapters/level_zero/v2/usm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,8 @@ ur_result_t ur_usm_pool_handle_t_::allocate(

*ppRetMem = umfPoolAlignedMalloc(umfPool, size, alignment);
if (*ppRetMem == nullptr) {
if (pool->asyncPool.cleanup()) { // true means that objects were deallocated
// let's try again
*ppRetMem = umfPoolAlignedMalloc(umfPool, size, alignment);
}
if (*ppRetMem == nullptr) {
auto umfRet = umfPoolGetLastAllocationError(umfPool);
return umf::umf2urResult(umfRet);
}
auto umfRet = umfPoolGetLastAllocationError(umfPool);
return umf::umf2urResult(umfRet);
}

return UR_RESULT_SUCCESS;
Expand Down
Loading