Skip to content

Placeholder should be used for link executable#1172

Merged
bader merged 1 commit intoKhronosGroup:mainfrom
frengels:crosscompile-target
Jan 27, 2026
Merged

Placeholder should be used for link executable#1172
bader merged 1 commit intoKhronosGroup:mainfrom
frengels:crosscompile-target

Conversation

@frengels
Copy link
Copy Markdown
Contributor

When setting the dpcpp executable directly it bypasses any additional flags which cmake would set. For example, this currently prevents cmake from setting --target= when cross-compiling the SYCL-CTS. Since CMAKE_CXX_COMPILER is already set to DPCPP_CXX_EXECUTABLE this will have the same desired effect.

@frengels frengels requested a review from bader as a code owner January 15, 2026 12:56
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jan 15, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Member

@keryell keryell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that makes sense.

@bader
Copy link
Copy Markdown
Contributor

bader commented Jan 15, 2026

When setting the dpcpp executable directly it bypasses any additional flags which cmake would set.

I think this was done intentionally. CMake configuration was inherited from the Codeplay ComputeCPP implementation, which has an option to use system C++ compiler as a host compiler for the SYCL code. DPC++ has this option as well, but it's not a default one.

For example, this currently prevents cmake from setting --target= when cross-compiling the SYCL-CTS

@frengels, did you considered using DPCPP_FLAGS for setting DPC++ compiler options?

Since CMAKE_CXX_COMPILER is already set to DPCPP_CXX_EXECUTABLE this will have the same desired effect.

Considering that ComputeCPP is EOLed, we should consider dropping DPC++ specific variables (i.e. DPCPP_CXX_EXECUTABLE and DPCPP_FLAGS) and use SYCL compiler as standard C++ host compiler as well. This will require more clean-up.

@frengels, what cmake options do use for cross-compiling SYCL-CTS?

@frengels
Copy link
Copy Markdown
Contributor Author

Sorry, I hadn't hit send.

I think this was done intentionally. CMake configuration was inherited from the Codeplay ComputeCPP implementation, which has an option to use system C++ compiler as a host compiler for the SYCL code. DPC++ has this option as well, but it's not a default one.

I have no issue with it changing from some of the host compiler flags. It's just that this would've been an unforeseen one that is added for cross-compilation with a toolchain file.

@frengels, did you considered using DPCPP_FLAGS for setting DPC++ compiler options?

No, I wanted it to remain as vanilla as possible, only having to change the toolchain file.

@frengels, what cmake options do use for cross-compiling SYCL-CTS?

I'm using the following

"SYCL_IMPLEMENTATION": "DPCPP",
"SYCL_CTS_CTEST_DEVICE": "GPU",
"SYCL_CTS_ENABLE_DOUBLE_TESTS": "OFF",
"SYCL_CTS_ENABLE_HALF_TESTS": "ON",
"SYCL_CTS_ENABLE_OPENCL_INTEROP_TESTS": "OFF",
"DPCPP_INSTALL_DIR": "$penv{DPCPP_INSTALL_DIR}",
"CMAKE_POLICY_VERSION_MINIMUM": "3.5"

And my toolchain file contains

set(CMAKE_SYSTEM Windows)
set(CMAKE_SYSTEM_PROCESSOR ARM64)

set(_TARGET "aarch64-pc-windows-msvc")

set(_DPCPP_INSTALL_DIR $ENV{DPCPP_INSTALL_DIR})

set(CMAKE_C_COMPILER_TARGET ${_TARGET})
set(CMAKE_CXX_COMPILER_TARGET ${_TARGET})
set(CMAKE_ASM_COMPILER_TARGET ${_TARGET})
set(CMAKE_C_COMPILER "${_DPCPP_INSTALL_DIR}/bin/clang.exe")
set(CMAKE_CXX_COMPILER "${_DPCPP_INSTALL_DIR}/bin/clang++.exe")
set(CMAKE_ASM_COMPILER "${_DPCPP_INSTALL_DIR}/bin/clang.exe")

@frengels frengels force-pushed the crosscompile-target branch from b34b2a7 to 5e5fe52 Compare January 21, 2026 11:04
The placeholder syntax allows cmake to expand this variable
and include important information for use with cross-compilation.
@frengels frengels force-pushed the crosscompile-target branch from 5e5fe52 to 3d0c72d Compare January 21, 2026 11:06
Copy link
Copy Markdown
Contributor

@bader bader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, setting SYCL compiler via C++ variables looks like a hack to me, but considering that we already have it in place, I'm okay with the patch.
Conceptually, SYCL-CTS build system separates C++ sources from SYCL sources and uses different compilers for building corresponding source files.
We need to take a closer look at configuring compilers separately.

@frengels, one more note: cross-compilation is not tested by regular CI, so your use case can be broken by future PRs.

@bader bader merged commit d534667 into KhronosGroup:main Jan 27, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants