-
Notifications
You must be signed in to change notification settings - Fork 796
[SYCL][E2E] Add test to check REQUIRES #16019
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
Draft
KornevNikita
wants to merge
12
commits into
intel:sycl
Choose a base branch
from
KornevNikita:check-requires
base: sycl
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
239a975
[SYCL][E2E] Add test to check REQUIRES
KornevNikita d76ffef
Apply suggestions
KornevNikita fc10f14
Merge remote-tracking branch 'origin/sycl' into check-requires
KornevNikita d8bdd59
allow feature
KornevNikita d0f5fec
Merge remote-tracking branch 'origin/sycl' into check-requires
KornevNikita 473f187
init
KornevNikita 8160444
Update the solution
KornevNikita 0976851
use custome type for available_features
KornevNikita fb1f123
Merge remote-tracking branch 'origin/sycl' into check-requires
KornevNikita c448126
align with sycl & format
KornevNikita 2cd280c
update allowed features
KornevNikita 513c796
move new class to fix pickle
KornevNikita File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| # This script provides the complete set of all possible features that can be | ||
| # used in XFAIL, UNSUPPORTED and REQUIRES. | ||
|
|
||
| # To use: | ||
| # from sycl_lit_allowed_features import get_sycl_lit_allowed_features | ||
| # allowed_features = get_sycl_lit_allowed_features() | ||
|
|
||
| # Note: | ||
| # The set below (partial_set_of_features) is maintained manually. If the new | ||
| # feature is NOT an aspect or an architecture - it should be added to this set. | ||
| # And vice versa - if the feature was deleted, it also should be deleted from | ||
| # this set, otherwise the feature is still treated as valid. | ||
| # | ||
| # Aspects and device architectures are added automatically and require no | ||
| # additional changes. | ||
|
|
||
| import os | ||
|
|
||
| partial_set_of_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", | ||
| # target: | ||
| "target-nvidia", | ||
| "target-native_cpu", | ||
| "target-amd", | ||
| "target-spir", | ||
| "spirv-backend", | ||
| # tools: | ||
| "sycl-ls", | ||
| "cm-compiler", | ||
| "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", | ||
| # any-target-is-: | ||
| "any-target-is-spir", | ||
| # sg-sizes (should we allow any sg-X?): | ||
| "sg-8", | ||
| "sg-16", | ||
| "sg-32", | ||
| # e2e-modes: | ||
| "run-mode", | ||
| "build-and-run-mode", | ||
| # miscellaneous: | ||
| "cl_options", | ||
| "opencl_icd", | ||
| "dump_ir", | ||
| "xptifw", | ||
| "has_ndebug", | ||
| "zstd", | ||
| "preview-breaking-changes-supported", | ||
| "vulkan", | ||
| "O0", | ||
| "ze_debug", | ||
| "igc-dev", | ||
| "enable-perf-tests", | ||
| } | ||
|
|
||
|
|
||
| # 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 get_sycl_lit_allowed_features(): | ||
| current_dir = os.path.dirname(os.path.abspath(__file__)) | ||
| aspects = parse_defines( | ||
| current_dir + "/../include/sycl/info/aspects.def", "__SYCL_ASPECT", "aspect" | ||
| ) | ||
| aspects_deprecated = parse_defines( | ||
| current_dir + "/../include/sycl/info/aspects_deprecated.def", | ||
| "__SYCL_ASPECT", | ||
| "aspect", | ||
| ) | ||
| architectures = parse_defines( | ||
| current_dir | ||
| + "/../include/sycl/ext/oneapi/experimental/device_architecture.def", | ||
| "__SYCL_ARCHITECTURE", | ||
| "arch", | ||
| ) | ||
|
|
||
| # Combine all sets | ||
| all_features = ( | ||
| partial_set_of_features | aspects | aspects_deprecated | architectures | ||
| ) | ||
| return all_features | ||
16 changes: 16 additions & 0 deletions
16
sycl/test/e2e_test_requirements/check-correctness-of-requirements.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| // This test checks that all "REQUIRES", "XFAIL" and "UNSUPPORTED" strings | ||
| // contain the right feature names. | ||
| // | ||
| // If this test fails: | ||
| // 1. there is some typo/deleted feature requested in the new/modified test. | ||
| // 2. ...or, there is some new feature. In this case please update the set of | ||
| // features in sycl/test-e2e/sycl_lit_allowed_features.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: | ||
| // RUN: python3 %S/check-correctness-of-requirements.py %t | ||
| // | ||
| // Small negative test | ||
| // RUN: echo non-existing-feature-request > %t | not python3 %S/check-correctness-of-requirements.py %t |
23 changes: 23 additions & 0 deletions
23
sycl/test/e2e_test_requirements/check-correctness-of-requirements.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # See check-correctness-of-requirements.cpp | ||
|
|
||
| import os | ||
| import sys | ||
|
|
||
| input_data = sys.argv[1] | ||
| current_dir = os.path.dirname(os.path.abspath(__file__)) | ||
|
|
||
| # See sycl/test-e2e/sycl_lit_allowed_features.py. | ||
| sys.path.append(current_dir + "/../../test-e2e") | ||
| from sycl_lit_allowed_features import get_sycl_lit_allowed_features | ||
|
|
||
| allowed_features = get_sycl_lit_allowed_features() | ||
|
|
||
| exit_code = 0 | ||
| with open(input_data, "r") as file: | ||
| requirements = set(file.read().split()) | ||
| for requirement in requirements: | ||
| if not requirement in allowed_features: | ||
| exit_code = 1 | ||
| print("Unsupported requirement: " + requirement) | ||
|
|
||
| sys.exit(exit_code) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't use these anymore.