Skip to content

Commit e3c332e

Browse files
committed
Generated sources
1 parent 760827d commit e3c332e

File tree

10 files changed

+169
-88
lines changed

10 files changed

+169
-88
lines changed

include/ur_api.h

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4201,17 +4201,19 @@ urProgramCreateWithIL(
42014201
);
42024202

42034203
///////////////////////////////////////////////////////////////////////////////
4204-
/// @brief Create a program object from device native binary.
4204+
/// @brief Create a program object from native binaries for the specified
4205+
/// devices.
42054206
///
42064207
/// @details
42074208
/// - The application may call this function from simultaneous threads.
42084209
/// - Following a successful call to this entry point, `phProgram` will
4209-
/// contain a binary of type ::UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT or
4210-
/// ::UR_PROGRAM_BINARY_TYPE_LIBRARY for `hDevice`.
4211-
/// - The device specified by `hDevice` must be device associated with
4210+
/// contain binaries of type ::UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT or
4211+
/// ::UR_PROGRAM_BINARY_TYPE_LIBRARY for the specified devices in
4212+
/// `phDevices`.
4213+
/// - The devices specified by `phDevices` must be associated with the
42124214
/// context.
42134215
/// - The adapter may (but is not required to) perform validation of the
4214-
/// provided module during this call.
4216+
/// provided modules during this call.
42154217
///
42164218
/// @remarks
42174219
/// _Analogues_
@@ -4224,21 +4226,26 @@ urProgramCreateWithIL(
42244226
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
42254227
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
42264228
/// + `NULL == hContext`
4227-
/// + `NULL == hDevice`
42284229
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
4229-
/// + `NULL == pBinary`
4230+
/// + `NULL == phDevices`
4231+
/// + `NULL == pLengths`
4232+
/// + `NULL == ppBinaries`
42304233
/// + `NULL == phProgram`
42314234
/// + `NULL != pProperties && pProperties->count > 0 && NULL == pProperties->pMetadatas`
42324235
/// - ::UR_RESULT_ERROR_INVALID_SIZE
42334236
/// + `NULL != pProperties && NULL != pProperties->pMetadatas && pProperties->count == 0`
42344237
/// - ::UR_RESULT_ERROR_INVALID_NATIVE_BINARY
4235-
/// + If `pBinary` isn't a valid binary for `hDevice.`
4238+
/// + If any binary in `ppBinaries` isn't a valid binary for the corresponding device in `phDevices.`
42364239
UR_APIEXPORT ur_result_t UR_APICALL
42374240
urProgramCreateWithBinary(
42384241
ur_context_handle_t hContext, ///< [in] handle of the context instance
4239-
ur_device_handle_t hDevice, ///< [in] handle to device associated with binary.
4240-
size_t size, ///< [in] size in bytes.
4241-
const uint8_t *pBinary, ///< [in] pointer to binary.
4242+
uint32_t numDevices, ///< [in] number of devices
4243+
ur_device_handle_t *phDevices, ///< [in][range(0, numDevices)] a pointer to a list of device handles. The
4244+
///< binaries are loaded for devices specified in this list.
4245+
size_t *pLengths, ///< [in][range(0, numDevices)] array of sizes of program binaries
4246+
///< specified by `pBinaries` (in bytes).
4247+
const uint8_t **ppBinaries, ///< [in][range(0, numDevices)] pointer to program binaries to be loaded
4248+
///< for devices specified by `phDevices`.
42424249
const ur_program_properties_t *pProperties, ///< [in][optional] pointer to program creation properties.
42434250
ur_program_handle_t *phProgram ///< [out] pointer to handle of Program object created.
42444251
);
@@ -10035,9 +10042,10 @@ typedef struct ur_program_create_with_il_params_t {
1003510042
/// allowing the callback the ability to modify the parameter's value
1003610043
typedef struct ur_program_create_with_binary_params_t {
1003710044
ur_context_handle_t *phContext;
10038-
ur_device_handle_t *phDevice;
10039-
size_t *psize;
10040-
const uint8_t **ppBinary;
10045+
uint32_t *pnumDevices;
10046+
ur_device_handle_t **pphDevices;
10047+
size_t **ppLengths;
10048+
const uint8_t ***pppBinaries;
1004110049
const ur_program_properties_t **ppProperties;
1004210050
ur_program_handle_t **pphProgram;
1004310051
} ur_program_create_with_binary_params_t;

include/ur_ddi.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,10 @@ typedef ur_result_t(UR_APICALL *ur_pfnProgramCreateWithIL_t)(
284284
/// @brief Function-pointer for urProgramCreateWithBinary
285285
typedef ur_result_t(UR_APICALL *ur_pfnProgramCreateWithBinary_t)(
286286
ur_context_handle_t,
287-
ur_device_handle_t,
288-
size_t,
289-
const uint8_t *,
287+
uint32_t,
288+
ur_device_handle_t *,
289+
size_t *,
290+
const uint8_t **,
290291
const ur_program_properties_t *,
291292
ur_program_handle_t *);
292293

include/ur_print.hpp

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11127,21 +11127,44 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct
1112711127
*(params->phContext));
1112811128

1112911129
os << ", ";
11130-
os << ".hDevice = ";
11130+
os << ".numDevices = ";
1113111131

11132-
ur::details::printPtr(os,
11133-
*(params->phDevice));
11132+
os << *(params->pnumDevices);
1113411133

1113511134
os << ", ";
11136-
os << ".size = ";
11135+
os << ".phDevices = {";
11136+
for (size_t i = 0; *(params->pphDevices) != NULL && i < *params->pnumDevices; ++i) {
11137+
if (i != 0) {
11138+
os << ", ";
11139+
}
1113711140

11138-
os << *(params->psize);
11141+
ur::details::printPtr(os,
11142+
(*(params->pphDevices))[i]);
11143+
}
11144+
os << "}";
1113911145

1114011146
os << ", ";
11141-
os << ".pBinary = ";
11147+
os << ".pLengths = {";
11148+
for (size_t i = 0; *(params->ppLengths) != NULL && i < *params->pnumDevices; ++i) {
11149+
if (i != 0) {
11150+
os << ", ";
11151+
}
1114211152

11143-
ur::details::printPtr(os,
11144-
*(params->ppBinary));
11153+
os << (*(params->ppLengths))[i];
11154+
}
11155+
os << "}";
11156+
11157+
os << ", ";
11158+
os << ".ppBinaries = {";
11159+
for (size_t i = 0; *(params->pppBinaries) != NULL && i < *params->pnumDevices; ++i) {
11160+
if (i != 0) {
11161+
os << ", ";
11162+
}
11163+
11164+
ur::details::printPtr(os,
11165+
(*(params->pppBinaries))[i]);
11166+
}
11167+
os << "}";
1114511168

1114611169
os << ", ";
1114711170
os << ".pProperties = ";

source/adapters/level_zero/ur_interface_loader.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ ur_result_t urProgramCreateWithIL(ur_context_handle_t hContext, const void *pIL,
187187
const ur_program_properties_t *pProperties,
188188
ur_program_handle_t *phProgram);
189189
ur_result_t urProgramCreateWithBinary(
190-
ur_context_handle_t hContext, ur_device_handle_t hDevice, size_t size,
191-
const uint8_t *pBinary, const ur_program_properties_t *pProperties,
192-
ur_program_handle_t *phProgram);
190+
ur_context_handle_t hContext, uint32_t numDevices,
191+
ur_device_handle_t *phDevices, size_t *pLengths, const uint8_t **ppBinaries,
192+
const ur_program_properties_t *pProperties, ur_program_handle_t *phProgram);
193193
ur_result_t urProgramBuild(ur_context_handle_t hContext,
194194
ur_program_handle_t hProgram, const char *pOptions);
195195
ur_result_t urProgramCompile(ur_context_handle_t hContext,

source/adapters/mock/ur_mockddi.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3157,10 +3157,16 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithIL(
31573157
/// @brief Intercept function for urProgramCreateWithBinary
31583158
__urdlllocal ur_result_t UR_APICALL urProgramCreateWithBinary(
31593159
ur_context_handle_t hContext, ///< [in] handle of the context instance
3160-
ur_device_handle_t
3161-
hDevice, ///< [in] handle to device associated with binary.
3162-
size_t size, ///< [in] size in bytes.
3163-
const uint8_t *pBinary, ///< [in] pointer to binary.
3160+
uint32_t numDevices, ///< [in] number of devices
3161+
ur_device_handle_t *
3162+
phDevices, ///< [in][range(0, numDevices)] a pointer to a list of device handles. The
3163+
///< binaries are loaded for devices specified in this list.
3164+
size_t *
3165+
pLengths, ///< [in][range(0, numDevices)] array of sizes of program binaries
3166+
///< specified by `pBinaries` (in bytes).
3167+
const uint8_t **
3168+
ppBinaries, ///< [in][range(0, numDevices)] pointer to program binaries to be loaded
3169+
///< for devices specified by `phDevices`.
31643170
const ur_program_properties_t *
31653171
pProperties, ///< [in][optional] pointer to program creation properties.
31663172
ur_program_handle_t
@@ -3169,7 +3175,8 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithBinary(
31693175
ur_result_t result = UR_RESULT_SUCCESS;
31703176

31713177
ur_program_create_with_binary_params_t params = {
3172-
&hContext, &hDevice, &size, &pBinary, &pProperties, &phProgram};
3178+
&hContext, &numDevices, &phDevices, &pLengths,
3179+
&ppBinaries, &pProperties, &phProgram};
31733180

31743181
auto beforeCallback = reinterpret_cast<ur_mock_callback_t>(
31753182
mock::getCallbacks().get_before_callback("urProgramCreateWithBinary"));

source/loader/layers/tracing/ur_trcddi.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2650,10 +2650,16 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithIL(
26502650
/// @brief Intercept function for urProgramCreateWithBinary
26512651
__urdlllocal ur_result_t UR_APICALL urProgramCreateWithBinary(
26522652
ur_context_handle_t hContext, ///< [in] handle of the context instance
2653-
ur_device_handle_t
2654-
hDevice, ///< [in] handle to device associated with binary.
2655-
size_t size, ///< [in] size in bytes.
2656-
const uint8_t *pBinary, ///< [in] pointer to binary.
2653+
uint32_t numDevices, ///< [in] number of devices
2654+
ur_device_handle_t *
2655+
phDevices, ///< [in][range(0, numDevices)] a pointer to a list of device handles. The
2656+
///< binaries are loaded for devices specified in this list.
2657+
size_t *
2658+
pLengths, ///< [in][range(0, numDevices)] array of sizes of program binaries
2659+
///< specified by `pBinaries` (in bytes).
2660+
const uint8_t **
2661+
ppBinaries, ///< [in][range(0, numDevices)] pointer to program binaries to be loaded
2662+
///< for devices specified by `phDevices`.
26572663
const ur_program_properties_t *
26582664
pProperties, ///< [in][optional] pointer to program creation properties.
26592665
ur_program_handle_t
@@ -2667,16 +2673,18 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithBinary(
26672673
}
26682674

26692675
ur_program_create_with_binary_params_t params = {
2670-
&hContext, &hDevice, &size, &pBinary, &pProperties, &phProgram};
2676+
&hContext, &numDevices, &phDevices, &pLengths,
2677+
&ppBinaries, &pProperties, &phProgram};
26712678
uint64_t instance =
26722679
getContext()->notify_begin(UR_FUNCTION_PROGRAM_CREATE_WITH_BINARY,
26732680
"urProgramCreateWithBinary", &params);
26742681

26752682
auto &logger = getContext()->logger;
26762683
logger.info(" ---> urProgramCreateWithBinary\n");
26772684

2678-
ur_result_t result = pfnCreateWithBinary(hContext, hDevice, size, pBinary,
2679-
pProperties, phProgram);
2685+
ur_result_t result =
2686+
pfnCreateWithBinary(hContext, numDevices, phDevices, pLengths,
2687+
ppBinaries, pProperties, phProgram);
26802688

26812689
getContext()->notify_end(UR_FUNCTION_PROGRAM_CREATE_WITH_BINARY,
26822690
"urProgramCreateWithBinary", &params, &result,

source/loader/layers/validation/ur_valddi.cpp

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2721,10 +2721,16 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithIL(
27212721
/// @brief Intercept function for urProgramCreateWithBinary
27222722
__urdlllocal ur_result_t UR_APICALL urProgramCreateWithBinary(
27232723
ur_context_handle_t hContext, ///< [in] handle of the context instance
2724-
ur_device_handle_t
2725-
hDevice, ///< [in] handle to device associated with binary.
2726-
size_t size, ///< [in] size in bytes.
2727-
const uint8_t *pBinary, ///< [in] pointer to binary.
2724+
uint32_t numDevices, ///< [in] number of devices
2725+
ur_device_handle_t *
2726+
phDevices, ///< [in][range(0, numDevices)] a pointer to a list of device handles. The
2727+
///< binaries are loaded for devices specified in this list.
2728+
size_t *
2729+
pLengths, ///< [in][range(0, numDevices)] array of sizes of program binaries
2730+
///< specified by `pBinaries` (in bytes).
2731+
const uint8_t **
2732+
ppBinaries, ///< [in][range(0, numDevices)] pointer to program binaries to be loaded
2733+
///< for devices specified by `phDevices`.
27282734
const ur_program_properties_t *
27292735
pProperties, ///< [in][optional] pointer to program creation properties.
27302736
ur_program_handle_t
@@ -2742,11 +2748,15 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithBinary(
27422748
return UR_RESULT_ERROR_INVALID_NULL_HANDLE;
27432749
}
27442750

2745-
if (NULL == hDevice) {
2746-
return UR_RESULT_ERROR_INVALID_NULL_HANDLE;
2751+
if (NULL == phDevices) {
2752+
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
27472753
}
27482754

2749-
if (NULL == pBinary) {
2755+
if (NULL == pLengths) {
2756+
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
2757+
}
2758+
2759+
if (NULL == ppBinaries) {
27502760
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
27512761
}
27522762

@@ -2770,13 +2780,9 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithBinary(
27702780
getContext()->refCountContext->logInvalidReference(hContext);
27712781
}
27722782

2773-
if (getContext()->enableLifetimeValidation &&
2774-
!getContext()->refCountContext->isReferenceValid(hDevice)) {
2775-
getContext()->refCountContext->logInvalidReference(hDevice);
2776-
}
2777-
2778-
ur_result_t result = pfnCreateWithBinary(hContext, hDevice, size, pBinary,
2779-
pProperties, phProgram);
2783+
ur_result_t result =
2784+
pfnCreateWithBinary(hContext, numDevices, phDevices, pLengths,
2785+
ppBinaries, pProperties, phProgram);
27802786

27812787
if (getContext()->enableLeakChecking && result == UR_RESULT_SUCCESS) {
27822788
getContext()->refCountContext->createRefCount(*phProgram);

source/loader/ur_ldrddi.cpp

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2563,10 +2563,16 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithIL(
25632563
/// @brief Intercept function for urProgramCreateWithBinary
25642564
__urdlllocal ur_result_t UR_APICALL urProgramCreateWithBinary(
25652565
ur_context_handle_t hContext, ///< [in] handle of the context instance
2566-
ur_device_handle_t
2567-
hDevice, ///< [in] handle to device associated with binary.
2568-
size_t size, ///< [in] size in bytes.
2569-
const uint8_t *pBinary, ///< [in] pointer to binary.
2566+
uint32_t numDevices, ///< [in] number of devices
2567+
ur_device_handle_t *
2568+
phDevices, ///< [in][range(0, numDevices)] a pointer to a list of device handles. The
2569+
///< binaries are loaded for devices specified in this list.
2570+
size_t *
2571+
pLengths, ///< [in][range(0, numDevices)] array of sizes of program binaries
2572+
///< specified by `pBinaries` (in bytes).
2573+
const uint8_t **
2574+
ppBinaries, ///< [in][range(0, numDevices)] pointer to program binaries to be loaded
2575+
///< for devices specified by `phDevices`.
25702576
const ur_program_properties_t *
25712577
pProperties, ///< [in][optional] pointer to program creation properties.
25722578
ur_program_handle_t
@@ -2586,12 +2592,16 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithBinary(
25862592
// convert loader handle to platform handle
25872593
hContext = reinterpret_cast<ur_context_object_t *>(hContext)->handle;
25882594

2589-
// convert loader handle to platform handle
2590-
hDevice = reinterpret_cast<ur_device_object_t *>(hDevice)->handle;
2595+
// convert loader handles to platform handles
2596+
auto phDevicesLocal = std::vector<ur_device_handle_t>(numDevices);
2597+
for (size_t i = 0; i < numDevices; ++i) {
2598+
phDevicesLocal[i] =
2599+
reinterpret_cast<ur_device_object_t *>(phDevices[i])->handle;
2600+
}
25912601

25922602
// forward to device-platform
2593-
result = pfnCreateWithBinary(hContext, hDevice, size, pBinary, pProperties,
2594-
phProgram);
2603+
result = pfnCreateWithBinary(hContext, numDevices, phDevicesLocal.data(),
2604+
pLengths, ppBinaries, pProperties, phProgram);
25952605

25962606
if (UR_RESULT_SUCCESS != result) {
25972607
return result;

source/loader/ur_libapi.cpp

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2997,17 +2997,19 @@ ur_result_t UR_APICALL urProgramCreateWithIL(
29972997
}
29982998

29992999
///////////////////////////////////////////////////////////////////////////////
3000-
/// @brief Create a program object from device native binary.
3000+
/// @brief Create a program object from native binaries for the specified
3001+
/// devices.
30013002
///
30023003
/// @details
30033004
/// - The application may call this function from simultaneous threads.
30043005
/// - Following a successful call to this entry point, `phProgram` will
3005-
/// contain a binary of type ::UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT or
3006-
/// ::UR_PROGRAM_BINARY_TYPE_LIBRARY for `hDevice`.
3007-
/// - The device specified by `hDevice` must be device associated with
3006+
/// contain binaries of type ::UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT or
3007+
/// ::UR_PROGRAM_BINARY_TYPE_LIBRARY for the specified devices in
3008+
/// `phDevices`.
3009+
/// - The devices specified by `phDevices` must be associated with the
30083010
/// context.
30093011
/// - The adapter may (but is not required to) perform validation of the
3010-
/// provided module during this call.
3012+
/// provided modules during this call.
30113013
///
30123014
/// @remarks
30133015
/// _Analogues_
@@ -3020,21 +3022,28 @@ ur_result_t UR_APICALL urProgramCreateWithIL(
30203022
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
30213023
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
30223024
/// + `NULL == hContext`
3023-
/// + `NULL == hDevice`
30243025
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
3025-
/// + `NULL == pBinary`
3026+
/// + `NULL == phDevices`
3027+
/// + `NULL == pLengths`
3028+
/// + `NULL == ppBinaries`
30263029
/// + `NULL == phProgram`
30273030
/// + `NULL != pProperties && pProperties->count > 0 && NULL == pProperties->pMetadatas`
30283031
/// - ::UR_RESULT_ERROR_INVALID_SIZE
30293032
/// + `NULL != pProperties && NULL != pProperties->pMetadatas && pProperties->count == 0`
30303033
/// - ::UR_RESULT_ERROR_INVALID_NATIVE_BINARY
3031-
/// + If `pBinary` isn't a valid binary for `hDevice.`
3034+
/// + If any binary in `ppBinaries` isn't a valid binary for the corresponding device in `phDevices.`
30323035
ur_result_t UR_APICALL urProgramCreateWithBinary(
30333036
ur_context_handle_t hContext, ///< [in] handle of the context instance
3034-
ur_device_handle_t
3035-
hDevice, ///< [in] handle to device associated with binary.
3036-
size_t size, ///< [in] size in bytes.
3037-
const uint8_t *pBinary, ///< [in] pointer to binary.
3037+
uint32_t numDevices, ///< [in] number of devices
3038+
ur_device_handle_t *
3039+
phDevices, ///< [in][range(0, numDevices)] a pointer to a list of device handles. The
3040+
///< binaries are loaded for devices specified in this list.
3041+
size_t *
3042+
pLengths, ///< [in][range(0, numDevices)] array of sizes of program binaries
3043+
///< specified by `pBinaries` (in bytes).
3044+
const uint8_t **
3045+
ppBinaries, ///< [in][range(0, numDevices)] pointer to program binaries to be loaded
3046+
///< for devices specified by `phDevices`.
30383047
const ur_program_properties_t *
30393048
pProperties, ///< [in][optional] pointer to program creation properties.
30403049
ur_program_handle_t
@@ -3046,8 +3055,8 @@ ur_result_t UR_APICALL urProgramCreateWithBinary(
30463055
return UR_RESULT_ERROR_UNINITIALIZED;
30473056
}
30483057

3049-
return pfnCreateWithBinary(hContext, hDevice, size, pBinary, pProperties,
3050-
phProgram);
3058+
return pfnCreateWithBinary(hContext, numDevices, phDevices, pLengths,
3059+
ppBinaries, pProperties, phProgram);
30513060
} catch (...) {
30523061
return exceptionToResult(std::current_exception());
30533062
}

0 commit comments

Comments
 (0)