medmekk HF Staff commited on
Commit
f6342f5
·
verified ·
1 Parent(s): d5e710f

Delete CMakeLists.txt

Browse files
Files changed (1) hide show
  1. CMakeLists.txt +0 -157
CMakeLists.txt DELETED
@@ -1,157 +0,0 @@
1
- cmake_minimum_required(VERSION 3.26)
2
- project(gemm LANGUAGES CXX)
3
-
4
- set(TARGET_DEVICE "cuda" CACHE STRING "Target device backend for kernel")
5
-
6
- install(CODE "set(CMAKE_INSTALL_LOCAL_ONLY TRUE)" ALL_COMPONENTS)
7
-
8
- include(FetchContent)
9
- file(MAKE_DIRECTORY ${FETCHCONTENT_BASE_DIR}) # Ensure the directory exists
10
- message(STATUS "FetchContent base directory: ${FETCHCONTENT_BASE_DIR}")
11
-
12
- set(CUDA_SUPPORTED_ARCHS "7.0;7.2;7.5;8.0;8.6;8.7;8.9;9.0;10.0;10.1;12.0")
13
-
14
- set(HIP_SUPPORTED_ARCHS "gfx942")
15
-
16
- include(${CMAKE_CURRENT_LIST_DIR}/cmake/utils.cmake)
17
-
18
- if(DEFINED Python_EXECUTABLE)
19
- # Allow passing through the interpreter (e.g. from setup.py).
20
- find_package(Python COMPONENTS Development Development.SABIModule Interpreter)
21
- if (NOT Python_FOUND)
22
- message(FATAL_ERROR "Unable to find python matching: ${EXECUTABLE}.")
23
- endif()
24
- else()
25
- find_package(Python REQUIRED COMPONENTS Development Development.SABIModule Interpreter)
26
- endif()
27
-
28
- append_cmake_prefix_path("torch" "torch.utils.cmake_prefix_path")
29
-
30
- find_package(Torch REQUIRED)
31
-
32
- if (NOT TARGET_DEVICE STREQUAL "cuda" AND
33
- NOT TARGET_DEVICE STREQUAL "rocm")
34
- return()
35
- endif()
36
-
37
- if(DEFINED CMAKE_CUDA_COMPILER_VERSION AND
38
- CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.8)
39
- set(CUDA_DEFAULT_KERNEL_ARCHS "7.0;7.2;7.5;8.0;8.6;8.7;8.9;9.0;10.0;10.1;12.0+PTX")
40
- else()
41
- set(CUDA_DEFAULT_KERNEL_ARCHS "7.0;7.2;7.5;8.0;8.6;8.7;8.9;9.0+PTX")
42
- endif()
43
-
44
- if (NOT HIP_FOUND AND CUDA_FOUND)
45
- set(GPU_LANG "CUDA")
46
-
47
-
48
-
49
- elseif(HIP_FOUND)
50
- set(GPU_LANG "HIP")
51
-
52
- # Importing torch recognizes and sets up some HIP/ROCm configuration but does
53
- # not let cmake recognize .hip files. In order to get cmake to understand the
54
- # .hip extension automatically, HIP must be enabled explicitly.
55
- enable_language(HIP)
56
- else()
57
- message(FATAL_ERROR "Can't find CUDA or HIP installation.")
58
- endif()
59
-
60
-
61
- if(GPU_LANG STREQUAL "CUDA")
62
- clear_cuda_arches(CUDA_ARCH_FLAGS)
63
- extract_unique_cuda_archs_ascending(CUDA_ARCHS "${CUDA_ARCH_FLAGS}")
64
- message(STATUS "CUDA target architectures: ${CUDA_ARCHS}")
65
- # Filter the target architectures by the supported supported archs
66
- # since for some files we will build for all CUDA_ARCHS.
67
- cuda_archs_loose_intersection(CUDA_ARCHS "${CUDA_SUPPORTED_ARCHS}" "${CUDA_ARCHS}")
68
- message(STATUS "CUDA supported target architectures: ${CUDA_ARCHS}")
69
-
70
- if(NVCC_THREADS AND GPU_LANG STREQUAL "CUDA")
71
- list(APPEND GPU_FLAGS "--threads=${NVCC_THREADS}")
72
- endif()
73
-
74
- add_compile_definitions(CUDA_KERNEL)
75
- elseif(GPU_LANG STREQUAL "HIP")
76
- override_gpu_arches(GPU_ARCHES HIP ${HIP_SUPPORTED_ARCHS})
77
- set(ROCM_ARCHS ${GPU_ARCHES})
78
- message(STATUS "ROCM supported target architectures: ${ROCM_ARCHS}")
79
-
80
- add_compile_definitions(ROCM_KERNEL)
81
- else()
82
- override_gpu_arches(GPU_ARCHES
83
- ${GPU_LANG}
84
- "${${GPU_LANG}_SUPPORTED_ARCHS}")
85
- endif()
86
-
87
- get_torch_gpu_compiler_flags(TORCH_GPU_FLAGS ${GPU_LANG})
88
- list(APPEND GPU_FLAGS ${TORCH_GPU_FLAGS})
89
-
90
- set(TORCH_gemm_SRC
91
- torch-ext/torch_binding.cpp torch-ext/torch_binding.h
92
- )
93
-
94
-
95
- list(APPEND SRC "${TORCH_gemm_SRC}")
96
-
97
-
98
- set(gemm_SRC
99
- "include/clangd_workaround.h"
100
- "include/gpu_libs.h"
101
- "include/gpu_types.h"
102
- "include/timer.h"
103
- "gemm/gemm_kernel.h"
104
- "gemm/gemm_kernel_legacy.h"
105
- "gemm/gemm_launcher.hip"
106
- "gemm/transpose_kernel.h"
107
- "src/utils/arithmetic.h"
108
- "tests/checker/metrics.h"
109
- )
110
-
111
- # TODO: check if CLion support this:
112
- # https://youtrack.jetbrains.com/issue/CPP-16510/CLion-does-not-handle-per-file-include-directories
113
- set_source_files_properties(
114
- ${gemm_SRC}
115
- PROPERTIES INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/include")
116
-
117
- if(GPU_LANG STREQUAL "CUDA")
118
- cuda_archs_loose_intersection(gemm_ARCHS "${CUDA_DEFAULT_KERNEL_ARCHS}" "${CUDA_ARCHS}")
119
- message(STATUS "Capabilities for kernel gemm: ${gemm_ARCHS}")
120
- set_gencode_flags_for_srcs(SRCS "${gemm_SRC}" CUDA_ARCHS "${gemm_ARCHS}")
121
-
122
-
123
-
124
- list(APPEND SRC "${gemm_SRC}")
125
- elseif(GPU_LANG STREQUAL "HIP")
126
- hip_archs_loose_intersection(gemm_ARCHS "gfx942" "${ROCM_ARCHS}")
127
- message(STATUS "Archs for kernel gemm: ${gemm_ARCHS}")
128
-
129
- foreach(_KERNEL_SRC ${gemm_SRC})
130
- if(_KERNEL_SRC MATCHES ".*\\.hip$")
131
- foreach(_ROCM_ARCH ${gemm_ARCHS})
132
- set_property(
133
- SOURCE ${_KERNEL_SRC}
134
- APPEND PROPERTY
135
- COMPILE_OPTIONS "$<$<COMPILE_LANGUAGE:HIP>:--offload-arch=${_ROCM_ARCH}>"
136
- )
137
- endforeach()
138
- endif()
139
- endforeach()
140
-
141
- list(APPEND SRC "${gemm_SRC}")
142
- endif()
143
-
144
-
145
- define_gpu_extension_target(
146
- _gemm_926a158_dirty
147
- DESTINATION _gemm_926a158_dirty
148
- LANGUAGE ${GPU_LANG}
149
- SOURCES ${SRC}
150
- COMPILE_FLAGS ${GPU_FLAGS}
151
- ARCHITECTURES ${GPU_ARCHES}
152
- #INCLUDE_DIRECTORIES ${CUTLASS_INCLUDE_DIR}
153
- USE_SABI 3
154
- WITH_SOABI)
155
-
156
- target_link_options(_gemm_926a158_dirty PRIVATE -static-libstdc++)
157
-