@@ -85,6 +85,9 @@ __urdlllocal ur_result_t UR_APICALL urAdapterRelease(
85
85
// forward to device-platform
86
86
result = pfnAdapterRelease (hAdapter);
87
87
88
+ // release loader handle
89
+ context->factories .ur_adapter_factory .release (hAdapter);
90
+
88
91
return result;
89
92
}
90
93
@@ -110,6 +113,9 @@ __urdlllocal ur_result_t UR_APICALL urAdapterRetain(
110
113
// forward to device-platform
111
114
result = pfnAdapterRetain (hAdapter);
112
115
116
+ // increment refcount of handle
117
+ context->factories .ur_adapter_factory .retain (hAdapter);
118
+
113
119
return result;
114
120
}
115
121
@@ -647,6 +653,9 @@ __urdlllocal ur_result_t UR_APICALL urDeviceRetain(
647
653
// forward to device-platform
648
654
result = pfnRetain (hDevice);
649
655
656
+ // increment refcount of handle
657
+ context->factories .ur_device_factory .retain (hDevice);
658
+
650
659
return result;
651
660
}
652
661
@@ -673,6 +682,9 @@ __urdlllocal ur_result_t UR_APICALL urDeviceRelease(
673
682
// forward to device-platform
674
683
result = pfnRelease (hDevice);
675
684
685
+ // release loader handle
686
+ context->factories .ur_device_factory .release (hDevice);
687
+
676
688
return result;
677
689
}
678
690
@@ -943,6 +955,9 @@ __urdlllocal ur_result_t UR_APICALL urContextRetain(
943
955
// forward to device-platform
944
956
result = pfnRetain (hContext);
945
957
958
+ // increment refcount of handle
959
+ context->factories .ur_context_factory .retain (hContext);
960
+
946
961
return result;
947
962
}
948
963
@@ -969,6 +984,9 @@ __urdlllocal ur_result_t UR_APICALL urContextRelease(
969
984
// forward to device-platform
970
985
result = pfnRelease (hContext);
971
986
987
+ // release loader handle
988
+ context->factories .ur_context_factory .release (hContext);
989
+
972
990
return result;
973
991
}
974
992
@@ -1271,6 +1289,9 @@ __urdlllocal ur_result_t UR_APICALL urMemRetain(
1271
1289
// forward to device-platform
1272
1290
result = pfnRetain (hMem);
1273
1291
1292
+ // increment refcount of handle
1293
+ context->factories .ur_mem_factory .retain (hMem);
1294
+
1274
1295
return result;
1275
1296
}
1276
1297
@@ -1297,6 +1318,9 @@ __urdlllocal ur_result_t UR_APICALL urMemRelease(
1297
1318
// forward to device-platform
1298
1319
result = pfnRelease (hMem);
1299
1320
1321
+ // release loader handle
1322
+ context->factories .ur_mem_factory .release (hMem);
1323
+
1300
1324
return result;
1301
1325
}
1302
1326
@@ -1648,6 +1672,9 @@ __urdlllocal ur_result_t UR_APICALL urSamplerRetain(
1648
1672
// forward to device-platform
1649
1673
result = pfnRetain (hSampler);
1650
1674
1675
+ // increment refcount of handle
1676
+ context->factories .ur_sampler_factory .retain (hSampler);
1677
+
1651
1678
return result;
1652
1679
}
1653
1680
@@ -1674,6 +1701,9 @@ __urdlllocal ur_result_t UR_APICALL urSamplerRelease(
1674
1701
// forward to device-platform
1675
1702
result = pfnRelease (hSampler);
1676
1703
1704
+ // release loader handle
1705
+ context->factories .ur_sampler_factory .release (hSampler);
1706
+
1677
1707
return result;
1678
1708
}
1679
1709
@@ -2107,6 +2137,9 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolRetain(
2107
2137
// forward to device-platform
2108
2138
result = pfnPoolRetain (pPool);
2109
2139
2140
+ // increment refcount of handle
2141
+ context->factories .ur_usm_pool_factory .retain (pPool);
2142
+
2110
2143
return result;
2111
2144
}
2112
2145
@@ -2132,6 +2165,9 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolRelease(
2132
2165
// forward to device-platform
2133
2166
result = pfnPoolRelease (pPool);
2134
2167
2168
+ // release loader handle
2169
+ context->factories .ur_usm_pool_factory .release (pPool);
2170
+
2135
2171
return result;
2136
2172
}
2137
2173
@@ -2517,6 +2553,9 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemRetain(
2517
2553
// forward to device-platform
2518
2554
result = pfnRetain (hPhysicalMem);
2519
2555
2556
+ // increment refcount of handle
2557
+ context->factories .ur_physical_mem_factory .retain (hPhysicalMem);
2558
+
2520
2559
return result;
2521
2560
}
2522
2561
@@ -2545,6 +2584,9 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemRelease(
2545
2584
// forward to device-platform
2546
2585
result = pfnRelease (hPhysicalMem);
2547
2586
2587
+ // release loader handle
2588
+ context->factories .ur_physical_mem_factory .release (hPhysicalMem);
2589
+
2548
2590
return result;
2549
2591
}
2550
2592
@@ -2876,6 +2918,9 @@ __urdlllocal ur_result_t UR_APICALL urProgramRetain(
2876
2918
// forward to device-platform
2877
2919
result = pfnRetain (hProgram);
2878
2920
2921
+ // increment refcount of handle
2922
+ context->factories .ur_program_factory .retain (hProgram);
2923
+
2879
2924
return result;
2880
2925
}
2881
2926
@@ -2902,6 +2947,9 @@ __urdlllocal ur_result_t UR_APICALL urProgramRelease(
2902
2947
// forward to device-platform
2903
2948
result = pfnRelease (hProgram);
2904
2949
2950
+ // release loader handle
2951
+ context->factories .ur_program_factory .release (hProgram);
2952
+
2905
2953
return result;
2906
2954
}
2907
2955
@@ -3499,6 +3547,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelRetain(
3499
3547
// forward to device-platform
3500
3548
result = pfnRetain (hKernel);
3501
3549
3550
+ // increment refcount of handle
3551
+ context->factories .ur_kernel_factory .retain (hKernel);
3552
+
3502
3553
return result;
3503
3554
}
3504
3555
@@ -3525,6 +3576,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelRelease(
3525
3576
// forward to device-platform
3526
3577
result = pfnRelease (hKernel);
3527
3578
3579
+ // release loader handle
3580
+ context->factories .ur_kernel_factory .release (hKernel);
3581
+
3528
3582
return result;
3529
3583
}
3530
3584
@@ -3975,6 +4029,9 @@ __urdlllocal ur_result_t UR_APICALL urQueueRetain(
3975
4029
// forward to device-platform
3976
4030
result = pfnRetain (hQueue);
3977
4031
4032
+ // increment refcount of handle
4033
+ context->factories .ur_queue_factory .retain (hQueue);
4034
+
3978
4035
return result;
3979
4036
}
3980
4037
@@ -4001,6 +4058,9 @@ __urdlllocal ur_result_t UR_APICALL urQueueRelease(
4001
4058
// forward to device-platform
4002
4059
result = pfnRelease (hQueue);
4003
4060
4061
+ // release loader handle
4062
+ context->factories .ur_queue_factory .release (hQueue);
4063
+
4004
4064
return result;
4005
4065
}
4006
4066
@@ -4305,6 +4365,9 @@ __urdlllocal ur_result_t UR_APICALL urEventRetain(
4305
4365
// forward to device-platform
4306
4366
result = pfnRetain (hEvent);
4307
4367
4368
+ // increment refcount of handle
4369
+ context->factories .ur_event_factory .retain (hEvent);
4370
+
4308
4371
return result;
4309
4372
}
4310
4373
@@ -4330,6 +4393,9 @@ __urdlllocal ur_result_t UR_APICALL urEventRelease(
4330
4393
// forward to device-platform
4331
4394
result = pfnRelease (hEvent);
4332
4395
4396
+ // release loader handle
4397
+ context->factories .ur_event_factory .release (hEvent);
4398
+
4333
4399
return result;
4334
4400
}
4335
4401
@@ -6862,6 +6928,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesReleaseExternalMemoryExp(
6862
6928
// forward to device-platform
6863
6929
result = pfnReleaseExternalMemoryExp (hContext, hDevice, hExternalMem);
6864
6930
6931
+ // release loader handle
6932
+ context->factories .ur_exp_external_mem_factory .release (hExternalMem);
6933
+
6865
6934
return result;
6866
6935
}
6867
6936
@@ -6952,6 +7021,10 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesReleaseExternalSemaphoreExp(
6952
7021
result =
6953
7022
pfnReleaseExternalSemaphoreExp (hContext, hDevice, hExternalSemaphore);
6954
7023
7024
+ // release loader handle
7025
+ context->factories .ur_exp_external_semaphore_factory .release (
7026
+ hExternalSemaphore);
7027
+
6955
7028
return result;
6956
7029
}
6957
7030
@@ -7179,6 +7252,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferRetainExp(
7179
7252
// forward to device-platform
7180
7253
result = pfnRetainExp (hCommandBuffer);
7181
7254
7255
+ // increment refcount of handle
7256
+ context->factories .ur_exp_command_buffer_factory .retain (hCommandBuffer);
7257
+
7182
7258
return result;
7183
7259
}
7184
7260
@@ -7209,6 +7285,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferReleaseExp(
7209
7285
// forward to device-platform
7210
7286
result = pfnReleaseExp (hCommandBuffer);
7211
7287
7288
+ // release loader handle
7289
+ context->factories .ur_exp_command_buffer_factory .release (hCommandBuffer);
7290
+
7212
7291
return result;
7213
7292
}
7214
7293
@@ -8525,6 +8604,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferRetainCommandExp(
8525
8604
// forward to device-platform
8526
8605
result = pfnRetainCommandExp (hCommand);
8527
8606
8607
+ // increment refcount of handle
8608
+ context->factories .ur_exp_command_buffer_command_factory .retain (hCommand);
8609
+
8528
8610
return result;
8529
8611
}
8530
8612
@@ -8556,6 +8638,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferReleaseCommandExp(
8556
8638
// forward to device-platform
8557
8639
result = pfnReleaseCommandExp (hCommand);
8558
8640
8641
+ // release loader handle
8642
+ context->factories .ur_exp_command_buffer_command_factory .release (hCommand);
8643
+
8559
8644
return result;
8560
8645
}
8561
8646
0 commit comments