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] Add test to check REQUIRES #16019

Open
wants to merge 4 commits into
base: sycl
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// This test checks that all "REQUIRES", "XFAIL" and "UNSUPPORTED" strings
// contain the right feature names.
// If this test fails:
// 1. there is some typo/non-existing feature request in the
// modified test.
// 2. ...or, there is some new feature. In this case please update the set of
// features in check-correctness-of-requirements.py
//
// Get a set of all features passed to "REQUIRES", "XFAIL" and "UNSUPPORTED"
// RUN: llvm-lit --show-used-features %S/../../test-e2e > %t
//
// Process this set using a python script as it's easier to work with sets there
// RUN: python3 %S/check-correctness-of-requirements.py %t %sycl_include
119 changes: 119 additions & 0 deletions sycl/test/e2e_test_requirements/check-correctness-of-requirements.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# See check-correctness-of-requirements.cpp

import re
import sys


# To parse .def files to get aspects and architectures
def parse_defines(path, macro, prefix):
features = set()
with open(path, "r") as file:
for line in file:
if line.startswith(macro):
feature = line.split("(")[1].split(",")[0].strip()
features.add(f"{prefix}-{feature}")
return features


def parse_requirements(input_data_path, sycl_include_dir_path):
available_features = {
# for completely disabled tests
"true",
# host OS:
"windows",
"system-windows",
"linux",
"system-linux",
# target device:
"cpu",
"gpu",
"accelerator",
# target backend:
"cuda",
"hip",
"hip_amd",
"hip_nvidia",
"opencl",
"level_zero",
"level-zero",
"native_cpu",
# tools:
"sycl-ls",
"cm-compiler",
"aot_tool",
"ocloc",
"opencl-aot",
"llvm-spirv",
"llvm-link",
# dev-kits:
"level_zero_dev_kit",
"cuda_dev_kit",
# manually-set features (deprecated, no new tests should use these features)
"gpu-intel-gen11",
"gpu-intel-gen12",
"gpu-intel-dg1",
"gpu-intel-dg2",
"gpu-intel-pvc",
"gpu-intel-pvc-vg",
"gpu-intel-pvc-1T",
"gpu-intel-pvc-2T",
"gpu-amd-gfx90a",
# any-device-is-:
"any-device-is-cpu",
"any-device-is-gpu",
"any-device-is-accelerator",
"any-device-is-cuda",
"any-device-is-hip",
"any-device-is-opencl",
"any-device-is-level_zero",
"any-device-is-native_cpu",
# sg-sizes (should we allow any sg-X?)
"sg-8",
"sg-16",
"sg-32",
# miscellaneous:
"cl_options",
"opencl_icd",
"dump_ir",
"xptifw",
"has_ndebug",
"zstd",
"preview-breaking-changes-supported",
"vulkan",
"O0",
"ze_debug",
"igc-dev",
# Note: aspects and architectures are gathered below
}

available_features.update(
parse_defines(
sycl_include_dir_path + "/sycl/info/aspects.def", "__SYCL_ASPECT", "aspect"
)
)
available_features.update(
parse_defines(
sycl_include_dir_path + "/sycl/info/aspects_deprecated.def",
"__SYCL_ASPECT",
"aspect",
)
)
available_features.update(
parse_defines(
sycl_include_dir_path + "/sycl/ext/oneapi/experimental/architectures.def",
"__SYCL_ARCHITECTURE",
"arch",
)
)

exit_code = 0
with open(input_data_path, "r") as file:
requirements = set(file.read().split())
for requirement in requirements:
if not requirement in available_features:
exit_code = 1
print("Unsupported requirement: " + requirement)
sys.exit(exit_code)


parse_requirements(sys.argv[1], sys.argv[2])
Loading