Skip to content

Commit b819b42

Browse files
Merge branch 'adapters' into steffen/virtual_mem_adapters
2 parents 31aba08 + 5e914c5 commit b819b42

Some content is hidden

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

71 files changed

+2356
-301
lines changed

.github/workflows/cmake.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,10 @@ jobs:
163163
strategy:
164164
matrix:
165165
adapter: [
166-
{name: CUDA, triplet: nvptx64-nvidia-cuda},
167-
{name: HIP, triplet: amdgcn-amd-amdhsa},
168-
{name: L0, triplet: spir64}
166+
{name: CUDA, triplet: nvptx64-nvidia-cuda, platform: ""},
167+
{name: HIP, triplet: amdgcn-amd-amdhsa, platform: ""},
168+
{name: L0, triplet: spir64, platform: ""},
169+
{name: OPENCL, triplet: spir64, platform: "Intel(R) OpenCL"}
169170
]
170171
build_type: [Debug, Release]
171172
compiler: [{c: gcc, cxx: g++}, {c: clang, cxx: clang++}]
@@ -219,7 +220,7 @@ jobs:
219220
- name: Test adapters
220221
if: matrix.adapter.name != 'L0'
221222
working-directory: ${{github.workspace}}/build
222-
run: ctest -C ${{matrix.build_type}} --output-on-failure -L "conformance" --timeout 180
223+
run: env UR_CTS_ADAPTER_PLATFORM="${{matrix.adapter.platform}}" ctest -C ${{matrix.build_type}} --output-on-failure -L "conformance" --timeout 180
223224

224225
examples-build-hw:
225226
name: Build - examples on HW

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55

66
cmake_minimum_required(VERSION 3.14.0 FATAL_ERROR)
7-
project(unified-runtime VERSION 0.7.0)
7+
project(unified-runtime VERSION 0.9.0)
88

99
include(GNUInstallDirs)
1010
include(CheckCXXSourceCompiles)

