Skip to content

Commit bd86785

Browse files
committed
Generated sources
1 parent b781398 commit bd86785

File tree

17 files changed

+562
-0
lines changed

17 files changed

+562
-0
lines changed

include/ur_api.h

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ typedef enum ur_function_t {
228228
UR_FUNCTION_LOADER_CONFIG_SET_MOCKING_ENABLED = 229, ///< Enumerator for ::urLoaderConfigSetMockingEnabled
229229
UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_MEMORY_EXP = 230, ///< Enumerator for ::urBindlessImagesReleaseExternalMemoryExp
230230
UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP = 231, ///< Enumerator for ::urBindlessImagesMapExternalLinearMemoryExp
231+
UR_FUNCTION_PROGRAM_CREATE_WITH_BINARY_EXP = 232, ///< Enumerator for ::urProgramCreateWithBinaryExp
231232
/// @cond
232233
UR_FUNCTION_FORCE_UINT32 = 0x7fffffff
233234
/// @endcond
@@ -9401,6 +9402,56 @@ urProgramLinkExp(
94019402
ur_program_handle_t *phProgram ///< [out] pointer to handle of program object created.
94029403
);
94039404

9405+
///////////////////////////////////////////////////////////////////////////////
9406+
/// @brief Create a program object from native binaries for the specified
9407+
/// devices.
9408+
///
9409+
/// @details
9410+
/// - The application may call this function from simultaneous threads.
9411+
/// - Following a successful call to this entry point, `phProgram` will
9412+
/// contain binaries of type ::UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT or
9413+
/// ::UR_PROGRAM_BINARY_TYPE_LIBRARY for the specified devices in
9414+
/// `phDevices`.
9415+
/// - The devices specified by `phDevices` must be associated with the
9416+
/// context.
9417+
/// - The adapter may (but is not required to) perform validation of the
9418+
/// provided modules during this call.
9419+
///
9420+
/// @remarks
9421+
/// _Analogues_
9422+
/// - **clCreateProgramWithBinary**
9423+
///
9424+
/// @returns
9425+
/// - ::UR_RESULT_SUCCESS
9426+
/// - ::UR_RESULT_ERROR_UNINITIALIZED
9427+
/// - ::UR_RESULT_ERROR_DEVICE_LOST
9428+
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
9429+
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
9430+
/// + `NULL == hContext`
9431+
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
9432+
/// + `NULL == phDevices`
9433+
/// + `NULL == pLengths`
9434+
/// + `NULL == ppBinaries`
9435+
/// + `NULL == phProgram`
9436+
/// + `NULL != pProperties && pProperties->count > 0 && NULL == pProperties->pMetadatas`
9437+
/// - ::UR_RESULT_ERROR_INVALID_SIZE
9438+
/// + `NULL != pProperties && NULL != pProperties->pMetadatas && pProperties->count == 0`
9439+
/// - ::UR_RESULT_ERROR_INVALID_NATIVE_BINARY
9440+
/// + If any binary in `ppBinaries` isn't a valid binary for the corresponding device in `phDevices.`
9441+
UR_APIEXPORT ur_result_t UR_APICALL
9442+
urProgramCreateWithBinaryExp(
9443+
ur_context_handle_t hContext, ///< [in] handle of the context instance
9444+
uint32_t numDevices, ///< [in] number of devices
9445+
ur_device_handle_t *phDevices, ///< [in][range(0, numDevices)] a pointer to a list of device handles. The
9446+
///< binaries are loaded for devices specified in this list.
9447+
size_t *pLengths, ///< [in][range(0, numDevices)] array of sizes of program binaries
9448+
///< specified by `pBinaries` (in bytes).
9449+
const uint8_t **ppBinaries, ///< [in][range(0, numDevices)] pointer to program binaries to be loaded
9450+
///< for devices specified by `phDevices`.
9451+
const ur_program_properties_t *pProperties, ///< [in][optional] pointer to program creation properties.
9452+
ur_program_handle_t *phProgram ///< [out] pointer to handle of Program object created.
9453+
);
9454+
94049455
#if !defined(__GNUC__)
94059456
#pragma endregion
94069457
#endif
@@ -10069,6 +10120,20 @@ typedef struct ur_program_retain_params_t {
1006910120
ur_program_handle_t *phProgram;
1007010121
} ur_program_retain_params_t;
1007110122

10123+
///////////////////////////////////////////////////////////////////////////////
10124+
/// @brief Function parameters for urProgramCreateWithBinaryExp
10125+
/// @details Each entry is a pointer to the parameter passed to the function;
10126+
/// allowing the callback the ability to modify the parameter's value
10127+
typedef struct ur_program_create_with_binary_exp_params_t {
10128+
ur_context_handle_t *phContext;
10129+
uint32_t *pnumDevices;
10130+
ur_device_handle_t **pphDevices;
10131+
size_t **ppLengths;
10132+
const uint8_t ***pppBinaries;
10133+
const ur_program_properties_t **ppProperties;
10134+
ur_program_handle_t **pphProgram;
10135+
} ur_program_create_with_binary_exp_params_t;
10136+
1007210137
///////////////////////////////////////////////////////////////////////////////
1007310138
/// @brief Function parameters for urProgramRelease
1007410139
/// @details Each entry is a pointer to the parameter passed to the function;

include/ur_api_funcs.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ _UR_API(urProgramCreateWithNativeHandle)
5252
_UR_API(urProgramBuildExp)
5353
_UR_API(urProgramCompileExp)
5454
_UR_API(urProgramLinkExp)
55+
_UR_API(urProgramCreateWithBinaryExp)
5556
_UR_API(urKernelCreate)
5657
_UR_API(urKernelGetInfo)
5758
_UR_API(urKernelGetGroupInfo)

include/ur_ddi.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,12 +447,24 @@ typedef ur_result_t(UR_APICALL *ur_pfnProgramLinkExp_t)(
447447
const char *,
448448
ur_program_handle_t *);
449449

450+
///////////////////////////////////////////////////////////////////////////////
451+
/// @brief Function-pointer for urProgramCreateWithBinaryExp
452+
typedef ur_result_t(UR_APICALL *ur_pfnProgramCreateWithBinaryExp_t)(
453+
ur_context_handle_t,
454+
uint32_t,
455+
ur_device_handle_t *,
456+
size_t *,
457+
const uint8_t **,
458+
const ur_program_properties_t *,
459+
ur_program_handle_t *);
460+
450461
///////////////////////////////////////////////////////////////////////////////
451462
/// @brief Table of ProgramExp functions pointers
452463
typedef struct ur_program_exp_dditable_t {
453464
ur_pfnProgramBuildExp_t pfnBuildExp;
454465
ur_pfnProgramCompileExp_t pfnCompileExp;
455466
ur_pfnProgramLinkExp_t pfnLinkExp;
467+
ur_pfnProgramCreateWithBinaryExp_t pfnCreateWithBinaryExp;
456468
} ur_program_exp_dditable_t;
457469

458470
///////////////////////////////////////////////////////////////////////////////

include/ur_print.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,6 +1362,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramLinkExpParams(const struct ur_
13621362
/// - `buff_size < out_size`
13631363
UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramRetainParams(const struct ur_program_retain_params_t *params, char *buffer, const size_t buff_size, size_t *out_size);
13641364

1365+
///////////////////////////////////////////////////////////////////////////////
1366+
/// @brief Print ur_program_create_with_binary_exp_params_t struct
1367+
/// @returns
1368+
/// - ::UR_RESULT_SUCCESS
1369+
/// - ::UR_RESULT_ERROR_INVALID_SIZE
1370+
/// - `buff_size < out_size`
1371+
UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramCreateWithBinaryExpParams(const struct ur_program_create_with_binary_exp_params_t *params, char *buffer, const size_t buff_size, size_t *out_size);
1372+
13651373
///////////////////////////////////////////////////////////////////////////////
13661374
/// @brief Print ur_program_release_params_t struct
13671375
/// @returns

include/ur_print.hpp

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,9 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) {
945945
case UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP:
946946
os << "UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP";
947947
break;
948+
case UR_FUNCTION_PROGRAM_CREATE_WITH_BINARY_EXP:
949+
os << "UR_FUNCTION_PROGRAM_CREATE_WITH_BINARY_EXP";
950+
break;
948951
default:
949952
os << "unknown enumerator";
950953
break;
@@ -11294,6 +11297,72 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct
1129411297
return os;
1129511298
}
1129611299

11300+
///////////////////////////////////////////////////////////////////////////////
11301+
/// @brief Print operator for the ur_program_create_with_binary_exp_params_t type
11302+
/// @returns
11303+
/// std::ostream &
11304+
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_create_with_binary_exp_params_t *params) {
11305+
11306+
os << ".hContext = ";
11307+
11308+
ur::details::printPtr(os,
11309+
*(params->phContext));
11310+
11311+
os << ", ";
11312+
os << ".numDevices = ";
11313+
11314+
os << *(params->pnumDevices);
11315+
11316+
os << ", ";
11317+
os << ".phDevices = {";
11318+
for (size_t i = 0; *(params->pphDevices) != NULL && i < *params->pnumDevices; ++i) {
11319+
if (i != 0) {
11320+
os << ", ";
11321+
}
11322+
11323+
ur::details::printPtr(os,
11324+
(*(params->pphDevices))[i]);
11325+
}
11326+
os << "}";
11327+
11328+
os << ", ";
11329+
os << ".pLengths = {";
11330+
for (size_t i = 0; *(params->ppLengths) != NULL && i < *params->pnumDevices; ++i) {
11331+
if (i != 0) {
11332+
os << ", ";
11333+
}
11334+
11335+
os << (*(params->ppLengths))[i];
11336+
}
11337+
os << "}";
11338+
11339+
os << ", ";
11340+
os << ".ppBinaries = {";
11341+
for (size_t i = 0; *(params->pppBinaries) != NULL && i < *params->pnumDevices; ++i) {
11342+
if (i != 0) {
11343+
os << ", ";
11344+
}
11345+
11346+
ur::details::printPtr(os,
11347+
(*(params->pppBinaries))[i]);
11348+
}
11349+
os << "}";
11350+
11351+
os << ", ";
11352+
os << ".pProperties = ";
11353+
11354+
ur::details::printPtr(os,
11355+
*(params->ppProperties));
11356+
11357+
os << ", ";
11358+
os << ".phProgram = ";
11359+
11360+
ur::details::printPtr(os,
11361+
*(params->pphProgram));
11362+
11363+
return os;
11364+
}
11365+
1129711366
///////////////////////////////////////////////////////////////////////////////
1129811367
/// @brief Print operator for the ur_program_release_params_t type
1129911368
/// @returns
@@ -17592,6 +17661,9 @@ inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, ur_function_
1759217661
case UR_FUNCTION_PROGRAM_RETAIN: {
1759317662
os << (const struct ur_program_retain_params_t *)params;
1759417663
} break;
17664+
case UR_FUNCTION_PROGRAM_CREATE_WITH_BINARY_EXP: {
17665+
os << (const struct ur_program_create_with_binary_exp_params_t *)params;
17666+
} break;
1759517667
case UR_FUNCTION_PROGRAM_RELEASE: {
1759617668
os << (const struct ur_program_release_params_t *)params;
1759717669
} break;

