Skip to content

Problem in dependency analysis #920

Open
@havogt

Description

@havogt

Adding an ij-cache for the rxm or rxp placeholder in the following example will give an out-of-bounds in the cache storage
https://github.com/MeteoSwiss-APN/cosmo-prerelease-gridtools/blob/2dd9994914714326e2f4cf0fb6f5d4d8aab9ef0a/dycore_gridtools/src/dycore/Stencils/HorizontalDiffusion/HorizontalDiffusionType2Limiter.cpp#L140.

@cosunae and I debugged the issue and we found the following problem:

  • The size of the cache is deduced to be <-2,1,-2,1> which is correct.
  • Dependency analysis computes the wrong extent<-2,1,-2,1> (the region of computation) for the LimitFluxStage.
  • However this stage has access extent<0, 1, 0, 1> on the rxp, rxm accessors. I.e. it will access at i+2 and j+2 which is out-of-bounds.

From our analysis we conclude the LimitFluxStage should have extent<-1,0,-1,0> (which is quite obvious as it is the second last stage and therefore we can directly read the extents from the accessors).

All other extents of the stages are correct. A possible problem could be the pattern in->flx->rxp->flx->out, i.e. we are writing and reading twice into/from the same temporary flx.

Workaround: The problem can be fixed by using make_stage_with_extent.

I attach the file which contains at the bottom the result of the dependency analysis. The first type contains the extents for the stages. The second type computed extended extents for the placeholders.

HorizontalDiffusionType2Limiter.txt

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions