@@ -218,8 +218,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferRead(
218
218
// last queue to write to the MemBuffer, meaning we must perform the copy
219
219
// from a different device
220
220
if (hBuffer->LastEventWritingToMemObj &&
221
- hBuffer->LastDeviceWritingToMemObj != hQueue->getDevice ()) {
222
- Device = hBuffer->LastDeviceWritingToMemObj ;
221
+ hBuffer->LastEventWritingToMemObj ->getQueue ()->getDevice () !=
222
+ hQueue->getDevice ()) {
223
+ Device = hBuffer->LastEventWritingToMemObj ->getQueue ()->getDevice ();
223
224
ScopedContext Active (Device);
224
225
HIPStream = hipStream_t{0 }; // Default stream for different device
225
226
// We may have to wait for an event on another queue if it is the last
@@ -367,8 +368,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch(
367
368
// if it has been written to
368
369
if (phEvent && (MemArg.AccessFlags &
369
370
(UR_MEM_FLAG_READ_WRITE | UR_MEM_FLAG_WRITE_ONLY))) {
370
- MemArg.Mem ->setLastEventWritingToMemObj (RetImplEvent.get (),
371
- hQueue->getDevice ());
371
+ MemArg.Mem ->setLastEventWritingToMemObj (RetImplEvent.get ());
372
372
}
373
373
}
374
374
// We can release the MemoryMigrationMutexes now
@@ -585,8 +585,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferReadRect(
585
585
// last queue to write to the MemBuffer, meaning we must perform the copy
586
586
// from a different device
587
587
if (hBuffer->LastEventWritingToMemObj &&
588
- hBuffer->LastDeviceWritingToMemObj != hQueue->getDevice ()) {
589
- Device = hBuffer->LastDeviceWritingToMemObj ;
588
+ hBuffer->LastEventWritingToMemObj ->getQueue ()->getDevice () !=
589
+ hQueue->getDevice ()) {
590
+ Device = hBuffer->LastEventWritingToMemObj ->getQueue ()->getDevice ();
590
591
ScopedContext Active (Device);
591
592
HIPStream = hipStream_t{0 }; // Default stream for different device
592
593
// We may have to wait for an event on another queue if it is the last
@@ -1018,8 +1019,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageRead(
1018
1019
// last queue to write to the MemBuffer, meaning we must perform the copy
1019
1020
// from a different device
1020
1021
if (hImage->LastEventWritingToMemObj &&
1021
- hImage->LastDeviceWritingToMemObj != hQueue->getDevice ()) {
1022
- Device = hImage->LastDeviceWritingToMemObj ;
1022
+ hImage->LastEventWritingToMemObj ->getQueue ()->getDevice () !=
1023
+ hQueue->getDevice ()) {
1024
+ Device = hImage->LastEventWritingToMemObj ->getQueue ()->getDevice ();
1023
1025
ScopedContext Active (Device);
1024
1026
HIPStream = hipStream_t{0 }; // Default stream for different device
1025
1027
// We may have to wait for an event on another queue if it is the last
0 commit comments