diff --git a/docs/development/ADRs/0015-Test_Exclusion_Matrices.md b/docs/development/ADRs/0015-Test_Exclusion_Matrices.md new file mode 100644 index 0000000000..920504db9a --- /dev/null +++ b/docs/development/ADRs/0015-Test_Exclusion_Matrices.md @@ -0,0 +1,80 @@ +--- +tags: [] +--- + +# Test-Exclusion Matrices + +- **Status**: valid +- **Authors**: Edoardo Paone (@edopao), Enrique G. Paredes (@egparedes) +- **Created**: 2023-09-21 +- **Updated**: 2023-09-21 + +In the context of Field View testing, lacking support for specific ITIR features while a certain backend +is being developed, we decided to use `pytest` fixtures to exclude unsupported tests. + +## Context + +It should be possible to run Field View tests on different backends. However, specific tests could be unsupported +on a certain backend, or the backend implementation could be only partially ready. +Therefore, we need a mechanism to specify the features required by each test and selectively enable +the supported backends, while keeping the test code clean. + +## Decision + +It was decided to apply fixtures and markers from `pytest` module. The fixture is the same used to execute the test +on different backends (`fieldview_backend` and `program_processor`), but it is extended with a check on the available feature markers. +If a test is annotated with a feature marker, the fixture will check if this feature is supported on the selected backend. +If no marker is specified, the test is supposed to run on all backends. + +In the example below, `test_offset_field` requires the backend to support dynamic offsets in the translation from ITIR: + +```python +@pytest.mark.uses_dynamic_offsets +def test_offset_field(cartesian_case): +``` + +In order to selectively enable the backends, the dictionary `next_tests.exclusion_matrices.BACKEND_SKIP_TEST_MATRIX` +lists for each backend the features that are not supported. +The fixture will check if the annotated feature is present in the exclusion-matrix for the selected backend. +If so, the exclusion matrix will also specify the action `pytest` should take (e.g. `SKIP` or `XFAIL`). + +The test-exclusion matrix is a dictionary, where `key` is the backend name and each entry is a tuple with the following fields: + +`(, , )` + +The backend string, used both as dictionary key and as string formatter in the skip message, is retrieved +by calling `tests.next_tests.get_processor_id()`, which returns the so-called processor name. +The following backend processors are defined: + +```python +DACE = "dace_iterator.run_dace_iterator" +GTFN_CPU = "otf_compile_executor.run_gtfn" +GTFN_CPU_IMPERATIVE = "otf_compile_executor.run_gtfn_imperative" +GTFN_CPU_WITH_TEMPORARIES = "otf_compile_executor.run_gtfn_with_temporaries" +``` + +Following the previous example, the GTFN backend with temporaries does not support yet dynamic offsets in ITIR: + +```python +BACKEND_SKIP_TEST_MATRIX = { + GTFN_CPU_WITH_TEMPORARIES: [ + ("uses_dynamic_offsets", pytest.XFAIL, "'{marker}' tests not supported by '{backend}' backend"), + ] +} +``` + +## Consequences + +Positive outcomes of this decision: + +- The solution provides a central place to specify test exclusion. +- The test code remains clean from if-statements for backend exclusion. +- The exclusion matrix gives an overview of the feature-readiness of different backends. + +Negative outcomes: + +- There is not (yet) any code-style check to enforce this solution, so code reviews should be aware of the ADR. + +## References + +- [pytest - Using markers to pass data to fixtures](https://docs.pytest.org/en/6.2.x/fixture.html#using-markers-to-pass-data-to-fixtures) diff --git a/docs/development/ADRs/Index.md b/docs/development/ADRs/Index.md index 1bbfd62d81..09d2273ee9 100644 --- a/docs/development/ADRs/Index.md +++ b/docs/development/ADRs/Index.md @@ -51,9 +51,9 @@ _None_ - [0011 - On The Fly Compilation](0011-On_The_Fly_Compilation.md) - [0012 - GridTools C++ OTF](0011-_GridTools_Cpp_OTF.md) -### Miscellanea +### Testing -_None_ +- [0015 - Exclusion Matrices](0015-Test_Exclusion_Matrices.md) ### Superseded diff --git a/pyproject.toml b/pyproject.toml index e915622857..e2d2a7dfe9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -326,9 +326,25 @@ module = 'gt4py.next.iterator.runtime' [tool.pytest.ini_options] markers = [ - 'requires_atlas', # mark tests that require 'atlas4py' bindings package - 'requires_dace', # mark tests that require 'dace' package - 'requires_gpu:' # mark tests that require a NVidia GPU (assume 'cupy' and 'cudatoolkit' are installed) + 'requires_atlas: tests that require `atlas4py` bindings package', + 'requires_dace: tests that require `dace` package', + 'requires_gpu: tests that require a NVidia GPU (`cupy` and `cudatoolkit` are required)', + 'uses_applied_shifts: tests that require backend support for applied-shifts', + 'uses_can_deref: tests that require backend support for can_deref', + 'uses_constant_fields: tests that require backend support for constant fields', + 'uses_dynamic_offsets: tests that require backend support for dynamic offsets', + 'uses_if_stmts: tests that require backend support for if-statements', + 'uses_index_fields: tests that require backend support for index fields', + 'uses_lift_expressions: tests that require backend support for lift expressions', + 'uses_negative_modulo: tests that require backend support for modulo on negative numbers', + 'uses_origin: tests that require backend support for domain origin', + 'uses_reduction_over_lift_expressions: tests that require backend support for reduction over lift expressions', + 'uses_scan_in_field_operator: tests that require backend support for scan in field operator', + 'uses_sparse_fields: tests that require backend support for sparse fields', + 'uses_strided_neighbor_offset: tests that require backend support for strided neighbor offset', + 'uses_tuple_args: tests that require backend support for tuple arguments', + 'uses_tuple_returns: tests that require backend support for tuple results', + 'uses_zero_dimensional_fields: tests that require backend support for zero-dimensional fields' ] norecursedirs = ['dist', 'build', 'cpp_backend_tests/build*', '_local/*', '.*'] testpaths = 'tests' diff --git a/tests/next_tests/exclusion_matrices.py b/tests/next_tests/exclusion_matrices.py new file mode 100644 index 0000000000..d0a44080ad --- /dev/null +++ b/tests/next_tests/exclusion_matrices.py @@ -0,0 +1,89 @@ +# GT4Py - GridTools Framework +# +# Copyright (c) 2014-2023, ETH Zurich +# All rights reserved. +# +# This file is part of the GT4Py project and the GridTools framework. +# GT4Py is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or any later +# version. See the LICENSE.txt file at the top-level directory of this +# distribution for a copy of the license or check . +# +# SPDX-License-Identifier: GPL-3.0-or-later +import pytest + + +""" +Contains definition of test-exclusion matrices, see ADR 15. +""" + +# Skip definitions +XFAIL = pytest.xfail +SKIP = pytest.skip + +# Skip messages (available format keys: 'marker', 'backend') +UNSUPPORTED_MESSAGE = "'{marker}' tests not supported by '{backend}' backend" +BINDINGS_UNSUPPORTED_MESSAGE = "'{marker}' not supported by '{backend}' bindings" + +# Processor ids as returned by next_tests.get_processor_id() +DACE = "dace_iterator.run_dace_iterator" +GTFN_CPU = "otf_compile_executor.run_gtfn" +GTFN_CPU_IMPERATIVE = "otf_compile_executor.run_gtfn_imperative" +GTFN_CPU_WITH_TEMPORARIES = "otf_compile_executor.run_gtfn_with_temporaries" + +# Test markers +REQUIRES_ATLAS = "requires_atlas" +USES_APPLIED_SHIFTS = "uses_applied_shifts" +USES_CAN_DEREF = "uses_can_deref" +USES_CONSTANT_FIELDS = "uses_constant_fields" +USES_DYNAMIC_OFFSETS = "uses_dynamic_offsets" +USES_IF_STMTS = "uses_if_stmts" +USES_INDEX_FIELDS = "uses_index_fields" +USES_LIFT_EXPRESSIONS = "uses_lift_expressions" +USES_NEGATIVE_MODULO = "uses_negative_modulo" +USES_ORIGIN = "uses_origin" +USES_REDUCTION_OVER_LIFT_EXPRESSIONS = "uses_reduction_over_lift_expressions" +USES_SCAN_IN_FIELD_OPERATOR = "uses_scan_in_field_operator" +USES_SPARSE_FIELDS = "uses_sparse_fields" +USES_STRIDED_NEIGHBOR_OFFSET = "uses_strided_neighbor_offset" +USES_TUPLE_ARGS = "uses_tuple_args" +USES_TUPLE_RETURNS = "uses_tuple_returns" +USES_ZERO_DIMENSIONAL_FIELDS = "uses_zero_dimensional_fields" + +# Common list of feature markers to skip +GTFN_SKIP_TEST_LIST = [ + (REQUIRES_ATLAS, XFAIL, BINDINGS_UNSUPPORTED_MESSAGE), + (USES_APPLIED_SHIFTS, XFAIL, UNSUPPORTED_MESSAGE), + (USES_IF_STMTS, XFAIL, UNSUPPORTED_MESSAGE), + (USES_NEGATIVE_MODULO, XFAIL, UNSUPPORTED_MESSAGE), + (USES_SCAN_IN_FIELD_OPERATOR, XFAIL, UNSUPPORTED_MESSAGE), + (USES_STRIDED_NEIGHBOR_OFFSET, XFAIL, BINDINGS_UNSUPPORTED_MESSAGE), +] + +""" +Skip matrix, contains for each backend processor a list of tuples with following fields: +(, ) +""" +BACKEND_SKIP_TEST_MATRIX = { + DACE: GTFN_SKIP_TEST_LIST + + [ + (USES_CAN_DEREF, XFAIL, UNSUPPORTED_MESSAGE), + (USES_CONSTANT_FIELDS, XFAIL, UNSUPPORTED_MESSAGE), + (USES_DYNAMIC_OFFSETS, XFAIL, UNSUPPORTED_MESSAGE), + (USES_INDEX_FIELDS, XFAIL, UNSUPPORTED_MESSAGE), + (USES_LIFT_EXPRESSIONS, XFAIL, UNSUPPORTED_MESSAGE), + (USES_ORIGIN, XFAIL, UNSUPPORTED_MESSAGE), + (USES_REDUCTION_OVER_LIFT_EXPRESSIONS, XFAIL, UNSUPPORTED_MESSAGE), + (USES_SPARSE_FIELDS, XFAIL, UNSUPPORTED_MESSAGE), + (USES_TUPLE_ARGS, XFAIL, UNSUPPORTED_MESSAGE), + (USES_TUPLE_RETURNS, XFAIL, UNSUPPORTED_MESSAGE), + (USES_ZERO_DIMENSIONAL_FIELDS, XFAIL, UNSUPPORTED_MESSAGE), + ], + GTFN_CPU: GTFN_SKIP_TEST_LIST, + GTFN_CPU_IMPERATIVE: GTFN_SKIP_TEST_LIST, + GTFN_CPU_WITH_TEMPORARIES: GTFN_SKIP_TEST_LIST + + [ + (USES_DYNAMIC_OFFSETS, XFAIL, UNSUPPORTED_MESSAGE), + ], +} diff --git a/tests/next_tests/integration_tests/feature_tests/ffront_tests/ffront_test_utils.py b/tests/next_tests/integration_tests/feature_tests/ffront_tests/ffront_test_utils.py index a8c35cc28f..d3863f5a28 100644 --- a/tests/next_tests/integration_tests/feature_tests/ffront_tests/ffront_test_utils.py +++ b/tests/next_tests/integration_tests/feature_tests/ffront_tests/ffront_test_utils.py @@ -22,7 +22,17 @@ import gt4py.next as gtx from gt4py.next.ffront import decorator from gt4py.next.iterator import embedded, ir as itir -from gt4py.next.program_processors.runners import dace_iterator, gtfn_cpu, roundtrip +from gt4py.next.program_processors.runners import gtfn_cpu, roundtrip +from tests.next_tests import exclusion_matrices + + +try: + from gt4py.next.program_processors.runners import dace_iterator +except ModuleNotFoundError as e: + if "dace" in str(e): + dace_iterator = None + else: + raise e import next_tests @@ -32,20 +42,33 @@ def no_backend(program: itir.FencilDefinition, *args: Any, **kwargs: Any) -> Non raise ValueError("No backend selected! Backend selection is mandatory in tests.") +OPTIONAL_PROCESSORS = [] +if dace_iterator: + OPTIONAL_PROCESSORS.append(dace_iterator.run_dace_iterator) + + @pytest.fixture( params=[ roundtrip.executor, gtfn_cpu.run_gtfn, gtfn_cpu.run_gtfn_imperative, gtfn_cpu.run_gtfn_with_temporaries, - dace_iterator.run_dace_iterator, - ], + ] + + OPTIONAL_PROCESSORS, ids=lambda p: next_tests.get_processor_id(p), ) def fieldview_backend(request): + backend = request.param + backend_id = next_tests.get_processor_id(backend) + + """See ADR 15.""" + for marker, skip_mark, msg in exclusion_matrices.BACKEND_SKIP_TEST_MATRIX.get(backend_id, []): + if request.node.get_closest_marker(marker): + skip_mark(msg.format(marker=marker, backend=backend_id)) + backup_backend = decorator.DEFAULT_BACKEND decorator.DEFAULT_BACKEND = no_backend - yield request.param + yield backend decorator.DEFAULT_BACKEND = backup_backend diff --git a/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_arg_call_interface.py b/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_arg_call_interface.py index 71e31542f7..1402649127 100644 --- a/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_arg_call_interface.py +++ b/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_arg_call_interface.py @@ -24,7 +24,7 @@ from gt4py.next.errors.exceptions import TypeError_ from gt4py.next.ffront.decorator import field_operator, program, scan_operator from gt4py.next.ffront.fbuiltins import broadcast, int32, int64 -from gt4py.next.program_processors.runners import dace_iterator, gtfn_cpu +from gt4py.next.program_processors.runners import gtfn_cpu from next_tests.integration_tests import cases from next_tests.integration_tests.cases import ( @@ -169,15 +169,8 @@ def testee( ) +@pytest.mark.uses_scan_in_field_operator def test_call_scan_operator_from_field_operator(cartesian_case): - if cartesian_case.backend in [ - gtfn_cpu.run_gtfn, - gtfn_cpu.run_gtfn_imperative, - gtfn_cpu.run_gtfn_with_temporaries, - dace_iterator.run_dace_iterator, - ]: - pytest.xfail("Calling scan from field operator not fully supported.") - @scan_operator(axis=KDim, forward=True, init=0.0) def testee_scan(state: float, x: float, y: float) -> float: return state + x + 2.0 * y diff --git a/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_execution.py b/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_execution.py index f50f16ea0f..865950eeab 100644 --- a/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_execution.py +++ b/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_execution.py @@ -33,7 +33,7 @@ where, ) from gt4py.next.ffront.experimental import as_offset -from gt4py.next.program_processors.runners import dace_iterator, gtfn_cpu +from gt4py.next.program_processors.runners import gtfn_cpu from next_tests.integration_tests import cases from next_tests.integration_tests.cases import ( @@ -68,10 +68,8 @@ def testee(a: cases.IJKField) -> cases.IJKField: cases.verify_with_default_data(cartesian_case, testee, ref=lambda a: a) +@pytest.mark.uses_tuple_returns def test_multicopy(cartesian_case): # noqa: F811 # fixtures - if cartesian_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") - @gtx.field_operator def testee(a: cases.IJKField, b: cases.IJKField) -> tuple[cases.IJKField, cases.IJKField]: return a, b @@ -161,10 +159,8 @@ def testee(a: cases.IJKField, b: cases.IJKField) -> cases.IJKField: cases.verify(cartesian_case, testee, a, b, out=out, ref=a.ndarray[1:] + b.ndarray[2:]) +@pytest.mark.uses_tuple_returns def test_tuples(cartesian_case): # noqa: F811 # fixtures - if cartesian_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") - @gtx.field_operator def testee(a: cases.IJKFloatField, b: cases.IJKFloatField) -> cases.IJKFloatField: inps = a, b @@ -211,10 +207,8 @@ def testee(a: int32) -> cases.VField: ) +@pytest.mark.uses_index_fields def test_scalar_arg_with_field(cartesian_case): # noqa: F811 # fixtures - if cartesian_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: index fields, constant fields") - @gtx.field_operator def testee(a: cases.IJKField, b: int32) -> cases.IJKField: tmp = b * a @@ -272,16 +266,8 @@ def testee(qc: cases.IKFloatField, scalar: float): cases.verify(cartesian_case, testee, qc, scalar, inout=qc, ref=expected) +@pytest.mark.uses_scan_in_field_operator def test_tuple_scalar_scan(cartesian_case): # noqa: F811 # fixtures - if cartesian_case.backend in [ - gtfn_cpu.run_gtfn, - gtfn_cpu.run_gtfn_imperative, - gtfn_cpu.run_gtfn_with_temporaries, - ]: - pytest.xfail("Scalar tuple arguments are not supported in gtfn yet.") - if cartesian_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple arguments") - @gtx.scan_operator(axis=KDim, forward=True, init=0.0) def testee_scan( state: float, qc_in: float, tuple_scalar: tuple[float, tuple[float, float]] @@ -301,10 +287,8 @@ def testee_op( cases.verify(cartesian_case, testee_op, qc, tuple_scalar, out=qc, ref=expected) +@pytest.mark.uses_index_fields def test_scalar_scan_vertical_offset(cartesian_case): # noqa: F811 # fixtures - if cartesian_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: scans") - @gtx.scan_operator(axis=KDim, forward=True, init=(0.0)) def testee_scan(state: float, inp: float) -> float: return inp @@ -382,12 +366,8 @@ def testee(a: cases.IFloatField) -> gtx.Field[[IDim], np.float32]: ) +@pytest.mark.uses_dynamic_offsets def test_offset_field(cartesian_case): - if cartesian_case.backend == gtfn_cpu.run_gtfn_with_temporaries: - pytest.xfail("Dynamic offsets not supported in gtfn") - if cartesian_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: offset fields") - ref = np.full( (cartesian_case.default_sizes[IDim], cartesian_case.default_sizes[KDim]), True, dtype=bool ) @@ -420,10 +400,8 @@ def testee(a: cases.IKField, offset_field: cases.IKField) -> gtx.Field[[IDim, KD assert np.allclose(out, ref) +@pytest.mark.uses_tuple_returns def test_nested_tuple_return(cartesian_case): - if cartesian_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") - @gtx.field_operator def pack_tuple( a: cases.IField, b: cases.IField @@ -438,10 +416,8 @@ def combine(a: cases.IField, b: cases.IField) -> cases.IField: cases.verify_with_default_data(cartesian_case, combine, ref=lambda a, b: a + a + b) +@pytest.mark.uses_reduction_over_lift_expressions def test_nested_reduction(unstructured_case): - if unstructured_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: reductions over lift expressions") - @gtx.field_operator def testee(a: cases.EField) -> cases.EField: tmp = neighbor_sum(a(V2E), axis=V2EDim) @@ -481,10 +457,8 @@ def testee(inp: cases.EField) -> cases.EField: ) +@pytest.mark.uses_tuple_returns def test_tuple_return_2(unstructured_case): - if unstructured_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") - @gtx.field_operator def testee(a: cases.EField, b: cases.EField) -> tuple[cases.VField, cases.VField]: tmp = neighbor_sum(a(V2E), axis=V2EDim) @@ -502,10 +476,8 @@ def testee(a: cases.EField, b: cases.EField) -> tuple[cases.VField, cases.VField ) +@pytest.mark.uses_tuple_returns def test_tuple_with_local_field_in_reduction_shifted(unstructured_case): - if unstructured_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuples") - @gtx.field_operator def reduce_tuple_element(e: cases.EField, v: cases.VField) -> cases.EField: tup = e(V2E), v @@ -522,10 +494,8 @@ def reduce_tuple_element(e: cases.EField, v: cases.VField) -> cases.EField: ) +@pytest.mark.uses_tuple_args def test_tuple_arg(cartesian_case): - if cartesian_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple args") - @gtx.field_operator def testee(a: tuple[tuple[cases.IField, cases.IField], cases.IField]) -> cases.IField: return 3 * a[0][0] + a[0][1] + a[1] @@ -555,6 +525,7 @@ def simple_scan_operator(carry: float) -> float: cases.verify(cartesian_case, simple_scan_operator, out=out, ref=expected) +@pytest.mark.uses_lift_expressions def test_solve_triag(cartesian_case): if cartesian_case.backend in [ gtfn_cpu.run_gtfn, @@ -564,8 +535,6 @@ def test_solve_triag(cartesian_case): pytest.xfail("Nested `scan`s requires creating temporaries.") if cartesian_case.backend == gtfn_cpu.run_gtfn_with_temporaries: pytest.xfail("Temporary extraction does not work correctly in combination with scans.") - if cartesian_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: scans") @gtx.scan_operator(axis=KDim, forward=True, init=(0.0, 0.0)) def tridiag_forward( @@ -627,10 +596,8 @@ def testee(left: int32, right: int32) -> cases.IField: @pytest.mark.parametrize("left, right", [(2, 3), (3, 2)]) +@pytest.mark.uses_tuple_returns def test_ternary_operator_tuple(cartesian_case, left, right): - if cartesian_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") - @gtx.field_operator def testee( a: cases.IField, b: cases.IField, left: int32, right: int32 @@ -646,10 +613,8 @@ def testee( ) +@pytest.mark.uses_reduction_over_lift_expressions def test_ternary_builtin_neighbor_sum(unstructured_case): - if unstructured_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: reductions over lift expressions") - @gtx.field_operator def testee(a: cases.EField, b: cases.EField) -> cases.VField: tmp = neighbor_sum(b(V2E) if 2 < 3 else a(V2E), axis=V2EDim) @@ -688,11 +653,10 @@ def simple_scan_operator(carry: float, a: float) -> float: @pytest.mark.parametrize("forward", [True, False]) +@pytest.mark.uses_tuple_returns def test_scan_nested_tuple_output(forward, cartesian_case): if cartesian_case.backend in [gtfn_cpu.run_gtfn_with_temporaries]: pytest.xfail("Temporary extraction does not work correctly in combination with scans.") - if cartesian_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") init = (1, (2, 3)) k_size = cartesian_case.default_sizes[KDim] @@ -720,9 +684,8 @@ def testee(out: tuple[cases.KField, tuple[cases.KField, cases.KField]]): ) +@pytest.mark.uses_tuple_args def test_scan_nested_tuple_input(cartesian_case): - if cartesian_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple args") init = 1.0 k_size = cartesian_case.default_sizes[KDim] inp1 = gtx.np_as_located_field(KDim)(np.ones((k_size,))) @@ -877,10 +840,8 @@ def program_domain( ) +@pytest.mark.uses_tuple_returns def test_domain_tuple(cartesian_case): - if cartesian_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") - @gtx.field_operator def fieldop_domain_tuple( a: cases.IJField, b: cases.IJField @@ -939,10 +900,8 @@ def return_undefined(): return undefined_symbol +@pytest.mark.uses_zero_dimensional_fields def test_zero_dims_fields(cartesian_case): - if cartesian_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: zero-dimensional fields") - @gtx.field_operator def implicit_broadcast_scalar(inp: cases.EmptyField): return inp @@ -970,10 +929,8 @@ def fieldop_implicit_broadcast_2(inp: cases.IField) -> cases.IField: ) +@pytest.mark.uses_tuple_returns def test_tuple_unpacking(cartesian_case): - if cartesian_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") - @gtx.field_operator def unpack( inp: cases.IField, @@ -986,9 +943,8 @@ def unpack( ) +@pytest.mark.uses_tuple_returns def test_tuple_unpacking_star_multi(cartesian_case): - if cartesian_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") OutType = tuple[ cases.IField, cases.IField, diff --git a/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_external_local_field.py b/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_external_local_field.py index 7f2b11afff..dbc35ddfdf 100644 --- a/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_external_local_field.py +++ b/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_external_local_field.py @@ -17,7 +17,6 @@ import gt4py.next as gtx from gt4py.next import int32, neighbor_sum -from gt4py.next.program_processors.runners import dace_iterator, gtfn_cpu from next_tests.integration_tests import cases from next_tests.integration_tests.cases import V2E, Edge, V2EDim, Vertex, unstructured_case diff --git a/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_gt4py_builtins.py b/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_gt4py_builtins.py index ee88b3764e..0ae874f3a6 100644 --- a/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_gt4py_builtins.py +++ b/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_gt4py_builtins.py @@ -18,7 +18,7 @@ import gt4py.next as gtx from gt4py.next import broadcast, float64, int32, int64, max_over, min_over, neighbor_sum, where -from gt4py.next.program_processors.runners import dace_iterator, gtfn_cpu +from gt4py.next.program_processors.runners import gtfn_cpu from next_tests.integration_tests import cases from next_tests.integration_tests.cases import ( @@ -46,8 +46,6 @@ ids=["positive_values", "negative_values"], ) def test_maxover_execution_(unstructured_case, strategy): - if unstructured_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: reductions") if unstructured_case.backend in [ gtfn_cpu.run_gtfn, gtfn_cpu.run_gtfn_imperative, @@ -69,9 +67,6 @@ def testee(edge_f: cases.EField) -> cases.VField: def test_minover_execution(unstructured_case): - if unstructured_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: reductions") - @gtx.field_operator def minover(edge_f: cases.EField) -> cases.VField: out = min_over(edge_f(V2E), axis=V2EDim) @@ -99,10 +94,8 @@ def fencil(edge_f: cases.EField, out: cases.VField): ) +@pytest.mark.uses_constant_fields def test_reduction_expression_in_call(unstructured_case): - if unstructured_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: make_const_list") - @gtx.field_operator def reduce_expr(edge_f: cases.EField) -> cases.VField: tmp_nbh_tup = edge_f(V2E), edge_f(V2E) @@ -133,10 +126,8 @@ def testee(flux: cases.EField) -> cases.VField: ) +@pytest.mark.uses_tuple_returns def test_conditional_nested_tuple(cartesian_case): - if cartesian_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") - @gtx.field_operator def conditional_nested_tuple( mask: cases.IBoolField, a: cases.IFloatField, b: cases.IFloatField diff --git a/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_math_builtin_execution.py b/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_math_builtin_execution.py index 9ceab7f2d0..f7121dc82f 100644 --- a/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_math_builtin_execution.py +++ b/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_math_builtin_execution.py @@ -22,7 +22,6 @@ from gt4py.next.ffront import dialect_ast_enums, fbuiltins, field_operator_ast as foast from gt4py.next.ffront.decorator import FieldOperator from gt4py.next.ffront.foast_passes.type_deduction import FieldOperatorTypeDeduction -from gt4py.next.program_processors.runners import dace_iterator from gt4py.next.type_system import type_translation from next_tests.integration_tests import cases diff --git a/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_math_unary_builtins.py b/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_math_unary_builtins.py index 54374077b4..85826c1ac0 100644 --- a/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_math_unary_builtins.py +++ b/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_math_unary_builtins.py @@ -37,7 +37,7 @@ tanh, trunc, ) -from gt4py.next.program_processors.runners import dace_iterator, gtfn_cpu +from gt4py.next.program_processors.runners import gtfn_cpu from next_tests.integration_tests import cases from next_tests.integration_tests.cases import IDim, cartesian_case, unstructured_case @@ -84,17 +84,8 @@ def floorDiv(inp1: cases.IField) -> cases.IField: cases.verify_with_default_data(cartesian_case, floorDiv, ref=lambda inp1: inp1 // 2) +@pytest.mark.uses_negative_modulo def test_mod(cartesian_case): - if cartesian_case.backend in [ - gtfn_cpu.run_gtfn, - gtfn_cpu.run_gtfn_imperative, - gtfn_cpu.run_gtfn_with_temporaries, - dace_iterator.run_dace_iterator, - ]: - pytest.xfail( - "Modulo not properly supported for negative numbers." - ) # see https://github.com/GridTools/gt4py/issues/1219 - @gtx.field_operator def mod_fieldop(inp1: cases.IField) -> cases.IField: return inp1 % 2 diff --git a/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_program.py b/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_program.py index d7c50e83f0..f489126fa7 100644 --- a/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_program.py +++ b/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_program.py @@ -20,7 +20,6 @@ import pytest import gt4py.next as gtx -from gt4py.next.program_processors.runners import dace_iterator from next_tests.integration_tests import cases from next_tests.integration_tests.cases import IDim, Ioff, JDim, cartesian_case, fieldview_backend @@ -129,10 +128,8 @@ def fo_from_fo_program(in_field: cases.IFloatField, out: cases.IFloatField): ) +@pytest.mark.uses_tuple_returns def test_tuple_program_return_constructed_inside(cartesian_case): - if cartesian_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") - @gtx.field_operator def pack_tuple( a: cases.IFloatField, b: cases.IFloatField @@ -158,10 +155,8 @@ def prog( assert np.allclose((a, b), (out_a, out_b)) +@pytest.mark.uses_tuple_returns def test_tuple_program_return_constructed_inside_with_slicing(cartesian_case): - if cartesian_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") - @gtx.field_operator def pack_tuple( a: cases.IFloatField, b: cases.IFloatField @@ -188,10 +183,8 @@ def prog( assert out_a[0] == 0 and out_b[0] == 0 +@pytest.mark.uses_tuple_returns def test_tuple_program_return_constructed_inside_nested(cartesian_case): - if cartesian_case.backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") - @gtx.field_operator def pack_tuple( a: cases.IFloatField, b: cases.IFloatField, c: cases.IFloatField diff --git a/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_scalar_if.py b/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_scalar_if.py index a49dd1fdcf..f9fd2c1353 100644 --- a/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_scalar_if.py +++ b/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_scalar_if.py @@ -19,7 +19,6 @@ import pytest from gt4py.next import Field, errors, field_operator, float64, index_field, np_as_located_field -from gt4py.next.program_processors.runners import dace_iterator, gtfn_cpu from next_tests.integration_tests import cases from next_tests.integration_tests.cases import ( @@ -46,15 +45,8 @@ @pytest.mark.parametrize("condition", [True, False]) +@pytest.mark.uses_if_stmts def test_simple_if(condition, cartesian_case): - if cartesian_case.backend in [ - gtfn_cpu.run_gtfn, - gtfn_cpu.run_gtfn_imperative, - gtfn_cpu.run_gtfn_with_temporaries, - dace_iterator.run_dace_iterator, - ]: - pytest.xfail("If-stmts are not supported yet.") - @field_operator def simple_if(a: cases.IField, b: cases.IField, condition: bool) -> cases.IField: if condition: @@ -71,15 +63,8 @@ def simple_if(a: cases.IField, b: cases.IField, condition: bool) -> cases.IField @pytest.mark.parametrize("condition1, condition2", [[True, False], [True, False]]) +@pytest.mark.uses_if_stmts def test_simple_if_conditional(condition1, condition2, cartesian_case): - if cartesian_case.backend in [ - gtfn_cpu.run_gtfn, - gtfn_cpu.run_gtfn_imperative, - gtfn_cpu.run_gtfn_with_temporaries, - dace_iterator.run_dace_iterator, - ]: - pytest.xfail("If-stmts are not supported yet.") - @field_operator def simple_if( a: cases.IField, @@ -112,15 +97,8 @@ def simple_if( @pytest.mark.parametrize("condition", [True, False]) +@pytest.mark.uses_if_stmts def test_local_if(cartesian_case, condition): - if cartesian_case.backend in [ - gtfn_cpu.run_gtfn, - gtfn_cpu.run_gtfn_imperative, - gtfn_cpu.run_gtfn_with_temporaries, - dace_iterator.run_dace_iterator, - ]: - pytest.xfail("If-stmts are not supported yet.") - @field_operator def local_if(a: cases.IField, b: cases.IField, condition: bool) -> cases.IField: if condition: @@ -138,15 +116,8 @@ def local_if(a: cases.IField, b: cases.IField, condition: bool) -> cases.IField: @pytest.mark.parametrize("condition", [True, False]) +@pytest.mark.uses_if_stmts def test_temporary_if(cartesian_case, condition): - if cartesian_case.backend in [ - gtfn_cpu.run_gtfn, - gtfn_cpu.run_gtfn_imperative, - gtfn_cpu.run_gtfn_with_temporaries, - dace_iterator.run_dace_iterator, - ]: - pytest.xfail("If-stmts are not supported yet.") - @field_operator def temporary_if(a: cases.IField, b: cases.IField, condition: bool) -> cases.IField: if condition: @@ -167,15 +138,8 @@ def temporary_if(a: cases.IField, b: cases.IField, condition: bool) -> cases.IFi @pytest.mark.parametrize("condition", [True, False]) +@pytest.mark.uses_if_stmts def test_if_return(cartesian_case, condition): - if cartesian_case.backend in [ - gtfn_cpu.run_gtfn, - gtfn_cpu.run_gtfn_imperative, - gtfn_cpu.run_gtfn_with_temporaries, - dace_iterator.run_dace_iterator, - ]: - pytest.xfail("If-stmts are not supported yet.") - @field_operator def temporary_if(a: cases.IField, b: cases.IField, condition: bool) -> cases.IField: if condition: @@ -196,15 +160,8 @@ def temporary_if(a: cases.IField, b: cases.IField, condition: bool) -> cases.IFi @pytest.mark.parametrize("condition", [True, False]) +@pytest.mark.uses_if_stmts def test_if_stmt_if_branch_returns(cartesian_case, condition): - if cartesian_case.backend in [ - gtfn_cpu.run_gtfn, - gtfn_cpu.run_gtfn_imperative, - gtfn_cpu.run_gtfn_with_temporaries, - dace_iterator.run_dace_iterator, - ]: - pytest.xfail("If-stmts are not supported yet.") - @field_operator def if_branch_returns(a: cases.IField, b: cases.IField, condition: bool) -> cases.IField: if condition: @@ -222,15 +179,8 @@ def if_branch_returns(a: cases.IField, b: cases.IField, condition: bool) -> case @pytest.mark.parametrize("condition", [True, False]) +@pytest.mark.uses_if_stmts def test_if_stmt_else_branch_returns(cartesian_case, condition): - if cartesian_case.backend in [ - gtfn_cpu.run_gtfn, - gtfn_cpu.run_gtfn_imperative, - gtfn_cpu.run_gtfn_with_temporaries, - dace_iterator.run_dace_iterator, - ]: - pytest.xfail("If-stmts are not supported yet.") - @field_operator def else_branch_returns(a: cases.IField, b: cases.IField, condition: bool) -> cases.IField: if condition: @@ -250,15 +200,8 @@ def else_branch_returns(a: cases.IField, b: cases.IField, condition: bool) -> ca @pytest.mark.parametrize("condition", [True, False]) +@pytest.mark.uses_if_stmts def test_if_stmt_both_branches_return(cartesian_case, condition): - if cartesian_case.backend in [ - gtfn_cpu.run_gtfn, - gtfn_cpu.run_gtfn_imperative, - gtfn_cpu.run_gtfn_with_temporaries, - dace_iterator.run_dace_iterator, - ]: - pytest.xfail("If-stmts are not supported yet.") - @field_operator def both_branches_return(a: cases.IField, b: cases.IField, condition: bool) -> cases.IField: if condition: @@ -278,15 +221,8 @@ def both_branches_return(a: cases.IField, b: cases.IField, condition: bool) -> c @pytest.mark.parametrize("condition1, condition2", [[True, False], [True, False]]) -def test_nested_if_stmt_conditinal(cartesian_case, condition1, condition2): - if cartesian_case.backend in [ - gtfn_cpu.run_gtfn, - gtfn_cpu.run_gtfn_imperative, - gtfn_cpu.run_gtfn_with_temporaries, - dace_iterator.run_dace_iterator, - ]: - pytest.xfail("If-stmts are not supported yet.") - +@pytest.mark.uses_if_stmts +def test_nested_if_stmt_conditional(cartesian_case, condition1, condition2): @field_operator def nested_if_conditional_return( inp: cases.IField, condition1: bool, condition2: bool @@ -322,15 +258,8 @@ def nested_if_conditional_return( @pytest.mark.parametrize("condition", [True, False]) +@pytest.mark.uses_if_stmts def test_nested_if(cartesian_case, condition): - if cartesian_case.backend in [ - gtfn_cpu.run_gtfn, - gtfn_cpu.run_gtfn_imperative, - gtfn_cpu.run_gtfn_with_temporaries, - dace_iterator.run_dace_iterator, - ]: - pytest.xfail("If-stmts are not supported yet.") - @field_operator def nested_if(a: cases.IField, b: cases.IField, condition: bool) -> cases.IField: if condition: @@ -364,15 +293,8 @@ def nested_if(a: cases.IField, b: cases.IField, condition: bool) -> cases.IField @pytest.mark.parametrize("condition1, condition2", [[True, False], [True, False]]) +@pytest.mark.uses_if_stmts def test_if_without_else(cartesian_case, condition1, condition2): - if cartesian_case.backend in [ - gtfn_cpu.run_gtfn, - gtfn_cpu.run_gtfn_imperative, - gtfn_cpu.run_gtfn_with_temporaries, - dace_iterator.run_dace_iterator, - ]: - pytest.xfail("If-stmts are not supported yet.") - @field_operator def if_without_else( a: cases.IField, b: cases.IField, condition1: bool, condition2: bool diff --git a/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_builtins.py b/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_builtins.py index 13fcf3b87f..ca29c5b18b 100644 --- a/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_builtins.py +++ b/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_builtins.py @@ -52,7 +52,6 @@ xor_, ) from gt4py.next.iterator.runtime import closure, fendef, fundef, offset -from gt4py.next.program_processors.runners.dace_iterator import run_dace_iterator from gt4py.next.program_processors.runners.gtfn_cpu import run_gtfn from next_tests.integration_tests.feature_tests.math_builtin_test_data import math_builtin_test_data @@ -171,10 +170,6 @@ def arithmetic_and_logical_test_data(): @pytest.mark.parametrize("builtin, inputs, expected", arithmetic_and_logical_test_data()) def test_arithmetic_and_logical_builtins(program_processor, builtin, inputs, expected, as_column): program_processor, validate = program_processor - if program_processor == run_dace_iterator: - pytest.xfail( - "Not supported in DaCe backend: argument types are not propagated for ITIR tests" - ) inps = asfield(*asarray(*inputs)) out = asfield((np.zeros_like(*asarray(expected))))[0] @@ -207,10 +202,6 @@ def test_arithmetic_and_logical_functors_gtfn(builtin, inputs, expected): @pytest.mark.parametrize("builtin_name, inputs", math_builtin_test_data()) def test_math_function_builtins(program_processor, builtin_name, inputs, as_column): program_processor, validate = program_processor - if program_processor == run_dace_iterator: - pytest.xfail( - "Not supported in DaCe backend: argument types are not propagated for ITIR tests" - ) if builtin_name == "gamma": # numpy has no gamma function @@ -254,10 +245,9 @@ def foo(a): @pytest.mark.parametrize("stencil", [_can_deref, _can_deref_lifted]) +@pytest.mark.uses_can_deref def test_can_deref(program_processor, stencil): program_processor, validate = program_processor - if program_processor == run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: can_deref") Node = gtx.Dimension("Node") diff --git a/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_conditional.py b/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_conditional.py index d20ec2ee3d..c2517f1a07 100644 --- a/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_conditional.py +++ b/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_conditional.py @@ -18,7 +18,6 @@ import gt4py.next as gtx from gt4py.next.iterator.builtins import * from gt4py.next.iterator.runtime import closure, fendef, fundef -from gt4py.next.program_processors.runners.dace_iterator import run_dace_iterator from next_tests.unit_tests.conftest import program_processor, run_processor @@ -27,15 +26,14 @@ @fundef -def test_conditional(inp): +def stencil_conditional(inp): tmp = if_(eq(deref(inp), 0), make_tuple(1.0, 2.0), make_tuple(3.0, 4.0)) return tuple_get(0, tmp) + tuple_get(1, tmp) +@pytest.mark.uses_tuple_returns def test_conditional_w_tuple(program_processor): program_processor, validate = program_processor - if program_processor == run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") shape = [5] @@ -46,7 +44,7 @@ def test_conditional_w_tuple(program_processor): IDim: range(0, shape[0]), } run_processor( - test_conditional[dom], + stencil_conditional[dom], program_processor, inp, out=out, diff --git a/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_horizontal_indirection.py b/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_horizontal_indirection.py index f4ebc596e5..75b935677b 100644 --- a/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_horizontal_indirection.py +++ b/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_horizontal_indirection.py @@ -34,8 +34,6 @@ from gt4py.next.program_processors.formatters.gtfn import ( format_sourcecode as gtfn_format_sourcecode, ) -from gt4py.next.program_processors.runners import gtfn_cpu -from gt4py.next.program_processors.runners.dace_iterator import run_dace_iterator from next_tests.integration_tests.cases import IDim from next_tests.unit_tests.conftest import program_processor, run_processor @@ -54,16 +52,13 @@ def conditional_indirection(inp, cond): return deref(compute_shift(cond)(inp)) +@pytest.mark.uses_applied_shifts def test_simple_indirection(program_processor): program_processor, validate = program_processor if program_processor in [ type_check.check, - gtfn_cpu.run_gtfn, - gtfn_cpu.run_gtfn_imperative, - gtfn_cpu.run_gtfn_with_temporaries, gtfn_format_sourcecode, - run_dace_iterator, ]: pytest.xfail( "We only support applied shifts in type_inference." @@ -97,13 +92,9 @@ def direct_indirection(inp, cond): return deref(shift(I, deref(cond))(inp)) +@pytest.mark.uses_dynamic_offsets def test_direct_offset_for_indirection(program_processor): program_processor, validate = program_processor - if program_processor == run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: shift offsets not literals") - - if program_processor == gtfn_cpu.run_gtfn_with_temporaries: - pytest.xfail("Dynamic offsets not supported in temporaries pass.") shape = [4] inp = gtx.np_as_located_field(IDim)(np.asarray(range(shape[0]), dtype=np.float64)) diff --git a/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_implicit_fencil.py b/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_implicit_fencil.py index 2076cdd864..d0dc8ec475 100644 --- a/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_implicit_fencil.py +++ b/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_implicit_fencil.py @@ -18,7 +18,6 @@ import gt4py.next as gtx from gt4py.next.iterator.builtins import * from gt4py.next.iterator.runtime import fundef -from gt4py.next.program_processors.runners.dace_iterator import run_dace_iterator from next_tests.unit_tests.conftest import program_processor, run_processor @@ -59,10 +58,6 @@ def test_single_argument(program_processor, dom): def test_2_arguments(program_processor, dom): program_processor, validate = program_processor - if program_processor == run_dace_iterator: - pytest.xfail( - "Not supported in DaCe backend: argument types are not propagated for ITIR tests" - ) @fundef def fun(inp0, inp1): diff --git a/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_scan.py b/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_scan.py index e0460b67b1..e02dab0a72 100644 --- a/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_scan.py +++ b/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_scan.py @@ -18,16 +18,14 @@ import gt4py.next as gtx from gt4py.next.iterator.builtins import cartesian_domain, deref, named_range, scan, shift from gt4py.next.iterator.runtime import fundef, offset -from gt4py.next.program_processors.runners.dace_iterator import run_dace_iterator from next_tests.integration_tests.cases import IDim, KDim from next_tests.unit_tests.conftest import lift_mode, program_processor, run_processor +@pytest.mark.uses_index_fields def test_scan_in_stencil(program_processor, lift_mode): program_processor, validate = program_processor - if program_processor == run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: shift inside lambda") isize = 1 ksize = 3 diff --git a/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_strided_offset_provider.py b/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_strided_offset_provider.py index 7bfaa7f643..0ac38e9b9f 100644 --- a/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_strided_offset_provider.py +++ b/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_strided_offset_provider.py @@ -18,8 +18,6 @@ import gt4py.next as gtx from gt4py.next.iterator.builtins import deref, named_range, shift, unstructured_domain from gt4py.next.iterator.runtime import closure, fendef, fundef, offset -from gt4py.next.program_processors.runners import gtfn_cpu -from gt4py.next.program_processors.runners.dace_iterator import run_dace_iterator from next_tests.unit_tests.conftest import program_processor, run_processor @@ -49,15 +47,9 @@ def fencil(size, out, inp): ) +@pytest.mark.uses_strided_neighbor_offset def test_strided_offset_provider(program_processor): program_processor, validate = program_processor - if program_processor in [ - gtfn_cpu.run_gtfn, - gtfn_cpu.run_gtfn_imperative, - gtfn_cpu.run_gtfn_with_temporaries, - run_dace_iterator, - ]: - pytest.xfail("gtx.StridedNeighborOffsetProvider not implemented in bindings.") LocA_size = 2 max_neighbors = LocA2LocAB_offset_provider.max_neighbors diff --git a/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_trivial.py b/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_trivial.py index 7cc4e95949..cc12183a24 100644 --- a/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_trivial.py +++ b/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_trivial.py @@ -19,7 +19,6 @@ from gt4py.next.iterator import transforms from gt4py.next.iterator.builtins import * from gt4py.next.iterator.runtime import closure, fendef, fundef, offset -from gt4py.next.program_processors.runners.gtfn_cpu import run_gtfn from next_tests.integration_tests.cases import IDim, JDim, KDim from next_tests.unit_tests.conftest import lift_mode, program_processor, run_processor diff --git a/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_tuple.py b/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_tuple.py index 5a6ffe2891..bd5a717bb2 100644 --- a/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_tuple.py +++ b/tests/next_tests/integration_tests/feature_tests/iterator_tests/test_tuple.py @@ -18,13 +18,8 @@ import gt4py.next as gtx from gt4py.next.iterator.builtins import * from gt4py.next.iterator.runtime import closure, fendef, fundef -from gt4py.next.program_processors.runners.dace_iterator import run_dace_iterator -from next_tests.unit_tests.conftest import ( - program_processor, - program_processor_no_gtfn_exec, - run_processor, -) +from next_tests.unit_tests.conftest import program_processor, run_processor IDim = gtx.Dimension("IDim") @@ -54,10 +49,9 @@ def tuple_output2(inp1, inp2): "stencil", [tuple_output1, tuple_output2], ) +@pytest.mark.uses_tuple_returns def test_tuple_output(program_processor, stencil): program_processor, validate = program_processor - if program_processor == run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") shape = [5, 7, 9] rng = np.random.default_rng() @@ -94,10 +88,9 @@ def tuple_of_tuple_output2(inp1, inp2, inp3, inp4): return make_tuple(deref(inp1), deref(inp2)), make_tuple(deref(inp3), deref(inp4)) +@pytest.mark.uses_tuple_returns def test_tuple_of_tuple_of_field_output(program_processor): program_processor, validate = program_processor - if program_processor == run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") @fundef def stencil(inp1, inp2, inp3, inp4): @@ -155,10 +148,9 @@ def stencil(inp1, inp2, inp3, inp4): "stencil", [tuple_output1, tuple_output2], ) +@pytest.mark.uses_tuple_returns def test_tuple_of_field_output_constructed_inside(program_processor, stencil): program_processor, validate = program_processor - if program_processor == run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") @fendef def fencil(size0, size1, size2, inp1, inp2, out1, out2): @@ -202,10 +194,9 @@ def fencil(size0, size1, size2, inp1, inp2, out1, out2): assert np.allclose(inp2, out2) +@pytest.mark.uses_tuple_returns def test_asymetric_nested_tuple_of_field_output_constructed_inside(program_processor): program_processor, validate = program_processor - if program_processor == run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") @fundef def stencil(inp1, inp2, inp3): @@ -265,10 +256,8 @@ def fencil(size0, size1, size2, inp1, inp2, inp3, out1, out2, out3): "stencil", [tuple_output1, tuple_output2], ) -def test_field_of_extra_dim_output(program_processor_no_gtfn_exec, stencil): - program_processor, validate = program_processor_no_gtfn_exec - if program_processor == run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") +def test_field_of_extra_dim_output(program_processor, stencil): + program_processor, validate = program_processor shape = [5, 7, 9] rng = np.random.default_rng() @@ -299,10 +288,9 @@ def tuple_input(inp): return tuple_get(0, inp_deref) + tuple_get(1, inp_deref) +@pytest.mark.uses_tuple_returns def test_tuple_field_input(program_processor): program_processor, validate = program_processor - if program_processor == run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") shape = [5, 7, 9] rng = np.random.default_rng() @@ -326,10 +314,8 @@ def test_tuple_field_input(program_processor): @pytest.mark.xfail(reason="Implement wrapper for extradim as tuple") -def test_field_of_extra_dim_input(program_processor_no_gtfn_exec): - program_processor, validate = program_processor_no_gtfn_exec - if program_processor == run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") +def test_field_of_extra_dim_input(program_processor): + program_processor, validate = program_processor shape = [5, 7, 9] rng = np.random.default_rng() @@ -362,10 +348,9 @@ def tuple_tuple_input(inp): ) +@pytest.mark.uses_tuple_returns def test_tuple_of_tuple_of_field_input(program_processor): program_processor, validate = program_processor - if program_processor == run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") shape = [5, 7, 9] rng = np.random.default_rng() @@ -404,10 +389,8 @@ def test_tuple_of_tuple_of_field_input(program_processor): @pytest.mark.xfail(reason="Implement wrapper for extradim as tuple") -def test_field_of_2_extra_dim_input(program_processor_no_gtfn_exec): - program_processor, validate = program_processor_no_gtfn_exec - if program_processor == run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple returns") +def test_field_of_2_extra_dim_input(program_processor): + program_processor, validate = program_processor shape = [5, 7, 9] rng = np.random.default_rng() diff --git a/tests/next_tests/integration_tests/multi_feature_tests/ffront_tests/test_icon_like_scan.py b/tests/next_tests/integration_tests/multi_feature_tests/ffront_tests/test_icon_like_scan.py index 2580c6ba7f..8db9a4c36e 100644 --- a/tests/next_tests/integration_tests/multi_feature_tests/ffront_tests/test_icon_like_scan.py +++ b/tests/next_tests/integration_tests/multi_feature_tests/ffront_tests/test_icon_like_scan.py @@ -18,7 +18,7 @@ import pytest import gt4py.next as gtx -from gt4py.next.program_processors.runners import dace_iterator, gtfn_cpu, roundtrip +from gt4py.next.program_processors.runners import gtfn_cpu, roundtrip from next_tests.integration_tests.feature_tests.ffront_tests.ffront_test_utils import ( fieldview_backend, @@ -211,6 +211,7 @@ class setup: return setup() +@pytest.mark.uses_tuple_returns def test_solve_nonhydro_stencil_52_like_z_q(test_setup, fieldview_backend): if fieldview_backend in [ gtfn_cpu.run_gtfn, @@ -218,8 +219,6 @@ def test_solve_nonhydro_stencil_52_like_z_q(test_setup, fieldview_backend): gtfn_cpu.run_gtfn_with_temporaries, ]: pytest.xfail("Needs implementation of scan projector.") - if fieldview_backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: scans") solve_nonhydro_stencil_52_like_z_q.with_backend(fieldview_backend)( test_setup.z_alpha, @@ -233,6 +232,7 @@ def test_solve_nonhydro_stencil_52_like_z_q(test_setup, fieldview_backend): assert np.allclose(test_setup.z_q_ref[:, 1:], test_setup.z_q_out[:, 1:]) +@pytest.mark.uses_tuple_returns def test_solve_nonhydro_stencil_52_like_z_q_tup(test_setup, fieldview_backend): if fieldview_backend in [gtfn_cpu.run_gtfn_with_temporaries]: pytest.xfail( @@ -241,8 +241,6 @@ def test_solve_nonhydro_stencil_52_like_z_q_tup(test_setup, fieldview_backend): ) if fieldview_backend == roundtrip.executor: pytest.xfail("Needs proper handling of tuple[Column] <-> Column[tuple].") - if fieldview_backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuples, scans") solve_nonhydro_stencil_52_like_z_q_tup.with_backend(fieldview_backend)( test_setup.z_alpha, @@ -256,11 +254,10 @@ def test_solve_nonhydro_stencil_52_like_z_q_tup(test_setup, fieldview_backend): assert np.allclose(test_setup.z_q_ref[:, 1:], test_setup.z_q_out[:, 1:]) +@pytest.mark.uses_tuple_returns def test_solve_nonhydro_stencil_52_like(test_setup, fieldview_backend): if fieldview_backend in [gtfn_cpu.run_gtfn_with_temporaries]: pytest.xfail("Temporary extraction does not work correctly in combination with scans.") - if fieldview_backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: scans") solve_nonhydro_stencil_52_like.with_backend(fieldview_backend)( test_setup.z_alpha, test_setup.z_beta, @@ -274,13 +271,12 @@ def test_solve_nonhydro_stencil_52_like(test_setup, fieldview_backend): assert np.allclose(test_setup.w_ref, test_setup.w) +@pytest.mark.uses_tuple_returns def test_solve_nonhydro_stencil_52_like_with_gtfn_tuple_merge(test_setup, fieldview_backend): if fieldview_backend in [gtfn_cpu.run_gtfn_with_temporaries]: pytest.xfail("Temporary extraction does not work correctly in combination with scans.") if fieldview_backend == roundtrip.executor: pytest.xfail("Needs proper handling of tuple[Column] <-> Column[tuple].") - if fieldview_backend == dace_iterator.run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuples, scans") solve_nonhydro_stencil_52_like_with_gtfn_tuple_merge.with_backend(fieldview_backend)( test_setup.z_alpha, diff --git a/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_anton_toy.py b/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_anton_toy.py index 14d929e822..16d839a8ab 100644 --- a/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_anton_toy.py +++ b/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_anton_toy.py @@ -19,7 +19,6 @@ from gt4py.next.iterator.builtins import cartesian_domain, deref, lift, named_range, shift from gt4py.next.iterator.runtime import closure, fendef, fundef, offset from gt4py.next.program_processors.runners import gtfn_cpu -from gt4py.next.program_processors.runners.dace_iterator import run_dace_iterator from next_tests.unit_tests.conftest import lift_mode, program_processor, run_processor @@ -75,6 +74,7 @@ def naive_lap(inp): return out +@pytest.mark.uses_origin def test_anton_toy(program_processor, lift_mode): program_processor, validate = program_processor @@ -87,8 +87,6 @@ def test_anton_toy(program_processor, lift_mode): if lift_mode != transforms.LiftMode.FORCE_INLINE: pytest.xfail("TODO: issue with temporaries that crashes the application") - if program_processor == run_dace_iterator: - pytest.xfail("TODO: not supported in DaCe backend") shape = [5, 7, 9] rng = np.random.default_rng() diff --git a/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_column_stencil.py b/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_column_stencil.py index 2446d6664f..41d6c8f0f9 100644 --- a/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_column_stencil.py +++ b/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_column_stencil.py @@ -18,11 +18,6 @@ import gt4py.next as gtx from gt4py.next.iterator.builtins import * from gt4py.next.iterator.runtime import closure, fendef, fundef, offset -from gt4py.next.program_processors.formatters.gtfn import ( - format_sourcecode as gtfn_format_sourcecode, -) -from gt4py.next.program_processors.runners.dace_iterator import run_dace_iterator -from gt4py.next.program_processors.runners.gtfn_cpu import run_gtfn, run_gtfn_imperative from next_tests.integration_tests.cases import IDim, KDim from next_tests.unit_tests.conftest import lift_mode, program_processor, run_processor @@ -79,11 +74,10 @@ def basic_stencils(request): return request.param +@pytest.mark.uses_origin def test_basic_column_stencils(program_processor, lift_mode, basic_stencils): program_processor, validate = program_processor stencil, ref_fun, inp_fun = basic_stencils - if program_processor == run_dace_iterator and inp_fun: - pytest.xfail("Not supported in DaCe backend: origin") shape = [5, 7] inp = ( @@ -95,13 +89,6 @@ def test_basic_column_stencils(program_processor, lift_mode, basic_stencils): ref = ref_fun(inp) - if ( - program_processor == run_dace_iterator - and stencil.__name__ == "shift_stencil" - and inp.origin - ): - pytest.xfail("Not supported in DaCe backend: origin") - run_processor( stencil[{IDim: range(0, shape[0]), KDim: range(0, shape[1])}], program_processor, @@ -162,12 +149,10 @@ def k_level_condition_upper_tuple(k_idx, k_level): ), ], ) +@pytest.mark.uses_tuple_returns def test_k_level_condition(program_processor, lift_mode, fun, k_level, inp_function, ref_function): program_processor, validate = program_processor - if program_processor == run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: tuple arguments") - k_size = 5 inp = inp_function(k_size) ref = ref_function(inp) @@ -361,10 +346,6 @@ def sum_shifted_fencil(out, inp0, inp1, k_size): def test_different_vertical_sizes(program_processor): program_processor, validate = program_processor - if program_processor == run_dace_iterator: - pytest.xfail( - "Not supported in DaCe backend: argument types are not propagated for ITIR tests" - ) k_size = 10 inp0 = gtx.np_as_located_field(KDim)(np.arange(0, k_size)) @@ -401,10 +382,9 @@ def sum_fencil(out, inp0, inp1, k_size): ) +@pytest.mark.uses_origin def test_different_vertical_sizes_with_origin(program_processor): program_processor, validate = program_processor - if program_processor == run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: origin") k_size = 10 inp0 = gtx.np_as_located_field(KDim)(np.arange(0, k_size)) diff --git a/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_fvm_nabla.py b/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_fvm_nabla.py index 2d35fb1e50..42de13ef44 100644 --- a/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_fvm_nabla.py +++ b/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_fvm_nabla.py @@ -15,8 +15,6 @@ import numpy as np import pytest -from gt4py.next.program_processors.runners.dace_iterator import run_dace_iterator - pytest.importorskip("atlas4py") @@ -136,15 +134,9 @@ def nabla( ) +@pytest.mark.requires_atlas def test_compute_zavgS(program_processor, lift_mode): program_processor, validate = program_processor - if program_processor in [ - gtfn_cpu.run_gtfn, - gtfn_cpu.run_gtfn_imperative, - gtfn_cpu.run_gtfn_with_temporaries, - run_dace_iterator, - ]: - pytest.xfail("TODO: bindings don't support Atlas tables") setup = nabla_setup() pp = gtx.np_as_located_field(Vertex)(setup.input_field) @@ -201,15 +193,9 @@ def compute_zavgS2_fencil( ) +@pytest.mark.requires_atlas def test_compute_zavgS2(program_processor, lift_mode): program_processor, validate = program_processor - if program_processor in [ - gtfn_cpu.run_gtfn, - gtfn_cpu.run_gtfn_imperative, - gtfn_cpu.run_gtfn_with_temporaries, - run_dace_iterator, - ]: - pytest.xfail("TODO: bindings don't support Atlas tables") setup = nabla_setup() pp = gtx.np_as_located_field(Vertex)(setup.input_field) @@ -244,15 +230,9 @@ def test_compute_zavgS2(program_processor, lift_mode): assert_close(1000788897.3202186, np.max(zavgS[1])) +@pytest.mark.requires_atlas def test_nabla(program_processor, lift_mode): program_processor, validate = program_processor - if program_processor in [ - gtfn_cpu.run_gtfn, - gtfn_cpu.run_gtfn_imperative, - gtfn_cpu.run_gtfn_with_temporaries, - run_dace_iterator, - ]: - pytest.xfail("TODO: bindings don't support Atlas tables") if lift_mode != LiftMode.FORCE_INLINE: pytest.xfail("shifted input arguments not supported for lift_mode != LiftMode.FORCE_INLINE") setup = nabla_setup() @@ -310,15 +290,9 @@ def nabla2( ) +@pytest.mark.requires_atlas def test_nabla2(program_processor, lift_mode): program_processor, validate = program_processor - if program_processor in [ - gtfn_cpu.run_gtfn, - gtfn_cpu.run_gtfn_imperative, - gtfn_cpu.run_gtfn_with_temporaries, - run_dace_iterator, - ]: - pytest.xfail("TODO: bindings don't support Atlas tables") setup = nabla_setup() sign = gtx.np_as_located_field(Vertex, V2EDim)(setup.sign_field) @@ -400,13 +374,6 @@ def test_nabla_sign(program_processor, lift_mode): program_processor, validate = program_processor if lift_mode != LiftMode.FORCE_INLINE: pytest.xfail("test is broken due to bad lift semantics in iterator IR") - if program_processor in [ - gtfn_cpu.run_gtfn, - gtfn_cpu.run_gtfn_imperative, - gtfn_cpu.run_gtfn_with_temporaries, - run_dace_iterator, - ]: - pytest.xfail("TODO: bindings don't support Atlas tables") setup = nabla_setup() is_pole_edge = gtx.np_as_located_field(Edge)(setup.is_pole_edge_field) diff --git a/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_hdiff.py b/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_hdiff.py index 1dfad40e48..7bd028b7c3 100644 --- a/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_hdiff.py +++ b/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_hdiff.py @@ -24,12 +24,7 @@ from next_tests.integration_tests.multi_feature_tests.iterator_tests.hdiff_reference import ( hdiff_reference, ) -from next_tests.unit_tests.conftest import ( - lift_mode, - program_processor, - program_processor_no_dace_exec, - run_processor, -) +from next_tests.unit_tests.conftest import lift_mode, program_processor, run_processor I = offset("I") @@ -76,8 +71,9 @@ def hdiff(inp, coeff, out, x, y): ) -def test_hdiff(hdiff_reference, program_processor_no_dace_exec, lift_mode): - program_processor, validate = program_processor_no_dace_exec +@pytest.mark.uses_origin +def test_hdiff(hdiff_reference, program_processor, lift_mode): + program_processor, validate = program_processor if program_processor in [ gtfn_cpu.run_gtfn, gtfn_cpu.run_gtfn_imperative, diff --git a/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_vertical_advection.py b/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_vertical_advection.py index 4474121876..f11046cb5d 100644 --- a/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_vertical_advection.py +++ b/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_vertical_advection.py @@ -25,12 +25,7 @@ from gt4py.next.program_processors.runners import gtfn_cpu from next_tests.integration_tests.cases import IDim, JDim, KDim -from next_tests.unit_tests.conftest import ( - lift_mode, - program_processor, - program_processor_no_dace_exec, - run_processor, -) +from next_tests.unit_tests.conftest import lift_mode, program_processor, run_processor @fundef @@ -120,8 +115,9 @@ def fen_solve_tridiag2(i_size, j_size, k_size, a, b, c, d, x): @pytest.mark.parametrize("fencil", [fen_solve_tridiag, fen_solve_tridiag2]) -def test_tridiag(fencil, tridiag_reference, program_processor_no_dace_exec, lift_mode): - program_processor, validate = program_processor_no_dace_exec +@pytest.mark.uses_lift_expressions +def test_tridiag(fencil, tridiag_reference, program_processor, lift_mode): + program_processor, validate = program_processor if ( program_processor in [ diff --git a/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_with_toy_connectivity.py b/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_with_toy_connectivity.py index ee07372731..27c9f6d124 100644 --- a/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_with_toy_connectivity.py +++ b/tests/next_tests/integration_tests/multi_feature_tests/iterator_tests/test_with_toy_connectivity.py @@ -32,7 +32,6 @@ from gt4py.next.iterator.runtime import fundef from gt4py.next.program_processors.formatters import gtfn from gt4py.next.program_processors.runners import gtfn_cpu -from gt4py.next.program_processors.runners.dace_iterator import run_dace_iterator from next_tests.toy_connectivity import ( C2E, @@ -54,7 +53,6 @@ from next_tests.unit_tests.conftest import ( lift_mode, program_processor, - program_processor_no_dace_exec, program_processor_no_gtfn_exec, run_processor, ) @@ -139,10 +137,9 @@ def map_make_const_list(in_edges): return reduce(plus, 0)(map_(multiplies)(neighbors(V2E, in_edges), make_const_list(2))) +@pytest.mark.uses_constant_fields def test_map_make_const_list(program_processor_no_gtfn_exec, lift_mode): program_processor, validate = program_processor_no_gtfn_exec - if program_processor == run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: make_const_list") inp = edge_index_field() out = gtx.np_as_located_field(Vertex)(np.zeros([9], inp.dtype)) ref = 2 * np.sum(v2e_arr, axis=1) @@ -244,8 +241,9 @@ def slice_sparse_stencil(sparse): return list_get(1, deref(sparse)) -def test_slice_sparse(program_processor_no_dace_exec, lift_mode): - program_processor, validate = program_processor_no_dace_exec +@pytest.mark.uses_sparse_fields +def test_slice_sparse(program_processor, lift_mode): + program_processor, validate = program_processor inp = gtx.np_as_located_field(Vertex, V2VDim)(v2v_arr) out = gtx.np_as_located_field(Vertex)(np.zeros([9], dtype=inp.dtype)) @@ -298,8 +296,9 @@ def shift_sliced_sparse_stencil(sparse): return list_get(1, deref(shift(V2V, 0)(sparse))) -def test_shift_sliced_sparse(program_processor_no_dace_exec, lift_mode): - program_processor, validate = program_processor_no_dace_exec +@pytest.mark.uses_sparse_fields +def test_shift_sliced_sparse(program_processor, lift_mode): + program_processor, validate = program_processor inp = gtx.np_as_located_field(Vertex, V2VDim)(v2v_arr) out = gtx.np_as_located_field(Vertex)(np.zeros([9], dtype=inp.dtype)) @@ -325,8 +324,9 @@ def slice_shifted_sparse_stencil(sparse): return list_get(1, deref(shift(V2V, 0)(sparse))) -def test_slice_shifted_sparse(program_processor_no_dace_exec, lift_mode): - program_processor, validate = program_processor_no_dace_exec +@pytest.mark.uses_sparse_fields +def test_slice_shifted_sparse(program_processor, lift_mode): + program_processor, validate = program_processor inp = gtx.np_as_located_field(Vertex, V2VDim)(v2v_arr) out = gtx.np_as_located_field(Vertex)(np.zeros([9], dtype=inp.dtype)) @@ -357,8 +357,8 @@ def lift_stencil(inp): return deref(shift(V2V, 2)(lift(deref_stencil)(inp))) -def test_lift(program_processor_no_dace_exec, lift_mode): - program_processor, validate = program_processor_no_dace_exec +def test_lift(program_processor, lift_mode): + program_processor, validate = program_processor inp = vertex_index_field() out = gtx.np_as_located_field(Vertex)(np.zeros([9], dtype=inp.dtype)) ref = np.asarray(np.asarray(range(9))) @@ -380,8 +380,9 @@ def sparse_shifted_stencil(inp): return list_get(2, list_get(0, neighbors(V2V, inp))) -def test_shift_sparse_input_field(program_processor_no_dace_exec, lift_mode): - program_processor, validate = program_processor_no_dace_exec +@pytest.mark.uses_sparse_fields +def test_shift_sparse_input_field(program_processor, lift_mode): + program_processor, validate = program_processor inp = gtx.np_as_located_field(Vertex, V2VDim)(v2v_arr) out = gtx.np_as_located_field(Vertex)(np.zeros([9], dtype=inp.dtype)) ref = np.asarray(np.asarray(range(9))) @@ -409,8 +410,9 @@ def shift_sparse_stencil2(inp): return list_get(1, list_get(3, neighbors(V2E, inp))) -def test_shift_sparse_input_field2(program_processor_no_dace_exec, lift_mode): - program_processor, validate = program_processor_no_dace_exec +@pytest.mark.uses_sparse_fields +def test_shift_sparse_input_field2(program_processor, lift_mode): + program_processor, validate = program_processor if program_processor in [ gtfn_cpu.run_gtfn, gtfn_cpu.run_gtfn_imperative, @@ -459,13 +461,12 @@ def sum_(a, b): return reduce(sum_, 0)(neighbors(V2V, lift(lambda x: reduce(sum_, 0)(deref(x)))(inp))) +@pytest.mark.uses_sparse_fields def test_sparse_shifted_stencil_reduce(program_processor_no_gtfn_exec, lift_mode): program_processor, validate = program_processor_no_gtfn_exec if program_processor == gtfn.format_sourcecode: pytest.xfail("We cannot unroll a reduction on a sparse field only.") # With our current understanding, this iterator IR program is illegal, however we might want to fix it and therefore keep the test for now. - if program_processor == run_dace_iterator: - pytest.xfail("Not supported in DaCe backend: illegal iterator IR") if lift_mode != transforms.LiftMode.FORCE_INLINE: pytest.xfail("shifted input arguments not supported for lift_mode != LiftMode.FORCE_INLINE") diff --git a/tests/next_tests/unit_tests/conftest.py b/tests/next_tests/unit_tests/conftest.py index 09d58a4376..04c34dfaab 100644 --- a/tests/next_tests/unit_tests/conftest.py +++ b/tests/next_tests/unit_tests/conftest.py @@ -23,12 +23,17 @@ from gt4py.next.iterator import ir as itir, pretty_parser, pretty_printer, runtime, transforms from gt4py.next.program_processors import processor_interface as ppi from gt4py.next.program_processors.formatters import gtfn, lisp, type_check -from gt4py.next.program_processors.runners import ( - dace_iterator, - double_roundtrip, - gtfn_cpu, - roundtrip, -) +from gt4py.next.program_processors.runners import double_roundtrip, gtfn_cpu, roundtrip +from tests.next_tests import exclusion_matrices + + +try: + from gt4py.next.program_processors.runners import dace_iterator +except ModuleNotFoundError as e: + if "dace" in str(e): + dace_iterator = None + else: + raise e import next_tests @@ -60,6 +65,11 @@ def pretty_format_and_check(root: itir.FencilDefinition, *args, **kwargs) -> str return pretty +OPTIONAL_PROCESSORS = [] +if dace_iterator: + OPTIONAL_PROCESSORS.append((dace_iterator.run_dace_iterator, True)) + + @pytest.fixture( params=[ # (processor, do_validate) @@ -73,19 +83,20 @@ def pretty_format_and_check(root: itir.FencilDefinition, *args, **kwargs) -> str (gtfn_cpu.run_gtfn_imperative, True), (gtfn_cpu.run_gtfn_with_temporaries, True), (gtfn.format_sourcecode, False), - (dace_iterator.run_dace_iterator, True), - ], + ] + + OPTIONAL_PROCESSORS, ids=lambda p: next_tests.get_processor_id(p[0]), ) def program_processor(request): - return request.param + backend, _ = request.param + backend_id = next_tests.get_processor_id(backend) + """See ADR 15.""" + for marker, skip_mark, msg in exclusion_matrices.BACKEND_SKIP_TEST_MATRIX.get(backend_id, []): + if request.node.get_closest_marker(marker): + skip_mark(msg.format(marker=marker, backend=backend_id)) -@pytest.fixture -def program_processor_no_dace_exec(program_processor): - if program_processor[0] == dace_iterator.run_dace_iterator: - pytest.xfail("DaCe backend not yet supported.") - return program_processor + return request.param @pytest.fixture