spcl / open-earth-compiler

development repository for the open earth compiler
https://arxiv.org/abs/2005.13014
Other
76 stars 14 forks source link

add the possiblity to load and store from and to the same field #40

Open gysit opened 4 years ago

gysit commented 4 years ago

sometime it is interesting to load and store from the same field:

gysit commented 4 years ago

An example may be that we want to apply boundary conditions to an input field of the stencil program (in place). It could look as follows: %0 = stencil.load %in %1 = stencil.apply boundary %2 = stencil.apply copy %3 = stencil.combine 0 -1 %1 plus %2 stencil.store %3 to %in

The idea here is that we verify that the the dependencies of the stencil.combine are all the uses of the input %in. This verification ensure that we have no race conditions when writing to %in. Additionally, we need to ensure we are able to remove the copy stencil if the input and the output field overlap. Alternatively we may also allow the stencil.combine to directly read from an input... or we may enable the stencil combine to have only one operand -> lower the result to multiple kernels

note the stencil combine needs to verify that all its input have one use! that way we ensure that we can allocate an rectangular output for the output of the stencil combine.

this feature is probably a low priority feature for the moment