megbrain_build_config.h.in 5.8 KB
Newer Older
1 2 3 4
/**
 * \file src/core/include/megbrain_build_config.h
 * MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
 *
5
 * Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
6 7 8 9 10 11 12 13 14 15
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 */

#ifndef _HEADER_MGB_BUILD_CONFIG
#define _HEADER_MGB_BUILD_CONFIG

#cmakedefine01 MGB_CUDA
16
#cmakedefine01 MGB_ROCM
17 18
#cmakedefine01 MGB_CAMBRICON
#cmakedefine01 MGB_ATLAS
19 20 21 22
#cmakedefine01 MGB_ASSERT_LOC
#cmakedefine01 MGB_ENABLE_DEBUG_UTIL
#cmakedefine01 MGB_ENABLE_LOGGING
#cmakedefine01 MGB_ENABLE_GRAD
23
#cmakedefine01 MGB_ENABLE_CPUINFO
24
#cmakedefine01 MGB_ENABLE_DOT
25 26 27 28
#cmakedefine01 MGB_VERBOSE_TYPEINFO_NAME
#cmakedefine01 MGB_BUILD_SLIM_SERVING
#cmakedefine01 MGB_ENABLE_EXCEPTION
#cmakedefine01 MGB_JIT
M
Megvii Engine Team 已提交
29
#cmakedefine01 MGB_JIT_MLIR
30 31 32 33 34
#cmakedefine01 MGB_JIT_HALIDE
#cmakedefine01 MGB_ENABLE_TENSOR_RT
#cmakedefine01 MGB_ENABLE_JSON
#cmakedefine01 MGB_HAVE_THREAD
#cmakedefine01 MGB_ENABLE_OPR_MM
35 36
#cmakedefine01 MGB_ENABLE_FBS_SERIALIZATION
#cmakedefine01 MGB_IS_DEV
37 38 39 40
// DNN related flags
// Platform macro's
#cmakedefine01 MEGDNN_WITH_CUDA

41
#cmakedefine01 MEGDNN_WITH_ROCM
42 43 44
#cmakedefine01 MEGDNN_ARMV7
#cmakedefine01 MEGDNN_AARCH64
#cmakedefine01 MEGDNN_ENABLE_FP16_NEON
45 46 47 48 49 50

#cmakedefine01 MEGDNN_X86_WITH_MKL
#cmakedefine01 MEGDNN_X86_WITH_OPENBLAS
#cmakedefine01 MEGDNN_X86_WITH_MKL_DNN
#cmakedefine01 MEGDNN_ENABLE_RTTI
#cmakedefine01 MEGDNN_ENABLE_LOGGING
51
#cmakedefine01 MEGDNN_ENABLE_MANGLING
52 53 54 55 56 57 58 59
#cmakedefine01 MEGDNN_ENABLE_EXCEPTIONS
#cmakedefine01 MEGDNN_NAIVE
#cmakedefine01 MEGDNN_X86
#cmakedefine01 MEGDNN_X86_64
#cmakedefine01 MEGDNN_64_BIT
#cmakedefine01 MEGDNN_THREADS_512
#cmakedefine01 MEGDNN_ENABLE_MULTI_THREADS

60 61 62 63
// whether atlas is available
#ifndef MGB_ATLAS
#define MGB_ATLAS  0
#endif
64

65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
// whether cuda is available
#ifndef MGB_CUDA
#define MGB_CUDA    1
#endif


// whether to include file/line location for assert message
#ifndef MGB_ASSERT_LOC
#define MGB_ASSERT_LOC          1
#endif

// whether to enable utils/debug.h and other debug methods
#ifndef MGB_ENABLE_DEBUG_UTIL
#define MGB_ENABLE_DEBUG_UTIL   1
#endif

// whether to enable logging
#ifndef MGB_ENABLE_LOGGING
#define MGB_ENABLE_LOGGING      1
#endif

// whether to enable registering opr grad functions
#ifndef MGB_ENABLE_GRAD
#define MGB_ENABLE_GRAD         1
#endif

91 92 93 94 95
// whether to enable cpuinfo
#ifndef MGB_ENABLE_CPUINFO
#define MGB_ENABLE_CPUINFO      1
#endif

96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
//! use one MACRO indicate enable_arm_dotprod
#if __ARM_FEATURE_DOTPROD
#ifdef MGB_ENABLE_DOT
#undef MGB_ENABLE_DOT
#endif
#define MGB_ENABLE_DOT 1
#endif


//! ENABLE MGB DOT should enable CPUINFO
#if MGB_ENABLE_DOT
#if !defined(MGB_ENABLE_CPUINFO) || !MGB_ENABLE_CPUINFO
#ifdef MGB_ENABLE_CPUINFO
#undef MGB_ENABLE_CPUINFO
#endif
#define MGB_ENABLE_CPUINFO 1
#endif
#endif

