Skip to content

Strict vs nonstrict type matching and casts #263

@jdahm

Description

@jdahm

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    gt4py.cartesianIssues concerning the current version with support only for cartesian grids.triage: explorationExplore new ideas

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions