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

refactor[next]: Change foast lowering from iterator of tuple to tuple of iterator #1449

Conversation

tehrengruber
Copy link
Contributor

@tehrengruber tehrengruber commented Feb 8, 2024

Changes lowering from FOAST to ITIR to use tuples of iterators instead of iterators of tuples.

  • Allows the collapse tuple pass to better optimize as what was previously lowered to ↑(λ(it) → it[0])(↑(λ() → {1, 2}) is now ({↑(λ() → 1)(), ↑(λ() → 2)()})[0]
  • Fixes tuples of fields of different locations violate ITIR #1413. In particular in combination with temporaries creating an iterator of tuples is problematic in case the respective backing fields are defined on different domains. This did not surface before as inlining all lifts everything always removed the invalid derefs.

@tehrengruber tehrengruber changed the base branch from improve_collapse_tuple to main February 13, 2024 13:12
@@ -130,7 +130,7 @@ def compilation_hash(otf_closure: stages.ProgramCall) -> int:
)

GTFN_DEFAULT_COMPILE_STEP: step_types.CompilationStep = compiler.Compiler(
cache_strategy=cache.Strategy.SESSION, builder_factory=compiledb.CompiledbFactory()
cache_strategy=cache.Strategy.PERSISTENT, builder_factory=cmake.CMakeFactory()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will be removed before merge. Breaks code-quality so won't be forgotten.

@tehrengruber tehrengruber marked this pull request as ready for review February 13, 2024 15:28
@tehrengruber tehrengruber requested a review from havogt February 13, 2024 15:28
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.

Can you carefully check where tests are missing? Difficult to follow the transformations without examples.

@tehrengruber
Copy link
Contributor Author

Let's quickly talk about testing tomorrow.

@tehrengruber tehrengruber merged commit 077c786 into GridTools:main Feb 16, 2024
31 checks passed
tehrengruber added a commit that referenced this pull request Feb 28, 2024
#1449 introduced a hashing function for expressions that relied on Python's builtin `hash`. As `hash` is not stable across interpreter runs this broke caching in some cases. This PR fixes that.
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.

tuples of fields of different locations violate ITIR
2 participants