From bed074b777d356031cbd3f496999b14e9292c567 Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Mon, 15 Dec 2025 17:23:33 -0800 Subject: [PATCH 1/3] align cmake for finding compiler with changes to OS compiler versioning --- libsyclinterface/cmake/modules/FindIntelSyclCompiler.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libsyclinterface/cmake/modules/FindIntelSyclCompiler.cmake b/libsyclinterface/cmake/modules/FindIntelSyclCompiler.cmake index fcc3eebafc..172a9b3150 100644 --- a/libsyclinterface/cmake/modules/FindIntelSyclCompiler.cmake +++ b/libsyclinterface/cmake/modules/FindIntelSyclCompiler.cmake @@ -100,6 +100,10 @@ if(${clangxx_result} MATCHES "0") MATH(EXPR IDX "${IDX}+1") endforeach() list(GET IntelSyclCompiler_VERSION_LIST 0 VERSION_STRING) + if("${VERSION_STRING}" MATCHES "Intel SYCL compiler Nightly") + # Handle nightly build version string + list(GET IntelSyclCompiler_VERSION_LIST 1 VERSION_STRING) + endif() # Get the dpcpp version string(REGEX MATCH From 3c380c9713ed84ae7a120343002d3fc2157e5ccc Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Wed, 17 Dec 2025 03:08:08 -0800 Subject: [PATCH 2/3] refactor finding Intel SYCL compiler version now more robust, with an option for clang versioning (OS compiler) and DPC++ versioning --- .../cmake/modules/FindIntelSyclCompiler.cmake | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/libsyclinterface/cmake/modules/FindIntelSyclCompiler.cmake b/libsyclinterface/cmake/modules/FindIntelSyclCompiler.cmake index 172a9b3150..e8de718472 100644 --- a/libsyclinterface/cmake/modules/FindIntelSyclCompiler.cmake +++ b/libsyclinterface/cmake/modules/FindIntelSyclCompiler.cmake @@ -95,24 +95,26 @@ execute_process( if(${clangxx_result} MATCHES "0") string(REPLACE "\n" ";" IntelSyclCompiler_VERSION_LIST "${clangxx_ver}") set(IDX 0) + set(IntelSyclCompiler_VERSION "") foreach(X ${IntelSyclCompiler_VERSION_LIST}) message(STATUS "dpcpp ver[${IDX}]: ${X}") - MATH(EXPR IDX "${IDX}+1") - endforeach() - list(GET IntelSyclCompiler_VERSION_LIST 0 VERSION_STRING) - if("${VERSION_STRING}" MATCHES "Intel SYCL compiler Nightly") - # Handle nightly build version string - list(GET IntelSyclCompiler_VERSION_LIST 1 VERSION_STRING) - endif() + if("x${IntelSyclCompiler_VERSION}" STREQUAL "x") + # Match 'clang version xx.x.x' + string(REGEX MATCH "^.*clang version [0-9]+\\.[0-9]+\\.[0-9]+.*$" _clang_match "${X}") + if(_clang_match) + string(REGEX REPLACE "^.*clang version ([0-9]+\\.[0-9]+\\.[0-9]+).*$" "\\1" IntelSyclCompiler_VERSION "${X}") + endif() - # Get the dpcpp version - string(REGEX MATCH - "[0-9]+\.[0-9]+\.[0-9]+" - IntelSyclCompiler_VERSION - ${VERSION_STRING} - ) + # Match 'Intel(R) oneAPI DPC++/C++ Compiler xxxx.x.x (...)' + string(REGEX MATCH "^.*Intel\\(R\\) oneAPI DPC\\+\\+\\/C\\+\\+ Compiler [0-9]+\\.[0-9]+\\.[0-9]+.*$" _oneapi_match "${X}") + if(_oneapi_match) + string(REGEX REPLACE "^.*Intel\\(R\\) oneAPI DPC\\+\\+\\/C\\+\\+ Compiler ([0-9]+\\.[0-9]+\\.[0-9]+).*$" "\\1" IntelSyclCompiler_VERSION "${X}") + endif() + endif() + math(EXPR IDX "${IDX}+1") + endforeach() - # Split out the version into major, minor an patch + # Split out the version into major, minor and patch string(REPLACE "." ";" IntelSyclCompiler_VERSION_LIST1 "${IntelSyclCompiler_VERSION}") list(GET IntelSyclCompiler_VERSION_LIST1 0 IntelSyclCompiler_VERSION_MAJOR) list(GET IntelSyclCompiler_VERSION_LIST1 1 IntelSyclCompiler_VERSION_MINOR) From 04a9f04d7eb42868798f3dba59572de4c99ddcaf Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Wed, 17 Dec 2025 11:22:24 -0800 Subject: [PATCH 3/3] apply review suggestion --- libsyclinterface/cmake/modules/FindIntelSyclCompiler.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsyclinterface/cmake/modules/FindIntelSyclCompiler.cmake b/libsyclinterface/cmake/modules/FindIntelSyclCompiler.cmake index e8de718472..039c115878 100644 --- a/libsyclinterface/cmake/modules/FindIntelSyclCompiler.cmake +++ b/libsyclinterface/cmake/modules/FindIntelSyclCompiler.cmake @@ -102,13 +102,13 @@ if(${clangxx_result} MATCHES "0") # Match 'clang version xx.x.x' string(REGEX MATCH "^.*clang version [0-9]+\\.[0-9]+\\.[0-9]+.*$" _clang_match "${X}") if(_clang_match) - string(REGEX REPLACE "^.*clang version ([0-9]+\\.[0-9]+\\.[0-9]+).*$" "\\1" IntelSyclCompiler_VERSION "${X}") + string(REGEX REPLACE "^.*clang version ([0-9]+\\.[0-9]+\\.[0-9]+).*$" "\\1" IntelSyclCompiler_VERSION "${_clang_match}") endif() # Match 'Intel(R) oneAPI DPC++/C++ Compiler xxxx.x.x (...)' string(REGEX MATCH "^.*Intel\\(R\\) oneAPI DPC\\+\\+\\/C\\+\\+ Compiler [0-9]+\\.[0-9]+\\.[0-9]+.*$" _oneapi_match "${X}") if(_oneapi_match) - string(REGEX REPLACE "^.*Intel\\(R\\) oneAPI DPC\\+\\+\\/C\\+\\+ Compiler ([0-9]+\\.[0-9]+\\.[0-9]+).*$" "\\1" IntelSyclCompiler_VERSION "${X}") + string(REGEX REPLACE "^.*Intel\\(R\\) oneAPI DPC\\+\\+\\/C\\+\\+ Compiler ([0-9]+\\.[0-9]+\\.[0-9]+).*$" "\\1" IntelSyclCompiler_VERSION "${_oneapi_match}") endif() endif() math(EXPR IDX "${IDX}+1")