Make the dual-mode example a diamond split/recombine DAG - #593
Merged
Conversation
Rework the dual_mode example so its graph! wiring is the canonical
split/recombine graph: a counter is split on parity into two labelled
branches ("{i} is odd" / "{i} is even") which are merged back into one
stream and printed. This shows the macro's dual-mode expansion deriving a
non-linear DAG — a shared apex node and a recombine — into both the
interpreted and the fully monomorphized compiled runner, with the example
asserting the two agree.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GNhpnzwTYzMe1DWiVn2h2E
0-jake-0
force-pushed
the
claude/dual-mode-split-recombine-diamond-bzgvam
branch
from
July 28, 2026 07:51
ad140d3 to
b3d2fa2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reworks the
dual_modeexample so itsgraph!wiring is a diamond (split/recombine) DAG instead of a mostly-linear chain. This demonstrates that the macro's dual-mode expansion derives a non-linear graph — a shared apex node and a two-input recombine — into both the interpreted and the fully monomorphized compiled runner, and that the two agree.countis referenced twice, so it is a shared apex node: the interpreted engine runs it once per cycle and fans the tick out to both branches, and the compiled engine emits it once and feeds bothjoininputs from the same slot.Why
Answers the question "can the dual-mode
graph!macro handle a split/recombine diamond?" — yes. The macro derives the full DAG from the wiring tokens (shared/fan-out nodes and multi-input recombine ops likejoin/merge), so nothing is limited to linear chains. Updating the canonical dual-mode example to a diamond makes that explicit in the one example most likely to be read first.Testing
cargo run -p wingfoil-next --release --example dual_mode:cargo fmt --all -- --checkandcargo clippy -p wingfoil-next --example dual_mode -- -D warningsboth pass.🤖 Generated with Claude Code
Generated by Claude Code