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.

cmake.patch 8.9 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. diff -Npur tvm/cmake/modules/ANTLR.cmake tvm_new/cmake/modules/ANTLR.cmake
  2. --- tvm/cmake/modules/ANTLR.cmake 2019-12-14 15:11:37.562418441 +0800
  3. +++ tvm_new/cmake/modules/ANTLR.cmake 2019-12-14 11:28:49.161977599 +0800
  4. @@ -14,12 +14,15 @@
  5. # KIND, either express or implied. See the License for the
  6. # specific language governing permissions and limitations
  7. # under the License.
  8. +
  9. +# 2019.12.30 - Modify current directory of tvm.
  10. +
  11. if(USE_ANTLR)
  12. find_antlr(${USE_ANTLR})
  13. if(ANTLR4)
  14. set(RELAY_PARSER_DIR
  15. - ${CMAKE_CURRENT_SOURCE_DIR}/python/tvm/relay/grammar)
  16. + ${TVM_DIR}/python/tvm/relay/grammar)
  17. set(RELAY_PARSER
  18. ${RELAY_PARSER_DIR}/py3/RelayVisitor.py
  19. diff -Npur tvm/cmake/modules/CUDA.cmake tvm_new/cmake/modules/CUDA.cmake
  20. --- tvm/cmake/modules/CUDA.cmake 2019-12-14 15:11:37.562418441 +0800
  21. +++ tvm_new/cmake/modules/CUDA.cmake 2019-12-14 11:28:49.161977599 +0800
  22. @@ -15,6 +15,8 @@
  23. # specific language governing permissions and limitations
  24. # under the License.
  25. +# 2019.12.30 - Modify current directory of tvm.
  26. +
  27. # CUDA Module
  28. find_cuda(${USE_CUDA})
  29. @@ -29,9 +31,9 @@ if(USE_CUDA)
  30. message(FATAL_ERROR "Cannot find CUDA, USE_CUDA=" ${USE_CUDA})
  31. endif()
  32. message(STATUS "Build with CUDA support")
  33. - file(GLOB RUNTIME_CUDA_SRCS src/runtime/cuda/*.cc)
  34. + file(GLOB RUNTIME_CUDA_SRCS ${TVM_DIR}/src/runtime/cuda/*.cc)
  35. list(APPEND RUNTIME_SRCS ${RUNTIME_CUDA_SRCS})
  36. - list(APPEND COMPILER_SRCS src/codegen/opt/build_cuda_on.cc)
  37. + list(APPEND COMPILER_SRCS ${TVM_DIR}/src/codegen/opt/build_cuda_on.cc)
  38. list(APPEND TVM_LINKER_LIBS ${CUDA_NVRTC_LIBRARY})
  39. list(APPEND TVM_RUNTIME_LINKER_LIBS ${CUDA_CUDART_LIBRARY})
  40. @@ -40,18 +42,18 @@ if(USE_CUDA)
  41. if(USE_CUDNN)
  42. message(STATUS "Build with cuDNN support")
  43. - file(GLOB CONTRIB_CUDNN_SRCS src/runtime/contrib/cudnn/*.cc)
  44. + file(GLOB CONTRIB_CUDNN_SRCS ${TVM_DIR}/src/runtime/contrib/cudnn/*.cc)
  45. list(APPEND RUNTIME_SRCS ${CONTRIB_CUDNN_SRCS})
  46. list(APPEND TVM_RUNTIME_LINKER_LIBS ${CUDA_CUDNN_LIBRARY})
  47. endif(USE_CUDNN)
  48. if(USE_CUBLAS)
  49. message(STATUS "Build with cuBLAS support")
  50. - file(GLOB CONTRIB_CUBLAS_SRCS src/runtime/contrib/cublas/*.cc)
  51. + file(GLOB CONTRIB_CUBLAS_SRCS ${TVM_DIR}/src/runtime/contrib/cublas/*.cc)
  52. list(APPEND RUNTIME_SRCS ${CONTRIB_CUBLAS_SRCS})
  53. list(APPEND TVM_RUNTIME_LINKER_LIBS ${CUDA_CUBLAS_LIBRARY})
  54. endif(USE_CUBLAS)
  55. else(USE_CUDA)
  56. - list(APPEND COMPILER_SRCS src/codegen/opt/build_cuda_off.cc)
  57. + list(APPEND COMPILER_SRCS ${TVM_DIR}/src/codegen/opt/build_cuda_off.cc)
  58. endif(USE_CUDA)
  59. diff -Npur tvm/cmake/modules/LLVM.cmake tvm_new/cmake/modules/LLVM.cmake
  60. --- tvm/cmake/modules/LLVM.cmake 2019-12-14 15:11:37.562418441 +0800
  61. +++ tvm_new/cmake/modules/LLVM.cmake 2019-12-14 11:28:49.161977599 +0800
  62. @@ -15,6 +15,8 @@
  63. # specific language governing permissions and limitations
  64. # under the License.
  65. +# 2019.12.30 - Modify current directory of tvm.
  66. +
  67. # LLVM rules
  68. add_definitions(-DDMLC_USE_FOPEN64=0)
  69. @@ -26,7 +28,7 @@ if(NOT USE_LLVM STREQUAL "OFF")
  70. message(STATUS "Set TVM_LLVM_VERSION=" ${TVM_LLVM_VERSION})
  71. # Set flags that are only needed for LLVM target
  72. add_definitions(-DTVM_LLVM_VERSION=${TVM_LLVM_VERSION})
  73. - file(GLOB COMPILER_LLVM_SRCS src/codegen/llvm/*.cc)
  74. + file(GLOB COMPILER_LLVM_SRCS ${TVM_DIR}/src/codegen/llvm/*.cc)
  75. list(APPEND TVM_LINKER_LIBS ${LLVM_LIBS})
  76. list(APPEND COMPILER_SRCS ${COMPILER_LLVM_SRCS})
  77. if(NOT MSVC)
  78. diff -Npur tvm/cmake/modules/Micro.cmake tvm_new/cmake/modules/Micro.cmake
  79. --- tvm/cmake/modules/Micro.cmake 2019-12-14 15:11:37.562418441 +0800
  80. +++ tvm_new/cmake/modules/Micro.cmake 2019-12-14 11:28:49.161977599 +0800
  81. @@ -15,8 +15,10 @@
  82. # specific language governing permissions and limitations
  83. # under the License.
  84. +# 2019.12.30 - Modify current directory of tvm.
  85. +
  86. if(USE_MICRO)
  87. message(STATUS "Build with Micro support")
  88. - file(GLOB RUNTIME_MICRO_SRCS src/runtime/micro/*.cc)
  89. + file(GLOB RUNTIME_MICRO_SRCS ${TVM_DIR}/src/runtime/micro/*.cc)
  90. list(APPEND RUNTIME_SRCS ${RUNTIME_MICRO_SRCS})
  91. endif(USE_MICRO)
  92. diff -Npur tvm/cmake/modules/VTA.cmake tvm_new/cmake/modules/VTA.cmake
  93. --- tvm/cmake/modules/VTA.cmake 2019-12-14 15:11:37.562418441 +0800
  94. +++ tvm_new/cmake/modules/VTA.cmake 2019-12-14 14:42:32.358381133 +0800
  95. @@ -15,17 +15,19 @@
  96. # specific language governing permissions and limitations
  97. # under the License.
  98. +# 2019.12.30 - Modify current directory of tvm.
  99. +
  100. # CMake Build rules for VTA
  101. find_program(PYTHON NAMES python python3 python3.6)
  102. if(MSVC)
  103. message(STATUS "VTA build is skipped in Windows..")
  104. elseif(PYTHON)
  105. - set(VTA_CONFIG ${PYTHON} ${CMAKE_CURRENT_SOURCE_DIR}/vta/config/vta_config.py)
  106. + set(VTA_CONFIG ${PYTHON} ${TVM_DIR}/vta/config/vta_config.py)
  107. if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/vta_config.json)
  108. message(STATUS "Use VTA config " ${CMAKE_CURRENT_BINARY_DIR}/vta_config.json)
  109. - set(VTA_CONFIG ${PYTHON} ${CMAKE_CURRENT_SOURCE_DIR}/vta/config/vta_config.py
  110. + set(VTA_CONFIG ${PYTHON} ${TVM_DIR}/vta/config/vta_config.py
  111. --use-cfg=${CMAKE_CURRENT_BINARY_DIR}/vta_config.json)
  112. endif()
  113. @@ -40,18 +42,18 @@ elseif(PYTHON)
  114. # Fast simulator driver build
  115. if(USE_VTA_FSIM)
  116. # Add fsim driver sources
  117. - file(GLOB FSIM_RUNTIME_SRCS vta/src/*.cc)
  118. - list(APPEND FSIM_RUNTIME_SRCS vta/src/sim/sim_driver.cc)
  119. - list(APPEND FSIM_RUNTIME_SRCS vta/src/vmem/virtual_memory.cc vta/src/vmem/virtual_memory.h)
  120. - list(APPEND FSIM_RUNTIME_SRCS vta/src/sim/sim_tlpp.cc)
  121. + file(GLOB FSIM_RUNTIME_SRCS ${TVM_DIR}/vta/src/*.cc)
  122. + list(APPEND FSIM_RUNTIME_SRCS ${TVM_DIR}/vta/src/sim/sim_driver.cc)
  123. + list(APPEND FSIM_RUNTIME_SRCS ${TVM_DIR}/vta/src/vmem/virtual_memory.cc ${TVM_DIR}/vta/src/vmem/virtual_memory.h)
  124. + list(APPEND FSIM_RUNTIME_SRCS ${TVM_DIR}/vta/src/sim/sim_tlpp.cc)
  125. # Target lib: vta_fsim
  126. add_library(vta_fsim SHARED ${FSIM_RUNTIME_SRCS})
  127. - target_include_directories(vta_fsim PUBLIC vta/include)
  128. + target_include_directories(vta_fsim PUBLIC ${TVM_DIR}/vta/include)
  129. foreach(__def ${VTA_DEFINITIONS})
  130. string(SUBSTRING ${__def} 3 -1 __strip_def)
  131. target_compile_definitions(vta_fsim PUBLIC ${__strip_def})
  132. endforeach()
  133. - include_directories("vta/include")
  134. + include_directories("${TVM_DIR}/vta/include")
  135. if(APPLE)
  136. set_target_properties(vta_fsim PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
  137. endif(APPLE)
  138. @@ -61,18 +63,18 @@ elseif(PYTHON)
  139. # Cycle accurate simulator driver build
  140. if(USE_VTA_TSIM)
  141. # Add tsim driver sources
  142. - file(GLOB TSIM_RUNTIME_SRCS vta/src/*.cc)
  143. - list(APPEND TSIM_RUNTIME_SRCS vta/src/tsim/tsim_driver.cc)
  144. - list(APPEND TSIM_RUNTIME_SRCS vta/src/dpi/module.cc)
  145. - list(APPEND TSIM_RUNTIME_SRCS vta/src/vmem/virtual_memory.cc vta/src/vmem/virtual_memory.h)
  146. + file(GLOB TSIM_RUNTIME_SRCS ${TVM_DIR}/vta/src/*.cc)
  147. + list(APPEND TSIM_RUNTIME_SRCS ${TVM_DIR}/vta/src/tsim/tsim_driver.cc)
  148. + list(APPEND TSIM_RUNTIME_SRCS ${TVM_DIR}/vta/src/dpi/module.cc)
  149. + list(APPEND TSIM_RUNTIME_SRCS ${TVM_DIR}/vta/src/vmem/virtual_memory.cc ${TVM_DIR}/vta/src/vmem/virtual_memory.h)
  150. # Target lib: vta_tsim
  151. add_library(vta_tsim SHARED ${TSIM_RUNTIME_SRCS})
  152. - target_include_directories(vta_tsim PUBLIC vta/include)
  153. + target_include_directories(vta_tsim PUBLIC ${TVM_DIR}/vta/include)
  154. foreach(__def ${VTA_DEFINITIONS})
  155. string(SUBSTRING ${__def} 3 -1 __strip_def)
  156. target_compile_definitions(vta_tsim PUBLIC ${__strip_def})
  157. endforeach()
  158. - include_directories("vta/include")
  159. + include_directories("${TVM_DIR}/vta/include")
  160. if(APPLE)
  161. set_target_properties(vta_tsim PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
  162. endif(APPLE)
  163. @@ -80,19 +82,19 @@ elseif(PYTHON)
  164. # VTA FPGA driver sources
  165. if(USE_VTA_FPGA)
  166. - file(GLOB FPGA_RUNTIME_SRCS vta/src/*.cc)
  167. + file(GLOB FPGA_RUNTIME_SRCS ${TVM_DIR}/vta/src/*.cc)
  168. # Rules for Zynq-class FPGAs with pynq OS support (see pynq.io)
  169. if(${VTA_TARGET} STREQUAL "pynq" OR
  170. ${VTA_TARGET} STREQUAL "ultra96")
  171. - list(APPEND FPGA_RUNTIME_SRCS vta/src/pynq/pynq_driver.cc)
  172. + list(APPEND FPGA_RUNTIME_SRCS ${TVM_DIR}/vta/src/pynq/pynq_driver.cc)
  173. # Rules for Pynq v2.4
  174. find_library(__cma_lib NAMES cma PATH /usr/lib)
  175. elseif(${VTA_TARGET} STREQUAL "de10nano") # DE10-Nano rules
  176. - file(GLOB FPGA_RUNTIME_SRCS vta/src/de10nano/*.cc vta/src/*.cc)
  177. + file(GLOB FPGA_RUNTIME_SRCS ${TVM_DIR}/vta/src/de10nano/*.cc ${TVM_DIR}/vta/src/*.cc)
  178. endif()
  179. # Target lib: vta
  180. add_library(vta SHARED ${FPGA_RUNTIME_SRCS})
  181. - target_include_directories(vta PUBLIC vta/include)
  182. + target_include_directories(vta PUBLIC ${TVM_DIR}/vta/include)
  183. foreach(__def ${VTA_DEFINITIONS})
  184. string(SUBSTRING ${__def} 3 -1 __strip_def)
  185. target_compile_definitions(vta PUBLIC ${__strip_def})