scripts/core/registry.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,9 @@ etors:
598598
- name: BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP
599599
desc: Enumerator for $xBindlessImagesMapExternalLinearMemoryExp
600600
value: '231'
601+
- name: PROGRAM_CREATE_WITH_BINARY_EXP
602+
desc: Enumerator for $xProgramCreateWithBinaryExp
603+
value: '232'
601604
---
602605
type: enum
603606
desc: Defines structure types

source/adapters/level_zero/ur_interface_loader.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urGetProgramExpProcAddrTable(
375375
pDdiTable->pfnBuildExp = ur::level_zero::urProgramBuildExp;
376376
pDdiTable->pfnCompileExp = ur::level_zero::urProgramCompileExp;
377377
pDdiTable->pfnLinkExp = ur::level_zero::urProgramLinkExp;
378+
pDdiTable->pfnCreateWithBinaryExp =
379+
ur::level_zero::urProgramCreateWithBinaryExp;
378380

379381
return result;
380382
}

source/adapters/level_zero/ur_interface_loader.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,10 @@ ur_result_t urProgramLinkExp(ur_context_handle_t hContext, uint32_t numDevices,
681681
const ur_program_handle_t *phPrograms,
682682
const char *pOptions,
683683
ur_program_handle_t *phProgram);
684+
ur_result_t urProgramCreateWithBinaryExp(
685+
ur_context_handle_t hContext, uint32_t numDevices,
686+
ur_device_handle_t *phDevices, size_t *pLengths, const uint8_t **ppBinaries,
687+
const ur_program_properties_t *pProperties, ur_program_handle_t *phProgram);
684688
ur_result_t urUSMImportExp(ur_context_handle_t hContext, void *pMem,
685689
size_t size);
686690
ur_result_t urUSMReleaseExp(ur_context_handle_t hContext, void *pMem);

