@@ -45,12 +45,11 @@ if(NOT LEVEL_ZERO_LIB_NAME AND NOT LEVEL_ZERO_LIBRARY)
4545 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++98-compat-extra-semi" )
4646 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-warning-option" )
4747 endif ()
48- set (BUILD_STATIC ON )
4948
5049 set (UR_LEVEL_ZERO_LOADER_REPO "https://github.com/oneapi-src/level-zero.git" )
5150 # Remember to update the pkg_check_modules minimum version above when updating the
5251 # clone tag
53- set (UR_LEVEL_ZERO_LOADER_TAG v1.25.0 )
52+ set (UR_LEVEL_ZERO_LOADER_TAG v1.25.1 )
5453
5554 # Disable due to a bug https://github.com/oneapi-src/level-zero/issues/104
5655 set (CMAKE_INCLUDE_CURRENT_DIR OFF )
@@ -60,6 +59,11 @@ if(NOT LEVEL_ZERO_LIB_NAME AND NOT LEVEL_ZERO_LIBRARY)
6059 set (CMAKE_MSVC_RUNTIME_LIBRARY_BAK "${CMAKE_MSVC_RUNTIME_LIBRARY} " )
6160 # UMF has not yet been able to build as static
6261 set (CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL" )
62+
63+ # Force building validation layer by setting BUILD_STATIC to OFF
64+ # This must be set before FetchContent to override Level Zero's default
65+ set (BUILD_STATIC OFF CACHE BOOL "Build Level Zero as dynamic library to enable validation layer" FORCE)
66+
6367 message (STATUS "Level Zero Adapter: Will fetch Level Zero Loader from ${UR_LEVEL_ZERO_LOADER_REPO} " )
6468 include (FetchContent)
6569 FetchContent_Declare(level-zero-loader
@@ -72,6 +76,13 @@ if(NOT LEVEL_ZERO_LIB_NAME AND NOT LEVEL_ZERO_LIBRARY)
7276 FetchContent_MakeAvailable(level-zero-loader)
7377 FetchContent_GetProperties(level-zero-loader)
7478
79+ # Ensure validation layer is built as part of the default target
80+ # This is needed for leak debugging with UR_L0_LEAKS_DEBUG=1
81+ if (TARGET ze_validation_layer)
82+ add_dependencies (ze_loader ze_validation_layer)
83+ message (STATUS "Level Zero validation layer will be built with loader" )
84+ endif ()
85+
7586 # Restore original flags
7687 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_BAK} " )
7788 set (CMAKE_MSVC_RUNTIME_LIBRARY "${CMAKE_MSVC_RUNTIME_LIBRARY_BAK} " )
0 commit comments