Skip to content

Commit

Permalink
Disable generating loader release calls + reword release tag docs
Browse files Browse the repository at this point in the history
  • Loading branch information
aarongreig committed Jul 2, 2024
1 parent 326bad6 commit c246813
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 139 deletions.
2 changes: 1 addition & 1 deletion scripts/YaML.md
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ class ur_name_t(Structure):
- `range` is used for params that are array pointers to specify the valid range that the is valid to read
+ `start` and `end` must be an ISO-C standard identifier or literal
+ `start` is inclusive and `end` is exclusive
- `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)
- `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.
- `typename` is used to denote the type enum for params that are opaque pointers to values of tagged data types.
- `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.
+ `offset` and `size` must be an ISO-C standard identifier or literal
Expand Down
12 changes: 7 additions & 5 deletions scripts/templates/ldrddi.cpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,17 @@ namespace ur_loader
del add_local
%>
%for i, item in enumerate(epilogue):
%if 0 == i:
%if 0 == i and not item['release']:
if( ${X}_RESULT_SUCCESS != result )
return result;
%endif
%if item['release']:
// release loader handle
${item['factory']}.release( ${item['name']} );
%elif not '_native_object_' in item['obj']:
## Before we can re-enable the releases we will need ref-counted object_t.
## See unified-runtime github issue #1784
##%if item['release']:
##// release loader handle
##${item['factory']}.release( ${item['name']} );
%if not item['release'] and not '_native_object_' in item['obj'] or th.make_func_name(n, tags, obj) == 'urPlatformCreateWithNativeHandle':
try
{
%if 'typename' in item:
Expand Down
133 changes: 0 additions & 133 deletions source/loader/ur_ldrddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,6 @@ __urdlllocal ur_result_t UR_APICALL urAdapterRelease(
// forward to device-platform
result = pfnAdapterRelease(hAdapter);

if (UR_RESULT_SUCCESS != result) {
return result;
}

// release loader handle
ur_adapter_factory.release(hAdapter);

return result;
}

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

if (UR_RESULT_SUCCESS != result) {
return result;
}

// release loader handle
ur_device_factory.release(hDevice);

return result;
}

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

if (UR_RESULT_SUCCESS != result) {
return result;
}

// release loader handle
ur_context_factory.release(hContext);

return result;
}

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

if (UR_RESULT_SUCCESS != result) {
return result;
}

// release loader handle
ur_mem_factory.release(hMem);

return result;
}

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

if (UR_RESULT_SUCCESS != result) {
return result;
}

// release loader handle
ur_sampler_factory.release(hSampler);

return result;
}

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

if (UR_RESULT_SUCCESS != result) {
return result;
}

// release loader handle
ur_usm_pool_factory.release(pPool);

return result;
}

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

if (UR_RESULT_SUCCESS != result) {
return result;
}

// release loader handle
ur_physical_mem_factory.release(hPhysicalMem);

return result;
}

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

if (UR_RESULT_SUCCESS != result) {
return result;
}

// release loader handle
ur_program_factory.release(hProgram);

return result;
}

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

if (UR_RESULT_SUCCESS != result) {
return result;
}

// release loader handle
ur_kernel_factory.release(hKernel);

return result;
}

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

if (UR_RESULT_SUCCESS != result) {
return result;
}

// release loader handle
ur_queue_factory.release(hQueue);

return result;
}

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

if (UR_RESULT_SUCCESS != result) {
return result;
}

// release loader handle
ur_event_factory.release(hEvent);

return result;
}

Expand Down Expand Up @@ -5919,13 +5842,6 @@ urBindlessImagesUnsampledImageHandleDestroyExp(
// forward to device-platform
result = pfnUnsampledImageHandleDestroyExp(hContext, hDevice, hImage);

if (UR_RESULT_SUCCESS != result) {
return result;
}

// release loader handle
ur_exp_image_factory.release(hImage);

return result;
}

Expand Down Expand Up @@ -5960,13 +5876,6 @@ urBindlessImagesSampledImageHandleDestroyExp(
// forward to device-platform
result = pfnSampledImageHandleDestroyExp(hContext, hDevice, hImage);

if (UR_RESULT_SUCCESS != result) {
return result;
}

// release loader handle
ur_exp_image_factory.release(hImage);

return result;
}

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

if (UR_RESULT_SUCCESS != result) {
return result;
}

// release loader handle
ur_exp_image_mem_factory.release(hImageMem);

return result;
}

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

if (UR_RESULT_SUCCESS != result) {
return result;
}

// release loader handle
ur_exp_image_mem_factory.release(hMem);

return result;
}

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

if (UR_RESULT_SUCCESS != result) {
return result;
}

// release loader handle
ur_exp_interop_mem_factory.release(hInteropMem);

return result;
}

Expand Down Expand Up @@ -6583,13 +6471,6 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesDestroyExternalSemaphoreExp(
result =
pfnDestroyExternalSemaphoreExp(hContext, hDevice, hInteropSemaphore);

if (UR_RESULT_SUCCESS != result) {
return result;
}

// release loader handle
ur_exp_interop_semaphore_factory.release(hInteropSemaphore);

return result;
}

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

if (UR_RESULT_SUCCESS != result) {
return result;
}

// release loader handle
ur_exp_command_buffer_factory.release(hCommandBuffer);

return result;
}

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

if (UR_RESULT_SUCCESS != result) {
return result;
}

// release loader handle
ur_exp_command_buffer_command_factory.release(hCommand);

return result;
}

Expand Down

0 comments on commit c246813

Please sign in to comment.