spcl / open-earth-compiler

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

Test if 'if-else' statements are lowered correctly #11

Closed muellch closed 4 years ago

muellch commented 4 years ago

Branching is needed for most advection stencils, since the form of the stencil depends on the sign of the velocity.

The most flexible way to implement if's seems to be to use the following mlir feature:

   %x, %y = loop.if %b -> (f32, f32) {
     %x_true = ...
     %y_true = ...
     loop.yield %x_true, %y_true : f32, f32
   } else {
     %x_false = ... 
     %y_false = ... 
     loop.yield %x_false, %y_false : f32, f32
   }

We have to test if any of the stencil compiler's passes fail if this feature is used (ShapeInference is a good candidate).