In a meeting this morning @havogt @DropD and I discussed type assignment in the IR, and one outcome of the discussion was it would be nice to introduce a strict type checking mode for stencils that would avoid implicit casts. As a reminder, the current behavior is that all nodes are implicitly upcast to the higher representation behind the scenes.
However, if for instance the user is working on mixed precision and wanted a section of code to convert to a lower precision, that would currently not be possible. We should support a simple cast syntax to expose the existing casting behind the scenes e.g. float(field[0, 0, 0]) and add an option to enable stricter type checking.
I propose that this could be a stencil decorator argument that the frontend interprets. Do others agree or have other thoughts about such a feature?
In a meeting this morning @havogt @DropD and I discussed type assignment in the IR, and one outcome of the discussion was it would be nice to introduce a strict type checking mode for stencils that would avoid implicit casts. As a reminder, the current behavior is that all nodes are implicitly upcast to the higher representation behind the scenes.
However, if for instance the user is working on mixed precision and wanted a section of code to convert to a lower precision, that would currently not be possible. We should support a simple cast syntax to expose the existing casting behind the scenes e.g.
float(field[0, 0, 0])and add an option to enable stricter type checking.I propose that this could be a stencil decorator argument that the frontend interprets. Do others agree or have other thoughts about such a feature?