AdaptiveCpp: Cannot build AdaptiveCpp with LLVM 20: CMake flag not propagated, /EHs injected for Clang++, and LLVM API break [Windows]

I’m reporting several issues encountered while trying to build AdaptiveCpp with LLVM 20 (Clang 20.1.5, built from source).

  1. LLVM_ADAPTIVECPP_LINK_INTO_TOOLS flag is not propagated when building as part of LLVM Edit: Not an issue; path to AdaptiveCpp was specified incorrectly: /../../AdaptiveCpp, first slash / isn’t needed

I am trying to build AdaptiveCpp (commit db23e2b0a075a8063599093dac22bc07219a9e94) as a part of LLVM to enable use of SSCP compiler.

cmake configure command I use:

cmake ../llvm -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%ACPP_INSTALL_PREFIX% -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" -DLLVM_ENABLE_PROJECTS="clang;openmp;lld" -DLLVM_PARALLEL_LINK_JOBS=%LLVM_PARALLEL_LINK_JOBS% -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON -DLLVM_EXTERNAL_PROJECTS=AdaptiveCpp -DLLVM_EXTERNAL_ADAPTIVECPP_SOURCE_DIR=../../AdaptiveCpp -DLLVM_ADAPTIVECPP_LINK_INTO_TOOLS=ON -DWITH_OPENCL_BACKEND=OFF -DBOOST_ROOT=%BOOST_INSTALL_DIR% -DLLVM_TOOL_BUGPOINT_BUILD=OFF -DLLVM_INCLUDE_TESTS=OFF %CCACHE_CMAKE_ARGS%

However, AdaptiveCpp configuration flags appear to be ignored by CMake. The log shows:

Manually-specified variables were not used by the project:

    BOOST_ROOT
    LLVM_ADAPTIVECPP_LINK_INTO_TOOLS
    WITH_OPENCL_BACKEND

As a result, AdaptiveCpp is built, I can see its files in the target LLVM dirs, but clang++ does not recognize -acpp-sscp when compiling SYCL programs.

  1. /EHs is injected into Clang++ builds on Windows Edit: not an issue; it’s by design now. Need to use clang-cl to build AdaptiveCpp now.

Ok. I am trying then simply to build AdaptiveCpp (commit db23e2b0a075a8063599093dac22bc07219a9e94) with Clang 20.1.5 as a separate build, without SSCP.

Configure command:

cmake .. -G Ninja -DCMAKE_C_COMPILER=c:/llvm/bin/clang.exe -DCMAKE_CXX_COMPILER=c:/llvm/bin/clang++.exe -DBOOST_ROOT=c:/libraries/boost_1_88_clangw20 -DLLVM_DIR=c:/llvm/lib/cmake/llvm -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=c:/AdaptiveCpp/ -DWITH_SSCP_COMPILER=OFF -DWITH_OPENCL_BACKEND=OFF -DWITH_LEVEL_ZERO_BACKEND=OFF -DWITH_ACCELERATED_CPU=ON -DHIPSYCL_DEBUG_LEVEL=0 -DROCM_PATH="C:/Program Files/AMD/ROCm/6.1"

CMake correctly detects Clang with GNU-style command line:

-- The CXX compiler identification is Clang 20.1.5 with GNU-like command-line

However, the build fails with:

clang++: error: no such file or directory: '/EHs'

This is because AdaptiveCpp now conditionally injects /EHs, for example:

if(WIN32 AND "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
  target_compile_options(acpp-common PRIVATE /EHs)
endif()

This did not exist in older AdaptiveCpp versions.

  1. LLVM 20 breaks compatibility with old AdaptiveCpp (commit 206760b95ab2a81f70de468cb87db0999a959c4d) Edit: this isn’t an issue now, compatibility of AdaptiveCpp with Clang 20 was fixed in newer versions.

Ok. I am trying to build older AdaptiveCpp (dated by March, 1) with LLVM 20. I succesfully built it earlier with LLVM 18, and also with 19 (but NVPTX didn’t work in 19).

I am getting this error:

error: variable 'GepIp' with type 'auto *' has incompatible initializer of type 'BasicBlock::iterator'

Please let me know if you’d prefer these as separate issues.

Happy to help test patches or give more context. Thanks!

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 29 (16 by maintainers)

Most upvoted comments

Our application runs some operations as a separate console application, and AdaptiveCpp warnings like [AdaptiveCpp Warning] backend_loader: Failed to load library: rt-backend-cuda.dll c:126 (for users without Nvidia GPUs) creep there.

IMO we could consider to turn that into a info message, so that it won’t be shown by default. It’s an expected output in some cases as you say, so perhaps a warning is not appropriate.

Regarding the second issue with /EHs. It probably may have originated from recent changes intended to support building AdaptiveCpp as part of LLVM using the MSVC toolchain (to enable the SSCP compiler on Windows). However, this breaks the older (still potentilly useful) workflow of building AdaptiveCpp separately from LLVM. May be, it would be worth to consider restoring support for Clang-based builds without MSVC-specific flags?

The old workflow generates a clang plugin. My understanding is that it is not possible to support clang plugins reliable on Windows, which is why the LLVM integration was introduced in the first place. Perhaps @fodinabor can comment more.