Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYCL][E2E] Functionality for splitting build and run of e2e tests #15728

Draft
wants to merge 14 commits into
base: sycl
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/sycl-linux-run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ on:
- '["amdgpu"]'
- '["Linux", "arc"]'
- '["cts-cpu"]'
- '["Linux", "build"]'
image:
description: |
Use option ending with ":build" for AMDGPU, ":latest" for the rest.
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/sycl-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ jobs:
target_devices: ext_oneapi_hip:gpu
tests_selector: e2e

- name: Intel Build Tests Only
runner: '["Linux", "build"]'
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:alldeps
image_options: -u 1001 --privileged --cap-add SYS_ADMIN
target_devices: opencl:cpu
tests_selector: e2e
extra_lit_opts: --param split-mode=build

- name: Intel L0 GPU
runner: '["Linux", "gen12"]'
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest
Expand Down
80 changes: 69 additions & 11 deletions sycl/test-e2e/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,47 @@ def getMatchedFromList(self, features, alist):
except ValueError as e:
raise ValueError("Error in UNSUPPORTED list:\n%s" % str(e))

def make_default_features_list(self, expr, triple, add_default=True):
### EXCEPTIONS LIST
# TODO: Define elsewhere?
exceptions = {}
exceptions["spir64"]={
"cuda":False, "hip":False, "hip_amd":False, "hip_nvidia":False,
"native_cpu":False,
}
exceptions["system"]={
"linux":True, "windows":False, "system-windows":False,
"run-mode":False, "TEMPORARY_DISABLED":False,
}
queried_features = []
for f in expr:
queried_features = queried_features + re.findall("[-+=._a-zA-Z0-9]+", f)

features = []
for f in queried_features:
if (exceptions[triple].get(
f,exceptions["system"].get(f,add_default))):
features.append(f)
return features

def select_triples_for_test(self, test):
# Check Triples
triples = set()
possible_triples = ["spir64"]
for triple in possible_triples:
unsupported=self.make_default_features_list(test.unsupported,triple,False)
required=self.make_default_features_list(test.requires,triple)
xfails=self.make_default_features_list(test.xfails,triple,False)
if test.getMissingRequiredFeaturesFromList(required):
continue
if self.getMatchedFromList(unsupported, test.unsupported):
continue
#if "*" in test.xfails or self.getMatchedFromList(xfails, test.xfails):
# continue
triples.add(triple)

return triples

def select_devices_for_test(self, test):
devices = []
for d in test.config.sycl_devices:
Expand Down Expand Up @@ -154,18 +195,26 @@ def execute(self, test, litConfig):
if isinstance(script, lit.Test.Result):
return script

devices_for_test = self.select_devices_for_test(test)
if not devices_for_test:
return lit.Test.Result(
lit.Test.UNSUPPORTED, "No supported devices to run the test on"
)

substitutions = lit.TestRunner.getDefaultSubstitutions(test, tmpDir, tmpBase)
devices_for_test = []
triples = set()
for sycl_device in devices_for_test:
(backend, _) = sycl_device.split(":")
triples.add(get_triple(test, backend))
if "run-mode" not in test.config.available_features:
triples = self.select_triples_for_test(test)
if not triples:
return lit.Test.Result(
lit.Test.UNSUPPORTED, "No supported backend to build for"
)
else:
devices_for_test = self.select_devices_for_test(test)
if not devices_for_test:
return lit.Test.Result(
lit.Test.UNSUPPORTED, "No supported devices to run the test on"
)

for sycl_device in devices_for_test:
(backend, _) = sycl_device.split(":")
triples.add(get_triple(test, backend))

substitutions = lit.TestRunner.getDefaultSubstitutions(test, tmpDir, tmpBase)
substitutions.append(("%{sycl_triple}", format(",".join(triples))))
# -fsycl-targets is needed for CUDA/HIP, so just use it be default so
# -that new tests by default would runnable there (unless they have
Expand Down Expand Up @@ -223,6 +272,14 @@ def get_extra_env(sycl_devices):
new_script.append(directive)
continue

# Filter commands based on split-mode
is_run_line = any(i in directive.command for i in
["%{run}","%{run-unfiltered-devices}","%if run-mode"])

if ((is_run_line and "run-mode" not in test.config.available_features) or
(not is_run_line and "build-mode" not in test.config.available_features)):
directive.command=""

if "%{run}" not in directive.command:
new_script.append(directive)
continue
Expand Down Expand Up @@ -278,7 +335,8 @@ def get_extra_env(sycl_devices):
test, litConfig, useExternalSh, script, tmpBase
)

if len(devices_for_test) > 1:
if (len(devices_for_test) > 1 or
"run-mode" not in test.config.available_features):
return result

# Single device - might be an XFAIL.
Expand Down
10 changes: 10 additions & 0 deletions sycl/test-e2e/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@

# Configuration file for the 'lit' test runner.

# split-mode: Set if tests should run normally or with split build/run
match lit_config.params.get("split-mode","both"):
case "run":
config.available_features.add("run-mode")
case "build":
config.available_features.add("build-mode")
case _:
config.available_features.add("run-mode")
config.available_features.add("build-mode")

# name: The name of this test suite.
config.name = "SYCL"

Expand Down
Loading