@@ -124,18 +124,6 @@ __urdlllocal ur_result_t UR_APICALL urAdapterRetain(
124
124
// forward to device-platform
125
125
result = pfnAdapterRetain (hAdapter);
126
126
127
- if (UR_RESULT_SUCCESS != result) {
128
- return result;
129
- }
130
-
131
- try {
132
- // convert platform handle to loader handle
133
- *hAdapter = reinterpret_cast <ur_adapter_handle_t >(
134
- ur_adapter_factory.getInstance (*hAdapter, dditable));
135
- } catch (std::bad_alloc &) {
136
- result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
137
- }
138
-
139
127
return result;
140
128
}
141
129
@@ -617,18 +605,6 @@ __urdlllocal ur_result_t UR_APICALL urDeviceRetain(
617
605
// forward to device-platform
618
606
result = pfnRetain (hDevice);
619
607
620
- if (UR_RESULT_SUCCESS != result) {
621
- return result;
622
- }
623
-
624
- try {
625
- // convert platform handle to loader handle
626
- *hDevice = reinterpret_cast <ur_device_handle_t >(
627
- ur_device_factory.getInstance (*hDevice, dditable));
628
- } catch (std::bad_alloc &) {
629
- result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
630
- }
631
-
632
608
return result;
633
609
}
634
610
@@ -906,18 +882,6 @@ __urdlllocal ur_result_t UR_APICALL urContextRetain(
906
882
// forward to device-platform
907
883
result = pfnRetain (hContext);
908
884
909
- if (UR_RESULT_SUCCESS != result) {
910
- return result;
911
- }
912
-
913
- try {
914
- // convert platform handle to loader handle
915
- *hContext = reinterpret_cast <ur_context_handle_t >(
916
- ur_context_factory.getInstance (*hContext, dditable));
917
- } catch (std::bad_alloc &) {
918
- result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
919
- }
920
-
921
885
return result;
922
886
}
923
887
@@ -1224,18 +1188,6 @@ __urdlllocal ur_result_t UR_APICALL urMemRetain(
1224
1188
// forward to device-platform
1225
1189
result = pfnRetain (hMem);
1226
1190
1227
- if (UR_RESULT_SUCCESS != result) {
1228
- return result;
1229
- }
1230
-
1231
- try {
1232
- // convert platform handle to loader handle
1233
- *hMem = reinterpret_cast <ur_mem_handle_t >(
1234
- ur_mem_factory.getInstance (*hMem, dditable));
1235
- } catch (std::bad_alloc &) {
1236
- result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
1237
- }
1238
-
1239
1191
return result;
1240
1192
}
1241
1193
@@ -1594,18 +1546,6 @@ __urdlllocal ur_result_t UR_APICALL urSamplerRetain(
1594
1546
// forward to device-platform
1595
1547
result = pfnRetain (hSampler);
1596
1548
1597
- if (UR_RESULT_SUCCESS != result) {
1598
- return result;
1599
- }
1600
-
1601
- try {
1602
- // convert platform handle to loader handle
1603
- *hSampler = reinterpret_cast <ur_sampler_handle_t >(
1604
- ur_sampler_factory.getInstance (*hSampler, dditable));
1605
- } catch (std::bad_alloc &) {
1606
- result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
1607
- }
1608
-
1609
1549
return result;
1610
1550
}
1611
1551
@@ -2041,18 +1981,6 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolRetain(
2041
1981
// forward to device-platform
2042
1982
result = pfnPoolRetain (pPool);
2043
1983
2044
- if (UR_RESULT_SUCCESS != result) {
2045
- return result;
2046
- }
2047
-
2048
- try {
2049
- // convert platform handle to loader handle
2050
- *pPool = reinterpret_cast <ur_usm_pool_handle_t >(
2051
- ur_usm_pool_factory.getInstance (*pPool, dditable));
2052
- } catch (std::bad_alloc &) {
2053
- result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
2054
- }
2055
-
2056
1984
return result;
2057
1985
}
2058
1986
@@ -2440,18 +2368,6 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemRetain(
2440
2368
// forward to device-platform
2441
2369
result = pfnRetain (hPhysicalMem);
2442
2370
2443
- if (UR_RESULT_SUCCESS != result) {
2444
- return result;
2445
- }
2446
-
2447
- try {
2448
- // convert platform handle to loader handle
2449
- *hPhysicalMem = reinterpret_cast <ur_physical_mem_handle_t >(
2450
- ur_physical_mem_factory.getInstance (*hPhysicalMem, dditable));
2451
- } catch (std::bad_alloc &) {
2452
- result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
2453
- }
2454
-
2455
2371
return result;
2456
2372
}
2457
2373
@@ -2699,18 +2615,6 @@ __urdlllocal ur_result_t UR_APICALL urProgramRetain(
2699
2615
// forward to device-platform
2700
2616
result = pfnRetain (hProgram);
2701
2617
2702
- if (UR_RESULT_SUCCESS != result) {
2703
- return result;
2704
- }
2705
-
2706
- try {
2707
- // convert platform handle to loader handle
2708
- *hProgram = reinterpret_cast <ur_program_handle_t >(
2709
- ur_program_factory.getInstance (*hProgram, dditable));
2710
- } catch (std::bad_alloc &) {
2711
- result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
2712
- }
2713
-
2714
2618
return result;
2715
2619
}
2716
2620
@@ -3301,18 +3205,6 @@ __urdlllocal ur_result_t UR_APICALL urKernelRetain(
3301
3205
// forward to device-platform
3302
3206
result = pfnRetain (hKernel);
3303
3207
3304
- if (UR_RESULT_SUCCESS != result) {
3305
- return result;
3306
- }
3307
-
3308
- try {
3309
- // convert platform handle to loader handle
3310
- *hKernel = reinterpret_cast <ur_kernel_handle_t >(
3311
- ur_kernel_factory.getInstance (*hKernel, dditable));
3312
- } catch (std::bad_alloc &) {
3313
- result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
3314
- }
3315
-
3316
3208
return result;
3317
3209
}
3318
3210
@@ -3760,18 +3652,6 @@ __urdlllocal ur_result_t UR_APICALL urQueueRetain(
3760
3652
// forward to device-platform
3761
3653
result = pfnRetain (hQueue);
3762
3654
3763
- if (UR_RESULT_SUCCESS != result) {
3764
- return result;
3765
- }
3766
-
3767
- try {
3768
- // convert platform handle to loader handle
3769
- *hQueue = reinterpret_cast <ur_queue_handle_t >(
3770
- ur_queue_factory.getInstance (*hQueue, dditable));
3771
- } catch (std::bad_alloc &) {
3772
- result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
3773
- }
3774
-
3775
3655
return result;
3776
3656
}
3777
3657
@@ -4080,18 +3960,6 @@ __urdlllocal ur_result_t UR_APICALL urEventRetain(
4080
3960
// forward to device-platform
4081
3961
result = pfnRetain (hEvent);
4082
3962
4083
- if (UR_RESULT_SUCCESS != result) {
4084
- return result;
4085
- }
4086
-
4087
- try {
4088
- // convert platform handle to loader handle
4089
- *hEvent = reinterpret_cast <ur_event_handle_t >(
4090
- ur_event_factory.getInstance (*hEvent, dditable));
4091
- } catch (std::bad_alloc &) {
4092
- result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
4093
- }
4094
-
4095
3963
return result;
4096
3964
}
4097
3965
@@ -6821,19 +6689,6 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferRetainExp(
6821
6689
// forward to device-platform
6822
6690
result = pfnRetainExp (hCommandBuffer);
6823
6691
6824
- if (UR_RESULT_SUCCESS != result) {
6825
- return result;
6826
- }
6827
-
6828
- try {
6829
- // convert platform handle to loader handle
6830
- *hCommandBuffer = reinterpret_cast <ur_exp_command_buffer_handle_t >(
6831
- ur_exp_command_buffer_factory.getInstance (*hCommandBuffer,
6832
- dditable));
6833
- } catch (std::bad_alloc &) {
6834
- result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
6835
- }
6836
-
6837
6692
return result;
6838
6693
}
6839
6694
@@ -7579,12 +7434,6 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferRetainCommandExp(
7579
7434
// forward to device-platform
7580
7435
result = pfnRetainCommandExp (hCommand);
7581
7436
7582
- if (UR_RESULT_SUCCESS != result) {
7583
- return result;
7584
- }
7585
-
7586
- // TODO: do we need to ref count the loader handles?
7587
-
7588
7437
return result;
7589
7438
}
7590
7439
0 commit comments