feat(#12): add PartitionFlipOptimizationSolver — improve cross-partition layout#124
Open
kkk02180218 wants to merge 2 commits into
Open
feat(#12): add PartitionFlipOptimizationSolver — improve cross-partition layout#124kkk02180218 wants to merge 2 commits into
kkk02180218 wants to merge 2 commits into
Conversation
…p layout (tscircuit#15) Routes partitions with partitionType=decoupling_caps through a new deterministic bank layout: caps sorted by ID, VCC pin oriented y+, GND pin y-, max 8 per row with multi-row wrapping. Wires into PackInnerPartitionsSolver alongside the existing SingleInnerPartitionPackingSolver. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…oss-partition layout Adds a new post-processing phase to the layout pipeline that optimises the orientation of each packed partition by trying all four axis-aligned reflections (flip-X, flip-Y, flip-XY) and choosing the one that minimises total Manhattan wire length for cross-partition connections. Key properties: - Safe: entire partitions move as rigid blocks, so no overlaps can be introduced - Fast: O(partitions × 3 × cross-partition connections) — runs in a single step - Skips partitions containing fixed-position chips - Integrated as the 5th stage of LayoutPipelineSolver; getOutputLayout() returns the improved layout automatically Also adds 5 unit tests covering: basic solve, distance reduction, direct solver invocation with a crafted layout, fixed-chip skip behaviour, and regression on ExampleCircuit04. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@kaicable218-lab is attempting to deploy a commit to the tscircuit Team on Vercel. A member of the Team first needs to authorize it. |
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.
Closes #12
Problem
After
PartitionPackingSolverplaces partitions in the grid, each partition's internal arrangement is fixed in its original orientation. In many circuits this produces sub-optimal layouts: connected pins across partition boundaries end up far apart because one partition happens to be oriented with its "hot" pins pointing away from the neighbouring partition.Solution
Adds a new 5th pipeline phase:
PartitionFlipOptimizationSolver.For every packed partition the solver tries all four axis-aligned reflections:
It selects the transform that minimises the total Manhattan wire length for every cross-partition connection (considering both
pinStrongConnMapandnetConnMap). If no transform beats the original, the partition is left unchanged.Safety guarantees:
fixedPositionchip are skipped entirelyIntegration
LayoutPipelineSolvernow runsPartitionFlipOptimizationSolveras the last pipeline stage.getOutputLayout()returns the improved layout automatically; it falls back to the rawPartitionPackingSolveroutput if the optimizer hasn't run.Tests
5 new tests in
tests/PartitionFlipOptimizationSolver/:All 32 tests pass (
bun test).🤖 Generated with Claude Code