@@ -72,15 +72,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
72
72
int MaxX = 0 , MaxY = 0 , MaxZ = 0 ;
73
73
UR_CHECK_ERROR (cuDeviceGetAttribute (
74
74
&MaxX, CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X, hDevice->get ()));
75
- detail::ur::assertion (MaxX >= 0 );
75
+ assert (MaxX >= 0 );
76
76
77
77
UR_CHECK_ERROR (cuDeviceGetAttribute (
78
78
&MaxY, CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y, hDevice->get ()));
79
- detail::ur::assertion (MaxY >= 0 );
79
+ assert (MaxY >= 0 );
80
80
81
81
UR_CHECK_ERROR (cuDeviceGetAttribute (
82
82
&MaxZ, CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z, hDevice->get ()));
83
- detail::ur::assertion (MaxZ >= 0 );
83
+ assert (MaxZ >= 0 );
84
84
85
85
ReturnSizes.Sizes [0 ] = size_t (MaxX);
86
86
ReturnSizes.Sizes [1 ] = size_t (MaxY);
@@ -95,15 +95,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
95
95
int MaxX = 0 , MaxY = 0 , MaxZ = 0 ;
96
96
UR_CHECK_ERROR (cuDeviceGetAttribute (
97
97
&MaxX, CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X, hDevice->get ()));
98
- detail::ur::assertion (MaxX >= 0 );
98
+ assert (MaxX >= 0 );
99
99
100
100
UR_CHECK_ERROR (cuDeviceGetAttribute (
101
101
&MaxY, CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y, hDevice->get ()));
102
- detail::ur::assertion (MaxY >= 0 );
102
+ assert (MaxY >= 0 );
103
103
104
104
UR_CHECK_ERROR (cuDeviceGetAttribute (
105
105
&MaxZ, CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z, hDevice->get ()));
106
- detail::ur::assertion (MaxZ >= 0 );
106
+ assert (MaxZ >= 0 );
107
107
108
108
ReturnSizes.Sizes [0 ] = size_t (MaxX);
109
109
ReturnSizes.Sizes [1 ] = size_t (MaxY);
@@ -116,8 +116,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
116
116
UR_CHECK_ERROR (cuDeviceGetAttribute (
117
117
&MaxWorkGroupSize, CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK,
118
118
hDevice->get ()));
119
-
120
- detail::ur::assertion (MaxWorkGroupSize >= 0 );
119
+ assert (MaxWorkGroupSize >= 0 );
121
120
122
121
return ReturnValue (size_t (MaxWorkGroupSize));
123
122
}
@@ -268,7 +267,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
268
267
int ClockFreq = 0 ;
269
268
UR_CHECK_ERROR (cuDeviceGetAttribute (
270
269
&ClockFreq, CU_DEVICE_ATTRIBUTE_CLOCK_RATE, hDevice->get ()));
271
- detail::ur::assertion (ClockFreq >= 0 );
270
+ assert (ClockFreq >= 0 );
272
271
return ReturnValue (static_cast <uint32_t >(ClockFreq) / 1000u );
273
272
}
274
273
case UR_DEVICE_INFO_ADDRESS_BITS: {
@@ -314,12 +313,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
314
313
UR_CHECK_ERROR (cuDeviceGetAttribute (
315
314
&TexHeight, CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT,
316
315
hDevice->get ()));
317
- detail::ur::assertion (TexHeight >= 0 );
316
+ assert (TexHeight >= 0 );
318
317
int SurfHeight = 0 ;
319
318
UR_CHECK_ERROR (cuDeviceGetAttribute (
320
319
&SurfHeight, CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT,
321
320
hDevice->get ()));
322
- detail::ur::assertion (SurfHeight >= 0 );
321
+ assert (SurfHeight >= 0 );
323
322
324
323
int Min = std::min (TexHeight, SurfHeight);
325
324
@@ -331,12 +330,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
331
330
UR_CHECK_ERROR (cuDeviceGetAttribute (
332
331
&TexWidth, CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH,
333
332
hDevice->get ()));
334
- detail::ur::assertion (TexWidth >= 0 );
333
+ assert (TexWidth >= 0 );
335
334
int SurfWidth = 0 ;
336
335
UR_CHECK_ERROR (cuDeviceGetAttribute (
337
336
&SurfWidth, CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH,
338
337
hDevice->get ()));
339
- detail::ur::assertion (SurfWidth >= 0 );
338
+ assert (SurfWidth >= 0 );
340
339
341
340
int Min = std::min (TexWidth, SurfWidth);
342
341
@@ -348,12 +347,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
348
347
UR_CHECK_ERROR (cuDeviceGetAttribute (
349
348
&TexHeight, CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT,
350
349
hDevice->get ()));
351
- detail::ur::assertion (TexHeight >= 0 );
350
+ assert (TexHeight >= 0 );
352
351
int SurfHeight = 0 ;
353
352
UR_CHECK_ERROR (cuDeviceGetAttribute (
354
353
&SurfHeight, CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT,
355
354
hDevice->get ()));
356
- detail::ur::assertion (SurfHeight >= 0 );
355
+ assert (SurfHeight >= 0 );
357
356
358
357
int Min = std::min (TexHeight, SurfHeight);
359
358
@@ -365,12 +364,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
365
364
UR_CHECK_ERROR (cuDeviceGetAttribute (
366
365
&TexWidth, CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH,
367
366
hDevice->get ()));
368
- detail::ur::assertion (TexWidth >= 0 );
367
+ assert (TexWidth >= 0 );
369
368
int SurfWidth = 0 ;
370
369
UR_CHECK_ERROR (cuDeviceGetAttribute (
371
370
&SurfWidth, CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH,
372
371
hDevice->get ()));
373
- detail::ur::assertion (SurfWidth >= 0 );
372
+ assert (SurfWidth >= 0 );
374
373
375
374
int Min = std::min (TexWidth, SurfWidth);
376
375
@@ -382,12 +381,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
382
381
UR_CHECK_ERROR (cuDeviceGetAttribute (
383
382
&TexDepth, CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH,
384
383
hDevice->get ()));
385
- detail::ur::assertion (TexDepth >= 0 );
384
+ assert (TexDepth >= 0 );
386
385
int SurfDepth = 0 ;
387
386
UR_CHECK_ERROR (cuDeviceGetAttribute (
388
387
&SurfDepth, CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH,
389
388
hDevice->get ()));
390
- detail::ur::assertion (SurfDepth >= 0 );
389
+ assert (SurfDepth >= 0 );
391
390
392
391
int Min = std::min (TexDepth, SurfDepth);
393
392
@@ -399,12 +398,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
399
398
UR_CHECK_ERROR (cuDeviceGetAttribute (
400
399
&TexWidth, CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH,
401
400
hDevice->get ()));
402
- detail::ur::assertion (TexWidth >= 0 );
401
+ assert (TexWidth >= 0 );
403
402
int SurfWidth = 0 ;
404
403
UR_CHECK_ERROR (cuDeviceGetAttribute (
405
404
&SurfWidth, CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH,
406
405
hDevice->get ()));
407
- detail::ur::assertion (SurfWidth >= 0 );
406
+ assert (SurfWidth >= 0 );
408
407
409
408
int Min = std::min (TexWidth, SurfWidth);
410
409
@@ -473,23 +472,22 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
473
472
int CacheSize = 0 ;
474
473
UR_CHECK_ERROR (cuDeviceGetAttribute (
475
474
&CacheSize, CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE, hDevice->get ()));
476
- detail::ur::assertion (CacheSize >= 0 );
475
+ assert (CacheSize >= 0 );
477
476
// The L2 cache is global to the GPU.
478
477
return ReturnValue (static_cast <uint64_t >(CacheSize));
479
478
}
480
479
case UR_DEVICE_INFO_GLOBAL_MEM_SIZE: {
481
480
size_t Bytes = 0 ;
482
481
// Runtime API has easy access to this value, driver API info is scarse.
483
- detail::ur::assertion (cuDeviceTotalMem (&Bytes, hDevice->get ()) ==
484
- CUDA_SUCCESS);
482
+ UR_CHECK_ERROR (cuDeviceTotalMem (&Bytes, hDevice->get ()));
485
483
return ReturnValue (uint64_t {Bytes});
486
484
}
487
485
case UR_DEVICE_INFO_MAX_CONSTANT_BUFFER_SIZE: {
488
486
int ConstantMemory = 0 ;
489
487
UR_CHECK_ERROR (cuDeviceGetAttribute (
490
488
&ConstantMemory, CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY,
491
489
hDevice->get ()));
492
- detail::ur::assertion (ConstantMemory >= 0 );
490
+ assert (ConstantMemory >= 0 );
493
491
494
492
return ReturnValue (static_cast <uint64_t >(ConstantMemory));
495
493
}
@@ -519,7 +517,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
519
517
UR_CHECK_ERROR (cuDeviceGetAttribute (
520
518
&ECCEnabled, CU_DEVICE_ATTRIBUTE_ECC_ENABLED, hDevice->get ()));
521
519
522
- detail::ur::assertion ((ECCEnabled == 0 ) | (ECCEnabled == 1 ));
520
+ assert ((ECCEnabled == 0 ) | (ECCEnabled == 1 ));
523
521
auto Result = static_cast <bool >(ECCEnabled);
524
522
return ReturnValue (Result);
525
523
}
@@ -528,7 +526,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
528
526
UR_CHECK_ERROR (cuDeviceGetAttribute (
529
527
&IsIntegrated, CU_DEVICE_ATTRIBUTE_INTEGRATED, hDevice->get ()));
530
528
531
- detail::ur::assertion ((IsIntegrated == 0 ) | (IsIntegrated == 1 ));
529
+ assert ((IsIntegrated == 0 ) | (IsIntegrated == 1 ));
532
530
auto result = static_cast <bool >(IsIntegrated);
533
531
return ReturnValue (result);
534
532
}
@@ -800,24 +798,22 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
800
798
case UR_DEVICE_INFO_GLOBAL_MEM_FREE: {
801
799
size_t FreeMemory = 0 ;
802
800
size_t TotalMemory = 0 ;
803
- detail::ur::assertion (cuMemGetInfo (&FreeMemory, &TotalMemory) ==
804
- CUDA_SUCCESS,
805
- " failed cuMemGetInfo() API." );
801
+ UR_CHECK_ERROR (cuMemGetInfo (&FreeMemory, &TotalMemory));
806
802
return ReturnValue (FreeMemory);
807
803
}
808
804
case UR_DEVICE_INFO_MEMORY_CLOCK_RATE: {
809
805
int Value = 0 ;
810
806
UR_CHECK_ERROR (cuDeviceGetAttribute (
811
807
&Value, CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE, hDevice->get ()));
812
- detail::ur::assertion (Value >= 0 );
808
+ assert (Value >= 0 );
813
809
// Convert kilohertz to megahertz when returning.
814
810
return ReturnValue (Value / 1000 );
815
811
}
816
812
case UR_DEVICE_INFO_MEMORY_BUS_WIDTH: {
817
813
int Value = 0 ;
818
814
UR_CHECK_ERROR (cuDeviceGetAttribute (
819
815
&Value, CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH, hDevice->get ()));
820
- detail::ur::assertion (Value >= 0 );
816
+ assert (Value >= 0 );
821
817
return ReturnValue (Value);
822
818
}
823
819
case UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES: {
@@ -953,17 +949,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
953
949
int Value = 0 ;
954
950
UR_CHECK_ERROR (cuDeviceGetAttribute (
955
951
&Value, CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID, hDevice->get ()));
956
- detail::ur::assertion (Value >= 0 );
952
+ assert (Value >= 0 );
957
953
return ReturnValue (Value);
958
954
}
959
955
case UR_DEVICE_INFO_UUID: {
960
956
CUuuid UUID;
961
957
#if (CUDA_VERSION >= 11040)
962
- detail::ur::assertion (cuDeviceGetUuid_v2 (&UUID, hDevice->get ()) ==
963
- CUDA_SUCCESS);
958
+ UR_CHECK_ERROR (cuDeviceGetUuid_v2 (&UUID, hDevice->get ()));
964
959
#else
965
- detail::ur::assertion (cuDeviceGetUuid (&UUID, hDevice->get ()) ==
966
- CUDA_SUCCESS);
960
+ UR_CHECK_ERROR (cuDeviceGetUuid (&UUID, hDevice->get ()));
967
961
#endif
968
962
std::array<unsigned char , 16 > Name;
969
963
std::copy (UUID.bytes , UUID.bytes + 16 , Name.begin ());
@@ -1046,7 +1040,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
1046
1040
&MaxRegisters, CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK,
1047
1041
hDevice->get ()));
1048
1042
1049
- detail::ur::assertion (MaxRegisters >= 0 );
1043
+ assert (MaxRegisters >= 0 );
1050
1044
1051
1045
return ReturnValue (static_cast <uint32_t >(MaxRegisters));
1052
1046
}
@@ -1060,7 +1054,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
1060
1054
UR_CHECK_ERROR (
1061
1055
cuDeviceGetPCIBusId (AddressBuffer, AddressBufferSize, hDevice->get ()));
1062
1056
// CUDA API (8.x - 12.1) guarantees 12 bytes + \0 are written
1063
- detail::ur::assertion (strnlen (AddressBuffer, AddressBufferSize) == 12 );
1057
+ assert (strnlen (AddressBuffer, AddressBufferSize) == 12 );
1064
1058
return ReturnValue (AddressBuffer,
1065
1059
strnlen (AddressBuffer, AddressBufferSize - 1 ) + 1 );
1066
1060
}
0 commit comments