summaryrefslogtreecommitdiff
path: root/caffe2/utils/CMakeLists.txt
blob: 2925f4145b0e3261515a794533822b0db6587823 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# TODO: Add ThreadPoolXNNPACK.cc when XNNPACK integration is updated
# to pass the actual threadpool ptr instead of nullptr.
if(INTERN_BUILD_MOBILE AND NOT BUILD_CAFFE2_MOBILE)
  add_definitions(-DUSE_INTERNAL_THREADPOOL_IMPL)
  list(APPEND Caffe2_CPU_SRCS
    utils/string_utils.cc
    utils/threadpool/pthreadpool.cc
    utils/threadpool/pthreadpool_impl.cc
    utils/threadpool/pthreadpool_new_if_impl.c
    utils/threadpool/ThreadPool.cc
    utils/threadpool/ThreadPoolMobile.cc
    utils/threadpool/ThreadPoolXNNPACK.cc
  )
  set(Caffe2_CPU_SRCS ${Caffe2_CPU_SRCS} PARENT_SCOPE)
  return()
endif()

list(APPEND Caffe2_CPU_SRCS
  utils/bench_utils.cc
  utils/cpuid.cc
  utils/math/broadcast.cc
  utils/math/elementwise.cc
  utils/math/reduce.cc
  utils/math/transpose.cc
  utils/math/utils.cc
  utils/math_cpu.cc
  utils/murmur_hash3.cc
  utils/proto_convert.cc
  utils/proto_utils.cc
  utils/proto_wrap.cc
  utils/signal_handler.cc
  utils/smart_tensor_printer.cc
  utils/string_utils.cc
  utils/threadpool/ThreadPool.cc)

# ---[ threadpool/pthreadpool* is a local modification of the NNPACK
# pthreadpool with a very similar interface. Neither NNPACK, nor this
# thread pool supports Windows.
if(NOT MSVC AND USE_XNNPACK)
  add_definitions(-DUSE_INTERNAL_THREADPOOL_IMPL)
  set(Caffe2_CPU_SRCS ${Caffe2_CPU_SRCS}
          utils/threadpool/pthreadpool.cc
          utils/threadpool/pthreadpool_impl.cc
          utils/threadpool/pthreadpool_new_if_impl.c
          utils/threadpool/ThreadPoolMobile.cc
          utils/threadpool/ThreadPoolXNNPACK.cc
          )
endif()

set(Caffe2_GPU_SRCS ${Caffe2_GPU_SRCS}
        utils/math/broadcast.cu
        utils/math/elementwise.cu
        utils/math/reduce.cu
        utils/math/transpose.cu
        utils/math_gpu.cu
        )

set(Caffe2_HIP_SRCS ${Caffe2_HIP_SRCS}
        utils/math/hip/broadcast.hip
        utils/math/hip/elementwise.hip
        utils/math/hip/reduce.hip
        utils/math/hip/transpose.hip
        utils/hip/math_gpu.hip
        )

set(Caffe2_CPU_TEST_SRCS ${Caffe2_CPU_TEST_SRCS}
        utils/fixed_divisor_test.cc
        utils/math_test.cc
        utils/fatal_signal_asan_no_sig_test.cc
        utils/simple_queue_test.cc
        utils/proto_utils_test.cc
        utils/cpuid_test.cc
        utils/smart_tensor_printer_test.cc
        utils/cast_test.cc
        )

set(Caffe2_GPU_TEST_SRCS ${Caffe2_GPU_TEST_SRCS}
        utils/math_gpu_test.cc
        )

set(Caffe2_HIP_TEST_SRCS ${Caffe2_HIP_TEST_SRCS}
        utils/hip/math_gpu_test.cc
        utils/hip/math_blas_gpu_test.cc
        )

# TODO Once all source files are defined inside the local c10_utils_xxx targets,
# it should be the job of the parent CMakeLists.txt to decide what to do with the target (i.e. link it to caffe2)
# instead of us locally adding it to Caffe2_xxx variables.
set(Caffe2_CPU_SRCS ${Caffe2_CPU_SRCS} PARENT_SCOPE)
set(Caffe2_GPU_SRCS ${Caffe2_GPU_SRCS} PARENT_SCOPE)
set(Caffe2_HIP_SRCS ${Caffe2_HIP_SRCS} PARENT_SCOPE)
set(Caffe2_CPU_TEST_SRCS ${Caffe2_CPU_TEST_SRCS} PARENT_SCOPE)
set(Caffe2_GPU_TEST_SRCS ${Caffe2_GPU_TEST_SRCS} PARENT_SCOPE)
set(Caffe2_HIP_TEST_SRCS ${Caffe2_HIP_TEST_SRCS} PARENT_SCOPE)