File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
unified-runtime/source/adapters/level_zero Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -434,9 +434,15 @@ ur_result_t ur_context_handle_t_::getFreeSlotInExistingOrNewPool(
434434 if (!ZePoolCache->empty ()) {
435435 if (NumEventsAvailableInEventPool[ZePoolCache->front ()] == 0 ) {
436436 if (DisableEventsCaching) {
437+ // Remove full pool from the cache if events caching is disabled.
438+ // also add pool to cleanup list to prevent leaks.
437439 ZePoolCleanupList.push_back (*ZePoolCache->begin ());
438440 ZePoolCache->erase (ZePoolCache->begin ());
439441 } else {
442+ // If event caching is enabled then we don't destroy events so there is
443+ // no need to remove pool from the cache and add it back when it has
444+ // available slots. Just keep it in the tail of the cache so that all
445+ // pools can be destroyed during context destruction.
440446 ZePoolCache->push_front (nullptr );
441447 }
442448 }
You can’t perform that action at this time.
0 commit comments