# Copyright (c) Advanced Micro Devices, Inc., or its affiliates. # SPDX-License-Identifier: MIT cmake_minimum_required(VERSION 3.15) project(ck_app) add_compile_options(-std=c++20) if (DTYPES) add_definitions(-DDTYPES) if (DTYPES MATCHES "int8") add_definitions(-DCK_ENABLE_INT8) set(CK_ENABLE_INT8 "ON") endif() if (DTYPES MATCHES "fp8") add_definitions(-DCK_ENABLE_FP8) set(CK_ENABLE_FP8 "ON") endif() if (DTYPES MATCHES "bf8") add_definitions(-DCK_ENABLE_BF8) set(CK_ENABLE_BF8 "ON") endif() if (DTYPES MATCHES "fp16") add_definitions(-DCK_ENABLE_FP16) set(CK_ENABLE_FP16 "ON") endif() if (DTYPES MATCHES "fp32") add_definitions(-DCK_ENABLE_FP32) set(CK_ENABLE_FP32 "ON") endif() if (DTYPES MATCHES "tf32") set(CK_ENABLE_TF32 "ON") endif() if (DTYPES MATCHES "fp64") add_definitions(-DCK_ENABLE_FP64) set(CK_ENABLE_FP64 "ON") endif() if (DTYPES MATCHES "bf16") add_definitions(-DCK_ENABLE_BF16) set(CK_ENABLE_BF16 "ON") endif() message(DEBUG "DTYPES macro set to ${DTYPES}") else() 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_TF32 "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() endif() if (GPU_TARGETS) if (GPU_TARGETS MATCHES "gfx9|gfx11|gfx12") 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() if (GPU_TARGETS MATCHES "gfx12" OR GPU_TARGETS MATCHES "gfx950") 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() if ((GPU_TARGETS MATCHES "gfx942" OR GPU_TARGETS MATCHES "gfx95") AND CK_ENABLE_TF32) add_definitions(-DCK_ENABLE_TF32) set(CK_ENABLE_TF32 "ON") else() message(STATUS "Disabling TF32 instances for this target") remove_definitions(-DCK_ENABLE_TF32) set(CK_ENABLE_TF32 "OFF") endif() else() add_definitions(-DCK_USE_WMMA -DCK_USE_XDL) set(CK_USE_XDL "ON") set(CK_USE_WMMA "ON") endif() find_package(composable_kernel COMPONENTS device_other_operations device_gemm_operations device_conv_operations device_reduction_operations utility) if(GPU_TARGETS MATCHES "gfx9") find_package(composable_kernel COMPONENTS device_contraction_operations) endif() find_package(hip REQUIRED PATHS /opt/rocm) message(STATUS "Build with HIP ${hip_VERSION}") # add all example subdir file(GLOB dir_list LIST_DIRECTORIES true *) FOREACH(subdir ${dir_list}) IF(IS_DIRECTORY "${subdir}" AND (NOT "${subdir}" MATCHES "build") AND (NOT "${subdir}" MATCHES ".vscode")) add_subdirectory(${subdir}) ENDIF() ENDFOREACH()