Skip to content

Commit 46722a5

Browse files
committed
Merge changes from multi device compile extension into core spec.
1 parent b66cf9b commit 46722a5

Some content is hidden

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

43 files changed

+338
-1842
lines changed

examples/codegen/codegen.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ int main() {
118118
ur_program_handle_t hProgram;
119119
ur_check(urProgramCreateWithIL(hContext, spv.data(), spv.size(), nullptr,
120120
&hProgram));
121-
ur_check(urProgramBuild(hContext, hProgram, nullptr));
121+
ur_check(urProgramBuild(hProgram, 1, &current_device, nullptr));
122122

123123
ur_mem_handle_t dA, dB;
124124
ur_check(urMemBufferCreate(hContext, UR_MEM_FLAG_READ_WRITE,

include/ur_api.h

+23-171
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,6 @@ typedef enum ur_function_t {
196196
UR_FUNCTION_ADAPTER_RETAIN = 179, ///< Enumerator for ::urAdapterRetain
197197
UR_FUNCTION_ADAPTER_GET_LAST_ERROR = 180, ///< Enumerator for ::urAdapterGetLastError
198198
UR_FUNCTION_ADAPTER_GET_INFO = 181, ///< Enumerator for ::urAdapterGetInfo
199-
UR_FUNCTION_PROGRAM_BUILD_EXP = 197, ///< Enumerator for ::urProgramBuildExp
200-
UR_FUNCTION_PROGRAM_COMPILE_EXP = 198, ///< Enumerator for ::urProgramCompileExp
201-
UR_FUNCTION_PROGRAM_LINK_EXP = 199, ///< Enumerator for ::urProgramLinkExp
202199
UR_FUNCTION_LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK = 200, ///< Enumerator for ::urLoaderConfigSetCodeLocationCallback
203200
UR_FUNCTION_LOADER_INIT = 201, ///< Enumerator for ::urLoaderInit
204201
UR_FUNCTION_LOADER_TEAR_DOWN = 202, ///< Enumerator for ::urLoaderTearDown
@@ -4091,17 +4088,21 @@ urProgramCreateWithBinary(
40914088
/// - ::UR_RESULT_ERROR_DEVICE_LOST
40924089
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
40934090
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
4094-
/// + `NULL == hContext`
40954091
/// + `NULL == hProgram`
4092+
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
4093+
/// + `NULL == phDevices`
40964094
/// - ::UR_RESULT_ERROR_INVALID_PROGRAM
40974095
/// + If `hProgram` isn't a valid program object.
40984096
/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE
40994097
/// + If an error occurred when building `hProgram`.
4098+
/// - ::UR_RESULT_ERROR_INVALID_SIZE
4099+
/// + `numDevices == 0`
41004100
UR_APIEXPORT ur_result_t UR_APICALL
41014101
urProgramBuild(
4102-
ur_context_handle_t hContext, ///< [in] handle of the context instance.
4103-
ur_program_handle_t hProgram, ///< [in] Handle of the program to build.
4104-
const char *pOptions ///< [in][optional] pointer to build options null-terminated string.
4102+
ur_program_handle_t hProgram, ///< [in] Handle of the program to build.
4103+
uint32_t numDevices, ///< [in] length of `phDevices`
4104+
ur_device_handle_t *phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles
4105+
const char *pOptions ///< [in][optional] pointer to build options null-terminated string.
41054106
);
41064107

41074108
///////////////////////////////////////////////////////////////////////////////
@@ -4123,17 +4124,21 @@ urProgramBuild(
41234124
/// - ::UR_RESULT_ERROR_DEVICE_LOST
41244125
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
41254126
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
4126-
/// + `NULL == hContext`
41274127
/// + `NULL == hProgram`
4128+
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
4129+
/// + `NULL == phDevices`
41284130
/// - ::UR_RESULT_ERROR_INVALID_PROGRAM
41294131
/// + If `hProgram` isn't a valid program object.
41304132
/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE
41314133
/// + If an error occurred while compiling `hProgram`.
4134+
/// - ::UR_RESULT_ERROR_INVALID_SIZE
4135+
/// + `numDevices == 0`
41324136
UR_APIEXPORT ur_result_t UR_APICALL
41334137
urProgramCompile(
4134-
ur_context_handle_t hContext, ///< [in] handle of the context instance.
4135-
ur_program_handle_t hProgram, ///< [in][out] handle of the program to compile.
4136-
const char *pOptions ///< [in][optional] pointer to build options null-terminated string.
4138+
ur_program_handle_t hProgram, ///< [in][out] handle of the program to compile.
4139+
uint32_t numDevices, ///< [in] length of `phDevices`
4140+
ur_device_handle_t *phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles
4141+
const char *pOptions ///< [in][optional] pointer to build options null-terminated string.
41374142
);
41384143

41394144
///////////////////////////////////////////////////////////////////////////////
@@ -4158,17 +4163,21 @@ urProgramCompile(
41584163
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
41594164
/// + `NULL == hContext`
41604165
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
4166+
/// + `NULL == phDevices`
41614167
/// + `NULL == phPrograms`
41624168
/// + `NULL == phProgram`
41634169
/// - ::UR_RESULT_ERROR_INVALID_PROGRAM
41644170
/// + If one of the programs in `phPrograms` isn't a valid program object.
41654171
/// - ::UR_RESULT_ERROR_INVALID_SIZE
4172+
/// + `numDevices == 0`
41664173
/// + `count == 0`
41674174
/// - ::UR_RESULT_ERROR_PROGRAM_LINK_FAILURE
41684175
/// + If an error occurred while linking `phPrograms`.
41694176
UR_APIEXPORT ur_result_t UR_APICALL
41704177
urProgramLink(
41714178
ur_context_handle_t hContext, ///< [in] handle of the context instance.
4179+
uint32_t numDevices, ///< [in] number of devices
4180+
ur_device_handle_t *phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles
41724181
uint32_t count, ///< [in] number of program handles in `phPrograms`.
41734182
const ur_program_handle_t *phPrograms, ///< [in][range(0, count)] pointer to array of program handles.
41744183
const char *pOptions, ///< [in][optional] pointer to linker options null-terminated string.
@@ -8423,131 +8432,6 @@ urKernelSuggestMaxCooperativeGroupCountExp(
84238432
uint32_t *pGroupCountRet ///< [out] pointer to maximum number of groups
84248433
);
84258434

8426-
#if !defined(__GNUC__)
8427-
#pragma endregion
8428-
#endif
8429-
// Intel 'oneAPI' Unified Runtime Experimental APIs for multi-device compile
8430-
#if !defined(__GNUC__)
8431-
#pragma region multi device compile(experimental)
8432-
#endif
8433-
///////////////////////////////////////////////////////////////////////////////
8434-
#ifndef UR_MULTI_DEVICE_COMPILE_EXTENSION_STRING_EXP
8435-
/// @brief The extension string which defines support for test
8436-
/// which is returned when querying device extensions.
8437-
#define UR_MULTI_DEVICE_COMPILE_EXTENSION_STRING_EXP "ur_exp_multi_device_compile"
8438-
#endif // UR_MULTI_DEVICE_COMPILE_EXTENSION_STRING_EXP
8439-
8440-
///////////////////////////////////////////////////////////////////////////////
8441-
/// @brief Produces an executable program from one program, negates need for the
8442-
/// linking step.
8443-
///
8444-
/// @details
8445-
/// - The application may call this function from simultaneous threads.
8446-
/// - Following a successful call to this entry point, the program passed
8447-
/// will contain a binary of the ::UR_PROGRAM_BINARY_TYPE_EXECUTABLE type
8448-
/// for each device in `phDevices`.
8449-
///
8450-
/// @remarks
8451-
/// _Analogues_
8452-
/// - **clBuildProgram**
8453-
///
8454-
/// @returns
8455-
/// - ::UR_RESULT_SUCCESS
8456-
/// - ::UR_RESULT_ERROR_UNINITIALIZED
8457-
/// - ::UR_RESULT_ERROR_DEVICE_LOST
8458-
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
8459-
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
8460-
/// + `NULL == hProgram`
8461-
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
8462-
/// + `NULL == phDevices`
8463-
/// - ::UR_RESULT_ERROR_INVALID_PROGRAM
8464-
/// + If `hProgram` isn't a valid program object.
8465-
/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE
8466-
/// + If an error occurred when building `hProgram`.
8467-
UR_APIEXPORT ur_result_t UR_APICALL
8468-
urProgramBuildExp(
8469-
ur_program_handle_t hProgram, ///< [in] Handle of the program to build.
8470-
uint32_t numDevices, ///< [in] number of devices
8471-
ur_device_handle_t *phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles
8472-
const char *pOptions ///< [in][optional] pointer to build options null-terminated string.
8473-
);
8474-
8475-
///////////////////////////////////////////////////////////////////////////////
8476-
/// @brief Produces an executable program from one or more programs.
8477-
///
8478-
/// @details
8479-
/// - The application may call this function from simultaneous threads.
8480-
/// - Following a successful call to this entry point `hProgram` will
8481-
/// contain a binary of the ::UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT type
8482-
/// for each device in `phDevices`.
8483-
///
8484-
/// @remarks
8485-
/// _Analogues_
8486-
/// - **clCompileProgram**
8487-
///
8488-
/// @returns
8489-
/// - ::UR_RESULT_SUCCESS
8490-
/// - ::UR_RESULT_ERROR_UNINITIALIZED
8491-
/// - ::UR_RESULT_ERROR_DEVICE_LOST
8492-
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
8493-
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
8494-
/// + `NULL == hProgram`
8495-
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
8496-
/// + `NULL == phDevices`
8497-
/// - ::UR_RESULT_ERROR_INVALID_PROGRAM
8498-
/// + If `hProgram` isn't a valid program object.
8499-
/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE
8500-
/// + If an error occurred while compiling `hProgram`.
8501-
UR_APIEXPORT ur_result_t UR_APICALL
8502-
urProgramCompileExp(
8503-
ur_program_handle_t hProgram, ///< [in][out] handle of the program to compile.
8504-
uint32_t numDevices, ///< [in] number of devices
8505-
ur_device_handle_t *phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles
8506-
const char *pOptions ///< [in][optional] pointer to build options null-terminated string.
8507-
);
8508-
8509-
///////////////////////////////////////////////////////////////////////////////
8510-
/// @brief Produces an executable program from one or more programs.
8511-
///
8512-
/// @details
8513-
/// - The application may call this function from simultaneous threads.
8514-
/// - Following a successful call to this entry point the program returned
8515-
/// in `phProgram` will contain a binary of the
8516-
/// ::UR_PROGRAM_BINARY_TYPE_EXECUTABLE type for each device in
8517-
/// `phDevices`.
8518-
///
8519-
/// @remarks
8520-
/// _Analogues_
8521-
/// - **clLinkProgram**
8522-
///
8523-
/// @returns
8524-
/// - ::UR_RESULT_SUCCESS
8525-
/// - ::UR_RESULT_ERROR_UNINITIALIZED
8526-
/// - ::UR_RESULT_ERROR_DEVICE_LOST
8527-
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
8528-
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
8529-
/// + `NULL == hContext`
8530-
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
8531-
/// + `NULL == phDevices`
8532-
/// + `NULL == phPrograms`
8533-
/// + `NULL == phProgram`
8534-
/// - ::UR_RESULT_ERROR_INVALID_PROGRAM
8535-
/// + If one of the programs in `phPrograms` isn't a valid program object.
8536-
/// - ::UR_RESULT_ERROR_INVALID_SIZE
8537-
/// + `count == 0`
8538-
/// - ::UR_RESULT_ERROR_PROGRAM_LINK_FAILURE
8539-
/// + If an error occurred while linking `phPrograms`.
8540-
UR_APIEXPORT ur_result_t UR_APICALL
8541-
urProgramLinkExp(
8542-
ur_context_handle_t hContext, ///< [in] handle of the context instance.
8543-
uint32_t numDevices, ///< [in] number of devices
8544-
ur_device_handle_t *phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles
8545-
uint32_t count, ///< [in] number of program handles in `phPrograms`.
8546-
const ur_program_handle_t *phPrograms, ///< [in][range(0, count)] pointer to array of program handles.
8547-
const char *pOptions, ///< [in][optional] pointer to linker options null-terminated string.
8548-
ur_program_handle_t *phProgram ///< [out] pointer to handle of program object created.
8549-
);
8550-
85518435
#if !defined(__GNUC__)
85528436
#pragma endregion
85538437
#endif
@@ -9054,68 +8938,36 @@ typedef struct ur_program_create_with_binary_params_t {
90548938
/// @details Each entry is a pointer to the parameter passed to the function;
90558939
/// allowing the callback the ability to modify the parameter's value
90568940
typedef struct ur_program_build_params_t {
9057-
ur_context_handle_t *phContext;
9058-
ur_program_handle_t *phProgram;
9059-
const char **ppOptions;
9060-
} ur_program_build_params_t;
9061-
9062-
///////////////////////////////////////////////////////////////////////////////
9063-
/// @brief Function parameters for urProgramBuildExp
9064-
/// @details Each entry is a pointer to the parameter passed to the function;
9065-
/// allowing the callback the ability to modify the parameter's value
9066-
typedef struct ur_program_build_exp_params_t {
90678941
ur_program_handle_t *phProgram;
90688942
uint32_t *pnumDevices;
90698943
ur_device_handle_t **pphDevices;
90708944
const char **ppOptions;
9071-
} ur_program_build_exp_params_t;
8945+
} ur_program_build_params_t;
90728946

90738947
///////////////////////////////////////////////////////////////////////////////
90748948
/// @brief Function parameters for urProgramCompile
90758949
/// @details Each entry is a pointer to the parameter passed to the function;
90768950
/// allowing the callback the ability to modify the parameter's value
90778951
typedef struct ur_program_compile_params_t {
9078-
ur_context_handle_t *phContext;
9079-
ur_program_handle_t *phProgram;
9080-
const char **ppOptions;
9081-
} ur_program_compile_params_t;
9082-
9083-
///////////////////////////////////////////////////////////////////////////////
9084-
/// @brief Function parameters for urProgramCompileExp
9085-
/// @details Each entry is a pointer to the parameter passed to the function;
9086-
/// allowing the callback the ability to modify the parameter's value
9087-
typedef struct ur_program_compile_exp_params_t {
90888952
ur_program_handle_t *phProgram;
90898953
uint32_t *pnumDevices;
90908954
ur_device_handle_t **pphDevices;
90918955
const char **ppOptions;
9092-
} ur_program_compile_exp_params_t;
8956+
} ur_program_compile_params_t;
90938957

90948958
///////////////////////////////////////////////////////////////////////////////
90958959
/// @brief Function parameters for urProgramLink
90968960
/// @details Each entry is a pointer to the parameter passed to the function;
90978961
/// allowing the callback the ability to modify the parameter's value
90988962
typedef struct ur_program_link_params_t {
9099-
ur_context_handle_t *phContext;
9100-
uint32_t *pcount;
9101-
const ur_program_handle_t **pphPrograms;
9102-
const char **ppOptions;
9103-
ur_program_handle_t **pphProgram;
9104-
} ur_program_link_params_t;
9105-
9106-
///////////////////////////////////////////////////////////////////////////////
9107-
/// @brief Function parameters for urProgramLinkExp
9108-
/// @details Each entry is a pointer to the parameter passed to the function;
9109-
/// allowing the callback the ability to modify the parameter's value
9110-
typedef struct ur_program_link_exp_params_t {
91118963
ur_context_handle_t *phContext;
91128964
uint32_t *pnumDevices;
91138965
ur_device_handle_t **pphDevices;
91148966
uint32_t *pcount;
91158967
const ur_program_handle_t **pphPrograms;
91168968
const char **ppOptions;
91178969
ur_program_handle_t **pphProgram;
9118-
} ur_program_link_exp_params_t;
8970+
} ur_program_link_params_t;
91198971

91208972
///////////////////////////////////////////////////////////////////////////////
91218973
/// @brief Function parameters for urProgramRetain

include/ur_ddi.h

+6-59
Original file line numberDiff line numberDiff line change
@@ -291,22 +291,26 @@ typedef ur_result_t(UR_APICALL *ur_pfnProgramCreateWithBinary_t)(
291291
///////////////////////////////////////////////////////////////////////////////
292292
/// @brief Function-pointer for urProgramBuild
293293
typedef ur_result_t(UR_APICALL *ur_pfnProgramBuild_t)(
294-
ur_context_handle_t,
295294
ur_program_handle_t,
295+
uint32_t,
296+
ur_device_handle_t *,
296297
const char *);
297298

298299
///////////////////////////////////////////////////////////////////////////////
299300
/// @brief Function-pointer for urProgramCompile
300301
typedef ur_result_t(UR_APICALL *ur_pfnProgramCompile_t)(
301-
ur_context_handle_t,
302302
ur_program_handle_t,
303+
uint32_t,
304+
ur_device_handle_t *,
303305
const char *);
304306

305307
///////////////////////////////////////////////////////////////////////////////
306308
/// @brief Function-pointer for urProgramLink
307309
typedef ur_result_t(UR_APICALL *ur_pfnProgramLink_t)(
308310
ur_context_handle_t,
309311
uint32_t,
312+
ur_device_handle_t *,
313+
uint32_t,
310314
const ur_program_handle_t *,
311315
const char *,
312316
ur_program_handle_t *);
@@ -408,62 +412,6 @@ typedef ur_result_t(UR_APICALL *ur_pfnGetProgramProcAddrTable_t)(
408412
ur_api_version_t,
409413
ur_program_dditable_t *);
410414

411-
///////////////////////////////////////////////////////////////////////////////
412-
/// @brief Function-pointer for urProgramBuildExp
413-
typedef ur_result_t(UR_APICALL *ur_pfnProgramBuildExp_t)(
414-
ur_program_handle_t,
415-
uint32_t,
416-
ur_device_handle_t *,
417-
const char *);
418-
419-
///////////////////////////////////////////////////////////////////////////////
420-
/// @brief Function-pointer for urProgramCompileExp
421-
typedef ur_result_t(UR_APICALL *ur_pfnProgramCompileExp_t)(
422-
ur_program_handle_t,
423-
uint32_t,
424-
ur_device_handle_t *,
425-
const char *);
426-
427-
///////////////////////////////////////////////////////////////////////////////
428-
/// @brief Function-pointer for urProgramLinkExp
429-
typedef ur_result_t(UR_APICALL *ur_pfnProgramLinkExp_t)(
430-
ur_context_handle_t,
431-
uint32_t,
432-
ur_device_handle_t *,
433-
uint32_t,
434-
const ur_program_handle_t *,
435-
const char *,
436-
ur_program_handle_t *);
437-
438-
///////////////////////////////////////////////////////////////////////////////
439-
/// @brief Table of ProgramExp functions pointers
440-
typedef struct ur_program_exp_dditable_t {
441-
ur_pfnProgramBuildExp_t pfnBuildExp;
442-
ur_pfnProgramCompileExp_t pfnCompileExp;
443-
ur_pfnProgramLinkExp_t pfnLinkExp;
444-
} ur_program_exp_dditable_t;
445-
446-
///////////////////////////////////////////////////////////////////////////////
447-
/// @brief Exported function for filling application's ProgramExp table
448-
/// with current process' addresses
449-
///
450-
/// @returns
451-
/// - ::UR_RESULT_SUCCESS
452-
/// - ::UR_RESULT_ERROR_UNINITIALIZED
453-
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
454-
/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION
455-
UR_DLLEXPORT ur_result_t UR_APICALL
456-
urGetProgramExpProcAddrTable(
457-
ur_api_version_t version, ///< [in] API version requested
458-
ur_program_exp_dditable_t *pDdiTable ///< [in,out] pointer to table of DDI function pointers
459-
);
460-
461-
///////////////////////////////////////////////////////////////////////////////
462-
/// @brief Function-pointer for urGetProgramExpProcAddrTable
463-
typedef ur_result_t(UR_APICALL *ur_pfnGetProgramExpProcAddrTable_t)(
464-
ur_api_version_t,
465-
ur_program_exp_dditable_t *);
466-
467415
///////////////////////////////////////////////////////////////////////////////
468416
/// @brief Function-pointer for urKernelCreate
469417
typedef ur_result_t(UR_APICALL *ur_pfnKernelCreate_t)(
@@ -2306,7 +2254,6 @@ typedef struct ur_dditable_t {
23062254
ur_context_dditable_t Context;
23072255
ur_event_dditable_t Event;
23082256
ur_program_dditable_t Program;
2309-
ur_program_exp_dditable_t ProgramExp;
23102257
ur_kernel_dditable_t Kernel;
23112258
ur_kernel_exp_dditable_t KernelExp;
23122259
ur_sampler_dditable_t Sampler;

0 commit comments

Comments
 (0)