Skip to content

Commit e60f448

Browse files
authored
[OneDNN build] Check availability of Ukernels (#239)
This commit checks availability of ukernels before including them into target. Signed-off-by: Dmitrii Makarenko <[email protected]>
1 parent 0625715 commit e60f448

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

third_party/cpu/CMakeLists.txt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1+
include(CheckSymbolExists)
12
# Find OneDNN ukernel library
23
find_package(dnnl CONFIG)
34
if (dnnl_FOUND)
4-
message(STATUS "Found OneDNN/DNNL")
5-
add_compile_definitions(ONEDNN_AVAILABLE)
65
get_target_property(dnnl_include DNNL::dnnl INTERFACE_INCLUDE_DIRECTORIES)
76
# currently used only in triton_cpu.cc and in ConvertDotToOneDNN
87
include_directories(${dnnl_include})
8+
set (dnnl_header ${dnnl_include}/oneapi/dnnl/dnnl_config.h)
9+
check_symbol_exists(DNNL_EXPERIMENTAL_UKERNEL ${dnnl_header} HAS_UKERNELS)
10+
if (HAS_UKERNELS)
11+
message(STATUS "Found OneDNN/DNNL with Ukernels support")
12+
add_compile_definitions(ONEDNN_AVAILABLE)
13+
else ()
14+
message(STATUS "SKIPPING found OneDNN/DNNL because Ukernels support is missing")
15+
endif()
916
else ()
1017
message(STATUS "Could NOT find OneDNN/DNNL")
1118
endif()
@@ -40,7 +47,7 @@ endif()
4047
# Configure and build Triton-CPU runtime
4148
set(TRITON_CPU_RUNTIME_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/runtime/cpu_runtime.cpp)
4249
set(TRITON_CPU_RUNTIME_LIBS LLVMSupport)
43-
if (dnnl_FOUND)
50+
if (dnnl_FOUND AND HAS_UKERNELS)
4451
set(TRITON_CPU_RUNTIME_SOURCES ${TRITON_CPU_RUNTIME_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/runtime/runtime_onednn.cpp)
4552
set(TRITON_CPU_RUNTIME_LIBS ${TRITON_CPU_RUNTIME_LIBS} DNNL::dnnl)
4653
endif()

third_party/cpu/runtime/runtime_onednn.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "oneapi/dnnl/dnnl_ukernel.hpp"
44
#include "oneapi/dnnl/dnnl_ukernel_types.h"
55
#if !defined(DNNL_EXPERIMENTAL_UKERNEL)
6-
#error "DNNL Ukerenel ismissing"
6+
#error "DNNL Ukerenel is missing"
77
#endif
88
#endif
99

0 commit comments

Comments
 (0)