-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -105,7 +105,7 @@ def load_jsonc(basename: str): | |
return json.loads("\n".join(lines)) | ||
|
||
|
||
def create_backend_test(test_name=None): | ||
def create_backend_test(devices:list[str] = None, test_name=None): | ||
Check warning Code scanning / lintrunner RUFF/RUF013 Warning test
PEP 484 prohibits implicit Optional.
See https://docs.astral.sh/ruff/rules/implicit-optional |
||
"""Creates an OrtBackendTest and adds its TestCase's to global scope so unittest will find them.""" | ||
|
||
overrides = load_jsonc("onnx_backend_test_series_overrides.jsonc") | ||
|
@@ -126,36 +126,35 @@ def create_backend_test(test_name=None): | |
else: | ||
filters = load_jsonc("onnx_backend_test_series_filters.jsonc") | ||
current_failing_tests = apply_filters(filters, "current_failing_tests") | ||
|
||
if platform.architecture()[0] == "32bit": | ||
current_failing_tests += apply_filters(filters, "current_failing_tests_x86") | ||
|
||
if backend.supports_device("DNNL"): | ||
if backend.supports_device("DNNL") or "DNNL" in devices: | ||
current_failing_tests += apply_filters(filters, "current_failing_tests_DNNL") | ||
|
||
if backend.supports_device("NNAPI"): | ||
if backend.supports_device("NNAPI") or "NNAPI" in devices: | ||
current_failing_tests += apply_filters(filters, "current_failing_tests_NNAPI") | ||
|
||
if backend.supports_device("OPENVINO_GPU"): | ||
if backend.supports_device("OPENVINO_GPU") or "OPENVINO_GPU" in devices: | ||
current_failing_tests += apply_filters(filters, "current_failing_tests_OPENVINO_GPU") | ||
|
||
if backend.supports_device("OPENVINO_CPU"): | ||
if backend.supports_device("OPENVINO_CPU") or "OPENVINO_CPU" in devices: | ||
current_failing_tests += apply_filters(filters, "current_failing_tests_OPENVINO_CPU_FP32") | ||
current_failing_tests += apply_filters(filters, "current_failing_tests_OPENVINO_CPU_FP16") | ||
|
||
if backend.supports_device("OPENVINO_NPU"): | ||
if backend.supports_device("OPENVINO_NPU") or "OPENVINO_NPU" in devices: | ||
current_failing_tests += apply_filters(filters, "current_failing_tests_OPENVINO_NPU") | ||
|
||
if backend.supports_device("OPENVINO"): | ||
if backend.supports_device("OPENVINO") or "OPENVINO" in devices: | ||
current_failing_tests += apply_filters(filters, "current_failing_tests_OPENVINO_opset18") | ||
|
||
if backend.supports_device("MIGRAPHX"): | ||
if backend.supports_device("MIGRAPHX") or "MIGRAPHX" in devices: | ||
current_failing_tests += apply_filters(filters, "current_failing_tests_MIGRAPHX") | ||
|
||
# Skip these tests for a "pure" DML onnxruntime python wheel. We keep these tests enabled for instances where both DML and CUDA | ||
# EPs are available (Windows GPU CI pipeline has this config) - these test will pass because CUDA has higher precedence than DML | ||
# and the nodes are assigned to only the CUDA EP (which supports these tests) | ||
if backend.supports_device("DML") and not backend.supports_device("GPU"): | ||
if (backend.supports_device("DML") and not backend.supports_device("GPU")) or "DML" in devices: | ||
current_failing_tests += apply_filters(filters, "current_failing_tests_pure_DML") | ||
|
||
filters = ( | ||
|
@@ -196,6 +195,15 @@ def parse_args(): | |
help="Only run tests that match this value. Matching is regex based, and '.*' is automatically appended", | ||
) | ||
|
||
parser.add_argument( | ||
"--devices", | ||
type=str, | ||
choices=["CPU", "CUDA", "MIGRAPHX", "DNNL", "DML", "OPENVINO_GPU", "OPENVINO_CPU", "OPENVINO_NPU","OPENVINO"], | ||
nargs="+", # allows multiple values | ||
default=["CPU"], # default to ["CPU"] if no input is given | ||
help="Select one or more devices CPU, CUDA, MIGRAPHX, DNNL, DML, OPENVINO_GPU, OPENVINO_CPU, OPENVINO_NPU, OPENVINO" | ||
) | ||
|
||
# parse just our args. python unittest has its own args and arg parsing, and that runs inside unittest.main() | ||
parsed, unknown = parser.parse_known_args() | ||
sys.argv = sys.argv[:1] + unknown | ||
|
@@ -206,5 +214,5 @@ def parse_args(): | |
if __name__ == "__main__": | ||
args = parse_args() | ||
|
||
create_backend_test(args.test_name) | ||
unittest.main() | ||
create_backend_test(args.devices,args.test_name) | ||
unittest.main() | ||
Check warning Code scanning / lintrunner RUFF/W292 Warning test
No newline at end of file.
See https://docs.astral.sh/ruff/rules/missing-newline-at-end-of-file |
This file contains 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