CMakeLists.txt 1.5 KB
Newer Older
1 2 3 4
set(kernel_declare_file ${PADDLE_BINARY_DIR}/paddle/pten/kernels/declarations.h.tmp CACHE INTERNAL "declarations.h file")
set(kernel_declare_file_final ${PADDLE_BINARY_DIR}/paddle/pten/kernels/declarations.h)
file(WRITE ${kernel_declare_file} "// Generated by the paddle/pten/kernels/CMakeLists.txt.  DO NOT EDIT!\n\n#pragma once\n\n")

C
Chen Weihang 已提交
5 6
# kernel primitive api
add_subdirectory(primitive)
C
Chen Weihang 已提交
7 8
# pten functors and functions called by kernels
add_subdirectory(funcs)
C
Chen Weihang 已提交
9

10 11
add_subdirectory(cpu)
if(WITH_GPU OR WITH_ROCM)
12
  add_subdirectory(gpu)
13 14
endif()
if(WITH_MKLDNN)
C
Chen Weihang 已提交
15 16
  # mkldnn will be deprecated and use the new name dnnl
  add_subdirectory(dnnl)
17 18 19 20
endif()
if(WITH_XPU)
  add_subdirectory(xpu)
endif()
21

22 23 24
# pten depends all pten kernel targets
set_property(GLOBAL PROPERTY PTEN_KERNELS "")

25
set(COMMON_KERNEL_DEPS dense_tensor kernel_context kernel_factory arg_map_context convert_utils lod_utils)
26
set(COMMON_KERNEL_DEPS ${COMMON_KERNEL_DEPS} eigen_function blas)
27 28
# remove this dep after removing fluid deps on tensor creation
set(COMMON_KERNEL_DEPS ${COMMON_KERNEL_DEPS} pten_api_utils)
C
Chen Weihang 已提交
29
set(COMMON_KERNEL_DEPS ${COMMON_KERNEL_DEPS} infermeta)
30

31 32 33 34 35
set(MATH_KERNEL_DEPS ${COMMON_KERNEL_DEPS} cast_kernel copy_kernel pten_transpose_cpu)
if(WITH_GPU OR WITH_ROCM)
  set(MATH_KERNEL_DEPS ${MATH_KERNEL_DEPS} pten_transpose_gpu)
endif()

36
# auto build kernel targets by cmake
37 38
register_kernels(EXCLUDES math_kernel DEPS ${COMMON_KERNEL_DEPS})
kernel_library(math_kernel DEPS ${MATH_KERNEL_DEPS})
39 40

copy_if_different(${kernel_declare_file} ${kernel_declare_file_final})