|
33 | 33 | CLIB_EXT = ".dll" if IS_WINDOWS else ".so" |
34 | 34 | SHARED_FLAG = "/DLL" if IS_WINDOWS else "-shared" |
35 | 35 | SYCL_FLAG = "-fsycl" |
| 36 | +ABI_FLAG = "-fpreview-breaking-changes" if IS_LINUX else "" |
36 | 37 |
|
37 | 38 | MINIMUM_GCC_VERSION = (5, 0, 0) |
38 | 39 | MINIMUM_MSVC_VERSION = (19, 0, 24215) |
@@ -321,7 +322,7 @@ def _gen_link_lib_cmd_line( |
321 | 322 |
|
322 | 323 | libraries_args = [] |
323 | 324 | libraries_args += [f"-l{x}" for x in libraries] |
324 | | - common_args = [SHARED_FLAG] + [SYCL_FLAG] |
| 325 | + common_args = [SHARED_FLAG] + [SYCL_FLAG] + [ABI_FLAG] |
325 | 326 |
|
326 | 327 | """ |
327 | 328 | link command formats: |
@@ -452,7 +453,7 @@ def unix_wrap_ninja_link_shared_object( |
452 | 453 | # create output directories avoid linker error. |
453 | 454 | create_parent_dirs_by_path(output_libname) |
454 | 455 |
|
455 | | - ldflags = [SHARED_FLAG] + [SYCL_FLAG] |
| 456 | + ldflags = [SHARED_FLAG] + [SYCL_FLAG] + [ABI_FLAG] |
456 | 457 | ldflags += [f"-L{x}" for x in library_dirs] |
457 | 458 | ldflags += [f"-L{x}" for x in runtime_library_dirs] |
458 | 459 | ldflags += extra_postargs |
@@ -510,7 +511,7 @@ def spawn(cmd): |
510 | 511 |
|
511 | 512 | if "-fPIC" in cflags: # Windows does not support this argument |
512 | 513 | cflags.remove("-fPIC") |
513 | | - cflags = cflags + ["-std=c++17", SYCL_FLAG] |
| 514 | + cflags = cflags + ["-std=c++17", SYCL_FLAG, ABI_FLAG] |
514 | 515 |
|
515 | 516 | cmd = [_bin, "-c", src, "-o", obj] + include_list + cflags |
516 | 517 | elif isinstance(self.cflags, dict): |
@@ -1004,9 +1005,11 @@ def library_paths() -> List[str]: |
1004 | 1005 | def _prepare_compile_flags(extra_compile_args): |
1005 | 1006 | if isinstance(extra_compile_args, List): |
1006 | 1007 | extra_compile_args.append(SYCL_FLAG) |
| 1008 | + extra_compile_args.append(ABI_FLAG) |
1007 | 1009 | elif isinstance(extra_compile_args, dict): |
1008 | 1010 | cl_flags = extra_compile_args.get("cxx", []) |
1009 | 1011 | cl_flags.append(SYCL_FLAG) |
| 1012 | + cl_flags.append(ABI_FLAG) |
1010 | 1013 | extra_compile_args["cxx"] = cl_flags |
1011 | 1014 |
|
1012 | 1015 | return extra_compile_args |
@@ -1048,7 +1051,7 @@ def _prepare_ldflags(extra_ldflags, verbose, is_standalone): |
1048 | 1051 | oneapi_link_args += ["-Wl,--start-group"] |
1049 | 1052 | oneapi_link_args += [f"{x}" for x in get_one_api_help().get_onemkl_libraries()] |
1050 | 1053 | oneapi_link_args += ["-Wl,--end-group"] |
1051 | | - oneapi_link_args += ["-lsycl", "-lOpenCL", "-lpthread", "-lm", "-ldl"] |
| 1054 | + oneapi_link_args += ["-lOpenCL", "-lpthread", "-lm", "-ldl"] |
1052 | 1055 |
|
1053 | 1056 | # Append IPEX link parameters. |
1054 | 1057 | oneapi_link_args += ["-lintel-ext-pt-gpu"] |
@@ -1244,7 +1247,12 @@ def object_file_path(source_file: str) -> str: |
1244 | 1247 | return target |
1245 | 1248 |
|
1246 | 1249 | objects = [object_file_path(src) for src in sources] |
1247 | | - ldflags = ([] if is_standalone else [SHARED_FLAG]) + [SYCL_FLAG] + extra_ldflags |
| 1250 | + ldflags = ( |
| 1251 | + ([] if is_standalone else [SHARED_FLAG]) |
| 1252 | + + [SYCL_FLAG] |
| 1253 | + + [ABI_FLAG] |
| 1254 | + + extra_ldflags |
| 1255 | + ) |
1248 | 1256 |
|
1249 | 1257 | # The darwin linker needs explicit consent to ignore unresolved symbols. |
1250 | 1258 | if IS_MACOS: |
|
0 commit comments