Skip to content

Commit f4bbddf

Browse files
committed
Merge changes from multi device compile extension into core spec.
1 parent 67e4d1b commit f4bbddf

Some content is hidden

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

41 files changed

+335
-1785
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
@@ -4088,17 +4085,21 @@ urProgramCreateWithBinary(
40884085
/// - ::UR_RESULT_ERROR_DEVICE_LOST
40894086
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
40904087
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
4091-
/// + `NULL == hContext`
40924088
/// + `NULL == hProgram`
4089+
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
4090+
/// + `NULL == phDevices`
40934091
/// - ::UR_RESULT_ERROR_INVALID_PROGRAM
40944092
/// + If `hProgram` isn't a valid program object.
40954093
/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE
40964094
/// + If an error occurred when building `hProgram`.
4095+
/// - ::UR_RESULT_ERROR_INVALID_SIZE
4096+
/// + `numDevices == 0`
40974097
UR_APIEXPORT ur_result_t UR_APICALL
40984098
urProgramBuild(
4099-
ur_context_handle_t hContext, ///< [in] handle of the context instance.
4100-
ur_program_handle_t hProgram, ///< [in] Handle of the program to build.
4101-
const char *pOptions ///< [in][optional] pointer to build options null-terminated string.
4099+
ur_program_handle_t hProgram, ///< [in] Handle of the program to build.
4100+
uint32_t numDevices, ///< [in] length of `phDevices`
4101+
ur_device_handle_t *phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles
4102+
const char *pOptions ///< [in][optional] pointer to build options null-terminated string.
41024103
);
41034104

41044105
///////////////////////////////////////////////////////////////////////////////
@@ -4120,17 +4121,21 @@ urProgramBuild(
41204121
/// - ::UR_RESULT_ERROR_DEVICE_LOST
41214122
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
41224123
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
4123-
/// + `NULL == hContext`
41244124
/// + `NULL == hProgram`
4125+
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
4126+
/// + `NULL == phDevices`
41254127
/// - ::UR_RESULT_ERROR_INVALID_PROGRAM
41264128
/// + If `hProgram` isn't a valid program object.
41274129
/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE
41284130
/// + If an error occurred while compiling `hProgram`.
4131+
/// - ::UR_RESULT_ERROR_INVALID_SIZE
4132+
/// + `numDevices == 0`
41294133
UR_APIEXPORT ur_result_t UR_APICALL
41304134
urProgramCompile(
4131-
ur_context_handle_t hContext, ///< [in] handle of the context instance.
4132-
ur_program_handle_t hProgram, ///< [in][out] handle of the program to compile.
4133-
const char *pOptions ///< [in][optional] pointer to build options null-terminated string.
4135+
ur_program_handle_t hProgram, ///< [in][out] handle of the program to compile.
4136+
uint32_t numDevices, ///< [in] length of `phDevices`
4137+
ur_device_handle_t *phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles
4138+
const char *pOptions ///< [in][optional] pointer to build options null-terminated string.
41344139
);
41354140

41364141
///////////////////////////////////////////////////////////////////////////////
@@ -4155,17 +4160,21 @@ urProgramCompile(
41554160
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
41564161
/// + `NULL == hContext`
41574162
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
4163+
/// + `NULL == phDevices`
41584164
/// + `NULL == phPrograms`
41594165
/// + `NULL == phProgram`
41604166
/// - ::UR_RESULT_ERROR_INVALID_PROGRAM
41614167
/// + If one of the programs in `phPrograms` isn't a valid program object.
41624168
/// - ::UR_RESULT_ERROR_INVALID_SIZE
4169+
/// + `numDevices == 0`
41634170
/// + `count == 0`
41644171
/// - ::UR_RESULT_ERROR_PROGRAM_LINK_FAILURE
41654172
/// + If an error occurred while linking `phPrograms`.
41664173
UR_APIEXPORT ur_result_t UR_APICALL
41674174
urProgramLink(
41684175
ur_context_handle_t hContext, ///< [in] handle of the context instance.
4176+
uint32_t numDevices, ///< [in] number of devices
4177+
ur_device_handle_t *phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles
41694178
uint32_t count, ///< [in] number of program handles in `phPrograms`.
41704179
const ur_program_handle_t *phPrograms, ///< [in][range(0, count)] pointer to array of program handles.
41714180
const char *pOptions, ///< [in][optional] pointer to linker options null-terminated string.
@@ -8420,131 +8429,6 @@ urKernelSuggestMaxCooperativeGroupCountExp(
84208429
uint32_t *pGroupCountRet ///< [out] pointer to maximum number of groups
84218430
);
84228431

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

90708944
///////////////////////////////////////////////////////////////////////////////
90718945
/// @brief Function parameters for urProgramCompile
90728946
/// @details Each entry is a pointer to the parameter passed to the function;
90738947
/// allowing the callback the ability to modify the parameter's value
90748948
typedef struct ur_program_compile_params_t {
9075-
ur_context_handle_t *phContext;
9076-
ur_program_handle_t *phProgram;
9077-
const char **ppOptions;
9078-
} ur_program_compile_params_t;
9079-
9080-
///////////////////////////////////////////////////////////////////////////////
9081-
/// @brief Function parameters for urProgramCompileExp
9082-
/// @details Each entry is a pointer to the parameter passed to the function;
9083-
/// allowing the callback the ability to modify the parameter's value
9084-
typedef struct ur_program_compile_exp_params_t {
90858949
ur_program_handle_t *phProgram;
90868950
uint32_t *pnumDevices;
90878951
ur_device_handle_t **pphDevices;
90888952
const char **ppOptions;
9089-
} ur_program_compile_exp_params_t;
8953+
} ur_program_compile_params_t;
90908954

90918955
///////////////////////////////////////////////////////////////////////////////
90928956
/// @brief Function parameters for urProgramLink
90938957
/// @details Each entry is a pointer to the parameter passed to the function;
90948958
/// allowing the callback the ability to modify the parameter's value
90958959
typedef struct ur_program_link_params_t {
9096-
ur_context_handle_t *phContext;
9097-
uint32_t *pcount;
9098-
const ur_program_handle_t **pphPrograms;
9099-
const char **ppOptions;
9100-
ur_program_handle_t **pphProgram;
9101-
} ur_program_link_params_t;
9102-
9103-
///////////////////////////////////////////////////////////////////////////////
9104-
/// @brief Function parameters for urProgramLinkExp
9105-
/// @details Each entry is a pointer to the parameter passed to the function;
9106-
/// allowing the callback the ability to modify the parameter's value
9107-
typedef struct ur_program_link_exp_params_t {
91088960
ur_context_handle_t *phContext;
91098961
uint32_t *pnumDevices;
91108962
ur_device_handle_t **pphDevices;
91118963
uint32_t *pcount;
91128964
const ur_program_handle_t **pphPrograms;
91138965
const char **ppOptions;
91148966
ur_program_handle_t **pphProgram;
9115-
} ur_program_link_exp_params_t;
8967+
} ur_program_link_params_t;
91168968

91178969
///////////////////////////////////////////////////////////////////////////////
91188970
/// @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)