Skip to content

Commit 9159957

Browse files
committed
Add any-target-is- features
1 parent 64bccab commit 9159957

File tree

5 files changed

+19
-10
lines changed

5 files changed

+19
-10
lines changed

sycl/test-e2e/E2EExpr.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ class E2EExpr(BooleanExpression):
88
"target-nvidia",
99
"target-amd",
1010
"target-native_cpu",
11+
"any-target-is-spir",
12+
"any-target-is-nvidia",
13+
"any-target-is-amd",
14+
"any-target-is-native_cpu",
1115
"linux",
1216
"system-linux",
1317
"windows",

sycl/test-e2e/Regression/multiple-targets.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
// It tests if the target triples can be specified with any order.
33
// The test is repeated for per_kernel device code splitting.
44
//
5-
// REQUIRES: target-nvidia || target-amd || target-native_cpu
6-
// RUN: %clangxx -fsycl -fsycl-targets=%{sycl_triple},spir64 %if any-device-is-hip %{ %{hip_arch_opts} %} -o %t1.out %s
5+
// REQUIRES: (target-nvidia || target-amd || target-native_cpu) && any-target-is-spir
6+
// RUN: %clangxx -fsycl -fsycl-targets=%{sycl_triple},spir64 %if any-target-is-amd %{ %{hip_arch_opts} %} -o %t1.out %s
77
// RUN: %{run} %t1.out
88
//
9-
// RUN: %clangxx -fsycl -fsycl-targets=spir64,%{sycl_triple} %if any-device-is-hip %{ %{hip_arch_opts} %} -o %t2.out %s
9+
// RUN: %clangxx -fsycl -fsycl-targets=spir64,%{sycl_triple} %if any-target-is-amd %{ %{hip_arch_opts} %} -o %t2.out %s
1010
// RUN: %{run} %t2.out
1111
//
12-
// RUN: %clangxx -fsycl -fsycl-targets=%{sycl_triple},spir64 %if any-device-is-hip %{ %{hip_arch_opts} %} -fsycl-device-code-split=per_kernel -o %t3.out %s
12+
// RUN: %clangxx -fsycl -fsycl-targets=%{sycl_triple},spir64 %if any-target-is-amd %{ %{hip_arch_opts} %} -fsycl-device-code-split=per_kernel -o %t3.out %s
1313
// RUN: %{run} %t3.out
1414
//
15-
// RUN: %clangxx -fsycl -fsycl-targets=spir64,%{sycl_triple} %if any-device-is-hip %{ %{hip_arch_opts} %} -fsycl-device-code-split=per_kernel -o %t4.out %s
15+
// RUN: %clangxx -fsycl -fsycl-targets=spir64,%{sycl_triple} %if any-target-is-amd %{ %{hip_arch_opts} %} -fsycl-device-code-split=per_kernel -o %t4.out %s
1616
// RUN: %{run} %t4.out
1717

1818
#include <sycl/detail/core.hpp>

sycl/test-e2e/format.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,6 @@ def get_extra_env(sycl_devices):
288288

289289
substitutions.append(("%{run-unfiltered-devices}", run_unfiltered_substitution))
290290

291-
for target in build_targets:
292-
test.config.available_features.add(target)
293-
294291
new_script = []
295292
for directive in script:
296293
if not isinstance(directive, lit.TestRunner.CommandDirective):

sycl/test-e2e/lit.cfg.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
elif config.test_mode == "build-only":
7070
lit_config.note("build-only test mode enabled, only compiling tests")
7171
config.sycl_devices = []
72-
config.sycl_build_targets = set("target-" + t for t in config.sycl_build_targets)
7372
if not config.amd_arch:
7473
config.amd_arch = "gfx1031"
7574
else:
@@ -697,12 +696,21 @@ def open_check_file(file_name):
697696
"Couldn't find pre-installed AOT device compiler " + aot_tool
698697
)
699698

699+
# Clear build targets when not in build-only, to populate according to devices
700+
if config.test_mode != "build-only":
701+
config.sycl_build_targets = set()
702+
700703
for sycl_device in config.sycl_devices:
701704
be, dev = sycl_device.split(":")
702705
config.available_features.add("any-device-is-" + dev)
703706
# Use short names for LIT rules.
704707
config.available_features.add("any-device-is-" + be)
705708

709+
target = config.backend_to_target[be]
710+
config.sycl_build_targets.add(target)
711+
712+
for target in config.sycl_build_targets:
713+
config.available_features.add("any-target-is-" + target.replace("target-",""))
706714
# That has to be executed last so that all device-independent features have been
707715
# discovered already.
708716
config.sycl_dev_features = {}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ config.igc_tag_file = os.path.join("/usr/local/lib/igc/", 'IGCTAG.txt')
3131
config.sycl_devices = lit_config.params.get("sycl_devices", "@SYCL_TEST_E2E_TARGETS@").split(';')
3232

3333
# FIXME: current test markup only supports spir in build-only
34-
config.sycl_build_targets = lit_config.params.get("sycl_build_targets", "spir").split(';')
34+
config.sycl_build_targets = set("target-" + t for t in lit_config.params.get("sycl_build_targets", "spir").split(';'))
3535

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

0 commit comments

Comments
 (0)