-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
xiaying
committed
Jan 6, 2021
1 parent
8dfb7bd
commit 2d1b129
Showing
160 changed files
with
10,096 additions
and
2,395 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
include(ExternalProject) | ||
|
||
set(DOWNLOAD_URL https://github.com/oneapi-src/oneDNN/archive/v1.7.zip) | ||
set(ROOT ${CMAKE_CURRENT_LIST_DIR}/../3rd_party/) | ||
set(ONEDNN_DIR ${ROOT}/oneDNN/) | ||
set(MNN_BUILD_DIR ${CMAKE_CURRENT_LIST_DIR}/../build/) | ||
|
||
set(CONFIGURE_CMD cd ${ONEDNN_DIR} && cmake -DCMAKE_INSTALL_PREFIX=${MNN_BUILD_DIR} -DDNNL_BUILD_EXAMPLES=OFF -DDNNL_BUILD_TESTS=OFF -DDNNL_CPU_RUNTIME=SEQ) | ||
set(BUILD_CMD cd ${ONEDNN_DIR} && make -j8) | ||
set(INSTALL_CMD cd ${ONEDNN_DIR} && make install) | ||
|
||
ExternalProject_Add(oneDNN | ||
PREFIX oneDNN | ||
URL ${DOWNLOAD_URL} | ||
DOWNLOAD_DIR ${ROOT} | ||
SOURCE_DIR ${ONEDNN_DIR} | ||
CONFIGURE_COMMAND ${CONFIGURE_CMD} | ||
BUILD_COMMAND ${BUILD_CMD} | ||
INSTALL_COMMAND ${INSTALL_CMD} | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
option(MNN_CODEGEN_LLVM "Build llvm backend for codegen." OFF) | ||
option(MNN_CODEGEN_C "Build C source backend for codegen." OFF) | ||
option(MNN_CODEGEN_OPENCL "Build OpenCL source backend for codegen." OFF) | ||
option(MNN_CODEGEN_JIT "Build jit for codegen." OFF) | ||
|
||
|
||
file(GLOB CODEGEN_HEADER "${CMAKE_CURRENT_LIST_DIR}/*.*") | ||
file(GLOB CPU_SRCS "${CMAKE_CURRENT_LIST_DIR}/cpu/*.*") | ||
list(APPEND MNN_CODEGEN_SRCS ${CODEGEN_HEADER}) | ||
|
||
if(MNN_CODEGEN_OPENCL) | ||
add_definitions(-DMNN_CODEGEN_OPENCL) | ||
file(GLOB OPENCL_SRCS "${CMAKE_CURRENT_LIST_DIR}/opencl/*.*") | ||
list(APPEND MNN_CODEGEN_SRCS ${OPENCL_SRCS}) | ||
endif() | ||
|
||
if(MNN_CODEGEN_C) | ||
add_definitions(-DMNN_CODEGEN_CPU) | ||
add_definitions(-DMNN_CODEGEN_C) | ||
file(GLOB C_SRCS "${CMAKE_CURRENT_LIST_DIR}/cpu/c/*.*") | ||
list(APPEND MNN_CODEGEN_SRCS ${CPU_SRCS}) | ||
list(APPEND MNN_CODEGEN_SRCS ${C_SRCS}) | ||
endif() | ||
|
||
if(MNN_CODEGEN_LLVM) | ||
add_definitions(-DMNN_CODEGEN_CPU) | ||
add_definitions(-DMNN_CODEGEN_LLVM) | ||
file(GLOB LLVM_SRCS "${CMAKE_CURRENT_LIST_DIR}/cpu/llvm/*.*") | ||
list(APPEND MNN_CODEGEN_SRCS ${CPU_SRCS}) | ||
list(APPEND MNN_CODEGEN_SRCS ${LLVM_SRCS}) | ||
# add llvm libs | ||
find_package(LLVM REQUIRED CONFIG) | ||
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") | ||
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") | ||
include_directories(${LLVM_INCLUDE_DIRS}) | ||
add_definitions(${LLVM_DEFINITIONS}) | ||
llvm_map_components_to_libnames(llvm_libs core bitwriter) | ||
list(APPEND MNN_EXTRA_DEPENDS ${llvm_libs}) | ||
endif() | ||
|
||
add_library(MNNCodegen OBJECT ${MNN_CODEGEN_SRCS}) | ||
set_property(TARGET MNNCodegen PROPERTY CXX_STANDARD 14) | ||
list(APPEND MNN_OBJECTS_TO_LINK $<TARGET_OBJECTS:MNNCodegen>) |
Oops, something went wrong.