You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

megbrain_build_config.h.in 6.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. /**
  2. * \file src/megbrain_build_config.h.in
  3. * MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
  4. *
  5. * Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
  6. *
  7. * Unless required by applicable law or agreed to in writing,
  8. * software distributed under the License is distributed on an
  9. * "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. */
  11. #ifndef _HEADER_MGB_BUILD_CONFIG
  12. #define _HEADER_MGB_BUILD_CONFIG
  13. #cmakedefine01 MGB_CUDA
  14. #cmakedefine01 MGB_ROCM
  15. #cmakedefine01 MGB_CAMBRICON
  16. #cmakedefine01 MGB_ATLAS
  17. #cmakedefine01 MGB_ASSERT_LOC
  18. #cmakedefine01 MGB_ENABLE_DEBUG_UTIL
  19. #cmakedefine01 MGB_ENABLE_LOGGING
  20. #cmakedefine01 MGB_ENABLE_GRAD
  21. #cmakedefine01 MGB_ENABLE_CPUINFO
  22. #cmakedefine01 MGB_ENABLE_DOT
  23. #cmakedefine01 MGB_VERBOSE_TYPEINFO_NAME
  24. #cmakedefine01 MGB_BUILD_SLIM_SERVING
  25. #cmakedefine01 MGB_ENABLE_EXCEPTION
  26. #cmakedefine01 MGB_JIT
  27. #cmakedefine01 MGB_JIT_MLIR
  28. #cmakedefine01 MGB_JIT_HALIDE
  29. #cmakedefine01 MGB_ENABLE_TENSOR_RT
  30. #cmakedefine01 MGB_ENABLE_JSON
  31. #cmakedefine01 MGB_HAVE_THREAD
  32. #cmakedefine01 MGB_ENABLE_OPR_MM
  33. #cmakedefine01 MGB_ENABLE_FBS_SERIALIZATION
  34. #cmakedefine01 MGB_IS_DEV
  35. #cmakedefine01 MGB_CUSTOM_OP
  36. // DNN related flags
  37. // Platform macro's
  38. #cmakedefine01 MEGDNN_WITH_CUDA
  39. #cmakedefine01 MEGDNN_WITH_ROCM
  40. #cmakedefine01 MEGDNN_ARMV7
  41. #cmakedefine01 MEGDNN_AARCH64
  42. #cmakedefine01 MEGDNN_ENABLE_FP16_NEON
  43. #cmakedefine01 MEGDNN_X86_WITH_MKL
  44. #cmakedefine01 MEGDNN_X86_WITH_OPENBLAS
  45. #cmakedefine01 MEGDNN_X86_WITH_MKL_DNN
  46. #cmakedefine01 MEGDNN_ENABLE_RTTI
  47. #cmakedefine01 MEGDNN_ENABLE_LOGGING
  48. #cmakedefine01 MEGDNN_ENABLE_MANGLING
  49. #cmakedefine01 MEGDNN_ENABLE_EXCEPTIONS
  50. #cmakedefine01 MEGDNN_NAIVE
  51. #cmakedefine01 MEGDNN_X86
  52. #cmakedefine01 MEGDNN_X86_64
  53. #cmakedefine01 MEGDNN_64_BIT
  54. #cmakedefine01 MEGDNN_THREADS_512
  55. #cmakedefine01 MEGDNN_ENABLE_MULTI_THREADS
  56. // whether atlas is available
  57. #ifndef MGB_ATLAS
  58. #define MGB_ATLAS 0
  59. #endif
  60. // whether cuda is available
  61. #ifndef MGB_CUDA
  62. #define MGB_CUDA 1
  63. #endif
  64. // whether to include file/line location for assert message
  65. #ifndef MGB_ASSERT_LOC
  66. #define MGB_ASSERT_LOC 1
  67. #endif
  68. // whether to enable utils/debug.h and other debug methods
  69. #ifndef MGB_ENABLE_DEBUG_UTIL
  70. #define MGB_ENABLE_DEBUG_UTIL 1
  71. #endif
  72. // whether to enable logging
  73. #ifndef MGB_ENABLE_LOGGING
  74. #define MGB_ENABLE_LOGGING 1
  75. #endif
  76. // whether to enable registering opr grad functions
  77. #ifndef MGB_ENABLE_GRAD
  78. #define MGB_ENABLE_GRAD 1
  79. #endif
  80. // whether to enable cpuinfo
  81. #ifndef MGB_ENABLE_CPUINFO
  82. #define MGB_ENABLE_CPUINFO 1
  83. #endif
  84. //! use one MACRO indicate enable_arm_dotprod
  85. #if __ARM_FEATURE_DOTPROD
  86. #ifdef MGB_ENABLE_DOT
  87. #undef MGB_ENABLE_DOT
  88. #endif
  89. #define MGB_ENABLE_DOT 1
  90. #endif
  91. //! ENABLE MGB DOT should enable CPUINFO
  92. #if MGB_ENABLE_DOT
  93. #if !defined(MGB_ENABLE_CPUINFO) || !MGB_ENABLE_CPUINFO
  94. #ifdef MGB_ENABLE_CPUINFO
  95. #undef MGB_ENABLE_CPUINFO
  96. #endif
  97. #define MGB_ENABLE_CPUINFO 1
  98. #endif
  99. #endif
  100. //! IOS disabled cpuinfo and dotprod, cpuinfo has some problem on ios
  101. #ifdef IOS
  102. #undef MGB_ENABLE_CPUINFO
  103. #define MGB_ENABLE_CPUINFO 0
  104. #undef MGB_ENABLE_DOT
  105. #endif
  106. // whether to include actual class name in mgb::Typeinfo object; if this is
  107. // disabled, mgb::serialization::OprRegistry::find_opr_by_name would not work.
  108. #ifndef MGB_VERBOSE_TYPEINFO_NAME
  109. #define MGB_VERBOSE_TYPEINFO_NAME 1
  110. #endif
  111. // whether to enbale configuing megbrain internals through env vars
  112. #ifndef MGB_ENABLE_GETENV
  113. #define MGB_ENABLE_GETENV MGB_ASSERT_LOC
  114. #endif
  115. // whether to remove unnecessary features when used for serving
  116. #ifndef MGB_BUILD_SLIM_SERVING
  117. #define MGB_BUILD_SLIM_SERVING 0
  118. #endif
  119. // whether to enable exception
  120. #ifndef MGB_ENABLE_EXCEPTION
  121. #if __EXCEPTIONS
  122. #define MGB_ENABLE_EXCEPTION 1
  123. #else
  124. #define MGB_ENABLE_EXCEPTION 0
  125. #endif
  126. #endif
  127. // whether <thread> is available and usable
  128. #ifndef MGB_HAVE_THREAD
  129. #define MGB_HAVE_THREAD 1
  130. #endif
  131. // whether to trade thread safety for memory usage
  132. #ifndef MGB_THREAD_SAFE
  133. #define MGB_THREAD_SAFE MGB_HAVE_THREAD
  134. #endif
  135. // whether to enable JIT
  136. #ifndef MGB_JIT
  137. #define MGB_JIT 1
  138. #endif
  139. #ifndef MGB_JIT_HALIDE
  140. #define MGB_JIT_HALIDE 0
  141. #endif
  142. #ifndef MGB_CUSTOM_OP
  143. #define MGB_CUSTOM_OP 0
  144. #endif
  145. #ifndef MEGDNN_WITH_CAMBRICON
  146. #define MEGDNN_WITH_CAMBRICON 0
  147. #endif
  148. #ifndef MGB_CAMBRICON
  149. #define MGB_CAMBRICON MEGDNN_WITH_CAMBRICON
  150. #endif
  151. // whether to enable TensorRT support
  152. #ifndef MGB_ENABLE_TENSOR_RT
  153. #define MGB_ENABLE_TENSOR_RT MGB_CUDA
  154. #endif
  155. // whether to enable fastrun profile
  156. #ifndef MGB_ENABLE_FASTRUN
  157. #define MGB_ENABLE_FASTRUN 1
  158. #endif
  159. /* ================= following are more finegrind controls ================= */
  160. // whether to enable json dumper
  161. #ifndef MGB_ENABLE_JSON
  162. #define MGB_ENABLE_JSON !MGB_BUILD_SLIM_SERVING
  163. #endif
  164. // whether to enable distributed communication
  165. #ifndef MGB_ENABLE_OPR_MM
  166. #define MGB_ENABLE_OPR_MM 0
  167. #endif
  168. /* ================= DNN related flags ================= */
  169. // whether to use mkl lib
  170. #ifndef MEGDNN_X86_WITH_MKL
  171. #define MEGDNN_X86_WITH_MKL 0
  172. #endif
  173. // whether to enable rtti
  174. #ifndef MEGDNN_ENABLE_RTTI
  175. #define MEGDNN_ENABLE_RTTI 1
  176. #endif
  177. // whether to enable mangling
  178. #ifndef MEGDNN_ENABLE_MANGLING
  179. #define MEGDNN_ENABLE_MANGLING !MEGDNN_ENABLE_RTTI
  180. #endif
  181. // whether to enable logging
  182. #ifndef MEGDNN_ENABLE_LOGGING
  183. #define MEGDNN_ENABLE_LOGGING MGB_ENABLE_LOGGING
  184. #endif
  185. // whether to enable exception
  186. #ifndef MEGDNN_ENABLE_EXCEPTIONS
  187. #define MEGDNN_ENABLE_EXCEPTIONS MGB_ENABLE_EXCEPTION
  188. #endif
  189. // whether to build naive
  190. #ifndef MEGDNN_NAIVE
  191. #define MEGDNN_NAIVE 0
  192. #endif
  193. // whether to build x86
  194. #ifndef MEGDNN_X86
  195. #define MEGDNN_X86 0
  196. #endif
  197. // whether to use cuda thread 512
  198. #ifndef MEGDNN_THREADS_512
  199. #define MEGDNN_THREADS_512 0
  200. #endif
  201. // whether to enable intra-op multi threads
  202. #ifndef MEGDNN_ENABLE_MULTI_THREADS
  203. #define MEGDNN_ENABLE_MULTI_THREADS 1
  204. #endif
  205. #ifndef MEGDNN_X86_WITH_OPENBLAS
  206. #define MEGDNN_X86_WITH_OPENBLAS 0
  207. #endif
  208. #ifndef MEGDNN_X86_WITH_MKL_DNN
  209. #define MEGDNN_X86_WITH_MKL_DNN 0
  210. #endif
  211. #ifdef WIN32
  212. #ifdef MGE_DLL_EXPORT
  213. #define MGE_WIN_DECLSPEC_FUC __declspec(dllexport)
  214. #define MGE_WIN_DECLSPEC_DATA __declspec(dllexport)
  215. #elif defined(MGE_WINDOWS_STATIC_LINK)
  216. #define MGE_WIN_DECLSPEC_FUC
  217. #define MGE_WIN_DECLSPEC_DATA
  218. #else
  219. #define MGE_WIN_DECLSPEC_FUC
  220. #define MGE_WIN_DECLSPEC_DATA __declspec(dllimport)
  221. #endif
  222. #else
  223. #define MGE_WIN_DECLSPEC_FUC
  224. #define MGE_WIN_DECLSPEC_DATA
  225. #endif
  226. #endif // _HEADER_MGB_BUILD_CONFIG