summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Help/release/3.21.rst10
-rw-r--r--Help/variable/CMAKE_LANG_COMPILER_ID.rst1
-rw-r--r--Modules/CMakeCompilerIdDetection.cmake3
-rw-r--r--Modules/CMakeDetermineCompiler.cmake2
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake24
-rw-r--r--Modules/CMakeDetermineHIPCompiler.cmake24
-rw-r--r--Modules/Compiler/ROCMClang-ASM.cmake2
-rw-r--r--Modules/Compiler/ROCMClang-C.cmake7
-rw-r--r--Modules/Compiler/ROCMClang-CXX.cmake7
-rw-r--r--Modules/Compiler/ROCMClang-DetermineCompiler.cmake19
-rw-r--r--Modules/Compiler/ROCMClang-FindBinUtils.cmake1
-rw-r--r--Modules/Compiler/ROCMClang-HIP.cmake49
-rw-r--r--Modules/Compiler/ROCMClang-OBJC.cmake7
-rw-r--r--Modules/Compiler/ROCMClang-OBJCXX.cmake7
-rw-r--r--Modules/Compiler/ROCMClang.cmake35
-rw-r--r--Modules/WriteCompilerDetectionHeader.cmake1
-rw-r--r--Tests/HIP/WithDefs/CMakeLists.txt2
17 files changed, 35 insertions, 166 deletions
diff --git a/Help/release/3.21.rst b/Help/release/3.21.rst
index 5d8c200277..a468817f0b 100644
--- a/Help/release/3.21.rst
+++ b/Help/release/3.21.rst
@@ -319,3 +319,13 @@ Changes made since CMake 3.21.0 include the following.
* The :generator:`Visual Studio 17 2022` generator is now based on
"Visual Studio 2022 Preview 4". Previously it was based on "Preview 3.1".
+
+* The AMD ROCm Platform ``hipcc`` compiler was identifed by CMake 3.21.0
+ through 3.21.2 as a distinct compiler with id ``ROCMClang``. This has
+ been removed because it caused regressions. Instead:
+
+ * ``hipcc`` may no longer be used as a ``HIP`` compiler because it
+ interferes with flags CMake needs to pass to Clang. Use Clang directly.
+
+ * ``hipcc`` may once again be used as a ``CXX`` compiler, and is treated as
+ whatever compiler it selects underneath, as CMake 3.20 and below did.
diff --git a/Help/variable/CMAKE_LANG_COMPILER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_ID.rst
index f23b7a214a..0abedde6a5 100644
--- a/Help/variable/CMAKE_LANG_COMPILER_ID.rst
+++ b/Help/variable/CMAKE_LANG_COMPILER_ID.rst
@@ -34,7 +34,6 @@ include:
OpenWatcom = Open Watcom (openwatcom.org)
PGI = The Portland Group (pgroup.com)
PathScale = PathScale (pathscale.com)
- ROCMClang = ROCm Toolkit Clang-based Compiler (rocmdocs.amd.com)
SDCC = Small Device C Compiler (sdcc.sourceforge.net)
SunPro = Oracle Solaris Studio (oracle.com)
TI = Texas Instruments (ti.com)
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index dd70d828f5..e6b3ee32e6 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -82,9 +82,6 @@ function(compiler_id_detection outvar lang)
AppleClang
ARMClang
)
- if(NOT __skip_rocmclang)
- list(APPEND ordered_compilers ROCMClang)
- endif()
list(APPEND ordered_compilers
Clang
GNU
diff --git a/Modules/CMakeDetermineCompiler.cmake b/Modules/CMakeDetermineCompiler.cmake
index 6430793baa..c967ab7c24 100644
--- a/Modules/CMakeDetermineCompiler.cmake
+++ b/Modules/CMakeDetermineCompiler.cmake
@@ -32,7 +32,7 @@ macro(_cmake_find_compiler lang)
endif()
# Look for directories containing compilers of reference languages.
- set(_${lang}_COMPILER_HINTS)
+ set(_${lang}_COMPILER_HINTS "${CMAKE_${lang}_COMPILER_HINTS}")
foreach(l ${_languages})
if(CMAKE_${l}_COMPILER AND IS_ABSOLUTE "${CMAKE_${l}_COMPILER}")
get_filename_component(_hint "${CMAKE_${l}_COMPILER}" PATH)
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 65e7236482..30b4aec90b 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -150,30 +150,6 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
endif()
endif()
- # When invoked with HIPCC we need to extract the path to the underlying
- # clang compiler when possible. This fixes the following issues:
- # env variables can change how hipcc behaves
- # allows us to properly find the binutils bundled with hip
- if(CMAKE_${lang}_COMPILER_ID STREQUAL "ROCMClang"
- AND CMAKE_${lang}_COMPILER MATCHES ".*hipcc")
- get_filename_component(_hipcc_dir "${CMAKE_${lang}_COMPILER}" DIRECTORY)
- execute_process(
- COMMAND "${_hipcc_dir}/hipconfig"
- --hipclangpath
- OUTPUT_VARIABLE output
- RESULT_VARIABLE result
- )
- if(result EQUAL 0 AND EXISTS "${output}")
- if(lang STREQUAL "C")
- set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${output}/clang")
- set(CMAKE_${lang}_COMPILER "${output}/clang" PARENT_SCOPE)
- else()
- set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${output}/clang++")
- set(CMAKE_${lang}_COMPILER "${output}/clang++" PARENT_SCOPE)
- endif()
- endif()
- endif()
-
if (COMPILER_QNXNTO AND CMAKE_${lang}_COMPILER_ID STREQUAL "GNU")
execute_process(
COMMAND "${CMAKE_${lang}_COMPILER}"
diff --git a/Modules/CMakeDetermineHIPCompiler.cmake b/Modules/CMakeDetermineHIPCompiler.cmake
index 394f8e2be0..5c8849e6ae 100644
--- a/Modules/CMakeDetermineHIPCompiler.cmake
+++ b/Modules/CMakeDetermineHIPCompiler.cmake
@@ -15,6 +15,13 @@ if(NOT CMAKE_HIP_COMPILER)
# prefer the environment variable HIPCXX
if(NOT $ENV{HIPCXX} STREQUAL "")
+ if("$ENV{HIPCXX}" MATCHES "hipcc")
+ message(FATAL_ERROR
+ "The HIPCXX environment variable is set to the hipcc wrapper:\n"
+ " $ENV{HIPCXX}\n"
+ "This is not supported. Use Clang directly, or let CMake pick a default."
+ )
+ endif()
get_filename_component(CMAKE_HIP_COMPILER_INIT $ENV{HIPCXX} PROGRAM PROGRAM_ARGS CMAKE_HIP_FLAGS_ENV_INIT)
if(CMAKE_HIP_FLAGS_ENV_INIT)
set(CMAKE_HIP_COMPILER_ARG1 "${CMAKE_HIP_FLAGS_ENV_INIT}" CACHE STRING "Arguments to CXX compiler")
@@ -26,10 +33,25 @@ if(NOT CMAKE_HIP_COMPILER)
# finally list compilers to try
if(NOT CMAKE_HIP_COMPILER_INIT)
- set(CMAKE_HIP_COMPILER_LIST hipcc clang++)
+ set(CMAKE_HIP_COMPILER_LIST clang++)
+
+ # Look for the Clang coming with ROCm to support HIP.
+ execute_process(COMMAND hipconfig --hipclangpath
+ OUTPUT_VARIABLE _CMAKE_HIPCONFIG_CLANGPATH
+ RESULT_VARIABLE _CMAKE_HIPCONFIG_RESULT
+ )
+ if(_CMAKE_HIPCONFIG_RESULT EQUAL 0 AND EXISTS "${_CMAKE_HIPCONFIG_CLANGPATH}")
+ set(CMAKE_HIP_COMPILER_HINTS "${_CMAKE_HIPCONFIG_CLANGPATH}")
+ endif()
endif()
_cmake_find_compiler(HIP)
+elseif(CMAKE_HIP_COMPILER MATCHES "hipcc")
+ message(FATAL_ERROR
+ "CMAKE_HIP_COMPILER is set to the hipcc wrapper:\n"
+ " ${CMAKE_HIP_COMPILER}\n"
+ "This is not supported. Use Clang directly, or let CMake pick a default."
+ )
else()
_cmake_find_compiler_path(HIP)
endif()
diff --git a/Modules/Compiler/ROCMClang-ASM.cmake b/Modules/Compiler/ROCMClang-ASM.cmake
deleted file mode 100644
index 85d1110a5e..0000000000
--- a/Modules/Compiler/ROCMClang-ASM.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-include(Compiler/ROCMClang)
-__compiler_rocmclang(ASM)
diff --git a/Modules/Compiler/ROCMClang-C.cmake b/Modules/Compiler/ROCMClang-C.cmake
deleted file mode 100644
index cdfa95d9ea..0000000000
--- a/Modules/Compiler/ROCMClang-C.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-include(Compiler/ROCMClang)
-__compiler_rocmclang(C)
-
-set(_rocm_clang_ver "${CMAKE_C_COMPILER_VERSION_INTERNAL}")
-set(CMAKE_C_COMPILER_VERSION "${CMAKE_C_COMPILER_VERSION_INTERNAL}")
-include(Compiler/Clang-C)
-set(CMAKE_C_COMPILER_VERSION "${_rocm_clang_ver}")
diff --git a/Modules/Compiler/ROCMClang-CXX.cmake b/Modules/Compiler/ROCMClang-CXX.cmake
deleted file mode 100644
index 5739c8e594..0000000000
--- a/Modules/Compiler/ROCMClang-CXX.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-include(Compiler/ROCMClang)
-__compiler_rocmclang(CXX)
-
-set(_rocm_clang_ver "${CMAKE_CXX_COMPILER_VERSION_INTERNAL}")
-set(CMAKE_CXX_COMPILER_VERSION "${CMAKE_CXX_COMPILER_VERSION_INTERNAL}")
-include(Compiler/Clang-CXX)
-set(CMAKE_CXX_COMPILER_VERSION "${_rocm_clang_ver}")
diff --git a/Modules/Compiler/ROCMClang-DetermineCompiler.cmake b/Modules/Compiler/ROCMClang-DetermineCompiler.cmake
deleted file mode 100644
index c2fc99b6bd..0000000000
--- a/Modules/Compiler/ROCMClang-DetermineCompiler.cmake
+++ /dev/null
@@ -1,19 +0,0 @@
-
-set(_compiler_id_pp_test "defined(__clang__) && __has_include(<hip/hip_version.h>)")
-
-set(_compiler_id_version_compute "
-# if defined(__clang__) && __has_include(<hip/hip_version.h>)
-# include <hip/hip_version.h>
-# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(HIP_VERSION_MAJOR)
-# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(HIP_VERSION_MINOR)
-# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(HIP_VERSION_PATCH)
-# endif")
-
-set(_compiler_id_simulate "
-# if defined(_MSC_VER)
-# define @PREFIX@SIMULATE_ID \"MSVC\"
-# elif defined(__clang__)
-# define @PREFIX@SIMULATE_ID \"Clang\"
-# elif defined(__GNUC__)
-# define @PREFIX@SIMULATE_ID \"GNU\"
-# endif")
diff --git a/Modules/Compiler/ROCMClang-FindBinUtils.cmake b/Modules/Compiler/ROCMClang-FindBinUtils.cmake
deleted file mode 100644
index e721c8708e..0000000000
--- a/Modules/Compiler/ROCMClang-FindBinUtils.cmake
+++ /dev/null
@@ -1 +0,0 @@
-include(Compiler/Clang-FindBinUtils)
diff --git a/Modules/Compiler/ROCMClang-HIP.cmake b/Modules/Compiler/ROCMClang-HIP.cmake
deleted file mode 100644
index 7af769987f..0000000000
--- a/Modules/Compiler/ROCMClang-HIP.cmake
+++ /dev/null
@@ -1,49 +0,0 @@
-include(Compiler/ROCMClang)
-__compiler_rocmclang(HIP)
-
-set(_CMAKE_COMPILE_AS_HIP_FLAG "-x hip")
-set(_CMAKE_HIP_RDC_FLAG "-fgpu-rdc")
-
-if(NOT "x${CMAKE_${lang}_SIMULATE_ID}" STREQUAL "xMSVC")
- set(CMAKE_HIP_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
- string(APPEND CMAKE_HIP_FLAGS_DEBUG_INIT " -O")
-endif()
-
-if(CMAKE_HIP_SIMULATE_ID STREQUAL "GNU")
- set(CMAKE_HIP_LINKER_WRAPPER_FLAG "-Wl,")
- set(CMAKE_HIP_LINKER_WRAPPER_FLAG_SEP ",")
-elseif(CMAKE_HIP_SIMULATE_ID STREQUAL "Clang")
- set(CMAKE_HIP_LINKER_WRAPPER_FLAG "-Xlinker" " ")
- set(CMAKE_HIP_LINKER_WRAPPER_FLAG_SEP)
-endif()
-
-if(NOT CMAKE_HIP_COMPILER_VERSION VERSION_LESS 1.0)
- set(CMAKE_HIP98_STANDARD_COMPILE_OPTION "-std=c++98")
- set(CMAKE_HIP98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
- set(CMAKE_HIP98_STANDARD__HAS_FULL_SUPPORT ON)
-
- set(CMAKE_HIP11_STANDARD_COMPILE_OPTION "-std=c++11")
- set(CMAKE_HIP11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
- set(CMAKE_HIP11_STANDARD__HAS_FULL_SUPPORT ON)
-
- set(CMAKE_HIP14_STANDARD_COMPILE_OPTION "-std=c++14")
- set(CMAKE_HIP14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
- set(CMAKE_HIP14_STANDARD__HAS_FULL_SUPPORT ON)
-
- set(CMAKE_HIP17_STANDARD_COMPILE_OPTION "-std=c++17")
- set(CMAKE_HIP17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
- set(CMAKE_HIP17_STANDARD__HAS_FULL_SUPPORT ON)
-
- set(CMAKE_HIP20_STANDARD_COMPILE_OPTION "-std=c++20")
- set(CMAKE_HIP20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
-endif()
-
-set(CMAKE_HIP_RUNTIME_LIBRARY_DEFAULT "SHARED")
-set(CMAKE_HIP_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "")
-set(CMAKE_HIP_RUNTIME_LIBRARY_LINK_OPTIONS_SHARED "")
-
-# Populated by CMakeHIPRuntime.cmake
-set(CMAKE_HIP_RUNTIME_LIBRARIES_STATIC "")
-set(CMAKE_HIP_RUNTIME_LIBRARIES_SHARED "")
-
-__compiler_check_default_language_standard(HIP 3.5 11)
diff --git a/Modules/Compiler/ROCMClang-OBJC.cmake b/Modules/Compiler/ROCMClang-OBJC.cmake
deleted file mode 100644
index 794973d33e..0000000000
--- a/Modules/Compiler/ROCMClang-OBJC.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-include(Compiler/ROCMClang)
-__compiler_rocmclang(OBJC)
-
-set(_rocm_clang_ver "${CMAKE_OBJC_COMPILER_VERSION_INTERNAL}")
-set(CMAKE_OBJC_COMPILER_VERSION "${CMAKE_OBJC_COMPILER_VERSION_INTERNAL}")
-include(Compiler/Clang-OBJC)
-set(CMAKE_OBJC_COMPILER_VERSION "${_rocm_clang_ver}")
diff --git a/Modules/Compiler/ROCMClang-OBJCXX.cmake b/Modules/Compiler/ROCMClang-OBJCXX.cmake
deleted file mode 100644
index 82238e1679..0000000000
--- a/Modules/Compiler/ROCMClang-OBJCXX.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-include(Compiler/ROCMClang)
-__compiler_rocmclang(OBJCXX)
-
-set(_rocm_clang_ver "${CMAKE_OBJCXX_COMPILER_VERSION_INTERNAL}")
-set(CMAKE_OBJCXX_COMPILER_VERSION "${CMAKE_OBJCXX_COMPILER_VERSION_INTERNAL}")
-include(Compiler/Clang-OBJCXX)
-set(CMAKE_OBJCXX_COMPILER_VERSION "${_rocm_clang_ver}")
diff --git a/Modules/Compiler/ROCMClang.cmake b/Modules/Compiler/ROCMClang.cmake
deleted file mode 100644
index 6b38c2d400..0000000000
--- a/Modules/Compiler/ROCMClang.cmake
+++ /dev/null
@@ -1,35 +0,0 @@
-# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-
-# This module is shared by multiple languages; use include blocker.
-include_guard()
-
-include(Compiler/CMakeCommonCompilerMacros)
-
-macro(__compiler_rocmclang lang)
-
- set(CMAKE_${lang}_VERBOSE_FLAG "-v")
-
- if(NOT "x${CMAKE_${lang}_SIMULATE_ID}" STREQUAL "xMSVC")
- # Feature flags.
- set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
- set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
- set(CMAKE_HIP_COMPILE_OPTIONS_VISIBILITY -fvisibility=)
-
- string(APPEND CMAKE_HIP_FLAGS_INIT " ")
- string(APPEND CMAKE_HIP_FLAGS_DEBUG_INIT " -g")
- string(APPEND CMAKE_HIP_FLAGS_RELEASE_INIT " -O3 -DNDEBUG")
- string(APPEND CMAKE_HIP_FLAGS_MINSIZEREL_INIT " -Os -DNDEBUG")
- string(APPEND CMAKE_HIP_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")
- endif()
-
- set(CMAKE_SHARED_LIBRARY_CREATE_HIP_FLAGS -shared)
- set(CMAKE_INCLUDE_SYSTEM_FLAG_HIP "-isystem ")
-
- set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 1)
- set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_LIBRARIES 1)
- set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1)
- set(CMAKE_${lang}_RESPONSE_FILE_FLAG "@")
- set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "@")
-endmacro()
diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake
index 54eb40ed2d..0e4e028051 100644
--- a/Modules/WriteCompilerDetectionHeader.cmake
+++ b/Modules/WriteCompilerDetectionHeader.cmake
@@ -384,7 +384,6 @@ elseif(_WCDH_policy STREQUAL "")
)
endif()
-set(__skip_rocmclang TRUE)
include(${CMAKE_CURRENT_LIST_DIR}/CMakeCompilerIdDetection.cmake)
function(_load_compiler_variables CompilerId lang)
diff --git a/Tests/HIP/WithDefs/CMakeLists.txt b/Tests/HIP/WithDefs/CMakeLists.txt
index e2db1820a7..270f95701b 100644
--- a/Tests/HIP/WithDefs/CMakeLists.txt
+++ b/Tests/HIP/WithDefs/CMakeLists.txt
@@ -19,7 +19,7 @@ target_compile_options(HIPOnlyWithDefs
PRIVATE
--offload-arch=gfx900
-DFLAG_COMPILE_LANG_$<COMPILE_LANGUAGE>
- $<$<HIP_COMPILER_ID:ROCMClang>:-DFLAG_LANG_IS_HIP=$<COMPILE_LANGUAGE:HIP>> # Host-only defines are possible only on NVCC.
+ $<$<HIP_COMPILER_ID:Clang>:-DFLAG_LANG_IS_HIP=$<COMPILE_LANGUAGE:HIP>> # Host-only defines are possible only on NVCC.
)
target_compile_definitions(HIPOnlyWithDefs