@@ -121,7 +121,10 @@ ur_result_t setCuMemAdvise(CUdeviceptr DevPtr, size_t Size,
121
121
122
122
for (auto &UnmappedFlag : UnmappedMemAdviceFlags) {
123
123
if (URAdviceFlags & UnmappedFlag) {
124
- throw UR_RESULT_ERROR_INVALID_ENUMERATION;
124
+ setErrorMessage (" Memory advice ignored because the CUDA backend does not "
125
+ " support some of the specified flags" ,
126
+ UR_RESULT_SUCCESS);
127
+ return UR_RESULT_ERROR_ADAPTER_SPECIFIC;
125
128
}
126
129
}
127
130
@@ -1355,15 +1358,17 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMPrefetch(
1355
1358
ur_queue_handle_t hQueue, const void *pMem, size_t size,
1356
1359
ur_usm_migration_flags_t flags, uint32_t numEventsInWaitList,
1357
1360
const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) {
1358
- unsigned int PointerRangeSize = 0 ;
1361
+ std::ignore = flags;
1362
+
1363
+ size_t PointerRangeSize = 0 ;
1359
1364
UR_CHECK_ERROR (cuPointerGetAttribute (
1360
1365
&PointerRangeSize, CU_POINTER_ATTRIBUTE_RANGE_SIZE, (CUdeviceptr)pMem));
1361
1366
UR_ASSERT (size <= PointerRangeSize, UR_RESULT_ERROR_INVALID_SIZE);
1362
1367
ur_device_handle_t Device = hQueue->getContext ()->getDevice ();
1363
1368
1364
1369
// Certain cuda devices and Windows do not have support for some Unified
1365
1370
// Memory features. cuMemPrefetchAsync requires concurrent memory access
1366
- // for managed memory. Therfore , ignore prefetch hint if concurrent managed
1371
+ // for managed memory. Therefore , ignore prefetch hint if concurrent managed
1367
1372
// memory access is not available.
1368
1373
if (!getAttribute (Device, CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS)) {
1369
1374
setErrorMessage (" Prefetch hint ignored as device does not support "
@@ -1381,10 +1386,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMPrefetch(
1381
1386
return UR_RESULT_ERROR_ADAPTER_SPECIFIC;
1382
1387
}
1383
1388
1384
- // flags is currently unused so fail if set
1385
- if (flags != 0 )
1386
- return UR_RESULT_ERROR_INVALID_VALUE;
1387
-
1388
1389
ur_result_t Result = UR_RESULT_SUCCESS;
1389
1390
std::unique_ptr<ur_event_handle_t_> EventPtr{nullptr };
1390
1391
@@ -1415,7 +1416,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMPrefetch(
1415
1416
UR_APIEXPORT ur_result_t UR_APICALL
1416
1417
urEnqueueUSMAdvise (ur_queue_handle_t hQueue, const void *pMem, size_t size,
1417
1418
ur_usm_advice_flags_t advice, ur_event_handle_t *phEvent) {
1418
- unsigned int PointerRangeSize = 0 ;
1419
+ size_t PointerRangeSize = 0 ;
1419
1420
UR_CHECK_ERROR (cuPointerGetAttribute (
1420
1421
&PointerRangeSize, CU_POINTER_ATTRIBUTE_RANGE_SIZE, (CUdeviceptr)pMem));
1421
1422
UR_ASSERT (size <= PointerRangeSize, UR_RESULT_ERROR_INVALID_SIZE);
0 commit comments