-
Notifications
You must be signed in to change notification settings - Fork 80
WIP Remove -fsycl-host-compiler, use pure icpx compilation #2994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
81eaa36
071fc3a
c7319f2
dd699a9
88090d9
7a226e8
cd86de4
2cd8cdc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -57,7 +57,8 @@ macro(set_build_flags) | |||||||||||||||||||||||||||||||||
| list(APPEND SYCL_HOST_FLAGS -fPIC) | ||||||||||||||||||||||||||||||||||
| list(APPEND SYCL_HOST_FLAGS -std=${CPP_STD}) | ||||||||||||||||||||||||||||||||||
| list(APPEND SYCL_HOST_FLAGS -Wunused-variable) | ||||||||||||||||||||||||||||||||||
| list(APPEND SYCL_HOST_FLAGS -Wno-interference-size) | ||||||||||||||||||||||||||||||||||
| # Required for Intel compiler breaking changes; | ||||||||||||||||||||||||||||||||||
| list(APPEND SYCL_HOST_FLAGS -D__INTEL_PREVIEW_BREAKING_CHANGES) | ||||||||||||||||||||||||||||||||||
| # Some versions of DPC++ compiler pass paths to SYCL headers as user include paths (`-I`) rather | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
| # than system paths (`-isystem`). This makes host compiler to report warnings encountered in the | ||||||||||||||||||||||||||||||||||
| # SYCL headers, such as deprecated warnings, even if warned API is not actually used in the program. | ||||||||||||||||||||||||||||||||||
|
|
@@ -188,7 +189,7 @@ macro(set_build_flags) | |||||||||||||||||||||||||||||||||
| message(STATUS "Compile Intel GPU AOT Targets for ${AOT_TARGETS}") | ||||||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| set(SYCL_COMPILE_FLAGS ${SYCL_COMPILE_FLAGS} ${SYCL_KERNEL_OPTIONS}) | ||||||||||||||||||||||||||||||||||
| set(SYCL_COMPILE_FLAGS ${SYCL_COMPILE_FLAGS} ${SYCL_HOST_FLAGS} ${SYCL_KERNEL_OPTIONS}) | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
| set(SYCL_COMPILE_FLAGS ${SYCL_COMPILE_FLAGS} ${SYCL_HOST_FLAGS} ${SYCL_KERNEL_OPTIONS}) | |
| if(WIN32) | |
| # On Windows, SYCL_HOST_FLAGS may contain MSVC-style flags (/std:..., /MD, /EHsc). | |
| # Only pass these flags when the SYCL compiler is a CL-style driver that understands them. | |
| # Always add kernel options. | |
| set(SYCL_COMPILE_FLAGS ${SYCL_COMPILE_FLAGS} ${SYCL_KERNEL_OPTIONS}) | |
| if(SYCL_COMPILER MATCHES "icx-cl(\\.exe)?" | |
| OR SYCL_COMPILER MATCHES "dpcpp-cl(\\.exe)?" | |
| OR SYCL_COMPILER MATCHES "cl(\\.exe)?") | |
| # CL-style drivers: safe to add MSVC-style host flags. | |
| set(SYCL_COMPILE_FLAGS ${SYCL_HOST_FLAGS} ${SYCL_COMPILE_FLAGS}) | |
| endif() | |
| else() | |
| # Non-Windows: keep existing behavior. | |
| set(SYCL_COMPILE_FLAGS ${SYCL_COMPILE_FLAGS} ${SYCL_HOST_FLAGS} ${SYCL_KERNEL_OPTIONS}) | |
| endif() |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -41,17 +41,14 @@ set(SYCL_compile_definitions [==[@SYCL_compile_definitions@]==]) # list | |||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| list(REMOVE_DUPLICATES SYCL_INCLUDE_DIRS) | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
| list(REMOVE_DUPLICATES SYCL_INCLUDE_DIRS) | |
| list(REMOVE_DUPLICATES SYCL_include_dirs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is unrelated to this PR, but please rename it to SYCL_include_dirs
Copilot
AI
Mar 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After removing -fsycl-host-compiler* usage, the SYCL_host_compiler variable set near the top of this script is no longer referenced anywhere. Consider removing it from the generated script/template to avoid implying that a separate host compiler is still used.
Copilot
AI
Mar 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CMAKE_HOST_FLAGS can contain preprocessor defines in MSVC form (/D...) on Windows, but this loop only forwards flags that match ^-D. That means important defines from CMAKE_CXX_FLAGS may be silently dropped on WIN32 builds. Consider also matching /D (and forwarding it in the appropriate form for icx).
| # Extract -D defines from CMAKE_HOST_FLAGS and pass them directly to icpx, | |
| # since host compiler is removed. This is needed for macros like | |
| # HAVE_AVX512_CPU_DEFINITION that control signatures, to avoid | |
| # symbol mismatch with libtorch_cpu.so. | |
| if(flag MATCHES "^-D") | |
| list(APPEND SYCL_compile_flags "${flag}") | |
| # Extract -D (GCC/Clang) or /D (MSVC) defines from CMAKE_HOST_FLAGS and pass | |
| # them directly to the SYCL compiler, since the host compiler is removed. | |
| # This is needed for macros like HAVE_AVX512_CPU_DEFINITION that control | |
| # signatures, to avoid symbol mismatch with libtorch_cpu.so. | |
| if(flag MATCHES "^-D" OR flag MATCHES "^/D") | |
| if(flag MATCHES "^/D") | |
| string(REGEX REPLACE "^/D" "-D" converted_flag "${flag}") | |
| else() | |
| set(converted_flag "${flag}") | |
| endif() | |
| list(APPEND SYCL_compile_flags "${converted_flag}") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -259,3 +259,16 @@ set(__INTEL_LLVM_COMPILER "${__INTEL_LLVM_COMPILER}" CACHE STRING "Intel llvm co | |
|
|
||
| message(DEBUG "The SYCL compiler is ${SYCL_COMPILER}") | ||
| message(DEBUG "The SYCL Flags are ${SYCL_FLAGS}") | ||
|
|
||
| # Find Intel runtime library (libintlc), required when linking SYCL objects | ||
| # with a non-icpx linker (e.g. g++). icpx adds this automatically, but g++ | ||
| # does not, leading to undefined reference to '_intel_fast_memcpy' etc. | ||
| find_library( | ||
| SYCL_INTLC_LIBRARY | ||
| NAMES intlc | ||
| HINTS ${SYCL_LIBRARY_DIR} | ||
| NO_DEFAULT_PATH | ||
chunhuanMeng marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ) | ||
|
Comment on lines
+213
to
+221
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chunhuanMeng As we discussed, could you check original status of |
||
| if(SYCL_INTLC_LIBRARY) | ||
| list(APPEND SYCL_LIBRARY ${SYCL_INTLC_LIBRARY}) | ||
| endif() | ||
guangyey marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting! I think we could upstream this component to https://github.com/pytorch/pytorch/blob/main/cmake/Modules/FindSYCLToolkit.cmake
Comment on lines
+222
to
+224
|
||
Uh oh!
There was an error while loading. Please reload this page.