File: CMakeLists.txt

package info (click to toggle)
pytorch 2.6.0%2Bdfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 161,672 kB
  • sloc: python: 1,278,832; cpp: 900,322; ansic: 82,710; asm: 7,754; java: 3,363; sh: 2,811; javascript: 2,443; makefile: 597; ruby: 195; xml: 84; objc: 68
file content (83 lines) | stat: -rw-r--r-- 3,303 bytes parent folder | download | duplicates (3)
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
set(TENSOREXPR_TEST_ROOT ${TORCH_ROOT}/test/cpp/tensorexpr)

set(TENSOREXPR_TEST_SRCS
  ${TENSOREXPR_TEST_ROOT}/test_approx.cpp
  ${TENSOREXPR_TEST_ROOT}/test_aten.cpp
  ${TENSOREXPR_TEST_ROOT}/test_boundsinference.cpp
  ${TENSOREXPR_TEST_ROOT}/test_conv.cpp
  ${TENSOREXPR_TEST_ROOT}/test_cpp_codegen.cpp
  ${TENSOREXPR_TEST_ROOT}/test_dynamic_shapes.cpp
  ${TENSOREXPR_TEST_ROOT}/test_expr.cpp
  ${TENSOREXPR_TEST_ROOT}/test_external_calls.cpp
  ${TENSOREXPR_TEST_ROOT}/test_graph_opt.cpp
  ${TENSOREXPR_TEST_ROOT}/test_ir_printer.cpp
  ${TENSOREXPR_TEST_ROOT}/test_ir_verifier.cpp
  ${TENSOREXPR_TEST_ROOT}/test_kernel.cpp
  ${TENSOREXPR_TEST_ROOT}/test_loopnest.cpp
  ${TENSOREXPR_TEST_ROOT}/test_memdependency.cpp
  ${TENSOREXPR_TEST_ROOT}/test_ops.cpp
  ${TENSOREXPR_TEST_ROOT}/test_quantization.cpp
  ${TENSOREXPR_TEST_ROOT}/test_memplanning.cpp
  ${TENSOREXPR_TEST_ROOT}/test_reductions.cpp
  ${TENSOREXPR_TEST_ROOT}/test_registerizer.cpp
  ${TENSOREXPR_TEST_ROOT}/test_simplify.cpp
  ${TENSOREXPR_TEST_ROOT}/test_te_fuser_pass.cpp
  ${TENSOREXPR_TEST_ROOT}/test_type.cpp
  ${TENSOREXPR_TEST_ROOT}/test_type_specializations.cpp
)

if(USE_CUDA)
  list(APPEND TENSOREXPR_TEST_SRCS ${TENSOREXPR_TEST_ROOT}/test_cuda.cpp)
endif()

if(USE_LLVM AND LLVM_FOUND)
  list(APPEND TENSOREXPR_TEST_SRCS ${TENSOREXPR_TEST_ROOT}/test_llvm.cpp)
endif()

add_executable(test_tensorexpr
  ${TORCH_ROOT}/test/cpp/common/main.cpp
  ${TENSOREXPR_TEST_ROOT}/padded_buffer.cpp
  ${TENSOREXPR_TEST_SRCS})

target_link_libraries(test_tensorexpr PRIVATE torch gtest)
target_include_directories(test_tensorexpr PRIVATE ${ATen_CPU_INCLUDE})
target_compile_definitions(test_tensorexpr PRIVATE USE_GTEST)

add_executable(tutorial_tensorexpr ${TENSOREXPR_TEST_ROOT}/tutorial.cpp)
target_link_libraries(tutorial_tensorexpr PRIVATE torch)
target_include_directories(tutorial_tensorexpr PRIVATE ${ATen_CPU_INCLUDE})

# The test case depends on the xnnpack header which in turn depends on the
# pthreadpool header. For some build environment we need add the dependency
# explicitly.
if(USE_PTHREADPOOL)
  target_link_libraries(test_tensorexpr PRIVATE pthreadpool)
endif()
if(USE_CUDA)
  target_compile_definitions(test_tensorexpr PRIVATE USE_CUDA)
  target_compile_definitions(tutorial_tensorexpr PRIVATE USE_CUDA)
elseif(USE_ROCM)
  target_link_libraries(test_tensorexpr PRIVATE
    hiprtc::hiprtc
    hip::amdhip64
    ${TORCH_CUDA_LIBRARIES})
  target_compile_definitions(test_tensorexpr PRIVATE USE_ROCM)

  target_link_libraries(tutorial_tensorexpr PRIVATE
    hiprtc::hiprtc
    hip::amdhip64
    ${TORCH_CUDA_LIBRARIES})
  target_compile_definitions(tutorial_tensorexpr PRIVATE USE_ROCM)
endif()

if(INSTALL_TEST)
  set_target_properties(test_tensorexpr PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${_rpath_portable_origin}/../lib")
  install(TARGETS test_tensorexpr DESTINATION bin)
  set_target_properties(tutorial_tensorexpr PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${_rpath_portable_origin}/../lib")
  install(TARGETS tutorial_tensorexpr DESTINATION bin)
  # Install PDB files for MSVC builds
  if(MSVC AND BUILD_SHARED_LIBS)
    install(FILES $<TARGET_PDB_FILE:test_tensorexpr> DESTINATION bin OPTIONAL)
    install(FILES $<TARGET_PDB_FILE:tutorial_tensorexpr> DESTINATION bin OPTIONAL)
  endif()
endif()