Skip to content

Commit b54e7f1

Browse files
[L0] Enable CB events only on PVC+ and immCmdLists
Now counter based events will be enabled by default only on PVC+, and only enabled for immCmdLists. Signed-off-by: Zhang, Winston <[email protected]>
1 parent a5427a2 commit b54e7f1

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

source/adapters/level_zero/context.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -697,12 +697,6 @@ ur_result_t ur_context_handle_t_::getAvailableCommandList(
697697
// command list is available for reuse.
698698
ur_result_t ur_result = UR_RESULT_ERROR_OUT_OF_RESOURCES;
699699

700-
// As a limitation of regular command list, when counter based events are used
701-
// the command list in the cache still has the potential of having events that
702-
// are still associated with another command list. We disable cache for
703-
// regular command list when counter based events are enabled to avoid race
704-
// condition.
705-
if (!Queue->CounterBasedEventsEnabled)
706700
// Initally, we need to check if a command list has already been created
707701
// on this device that is available for use. If so, then reuse that
708702
// Level-Zero Command List and Fence for this PI call.

source/adapters/level_zero/queue.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,14 +1168,14 @@ ur_queue_handle_t_::ur_queue_handle_t_(
11681168
ZeCommandListBatchComputeConfig.startSize();
11691169
CopyCommandBatch.QueueBatchSize = ZeCommandListBatchCopyConfig.startSize();
11701170

1171-
static const bool useDriverCounterBasedEvents = [] {
1171+
static const bool useDriverCounterBasedEvents = [Device] {
11721172
const char *UrRet = std::getenv("UR_L0_USE_DRIVER_COUNTER_BASED_EVENTS");
1173-
if (!UrRet)
1173+
if (!UrRet && Device->isPVC())
11741174
return true;
11751175
return std::atoi(UrRet) != 0;
11761176
}();
11771177
this->CounterBasedEventsEnabled =
1178-
isInOrderQueue() && Device->useDriverInOrderLists() &&
1178+
UsingImmCmdLists && isInOrderQueue() && Device->useDriverInOrderLists() &&
11791179
useDriverCounterBasedEvents &&
11801180
Device->Platform->ZeDriverEventPoolCountingEventsExtensionFound;
11811181
}
@@ -1872,9 +1872,6 @@ ur_result_t ur_queue_handle_t_::executeOpenCommandList(bool IsCopy) {
18721872
ur_result_t ur_queue_handle_t_::resetCommandList(
18731873
ur_command_list_ptr_t CommandList, bool MakeAvailable,
18741874
std::vector<ur_event_handle_t> &EventListToCleanup, bool CheckStatus) {
1875-
bool CounterBasedEventsResetable = CounterBasedEventsEnabled &&
1876-
Device->useDriverInOrderLists() &&
1877-
isInOrderQueue() && !UsingImmCmdLists;
18781875
bool UseCopyEngine = CommandList->second.isCopy(this);
18791876

18801877
// Immediate commandlists do not have an associated fence.
@@ -1883,8 +1880,7 @@ ur_result_t ur_queue_handle_t_::resetCommandList(
18831880
// Reset the fence and put the command list into a cache for reuse in PI
18841881
// calls.
18851882
ZE2UR_CALL(zeFenceReset, (CommandList->second.ZeFence));
1886-
if (!CounterBasedEventsResetable)
1887-
ZE2UR_CALL(zeCommandListReset, (CommandList->first));
1883+
ZE2UR_CALL(zeCommandListReset, (CommandList->first));
18881884
CommandList->second.ZeFenceInUse = false;
18891885
CommandList->second.IsClosed = false;
18901886
}

0 commit comments

Comments
 (0)