From 25cd2e3488a17bdac0f080474f2f4800e5dcfa5c Mon Sep 17 00:00:00 2001 From: trixirt Date: Wed, 14 Aug 2024 20:43:10 -0700 Subject: [PATCH] Check compiler flags before using (#1403) * Check compiler flags before using The user's compiler may not support these flags, so check. Resolves failures on Fedora. Signed-off-by: Tom Rix * fix syntax CMakeLists.txt Fix syntax in the check_cxx_compiler_flag. --------- Signed-off-by: Tom Rix Co-authored-by: Tom Rix Co-authored-by: Illia Silin <98187287+illsilin@users.noreply.github.com> [ROCm/composable_kernel commit: 49769ec8891720e0a6b7316325f3dd966663c41b] --- CMakeLists.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 96c37ac943..2039948a12 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,12 +191,18 @@ endif() configure_file(include/ck/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/ck/config.h) if(NOT WIN32 AND ${hip_VERSION_FLAT} GREATER 500723302) - message("Adding the fno-offload-uniform-block compiler flag") - add_compile_options(-fno-offload-uniform-block) + check_cxx_compiler_flag("-fno-offload-uniform-block" HAS_NO_OFFLOAD_UNIFORM_BLOCK) + if(HAS_NO_OFFLOAD_UNIFORM_BLOCK) + message("Adding the fno-offload-uniform-block compiler flag") + add_compile_options(-fno-offload-uniform-block) + endif() endif() if(NOT WIN32 AND ${hip_VERSION_FLAT} GREATER 600140090) - message("Adding the enable-post-misched=0 compiler flag") - add_compile_options("SHELL: -mllvm -enable-post-misched=0") + check_cxx_compiler_flag("-mllvm -enable-post-misched=0" HAS_ENABLE_POST_MISCHED) + if(HAS_ENABLE_POST_MISCHED) + message("Adding the enable-post-misched=0 compiler flag") + add_compile_options("SHELL: -mllvm -enable-post-misched=0") + endif() endif() set(check-coerce) check_cxx_compiler_flag(" -mllvm -amdgpu-coerce-illegal-types=1" check-coerce)