Open
Description
When trying to compile my CUDA project with LTO enabled I get the error CMAKE doesn't support IPO for current CUDA compiler
. In my root CMakeLists.txt file I have the check defined in this way:
cmake_minimum_required(VERSION 3.27...3.31)
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
set(CMAKE_CUDA_ARCHITECTURES 50)
endif()
project(
cuda_path_tracer
VERSION 1.0
LANGUAGES CXX CUDA
)
include(CheckIPOSupported)
check_ipo_supported(RESULT supported OUTPUT error)
if (supported)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
else()
message(WARNING "IPO is not supported: ${error}")
endif()
...
Shouldn't LTO be supported with clang? I am currently using clang20
Edit
I managed to find where in the CMake source code LTO support for CUDA compilation with Clang is unset. Here https://fuchsia.googlesource.com/third_party/github.com/Kitware/CMake/+/refs/heads/main/Modules/Compiler/Clang-CUDA.cmake we see
# Clang doesn't support CUDA device LTO
set(_CMAKE_CUDA_IPO_SUPPORTED_BY_CMAKE NO)
set(_CMAKE_CUDA_IPO_MAY_BE_SUPPORTED_BY_COMPILER NO)
However, I can't seem to find this mentioned anywhere in the Clang's documentation, is it a feature that is on a roadmap for future Clang releases?