-
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
feat[next]: Lowering foast/past to GTIR #1569
Conversation
common_symbols: dict[str, foast.Symbol] = node.annex.propagated_symbols | ||
|
||
if return_kind is foast_introspection.StmtReturnKind.NO_RETURN: | ||
# TODO document why this case should be handled in this way, not by the more general CONDITIONAL_RETURN |
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.
question to @tehrengruber (probably smaller tree?)
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 overall good to me. Requested changes are mostly minor style issues.
src/gt4py/eve/utils.py
Outdated
@@ -1651,3 +1651,5 @@ def to_set(self) -> Set[T]: | |||
|
|||
|
|||
xiter = XIterable | |||
|
|||
__all__ = ["toolz"] |
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.
I guess this has been added to avoid linter errors but I don't think it's the right solution (and additionally __all__
should always go at the top of the file).
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.
I don't remember. My question would be, do you think it's ok to import toolz from eve (to have the import check for the ctoolz not repeated everywhere).
|
||
|
||
def test_annotated_assignment(): | ||
pytest.xfail("Annotated assignments are not properly supported at the moment.") |
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 a question: why?
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's blindly copied, I can check
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.
First error "gtx
not defined", after importing Field
directly, I get "TDim
not defined". Not sure if hard to fix.
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.
(first part might be fixed by @nfarabullini 's work...)
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.
Not sure, but I think the reason this doesn't work is because in a from __future__ import annotations
file the annotations are no evaluated and hence don't land in the closure vars. This might be something to take into consideration in @nfarabullini works.
) | ||
|
||
|
||
def test_copy_lowering(copy_program_def, gtir_identity_fundef): |
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.
Slightly outside of the scope of the PR and not strictly necessary, but in the spirit of the previous tests, I'd suggest to rename all the copy_
names (e.g. fixture, test_function, ...) should be renamed to something like identity
or pass_through
,
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.
This is actually a copy, we use the identity fieldop but assign the result into another field.
src/gt4py/eve/utils.py
Outdated
@@ -1651,3 +1651,5 @@ def to_set(self) -> Set[T]: | |||
|
|||
|
|||
xiter = XIterable | |||
|
|||
__all__ = ["toolz"] |
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.
I don't remember. My question would be, do you think it's ok to import toolz from eve (to have the import check for the ctoolz not repeated everywhere).
common_symbols: dict[str, foast.Symbol] = node.annex.propagated_symbols | ||
|
||
if return_kind is foast_introspection.StmtReturnKind.NO_RETURN: | ||
# TODO document why this case should be handled in this way, not by the more general CONDITIONAL_RETURN |
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.
This is meant to be resolved in this PR, probably removed.
@@ -136,7 +136,6 @@ class TupleConstructorType(Protocol, Generic[_R]): | |||
def __call__(self, *args: Any) -> _R: ... | |||
|
|||
|
|||
# TODO(havogt): the complicated typing is a hint that this function needs refactoring |
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.
this is the Till's tree_map
version. this removal is acknowledging that the problem is not simple and typing is complicated for this kind of function.
|
||
|
||
def test_annotated_assignment(): | ||
pytest.xfail("Annotated assignments are not properly supported at the moment.") |
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's blindly copied, I can check
Co-authored-by: Enrique González Paredes <[email protected]>
@@ -356,6 +363,18 @@ def lifted_neighbors(offset, it) -> itir.Expr: | |||
return lift(lambda_("it")(neighbors(offset, "it")))(it) | |||
|
|||
|
|||
def as_fieldop_neighbors(offset, it) -> itir.Expr: |
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.
We need to also pass the optional domain of as_fieldop
, at least for unit testing of gtir to SDFG. Anyway, I could also add it in my PR.
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 to me.
common_symbols: dict[str, foast.Symbol] = node.annex.propagated_symbols | ||
|
||
if return_kind is foast_introspection.StmtReturnKind.NO_RETURN: | ||
# FIXME[#1582](havogt): document why this case should be handled in this way, not by the more general CONDITIONAL_RETURN |
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.
# FIXME[#1582](havogt): document why this case should be handled in this way, not by the more general CONDITIONAL_RETURN | |
# FIXME[#1582](tehrengruber): document why this case should be handled in this way, not by the more general CONDITIONAL_RETURN |
Adds lowering of foast and past to GTIR.
The backend that goes through the new lowering is not enabled in this PR as it is missing the domain propagation pass which comes in a different PR. The lowering is tested with the test_foast_to_gtir (which is an extended duplication of
test_foast_to_itir
which will eventually be deleted).Notes: