20
20
21
21
extern size_t imageElementByteSize (hipArray_Format ArrayFormat);
22
22
23
- ur_result_t enqueueEventsWait (ur_queue_handle_t , hipStream_t Stream,
23
+ ur_result_t enqueueEventsWait (ur_queue_handle_t Queue , hipStream_t Stream,
24
24
uint32_t NumEventsInWaitList,
25
25
const ur_event_handle_t *EventWaitList) {
26
26
if (!EventWaitList) {
@@ -29,8 +29,8 @@ ur_result_t enqueueEventsWait(ur_queue_handle_t, hipStream_t Stream,
29
29
try {
30
30
auto Result = forLatestEvents (
31
31
EventWaitList, NumEventsInWaitList,
32
- [Stream](ur_event_handle_t Event) -> ur_result_t {
33
- ScopedContext Active (Event ->getDevice ());
32
+ [Stream, Queue ](ur_event_handle_t Event) -> ur_result_t {
33
+ ScopedContext Active (Queue ->getDevice ());
34
34
if (Event->isCompleted () || Event->getStream () == Stream) {
35
35
return UR_RESULT_SUCCESS;
36
36
} else {
@@ -218,8 +218,8 @@ 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->LastEventWritingToMemObj -> getDevice () != hQueue->getDevice ()) {
222
- Device = hBuffer->LastEventWritingToMemObj -> getDevice () ;
221
+ hBuffer->LastDeviceWritingToMemObj != hQueue->getDevice ()) {
222
+ Device = hBuffer->LastDeviceWritingToMemObj ;
223
223
ScopedContext Active (Device);
224
224
HIPStream = hipStream_t{0 }; // Default stream for different device
225
225
// We may have to wait for an event on another queue if it is the last
@@ -367,7 +367,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch(
367
367
// if it has been written to
368
368
if (phEvent && (MemArg.AccessFlags &
369
369
(UR_MEM_FLAG_READ_WRITE | UR_MEM_FLAG_WRITE_ONLY))) {
370
- MemArg.Mem ->setLastEventWritingToMemObj (RetImplEvent.get ());
370
+ MemArg.Mem ->setLastEventWritingToMemObj (RetImplEvent.get (),
371
+ hQueue->getDevice ());
371
372
}
372
373
}
373
374
// We can release the MemoryMigrationMutexes now
@@ -584,8 +585,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferReadRect(
584
585
// last queue to write to the MemBuffer, meaning we must perform the copy
585
586
// from a different device
586
587
if (hBuffer->LastEventWritingToMemObj &&
587
- hBuffer->LastEventWritingToMemObj -> getDevice () != hQueue->getDevice ()) {
588
- Device = hBuffer->LastEventWritingToMemObj -> getDevice () ;
588
+ hBuffer->LastDeviceWritingToMemObj != hQueue->getDevice ()) {
589
+ Device = hBuffer->LastDeviceWritingToMemObj ;
589
590
ScopedContext Active (Device);
590
591
HIPStream = hipStream_t{0 }; // Default stream for different device
591
592
// We may have to wait for an event on another queue if it is the last
@@ -1017,8 +1018,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageRead(
1017
1018
// last queue to write to the MemBuffer, meaning we must perform the copy
1018
1019
// from a different device
1019
1020
if (hImage->LastEventWritingToMemObj &&
1020
- hImage->LastEventWritingToMemObj -> getDevice () != hQueue->getDevice ()) {
1021
- Device = hImage->LastEventWritingToMemObj -> getDevice () ;
1021
+ hImage->LastDeviceWritingToMemObj != hQueue->getDevice ()) {
1022
+ Device = hImage->LastDeviceWritingToMemObj ;
1022
1023
ScopedContext Active (Device);
1023
1024
HIPStream = hipStream_t{0 }; // Default stream for different device
1024
1025
// We may have to wait for an event on another queue if it is the last
0 commit comments