Skip to content
This repository was archived by the owner on Jul 22, 2026. It is now read-only.

Commit fca6f3b

Browse files
committed
Fix Windows SYCL linking and ccache
1 parent 3461caa commit fca6f3b

5 files changed

Lines changed: 24 additions & 4 deletions

File tree

.github/workflows/sycl-ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,10 @@ jobs:
121121
uses: seanmiddleditch/gha-setup-ninja@v6
122122

123123
- name: Setup ccache
124-
uses: Chocobo1/setup-ccache-action@v1
124+
uses: hendrikmuhs/ccache-action@v1.2
125125
with:
126-
windows_compile_environment: msvc
126+
key: ccache-${{ github.job }}-${{ matrix.build_type }}
127+
max-size: 2G
127128

128129
- name: Setup MSVC environment
129130
uses: ilammy/msvc-dev-cmd@v1

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ set(ITLABAI_SYCL_TARGETS "" CACHE STRING
1414
"Optional SYCL targets; forwarded to AdaptiveCpp as ACPP_TARGETS or IntelLLVM as -fsycl-targets")
1515
set(ITLABAI_SYCL_ROOT "" CACHE PATH
1616
"Optional root directory of the SYCL toolchain; used to expose SYCL headers to host-only sources")
17+
set(ITLABAI_SYCL_LIBRARY "" CACHE FILEPATH
18+
"Optional Intel SYCL runtime import library; used for Windows host linking")
1719

1820
option(ENABLE_STATISTIC_TENSORS "Enable statistic tensors" OFF)
1921

app/SYCL/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ elseif(ITLABAI_SYCL_IMPLEMENTATION STREQUAL "IntelLLVM"
1111
target_include_directories(SYCL_Example PRIVATE "${ITLABAI_SYCL_ROOT}/include")
1212
endif()
1313

14-
if(ITLABAI_SYCL_IMPLEMENTATION STREQUAL "IntelLLVM")
14+
if(ITLABAI_SYCL_IMPLEMENTATION STREQUAL "IntelLLVM" AND NOT WIN32)
1515
target_link_options(SYCL_Example PRIVATE -fsycl)
1616
if(ITLABAI_SYCL_TARGETS)
1717
target_link_options(SYCL_Example PRIVATE
@@ -30,6 +30,11 @@ if(WIN32 AND ITLABAI_SYCL_IMPLEMENTATION STREQUAL "IntelLLVM")
3030
message(FATAL_ERROR
3131
"Windows IntelLLVM SYCL build requires clang++.exe under ITLABAI_SYCL_ROOT")
3232
endif()
33+
if(NOT ITLABAI_SYCL_LIBRARY OR NOT EXISTS "${ITLABAI_SYCL_LIBRARY}")
34+
message(FATAL_ERROR
35+
"Windows IntelLLVM SYCL build requires ITLABAI_SYCL_LIBRARY "
36+
"to point to the runtime import library")
37+
endif()
3338

3439
set(SYCL_EXAMPLE_KERNEL_OBJECT
3540
"${CMAKE_CURRENT_BINARY_DIR}/SYCL_Example.sycl_kernel.obj")
@@ -61,6 +66,7 @@ if(WIN32 AND ITLABAI_SYCL_IMPLEMENTATION STREQUAL "IntelLLVM")
6166
EXTERNAL_OBJECT TRUE
6267
GENERATED TRUE
6368
)
69+
target_link_libraries(SYCL_Example PRIVATE "${ITLABAI_SYCL_LIBRARY}")
6470
else()
6571
add_library(SYCL_Example_kernel OBJECT sycl_kernel.cpp)
6672
itlabai_add_sycl_to_target(TARGET SYCL_Example_kernel SOURCES

scripts/ci/sycl_configure.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
import os
6+
import shutil
67
import sys
78

89
from common import main_error, require_env, run
@@ -15,7 +16,7 @@ def main() -> None:
1516
build_type, opencv_apps = sys.argv[1:]
1617

1718
cmake_args = []
18-
if require_env("RUNNER_OS") != "Windows":
19+
if shutil.which("ccache"):
1920
cmake_args.extend(
2021
[
2122
"-DCMAKE_C_COMPILER_LAUNCHER=ccache",
@@ -58,6 +59,9 @@ def main() -> None:
5859
itlabai_sycl_root = os.environ.get("SYCL_ROOT", "")
5960
if itlabai_sycl_root:
6061
cmake_args.append(f"-DITLABAI_SYCL_ROOT={itlabai_sycl_root}")
62+
itlabai_sycl_library = os.environ.get("ITLABAI_SYCL_LIBRARY", "")
63+
if itlabai_sycl_library:
64+
cmake_args.append(f"-DITLABAI_SYCL_LIBRARY={itlabai_sycl_library}")
6165

6266
c_flags = os.environ.get("ITLABAI_C_FLAGS", "")
6367
cxx_flags = os.environ.get("ITLABAI_CXX_FLAGS", "")

scripts/ci/sycl_x86_setup.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,17 @@ def setup_windows_compilers(sycl_root: Path) -> None:
228228
sycl_root / "bin" / "clang++.exe",
229229
]
230230
)
231+
sycl_library = find_first_existing(
232+
[
233+
sycl_root / "lib" / "sycl8.lib",
234+
sycl_root / "lib" / "sycl.lib",
235+
]
236+
)
231237

232238
write_env("ITLABAI_CC", cygpath("m", cc_path))
233239
write_env("ITLABAI_CXX", cygpath("m", cxx_path))
234240
write_env("ITLABAI_CMAKE_PREFIX_PATH", cygpath("m", sycl_root))
241+
write_env("ITLABAI_SYCL_LIBRARY", cygpath("m", sycl_library))
235242
append_path(cygpath("m", sycl_root / "bin"))
236243

237244

0 commit comments

Comments
 (0)