Skip to content

Commit f71a0cb

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 9b82c1d commit f71a0cb

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
@@ -716,12 +716,6 @@ ur_result_t ur_context_handle_t_::getAvailableCommandList(
716716
// command list is available for reuse.
717717
ur_result_t ur_result = UR_RESULT_ERROR_OUT_OF_RESOURCES;
718718

719-
// As a limitation of regular command list, when counter based events are used
720-
// the command list in the cache still has the potential of having events that
721-
// are still associated with another command list. We disable cache for
722-
// regular command list when counter based events are enabled to avoid race
723-
// condition.
724-
if (!Queue->CounterBasedEventsEnabled)
725719
// Initally, we need to check if a command list has already been created
726720
// on this device that is available for use. If so, then reuse that
727721
// 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
@@ -959,14 +959,14 @@ ur_queue_handle_t_::ur_queue_handle_t_(
959959
ZeCommandListBatchComputeConfig.startSize();
960960
CopyCommandBatch.QueueBatchSize = ZeCommandListBatchCopyConfig.startSize();
961961

962-
static const bool useDriverCounterBasedEvents = [] {
962+
static const bool useDriverCounterBasedEvents = [Device] {
963963
const char *UrRet = std::getenv("UR_L0_USE_DRIVER_COUNTER_BASED_EVENTS");
964-
if (!UrRet)
964+
if (!UrRet && Device->isPVC())
965965
return true;
966966
return std::atoi(UrRet) != 0;
967967
}();
968968
this->CounterBasedEventsEnabled =
969-
isInOrderQueue() && Device->useDriverInOrderLists() &&
969+
UsingImmCmdLists && isInOrderQueue() && Device->useDriverInOrderLists() &&
970970
useDriverCounterBasedEvents &&
971971
Device->Platform->ZeDriverEventPoolCountingEventsExtensionFound;
972972
}
@@ -1644,9 +1644,6 @@ ur_result_t ur_queue_handle_t_::executeOpenCommandList(bool IsCopy) {
16441644
ur_result_t ur_queue_handle_t_::resetCommandList(
16451645
ur_command_list_ptr_t CommandList, bool MakeAvailable,
16461646
std::vector<ur_event_handle_t> &EventListToCleanup, bool CheckStatus) {
1647-
bool CounterBasedEventsResetable = CounterBasedEventsEnabled &&
1648-
Device->useDriverInOrderLists() &&
1649-
isInOrderQueue() && !UsingImmCmdLists;
16501647
bool UseCopyEngine = CommandList->second.isCopy(this);
16511648

16521649
// Immediate commandlists do not have an associated fence.
@@ -1655,8 +1652,7 @@ ur_result_t ur_queue_handle_t_::resetCommandList(
16551652
// Reset the fence and put the command list into a cache for reuse in PI
16561653
// calls.
16571654
ZE2UR_CALL(zeFenceReset, (CommandList->second.ZeFence));
1658-
if (!CounterBasedEventsResetable)
1659-
ZE2UR_CALL(zeCommandListReset, (CommandList->first));
1655+
ZE2UR_CALL(zeCommandListReset, (CommandList->first));
16601656
CommandList->second.ZeFenceInUse = false;
16611657
CommandList->second.IsClosed = false;
16621658
}

0 commit comments

Comments
 (0)