forked from onnx/onnx-mlir
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
70 lines (57 loc) · 1.78 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# SPDX-License-Identifier: Apache-2.0
# When an accelerator is specified to be built in ONNX_MLIR_ACCELERATORS,
# if for whatever reason we do not want to build it on a specific arch,
# XX_ENABLED variable can be used to control that. For example, if we
# only want to compile NNPA on s390x, we can do:
#
# if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "s390x")
# set(NNPA_ENABLED 1 BOOL PARENT_SCOPE)
# ...
# endif()
set(NNPA_ENABLED 1 BOOL PARENT_SCOPE)
set(NNPA_SRC_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
set(NNPA_BIN_ROOT "${CMAKE_CURRENT_BINARY_DIR}")
set(NNPA_LIBRARY_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
set(NNPA_RUNTIME_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
set(NNPA_INCLUDE_PATH ${CMAKE_INCLUDE_OUTPUT_DIRECTORY})
set(NNPA_ONNX_MLIR_SRC_ROOT ${ONNX_MLIR_SRC_ROOT})
set(NNPA_ONNX_MLIR_BIN_ROOT ${ONNX_MLIR_BIN_ROOT})
# The path to find the zDNN library.
if (DEFINED ENV{ZDNN_LIBRARY_DIR} AND EXISTS $ENV{ZDNN_LIBRARY_DIR})
message(DEBUG "ZDNN_LIBRARY_DIR : " $ENV{ZDNN_LIBRARY_DIR})
set(ZDNN_LIBRARY_DIR $ENV{ZDNN_LIBRARY_DIR})
set(ZDNN_LIBRARY_ENABLED 1)
else()
message(DEBUG "ZDNN_LIBRARY_DIR not found. zDNN-related tests will be turned off.")
set(ZDNN_LIBRARY_ENABLED 0)
endif()
include(zdnn.cmake)
setup_zdnn(v1.0.1)
add_subdirectory(Dialect)
add_subdirectory(Conversion)
add_subdirectory(Support)
add_subdirectory(Transform)
add_subdirectory(Compiler)
add_subdirectory(Runtime)
add_onnx_mlir_library(OMNNPAAccel
NNPAAccelerator.cpp
EXCLUDE_FROM_OM_LIBS
DEPENDS
libzdnn
RuntimeNNPA
INCLUDE_DIRS PUBLIC
${ONNX_MLIR_SRC_ROOT}/include
${ONNX_MLIR_SRC_ROOT}
${NNPA_ONNX_MLIR_SRC_ROOT}
${NNPA_SRC_ROOT}
${NNPA_BIN_ROOT}
${NNPA_INCLUDE_PATH}
LINK_LIBS PUBLIC
onnx
OMNNPACompilerUtils
OMAccelerator
OMZHighOps
OMZHighToZLow
OMZLowOps
OMZLowToLLVM
)