Skip to content

Commit

Permalink
Set to always build with static L0 loader
Browse files Browse the repository at this point in the history
Signed-off-by: Neil R. Spruit <[email protected]>
  • Loading branch information
nrspruit committed Feb 7, 2025
1 parent 44d02dc commit 58ff0fd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions cmake/FetchLevelZero.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ if (NOT DEFINED LEVEL_ZERO_LIBRARY OR NOT DEFINED LEVEL_ZERO_INCLUDE_DIR)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++98-compat-extra-semi")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-warning-option")
endif()
if(UR_STATIC_ADAPTER_L0)
set(BUILD_STATIC ON)
endif()
#if(UR_STATIC_ADAPTER_L0)
set(BUILD_STATIC ON)
#endif()

if (UR_LEVEL_ZERO_LOADER_REPO STREQUAL "")
set(UR_LEVEL_ZERO_LOADER_REPO "https://github.com/nrspruit/level-zero.git")
Expand Down
1 change: 1 addition & 0 deletions source/adapters/level_zero/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ if(UR_BUILD_ADAPTER_L0)
)
install_ur_library(ur_adapter_level_zero)

target_compile_definitions(ur_adapter_level_zero PUBLIC UR_STATIC_LEVEL_ZERO)
if(UR_STATIC_ADAPTER_L0)
target_compile_definitions(ur_adapter_level_zero PUBLIC UR_STATIC_ADAPTER_LEVEL_ZERO)

Expand Down
6 changes: 3 additions & 3 deletions source/adapters/level_zero/adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ ur_adapter_handle_t_::ur_adapter_handle_t_()
// Dynamically load the new L0 apis separately.
// This must be done to avoid attempting to use symbols that do
// not exist in older loader runtimes.
#ifndef UR_STATIC_ADAPTER_LEVEL_ZERO
#ifndef UR_STATIC_LEVEL_ZERO
#ifdef _WIN32
GlobalAdapter->processHandle = GetModuleHandle(NULL);
#else
Expand Down Expand Up @@ -414,7 +414,7 @@ ur_adapter_handle_t_::ur_adapter_handle_t_()
}

if (useInitDrivers) {
#ifdef UR_STATIC_ADAPTER_LEVEL_ZERO
#ifdef UR_STATIC_LEVEL_ZERO
GlobalAdapter->initDriversFunctionPtr = zeInitDrivers;
#else
GlobalAdapter->initDriversFunctionPtr =
Expand Down Expand Up @@ -482,7 +482,7 @@ ur_adapter_handle_t_::ur_adapter_handle_t_()
ZesInitNeeded = true;
}
if (ZesInitNeeded) {
#ifdef UR_STATIC_ADAPTER_LEVEL_ZERO
#ifdef UR_STATIC_LEVEL_ZERO
GlobalAdapter->getDeviceByUUIdFunctionPtr = zesDriverGetDeviceByUuidExp;
GlobalAdapter->getSysManDriversFunctionPtr = zesDriverGet;
GlobalAdapter->sysManInitFunctionPtr = zesInit;
Expand Down
2 changes: 1 addition & 1 deletion source/adapters/level_zero/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ ur_result_t ur_platform_handle_t_::initialize() {
// Check if mutable command list extension is supported and initialize
// function pointers.
if (MutableCommandListSpecExtensionSupported) {
#ifdef UR_STATIC_ADAPTER_LEVEL_ZERO
#ifdef UR_STATIC_LEVEL_ZERO
ZeMutableCmdListExt.zexCommandListGetNextCommandIdExp =
zeCommandListGetNextCommandIdExp;
ZeMutableCmdListExt.zexCommandListUpdateMutableCommandsExp =
Expand Down

0 comments on commit 58ff0fd

Please sign in to comment.