@@ -897,7 +897,7 @@ _pi_queue::resetCommandList(pi_command_list_ptr_t CommandList,
897
897
// calls.
898
898
ZE_CALL (zeFenceReset, (CommandList->second .ZeFence ));
899
899
ZE_CALL (zeCommandListReset, (CommandList->first ));
900
- CommandList->second .InUse = false ;
900
+ CommandList->second .ZeFenceInUse = false ;
901
901
}
902
902
903
903
auto &EventList = CommandList->second .EventList ;
@@ -1140,8 +1140,8 @@ pi_result resetCommandLists(pi_queue Queue) {
1140
1140
for (auto &&it = Queue->CommandListMap .begin ();
1141
1141
it != Queue->CommandListMap .end (); ++it) {
1142
1142
// It is possible that the fence was already noted as signalled and
1143
- // reset. In that case the InUse flag will be false.
1144
- if (it->second .InUse ) {
1143
+ // reset. In that case the ZeFenceInUse flag will be false.
1144
+ if (it->second .ZeFence != nullptr && it-> second . ZeFenceInUse ) {
1145
1145
ze_result_t ZeResult =
1146
1146
ZE_CALL_NOCHECK (zeFenceQueryStatus, (it->second .ZeFence ));
1147
1147
if (ZeResult == ZE_RESULT_SUCCESS) {
@@ -1220,7 +1220,8 @@ _pi_context::getAvailableCommandList(pi_queue Queue,
1220
1220
auto it = Queue->CommandListMap .find (ZeCommandList);
1221
1221
if (it != Queue->CommandListMap .end ()) {
1222
1222
CommandList = it;
1223
- CommandList->second .InUse = true ;
1223
+ if (CommandList->second .ZeFence != nullptr )
1224
+ CommandList->second .ZeFenceInUse = true ;
1224
1225
} else {
1225
1226
// If there is a command list available on this context, but it
1226
1227
// wasn't yet used in this queue then create a new entry in this
@@ -3360,7 +3361,7 @@ pi_result piQueueRelease(pi_queue Queue) {
3360
3361
// For immediate commandlists we don't need to do an L0 reset of the
3361
3362
// commandlist but do need to do event cleanup which is also in the
3362
3363
// resetCommandList function.
3363
- if (it->second .InUse ) {
3364
+ if (it->second .ZeFence != nullptr && it-> second . ZeFenceInUse ) {
3364
3365
Queue->resetCommandList (it, true , EventListToCleanup);
3365
3366
}
3366
3367
// TODO: remove "if" when the problem is fixed in the level zero
0 commit comments