-
Notifications
You must be signed in to change notification settings - Fork 71
refactor(hydro_lang)!: migrate Hydro IR to have Flo semantics at all levels #2136
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
Conversation
Deploying hydro with
|
| Latest commit: |
62094c0
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f3c7c47f.hydroflow.pages.dev |
| Branch Preview URL: | https://pr2136.hydroflow.pages.dev |
|
Draft until I add unit tests for regressions I caught during development. |
862275b to
0b8922d
Compare
…levels Previously, the Hydro -> Hydro IR layer did a bunch of work to translate between Flo semantics and DFIR semantics, so that Hydro IR -> DFIR was generally 1:1. In preparation for the simulator and DFIR's migration to Flo semantics, we now use Flo semantics in the Hydro IR (top level operators do not reset their state on batch boundaries), and shift the Flo -> DFIR semantics translation to the IR -> DFIR layer. This also comes with a breaking API change to clean up naming and avoid function overloading. In particular, `batch` / `snapshot` are renamed to `batch_atomic` and `snapshot_atomic` for the case where the batched result is supposed to be in-sync with the atomic execution context. There were a couple of bugs during the transition to the new IR semantics that were not caught by existing unit tests, so I added additional tests that cover each of them. Also makes some minor improvements / bug fixes the way: - Restricts `KeyedSingleton::snapshot` to unbounded-value only, since bounded value keyed singletons do not replay their elements - Groups together definitions for `resolve_futures` and `resolve_futures_ordered` - Removes various unnecessary `NoAtomic` trait bounds
| metadata: HydroIrMetadata, | ||
| }, | ||
|
|
||
| YieldConcat { |
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.
What is YieldConcat?
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.
In Flo-terminology, yields the bounded collection inside the tick to outside the tick by using the "concat" operator (++) for that collection type. The concat is the "natural" combination method, appending elements for stream, replacing the value for singleton, etc.
| // if both inputs are root, the output is expected to have streamy semantics, so we need | ||
| // a multiset_delta() to negate the replay behavior | ||
| parse_quote! { |
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.
Do we have an issue to fix this at the DFIR level?
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.
| #source_ident = source_iter(#expr); | ||
| } | ||
| } else { | ||
| // TODO(shadaj): a more natural semantics would be to to re-evaluate the expression on each tick |
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.
Issue for this?
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.
Previously, the Hydro -> Hydro IR layer did a bunch of work to translate between Flo semantics and DFIR semantics, so that Hydro IR -> DFIR was generally 1:1. In preparation for the simulator and DFIR's migration to Flo semantics, we now use Flo semantics in the Hydro IR (top level operators do not reset their state on batch boundaries), and shift the Flo -> DFIR semantics translation to the IR -> DFIR layer.
This also comes with a breaking API change to clean up naming and avoid function overloading. In particular,
batch/snapshotare renamed tobatch_atomicandsnapshot_atomicfor the case where the batched result is supposed to be in-sync with the atomic execution context.There were a couple of bugs during the transition to the new IR semantics that were not caught by existing unit tests, so I added additional tests that cover each of them.
Also makes some minor improvements / bug fixes the way:
KeyedSingleton::snapshotto unbounded-value only, since bounded value keyed singletons do not replay their elementsresolve_futuresandresolve_futures_orderedNoAtomictrait boundsStack created with Sapling. Best reviewed with ReviewStack.