CMakeLists.txt 1.7 KB
Newer Older
1 2
set(jit_file ${PADDLE_BINARY_DIR}/paddle/fluid/operators/jit/kernels.h.tmp)
set(jit_file_final ${PADDLE_BINARY_DIR}/paddle/fluid/operators/jit/kernels.h)
3 4 5 6
file(
  WRITE ${jit_file}
  "// Generated by the paddle/fluid/operators/jit/CMakeLists.txt.  DO NOT EDIT!\n\n"
)
T
tensor-tang 已提交
7 8
file(APPEND ${jit_file} "\#pragma once\n")
file(APPEND ${jit_file} "\#include \"paddle/fluid/operators/jit/helper.h\"\n")
9 10
file(APPEND ${jit_file}
     "\#include \"paddle/fluid/operators/jit/registry.h\"\n\n")
T
tensor-tang 已提交
11

12
set(JIT_KERNEL_DEPS device_context cblas gflags enforce place xxhash)
T
tensor-tang 已提交
13

14 15 16 17
file(
  GLOB jit_kernel_cc_srcs
  RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
  "*.cc")
T
tensor-tang 已提交
18
list(REMOVE_ITEM jit_kernel_cc_srcs test.cc benchmark.cc)
19 20 21 22
cc_library(
  jit_kernel_base
  SRCS ${jit_kernel_cc_srcs}
  DEPS ${JIT_KERNEL_DEPS})
T
tensor-tang 已提交
23

24
copy_if_different(${jit_file} ${jit_file_final})
25

T
tensor-tang 已提交
26
# refer must go first
T
tensor-tang 已提交
27
add_subdirectory(refer)
T
tensor-tang 已提交
28
add_subdirectory(more)
T
tensor-tang 已提交
29
if(WITH_XBYAK)
30
  add_subdirectory(gen)
T
tensor-tang 已提交
31 32
endif()

33 34 35 36 37 38 39 40
cc_library(
  jit_kernel_helper INTERFACE
  SRCS ${jit_kernel_cc_srcs}
  DEPS jit_kernel_base ${JIT_KERNEL_DEPS})
cc_test(
  jit_kernel_test
  SRCS test.cc
  DEPS jit_kernel_helper)
41
if(NOT WIN32)
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
  set(cuda_less12_and_gcc_greater12 false)
  if(DEFINED CMAKE_CUDA_COMPILER_VERSION)
    if(${CMAKE_CUDA_COMPILER_VERSION} LESS 12.0
       AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER 12.0)
      set(cuda_less12_and_gcc_greater12 true)
    endif()
  endif()
  if(NOT cuda_less12_and_gcc_greater12)
    cc_binary(
      jit_kernel_benchmark
      SRCS
      benchmark.cc
      DEPS
      jit_kernel_helper
      device_tracer
      tensor)
  endif()
59
endif()
60
if(WITH_TESTING AND TEST jit_kernel_test)
61
  set_tests_properties(jit_kernel_test PROPERTIES TIMEOUT 120)
Y
YUNSHEN XIE 已提交
62
endif()