diff --git a/CMakeLists.txt b/CMakeLists.txt index eaed7d3509..06d270c16e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,22 @@ set(version 1.2.0) project(composable_kernel VERSION ${version} LANGUAGES CXX HIP) include(CTest) +# Set the default value of LLVM_MAIN_REVISION to the equivalent of ROCm7.1.1 release +set(LLVM_MAIN_REVISION 524190) +if (CMAKE_CXX_COMPILER MATCHES "/opt/rocm") + message("compiler in default /opt/rocm/ path") + file(READ "/opt/rocm/llvm/include/llvm/Config/llvm-config.h" HEADER_CONTENT) + string(REGEX MATCH "#define LLVM_MAIN_REVISION[ \t]+([0-9]+)" MATCH_RESULT "${HEADER_CONTENT}") + set(LLVM_MAIN_REVISION ${CMAKE_MATCH_1}) +elseif (CMAKE_CXX_COMPILER MATCHES "/llvm-project/build") + message("compiler in custom /llvm-project/build/ path") + file(READ "/llvm-project/build/include/llvm/Config/llvm-config.h" HEADER_CONTENT) + string(REGEX MATCH "#define LLVM_MAIN_REVISION[ \t]+([0-9]+)" MATCH_RESULT "${HEADER_CONTENT}") + set(LLVM_MAIN_REVISION ${CMAKE_MATCH_1}) +endif() +message("From CMake: LLVM_MAIN_REVISION=${LLVM_MAIN_REVISION}") +add_definitions(-DLLVM_MAIN_REVISION=${LLVM_MAIN_REVISION}) + option(ENABLE_CLANG_CPP_CHECKS "Enables clang tidy, cppcheck" ON) option(MIOPEN_REQ_LIBS_ONLY "Build only the MIOpen required libraries" OFF) option(CK_EXPERIMENTAL_BUILDER "Enable experimental builder" OFF) diff --git a/include/ck_tile/core/config.hpp b/include/ck_tile/core/config.hpp index 08d555d27c..e737421023 100644 --- a/include/ck_tile/core/config.hpp +++ b/include/ck_tile/core/config.hpp @@ -39,7 +39,7 @@ #define CK_TILE_DEVICE inline __device__ #define CK_TILE_HOST_DEVICE inline __host__ __device__ #define CK_TILE_DEVICE_EXTERN __device__ -#if __clang_major__ < 22 +#if LLVM_MAIN_REVISION < 554785 #define CK_TILE_HOST_DEVICE_EXTERN __host__ __device__ #else #define CK_TILE_HOST_DEVICE_EXTERN