CMakeLists.txt 2.67 KB
Newer Older
Chao Liu's avatar
Chao Liu committed
1
2
3
4
cmake_minimum_required(VERSION 3.15)
project(ck_app)
add_compile_options(-std=c++17)

5
if (DTYPES)
6
7
8
    add_definitions(-DDTYPES)
    if (DTYPES MATCHES "int8")
        add_definitions(-DCK_ENABLE_INT8)
9
        set(CK_ENABLE_INT8 "ON")
10
11
12
    endif()
    if (DTYPES MATCHES "fp8")
        add_definitions(-DCK_ENABLE_FP8)
13
14
15
16
17
        set(CK_ENABLE_FP8 "ON")
    endif()
    if (DTYPES MATCHES "bf8")
        add_definitions(-DCK_ENABLE_BF8)
        set(CK_ENABLE_BF8 "ON")
18
19
20
    endif()
    if (DTYPES MATCHES "fp16")
        add_definitions(-DCK_ENABLE_FP16)
21
        set(CK_ENABLE_FP16 "ON")
22
23
24
    endif()
    if (DTYPES MATCHES "fp32")
        add_definitions(-DCK_ENABLE_FP32)
25
        set(CK_ENABLE_FP32 "ON")
26
27
28
    endif()
    if (DTYPES MATCHES "fp64")
        add_definitions(-DCK_ENABLE_FP64)
29
        set(CK_ENABLE_FP64 "ON")
30
31
32
    endif()
    if (DTYPES MATCHES "bf16")
        add_definitions(-DCK_ENABLE_BF16)
33
        set(CK_ENABLE_BF16 "ON")
34
35
    endif()
    message("DTYPES macro set to ${DTYPES}")
36
else()
37
38
39
40
41
42
43
44
45
46
47
    add_definitions(-DCK_ENABLE_INT8 -DCK_ENABLE_FP16 -DCK_ENABLE_FP32 -DCK_ENABLE_FP64 -DCK_ENABLE_BF16)
    set(CK_ENABLE_INT8 "ON")
    set(CK_ENABLE_FP16 "ON")
    set(CK_ENABLE_FP32 "ON")
    set(CK_ENABLE_FP64 "ON")
    set(CK_ENABLE_BF16 "ON")
    if (GPU_TARGETS MATCHES "gfx94")
        add_definitions(-DCK_ENABLE_FP8 -DCK_ENABLE_BF8)
        set(CK_ENABLE_FP8 "ON")
        set(CK_ENABLE_BF8 "ON")
    endif()
48
49
endif()

50
51
52
53
54
55
56
57
58
if (GPU_TARGETS)
    if (GPU_TARGETS MATCHES "gfx9")
        add_definitions(-DCK_USE_XDL)
        set(CK_USE_XDL "ON")
    endif()
    if (GPU_TARGETS MATCHES "gfx11")
        add_definitions(-DCK_USE_WMMA)
        set(CK_USE_WMMA "ON")
    endif()
59
60
61
62
63
64
65
66
    if (GPU_TARGETS MATCHES "gfx12")
        add_definitions(-DCK_USE_OCP_FP8)
        set(CK_USE_OCP_FP8 "ON")
    endif()
    if (GPU_TARGETS MATCHES "gfx90a" OR GPU_TARGETS MATCHES "gfx94")
        add_definitions(-DCK_USE_FNUZ_FP8)
        set(CK_USE_FNUZ_FP8 "ON")
    endif()
67
68
69
70
71
72
else()
    add_definitions(-DCK_USE_WMMA -DCK_USE_XDL)
    set(CK_USE_XDL "ON")
    set(CK_USE_WMMA "ON")
endif()

Illia Silin's avatar
Illia Silin committed
73
find_package(composable_kernel COMPONENTS device_other_operations device_gemm_operations device_conv_operations  device_reduction_operations utility)
74
75
76
if(GPU_TARGETS MATCHES "gfx9")
    find_package(composable_kernel COMPONENTS device_contraction_operations)
endif()
Chao Liu's avatar
Chao Liu committed
77
78
79
find_package(hip REQUIRED PATHS /opt/rocm)
message(STATUS "Build with HIP ${hip_VERSION}")

Shaojie WANG's avatar
Shaojie WANG committed
80
81
82
# add all example subdir
file(GLOB dir_list LIST_DIRECTORIES true *)
FOREACH(subdir ${dir_list})
83
84
    IF(IS_DIRECTORY "${subdir}" AND (NOT "${subdir}" MATCHES "build") 
                                AND (NOT "${subdir}" MATCHES ".vscode"))
Shaojie WANG's avatar
Shaojie WANG committed
85
86
87
        add_subdirectory(${subdir})
    ENDIF()
ENDFOREACH()