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

Commit 360bade

Browse files
committed
Stage Intel OpenCL runtime for Windows SYCL
1 parent ddedd0c commit 360bade

1 file changed

Lines changed: 14 additions & 43 deletions

File tree

scripts/ci/sycl_test.py

Lines changed: 14 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
import shutil
56
import os
67
import subprocess
78
import sys
@@ -10,65 +11,35 @@
1011
from common import find_file
1112

1213

13-
def find_windows_tbb_runtime_dir() -> Path | None:
14-
build_root = Path("build").resolve()
15-
fallback: Path | None = None
16-
for current_root, _, files in os.walk(build_root):
17-
current_files = set(files)
18-
if "tbb12.dll" not in current_files:
19-
continue
20-
21-
candidate = Path(current_root)
22-
if "tbbmalloc.dll" in current_files or "tbbmalloc_proxy.dll" in current_files:
23-
return candidate
24-
if fallback is None:
25-
fallback = candidate
26-
27-
return fallback
28-
29-
30-
def configure_windows_opencl_tbb() -> None:
14+
def prepare_windows_opencl_runtime() -> None:
3115
if os.environ.get("RUNNER_OS") != "Windows":
3216
return
3317

3418
icd_path = os.environ.get("OCL_ICD_FILENAMES")
3519
if not icd_path:
3620
return
3721

38-
config_path = Path(icd_path).with_name("cl.cfg")
39-
if not config_path.exists():
22+
runtime_dir = Path(icd_path).resolve().parent
23+
runtime_opencl = runtime_dir / "OpenCL.dll"
24+
if not runtime_opencl.exists():
4025
return
4126

42-
tbb_runtime_dir = find_windows_tbb_runtime_dir()
43-
if tbb_runtime_dir is None:
27+
example_binary = find_file([Path("build").resolve()], "SYCL_Example.exe")
28+
if example_binary is None:
4429
return
4530

46-
tbb_dir = str(tbb_runtime_dir.resolve())
47-
existing_lines = config_path.read_text(encoding="utf-8").splitlines()
48-
updated_lines: list[str] = []
49-
updated = False
50-
for line in existing_lines:
51-
if line.strip().startswith("CL_CONFIG_TBB_DLL_PATH"):
52-
updated_lines.append(f"CL_CONFIG_TBB_DLL_PATH = {tbb_dir}")
53-
updated = True
54-
else:
55-
updated_lines.append(line)
56-
57-
if not updated:
58-
updated_lines.append(f"CL_CONFIG_TBB_DLL_PATH = {tbb_dir}")
59-
60-
config_path.write_text("\n".join(updated_lines) + "\n", encoding="utf-8")
61-
print(f"+ patched {config_path} with CL_CONFIG_TBB_DLL_PATH={tbb_dir}", flush=True)
31+
staged_opencl = example_binary.parent / runtime_opencl.name
32+
shutil.copy2(runtime_opencl, staged_opencl)
33+
print(
34+
f"+ staged {runtime_opencl} next to {example_binary}",
35+
flush=True,
36+
)
6237

6338

6439
def main() -> int:
65-
configure_windows_opencl_tbb()
40+
prepare_windows_opencl_runtime()
6641

6742
env = os.environ.copy()
68-
if os.environ.get("RUNNER_OS") == "Windows":
69-
tbb_runtime_dir = find_windows_tbb_runtime_dir()
70-
if tbb_runtime_dir is not None:
71-
env["PATH"] = f"{tbb_runtime_dir}{os.pathsep}{env.get('PATH', '')}"
7243

7344
device_selector = env.get("DEVICE_SELECTOR", "")
7445
if device_selector:

0 commit comments

Comments
 (0)