CMakeLists.txt 1.3 KB
Newer Older
1 2 3 4 5 6
include(pten_kernel)

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 已提交
7 8 9 10 11
# kernel primitive api
add_subdirectory(primitive)
# pten hybird functors and functions called by kernels
add_subdirectory(hybird)

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

27 28 29 30 31 32 33 34 35
# pten depends all pten kernel targets
set_property(GLOBAL PROPERTY PTEN_KERNELS "")

set(COMMON_KERNEL_DEPS dense_tensor kernel_context kernel_factory)
set(COMMON_KERNEL_DEPS ${COMMON_KERNEL_DEPS} eigen_function)

# auto build kernel targets by cmake
register_kernels(EXCLUDES flatten_kernel DEPS ${COMMON_KERNEL_DEPS})
# TODO(chenweihang): auto parse compile deps by include headers later
36
kernel_library(flatten_kernel DEPS ${COMMON_KERNEL_DEPS} copy_kernel unary)
37 38

copy_if_different(${kernel_declare_file} ${kernel_declare_file_final})