@@ -84,6 +84,7 @@ ur_exp_command_buffer_handle_t_::getSyncPoint(ur_event_handle_t event) {
84
84
throw UR_RESULT_ERROR_OUT_OF_RESOURCES;
85
85
}
86
86
syncPoints.push_back (event);
87
+ usedSyncPoints.push_back (false );
87
88
return static_cast <ur_exp_command_buffer_sync_point_t >(syncPoints.size () - 1 );
88
89
}
89
90
@@ -99,7 +100,7 @@ ur_event_handle_t *ur_exp_command_buffer_handle_t_::getWaitListFromSyncPoints(
99
100
UR_LOG (ERR, " Invalid sync point" );
100
101
throw UR_RESULT_ERROR_INVALID_VALUE;
101
102
}
102
- usedSyncPoints. insert ( pSyncPointWaitList[i]) ;
103
+ usedSyncPoints[ pSyncPointWaitList[i]] = true ;
103
104
syncPointWaitList[i] = syncPoints[pSyncPointWaitList[i]];
104
105
}
105
106
return syncPointWaitList.data ();
@@ -133,10 +134,13 @@ ur_result_t ur_exp_command_buffer_handle_t_::finalizeCommandBuffer() {
133
134
if (!isInOrder) {
134
135
ZE2UR_CALL (zeCommandListAppendBarrier,
135
136
(commandListLocked->getZeCommandList (), nullptr , 0 , nullptr ));
136
- for (auto &event : usedSyncPoints) {
137
- ZE2UR_CALL (zeCommandListAppendEventReset,
138
- (commandListLocked->getZeCommandList (),
139
- syncPoints[event]->getZeEvent ()));
137
+ for (size_t i = 0 ; i < usedSyncPoints.size (); ++i) {
138
+ if (!usedSyncPoints[i]) {
139
+ continue ;
140
+ }
141
+ ZE2UR_CALL (
142
+ zeCommandListAppendEventReset,
143
+ (commandListLocked->getZeCommandList (), syncPoints[i]->getZeEvent ()));
140
144
}
141
145
ZE2UR_CALL (zeCommandListAppendBarrier,
142
146
(commandListLocked->getZeCommandList (), nullptr , 0 , nullptr ));
0 commit comments