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

5 6 7 8
if(WITH_GPU)
  proto_library(external_error_proto SRCS external_error.proto)
endif()

9 10 11 12 13
cc_library(
  flags
  SRCS flags.cc
  DEPS gflags)

14
cc_library(errors SRCS errors.cc)
15
set(phi_enforce_deps errors flags)
X
xiongkun 已提交
16
if(WITH_GPU)
17
  set(phi_enforce_deps ${phi_enforce_deps} external_error_proto)
X
xiongkun 已提交
18
endif()
19 20 21 22
cc_library(
  phi_enforce
  SRCS enforce.cc
  DEPS ${phi_enforce_deps})
23

24 25 26 27 28
cc_library(
  phi_os_info
  SRCS os_info.cc
  DEPS phi_enforce)

29 30 31 32
if(WITH_XPU)
  cc_library(
    kernel_factory
    SRCS kernel_factory.cc
33
    DEPS phi_enforce convert_utils phi_backends)
34 35 36 37
else()
  cc_library(
    kernel_factory
    SRCS kernel_factory.cc
38
    DEPS phi_enforce convert_utils)
39
endif()
40 41 42
cc_library(
  kernel_context
  SRCS kernel_context.cc
43
  DEPS phi_enforce phi_backends)
44

45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
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)
61 62 63 64
cc_library(
  threadpool
  SRCS threadpool.cc
  DEPS phi_enforce)
65

66 67 68
cc_library(
  dense_tensor
  SRCS dense_tensor.cc dense_tensor_impl.cc
69
  DEPS convert_utils tensor_meta tensor_base ddim)
70

71
target_link_libraries(dense_tensor memory_utils)
72

73 74 75 76 77 78 79 80 81 82 83 84
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)
85

86 87 88 89 90
cc_library(
  tensor_array
  SRCS tensor_array.cc
  DEPS dense_tensor tensor_base)

91 92 93 94 95
cc_library(
  extended_tensor
  SRCS extended_tensor.cc
  DEPS tensor_base)

96 97 98 99 100 101 102 103
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)
104

105 106 107
cc_library(
  selected_rows
  SRCS selected_rows_impl.cc selected_rows.cc
108
  DEPS tensor_base dense_tensor phi_enforce ddim)
109 110 111 112
cc_library(
  phi_device_context
  SRCS device_context.cc
  DEPS dense_tensor selected_rows)
113

114 115 116 117
cc_library(
  custom_kernel
  SRCS custom_kernel.cc
  DEPS kernel_factory)
118

H
Huang Jiyi 已提交
119 120 121
cc_library(
  mixed_vector
  SRCS mixed_vector.cc
122
  DEPS phi_backends place memory)
H
Huang Jiyi 已提交
123

124 125 126 127 128
cc_library(
  generator
  SRCS generator.cc
  DEPS enforce place)

129 130
# Will remove once we implemented MKLDNN_Tensor
if(WITH_MKLDNN)
131 132
  add_dependencies(dense_tensor mkldnn)
  add_dependencies(tensor_base mkldnn)
133
endif()
134 135 136 137 138

if(WITH_GPU)
  nv_library(
    phi_tensor_utils
    SRCS tensor_utils.cc
139
    DEPS phi_backends dense_tensor selected_rows memcpy memory_utils)
140 141 142 143
elseif(WITH_ROCM)
  hip_library(
    phi_tensor_utils
    SRCS tensor_utils.cc
144
    DEPS phi_backends dense_tensor selected_rows memcpy memory_utils)
145 146 147 148
elseif(WITH_XPU_KP)
  xpu_library(
    phi_tensor_utils
    SRCS tensor_utils.cc
149
    DEPS phi_backends dense_tensor selected_rows memcpy memory_utils)
150 151 152 153
else()
  cc_library(
    phi_tensor_utils
    SRCS tensor_utils.cc
154
    DEPS dense_tensor selected_rows memcpy phi_backends memory_utils)
155
endif()