115 116 117 118 119 120
//! IOS disabled cpuinfo and dotprod, cpuinfo has some problem on ios
#ifdef IOS
#undef MGB_ENABLE_CPUINFO
#define MGB_ENABLE_CPUINFO      0
#undef MGB_ENABLE_DOT
#endif
121

122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
// whether to include actual class name in mgb::Typeinfo object; if this is
// disabled, mgb::serialization::OprRegistry::find_opr_by_name would not work.
#ifndef MGB_VERBOSE_TYPEINFO_NAME
#define MGB_VERBOSE_TYPEINFO_NAME   1
#endif

// whether to enbale configuing megbrain internals through env vars
#ifndef MGB_ENABLE_GETENV
#define MGB_ENABLE_GETENV       1
#endif

// whether to remove unnecessary features when used for serving
#ifndef MGB_BUILD_SLIM_SERVING
#define MGB_BUILD_SLIM_SERVING  0
#endif

// whether to enable exception
#ifndef MGB_ENABLE_EXCEPTION
#if __EXCEPTIONS
#define MGB_ENABLE_EXCEPTION    1
#else
#define MGB_ENABLE_EXCEPTION    0
#endif
#endif

// whether <thread> is available and usable
#ifndef MGB_HAVE_THREAD
#define MGB_HAVE_THREAD         1
#endif

// whether to trade thread safety for memory usage
#ifndef MGB_THREAD_SAFE
#define MGB_THREAD_SAFE MGB_HAVE_THREAD
#endif

// whether to enable JIT
#ifndef MGB_JIT
#define MGB_JIT     1
#endif
#ifndef MGB_JIT_HALIDE
#define MGB_JIT_HALIDE 0
#endif


166 167 168 169 170 171 172 173 174
#ifndef MEGDNN_WITH_CAMBRICON
#define MEGDNN_WITH_CAMBRICON 0
#endif

#ifndef MGB_CAMBRICON
#define MGB_CAMBRICON MEGDNN_WITH_CAMBRICON
#endif


175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
// whether to enable TensorRT support
#ifndef MGB_ENABLE_TENSOR_RT
#define MGB_ENABLE_TENSOR_RT    MGB_CUDA
#endif

// whether to enable fastrun profile
#ifndef MGB_ENABLE_FASTRUN
#define MGB_ENABLE_FASTRUN 1
#endif


/* ================= following are more finegrind controls ================= */

// whether to enable json dumper
#ifndef MGB_ENABLE_JSON
#define MGB_ENABLE_JSON !MGB_BUILD_SLIM_SERVING
#endif

// whether to enable distributed communication
#ifndef MGB_ENABLE_OPR_MM
#define MGB_ENABLE_OPR_MM 0
#endif

/* ================= DNN related flags ================= */

// whether to use mkl lib
#ifndef MEGDNN_X86_WITH_MKL
#define MEGDNN_X86_WITH_MKL 0
#endif

// whether to enable rtti
#ifndef MEGDNN_ENABLE_RTTI
#define MEGDNN_ENABLE_RTTI 1
#endif

// whether to enable mangling
#ifndef MEGDNN_ENABLE_MANGLING
#define MEGDNN_ENABLE_MANGLING !MEGDNN_ENABLE_RTTI
#endif

// whether to enable logging
#ifndef MEGDNN_ENABLE_LOGGING
#define MEGDNN_ENABLE_LOGGING MGB_ENABLE_LOGGING
#endif

// whether to enable exception
#ifndef MEGDNN_ENABLE_EXCEPTIONS
#define MEGDNN_ENABLE_EXCEPTIONS MGB_ENABLE_EXCEPTION
#endif

// whether to build naive
#ifndef MEGDNN_NAIVE
#define MEGDNN_NAIVE 0
#endif

// whether to build x86
#ifndef MEGDNN_X86
#define MEGDNN_X86 0
#endif

// whether to use cuda thread 512
#ifndef MEGDNN_THREADS_512
#define MEGDNN_THREADS_512 0
#endif

// whether to enable intra-op multi threads
#ifndef MEGDNN_ENABLE_MULTI_THREADS
#define MEGDNN_ENABLE_MULTI_THREADS 1
#endif

#ifndef MEGDNN_X86_WITH_OPENBLAS
#define MEGDNN_X86_WITH_OPENBLAS 0
#endif

#ifndef MEGDNN_X86_WITH_MKL_DNN
#define MEGDNN_X86_WITH_MKL_DNN 0
#endif

#endif // _HEADER_MGB_BUILD_CONFIG