CMakeLists.txt 2.5 KB
Newer Older
1
# compatible utils used for fluid op system
2 3
add_subdirectory(compat)

4
cc_library(errors SRCS errors.cc)
5
set(phi_enforce_deps errors flags)
X
xiongkun 已提交
6
if(WITH_GPU)
7
  set(phi_enforce_deps ${phi_enforce_deps} external_error_proto)
X
xiongkun 已提交
8
endif()
9 10 11 12
cc_library(
  phi_enforce
  SRCS enforce.cc
  DEPS ${phi_enforce_deps})
13

14 15 16 17 18 19 20 21
cc_library(
  kernel_factory
  SRCS kernel_factory.cc
  DEPS phi_enforce fluid_convert_utils)
cc_library(
  kernel_context
  SRCS kernel_context.cc
  DEPS phi_enforce phi_context)
22

23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
cc_library(
  ddim
  SRCS ddim.cc
  DEPS phi_enforce)
cc_library(
  tensor_base
  SRCS tensor_base.cc allocator.cc
  DEPS phi_enforce)
cc_library(
  tensor_meta
  SRCS tensor_meta.cc
  DEPS phi_enforce)
cc_library(
  lod_utils
  SRCS lod_utils.cc
  DEPS phi_enforce)
39

40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
cc_library(
  dense_tensor
  SRCS dense_tensor.cc dense_tensor_impl.cc
  DEPS convert_utils fluid_convert_utils tensor_meta tensor_base)
cc_library(
  sparse_coo_tensor
  SRCS sparse_coo_tensor.cc
  DEPS tensor_meta tensor_base)
cc_library(
  sparse_csr_tensor
  SRCS sparse_csr_tensor.cc
  DEPS dense_tensor tensor_base)
cc_library(
  string_tensor
  SRCS string_tensor.cc
  DEPS convert_utils tensor_meta tensor_base)
56

57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
cc_library(
  meta_tensor
  SRCS meta_tensor.cc
  DEPS tensor_base tensor_meta dense_tensor)
cc_library(
  infermeta_utils
  SRCS infermeta_utils.cc
  DEPS meta_tensor)
cc_library(
  selected_rows
  SRCS selected_rows_impl.cc selected_rows.cc
  DEPS tensor_base dense_tensor phi_enforce ddim memcpy)
cc_library(
  phi_device_context
  SRCS device_context.cc
  DEPS dense_tensor selected_rows)
73

74 75 76 77
cc_library(
  custom_kernel
  SRCS custom_kernel.cc
  DEPS kernel_factory)
78

79 80
# Will remove once we implemented MKLDNN_Tensor
if(WITH_MKLDNN)
81 82
  add_dependencies(dense_tensor mkldnn)
  add_dependencies(tensor_base mkldnn)
83
endif()
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123

if(WITH_GPU)
  nv_library(
    phi_tensor_utils
    SRCS tensor_utils.cc
    DEPS cpu_context
         gpu_context
         dense_tensor
         selected_rows
         malloc
         memcpy
         device_context)
elseif(WITH_ROCM)
  hip_library(
    phi_tensor_utils
    SRCS tensor_utils.cc
    DEPS cpu_context
         gpu_context
         dense_tensor
         selected_rows
         malloc
         memcpy
         device_context)
elseif(WITH_XPU_KP)
  xpu_library(
    phi_tensor_utils
    SRCS tensor_utils.cc
    DEPS cpu_context
         xpu_context
         dense_tensor
         selected_rows
         malloc
         memcpy
         device_context)
else()
  cc_library(
    phi_tensor_utils
    SRCS tensor_utils.cc
    DEPS cpu_context dense_tensor selected_rows malloc memcpy device_context)
endif()