@@ -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
@@ -2759,6 +2801,9 @@ __urdlllocal ur_result_t UR_APICALL urProgramRetain(
2759
2801
// forward to device-platform
2760
2802
result = pfnRetain (hProgram);
2761
2803
2804
+ // increment refcount of handle
2805
+ context->factories .ur_program_factory .retain (hProgram);
2806
+
2762
2807
return result;
2763
2808
}
2764
2809
@@ -2785,6 +2830,9 @@ __urdlllocal ur_result_t UR_APICALL urProgramRelease(
2785
2830
// forward to device-platform
2786
2831
result = pfnRelease (hProgram);
2787
2832
2833
+ // release loader handle
2834
+ context->factories .ur_program_factory .release (hProgram);
2835
+
2788
2836
return result;
2789
2837
}
2790
2838
@@ -3382,6 +3430,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelRetain(
3382
3430
// forward to device-platform
3383
3431
result = pfnRetain (hKernel);
3384
3432
3433
+ // increment refcount of handle
3434
+ context->factories .ur_kernel_factory .retain (hKernel);
3435
+
3385
3436
return result;
3386
3437
}
3387
3438
@@ -3408,6 +3459,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelRelease(
3408
3459
// forward to device-platform
3409
3460
result = pfnRelease (hKernel);
3410
3461
3462
+ // release loader handle
3463
+ context->factories .ur_kernel_factory .release (hKernel);
3464
+
3411
3465
return result;
3412
3466
}
3413
3467
@@ -3858,6 +3912,9 @@ __urdlllocal ur_result_t UR_APICALL urQueueRetain(
3858
3912
// forward to device-platform
3859
3913
result = pfnRetain (hQueue);
3860
3914
3915
+ // increment refcount of handle
3916
+ context->factories .ur_queue_factory .retain (hQueue);
3917
+
3861
3918
return result;
3862
3919
}
3863
3920
@@ -3884,6 +3941,9 @@ __urdlllocal ur_result_t UR_APICALL urQueueRelease(
3884
3941
// forward to device-platform
3885
3942
result = pfnRelease (hQueue);
3886
3943
3944
+ // release loader handle
3945
+ context->factories .ur_queue_factory .release (hQueue);
3946
+
3887
3947
return result;
3888
3948
}
3889
3949
@@ -4188,6 +4248,9 @@ __urdlllocal ur_result_t UR_APICALL urEventRetain(
4188
4248
// forward to device-platform
4189
4249
result = pfnRetain (hEvent);
4190
4250
4251
+ // increment refcount of handle
4252
+ context->factories .ur_event_factory .retain (hEvent);
4253
+
4191
4254
return result;
4192
4255
}
4193
4256
@@ -4213,6 +4276,9 @@ __urdlllocal ur_result_t UR_APICALL urEventRelease(
4213
4276
// forward to device-platform
4214
4277
result = pfnRelease (hEvent);
4215
4278
4279
+ // release loader handle
4280
+ context->factories .ur_event_factory .release (hEvent);
4281
+
4216
4282
return result;
4217
4283
}
4218
4284
@@ -6745,6 +6811,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesReleaseExternalMemoryExp(
6745
6811
// forward to device-platform
6746
6812
result = pfnReleaseExternalMemoryExp (hContext, hDevice, hExternalMem);
6747
6813
6814
+ // release loader handle
6815
+ context->factories .ur_exp_external_mem_factory .release (hExternalMem);
6816
+
6748
6817
return result;
6749
6818
}
6750
6819
@@ -6835,6 +6904,10 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesReleaseExternalSemaphoreExp(
6835
6904
result =
6836
6905
pfnReleaseExternalSemaphoreExp (hContext, hDevice, hExternalSemaphore);
6837
6906
6907
+ // release loader handle
6908
+ context->factories .ur_exp_external_semaphore_factory .release (
6909
+ hExternalSemaphore);
6910
+
6838
6911
return result;
6839
6912
}
6840
6913
@@ -7062,6 +7135,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferRetainExp(
7062
7135
// forward to device-platform
7063
7136
result = pfnRetainExp (hCommandBuffer);
7064
7137
7138
+ // increment refcount of handle
7139
+ context->factories .ur_exp_command_buffer_factory .retain (hCommandBuffer);
7140
+
7065
7141
return result;
7066
7142
}
7067
7143
@@ -7092,6 +7168,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferReleaseExp(
7092
7168
// forward to device-platform
7093
7169
result = pfnReleaseExp (hCommandBuffer);
7094
7170
7171
+ // release loader handle
7172
+ context->factories .ur_exp_command_buffer_factory .release (hCommandBuffer);
7173
+
7095
7174
return result;
7096
7175
}
7097
7176
@@ -8408,6 +8487,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferRetainCommandExp(
8408
8487
// forward to device-platform
8409
8488
result = pfnRetainCommandExp (hCommand);
8410
8489
8490
+ // increment refcount of handle
8491
+ context->factories .ur_exp_command_buffer_command_factory .retain (hCommand);
8492
+
8411
8493
return result;
8412
8494
}
8413
8495
@@ -8439,6 +8521,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferReleaseCommandExp(
8439
8521
// forward to device-platform
8440
8522
result = pfnReleaseCommandExp (hCommand);
8441
8523
8524
+ // release loader handle
8525
+ context->factories .ur_exp_command_buffer_command_factory .release (hCommand);
8526
+
8442
8527
return result;
8443
8528
}
8444
8529
0 commit comments