include/ur.py

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
77
88
@file ur.py
9-
@version v0.7-r0
9+
@version v0.9-r0
1010
1111
"""
1212
import platform
@@ -196,6 +196,9 @@ class ur_function_v(IntEnum):
196196
ADAPTER_RETAIN = 179 ## Enumerator for ::urAdapterRetain
197197
ADAPTER_GET_LAST_ERROR = 180 ## Enumerator for ::urAdapterGetLastError
198198
ADAPTER_GET_INFO = 181 ## Enumerator for ::urAdapterGetInfo
199+
PROGRAM_BUILD_EXP = 197 ## Enumerator for ::urProgramBuildExp
200+
PROGRAM_COMPILE_EXP = 198 ## Enumerator for ::urProgramCompileExp
201+
PROGRAM_LINK_EXP = 199 ## Enumerator for ::urProgramLinkExp
199202

200203
class ur_function_t(c_int):
201204
def __str__(self):
@@ -570,7 +573,9 @@ def __str__(self):
570573
class ur_api_version_v(IntEnum):
571574
_0_6 = UR_MAKE_VERSION( 0, 6 ) ## version 0.6
572575
_0_7 = UR_MAKE_VERSION( 0, 7 ) ## version 0.7
573-
CURRENT = UR_MAKE_VERSION( 0, 7 ) ## latest known version
576+
_0_8 = UR_MAKE_VERSION( 0, 8 ) ## version 0.8
577+
_0_9 = UR_MAKE_VERSION( 0, 9 ) ## version 0.9
578+
CURRENT = UR_MAKE_VERSION( 0, 9 ) ## latest known version
574579

575580
class ur_api_version_t(c_int):
576581
def __str__(self):
@@ -2253,6 +2258,11 @@ class ur_exp_command_buffer_sync_point_t(c_ulong):
22532258
class ur_exp_command_buffer_handle_t(c_void_p):
22542259
pass
22552260

2261+
###############################################################################
2262+
## @brief The extension string which defines support for test
2263+
## which is returned when querying device extensions.
2264+
UR_MULTI_DEVICE_COMPILE_EXTENSION_STRING_EXP = "ur_exp_multi_device_compile"
2265+
22562266
###############################################################################
22572267
## @brief Supported peer info
22582268
class ur_exp_peer_info_v(IntEnum):
@@ -2569,6 +2579,37 @@ class ur_program_dditable_t(Structure):
25692579
("pfnCreateWithNativeHandle", c_void_p) ## _urProgramCreateWithNativeHandle_t
25702580
]
25712581

2582+
###############################################################################
2583+
## @brief Function-pointer for urProgramBuildExp
2584+
if __use_win_types:
2585+
_urProgramBuildExp_t = WINFUNCTYPE( ur_result_t, ur_program_handle_t, c_ulong, POINTER(ur_device_handle_t), c_char_p )
2586+
else:
2587+
_urProgramBuildExp_t = CFUNCTYPE( ur_result_t, ur_program_handle_t, c_ulong, POINTER(ur_device_handle_t), c_char_p )
2588+
2589+
###############################################################################
2590+
## @brief Function-pointer for urProgramCompileExp
2591+
if __use_win_types:
2592+
_urProgramCompileExp_t = WINFUNCTYPE( ur_result_t, ur_program_handle_t, c_ulong, POINTER(ur_device_handle_t), c_char_p )
2593+
else:
2594+
_urProgramCompileExp_t = CFUNCTYPE( ur_result_t, ur_program_handle_t, c_ulong, POINTER(ur_device_handle_t), c_char_p )
2595+
2596+
###############################################################################
2597+
## @brief Function-pointer for urProgramLinkExp
2598+
if __use_win_types:
2599+
_urProgramLinkExp_t = WINFUNCTYPE( ur_result_t, ur_context_handle_t, c_ulong, POINTER(ur_device_handle_t), c_ulong, POINTER(ur_program_handle_t), c_char_p, POINTER(ur_program_handle_t) )
2600+
else:
2601+
_urProgramLinkExp_t = CFUNCTYPE( ur_result_t, ur_context_handle_t, c_ulong, POINTER(ur_device_handle_t), c_ulong, POINTER(ur_program_handle_t), c_char_p, POINTER(ur_program_handle_t) )
2602+
2603+
2604+
###############################################################################
2605+
## @brief Table of ProgramExp functions pointers
2606+
class ur_program_exp_dditable_t(Structure):
2607+
_fields_ = [
2608+
("pfnBuildExp", c_void_p), ## _urProgramBuildExp_t
2609+
("pfnCompileExp", c_void_p), ## _urProgramCompileExp_t
2610+
("pfnLinkExp", c_void_p) ## _urProgramLinkExp_t
2611+
]
2612+
25722613
###############################################################################
25732614
## @brief Function-pointer for urKernelCreate
25742615
if __use_win_types:
@@ -3754,6 +3795,7 @@ class ur_dditable_t(Structure):
37543795
("Context", ur_context_dditable_t),
37553796
("Event", ur_event_dditable_t),
37563797
("Program", ur_program_dditable_t),
3798+
("ProgramExp", ur_program_exp_dditable_t),
37573799
("Kernel", ur_kernel_dditable_t),
37583800
("Sampler", ur_sampler_dditable_t),
37593801
("Mem", ur_mem_dditable_t),
@@ -3856,6 +3898,18 @@ def __init__(self, version : ur_api_version_t):
38563898
self.urProgramGetNativeHandle = _urProgramGetNativeHandle_t(self.__dditable.Program.pfnGetNativeHandle)
38573899
self.urProgramCreateWithNativeHandle = _urProgramCreateWithNativeHandle_t(self.__dditable.Program.pfnCreateWithNativeHandle)
38583900

3901+
# call driver to get function pointers
3902+
ProgramExp = ur_program_exp_dditable_t()
3903+
r = ur_result_v(self.__dll.urGetProgramExpProcAddrTable(version, byref(ProgramExp)))
3904+
if r != ur_result_v.SUCCESS:
3905+
raise Exception(r)
3906+
self.__dditable.ProgramExp = ProgramExp
3907+
3908+
# attach function interface to function address
3909+
self.urProgramBuildExp = _urProgramBuildExp_t(self.__dditable.ProgramExp.pfnBuildExp)
3910+
self.urProgramCompileExp = _urProgramCompileExp_t(self.__dditable.ProgramExp.pfnCompileExp)
3911+
self.urProgramLinkExp = _urProgramLinkExp_t(self.__dditable.ProgramExp.pfnLinkExp)
3912+
38593913
# call driver to get function pointers
38603914
Kernel = ur_kernel_dditable_t()
38613915
r = ur_result_v(self.__dll.urGetKernelProcAddrTable(version, byref(Kernel)))

include/ur_api.h

Lines changed: 168 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
88
*
99
* @file ur_api.h
10-
* @version v0.7-r0
10+
* @version v0.9-r0
1111
*
1212
*/
1313
#ifndef UR_API_H_INCLUDED
@@ -205,6 +205,9 @@ typedef enum ur_function_t {
205205
UR_FUNCTION_ADAPTER_RETAIN = 179, ///< Enumerator for ::urAdapterRetain
206206
UR_FUNCTION_ADAPTER_GET_LAST_ERROR = 180, ///< Enumerator for ::urAdapterGetLastError
207207
UR_FUNCTION_ADAPTER_GET_INFO = 181, ///< Enumerator for ::urAdapterGetInfo
208+
UR_FUNCTION_PROGRAM_BUILD_EXP = 197, ///< Enumerator for ::urProgramBuildExp
209+
UR_FUNCTION_PROGRAM_COMPILE_EXP = 198, ///< Enumerator for ::urProgramCompileExp
210+
UR_FUNCTION_PROGRAM_LINK_EXP = 199, ///< Enumerator for ::urProgramLinkExp
208211
/// @cond
209212
UR_FUNCTION_FORCE_UINT32 = 0x7fffffff
210213
/// @endcond
@@ -1022,7 +1025,9 @@ urPlatformGetInfo(
10221025
typedef enum ur_api_version_t {
10231026
UR_API_VERSION_0_6 = UR_MAKE_VERSION(0, 6), ///< version 0.6
10241027
UR_API_VERSION_0_7 = UR_MAKE_VERSION(0, 7), ///< version 0.7
1025-
UR_API_VERSION_CURRENT = UR_MAKE_VERSION(0, 7), ///< latest known version
1028+
UR_API_VERSION_0_8 = UR_MAKE_VERSION(0, 8), ///< version 0.8
1029+
UR_API_VERSION_0_9 = UR_MAKE_VERSION(0, 9), ///< version 0.9
1030+
UR_API_VERSION_CURRENT = UR_MAKE_VERSION(0, 9), ///< latest known version
10261031
/// @cond
10271032
UR_API_VERSION_FORCE_UINT32 = 0x7fffffff
10281033
/// @endcond
@@ -8030,6 +8035,131 @@ urCommandBufferEnqueueExp(
80308035
///< command-buffer execution instance.
80318036
);
80328037

8038+
#if !defined(__GNUC__)
8039+
#pragma endregion
8040+
#endif
8041+
// Intel 'oneAPI' Unified Runtime Experimental APIs for multi-device compile
8042+
#if !defined(__GNUC__)
8043+
#pragma region multi device compile(experimental)
8044+
#endif
8045+
///////////////////////////////////////////////////////////////////////////////
8046+
#ifndef UR_MULTI_DEVICE_COMPILE_EXTENSION_STRING_EXP
8047+
/// @brief The extension string which defines support for test
8048+
/// which is returned when querying device extensions.
8049+
#define UR_MULTI_DEVICE_COMPILE_EXTENSION_STRING_EXP "ur_exp_multi_device_compile"
8050+
#endif // UR_MULTI_DEVICE_COMPILE_EXTENSION_STRING_EXP
8051+
8052+
///////////////////////////////////////////////////////////////////////////////
8053+
/// @brief Produces an executable program from one program, negates need for the
8054+
/// linking step.
8055+
///
8056+
/// @details
8057+
/// - The application may call this function from simultaneous threads.
8058+
/// - Following a successful call to this entry point, the program passed
8059+
/// will contain a binary of the ::UR_PROGRAM_BINARY_TYPE_EXECUTABLE type
8060+
/// for each device in `phDevices`.
8061+
///
8062+
/// @remarks
8063+
/// _Analogues_
8064+
/// - **clBuildProgram**
8065+
///
8066+
/// @returns
8067+
/// - ::UR_RESULT_SUCCESS
8068+
/// - ::UR_RESULT_ERROR_UNINITIALIZED
8069+
/// - ::UR_RESULT_ERROR_DEVICE_LOST
8070+
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
8071+
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
8072+
/// + `NULL == hProgram`
8073+
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
8074+
/// + `NULL == phDevices`
8075+
/// - ::UR_RESULT_ERROR_INVALID_PROGRAM
8076+
/// + If `hProgram` isn't a valid program object.
8077+
/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE
8078+
/// + If an error occurred when building `hProgram`.
8079+
UR_APIEXPORT ur_result_t UR_APICALL
8080+
urProgramBuildExp(
8081+
ur_program_handle_t hProgram, ///< [in] Handle of the program to build.
8082+
uint32_t numDevices, ///< [in] number of devices
8083+
ur_device_handle_t *phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles
8084+
const char *pOptions ///< [in][optional] pointer to build options null-terminated string.
8085+
);
8086+
8087+
///////////////////////////////////////////////////////////////////////////////
8088+
/// @brief Produces an executable program from one or more programs.
8089+
///
8090+
/// @details
8091+
/// - The application may call this function from simultaneous threads.
8092+
/// - Following a successful call to this entry point `hProgram` will
8093+
/// contain a binary of the ::UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT type
8094+
/// for each device in `phDevices`.
8095+
///
8096+
/// @remarks
8097+
/// _Analogues_
8098+
/// - **clCompileProgram**
8099+
///
8100+
/// @returns
8101+
/// - ::UR_RESULT_SUCCESS
8102+
/// - ::UR_RESULT_ERROR_UNINITIALIZED
8103+
/// - ::UR_RESULT_ERROR_DEVICE_LOST
8104+
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
8105+
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
8106+
/// + `NULL == hProgram`
8107+
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
8108+
/// + `NULL == phDevices`
8109+
/// - ::UR_RESULT_ERROR_INVALID_PROGRAM
8110+
/// + If `hProgram` isn't a valid program object.
8111+
/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE
8112+
/// + If an error occurred while compiling `hProgram`.
8113+
UR_APIEXPORT ur_result_t UR_APICALL
8114+
urProgramCompileExp(
8115+
ur_program_handle_t hProgram, ///< [in][out] handle of the program to compile.
8116+
uint32_t numDevices, ///< [in] number of devices
8117+
ur_device_handle_t *phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles
8118+
const char *pOptions ///< [in][optional] pointer to build options null-terminated string.
8119+
);
8120+
8121+
///////////////////////////////////////////////////////////////////////////////
8122+
/// @brief Produces an executable program from one or more programs.
8123+
///
8124+
/// @details
8125+
/// - The application may call this function from simultaneous threads.
8126+
/// - Following a successful call to this entry point the program returned
8127+
/// in `phProgram` will contain a binary of the
8128+
/// ::UR_PROGRAM_BINARY_TYPE_EXECUTABLE type for each device in
8129+
/// `phDevices`.
8130+
///
8131+
/// @remarks
8132+
/// _Analogues_
8133+
/// - **clLinkProgram**
8134+
///
8135+
/// @returns
8136+
/// - ::UR_RESULT_SUCCESS
8137+
/// - ::UR_RESULT_ERROR_UNINITIALIZED
8138+
/// - ::UR_RESULT_ERROR_DEVICE_LOST
8139+
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
8140+
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
8141+
/// + `NULL == hContext`
8142+
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
8143+
/// + `NULL == phDevices`
8144+
/// + `NULL == phPrograms`
8145+
/// + `NULL == phProgram`
8146+
/// - ::UR_RESULT_ERROR_INVALID_PROGRAM
8147+
/// + If one of the programs in `phPrograms` isn't a valid program object.
8148+
/// - ::UR_RESULT_ERROR_INVALID_SIZE
8149+
/// + `count == 0`
8150+
/// - ::UR_RESULT_ERROR_PROGRAM_LINK_FAILURE
8151+
/// + If an error occurred while linking `phPrograms`.
8152+
UR_APIEXPORT ur_result_t UR_APICALL
8153+
urProgramLinkExp(
8154+
ur_context_handle_t hContext, ///< [in] handle of the context instance.
8155+
uint32_t numDevices, ///< [in] number of devices
8156+
ur_device_handle_t *phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles
8157+
uint32_t count, ///< [in] number of program handles in `phPrograms`.
8158+
const ur_program_handle_t *phPrograms, ///< [in][range(0, count)] pointer to array of program handles.
8159+
const char *pOptions, ///< [in][optional] pointer to linker options null-terminated string.
8160+
ur_program_handle_t *phProgram ///< [out] pointer to handle of program object created.
8161+
);
8162+
80338163
#if !defined(__GNUC__)
80348164
#pragma endregion
80358165
#endif
@@ -8531,6 +8661,17 @@ typedef struct ur_program_build_params_t {
85318661
const char **ppOptions;
85328662
} ur_program_build_params_t;
85338663

8664+
///////////////////////////////////////////////////////////////////////////////
8665+
/// @brief Function parameters for urProgramBuildExp
8666+
/// @details Each entry is a pointer to the parameter passed to the function;
8667+
/// allowing the callback the ability to modify the parameter's value
8668+
typedef struct ur_program_build_exp_params_t {
8669+
ur_program_handle_t *phProgram;
8670+
uint32_t *pnumDevices;
8671+
ur_device_handle_t **pphDevices;
8672+
const char **ppOptions;
8673+
} ur_program_build_exp_params_t;
8674+
85348675
///////////////////////////////////////////////////////////////////////////////
85358676
/// @brief Function parameters for urProgramCompile
85368677
/// @details Each entry is a pointer to the parameter passed to the function;
@@ -8541,6 +8682,17 @@ typedef struct ur_program_compile_params_t {
85418682
const char **ppOptions;
85428683
} ur_program_compile_params_t;
85438684

8685+
///////////////////////////////////////////////////////////////////////////////
8686+
/// @brief Function parameters for urProgramCompileExp
8687+
/// @details Each entry is a pointer to the parameter passed to the function;
8688+
/// allowing the callback the ability to modify the parameter's value
8689+
typedef struct ur_program_compile_exp_params_t {
8690+
ur_program_handle_t *phProgram;
8691+
uint32_t *pnumDevices;
8692+
ur_device_handle_t **pphDevices;
8693+
const char **ppOptions;
8694+
} ur_program_compile_exp_params_t;
8695+
85448696
///////////////////////////////////////////////////////////////////////////////
85458697
/// @brief Function parameters for urProgramLink
85468698
/// @details Each entry is a pointer to the parameter passed to the function;
@@ -8553,6 +8705,20 @@ typedef struct ur_program_link_params_t {
85538705
ur_program_handle_t **pphProgram;
85548706
} ur_program_link_params_t;
85558707

8708+
///////////////////////////////////////////////////////////////////////////////
8709+
/// @brief Function parameters for urProgramLinkExp
8710+
/// @details Each entry is a pointer to the parameter passed to the function;
8711+
/// allowing the callback the ability to modify the parameter's value
8712+
typedef struct ur_program_link_exp_params_t {
8713+
ur_context_handle_t *phContext;
8714+
uint32_t *pnumDevices;
8715+
ur_device_handle_t **pphDevices;
8716+
uint32_t *pcount;
8717+
const ur_program_handle_t **pphPrograms;
8718+
const char **ppOptions;
8719+
ur_program_handle_t **pphProgram;
8720+
} ur_program_link_exp_params_t;
8721+
85568722
///////////////////////////////////////////////////////////////////////////////
85578723
/// @brief Function parameters for urProgramRetain
85588724
/// @details Each entry is a pointer to the parameter passed to the function;

0 commit comments

Comments
 (0)