File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed 
unified-runtime/source/adapters/level_zero/v2 Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -131,19 +131,24 @@ ur_result_t ur_exp_command_buffer_handle_t_::finalizeCommandBuffer() {
131131  auto  commandListLocked = commandListManager.lock ();
132132  UR_ASSERT (!isFinalized, UR_RESULT_ERROR_INVALID_OPERATION);
133133
134+   size_t  numEventResets = 0 ;
135+ 
134136  if  (!isInOrder) {
135137    ZE2UR_CALL (zeCommandListAppendBarrier,
136138               (commandListLocked->getZeCommandList (), nullptr , 0 , nullptr ));
137139    for  (size_t  i = 0 ; i < usedSyncPoints.size (); ++i) {
138140      if  (!usedSyncPoints[i]) {
139141        continue ;
140142      }
143+       ++numEventResets;
141144      ZE2UR_CALL (
142145          zeCommandListAppendEventReset,
143146          (commandListLocked->getZeCommandList (), syncPoints[i]->getZeEvent ()));
144147    }
145-     ZE2UR_CALL (zeCommandListAppendBarrier,
146-                (commandListLocked->getZeCommandList (), nullptr , 0 , nullptr ));
148+ 
149+     if  (numEventResets)
150+       ZE2UR_CALL (zeCommandListAppendBarrier,
151+                       (commandListLocked->getZeCommandList (), nullptr , 0 , nullptr ));
147152  }
148153  //  Close the command lists and have them ready for dispatch.
149154  ZE2UR_CALL (zeCommandListClose, (commandListLocked->getZeCommandList ()));
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments