From 50af5f124b03c11c31a6773f6f344102fd049c33 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Tue, 1 Dec 2026 13:03:15 +0100 Subject: [PATCH 1/2] Accept the DPClang compiler ID of CMake 4.5 CMake 4.5 identifies the open source DPC++ compiler, version 7.0 and newer, by the new compiler ID `DPClang` instead of `Clang`, with no policy to keep the old one. On Linux, `IntelSYCLConfig.cmake` accepted only `Clang` and `IntelLLVM`, so configuring dpctl with the open source DPC++ and CMake 4.5 failed with "Unsupported compiler family DPClang". Both of its compiler-ID checks now accept `DPClang` too. On Windows CMake 4.5 identifies clang-cl of the open source DPC++ as `DPClang` with the MSVC-like command line and reuses the Clang platform rules for it. The checks that pick `/W3` over `-Wall` for clang-cl and link clang-cl targets through the compiler driver now match `DPClang` as well. --- CHANGELOG.md | 1 + cmake/IntelSYCLConfig.cmake | 3 +++ cmake/WindowsClangClLinkRules.cmake | 2 +- dpctl/CMakeLists.txt | 2 +- libsyclinterface/CMakeLists.txt | 2 +- 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9eb1d2f1f..fc11a54888 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Removed stale `select_host_device` and `has_host_device` names from `dpctl.__all__`, which made `from dpctl import *` fail with `AttributeError` [gh-2410](https://github.com/IntelPython/dpctl/pull/2410) * A USM allocation that fails now drops the references held for offloaded tasks that have completed, and is attempted once more if that released anything, so that memory only waiting to be given up is not reported as unavailable [gh-2359](https://github.com/IntelPython/dpctl/pull/2359) * `dpctl.SyclPlatform.get_devices` no longer prints Unified Runtime warnings for `device_type="custom"` on non-OpenCL platforms, where custom devices are not supported [gh-2306](https://github.com/IntelPython/dpctl/pull/2306) +* Fixed building with the open source DPC++ compiler and CMake 4.5 or newer, which identifies it as `DPClang` instead of `Clang` [gh-XXXX](https://github.com/IntelPython/dpctl/pull/XXXX) ### Maintenance * Removed the `-fno-sycl-id-queries-fit-in-int` compile option, which none of the `dpctl` extensions need since `dpctl.tensor` moved to `dpnp` [gh-2413](https://github.com/IntelPython/dpctl/pull/2413) diff --git a/cmake/IntelSYCLConfig.cmake b/cmake/IntelSYCLConfig.cmake index 5994c35b1d..a0cf766fe1 100644 --- a/cmake/IntelSYCLConfig.cmake +++ b/cmake/IntelSYCLConfig.cmake @@ -102,8 +102,10 @@ if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "x") endif() # Check for known compiler family that supports SYCL +# (CMake 4.5 and newer identify the open source DPC++ 7.0 and newer as DPClang) if( NOT "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang" AND + NOT "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xDPClang" AND NOT "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntelLLVM") set(IntelSYCL_FOUND False) set(SYCL_REASON_FAILURE "Unsupported compiler family ${CMAKE_CXX_COMPILER_ID} and compiler ${CMAKE_CXX_COMPILER}!!") @@ -247,6 +249,7 @@ set(SYCL_LINK_FLAGS "") # Based on Compiler ID, add support for SYCL if( "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang" OR + "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xDPClang" OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntelLLVM") list(APPEND SYCL_FLAGS "-fsycl") list(APPEND SYCL_LINK_FLAGS "-fsycl") diff --git a/cmake/WindowsClangClLinkRules.cmake b/cmake/WindowsClangClLinkRules.cmake index d900d7e383..71ceffa903 100644 --- a/cmake/WindowsClangClLinkRules.cmake +++ b/cmake/WindowsClangClLinkRules.cmake @@ -8,7 +8,7 @@ if(CMAKE_GENERATOR MATCHES "Visual Studio") endif() foreach(_lang C CXX) - if(NOT CMAKE_${_lang}_COMPILER_ID STREQUAL "Clang" + if(NOT CMAKE_${_lang}_COMPILER_ID MATCHES "^(Clang|DPClang)$" OR NOT CMAKE_${_lang}_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC" OR CMAKE_${_lang}_LINK_MODE STREQUAL "DRIVER") continue() diff --git a/dpctl/CMakeLists.txt b/dpctl/CMakeLists.txt index dab02b8117..069e75d11c 100644 --- a/dpctl/CMakeLists.txt +++ b/dpctl/CMakeLists.txt @@ -7,7 +7,7 @@ find_package(Cython REQUIRED) if(WIN32) # clang-cl reads -Wall as /Wall, i.e. -Weverything - if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + if(CMAKE_CXX_COMPILER_ID MATCHES "^(Clang|DPClang)$") set(_dpctl_wall_flag "/W3 ") else() set(_dpctl_wall_flag "-Wall ") diff --git a/libsyclinterface/CMakeLists.txt b/libsyclinterface/CMakeLists.txt index 87e4ceb23b..dabd73095c 100644 --- a/libsyclinterface/CMakeLists.txt +++ b/libsyclinterface/CMakeLists.txt @@ -182,7 +182,7 @@ set(CMAKE_CXX_STANDARD 17) if(WIN32) # clang-cl reads -Wall as /Wall, i.e. -Weverything - if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + if(CMAKE_CXX_COMPILER_ID MATCHES "^(Clang|DPClang)$") set(_dpctl_wall_flag "/W3 ") else() set(_dpctl_wall_flag "-Wall ") From 570d572f122adcee284bab7277f8de8bd3887e55 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Tue, 1 Dec 2026 13:06:16 +0100 Subject: [PATCH 2/2] Add gh-2433 to the changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc11a54888..d3fa840adf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,7 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Removed stale `select_host_device` and `has_host_device` names from `dpctl.__all__`, which made `from dpctl import *` fail with `AttributeError` [gh-2410](https://github.com/IntelPython/dpctl/pull/2410) * A USM allocation that fails now drops the references held for offloaded tasks that have completed, and is attempted once more if that released anything, so that memory only waiting to be given up is not reported as unavailable [gh-2359](https://github.com/IntelPython/dpctl/pull/2359) * `dpctl.SyclPlatform.get_devices` no longer prints Unified Runtime warnings for `device_type="custom"` on non-OpenCL platforms, where custom devices are not supported [gh-2306](https://github.com/IntelPython/dpctl/pull/2306) -* Fixed building with the open source DPC++ compiler and CMake 4.5 or newer, which identifies it as `DPClang` instead of `Clang` [gh-XXXX](https://github.com/IntelPython/dpctl/pull/XXXX) +* Fixed building with the open source DPC++ compiler and CMake 4.5 or newer, which identifies it as `DPClang` instead of `Clang` [gh-2433](https://github.com/IntelPython/dpctl/pull/2433) ### Maintenance * Removed the `-fno-sycl-id-queries-fit-in-int` compile option, which none of the `dpctl` extensions need since `dpctl.tensor` moved to `dpnp` [gh-2413](https://github.com/IntelPython/dpctl/pull/2413)