Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

cmake_minimum_required(VERSION 3.14.0 FATAL_ERROR)
project(unified-runtime VERSION 0.7.0)
project(unified-runtime VERSION 0.8.0)

include(GNUInstallDirs)
include(CheckCXXSourceCompiles)
Expand Down
2 changes: 1 addition & 1 deletion cmake/helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function(add_ur_target_compile_options name)
endif()
elseif(MSVC)
target_compile_options(${name} PRIVATE
/MP
$<$<CXX_COMPILER_ID:MSVC>:/MP> # clang-cl.exe does not support /MP
/W3
/MD$<$<CONFIG:Debug>:d>
/GS
Expand Down
5 changes: 3 additions & 2 deletions include/ur.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

@file ur.py
@version v0.7-r0
@version v0.8-r0

"""
import platform
Expand Down Expand Up @@ -570,7 +570,8 @@ def __str__(self):
class ur_api_version_v(IntEnum):
_0_6 = UR_MAKE_VERSION( 0, 6 ) ## version 0.6
_0_7 = UR_MAKE_VERSION( 0, 7 ) ## version 0.7
CURRENT = UR_MAKE_VERSION( 0, 7 ) ## latest known version
_0_8 = UR_MAKE_VERSION( 0, 8 ) ## version 0.8
CURRENT = UR_MAKE_VERSION( 0, 8 ) ## latest known version

class ur_api_version_t(c_int):
def __str__(self):
Expand Down
5 changes: 3 additions & 2 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*
* @file ur_api.h
* @version v0.7-r0
* @version v0.8-r0
*
*/
#ifndef UR_API_H_INCLUDED
Expand Down Expand Up @@ -1022,7 +1022,8 @@ urPlatformGetInfo(
typedef enum ur_api_version_t {
UR_API_VERSION_0_6 = UR_MAKE_VERSION(0, 6), ///< version 0.6
UR_API_VERSION_0_7 = UR_MAKE_VERSION(0, 7), ///< version 0.7
UR_API_VERSION_CURRENT = UR_MAKE_VERSION(0, 7), ///< latest known version
UR_API_VERSION_0_8 = UR_MAKE_VERSION(0, 8), ///< version 0.8
UR_API_VERSION_CURRENT = UR_MAKE_VERSION(0, 8), ///< latest known version
/// @cond
UR_API_VERSION_FORCE_UINT32 = 0x7fffffff
/// @endcond
Expand Down
2 changes: 1 addition & 1 deletion include/ur_ddi.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*
* @file ur_ddi.h
* @version v0.7-r0
* @version v0.8-r0
*
*/
#ifndef UR_DDI_H_INCLUDED
Expand Down
2 changes: 1 addition & 1 deletion scripts/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "Intel One API Unified Runtime API"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = v0.7
PROJECT_NUMBER = v0.8

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
80 changes: 0 additions & 80 deletions scripts/ci.py

This file was deleted.

9 changes: 9 additions & 0 deletions scripts/core/INTRO.rst
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,15 @@ Specific environment variables can be set to control the behavior of unified run

This environment variable is ignored when :envvar:`UR_ADAPTERS_FORCE_LOAD` environment variable is used.

.. envvar:: UR_ADAPTERS_DEEP_BIND

If set, the loader will use `RTLD_DEEPBIND` when opening adapter libraries. This might be useful if an adapter
requires a different version of a shared library compared to the rest of the applcation.

.. note::

This environment variable is Linux-only.

.. envvar:: UR_ENABLE_LAYERS

Holds a comma-separated list of layers to enable in addition to any specified via ``urInit``.
Expand Down
3 changes: 3 additions & 0 deletions scripts/core/platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ etors:
- name: "0_7"
value: "$X_MAKE_VERSION( 0, 7 )"
desc: "version 0.7"
- name: "0_8"
value: "$X_MAKE_VERSION( 0, 8 )"
desc: "version 0.8"
--- #--------------------------------------------------------------------------
type: function
desc: "Returns the API version supported by the specified platform"
Expand Down
4 changes: 2 additions & 2 deletions scripts/parse_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import ctypes
import itertools

default_version = "0.7"
all_versions = ["0.6", "0.7"]
default_version = "0.8"
all_versions = ["0.6", "0.7", "0.8"]

"""
preprocess object
Expand Down
26 changes: 18 additions & 8 deletions scripts/templates/params.hpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ from templates import helper as th
${x}_params::serializePtr(os, ${caller.body()});
%elif th.type_traits.is_handle(itype):
${x}_params::serializePtr(os, ${caller.body()});
%elif iname and iname.startswith("pfn"):
os << reinterpret_cast<void*>(${caller.body()});
%else:
os << ${caller.body()};
%endif
Expand Down Expand Up @@ -104,7 +106,7 @@ template <> struct is_handle<${th.make_type_name(n, tags, obj)}> : std::true_typ
%endfor
template <typename T>
inline constexpr bool is_handle_v = is_handle<T>::value;
template <typename T> inline void serializePtr(std::ostream &os, T *ptr);
template <typename T> inline void serializePtr(std::ostream &os, const T *ptr);
template <typename T> inline void serializeFlag(std::ostream &os, uint32_t flag);
template <typename T> inline void serializeTagged(std::ostream &os, const void *ptr, T value, size_t size);

Expand Down Expand Up @@ -192,7 +194,11 @@ template <typename T> inline void serializeTagged(std::ostream &os, const void *
case ${ename}: {
%if th.value_traits.is_array(vtype):
<% atype = th.value_traits.get_array_name(vtype) %>
%if 'void' in atype:
const ${atype} const *tptr = (const ${atype} const*)ptr;
%else:
const ${atype} *tptr = (const ${atype} *)ptr;
%endif
%if "char" in atype: ## print char* arrays as simple NULL-terminated strings
serializePtr(os, tptr);
%else:
Expand All @@ -209,12 +215,16 @@ template <typename T> inline void serializeTagged(std::ostream &os, const void *
os << "}";
%endif
%else:
%if 'void' in vtype:
const ${vtype} const *tptr = (const ${vtype} const *)ptr;
%else:
const ${vtype} *tptr = (const ${vtype} *)ptr;
%endif
if (sizeof(${vtype}) > size) {
os << "invalid size (is: " << size << ", expected: >=" << sizeof(${vtype}) << ")";
return;
}
os << (void *)(tptr) << " (";
os << (const void *)(tptr) << " (";
<%call expr="member(tptr, vtype, False)">
*tptr
</%call>
Expand All @@ -237,7 +247,7 @@ template <typename T> inline void serializeTagged(std::ostream &os, const void *
}

## structure type enum value must be first
enum ${th.make_enum_name(n, tags, obj)} *value = (enum ${th.make_enum_name(n, tags, obj)} *)ptr;
const enum ${th.make_enum_name(n, tags, obj)} *value = (const enum ${th.make_enum_name(n, tags, obj)} *)ptr;
switch (*value) {
%for n, item in enumerate(obj['etors']):
<%
Expand Down Expand Up @@ -362,21 +372,21 @@ inline std::ostream &operator<<(std::ostream &os, const struct ${th.make_pfncb_p

namespace ${x}_params {

template <typename T> inline void serializePtr(std::ostream &os, T *ptr) {
template <typename T> inline void serializePtr(std::ostream &os, const T *ptr) {
if (ptr == nullptr) {
os << "nullptr";
} else if constexpr (std::is_pointer_v<T>) {
os << (void *)(ptr) << " (";
os << (const void *)(ptr) << " (";
serializePtr(os, *ptr);
os << ")";
} else if constexpr (std::is_void_v<T> || is_handle_v<T *>) {
os << (void *)ptr;
os << (const void *)ptr;
} else if constexpr (std::is_same_v<std::remove_cv_t< T >, char>) {
os << (void *)(ptr) << " (";
os << (const void *)(ptr) << " (";
os << ptr;
os << ")";
} else {
os << (void *)(ptr) << " (";
os << (const void *)(ptr) << " (";
os << *ptr;
os << ")";
}
Expand Down
35 changes: 16 additions & 19 deletions source/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,25 @@
# See LICENSE.TXT
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

add_library(ur_common INTERFACE)
add_subdirectory(unified_malloc_framework)
add_subdirectory(umf_pools)

add_ur_library(ur_common STATIC
umf_helpers.hpp
ur_pool_manager.hpp
$<$<PLATFORM_ID:Windows>:windows/ur_lib_loader.cpp>
$<$<PLATFORM_ID:Linux,Darwin>:linux/ur_lib_loader.cpp>
)
add_library(${PROJECT_NAME}::common ALIAS ur_common)

target_include_directories(ur_common INTERFACE
target_include_directories(ur_common PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/include
)

add_subdirectory(unified_malloc_framework)
add_subdirectory(umf_pools)
target_link_libraries(ur_common INTERFACE unified_malloc_framework disjoint_pool ${CMAKE_DL_LIBS} ${PROJECT_NAME}::headers)

if(WIN32)
target_sources(ur_common
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/windows/ur_lib_loader.cpp
umf_helpers.hpp ur_pool_manager.hpp
)
else()
target_sources(ur_common
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/linux/ur_lib_loader.cpp
umf_helpers.hpp ur_pool_manager.hpp
)
endif()
target_link_libraries(ur_common PUBLIC
unified_malloc_framework
disjoint_pool
${CMAKE_DL_LIBS}
${PROJECT_NAME}::headers
)
24 changes: 16 additions & 8 deletions source/common/linux/ur_lib_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@
#include "logger/ur_logger.hpp"
#include "ur_lib_loader.hpp"

#if defined(SANITIZER_ANY) || defined(__APPLE__)
#define LOAD_DRIVER_LIBRARY(NAME) dlopen(NAME, RTLD_LAZY | RTLD_LOCAL)
#else
#define LOAD_DRIVER_LIBRARY(NAME) \
dlopen(NAME, RTLD_LAZY | RTLD_LOCAL | RTLD_DEEPBIND)
#endif
#define DEEP_BIND_ENV "UR_ADAPTERS_DEEP_BIND"

namespace ur_loader {

Expand All @@ -34,8 +29,21 @@ void LibLoader::freeAdapterLibrary(HMODULE handle) {

std::unique_ptr<HMODULE, LibLoader::lib_dtor>
LibLoader::loadAdapterLibrary(const char *name) {
return std::unique_ptr<HMODULE, LibLoader::lib_dtor>(
LOAD_DRIVER_LIBRARY(name));
int mode = RTLD_LAZY | RTLD_LOCAL;
#if !defined(__APPLE__)
bool deepbind = getenv_tobool(DEEP_BIND_ENV);
if (deepbind) {
#if defined(SANITIZER_ANY)
logger::warning(
"Enabling RTLD_DEEPBIND while running under a sanitizer is likely "
"to cause issues. Consider disabling {} environment variable.",
DEEP_BIND_ENV);
#endif
mode |= RTLD_DEEPBIND;
}
#endif

return std::unique_ptr<HMODULE, LibLoader::lib_dtor>(dlopen(name, mode));
}

void *LibLoader::getFunctionPtr(HMODULE handle, const char *func_name) {
Expand Down
Loading