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]: Improve fieldop fusion #1764

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

Conversation

tehrengruber
Copy link
Contributor

@tehrengruber tehrengruber commented Dec 2, 2024

  • Add support for inlining into scans.
  • Fuse make_tuple(as_fieldop(...), as_fieldop(...)) calls into as_fieldop(λ(...) → make_tuple(...))(...).
  • Refactor pass such that inlining decision is expressed in a dedicated function _arg_inline_predicate.
  • Inline all let vars with dtype list.
  • Performance improvement: Stop visiting when reaching a stencil.
  • Bugfix for inlining of as_fieldop args that use the same arg twice, e.g. as_fieldop(...)(a, b).
  • Bugfix such that only expressions inside the expr of an itir.SetAt are considered.

Comment on lines +90 to +95
if inner_arg.id in extracted_args:
assert extracted_args[inner_arg.id] == inner_arg
alias = stencil_params[list(extracted_args.keys()).index(inner_arg.id)]
stencil_body = im.let(inner_param, im.ref(alias.id))(stencil_body)
else:
stencil_params.append(inner_param)
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 is a fix for the case covered in test_trivial_same_arg_twice

@tehrengruber tehrengruber marked this pull request as ready for review January 16, 2025 11:20
@tehrengruber tehrengruber requested a review from havogt January 16, 2025 11:28
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.

3 participants