Skip to content

Commit 71d123c

Browse files
committed
Merge branch 'main' into detect-memory-leak
2 parents 8c524ef + 0abf370 commit 71d123c

File tree

92 files changed

+4795
-3851
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+4795
-3851
lines changed

cmake/helpers.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ function(add_ur_library name)
131131
add_library(${name} ${ARGN})
132132
add_ur_target_compile_options(${name})
133133
add_ur_target_link_options(${name})
134+
if(MSVC)
135+
target_link_options(${name} PRIVATE
136+
$<$<STREQUAL:$<TARGET_LINKER_FILE_NAME:${name}>,link.exe>:/DEPENDENTLOADFLAG:0x2000>
137+
)
138+
endif()
134139
endfunction()
135140

136141
include(FetchContent)

include/ur_api.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ typedef enum ur_function_t {
164164
UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_FREE_EXP = 142, ///< Enumerator for ::urBindlessImagesMipmapFreeExp
165165
UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_ARRAY_EXP = 144, ///< Enumerator for ::urBindlessImagesMapExternalArrayExp
166166
UR_FUNCTION_BINDLESS_IMAGES_RELEASE_INTEROP_EXP = 145, ///< Enumerator for ::urBindlessImagesReleaseInteropExp
167-
UR_FUNCTION_BINDLESS_IMAGES_DESTROY_EXTERNAL_SEMAPHORE_EXP = 147, ///< Enumerator for ::urBindlessImagesDestroyExternalSemaphoreExp
167+
UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_SEMAPHORE_EXP = 147, ///< Enumerator for ::urBindlessImagesReleaseExternalSemaphoreExp
168168
UR_FUNCTION_BINDLESS_IMAGES_WAIT_EXTERNAL_SEMAPHORE_EXP = 148, ///< Enumerator for ::urBindlessImagesWaitExternalSemaphoreExp
169169
UR_FUNCTION_BINDLESS_IMAGES_SIGNAL_EXTERNAL_SEMAPHORE_EXP = 149, ///< Enumerator for ::urBindlessImagesSignalExternalSemaphoreExp
170170
UR_FUNCTION_ENQUEUE_USM_FILL_2D = 151, ///< Enumerator for ::urEnqueueUSMFill2D
@@ -7773,7 +7773,7 @@ UR_APIEXPORT ur_result_t UR_APICALL
77737773
urBindlessImagesImageCopyExp(
77747774
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
77757775
void *pDst, ///< [in] location the data will be copied to
7776-
void *pSrc, ///< [in] location the data will be copied from
7776+
const void *pSrc, ///< [in] location the data will be copied from
77777777
const ur_image_format_t *pImageFormat, ///< [in] pointer to image format specification
77787778
const ur_image_desc_t *pImageDesc, ///< [in] pointer to image description
77797779
ur_exp_image_copy_flags_t imageCopyFlags, ///< [in] flags describing copy direction e.g. H2D or D2H
@@ -7944,7 +7944,7 @@ urBindlessImagesMapExternalArrayExp(
79447944
);
79457945

79467946
///////////////////////////////////////////////////////////////////////////////
7947-
/// @brief Destroy interop memory
7947+
/// @brief Release interop memory
79487948
///
79497949
/// @remarks
79507950
/// _Analogues_
@@ -7965,7 +7965,7 @@ UR_APIEXPORT ur_result_t UR_APICALL
79657965
urBindlessImagesReleaseInteropExp(
79667966
ur_context_handle_t hContext, ///< [in] handle of the context object
79677967
ur_device_handle_t hDevice, ///< [in] handle of the device object
7968-
ur_exp_interop_mem_handle_t hInteropMem ///< [in][release] handle of interop memory to be freed
7968+
ur_exp_interop_mem_handle_t hInteropMem ///< [in][release] handle of interop memory to be destroyed
79697969
);
79707970

79717971
///////////////////////////////////////////////////////////////////////////////
@@ -8000,7 +8000,7 @@ urBindlessImagesImportExternalSemaphoreExp(
80008000
);
80018001

80028002
///////////////////////////////////////////////////////////////////////////////
8003-
/// @brief Destroy the external semaphore handle
8003+
/// @brief Release the external semaphore
80048004
///
80058005
/// @remarks
80068006
/// _Analogues_
@@ -8018,7 +8018,7 @@ urBindlessImagesImportExternalSemaphoreExp(
80188018
/// - ::UR_RESULT_ERROR_INVALID_CONTEXT
80198019
/// - ::UR_RESULT_ERROR_INVALID_VALUE
80208020
UR_APIEXPORT ur_result_t UR_APICALL
8021-
urBindlessImagesDestroyExternalSemaphoreExp(
8021+
urBindlessImagesReleaseExternalSemaphoreExp(
80228022
ur_context_handle_t hContext, ///< [in] handle of the context object
80238023
ur_device_handle_t hDevice, ///< [in] handle of the device object
80248024
ur_exp_interop_semaphore_handle_t hInteropSemaphore ///< [in][release] handle of interop semaphore to be destroyed
@@ -11139,7 +11139,7 @@ typedef struct ur_bindless_images_sampled_image_create_exp_params_t {
1113911139
typedef struct ur_bindless_images_image_copy_exp_params_t {
1114011140
ur_queue_handle_t *phQueue;
1114111141
void **ppDst;
11142-
void **ppSrc;
11142+
const void **ppSrc;
1114311143
const ur_image_format_t **ppImageFormat;
1114411144
const ur_image_desc_t **ppImageDesc;
1114511145
ur_exp_image_copy_flags_t *pimageCopyFlags;
@@ -11235,14 +11235,14 @@ typedef struct ur_bindless_images_import_external_semaphore_exp_params_t {
1123511235
} ur_bindless_images_import_external_semaphore_exp_params_t;
1123611236

1123711237
///////////////////////////////////////////////////////////////////////////////
11238-
/// @brief Function parameters for urBindlessImagesDestroyExternalSemaphoreExp
11238+
/// @brief Function parameters for urBindlessImagesReleaseExternalSemaphoreExp
1123911239
/// @details Each entry is a pointer to the parameter passed to the function;
1124011240
/// allowing the callback the ability to modify the parameter's value
11241-
typedef struct ur_bindless_images_destroy_external_semaphore_exp_params_t {
11241+
typedef struct ur_bindless_images_release_external_semaphore_exp_params_t {
1124211242
ur_context_handle_t *phContext;
1124311243
ur_device_handle_t *phDevice;
1124411244
ur_exp_interop_semaphore_handle_t *phInteropSemaphore;
11245-
} ur_bindless_images_destroy_external_semaphore_exp_params_t;
11245+
} ur_bindless_images_release_external_semaphore_exp_params_t;
1124611246

1124711247
///////////////////////////////////////////////////////////////////////////////
1124811248
/// @brief Function parameters for urBindlessImagesWaitExternalSemaphoreExp

include/ur_ddi.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,7 +1582,7 @@ typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesSampledImageCreateExp_t)(
15821582
typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesImageCopyExp_t)(
15831583
ur_queue_handle_t,
15841584
void *,
1585-
void *,
1585+
const void *,
15861586
const ur_image_format_t *,
15871587
const ur_image_desc_t *,
15881588
ur_exp_image_copy_flags_t,
@@ -1656,8 +1656,8 @@ typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesImportExternalSemaphoreExp_t
16561656
ur_exp_interop_semaphore_handle_t *);
16571657

16581658
///////////////////////////////////////////////////////////////////////////////
1659-
/// @brief Function-pointer for urBindlessImagesDestroyExternalSemaphoreExp
1660-
typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesDestroyExternalSemaphoreExp_t)(
1659+
/// @brief Function-pointer for urBindlessImagesReleaseExternalSemaphoreExp
1660+
typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesReleaseExternalSemaphoreExp_t)(
16611661
ur_context_handle_t,
16621662
ur_device_handle_t,
16631663
ur_exp_interop_semaphore_handle_t);
@@ -1701,7 +1701,7 @@ typedef struct ur_bindless_images_exp_dditable_t {
17011701
ur_pfnBindlessImagesMapExternalArrayExp_t pfnMapExternalArrayExp;
17021702
ur_pfnBindlessImagesReleaseInteropExp_t pfnReleaseInteropExp;
17031703
ur_pfnBindlessImagesImportExternalSemaphoreExp_t pfnImportExternalSemaphoreExp;
1704-
ur_pfnBindlessImagesDestroyExternalSemaphoreExp_t pfnDestroyExternalSemaphoreExp;
1704+
ur_pfnBindlessImagesReleaseExternalSemaphoreExp_t pfnReleaseExternalSemaphoreExp;
17051705
ur_pfnBindlessImagesWaitExternalSemaphoreExp_t pfnWaitExternalSemaphoreExp;
17061706
ur_pfnBindlessImagesSignalExternalSemaphoreExp_t pfnSignalExternalSemaphoreExp;
17071707
} ur_bindless_images_exp_dditable_t;

include/ur_print.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2155,12 +2155,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urPrintBindlessImagesReleaseInteropExpParams
21552155
UR_APIEXPORT ur_result_t UR_APICALL urPrintBindlessImagesImportExternalSemaphoreExpParams(const struct ur_bindless_images_import_external_semaphore_exp_params_t *params, char *buffer, const size_t buff_size, size_t *out_size);
21562156

21572157
///////////////////////////////////////////////////////////////////////////////
2158-
/// @brief Print ur_bindless_images_destroy_external_semaphore_exp_params_t struct
2158+
/// @brief Print ur_bindless_images_release_external_semaphore_exp_params_t struct
21592159
/// @returns
21602160
/// - ::UR_RESULT_SUCCESS
21612161
/// - ::UR_RESULT_ERROR_INVALID_SIZE
21622162
/// - `buff_size < out_size`
2163-
UR_APIEXPORT ur_result_t UR_APICALL urPrintBindlessImagesDestroyExternalSemaphoreExpParams(const struct ur_bindless_images_destroy_external_semaphore_exp_params_t *params, char *buffer, const size_t buff_size, size_t *out_size);
2163+
UR_APIEXPORT ur_result_t UR_APICALL urPrintBindlessImagesReleaseExternalSemaphoreExpParams(const struct ur_bindless_images_release_external_semaphore_exp_params_t *params, char *buffer, const size_t buff_size, size_t *out_size);
21642164

21652165
///////////////////////////////////////////////////////////////////////////////
21662166
/// @brief Print ur_bindless_images_wait_external_semaphore_exp_params_t struct

include/ur_print.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -752,8 +752,8 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) {
752752
case UR_FUNCTION_BINDLESS_IMAGES_RELEASE_INTEROP_EXP:
753753
os << "UR_FUNCTION_BINDLESS_IMAGES_RELEASE_INTEROP_EXP";
754754
break;
755-
case UR_FUNCTION_BINDLESS_IMAGES_DESTROY_EXTERNAL_SEMAPHORE_EXP:
756-
os << "UR_FUNCTION_BINDLESS_IMAGES_DESTROY_EXTERNAL_SEMAPHORE_EXP";
755+
case UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_SEMAPHORE_EXP:
756+
os << "UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_SEMAPHORE_EXP";
757757
break;
758758
case UR_FUNCTION_BINDLESS_IMAGES_WAIT_EXTERNAL_SEMAPHORE_EXP:
759759
os << "UR_FUNCTION_BINDLESS_IMAGES_WAIT_EXTERNAL_SEMAPHORE_EXP";
@@ -15191,10 +15191,10 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct
1519115191
}
1519215192

1519315193
///////////////////////////////////////////////////////////////////////////////
15194-
/// @brief Print operator for the ur_bindless_images_destroy_external_semaphore_exp_params_t type
15194+
/// @brief Print operator for the ur_bindless_images_release_external_semaphore_exp_params_t type
1519515195
/// @returns
1519615196
/// std::ostream &
15197-
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_bindless_images_destroy_external_semaphore_exp_params_t *params) {
15197+
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_bindless_images_release_external_semaphore_exp_params_t *params) {
1519815198

1519915199
os << ".hContext = ";
1520015200

@@ -17747,8 +17747,8 @@ inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, ur_function_
1774717747
case UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_EXP: {
1774817748
os << (const struct ur_bindless_images_import_external_semaphore_exp_params_t *)params;
1774917749
} break;
17750-
case UR_FUNCTION_BINDLESS_IMAGES_DESTROY_EXTERNAL_SEMAPHORE_EXP: {
17751-
os << (const struct ur_bindless_images_destroy_external_semaphore_exp_params_t *)params;
17750+
case UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_SEMAPHORE_EXP: {
17751+
os << (const struct ur_bindless_images_release_external_semaphore_exp_params_t *)params;
1775217752
} break;
1775317753
case UR_FUNCTION_BINDLESS_IMAGES_WAIT_EXTERNAL_SEMAPHORE_EXP: {
1775417754
os << (const struct ur_bindless_images_wait_external_semaphore_exp_params_t *)params;

scripts/core/EXP-BINDLESS-IMAGES.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Enums
138138
* ${X}_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_ARRAY_EXP
139139
* ${X}_FUNCTION_BINDLESS_IMAGES_RELEASE_INTEROP_EXP
140140
* ${X}_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_EXP
141-
* ${X}_FUNCTION_BINDLESS_IMAGES_DESTROY_EXTERNAL_SEMAPHORE_EXP
141+
* ${X}_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_SEMAPHORE_EXP
142142
* ${X}_FUNCTION_BINDLESS_IMAGES_WAIT_EXTERNAL_SEMAPHORE_EXP
143143
* ${X}_FUNCTION_BINDLESS_IMAGES_SIGNAL_EXTERNAL_SEMAPHORE_EXP
144144

@@ -181,7 +181,7 @@ Functions
181181
* ${x}BindlessImagesMapExternalArrayExp
182182
* ${x}BindlessImagesReleaseInteropExp
183183
* ${x}BindlessImagesImportExternalSemaphoreExp
184-
* ${x}BindlessImagesDestroyExternalSemaphoreExp
184+
* ${x}BindlessImagesReleaseExternalSemaphoreExp
185185
* ${x}BindlessImagesWaitExternalSemaphoreExp
186186
* ${x}BindlessImagesSignalExternalSemaphoreExp
187187

@@ -237,6 +237,9 @@ Changelog
237237
| || - ${X}_EXP_EXTERNAL_MEM_TYPE_WIN32_NT_DX12_RESOURCE |
238238
| || - ${X}_EXP_EXTERNAL_SEMAPHORE_TYPE_WIN32_NT_DX12_FENCE |
239239
+------------------------------------------------------------------------+
240+
| 14.0 || Rename func BindlessImagesDestroyExternalSemaphoreExp to |
241+
| || BindlessImagesReleaseExternalSemaphoreExp |
242+
+------------------------------------------------------------------------+
240243

241244
Contributors
242245
--------------------------------------------------------------------------------

scripts/core/exp-bindless-images.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ params:
527527
- type: void*
528528
name: pDst
529529
desc: "[in] location the data will be copied to"
530-
- type: void*
530+
- type: const void*
531531
name: pSrc
532532
desc: "[in] location the data will be copied from"
533533
- type: "const $x_image_format_t*"
@@ -717,7 +717,7 @@ returns:
717717
- $X_RESULT_ERROR_OUT_OF_RESOURCES
718718
--- #--------------------------------------------------------------------------
719719
type: function
720-
desc: "Destroy interop memory"
720+
desc: "Release interop memory"
721721
class: $xBindlessImages
722722
name: ReleaseInteropExp
723723
ordinal: "0"
@@ -732,7 +732,7 @@ params:
732732
desc: "[in] handle of the device object"
733733
- type: $x_exp_interop_mem_handle_t
734734
name: hInteropMem
735-
desc: "[in][release] handle of interop memory to be freed"
735+
desc: "[in][release] handle of interop memory to be destroyed"
736736
returns:
737737
- $X_RESULT_ERROR_INVALID_CONTEXT
738738
- $X_RESULT_ERROR_INVALID_VALUE
@@ -765,9 +765,9 @@ returns:
765765
- $X_RESULT_ERROR_INVALID_VALUE
766766
--- #--------------------------------------------------------------------------
767767
type: function
768-
desc: "Destroy the external semaphore handle"
768+
desc: "Release the external semaphore"
769769
class: $xBindlessImages
770-
name: DestroyExternalSemaphoreExp
770+
name: ReleaseExternalSemaphoreExp
771771
ordinal: "0"
772772
analogue:
773773
- "**cuDestroyExternalSemaphore**"

scripts/core/registry.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ etors:
406406
- name: BINDLESS_IMAGES_RELEASE_INTEROP_EXP
407407
desc: Enumerator for $xBindlessImagesReleaseInteropExp
408408
value: '145'
409-
- name: BINDLESS_IMAGES_DESTROY_EXTERNAL_SEMAPHORE_EXP
410-
desc: Enumerator for $xBindlessImagesDestroyExternalSemaphoreExp
409+
- name: BINDLESS_IMAGES_RELEASE_EXTERNAL_SEMAPHORE_EXP
410+
desc: Enumerator for $xBindlessImagesReleaseExternalSemaphoreExp
411411
value: '147'
412412
- name: BINDLESS_IMAGES_WAIT_EXTERNAL_SEMAPHORE_EXP
413413
desc: Enumerator for $xBindlessImagesWaitExternalSemaphoreExp

scripts/templates/ldrddi.cpp.mako

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,6 @@ from templates import helper as th
2323

2424
namespace ur_loader
2525
{
26-
///////////////////////////////////////////////////////////////////////////////
27-
%for obj in th.get_adapter_handles(specs):
28-
%if 'class' in obj:
29-
<%
30-
_handle_t = th.subt(n, tags, obj['name'])
31-
_factory_t = re.sub(r"(\w+)_handle_t", r"\1_factory_t", _handle_t)
32-
_factory = re.sub(r"(\w+)_handle_t", r"\1_factory", _handle_t)
33-
%>${th.append_ws(_factory_t, 35)} ${_factory};
34-
%endif
35-
%endfor
36-
3726
%for obj in th.get_adapter_functions(specs):
3827
///////////////////////////////////////////////////////////////////////////////
3928
/// @brief Intercept function for ${th.make_func_name(n, tags, obj)}
@@ -51,6 +40,7 @@ namespace ur_loader
5140
add_local = False
5241
%>${th.get_initial_null_set(obj)}
5342

43+
[[maybe_unused]] auto context = getContext();
5444
%if re.match(r"\w+AdapterGet$", th.make_func_name(n, tags, obj)):
5545

5646
size_t adapterIndex = 0;
@@ -63,7 +53,7 @@ namespace ur_loader
6353
platform.dditable.${n}.${th.get_table_name(n, tags, obj)}.${th.make_pfn_name(n, tags, obj)}( 1, &${obj['params'][1]['name']}[adapterIndex], nullptr );
6454
try
6555
{
66-
${obj['params'][1]['name']}[adapterIndex] = reinterpret_cast<${n}_adapter_handle_t>(${n}_adapter_factory.getInstance(
56+
${obj['params'][1]['name']}[adapterIndex] = reinterpret_cast<${n}_adapter_handle_t>(context->factories.${n}_adapter_factory.getInstance(
6757
${obj['params'][1]['name']}[adapterIndex], &platform.dditable
6858
));
6959
}
@@ -114,7 +104,7 @@ namespace ur_loader
114104
for( uint32_t i = 0; i < library_platform_handle_count; ++i ) {
115105
uint32_t platform_index = total_platform_handle_count + i;
116106
${obj['params'][3]['name']}[ platform_index ] = reinterpret_cast<${n}_platform_handle_t>(
117-
${n}_platform_factory.getInstance( ${obj['params'][3]['name']}[ platform_index ], dditable ) );
107+
context->factories.${n}_platform_factory.getInstance( ${obj['params'][3]['name']}[ platform_index ], dditable ) );
118108
}
119109
}
120110
catch( std::bad_alloc& )
@@ -272,9 +262,16 @@ namespace ur_loader
272262
%>
273263
%for i, item in enumerate(epilogue):
274264
%if 0 == i and not item['release'] and not item['retain'] and not th.always_wrap_outputs(obj):
275-
if( ${X}_RESULT_SUCCESS != result )
265+
## TODO: Remove once we have a concrete way for submitting warnings in place.
266+
%if re.match(r"urEnqueue\w+", th.make_func_name(n, tags, obj)):
267+
// In the event of ERROR_ADAPTER_SPECIFIC we should still attempt to wrap any output handles below.
268+
if( ${X}_RESULT_SUCCESS != result && ${X}_RESULT_ERROR_ADAPTER_SPECIFIC != result )
269+
return result;
270+
%else:
271+
if( ${X}_RESULT_SUCCESS != result)
276272
return result;
277273
274+
%endif
278275
%endif
279276
## Before we can re-enable the releases we will need ref-counted object_t.
280277
## See unified-runtime github issue #1784
@@ -294,7 +291,7 @@ namespace ur_loader
294291
for (size_t i = 0; i < nelements; ++i) {
295292
if (handles[i] != nullptr) {
296293
handles[i] = reinterpret_cast<${etor['type']}>(
297-
${etor['factory']}.getInstance( handles[i], dditable ) );
294+
context->factories.${etor['factory']}.getInstance( handles[i], dditable ) );
298295
}
299296
}
300297
} break;
@@ -306,16 +303,16 @@ namespace ur_loader
306303
// convert platform handles to loader handles
307304
for( size_t i = ${item['range'][0]}; ( nullptr != ${item['name']} ) && ( i < ${item['range'][1]} ); ++i )
308305
${item['name']}[ i ] = reinterpret_cast<${item['type']}>(
309-
${item['factory']}.getInstance( ${item['name']}[ i ], dditable ) );
306+
context->factories.${item['factory']}.getInstance( ${item['name']}[ i ], dditable ) );
310307
%else:
311308
// convert platform handle to loader handle
312309
%if item['optional'] or th.always_wrap_outputs(obj):
313310
if( nullptr != ${item['name']} )
314311
*${item['name']} = reinterpret_cast<${item['type']}>(
315-
${item['factory']}.getInstance( *${item['name']}, dditable ) );
312+
context->factories.${item['factory']}.getInstance( *${item['name']}, dditable ) );
316313
%else:
317314
*${item['name']} = reinterpret_cast<${item['type']}>(
318-
${item['factory']}.getInstance( *${item['name']}, dditable ) );
315+
context->factories.${item['factory']}.getInstance( *${item['name']}, dditable ) );
319316
%endif
320317
%endif
321318
}
@@ -360,13 +357,13 @@ ${tbl['export']['name']}(
360357
if( nullptr == pDdiTable )
361358
return ${X}_RESULT_ERROR_INVALID_NULL_POINTER;
362359
363-
if( ur_loader::context->version < version )
360+
if( ur_loader::getContext()->version < version )
364361
return ${X}_RESULT_ERROR_UNSUPPORTED_VERSION;
365362
366363
${x}_result_t result = ${X}_RESULT_SUCCESS;
367364
368365
// Load the device-platform DDI tables
369-
for( auto& platform : ur_loader::context->platforms )
366+
for( auto& platform : ur_loader::getContext()->platforms )
370367
{
371368
if(platform.initStatus != ${X}_RESULT_SUCCESS)
372369
continue;
@@ -379,7 +376,7 @@ ${tbl['export']['name']}(
379376
380377
if( ${X}_RESULT_SUCCESS == result )
381378
{
382-
if( ur_loader::context->platforms.size() != 1 || ur_loader::context->forceIntercept )
379+
if( ur_loader::getContext()->platforms.size() != 1 || ur_loader::getContext()->forceIntercept )
383380
{
384381
// return pointers to loader's DDIs
385382
%for obj in tbl['functions']:
@@ -397,7 +394,7 @@ ${tbl['export']['name']}(
397394
else
398395
{
399396
// return pointers directly to platform's DDIs
400-
*pDdiTable = ur_loader::context->platforms.front().dditable.${n}.${tbl['name']};
397+
*pDdiTable = ur_loader::getContext()->platforms.front().dditable.${n}.${tbl['name']};
401398
}
402399
}
403400

0 commit comments

Comments
 (0)