@@ -1307,8 +1307,9 @@ ur_result_t UR_APICALL urEnqueueUSMFill(
1307
1307
auto pfnUSMFill = getContext ()->urDdiTable .Enqueue .pfnUSMFill ;
1308
1308
getContext ()->logger .debug (" ==== urEnqueueUSMFill" );
1309
1309
1310
+ ur_event_handle_t hEvent = nullptr ;
1310
1311
UR_CALL (pfnUSMFill (hQueue, pMem, patternSize, pPattern, size,
1311
- numEventsInWaitList, phEventWaitList, phEvent ));
1312
+ numEventsInWaitList, phEventWaitList, &hEvent ));
1312
1313
1313
1314
const auto Mem = (uptr)pMem;
1314
1315
auto MemInfoItOp = getMsanInterceptor ()->findAllocInfoByAddress (Mem);
@@ -1319,8 +1320,13 @@ ur_result_t UR_APICALL urEnqueueUSMFill(
1319
1320
getMsanInterceptor ()->getDeviceInfo (MemInfo->Device );
1320
1321
const auto MemShadow = DeviceInfo->Shadow ->MemToShadow (Mem);
1321
1322
1322
- UR_CALL (EnqueueUSMBlockingSet (hQueue, (void *)MemShadow, 0 , size,
1323
- phEvent ? 1 : 0 , phEvent, phEvent));
1323
+ const ur_event_handle_t hEventWait = hEvent;
1324
+ UR_CALL (EnqueueUSMBlockingSet (hQueue, (void *)MemShadow, 0 , size, 1 ,
1325
+ &hEventWait, &hEvent));
1326
+ }
1327
+
1328
+ if (phEvent) {
1329
+ *phEvent = hEvent;
1324
1330
}
1325
1331
1326
1332
return UR_RESULT_SUCCESS;
@@ -1350,8 +1356,9 @@ ur_result_t UR_APICALL urEnqueueUSMMemcpy(
1350
1356
auto pfnUSMMemcpy = getContext ()->urDdiTable .Enqueue .pfnUSMMemcpy ;
1351
1357
getContext ()->logger .debug (" ==== pfnUSMMemcpy" );
1352
1358
1359
+ ur_event_handle_t hEvent = nullptr ;
1353
1360
UR_CALL (pfnUSMMemcpy (hQueue, blocking, pDst, pSrc, size,
1354
- numEventsInWaitList, phEventWaitList, phEvent ));
1361
+ numEventsInWaitList, phEventWaitList, &hEvent ));
1355
1362
1356
1363
const auto Src = (uptr)pSrc, Dst = (uptr)pDst;
1357
1364
auto SrcInfoItOp = getMsanInterceptor ()->findAllocInfoByAddress (Src);
@@ -1366,18 +1373,23 @@ ur_result_t UR_APICALL urEnqueueUSMMemcpy(
1366
1373
const auto SrcShadow = DeviceInfo->Shadow ->MemToShadow (Src);
1367
1374
const auto DstShadow = DeviceInfo->Shadow ->MemToShadow (Dst);
1368
1375
1376
+ const ur_event_handle_t hEventWait = hEvent;
1369
1377
UR_CALL (pfnUSMMemcpy (hQueue, blocking, (void *)DstShadow,
1370
- (void *)SrcShadow, size, phEvent ? 1 : 0 , phEvent,
1371
- phEvent));
1378
+ (void *)SrcShadow, size, 1 , &hEventWait, &hEvent));
1372
1379
} else if (DstInfoItOp) {
1373
1380
auto DstInfo = (*DstInfoItOp)->second ;
1374
1381
1375
1382
const auto &DeviceInfo =
1376
1383
getMsanInterceptor ()->getDeviceInfo (DstInfo->Device );
1377
1384
auto DstShadow = DeviceInfo->Shadow ->MemToShadow (Dst);
1378
1385
1379
- UR_CALL (EnqueueUSMBlockingSet (hQueue, (void *)DstShadow, 0 , size,
1380
- phEvent ? 1 : 0 , phEvent, phEvent));
1386
+ const ur_event_handle_t hEventWait = hEvent;
1387
+ UR_CALL (EnqueueUSMBlockingSet (hQueue, (void *)DstShadow, 0 , size, 1 ,
1388
+ &hEventWait, &hEvent));
1389
+ }
1390
+
1391
+ if (phEvent) {
1392
+ *phEvent = hEvent;
1381
1393
}
1382
1394
1383
1395
return UR_RESULT_SUCCESS;
@@ -1413,9 +1425,10 @@ ur_result_t UR_APICALL urEnqueueUSMFill2D(
1413
1425
auto pfnUSMFill2D = getContext ()->urDdiTable .Enqueue .pfnUSMFill2D ;
1414
1426
getContext ()->logger .debug (" ==== urEnqueueUSMFill2D" );
1415
1427
1428
+ ur_event_handle_t hEvent = nullptr ;
1416
1429
UR_CALL (pfnUSMFill2D (hQueue, pMem, pitch, patternSize, pPattern, width,
1417
1430
height, numEventsInWaitList, phEventWaitList,
1418
- phEvent ));
1431
+ &hEvent ));
1419
1432
1420
1433
const auto Mem = (uptr)pMem;
1421
1434
auto MemInfoItOp = getMsanInterceptor ()->findAllocInfoByAddress (Mem);
@@ -1427,8 +1440,13 @@ ur_result_t UR_APICALL urEnqueueUSMFill2D(
1427
1440
const auto MemShadow = DeviceInfo->Shadow ->MemToShadow (Mem);
1428
1441
1429
1442
const char Pattern = 0 ;
1443
+ const ur_event_handle_t hEventWait = hEvent;
1430
1444
UR_CALL (pfnUSMFill2D (hQueue, (void *)MemShadow, pitch, 1 , &Pattern,
1431
- width, height, phEvent ? 1 : 0 , phEvent, phEvent));
1445
+ width, height, 1 , &hEventWait, &hEvent));
1446
+ }
1447
+
1448
+ if (phEvent) {
1449
+ *phEvent = hEvent;
1432
1450
}
1433
1451
1434
1452
return UR_RESULT_SUCCESS;
@@ -1463,11 +1481,12 @@ ur_result_t UR_APICALL urEnqueueUSMMemcpy2D(
1463
1481
auto pfnUSMMemcpy2D = getContext ()->urDdiTable .Enqueue .pfnUSMMemcpy2D ;
1464
1482
getContext ()->logger .debug (" ==== pfnUSMMemcpy2D" );
1465
1483
1484
+ ur_event_handle_t hEvent = nullptr ;
1466
1485
UR_CALL (pfnUSMMemcpy2D (hQueue, blocking, pDst, dstPitch, pSrc, srcPitch,
1467
1486
width, height, numEventsInWaitList, phEventWaitList,
1468
- phEvent ));
1487
+ &hEvent ));
1469
1488
1470
- auto Src = (uptr)pSrc, Dst = (uptr)pDst;
1489
+ const auto Src = (uptr)pSrc, Dst = (uptr)pDst;
1471
1490
auto SrcInfoItOp = getMsanInterceptor ()->findAllocInfoByAddress (Src);
1472
1491
auto DstInfoItOp = getMsanInterceptor ()->findAllocInfoByAddress (Dst);
1473
1492
@@ -1477,23 +1496,29 @@ ur_result_t UR_APICALL urEnqueueUSMMemcpy2D(
1477
1496
1478
1497
const auto &DeviceInfo =
1479
1498
getMsanInterceptor ()->getDeviceInfo (SrcInfo->Device );
1480
- auto SrcShadow = DeviceInfo->Shadow ->MemToShadow (Src);
1481
- auto DstShadow = DeviceInfo->Shadow ->MemToShadow (Dst);
1499
+ const auto SrcShadow = DeviceInfo->Shadow ->MemToShadow (Src);
1500
+ const auto DstShadow = DeviceInfo->Shadow ->MemToShadow (Dst);
1482
1501
1502
+ const ur_event_handle_t hEventWait = hEvent;
1483
1503
UR_CALL (pfnUSMMemcpy2D (hQueue, blocking, (void *)DstShadow, dstPitch,
1484
- (void *)SrcShadow, srcPitch, width, height,
1485
- phEvent ? 1 : 0 , phEvent, phEvent ));
1504
+ (void *)SrcShadow, srcPitch, width, height, 1 ,
1505
+ &hEventWait, &hEvent ));
1486
1506
} else if (DstInfoItOp) {
1487
1507
auto DstInfo = (*DstInfoItOp)->second ;
1488
1508
1489
1509
const auto &DeviceInfo =
1490
1510
getMsanInterceptor ()->getDeviceInfo (DstInfo->Device );
1491
- auto DstShadow = DeviceInfo->Shadow ->MemToShadow (Dst);
1511
+ const auto DstShadow = DeviceInfo->Shadow ->MemToShadow (Dst);
1492
1512
1493
1513
const char Pattern = 0 ;
1514
+ const ur_event_handle_t hEventWait = hEvent;
1494
1515
UR_CALL (getContext ()->urDdiTable .Enqueue .pfnUSMFill2D (
1495
- hQueue, (void *)DstShadow, dstPitch, 1 , &Pattern, width, height,
1496
- phEvent ? 1 : 0 , phEvent, phEvent));
1516
+ hQueue, (void *)DstShadow, dstPitch, 1 , &Pattern, width, height, 1 ,
1517
+ &hEventWait, &hEvent));
1518
+ }
1519
+
1520
+ if (phEvent) {
1521
+ *phEvent = hEvent;
1497
1522
}
1498
1523
1499
1524
return UR_RESULT_SUCCESS;
0 commit comments