@@ -49,7 +49,8 @@ ur_result_t enqueueEventsWait(ur_queue_handle_t CommandQueue,
49
49
if (Event->getStream () == Stream) {
50
50
return UR_RESULT_SUCCESS;
51
51
} else {
52
- return UR_CHECK_ERROR (hipStreamWaitEvent (Stream, Event->get (), 0 ));
52
+ UR_CHECK_ERROR (hipStreamWaitEvent (Stream, Event->get (), 0 ));
53
+ return UR_RESULT_SUCCESS;
53
54
}
54
55
});
55
56
@@ -109,7 +110,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferWrite(
109
110
UR_CHECK_ERROR (RetImplEvent->start ());
110
111
}
111
112
112
- Result = UR_CHECK_ERROR (
113
+ UR_CHECK_ERROR (
113
114
hipMemcpyHtoDAsync (hBuffer->Mem .BufferMem .getWithOffset (offset),
114
115
const_cast <void *>(pSrc), size, HIPStream));
115
116
@@ -118,7 +119,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferWrite(
118
119
}
119
120
120
121
if (blockingWrite) {
121
- Result = UR_CHECK_ERROR (hipStreamSynchronize (HIPStream));
122
+ UR_CHECK_ERROR (hipStreamSynchronize (HIPStream));
122
123
}
123
124
124
125
if (phEvent) {
@@ -155,15 +156,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferRead(
155
156
UR_CHECK_ERROR (RetImplEvent->start ());
156
157
}
157
158
158
- Result = UR_CHECK_ERROR (hipMemcpyDtoHAsync (
159
+ UR_CHECK_ERROR (hipMemcpyDtoHAsync (
159
160
pDst, hBuffer->Mem .BufferMem .getWithOffset (offset), size, HIPStream));
160
161
161
162
if (phEvent) {
162
163
UR_CHECK_ERROR (RetImplEvent->record ());
163
164
}
164
165
165
166
if (blockingRead) {
166
- Result = UR_CHECK_ERROR (hipStreamSynchronize (HIPStream));
167
+ UR_CHECK_ERROR (hipStreamSynchronize (HIPStream));
167
168
}
168
169
169
170
if (phEvent) {
@@ -309,7 +310,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch(
309
310
310
311
if (LocalMemSzPtr) {
311
312
int DeviceMaxLocalMem = 0 ;
312
- Result = UR_CHECK_ERROR (hipDeviceGetAttribute (
313
+ UR_CHECK_ERROR (hipDeviceGetAttribute (
313
314
&DeviceMaxLocalMem, hipDeviceAttributeMaxSharedMemoryPerBlock,
314
315
HIPDev));
315
316
@@ -322,11 +323,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch(
322
323
UR_RESULT_ERROR_ADAPTER_SPECIFIC);
323
324
return UR_RESULT_ERROR_ADAPTER_SPECIFIC;
324
325
}
325
- Result = UR_CHECK_ERROR (hipFuncSetAttribute (
326
+ UR_CHECK_ERROR (hipFuncSetAttribute (
326
327
HIPFunc, hipFuncAttributeMaxDynamicSharedMemorySize, EnvVal));
327
328
}
328
329
329
- Result = UR_CHECK_ERROR (hipModuleLaunchKernel (
330
+ UR_CHECK_ERROR (hipModuleLaunchKernel (
330
331
HIPFunc, BlocksPerGrid[0 ], BlocksPerGrid[1 ], BlocksPerGrid[2 ],
331
332
ThreadsPerBlock[0 ], ThreadsPerBlock[1 ], ThreadsPerBlock[2 ],
332
333
hKernel->getLocalSize (), HIPStream, ArgIndices.data (), nullptr ));
@@ -405,13 +406,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier(
405
406
Event->getComputeStreamToken ())) {
406
407
return UR_RESULT_SUCCESS;
407
408
} else {
408
- return UR_CHECK_ERROR (
409
- hipStreamWaitEvent (HIPStream, Event-> get (), 0 )) ;
409
+ UR_CHECK_ERROR (hipStreamWaitEvent (HIPStream, Event-> get (), 0 ));
410
+ return UR_RESULT_SUCCESS ;
410
411
}
411
412
});
412
413
}
413
414
414
- Result = UR_CHECK_ERROR (hipEventRecord (hQueue->BarrierEvent , HIPStream));
415
+ UR_CHECK_ERROR (hipEventRecord (hQueue->BarrierEvent , HIPStream));
415
416
for (unsigned int i = 0 ; i < hQueue->ComputeAppliedBarrier .size (); i++) {
416
417
hQueue->ComputeAppliedBarrier [i] = false ;
417
418
}
@@ -487,7 +488,8 @@ static ur_result_t commonEnqueueMemBufferCopyRect(
487
488
Params.dstPitch = DstRowPitch;
488
489
Params.dstHeight = DstSlicePitch / DstRowPitch;
489
490
490
- return UR_CHECK_ERROR (hipDrvMemcpy3DAsync (&Params, HipStream));
491
+ UR_CHECK_ERROR (hipDrvMemcpy3DAsync (&Params, HipStream));
492
+ return UR_RESULT_SUCCESS;
491
493
}
492
494
493
495
UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferReadRect (
@@ -546,7 +548,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferReadRect(
546
548
}
547
549
548
550
if (blockingRead) {
549
- Result = UR_CHECK_ERROR (hipStreamSynchronize (HIPStream));
551
+ UR_CHECK_ERROR (hipStreamSynchronize (HIPStream));
550
552
}
551
553
552
554
if (phEvent) {
@@ -593,7 +595,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferWriteRect(
593
595
}
594
596
595
597
if (blockingWrite) {
596
- Result = UR_CHECK_ERROR (hipStreamSynchronize (HIPStream));
598
+ UR_CHECK_ERROR (hipStreamSynchronize (HIPStream));
597
599
}
598
600
599
601
if (phEvent) {
@@ -638,7 +640,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferCopy(
638
640
auto Src = hBufferSrc->Mem .BufferMem .getWithOffset (srcOffset);
639
641
auto Dst = hBufferDst->Mem .BufferMem .getWithOffset (dstOffset);
640
642
641
- Result = UR_CHECK_ERROR (hipMemcpyDtoDAsync (Dst, Src, size, Stream));
643
+ UR_CHECK_ERROR (hipMemcpyDtoDAsync (Dst, Src, size, Stream));
642
644
643
645
if (phEvent) {
644
646
UR_CHECK_ERROR (RetImplEvent->record ());
@@ -713,10 +715,7 @@ ur_result_t commonMemSetLargePattern(hipStream_t Stream, uint32_t PatternSize,
713
715
714
716
// Get 4-byte chunk of the pattern and call hipMemsetD32Async
715
717
auto Value = *(static_cast <const uint32_t *>(pPattern));
716
- auto Result = UR_CHECK_ERROR (hipMemsetD32Async (Ptr, Value, Count32, Stream));
717
- if (Result != UR_RESULT_SUCCESS) {
718
- return Result;
719
- }
718
+ UR_CHECK_ERROR (hipMemsetD32Async (Ptr, Value, Count32, Stream));
720
719
for (auto step = 4u ; step < NumberOfSteps; ++step) {
721
720
// take 1 byte of the pattern
722
721
Value = *(static_cast <const uint8_t *>(pPattern) + step);
@@ -726,11 +725,8 @@ ur_result_t commonMemSetLargePattern(hipStream_t Stream, uint32_t PatternSize,
726
725
(step * sizeof (uint8_t )));
727
726
728
727
// set all of the pattern chunks
729
- Result = UR_CHECK_ERROR (hipMemset2DAsync (OffsetPtr, Pitch, Value,
730
- sizeof (uint8_t ), Height, Stream));
731
- if (Result != UR_RESULT_SUCCESS) {
732
- return Result;
733
- }
728
+ UR_CHECK_ERROR (hipMemset2DAsync (OffsetPtr, Pitch, Value, sizeof (uint8_t ),
729
+ Height, Stream));
734
730
}
735
731
return UR_RESULT_SUCCESS;
736
732
}
@@ -764,7 +760,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferFill(
764
760
ScopedContext Active (hQueue->getDevice ());
765
761
766
762
auto Stream = hQueue->getNextTransferStream ();
767
- ur_result_t Result;
763
+ ur_result_t Result = UR_RESULT_SUCCESS ;
768
764
if (phEventWaitList) {
769
765
Result = enqueueEventsWait (hQueue, Stream, numEventsInWaitList,
770
766
phEventWaitList);
@@ -784,17 +780,17 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferFill(
784
780
switch (patternSize) {
785
781
case 1 : {
786
782
auto Value = *static_cast <const uint8_t *>(pPattern);
787
- Result = UR_CHECK_ERROR (hipMemsetD8Async (DstDevice, Value, N, Stream));
783
+ UR_CHECK_ERROR (hipMemsetD8Async (DstDevice, Value, N, Stream));
788
784
break ;
789
785
}
790
786
case 2 : {
791
787
auto Value = *static_cast <const uint16_t *>(pPattern);
792
- Result = UR_CHECK_ERROR (hipMemsetD16Async (DstDevice, Value, N, Stream));
788
+ UR_CHECK_ERROR (hipMemsetD16Async (DstDevice, Value, N, Stream));
793
789
break ;
794
790
}
795
791
case 4 : {
796
792
auto Value = *static_cast <const uint32_t *>(pPattern);
797
- Result = UR_CHECK_ERROR (hipMemsetD32Async (DstDevice, Value, N, Stream));
793
+ UR_CHECK_ERROR (hipMemsetD32Async (DstDevice, Value, N, Stream));
798
794
break ;
799
795
}
800
796
@@ -855,7 +851,8 @@ static ur_result_t commonEnqueueMemImageNDCopy(
855
851
}
856
852
CpyDesc.WidthInBytes = Region[0 ];
857
853
CpyDesc.Height = Region[1 ];
858
- return UR_CHECK_ERROR (hipMemcpyParam2DAsync (&CpyDesc, HipStream));
854
+ UR_CHECK_ERROR (hipMemcpyParam2DAsync (&CpyDesc, HipStream));
855
+ return UR_RESULT_SUCCESS;
859
856
}
860
857
861
858
if (ImgType == UR_MEM_TYPE_IMAGE3D) {
@@ -884,8 +881,8 @@ static ur_result_t commonEnqueueMemImageNDCopy(
884
881
CpyDesc.WidthInBytes = Region[0 ];
885
882
CpyDesc.Height = Region[1 ];
886
883
CpyDesc.Depth = Region[2 ];
887
- return UR_CHECK_ERROR (hipDrvMemcpy3DAsync (&CpyDesc, HipStream));
888
- return UR_RESULT_ERROR_UNKNOWN ;
884
+ UR_CHECK_ERROR (hipDrvMemcpy3DAsync (&CpyDesc, HipStream));
885
+ return UR_RESULT_SUCCESS ;
889
886
}
890
887
891
888
return UR_RESULT_ERROR_INVALID_VALUE;
@@ -948,7 +945,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageRead(
948
945
}
949
946
950
947
if (blockingRead) {
951
- Result = UR_CHECK_ERROR (hipStreamSynchronize (HIPStream));
948
+ UR_CHECK_ERROR (hipStreamSynchronize (HIPStream));
952
949
}
953
950
} catch (ur_result_t Err) {
954
951
return Err;
@@ -1243,19 +1240,19 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMFill(
1243
1240
auto N = size / patternSize;
1244
1241
switch (patternSize) {
1245
1242
case 1 :
1246
- Result = UR_CHECK_ERROR (
1247
- hipMemsetD8Async ( reinterpret_cast <hipDeviceptr_t>(ptr) ,
1248
- *( const uint8_t *)pPattern & 0xFF , N, HIPStream));
1243
+ UR_CHECK_ERROR (hipMemsetD8Async ( reinterpret_cast <hipDeviceptr_t>(ptr),
1244
+ *( const uint8_t *)pPattern & 0xFF , N ,
1245
+ HIPStream));
1249
1246
break ;
1250
1247
case 2 :
1251
- Result = UR_CHECK_ERROR (hipMemsetD16Async (
1252
- reinterpret_cast <hipDeviceptr_t>(ptr) ,
1253
- *( const uint16_t *)pPattern & 0xFFFF , N, HIPStream));
1248
+ UR_CHECK_ERROR (hipMemsetD16Async (reinterpret_cast <hipDeviceptr_t>(ptr),
1249
+ *( const uint16_t *)pPattern & 0xFFFF , N ,
1250
+ HIPStream));
1254
1251
break ;
1255
1252
case 4 :
1256
- Result = UR_CHECK_ERROR (hipMemsetD32Async (
1257
- reinterpret_cast <hipDeviceptr_t>(ptr) ,
1258
- *( const uint32_t *)pPattern & 0xFFFFFFFF , N, HIPStream));
1253
+ UR_CHECK_ERROR (hipMemsetD32Async (reinterpret_cast <hipDeviceptr_t>(ptr),
1254
+ *( const uint32_t *)pPattern & 0xFFFFFFFF ,
1255
+ N, HIPStream));
1259
1256
break ;
1260
1257
1261
1258
default :
@@ -1265,7 +1262,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMFill(
1265
1262
}
1266
1263
1267
1264
if (phEvent) {
1268
- Result = UR_CHECK_ERROR (EventPtr->record ());
1265
+ UR_CHECK_ERROR (EventPtr->record ());
1269
1266
*phEvent = EventPtr.release ();
1270
1267
}
1271
1268
} catch (ur_result_t Err) {
@@ -1294,13 +1291,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMMemcpy(
1294
1291
UR_COMMAND_USM_MEMCPY, hQueue, HIPStream));
1295
1292
UR_CHECK_ERROR (EventPtr->start ());
1296
1293
}
1297
- Result = UR_CHECK_ERROR (
1294
+ UR_CHECK_ERROR (
1298
1295
hipMemcpyAsync (pDst, pSrc, size, hipMemcpyDefault, HIPStream));
1299
1296
if (phEvent) {
1300
1297
UR_CHECK_ERROR (EventPtr->record ());
1301
1298
}
1302
1299
if (blocking) {
1303
- Result = UR_CHECK_ERROR (hipStreamSynchronize (HIPStream));
1300
+ UR_CHECK_ERROR (hipStreamSynchronize (HIPStream));
1304
1301
}
1305
1302
if (phEvent) {
1306
1303
*phEvent = EventPtr.release ();
@@ -1367,7 +1364,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMPrefetch(
1367
1364
UR_COMMAND_USM_PREFETCH, hQueue, HIPStream));
1368
1365
UR_CHECK_ERROR (EventPtr->start ());
1369
1366
}
1370
- Result = UR_CHECK_ERROR (
1367
+ UR_CHECK_ERROR (
1371
1368
hipMemPrefetchAsync (pMem, size, hQueue->getDevice ()->get (), HIPStream));
1372
1369
if (phEvent) {
1373
1370
UR_CHECK_ERROR (EventPtr->record ());
@@ -1439,16 +1436,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMMemcpy2D(
1439
1436
UR_CHECK_ERROR (RetImplEvent->start ());
1440
1437
}
1441
1438
1442
- Result =
1443
- UR_CHECK_ERROR (hipMemcpy2DAsync (pDst, dstPitch, pSrc, srcPitch, width,
1444
- height, hipMemcpyDefault, HIPStream));
1439
+ UR_CHECK_ERROR (hipMemcpy2DAsync (pDst, dstPitch, pSrc, srcPitch, width,
1440
+ height, hipMemcpyDefault, HIPStream));
1445
1441
1446
1442
if (phEvent) {
1447
1443
UR_CHECK_ERROR (RetImplEvent->record ());
1448
1444
*phEvent = RetImplEvent.release ();
1449
1445
}
1450
1446
if (blocking) {
1451
- Result = UR_CHECK_ERROR (hipStreamSynchronize (HIPStream));
1447
+ UR_CHECK_ERROR (hipStreamSynchronize (HIPStream));
1452
1448
}
1453
1449
} catch (ur_result_t Err) {
1454
1450
Result = Err;
0 commit comments