source/adapters/mock/ur_mockddi.cpp

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9913,6 +9913,68 @@ __urdlllocal ur_result_t UR_APICALL urProgramLinkExp(
99139913
return exceptionToResult(std::current_exception());
99149914
}
99159915

9916+
///////////////////////////////////////////////////////////////////////////////
9917+
/// @brief Intercept function for urProgramCreateWithBinaryExp
9918+
__urdlllocal ur_result_t UR_APICALL urProgramCreateWithBinaryExp(
9919+
ur_context_handle_t hContext, ///< [in] handle of the context instance
9920+
uint32_t numDevices, ///< [in] number of devices
9921+
ur_device_handle_t *
9922+
phDevices, ///< [in][range(0, numDevices)] a pointer to a list of device handles. The
9923+
///< binaries are loaded for devices specified in this list.
9924+
size_t *
9925+
pLengths, ///< [in][range(0, numDevices)] array of sizes of program binaries
9926+
///< specified by `pBinaries` (in bytes).
9927+
const uint8_t **
9928+
ppBinaries, ///< [in][range(0, numDevices)] pointer to program binaries to be loaded
9929+
///< for devices specified by `phDevices`.
9930+
const ur_program_properties_t *
9931+
pProperties, ///< [in][optional] pointer to program creation properties.
9932+
ur_program_handle_t
9933+
*phProgram ///< [out] pointer to handle of Program object created.
9934+
) try {
9935+
ur_result_t result = UR_RESULT_SUCCESS;
9936+
9937+
ur_program_create_with_binary_exp_params_t params = {
9938+
&hContext, &numDevices, &phDevices, &pLengths,
9939+
&ppBinaries, &pProperties, &phProgram};
9940+
9941+
auto beforeCallback = reinterpret_cast<ur_mock_callback_t>(
9942+
mock::getCallbacks().get_before_callback(
9943+
"urProgramCreateWithBinaryExp"));
9944+
if (beforeCallback) {
9945+
result = beforeCallback(&params);
9946+
if (result != UR_RESULT_SUCCESS) {
9947+
return result;
9948+
}
9949+
}
9950+
9951+
auto replaceCallback = reinterpret_cast<ur_mock_callback_t>(
9952+
mock::getCallbacks().get_replace_callback(
9953+
"urProgramCreateWithBinaryExp"));
9954+
if (replaceCallback) {
9955+
result = replaceCallback(&params);
9956+
} else {
9957+
9958+
*phProgram = mock::createDummyHandle<ur_program_handle_t>();
9959+
result = UR_RESULT_SUCCESS;
9960+
}
9961+
9962+
if (result != UR_RESULT_SUCCESS) {
9963+
return result;
9964+
}
9965+
9966+
auto afterCallback = reinterpret_cast<ur_mock_callback_t>(
9967+
mock::getCallbacks().get_after_callback(
9968+
"urProgramCreateWithBinaryExp"));
9969+
if (afterCallback) {
9970+
return afterCallback(&params);
9971+
}
9972+
9973+
return result;
9974+
} catch (...) {
9975+
return exceptionToResult(std::current_exception());
9976+
}
9977+
99169978
///////////////////////////////////////////////////////////////////////////////
99179979
/// @brief Intercept function for urUSMImportExp
99189980
__urdlllocal ur_result_t UR_APICALL urUSMImportExp(
@@ -10948,6 +11010,8 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramExpProcAddrTable(
1094811010

1094911011
pDdiTable->pfnLinkExp = driver::urProgramLinkExp;
1095011012

11013+
pDdiTable->pfnCreateWithBinaryExp = driver::urProgramCreateWithBinaryExp;
11014+
1095111015
return result;
1095211016
} catch (...) {
1095311017
return exceptionToResult(std::current_exception());

0 commit comments

Comments
 (0)