Skip to content

Commit c246813

Browse files
committed
Disable generating loader release calls + reword release tag docs
1 parent 326bad6 commit c246813

File tree

3 files changed

+8
-139
lines changed

3 files changed

+8
-139
lines changed

scripts/YaML.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ class ur_name_t(Structure):
625625
- `range` is used for params that are array pointers to specify the valid range that the is valid to read
626626
+ `start` and `end` must be an ISO-C standard identifier or literal
627627
+ `start` is inclusive and `end` is exclusive
628-
- `release` is used for params that are handles or pointers to handles where the function will destroy any backing memory associated with the handle(s)
628+
- `release` is used for params that are handles or pointers to handles where the function will decrement the handle's reference count, potentially leaving it in an invalid state if the reference count reaches zero.
629629
- `typename` is used to denote the type enum for params that are opaque pointers to values of tagged data types.
630630
- `bounds` is used for params that are memory objects or USM allocations. It specifies the range within the memory allocation represented by the param that will be accessed by the operation.
631631
+ `offset` and `size` must be an ISO-C standard identifier or literal

scripts/templates/ldrddi.cpp.mako

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,15 +271,17 @@ namespace ur_loader
271271
del add_local
272272
%>
273273
%for i, item in enumerate(epilogue):
274-
%if 0 == i:
274+
%if 0 == i and not item['release']:
275275
if( ${X}_RESULT_SUCCESS != result )
276276
return result;
277277
278278
%endif
279-
%if item['release']:
280-
// release loader handle
281-
${item['factory']}.release( ${item['name']} );
282-
%elif not '_native_object_' in item['obj']:
279+
## Before we can re-enable the releases we will need ref-counted object_t.
280+
## See unified-runtime github issue #1784
281+
##%if item['release']:
282+
##// release loader handle
283+
##${item['factory']}.release( ${item['name']} );
284+
%if not item['release'] and not '_native_object_' in item['obj'] or th.make_func_name(n, tags, obj) == 'urPlatformCreateWithNativeHandle':
283285
try
284286
{
285287
%if 'typename' in item:

source/loader/ur_ldrddi.cpp

Lines changed: 0 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,6 @@ __urdlllocal ur_result_t UR_APICALL urAdapterRelease(
101101
// forward to device-platform
102102
result = pfnAdapterRelease(hAdapter);
103103

104-
if (UR_RESULT_SUCCESS != result) {
105-
return result;
106-
}
107-
108-
// release loader handle
109-
ur_adapter_factory.release(hAdapter);
110-
111104
return result;
112105
}
113106

@@ -636,13 +629,6 @@ __urdlllocal ur_result_t UR_APICALL urDeviceRelease(
636629
// forward to device-platform
637630
result = pfnRelease(hDevice);
638631

639-
if (UR_RESULT_SUCCESS != result) {
640-
return result;
641-
}
642-
643-
// release loader handle
644-
ur_device_factory.release(hDevice);
645-
646632
return result;
647633
}
648634

@@ -920,13 +906,6 @@ __urdlllocal ur_result_t UR_APICALL urContextRelease(
920906
// forward to device-platform
921907
result = pfnRelease(hContext);
922908

923-
if (UR_RESULT_SUCCESS != result) {
924-
return result;
925-
}
926-
927-
// release loader handle
928-
ur_context_factory.release(hContext);
929-
930909
return result;
931910
}
932911

@@ -1232,13 +1211,6 @@ __urdlllocal ur_result_t UR_APICALL urMemRelease(
12321211
// forward to device-platform
12331212
result = pfnRelease(hMem);
12341213

1235-
if (UR_RESULT_SUCCESS != result) {
1236-
return result;
1237-
}
1238-
1239-
// release loader handle
1240-
ur_mem_factory.release(hMem);
1241-
12421214
return result;
12431215
}
12441216

@@ -1597,13 +1569,6 @@ __urdlllocal ur_result_t UR_APICALL urSamplerRelease(
15971569
// forward to device-platform
15981570
result = pfnRelease(hSampler);
15991571

1600-
if (UR_RESULT_SUCCESS != result) {
1601-
return result;
1602-
}
1603-
1604-
// release loader handle
1605-
ur_sampler_factory.release(hSampler);
1606-
16071572
return result;
16081573
}
16091574

@@ -2038,13 +2003,6 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolRelease(
20382003
// forward to device-platform
20392004
result = pfnPoolRelease(pPool);
20402005

2041-
if (UR_RESULT_SUCCESS != result) {
2042-
return result;
2043-
}
2044-
2045-
// release loader handle
2046-
ur_usm_pool_factory.release(pPool);
2047-
20482006
return result;
20492007
}
20502008

@@ -2435,13 +2393,6 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemRelease(
24352393
// forward to device-platform
24362394
result = pfnRelease(hPhysicalMem);
24372395

2438-
if (UR_RESULT_SUCCESS != result) {
2439-
return result;
2440-
}
2441-
2442-
// release loader handle
2443-
ur_physical_mem_factory.release(hPhysicalMem);
2444-
24452396
return result;
24462397
}
24472398

@@ -2686,13 +2637,6 @@ __urdlllocal ur_result_t UR_APICALL urProgramRelease(
26862637
// forward to device-platform
26872638
result = pfnRelease(hProgram);
26882639

2689-
if (UR_RESULT_SUCCESS != result) {
2690-
return result;
2691-
}
2692-
2693-
// release loader handle
2694-
ur_program_factory.release(hProgram);
2695-
26962640
return result;
26972641
}
26982642

@@ -3283,13 +3227,6 @@ __urdlllocal ur_result_t UR_APICALL urKernelRelease(
32833227
// forward to device-platform
32843228
result = pfnRelease(hKernel);
32853229

3286-
if (UR_RESULT_SUCCESS != result) {
3287-
return result;
3288-
}
3289-
3290-
// release loader handle
3291-
ur_kernel_factory.release(hKernel);
3292-
32933230
return result;
32943231
}
32953232

@@ -3736,13 +3673,6 @@ __urdlllocal ur_result_t UR_APICALL urQueueRelease(
37363673
// forward to device-platform
37373674
result = pfnRelease(hQueue);
37383675

3739-
if (UR_RESULT_SUCCESS != result) {
3740-
return result;
3741-
}
3742-
3743-
// release loader handle
3744-
ur_queue_factory.release(hQueue);
3745-
37463676
return result;
37473677
}
37483678

@@ -4050,13 +3980,6 @@ __urdlllocal ur_result_t UR_APICALL urEventRelease(
40503980
// forward to device-platform
40513981
result = pfnRelease(hEvent);
40523982

4053-
if (UR_RESULT_SUCCESS != result) {
4054-
return result;
4055-
}
4056-
4057-
// release loader handle
4058-
ur_event_factory.release(hEvent);
4059-
40603983
return result;
40613984
}
40623985

@@ -5919,13 +5842,6 @@ urBindlessImagesUnsampledImageHandleDestroyExp(
59195842
// forward to device-platform
59205843
result = pfnUnsampledImageHandleDestroyExp(hContext, hDevice, hImage);
59215844

5922-
if (UR_RESULT_SUCCESS != result) {
5923-
return result;
5924-
}
5925-
5926-
// release loader handle
5927-
ur_exp_image_factory.release(hImage);
5928-
59295845
return result;
59305846
}
59315847

@@ -5960,13 +5876,6 @@ urBindlessImagesSampledImageHandleDestroyExp(
59605876
// forward to device-platform
59615877
result = pfnSampledImageHandleDestroyExp(hContext, hDevice, hImage);
59625878

5963-
if (UR_RESULT_SUCCESS != result) {
5964-
return result;
5965-
}
5966-
5967-
// release loader handle
5968-
ur_exp_image_factory.release(hImage);
5969-
59705879
return result;
59715880
}
59725881

@@ -6046,13 +5955,6 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageFreeExp(
60465955
// forward to device-platform
60475956
result = pfnImageFreeExp(hContext, hDevice, hImageMem);
60485957

6049-
if (UR_RESULT_SUCCESS != result) {
6050-
return result;
6051-
}
6052-
6053-
// release loader handle
6054-
ur_exp_image_mem_factory.release(hImageMem);
6055-
60565958
return result;
60575959
}
60585960

@@ -6349,13 +6251,6 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMipmapFreeExp(
63496251
// forward to device-platform
63506252
result = pfnMipmapFreeExp(hContext, hDevice, hMem);
63516253

6352-
if (UR_RESULT_SUCCESS != result) {
6353-
return result;
6354-
}
6355-
6356-
// release loader handle
6357-
ur_exp_image_mem_factory.release(hMem);
6358-
63596254
return result;
63606255
}
63616256

@@ -6490,13 +6385,6 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesReleaseInteropExp(
64906385
// forward to device-platform
64916386
result = pfnReleaseInteropExp(hContext, hDevice, hInteropMem);
64926387

6493-
if (UR_RESULT_SUCCESS != result) {
6494-
return result;
6495-
}
6496-
6497-
// release loader handle
6498-
ur_exp_interop_mem_factory.release(hInteropMem);
6499-
65006388
return result;
65016389
}
65026390

@@ -6583,13 +6471,6 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesDestroyExternalSemaphoreExp(
65836471
result =
65846472
pfnDestroyExternalSemaphoreExp(hContext, hDevice, hInteropSemaphore);
65856473

6586-
if (UR_RESULT_SUCCESS != result) {
6587-
return result;
6588-
}
6589-
6590-
// release loader handle
6591-
ur_exp_interop_semaphore_factory.release(hInteropSemaphore);
6592-
65936474
return result;
65946475
}
65956476

@@ -6833,13 +6714,6 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferReleaseExp(
68336714
// forward to device-platform
68346715
result = pfnReleaseExp(hCommandBuffer);
68356716

6836-
if (UR_RESULT_SUCCESS != result) {
6837-
return result;
6838-
}
6839-
6840-
// release loader handle
6841-
ur_exp_command_buffer_factory.release(hCommandBuffer);
6842-
68436717
return result;
68446718
}
68456719

@@ -7586,13 +7460,6 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferReleaseCommandExp(
75867460
// forward to device-platform
75877461
result = pfnReleaseCommandExp(hCommand);
75887462

7589-
if (UR_RESULT_SUCCESS != result) {
7590-
return result;
7591-
}
7592-
7593-
// release loader handle
7594-
ur_exp_command_buffer_command_factory.release(hCommand);
7595-
75967463
return result;
75977464
}
75987465

0 commit comments

Comments
 (0)