Add feedback-directed global PnR search - #52
Merged
Conversation
Define the bounded candidate, solution-state, and route-order architecture so implementation can preserve layout diversity without replacing the existing local placer and routing primitives.
Keep a bounded, deterministic pool of geometry-distinct child layouts and generate stable layout combinations so global search no longer has to commit to one local result immediately.
Represent candidate selections, placements, routes, cost components, and diagnostics explicitly so later search stages can compare complete attempts instead of returning opaque first successes.
Preserve the legacy preferred child layout as the fast path while retaining geometry-diverse fallbacks. Try bounded layout combinations and multiple deterministic net orders before rejecting a placement, keeping existing route contracts and counter verification intact.
Define global-only budgets, heuristic selection, presets, and decomposed placement costs so experimental policies can be added without changing local placement or routing semantics.
Separate global search budgets, placement heuristics, net ordering, presets, and placement cost weights so experimental global strategies can be enabled and tuned without changing local placement or routing semantics.
Allow global placement policies to wrap general and register-specific flat placements across configurable z layers using alternating or net-aware assignment, while keeping the balanced default unchanged.
Split placement volume into XY footprint and height span components so layered heuristics can be tuned explicitly while default zero weights preserve existing ranking behavior.
Exercise the opt-in Thorough preset and prove connected child modules can be placed on separate z layers and routed through the existing global router.
Estimate overlapping 3D net demand in configurable coarse bins so placement policies can trade routing congestion against geometry and wire length. Keep the metric disabled for Fast and Balanced while enabling it for the experimental Thorough preset.
Generate layered variants from register-specific seed placements when Layered3D is the only selected heuristic. This makes the policy independently composable and allows forced 3D counter experiments without retaining flat candidates.
Preserve the successfully routed two-layer counter world and its placement bounding boxes so the 3D result remains available for viewer inspection and future placement comparisons.
Document a bounded continuous relaxation and legalization strategy that places hard child bounding boxes freely in 3D while preserving existing routing and verification boundaries.
Add a configurable experimental Free3D heuristic to the Thorough preset while preserving Balanced behavior and existing placement dispatch until the solver is introduced.
Seed hard child boxes throughout a deterministic 3D lattice, relax them with compactness and overlap forces, then snap and legalize the result onto nonnegative integer coordinates before routing.
Apply deterministic spring forces along module nets and rank free 3D register attempts through the same decomposed placement cost used by existing global heuristics.
Replace the layered comparison artifact with the successfully routed free-3D counter world, preserving its smaller footprint, shorter estimated wiring and verified output locations for viewer inspection.
Define burnout as settle-local stabilization state so sequential circuits can recover on later external switch changes while retaining oscillation protection within each settle.
Reject global PnR candidates that only survive the first two clock edges, cover the full two-bit count and hold cycle with an artifact regression, and regenerate the counter NBT from the first placement that passes the stronger semantic verifier.
Restrict the counter global PnR smoke test to the Free3D placement heuristic, regenerate the first artifact that passes the complete two-bit count-cycle verifier, and refresh the viewer examples so the selected result is visibly three-dimensional.
Specify a run-scoped exact-structure cache that reuses duplicate D-latch and clock-inverter candidates while keeping port remapping and disk persistence out of scope.
Reuse child layout candidates within a global PnR run when graph topology, ports, and placer configuration match, relabel cloned candidates per instance, and avoid regenerating duplicate D-latch and clock-inverter layouts.
Define staged evaluation, structured failure diagnostics, and bounded feedback-driven candidate exploration before increasing the counter search budget.
Break the approved design into release-tested steps for diagnostics, staged evaluation, diverse candidate exploration, feedback search, and counter artifact verification.
Add deterministic failure grouping and stage timing aggregation without changing candidate ordering or routing behavior.
Provide a fast global routing option with fixed frontier width and per-net expansion limits while preserving existing route contracts and AStar behavior.
Provide a fast-fail routing strategy that retains only the best immediate state, avoids frontier exploration, and preserves the existing route validation contracts.
Make global placement and routing explore bounded layout, placement, net-order, and GreedyBeam variants while reusing structurally identical local candidates. Preserve partial routes across refinement and feed routing or semantic failures back into later attempts so the counter can converge without changing the local placer. Also fix simulator source accounting and pending repeater pulse handling uncovered by end-to-end counter verification, and refresh the successful counter artifacts.
Publish the verified feedback-directed global PnR counter output and its placement visualization to the NBT viewer so the bundled example matches the latest compiler result.
Keep the global PnR implementation in the pull request while excluding internal planning and design artifacts, and remove their now-invalid AGENTS.md references.
Keep the GitHub Actions WASM build aligned with the repository's nightly toolchain so edition-gated Rust features compile consistently.
Cache redstone, cobble, torch, and power-source positions so repeated normalization avoids scanning the full world volume. Add opt-in stage profiling and a counter latency benchmark to preserve the measured performance workflow.
Use the locally validated 2025-02-08 nightly snapshot in both repository defaults and the NBT viewer workflow to prevent CI breakage from rolling nightly changes.
Precompute reverse redstone and cobble power inputs after topology initialization so signal normalization only visits connected sources. This preserves the existing event and relaxation behavior while removing repeated all-source scans.
Disable the invisible-block debug buffer so sparse structures do not rebuild geometry for every empty voxel during switch simulation.
Advance simulator idle cycles between WASM-driven manual switch changes so interactive combinational circuits do not accumulate artificial torch burnout. Add a full-adder input-walk regression test for the affected torch.
rollrat
marked this pull request as ready for review
July 18, 2026 03:14
Resolve the nbt-sim-wasm test-module conflict by preserving both the full-adder burnout regression and master's new cyclic logic graph coverage.
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
Why
The counter had feasible local layouts but global placement and routing could exhaust a single heuristic path or produce a physically routed result that failed semantic simulation. The new search treats global PnR as a bounded anytime process: it records why an attempt failed, preserves useful partial work, and explores controlled placement and routing alternatives while keeping the knobs explicit.
Impact
The two-bit counter now completes global PnR and passes two full
0 → 1 → 2 → 3 → 0cycles. The policy interfaces also make experimental placement and routing heuristics easier to enable, tune, and compare.Validation
cargo test --release global_pnr -- --nocapture— 83 passed, 2 ignoredcargo test --release simulator_counts_through_full_two_bit_cycle -- --nocaptureCOUNTER_SAMPLING_LIMIT=32 COUNTER_LAYOUT_LIMIT=1 cargo test --release counter_module_generates_world_from_child_layout_candidates -- --ignored --nocapture— passed in 233.05s, selected attempt 55 with 14 routed nets