Commit 0ced1e2
committed
Add MergeOrdered IR node with proper sim interleaving hooks
Addresses #2768
Replace the sliced!-based merge_ordered implementation with a dedicated
HydroNode::MergeOrdered IR node that has distinct codegen for production
and simulation.
Production codegen:
- Emits union() DFIR operator (both inputs pulled in same stratum)
Simulation codegen (two modes):
- Bounded/tick: MergeOrderedHook (inline) buffers both batches and
generates a valid interleaving via boolean coin flips, preserving
per-input order. Explores C(a+b, a) states instead of (a+b)!.
- Unbounded/top-level: TopLevelMergeOrderedHook releases one element
at a time from the front of either input queue, allowing feedback
cycles to deliver elements between releases.
API changes:
- Removed NoTick bound from merge_ordered — works on any Location and
Boundedness now. When bounded, the nondet is still explored in sim.
- State space reduced from 26 to 6 instances in the existing test
(2 elements per input: C(4,2) = 6 valid interleavings).
Tests added:
- sim_merge_ordered: ordering preservation assertion (invalid
interleavings like [2,1,3,4] are never produced)
- sim_merge_ordered_one_empty: pass-through when one input is empty
- sim_merge_ordered_cycle_back: feedback cycle where a cycled-back
element arrives before elements on the other input
- sim_merge_ordered_delayed: delayed element on one input
- deploy_merge_ordered_delayed: production localhost test with timing1 parent 5aa4324 commit 0ced1e2
5 files changed
Lines changed: 689 additions & 19 deletions
File tree
- hydro_lang/src
- compile/ir
- live_collections/stream
- sim
- viz
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
442 | 452 | | |
443 | 453 | | |
444 | 454 | | |
| |||
596 | 606 | | |
597 | 607 | | |
598 | 608 | | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
599 | 630 | | |
600 | 631 | | |
601 | 632 | | |
| |||
2036 | 2067 | | |
2037 | 2068 | | |
2038 | 2069 | | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
2039 | 2076 | | |
2040 | 2077 | | |
2041 | 2078 | | |
| |||
2312 | 2349 | | |
2313 | 2350 | | |
2314 | 2351 | | |
| 2352 | + | |
| 2353 | + | |
| 2354 | + | |
| 2355 | + | |
| 2356 | + | |
2315 | 2357 | | |
2316 | 2358 | | |
2317 | 2359 | | |
| |||
2464 | 2506 | | |
2465 | 2507 | | |
2466 | 2508 | | |
| 2509 | + | |
| 2510 | + | |
| 2511 | + | |
| 2512 | + | |
| 2513 | + | |
| 2514 | + | |
| 2515 | + | |
| 2516 | + | |
| 2517 | + | |
2467 | 2518 | | |
2468 | 2519 | | |
2469 | 2520 | | |
| |||
3180 | 3231 | | |
3181 | 3232 | | |
3182 | 3233 | | |
| 3234 | + | |
| 3235 | + | |
| 3236 | + | |
| 3237 | + | |
| 3238 | + | |
| 3239 | + | |
| 3240 | + | |
| 3241 | + | |
| 3242 | + | |
| 3243 | + | |
| 3244 | + | |
| 3245 | + | |
| 3246 | + | |
| 3247 | + | |
| 3248 | + | |
| 3249 | + | |
| 3250 | + | |
| 3251 | + | |
| 3252 | + | |
| 3253 | + | |
| 3254 | + | |
| 3255 | + | |
| 3256 | + | |
| 3257 | + | |
| 3258 | + | |
| 3259 | + | |
| 3260 | + | |
| 3261 | + | |
3183 | 3262 | | |
3184 | 3263 | | |
3185 | 3264 | | |
| |||
4247 | 4326 | | |
4248 | 4327 | | |
4249 | 4328 | | |
| 4329 | + | |
4250 | 4330 | | |
4251 | 4331 | | |
4252 | 4332 | | |
| |||
4324 | 4404 | | |
4325 | 4405 | | |
4326 | 4406 | | |
| 4407 | + | |
4327 | 4408 | | |
4328 | 4409 | | |
4329 | 4410 | | |
| |||
4378 | 4459 | | |
4379 | 4460 | | |
4380 | 4461 | | |
| 4462 | + | |
4381 | 4463 | | |
4382 | 4464 | | |
4383 | 4465 | | |
| |||
4436 | 4518 | | |
4437 | 4519 | | |
4438 | 4520 | | |
| 4521 | + | |
| 4522 | + | |
| 4523 | + | |
4439 | 4524 | | |
4440 | 4525 | | |
4441 | 4526 | | |
| |||
4526 | 4611 | | |
4527 | 4612 | | |
4528 | 4613 | | |
| 4614 | + | |
| 4615 | + | |
| 4616 | + | |
| 4617 | + | |
| 4618 | + | |
| 4619 | + | |
| 4620 | + | |
4529 | 4621 | | |
4530 | 4622 | | |
4531 | 4623 | | |
| |||
0 commit comments