MeteoSwiss-APN / dawn

Compiler toolchain to enable generation of high-level DSLs for geophysical fluid dynamics models
MIT License
28 stars 30 forks source link

Fix Codegen for Sparse Fields in Nested Reductions #1156

Closed mroethlin closed 2 years ago

mroethlin commented 2 years ago

Technical Description

There was a spurious error emitted in the codegen, complaining that a sparse field was not contained in a reduction, even though it was. This can for example be triggered by

@stencil
def codegen_bug(inF: Field[Cell, K], coeff: Field[Edge > Vertex, K], outF: Field[Edge, K]):
    tempF: Field[Vertex, K]
    with domain.upward.across[lb+2:halo-1]:       
        outF = sum_over(Edge > Vertex, coeff*sum_over(Vertex > Cell, inF))

The problem was that the current state of the codegen stack was not properly communicated "downwards". This PR fixes that issue.

NOTE Due to dawn becoming EOL, This is a quick and dirty fix without test

Example

c.f. above

Testing

None

Dependencies

This PR is independent.

mroethlin commented 2 years ago

launch jenkins