@@ -4824,9 +4824,7 @@ pi_result piEnqueueMemBufferMap(pi_queue Queue, pi_mem Buffer,
4824
4824
{
4825
4825
// Lock automatically releases when this goes out of scope.
4826
4826
std::lock_guard<std::mutex> lock (Queue->PiQueueMutex );
4827
- if (Queue->LastCommandEvent != nullptr ) {
4828
- TmpLastCommandEvent = Queue->LastCommandEvent ;
4829
- }
4827
+ TmpLastCommandEvent = Queue->LastCommandEvent ;
4830
4828
}
4831
4829
4832
4830
if (TmpLastCommandEvent != nullptr ) {
@@ -4842,12 +4840,6 @@ pi_result piEnqueueMemBufferMap(pi_queue Queue, pi_mem Buffer,
4842
4840
*RetMap = pi_cast<char *>(Buffer->getZeHandle ()) + Offset;
4843
4841
}
4844
4842
4845
- {
4846
- // Lock automatically releases when this goes out of scope.
4847
- std::lock_guard<std::mutex> lock (Queue->PiQueueMutex );
4848
- Queue->LastCommandEvent = *Event;
4849
- }
4850
-
4851
4843
// Signal this event
4852
4844
ZE_CALL (zeEventHostSignal, (ZeEvent));
4853
4845
@@ -4950,30 +4942,24 @@ pi_result piEnqueueMemUnmap(pi_queue Queue, pi_mem MemObj, void *MappedPtr,
4950
4942
// Wait on incoming events before doing the copy
4951
4943
PI_CALL (piEventsWait (NumEventsInWaitList, EventWaitList));
4952
4944
4953
- if (Queue->isInOrderQueue ()) {
4954
- pi_event TmpLastCommandEvent = nullptr ;
4955
- {
4956
- // Lock automatically releases when this goes out of scope.
4957
- std::lock_guard<std::mutex> lock (Queue-> PiQueueMutex );
4958
- if (Queue->LastCommandEvent != nullptr ) {
4959
- TmpLastCommandEvent = Queue->LastCommandEvent ;
4960
- }
4961
- }
4962
- if (TmpLastCommandEvent != nullptr ) {
4945
+ if (Queue->isInOrderQueue ()) {
4946
+ pi_event TmpLastCommandEvent = nullptr ;
4947
+
4948
+ {
4949
+ // Lock automatically releases when this goes out of scope.
4950
+ std::lock_guard<std::mutex> lock (Queue->PiQueueMutex );
4951
+ TmpLastCommandEvent = Queue->LastCommandEvent ;
4952
+ }
4953
+
4954
+ if (TmpLastCommandEvent != nullptr ) {
4963
4955
PI_CALL (piEventsWait (1 , &TmpLastCommandEvent));
4964
- }
4965
4956
}
4957
+ }
4966
4958
4967
4959
if (MemObj->MapHostPtr )
4968
4960
memcpy (pi_cast<char *>(MemObj->getZeHandle ()) + MapInfo.Offset , MappedPtr,
4969
4961
MapInfo.Size );
4970
4962
4971
- {
4972
- // Lock automatically releases when this goes out of scope.
4973
- std::lock_guard<std::mutex> lock (Queue->PiQueueMutex );
4974
- Queue->LastCommandEvent = *Event;
4975
- }
4976
-
4977
4963
// Signal this event
4978
4964
ZE_CALL (zeEventHostSignal, (ZeEvent));
4979
4965
0 commit comments