@@ -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
@@ -614,6 +620,9 @@ __urdlllocal ur_result_t UR_APICALL urDeviceRetain(
614
620
// forward to device-platform
615
621
result = pfnRetain (hDevice);
616
622
623
+ // increment refcount of handle
624
+ context->factories .ur_device_factory .retain (hDevice);
625
+
617
626
return result;
618
627
}
619
628
@@ -640,6 +649,9 @@ __urdlllocal ur_result_t UR_APICALL urDeviceRelease(
640
649
// forward to device-platform
641
650
result = pfnRelease (hDevice);
642
651
652
+ // release loader handle
653
+ context->factories .ur_device_factory .release (hDevice);
654
+
643
655
return result;
644
656
}
645
657
@@ -910,6 +922,9 @@ __urdlllocal ur_result_t UR_APICALL urContextRetain(
910
922
// forward to device-platform
911
923
result = pfnRetain (hContext);
912
924
925
+ // increment refcount of handle
926
+ context->factories .ur_context_factory .retain (hContext);
927
+
913
928
return result;
914
929
}
915
930
@@ -936,6 +951,9 @@ __urdlllocal ur_result_t UR_APICALL urContextRelease(
936
951
// forward to device-platform
937
952
result = pfnRelease (hContext);
938
953
954
+ // release loader handle
955
+ context->factories .ur_context_factory .release (hContext);
956
+
939
957
return result;
940
958
}
941
959
@@ -1238,6 +1256,9 @@ __urdlllocal ur_result_t UR_APICALL urMemRetain(
1238
1256
// forward to device-platform
1239
1257
result = pfnRetain (hMem);
1240
1258
1259
+ // increment refcount of handle
1260
+ context->factories .ur_mem_factory .retain (hMem);
1261
+
1241
1262
return result;
1242
1263
}
1243
1264
@@ -1264,6 +1285,9 @@ __urdlllocal ur_result_t UR_APICALL urMemRelease(
1264
1285
// forward to device-platform
1265
1286
result = pfnRelease (hMem);
1266
1287
1288
+ // release loader handle
1289
+ context->factories .ur_mem_factory .release (hMem);
1290
+
1267
1291
return result;
1268
1292
}
1269
1293
@@ -1615,6 +1639,9 @@ __urdlllocal ur_result_t UR_APICALL urSamplerRetain(
1615
1639
// forward to device-platform
1616
1640
result = pfnRetain (hSampler);
1617
1641
1642
+ // increment refcount of handle
1643
+ context->factories .ur_sampler_factory .retain (hSampler);
1644
+
1618
1645
return result;
1619
1646
}
1620
1647
@@ -1641,6 +1668,9 @@ __urdlllocal ur_result_t UR_APICALL urSamplerRelease(
1641
1668
// forward to device-platform
1642
1669
result = pfnRelease (hSampler);
1643
1670
1671
+ // release loader handle
1672
+ context->factories .ur_sampler_factory .release (hSampler);
1673
+
1644
1674
return result;
1645
1675
}
1646
1676
@@ -2074,6 +2104,9 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolRetain(
2074
2104
// forward to device-platform
2075
2105
result = pfnPoolRetain (pPool);
2076
2106
2107
+ // increment refcount of handle
2108
+ context->factories .ur_usm_pool_factory .retain (pPool);
2109
+
2077
2110
return result;
2078
2111
}
2079
2112
@@ -2099,6 +2132,9 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolRelease(
2099
2132
// forward to device-platform
2100
2133
result = pfnPoolRelease (pPool);
2101
2134
2135
+ // release loader handle
2136
+ context->factories .ur_usm_pool_factory .release (pPool);
2137
+
2102
2138
return result;
2103
2139
}
2104
2140
@@ -2484,6 +2520,9 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemRetain(
2484
2520
// forward to device-platform
2485
2521
result = pfnRetain (hPhysicalMem);
2486
2522
2523
+ // increment refcount of handle
2524
+ context->factories .ur_physical_mem_factory .retain (hPhysicalMem);
2525
+
2487
2526
return result;
2488
2527
}
2489
2528
@@ -2512,6 +2551,9 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemRelease(
2512
2551
// forward to device-platform
2513
2552
result = pfnRelease (hPhysicalMem);
2514
2553
2554
+ // release loader handle
2555
+ context->factories .ur_physical_mem_factory .release (hPhysicalMem);
2556
+
2515
2557
return result;
2516
2558
}
2517
2559
@@ -2749,6 +2791,9 @@ __urdlllocal ur_result_t UR_APICALL urProgramRetain(
2749
2791
// forward to device-platform
2750
2792
result = pfnRetain (hProgram);
2751
2793
2794
+ // increment refcount of handle
2795
+ context->factories .ur_program_factory .retain (hProgram);
2796
+
2752
2797
return result;
2753
2798
}
2754
2799
@@ -2775,6 +2820,9 @@ __urdlllocal ur_result_t UR_APICALL urProgramRelease(
2775
2820
// forward to device-platform
2776
2821
result = pfnRelease (hProgram);
2777
2822
2823
+ // release loader handle
2824
+ context->factories .ur_program_factory .release (hProgram);
2825
+
2778
2826
return result;
2779
2827
}
2780
2828
@@ -3372,6 +3420,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelRetain(
3372
3420
// forward to device-platform
3373
3421
result = pfnRetain (hKernel);
3374
3422
3423
+ // increment refcount of handle
3424
+ context->factories .ur_kernel_factory .retain (hKernel);
3425
+
3375
3426
return result;
3376
3427
}
3377
3428
@@ -3398,6 +3449,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelRelease(
3398
3449
// forward to device-platform
3399
3450
result = pfnRelease (hKernel);
3400
3451
3452
+ // release loader handle
3453
+ context->factories .ur_kernel_factory .release (hKernel);
3454
+
3401
3455
return result;
3402
3456
}
3403
3457
@@ -3848,6 +3902,9 @@ __urdlllocal ur_result_t UR_APICALL urQueueRetain(
3848
3902
// forward to device-platform
3849
3903
result = pfnRetain (hQueue);
3850
3904
3905
+ // increment refcount of handle
3906
+ context->factories .ur_queue_factory .retain (hQueue);
3907
+
3851
3908
return result;
3852
3909
}
3853
3910
@@ -3874,6 +3931,9 @@ __urdlllocal ur_result_t UR_APICALL urQueueRelease(
3874
3931
// forward to device-platform
3875
3932
result = pfnRelease (hQueue);
3876
3933
3934
+ // release loader handle
3935
+ context->factories .ur_queue_factory .release (hQueue);
3936
+
3877
3937
return result;
3878
3938
}
3879
3939
@@ -4178,6 +4238,9 @@ __urdlllocal ur_result_t UR_APICALL urEventRetain(
4178
4238
// forward to device-platform
4179
4239
result = pfnRetain (hEvent);
4180
4240
4241
+ // increment refcount of handle
4242
+ context->factories .ur_event_factory .retain (hEvent);
4243
+
4181
4244
return result;
4182
4245
}
4183
4246
@@ -4203,6 +4266,9 @@ __urdlllocal ur_result_t UR_APICALL urEventRelease(
4203
4266
// forward to device-platform
4204
4267
result = pfnRelease (hEvent);
4205
4268
4269
+ // release loader handle
4270
+ context->factories .ur_event_factory .release (hEvent);
4271
+
4206
4272
return result;
4207
4273
}
4208
4274
@@ -6715,6 +6781,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesReleaseExternalMemoryExp(
6715
6781
// forward to device-platform
6716
6782
result = pfnReleaseExternalMemoryExp (hContext, hDevice, hExternalMem);
6717
6783
6784
+ // release loader handle
6785
+ context->factories .ur_exp_external_mem_factory .release (hExternalMem);
6786
+
6718
6787
return result;
6719
6788
}
6720
6789
@@ -6805,6 +6874,10 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesReleaseExternalSemaphoreExp(
6805
6874
result =
6806
6875
pfnReleaseExternalSemaphoreExp (hContext, hDevice, hExternalSemaphore);
6807
6876
6877
+ // release loader handle
6878
+ context->factories .ur_exp_external_semaphore_factory .release (
6879
+ hExternalSemaphore);
6880
+
6808
6881
return result;
6809
6882
}
6810
6883
@@ -7030,6 +7103,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferRetainExp(
7030
7103
// forward to device-platform
7031
7104
result = pfnRetainExp (hCommandBuffer);
7032
7105
7106
+ // increment refcount of handle
7107
+ context->factories .ur_exp_command_buffer_factory .retain (hCommandBuffer);
7108
+
7033
7109
return result;
7034
7110
}
7035
7111
@@ -7060,6 +7136,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferReleaseExp(
7060
7136
// forward to device-platform
7061
7137
result = pfnReleaseExp (hCommandBuffer);
7062
7138
7139
+ // release loader handle
7140
+ context->factories .ur_exp_command_buffer_factory .release (hCommandBuffer);
7141
+
7063
7142
return result;
7064
7143
}
7065
7144
@@ -7808,6 +7887,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferRetainCommandExp(
7808
7887
// forward to device-platform
7809
7888
result = pfnRetainCommandExp (hCommand);
7810
7889
7890
+ // increment refcount of handle
7891
+ context->factories .ur_exp_command_buffer_command_factory .retain (hCommand);
7892
+
7811
7893
return result;
7812
7894
}
7813
7895
@@ -7839,6 +7921,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferReleaseCommandExp(
7839
7921
// forward to device-platform
7840
7922
result = pfnReleaseCommandExp (hCommand);
7841
7923
7924
+ // release loader handle
7925
+ context->factories .ur_exp_command_buffer_command_factory .release (hCommand);
7926
+
7842
7927
return result;
7843
7928
}
7844
7929
0 commit comments