-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend ITIR type inference to collect the types of all subexpressions #1155
Extend ITIR type inference to collect the types of all subexpressions #1155
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good. Besides a couple of missing type hints, the rest of my comments are just questions and optional suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just two comments from my side (and the failing tests) and it will be ready to go.
collected_types Mapping from the (Python) id of a node to its type. | ||
constraints Set of constraints, where a constraint is a pair of types that need to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the correct Google style format for the docstrings (as required by sphix-napoleon: https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html#example-google)
collected_types Mapping from the (Python) id of a node to its type. | |
constraints Set of constraints, where a constraint is a pair of types that need to | |
collected_types: Mapping from the (Python) id of a node to its type. | |
constraints: Set of constraints, where a constraint is a pair of types that need to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. This should be adopted in the https://github.com/GridTools/gt4py/blob/main/CODING_GUIDELINES.rst at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was already there in functional (https://github.com/GridTools/gt4py/blob/functional/CODING_GUIDELINES.md#docstrings), but it got lost during the merge. I will update soon the documents in master with the versions from the other branch.
Blocked by #1182 |
a33f239
to
6ee1f51
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good. Don't forget to add a proper commit message.
Type inference on ITIR was previously only returning the type of a single expression. This PR introduces extends the inference to collect the type of all subexpressions and introduces a new function
_infer_all
returning a mapping from the (Python) id of a node to its type. As we start using this function we will make it public.