-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
68 lines (51 loc) · 1.71 KB
/
Copy pathCMakeLists.txt
File metadata and controls
68 lines (51 loc) · 1.71 KB
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
cmake_minimum_required(VERSION 3.18)
project(micro_kernel_generator LANGUAGES CXX CUDA)
# --------------------------------------------------
# Standards
# --------------------------------------------------
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CUDA_ARCHITECTURES 75)
find_package(CUDAToolkit REQUIRED)
# --------------------------------------------------
# Default Tunable Parameters
# (can override via -D in cmake)
# --------------------------------------------------
set(BLOCK_M 64 CACHE STRING "Block tile M dimension")
set(BLOCK_N 64 CACHE STRING "Block tile N dimension")
set(STAGE_K 16 CACHE STRING "K stage depth")
set(WARPS_PER_BLOCK 4 CACHE STRING "Warps per block")
set(ILP_DEPTH 2 CACHE STRING "Accumulator sets (1 or 2)")
# --------------------------------------------------
# Compile Definitions
# --------------------------------------------------
add_compile_definitions(
BLOCK_M=${BLOCK_M}
BLOCK_N=${BLOCK_N}
STAGE_K=${STAGE_K}
WARPS_PER_BLOCK=${WARPS_PER_BLOCK}
ILP_DEPTH=${ILP_DEPTH}
)
# --------------------------------------------------
# Kernel Library
# --------------------------------------------------
file(GLOB KERNEL_SOURCES kernels/*.cu)
add_library(kernels STATIC ${KERNEL_SOURCES})
set_target_properties(kernels PROPERTIES
CUDA_SEPARABLE_COMPILATION ON
)
# --------------------------------------------------
# Benchmark Executable
# --------------------------------------------------
add_executable(benchmark benchmarks/benchmark.cu)
target_link_libraries(benchmark
PRIVATE
kernels
CUDA::cudart
CUDA::cublas
)
# Force C++ linker
set_target_properties(benchmark PROPERTIES
LINKER_LANGUAGE CXX
)