Fix: add building option for NNet (#162)

Signed-off-by: YdrMaster <ydrml@hotmail.com>
This commit is contained in:
Derui Yang 2023-10-16 19:53:28 +08:00 committed by GitHub
parent 1184fa131f
commit d0f9792613
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 4 deletions

View File

@ -5,6 +5,7 @@ option(USE_KUNLUN "Support KUNLUN XPU" OFF)
option(USE_INTELCPU "Support INTELCPU" OFF) option(USE_INTELCPU "Support INTELCPU" OFF)
option(USE_BACKTRACE "Print backtrace on exception and segmentation fault" ON) option(USE_BACKTRACE "Print backtrace on exception and segmentation fault" ON)
option(USE_PROTOBUF "Serialize and deserialize tensors" OFF) option(USE_PROTOBUF "Serialize and deserialize tensors" OFF)
option(BUILD_NNET "Build nnet" OFF)
option(BUILD_DIST "Build project for distributed running" OFF) option(BUILD_DIST "Build project for distributed running" OFF)
option(BUILD_TEST "Build tests" OFF) option(BUILD_TEST "Build tests" OFF)
@ -123,7 +124,13 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -UNDEBUG")
# Source files # Source files
file(GLOB_RECURSE SRC src/ffi/*.cc src/core/*.cc src/kernels/cpu/*.cc src/nnet/*.cc src/operators/*.cc src/utils/*.cc) file(GLOB_RECURSE SRC src/ffi/*.cc src/core/*.cc src/kernels/cpu/*.cc src/operators/*.cc src/utils/*.cc)
if(BUILD_NNET)
add_compile_definitions(BUILD_NNET=1)
file(GLOB_RECURSE SRC_NNET src/nnet/*.cc)
list (APPEND SRC ${SRC_NNET})
endif()
if(USE_CUDA) if(USE_CUDA)
file(GLOB_RECURSE SRC_CUDA src/cuda/*.cc src/cuda/*.cu src/kernels/cuda/*.cc src/kernels/cuda/*.cu) file(GLOB_RECURSE SRC_CUDA src/cuda/*.cc src/cuda/*.cu src/kernels/cuda/*.cc src/kernels/cuda/*.cu)

View File

@ -1,3 +1,5 @@
#ifdef BUILD_NNET
#include "operators/membound.h" #include "operators/membound.h"
#include "core/kernel.h" #include "core/kernel.h"
#include "nnet/Visitor/Interpreter.h" #include "nnet/Visitor/Interpreter.h"
@ -82,3 +84,5 @@ REGISTER_KERNEL(Device::CPU, OpType::MemBound, DataType::UInt32,
MemboundInterpreter, "MemboundInterpreter_CPU"); MemboundInterpreter, "MemboundInterpreter_CPU");
} // namespace infini } // namespace infini
#endif

View File

@ -1,3 +1,5 @@
#ifdef BUILD_NNET
#include "operators/membound.h" #include "operators/membound.h"
#include "nnet/Visitor/CheckOOBVisitor.h" #include "nnet/Visitor/CheckOOBVisitor.h"
#include "nnet/Visitor/HashVisitor.h" #include "nnet/Visitor/HashVisitor.h"
@ -84,3 +86,5 @@ bool MemBoundObj::checkOOB(nnet::Expr expr) {
} }
} // namespace infini } // namespace infini
#endif