Skip to content

next: lowering to SDFG fails with compile-time domain outside the range of the target domain #2265

@edopao

Description

@edopao

The following validation error was observed in the lowering to SDFG, in two icon4py stencil tests, when using compile-time vertical domain:

tests/dycore/stencil_tests/test_compute_derived_horizontal_winds_and_ke_and_contravariant_correction.py::TestComputeDerivedHorizontalWindsAndKEAndHorizontalAdvectionofWAndContravariantCorrection::test_TestComputeDerivedHorizontalWindsAndKEAndHorizontalAdvectionofWAndContravariantCorrection[compile_time_domain-input_data0]
dace.sdfg.validation.InvalidSDFGEdgeError: Memlet subset negative out-of-bounds (at state lambda_entry, edge __tmp14[0:29020, -3:-3] -> [0:29020, 10:10] (__tmp14:None -> __tmp15:None))
FAILED
tests/dycore/stencil_tests/test_compute_perturbed_quantities_and_interpolation.py::TestComputePerturbedQuantitiesAndInterpolation::test_TestComputePerturbedQuantitiesAndInterpolation[compile_time_domain]
dace.sdfg.validation.InvalidSDFGEdgeError: Memlet subset negative out-of-bounds (at state stmt_4, edge __tmp67[0:19208, -17:-17] -> [0:19208, 10:10] (__tmp67:None -> __tmp68:None))
FAILED

This error was triggered by the following input confuguration:

nflatlev = 13
nflat_gradp = 27
grid.num_levels = 10 (in simple_grid, used by stencil tests)

Some computation did start or end at a vertical index outside the target domain [0, 10]. This resulted in an invalid memlet subset during the lowering of a concat_where expression.

We could simply fix this in the lowering to SDFG, by removing branches of concat_where expressions when they have empty domain. Alternately, we can create an IR pass to remove such branches before lowering to SDFG.

As a temporary workaround, the test configuration was updated to use vertical indices inside the target domain (see 48c9b08).

Metadata

Metadata

Assignees

No one assigned

    Labels

    gt4py.nextIssues concerning the new version with support for non-cartesian grids.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions