Skip to content

Commit d411af4

Browse files
authored
[SYCL][E2E] Add autodetection for build targets (#17141)
Based on the output of `clang++ --print-targets`
1 parent a5de188 commit d411af4

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

sycl/test-e2e/lit.cfg.py

+11
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,17 @@ def open_check_file(file_name):
525525
if not sycl_ls:
526526
lit_config.fatal("can't find `sycl-ls`")
527527

528+
if (
529+
len(config.sycl_build_targets) == 1
530+
and next(iter(config.sycl_build_targets)) == "target-all"
531+
):
532+
config.sycl_build_targets = {"target-spir"}
533+
sp = subprocess.getstatusoutput(config.dpcpp_compiler + " --print-targets")
534+
if "nvptx64" in sp[1]:
535+
config.sycl_build_targets.add("target-nvidia")
536+
if "amdgcn" in sp[1]:
537+
config.sycl_build_targets.add("target-amd")
538+
528539
if len(config.sycl_devices) == 1 and config.sycl_devices[0] == "all":
529540
devices = set()
530541
cmd = (

sycl/test-e2e/lit.site.cfg.py.in

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ config.igc_tag_file = os.path.join("/usr/local/lib/igc/", 'IGCTAG.txt')
3030

3131
config.sycl_devices = lit_config.params.get("sycl_devices", "@SYCL_TEST_E2E_TARGETS@").split(';')
3232

33-
config.sycl_build_targets = set("target-" + t for t in lit_config.params.get("sycl_build_targets", "spir").split(';'))
33+
config.sycl_build_targets = set("target-" + t for t in lit_config.params.get(
34+
"sycl_build_targets", "all").split(';'))
3435

3536
config.amd_arch = lit_config.params.get("amd_arch", "@AMD_ARCH@")
3637
config.sycl_threads_lib = '@SYCL_THREADS_LIB@'

0 commit comments

Comments
 (0)