Skip to content

Candidate for the v0.10.4 release tag #2076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Sep 16, 2024
Merged
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.20.0 FATAL_ERROR)
project(unified-runtime VERSION 0.10.3)
project(unified-runtime VERSION 0.10.4)

# Check if unified runtime is built as a standalone project.
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR UR_STANDALONE_BUILD)
Expand Down
15 changes: 15 additions & 0 deletions source/adapters/opencl/usm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ urUSMHostAlloc(ur_context_handle_t hContext, const ur_usm_desc_t *pUSMDesc,
void *Ptr = nullptr;
uint32_t Alignment = pUSMDesc ? pUSMDesc->align : 0;

if (pUSMDesc && pUSMDesc->align != 0 &&
((pUSMDesc->align & (pUSMDesc->align - 1)) != 0)) {
return UR_RESULT_ERROR_INVALID_VALUE;
}

std::vector<cl_mem_properties_intel> AllocProperties;
if (pUSMDesc && pUSMDesc->pNext) {
UR_RETURN_ON_FAILURE(usmDescToCLMemProperties(
Expand Down Expand Up @@ -130,6 +135,11 @@ urUSMDeviceAlloc(ur_context_handle_t hContext, ur_device_handle_t hDevice,
void *Ptr = nullptr;
uint32_t Alignment = pUSMDesc ? pUSMDesc->align : 0;

if (pUSMDesc && pUSMDesc->align != 0 &&
((pUSMDesc->align & (pUSMDesc->align - 1)) != 0)) {
return UR_RESULT_ERROR_INVALID_VALUE;
}

std::vector<cl_mem_properties_intel> AllocProperties;
if (pUSMDesc && pUSMDesc->pNext) {
UR_RETURN_ON_FAILURE(usmDescToCLMemProperties(
Expand Down Expand Up @@ -173,6 +183,11 @@ urUSMSharedAlloc(ur_context_handle_t hContext, ur_device_handle_t hDevice,
void *Ptr = nullptr;
uint32_t Alignment = pUSMDesc ? pUSMDesc->align : 0;

if (pUSMDesc && pUSMDesc->align != 0 &&
((pUSMDesc->align & (pUSMDesc->align - 1)) != 0)) {
return UR_RESULT_ERROR_INVALID_VALUE;
}

std::vector<cl_mem_properties_intel> AllocProperties;
if (pUSMDesc && pUSMDesc->pNext) {
UR_RETURN_ON_FAILURE(usmDescToCLMemProperties(
Expand Down
4 changes: 2 additions & 2 deletions source/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ if (NOT DEFINED UMF_REPO)
endif()

if (NOT DEFINED UMF_TAG)
# v0.9.x 19.08.2024: Merge pull request #688 ...
set(UMF_TAG 59c4150b7120a7af5b3c8eb2d9b8bbb5d2e96aa3)
# v0.9.x 12.09.2024: 0.9.0 release
set(UMF_TAG v0.9.0)
endif()

message(STATUS "Will fetch Unified Memory Framework from ${UMF_REPO}")
Expand Down
9 changes: 5 additions & 4 deletions source/loader/layers/tracing/ur_tracing_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ struct XptiContextManager {
~XptiContextManager() { xptiFrameworkFinalize(); }
};

static std::shared_ptr<XptiContextManager> xptiContextManagerGlobal = [] {
return std::make_shared<XptiContextManager>();
}();
static std::shared_ptr<XptiContextManager> xptiContextManagerGet() {
static auto contextManager = std::make_shared<XptiContextManager>();
return contextManager;
};
static thread_local xpti_td *activeEvent;

///////////////////////////////////////////////////////////////////////////////
context_t::context_t() : logger(logger::create_logger("tracing", true, true)) {
this->xptiContextManager = xptiContextManagerGlobal;
this->xptiContextManager = xptiContextManagerGet();

call_stream_id = xptiRegisterStream(CALL_STREAM_NAME);
std::ostringstream streamv;
Expand Down
25 changes: 25 additions & 0 deletions source/loader/ur_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,27 @@ context_t *getContext() { return context_t::get_direct(); }

///////////////////////////////////////////////////////////////////////////////
ur_result_t context_t::init() {
#ifdef _WIN32
// Suppress system errors.
// Tells the system to not display the critical-error-handler message box.
// Instead, the system sends the error to the calling process.
// This is crucial for graceful handling of adapters that couldn't be
// loaded, e.g. due to missing native run-times.
// TODO: add reporting in case of an error.
// NOTE: we restore the old mode to not affect user app behavior.
// See https://github.com/intel/llvm/blob/sycl/sycl/ur_win_proxy_loader/ur_win_proxy_loader.cpp (preloadLibraries())
UINT SavedMode = SetErrorMode(SEM_FAILCRITICALERRORS);
#endif

#ifdef UR_STATIC_ADAPTER_LEVEL_ZERO
// If the adapters were force loaded, it means the user wants to use
// a specific adapter library. Don't load any static adapters.
if (!adapter_registry.adaptersForceLoaded()) {
auto &level_zero = platforms.emplace_back(nullptr);
ur::level_zero::urAdapterGetDdiTables(&level_zero.dditable.ur);
}
#endif

for (const auto &adapterPaths : adapter_registry) {
for (const auto &path : adapterPaths) {
auto handle = LibLoader::loadAdapterLibrary(path.string().c_str());
Expand All @@ -24,6 +45,10 @@ ur_result_t context_t::init() {
}
}
}
#ifdef _WIN32
// Restore system error handling.
(void)SetErrorMode(SavedMode);
#endif

forceIntercept = getenv_tobool("UR_ENABLE_LOADER_INTERCEPT");

Expand Down
Loading