Skip to content

Commit ddd721f

Browse files
committed
Fix rebase issues
1 parent fbdb472 commit ddd721f

File tree

5 files changed

+5
-156
lines changed

5 files changed

+5
-156
lines changed

include/ur_api.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ typedef enum ur_function_t {
226226
UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_MEMORY_EXP = 226, ///< Enumerator for ::urBindlessImagesImportExternalMemoryExp
227227
UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_EXP = 227, ///< Enumerator for ::urBindlessImagesImportExternalSemaphoreExp
228228
UR_FUNCTION_ENQUEUE_NATIVE_COMMAND_EXP = 228, ///< Enumerator for ::urEnqueueNativeCommandExp
229-
UR_FUNCTION_LOADER_CONFIG_SET_MOCKING_ENABLED = 231, ///< Enumerator for ::urLoaderConfigSetMockingEnabled
229+
UR_FUNCTION_LOADER_CONFIG_SET_MOCKING_ENABLED = 229, ///< Enumerator for ::urLoaderConfigSetMockingEnabled
230230
/// @cond
231231
UR_FUNCTION_FORCE_UINT32 = 0x7fffffff
232232
/// @endcond

scripts/core/INTRO.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ For more information about the usage of mentioned environment variables see `Env
259259
Mocking
260260
---------------------
261261
A mock UR adapter can be accessed for test purposes by enabling it via
262-
${x}LoaderConfigSetMockingEnabled.
262+
${x}LoaderConfigSetMockingEnabled.
263263

264264
The default fallback behavior for entry points in the mock adapter is to simply
265265
return ``UR_RESULT_SUCCESS``. For entry points concerning handles, i.e. those

scripts/core/registry.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ etors:
594594
value: '228'
595595
- name: LOADER_CONFIG_SET_MOCKING_ENABLED
596596
desc: Enumerator for $xLoaderConfigSetMockingEnabled
597-
value: '231'
597+
value: '229'
598598
---
599599
type: enum
600600
desc: Defines structure types

scripts/templates/ldrddi.cpp.mako

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ namespace ur_loader
271271
del add_local
272272
%>
273273
%for i, item in enumerate(epilogue):
274-
%if 0 == i and not item['release']:
274+
%if 0 == i and not item['release'] and not item['retain']:
275275
if( ${X}_RESULT_SUCCESS != result )
276276
return result;
277277
@@ -281,7 +281,7 @@ namespace ur_loader
281281
##%if item['release']:
282282
##// release loader handle
283283
##${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':
284+
%if not item['release'] and not item['retain'] and not '_native_object_' in item['obj'] or th.make_func_name(n, tags, obj) == 'urPlatformCreateWithNativeHandle':
285285
try
286286
{
287287
%if 'typename' in item:

source/loader/ur_ldrddi.cpp

Lines changed: 0 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,6 @@ __urdlllocal ur_result_t UR_APICALL urAdapterRetain(
124124
// forward to device-platform
125125
result = pfnAdapterRetain(hAdapter);
126126

127-
if (UR_RESULT_SUCCESS != result) {
128-
return result;
129-
}
130-
131-
try {
132-
// convert platform handle to loader handle
133-
*hAdapter = reinterpret_cast<ur_adapter_handle_t>(
134-
ur_adapter_factory.getInstance(*hAdapter, dditable));
135-
} catch (std::bad_alloc &) {
136-
result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
137-
}
138-
139127
return result;
140128
}
141129

@@ -617,18 +605,6 @@ __urdlllocal ur_result_t UR_APICALL urDeviceRetain(
617605
// forward to device-platform
618606
result = pfnRetain(hDevice);
619607

620-
if (UR_RESULT_SUCCESS != result) {
621-
return result;
622-
}
623-
624-
try {
625-
// convert platform handle to loader handle
626-
*hDevice = reinterpret_cast<ur_device_handle_t>(
627-
ur_device_factory.getInstance(*hDevice, dditable));
628-
} catch (std::bad_alloc &) {
629-
result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
630-
}
631-
632608
return result;
633609
}
634610

@@ -906,18 +882,6 @@ __urdlllocal ur_result_t UR_APICALL urContextRetain(
906882
// forward to device-platform
907883
result = pfnRetain(hContext);
908884

909-
if (UR_RESULT_SUCCESS != result) {
910-
return result;
911-
}
912-
913-
try {
914-
// convert platform handle to loader handle
915-
*hContext = reinterpret_cast<ur_context_handle_t>(
916-
ur_context_factory.getInstance(*hContext, dditable));
917-
} catch (std::bad_alloc &) {
918-
result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
919-
}
920-
921885
return result;
922886
}
923887

@@ -1224,18 +1188,6 @@ __urdlllocal ur_result_t UR_APICALL urMemRetain(
12241188
// forward to device-platform
12251189
result = pfnRetain(hMem);
12261190

1227-
if (UR_RESULT_SUCCESS != result) {
1228-
return result;
1229-
}
1230-
1231-
try {
1232-
// convert platform handle to loader handle
1233-
*hMem = reinterpret_cast<ur_mem_handle_t>(
1234-
ur_mem_factory.getInstance(*hMem, dditable));
1235-
} catch (std::bad_alloc &) {
1236-
result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
1237-
}
1238-
12391191
return result;
12401192
}
12411193

@@ -1594,18 +1546,6 @@ __urdlllocal ur_result_t UR_APICALL urSamplerRetain(
15941546
// forward to device-platform
15951547
result = pfnRetain(hSampler);
15961548

1597-
if (UR_RESULT_SUCCESS != result) {
1598-
return result;
1599-
}
1600-
1601-
try {
1602-
// convert platform handle to loader handle
1603-
*hSampler = reinterpret_cast<ur_sampler_handle_t>(
1604-
ur_sampler_factory.getInstance(*hSampler, dditable));
1605-
} catch (std::bad_alloc &) {
1606-
result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
1607-
}
1608-
16091549
return result;
16101550
}
16111551

@@ -2041,18 +1981,6 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolRetain(
20411981
// forward to device-platform
20421982
result = pfnPoolRetain(pPool);
20431983

2044-
if (UR_RESULT_SUCCESS != result) {
2045-
return result;
2046-
}
2047-
2048-
try {
2049-
// convert platform handle to loader handle
2050-
*pPool = reinterpret_cast<ur_usm_pool_handle_t>(
2051-
ur_usm_pool_factory.getInstance(*pPool, dditable));
2052-
} catch (std::bad_alloc &) {
2053-
result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
2054-
}
2055-
20561984
return result;
20571985
}
20581986

@@ -2440,18 +2368,6 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemRetain(
24402368
// forward to device-platform
24412369
result = pfnRetain(hPhysicalMem);
24422370

2443-
if (UR_RESULT_SUCCESS != result) {
2444-
return result;
2445-
}
2446-
2447-
try {
2448-
// convert platform handle to loader handle
2449-
*hPhysicalMem = reinterpret_cast<ur_physical_mem_handle_t>(
2450-
ur_physical_mem_factory.getInstance(*hPhysicalMem, dditable));
2451-
} catch (std::bad_alloc &) {
2452-
result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
2453-
}
2454-
24552371
return result;
24562372
}
24572373

@@ -2699,18 +2615,6 @@ __urdlllocal ur_result_t UR_APICALL urProgramRetain(
26992615
// forward to device-platform
27002616
result = pfnRetain(hProgram);
27012617

2702-
if (UR_RESULT_SUCCESS != result) {
2703-
return result;
2704-
}
2705-
2706-
try {
2707-
// convert platform handle to loader handle
2708-
*hProgram = reinterpret_cast<ur_program_handle_t>(
2709-
ur_program_factory.getInstance(*hProgram, dditable));
2710-
} catch (std::bad_alloc &) {
2711-
result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
2712-
}
2713-
27142618
return result;
27152619
}
27162620

@@ -3301,18 +3205,6 @@ __urdlllocal ur_result_t UR_APICALL urKernelRetain(
33013205
// forward to device-platform
33023206
result = pfnRetain(hKernel);
33033207

3304-
if (UR_RESULT_SUCCESS != result) {
3305-
return result;
3306-
}
3307-
3308-
try {
3309-
// convert platform handle to loader handle
3310-
*hKernel = reinterpret_cast<ur_kernel_handle_t>(
3311-
ur_kernel_factory.getInstance(*hKernel, dditable));
3312-
} catch (std::bad_alloc &) {
3313-
result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
3314-
}
3315-
33163208
return result;
33173209
}
33183210

@@ -3760,18 +3652,6 @@ __urdlllocal ur_result_t UR_APICALL urQueueRetain(
37603652
// forward to device-platform
37613653
result = pfnRetain(hQueue);
37623654

3763-
if (UR_RESULT_SUCCESS != result) {
3764-
return result;
3765-
}
3766-
3767-
try {
3768-
// convert platform handle to loader handle
3769-
*hQueue = reinterpret_cast<ur_queue_handle_t>(
3770-
ur_queue_factory.getInstance(*hQueue, dditable));
3771-
} catch (std::bad_alloc &) {
3772-
result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
3773-
}
3774-
37753655
return result;
37763656
}
37773657

@@ -4080,18 +3960,6 @@ __urdlllocal ur_result_t UR_APICALL urEventRetain(
40803960
// forward to device-platform
40813961
result = pfnRetain(hEvent);
40823962

4083-
if (UR_RESULT_SUCCESS != result) {
4084-
return result;
4085-
}
4086-
4087-
try {
4088-
// convert platform handle to loader handle
4089-
*hEvent = reinterpret_cast<ur_event_handle_t>(
4090-
ur_event_factory.getInstance(*hEvent, dditable));
4091-
} catch (std::bad_alloc &) {
4092-
result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
4093-
}
4094-
40953963
return result;
40963964
}
40973965

@@ -6821,19 +6689,6 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferRetainExp(
68216689
// forward to device-platform
68226690
result = pfnRetainExp(hCommandBuffer);
68236691

6824-
if (UR_RESULT_SUCCESS != result) {
6825-
return result;
6826-
}
6827-
6828-
try {
6829-
// convert platform handle to loader handle
6830-
*hCommandBuffer = reinterpret_cast<ur_exp_command_buffer_handle_t>(
6831-
ur_exp_command_buffer_factory.getInstance(*hCommandBuffer,
6832-
dditable));
6833-
} catch (std::bad_alloc &) {
6834-
result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
6835-
}
6836-
68376692
return result;
68386693
}
68396694

@@ -7579,12 +7434,6 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferRetainCommandExp(
75797434
// forward to device-platform
75807435
result = pfnRetainCommandExp(hCommand);
75817436

7582-
if (UR_RESULT_SUCCESS != result) {
7583-
return result;
7584-
}
7585-
7586-
// TODO: do we need to ref count the loader handles?
7587-
75887437
return result;
75897438
}
75907439

0 commit comments

Comments
 (0)