Skip to content

Commit 3e207f0

Browse files
committed
Relax Intel build-tree OpenMP assumptions
1 parent 71dcbb6 commit 3e207f0

1 file changed

Lines changed: 10 additions & 18 deletions

File tree

scripts/ci/sycl_x86_setup.py

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,7 @@ def linux_native_cpu_toolchain_ready(toolchain_root: Path) -> bool:
4040
find_file([toolchain_root], "remangled-l64-signed_char.libspirv.bc")
4141
is not None
4242
)
43-
has_openmp_runtime = (
44-
find_file([toolchain_root], "libiomp5.so") is not None
45-
or find_file([toolchain_root], "libomp.so") is not None
46-
)
47-
has_openmp_header = find_file([toolchain_root], "omp.h") is not None
48-
return (
49-
has_compiler
50-
and has_runtime
51-
and has_native_cpu_libspirv
52-
and has_openmp_runtime
53-
and has_openmp_header
54-
)
43+
return has_compiler and has_runtime and has_native_cpu_libspirv
5544

5645

5746
def configure_platform(platform: str) -> None:
@@ -252,8 +241,10 @@ def setup_unix_compilers(sycl_root: Path) -> None:
252241
library_roots = [sycl_root]
253242
sycl_runtime_dirs: list[Path] = []
254243

244+
source_built_linux_toolchain = False
255245
if require_env("RUNNER_OS") == "Linux":
256246
compiler_root = Path(require_env("SYCL_ROOT"))
247+
source_built_linux_toolchain = not os.environ.get("TOOLCHAIN_ASSET")
257248
cc_candidates = [
258249
compiler_root / "bin" / "icx",
259250
compiler_root / "bin" / "clang",
@@ -291,7 +282,7 @@ def setup_unix_compilers(sycl_root: Path) -> None:
291282
openmp_library = find_file([sycl_root, Path("/opt/intel/oneapi")], "libomp.so")
292283
openmp_library_name = "omp"
293284
openmp_flags = "-fopenmp"
294-
if openmp_library is None:
285+
if openmp_library is None and not source_built_linux_toolchain:
295286
main_error("Unable to locate an Intel toolchain OpenMP runtime library")
296287

297288
resource_dir = Path(capture([str(cxx_path), "-print-resource-dir"]))
@@ -303,15 +294,16 @@ def setup_unix_compilers(sycl_root: Path) -> None:
303294
],
304295
"omp.h",
305296
)
306-
if openmp_header is None:
297+
if openmp_header is None and not source_built_linux_toolchain:
307298
main_error(
308299
"Unable to locate Intel-provided omp.h under the SYCL toolchain"
309300
)
310301

311-
write_env("ITLABAI_OPENMP_FLAGS", openmp_flags)
312-
write_env("ITLABAI_OPENMP_LIBRARY_NAME", openmp_library_name)
313-
write_env("ITLABAI_OPENMP_LIBRARY", str(openmp_library))
314-
write_env("ITLABAI_OPENMP_INCLUDE_DIR", str(openmp_header.parent))
302+
if openmp_library is not None and openmp_header is not None:
303+
write_env("ITLABAI_OPENMP_FLAGS", openmp_flags)
304+
write_env("ITLABAI_OPENMP_LIBRARY_NAME", openmp_library_name)
305+
write_env("ITLABAI_OPENMP_LIBRARY", str(openmp_library))
306+
write_env("ITLABAI_OPENMP_INCLUDE_DIR", str(openmp_header.parent))
315307

316308
libsycl = find_file(library_roots + [sycl_root], "libsycl.so.8")
317309
if libsycl is None:

0 commit comments

Comments
 (0)