Skip to content
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]: Flatten as_fieldop tuple arguments #1873

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

tehrengruber
Copy link
Contributor

@tehrengruber tehrengruber commented Feb 18, 2025

Adds a new transformation in the collapse tuple pass that transforms all tuple arguments of an as_fieldop into multiple arguments, one for each element:

(⇑(λ(it) → (·it)[1]))({1, 2})
into
(⇑(λ(__ct_flat_el0_it, __ct_flat_el1_it) → ·__ct_flat_el1_it))(1, 2)

Depends on #1868

return let_expr


def unwrap_scan(stencil: itir.Lambda | itir.FunCall):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function has been moved, the only addition is the _remove_let_alias call.

@@ -71,3 +71,79 @@ def is_equal(a: itir.Expr, b: itir.Expr):
return a == b or (
CannonicalizeBoundSymbolNames.apply(a) == CannonicalizeBoundSymbolNames.apply(b)
)


def canonicalize_as_fieldop(expr: itir.FunCall) -> itir.FunCall:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function has only been moved without changes.

Copy link
Contributor

@havogt havogt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants