Skip to content

Adding treatment of ARM platforms if a SYCL-compatible compiler is detected#599

Open
christophriesinger wants to merge 3 commits into
RenderKit:masterfrom
christophriesinger:criesing/compiler_SYCL_capability_handling
Open

Adding treatment of ARM platforms if a SYCL-compatible compiler is detected#599
christophriesinger wants to merge 3 commits into
RenderKit:masterfrom
christophriesinger:criesing/compiler_SYCL_capability_handling

Conversation

@christophriesinger

Copy link
Copy Markdown

At least since Clang 19, LLVM Clang supports SYCL and thus, the -fsycl compiler argument. Hence, if such a LLVM Clang is detected by CMake, common/cmake/dpcpp.cmake gets included. Since LLVM Clang with support for the -fsycl compiler argument is also available for ARM platforms (e.g. Clang-cl for Windows on ARM) dpcpp.cmake has to make sure no arguments are passed to Clang not supported by ARM (e.g. -msse2).

This code changes copies the treatment for ARM platforms from clang.cmake to dpcpp.cmake.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates Embree’s SYCL (DPCPP/Clang -fsycl) CMake configuration to avoid passing x86-only compile flags when building on ARM platforms, mirroring the existing ARM handling in the Clang toolchain CMake.

Changes:

  • Add EMBREE_ARM-gated ISA flag definitions in dpcpp.cmake (including a macOS universal-binary x86_64 sub-case).
  • Adjust default (non-ARM) SSE2 flags in dpcpp.cmake to match the pattern used in clang.cmake.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread common/cmake/dpcpp.cmake Outdated
_SET_IF_EMPTY(FLAGS_AVX512 "-march=skx")
IF (EMBREE_ARM)
IF ("x86_64" IN_LIST CMAKE_OSX_ARCHITECTURES)
# set ARM an x86 flags for macOS universal binary build
Comment thread common/cmake/dpcpp.cmake Outdated
Comment on lines +25 to +27
# for `thread` keyword
_SET_IF_EMPTY(FLAGS_SSE2 "-msse -msse2 -mno-sse4.2")
_SET_IF_EMPTY(FLAGS_SSE42 "-msse4.2")
@stefanatwork stefanatwork self-requested a review June 18, 2026 11:40
@stefanatwork stefanatwork self-assigned this Jun 18, 2026
@stefanatwork stefanatwork requested a review from Copilot June 18, 2026 11:40
@stefanatwork stefanatwork added this to the 4.4.2 milestone Jun 18, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

Comment on lines +99 to +104
MACRO(APPLY_MACOS_FLAGS)
IF (APPLE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.7") # makes sure code runs on older MacOSX versions
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") # link against libc++ which supports C++11 features
ENDIF()
ENDMACRO()
Comment on lines +54 to +66
MACRO(CONFIGURE_STACK_PROTECTOR)
IF (EMBREE_STACK_PROTECTOR)
IF (WIN32 AND SYCL_ONEAPI_ICX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GS") # protects against return address overrides
ELSEIF (NOT WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector") # protects against return address overrides
ELSEIF (WIN32)
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /GS") # protects against return address overrides
ENDIF()
ELSEIF (WIN32)
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /GS-") # do not protect against return address overrides
ENDIF()
ENDMACRO()
Comment on lines +68 to +78
MACRO(DISABLE_STACK_PROTECTOR_FOR_FILE file)
IF (EMBREE_STACK_PROTECTOR)
IF (SYCL_ONEAPI_ICX AND WIN32)
SET_SOURCE_FILES_PROPERTIES(${file} PROPERTIES COMPILE_FLAGS "/GS-")
ELSEIF (NOT WIN32)
SET_SOURCE_FILES_PROPERTIES(${file} PROPERTIES COMPILE_FLAGS "-fno-stack-protector")
ELSEIF (WIN32)
SET_SOURCE_FILES_PROPERTIES(${file} PROPERTIES COMPILE_FLAGS "/GS-")
ENDIF()
ENDIF()
ENDMACRO()
Comment thread common/cmake/gnu.cmake
Comment on lines +31 to +41
IF (NOT APPLE)
IF (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") # issues link error for undefined symbols in shared library
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z noexecstack") # we do not need an executable stack
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z relro -z now") # re-arranges data sections to increase security
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -z noexecstack") # we do not need an executable stack
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -z relro -z now") # re-arranges data sections to increase security
ENDIF ()
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") # enables position independent execution for executable
ENDIF(APPLE)
ENDIF()

SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") # enables position independent execution for executable
SET(FLAGS_SSE42 "-D__SSE4_2__ -D__SSE4_1__ -msse4.2")
SET(FLAGS_AVX "-D__AVX__ -D__SSE4_2__ -D__SSE4_1__ -D__BMI__ -D__BMI2__ -D__LZCNT__ -mavx")
SET(FLAGS_AVX2 "-D__AVX2__ -D__AVX__ -D__SSE4_2__ -D__SSE4_1__ -D__BMI__ -D__BMI2__ -D__LZCNT__ -mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
_SET_IF_EMPTY(FLAGS_AVX512 "-march=skx")
_SET_IF_EMPTY(FLAGS_SSE42 "-msse4.2")
_SET_IF_EMPTY(FLAGS_AVX "-mavx")
_SET_IF_EMPTY(FLAGS_AVX2 "-mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
_SET_IF_EMPTY(FLAGS_AVX512 "-march=skx")
@anthony-linaro

Copy link
Copy Markdown
Contributor

I might be wrong here, but couldn't we just make a change here: https://github.com/RenderKit/embree/blob/master/CMakeLists.txt#L228, guarded by something like (untested)

if(EMBREE_ARM AND WIN32 AND ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT COMPILER_HAS_SYCL_SUPPORT)
    set(COMPILER_HAS_SYCL_SUPPORT OFF)
endif()

Which would bypass the entire dpcpp thing? The build instructions from #439 I wrote still work if you just add -DCOMPILER_HAS_SYCL_SUPPORT=OFF to the configure line on the current tip of main, no more changes needed.

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