Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ export class SchematicTraceLinesSolver extends BaseSolver {
this.chipMap = params.chipMap

this.queuedConnectionPairs = [...this.mspConnectionPairs]

// Connection pairs are solved sequentially and each child inherits the
// BaseSolver iteration limit. Give the parent enough steps to let every
// child reach its own terminal state, including scheduling/finalization.
const maxStepsPerConnectionPair = this.MAX_ITERATIONS + 2
this.MAX_ITERATIONS = Math.max(
this.MAX_ITERATIONS,
maxStepsPerConnectionPair * this.mspConnectionPairs.length + 1,
)
}

override getConstructorParams(): ConstructorParameters<
Expand Down
1,530 changes: 1,249 additions & 281 deletions tests/repros/__snapshots__/repro-pmp11282-isolated-dcdc-default-budget.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 8 additions & 31 deletions tests/repros/repro-pmp11282-isolated-dcdc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,52 +30,29 @@ test("repro PMP11282 isolated DC/DC traces and endpoint net labels", () => {
defaultPipeline.solve()

const defaultTraceSolver = defaultPipeline.schematicTraceLinesSolver!
expect(defaultPipeline.solved).toBe(false)
expect(defaultPipeline.failed).toBe(true)
expect(defaultPipeline.error).toBe(
"SchematicTraceLinesSolver ran out of iterations",
)
expect(defaultTraceSolver.solvedTracePaths).toHaveLength(70)
expect(defaultTraceSolver.failedConnectionPairs).toHaveLength(37)
expect(defaultTraceSolver.queuedConnectionPairs).toHaveLength(95)
expect(defaultPipeline.solved).toBe(true)
expect(defaultPipeline.failed).toBe(false)
expect(defaultPipeline.error).toBeNull()
expect(defaultTraceSolver.solvedTracePaths).toHaveLength(143)
expect(defaultTraceSolver.failedConnectionPairs).toHaveLength(60)
expect(defaultTraceSolver.queuedConnectionPairs).toHaveLength(0)
expect(defaultPipeline).toMatchSolverSnapshot(
import.meta.path,
"repro-pmp11282-isolated-dcdc-default-budget",
)

// Let the same unmodified production pipeline reach its downstream stages
// by increasing only this test instance's nested-solver budget. This keeps
// the reproduction production-code-free while exposing the resulting labels.
const diagnosticPipeline = new SchematicTracePipelineSolver(
cloneInputProblem(),
{ hideRatsNet: true },
)
diagnosticPipeline.solveUntilPhase("schematicTraceLinesSolver")
diagnosticPipeline.step()
diagnosticPipeline.schematicTraceLinesSolver!.MAX_ITERATIONS *=
diagnosticPipeline.mspConnectionPairSolver!.mspConnectionPairs.length
diagnosticPipeline.solve()

const finalOutput = diagnosticPipeline.inlineNetLabelSolver!.getOutput()
const finalOutput = defaultPipeline.inlineNetLabelSolver!.getOutput()
const endpointPairLabels = finalOutput.netLabelPlacements.filter((label) =>
label.netId?.includes(" to "),
)
const endpointPairNetIds = new Set(
endpointPairLabels.map((label) => label.netId!),
)

expect(diagnosticPipeline.solved).toBe(true)
expect(diagnosticPipeline.failed).toBe(false)
expect(
diagnosticPipeline.schematicTraceLinesSolver!.solvedTracePaths,
).toHaveLength(143)
expect(
diagnosticPipeline.schematicTraceLinesSolver!.failedConnectionPairs,
).toHaveLength(60)
expect(finalOutput.netLabelPlacements).toHaveLength(108)
expect(endpointPairLabels).toHaveLength(80)
expect(endpointPairNetIds.size).toBe(62)
expect(endpointPairNetIds).toContain("U500.pin8 to C501.pin1")
expect(endpointPairNetIds).toContain("L500.pin1 to L500.pin2")
expect(diagnosticPipeline).toMatchSolverSnapshot(import.meta.path)
expect(defaultPipeline).toMatchSolverSnapshot(import.meta.path)
}, 30_000)
13 changes: 8 additions & 5 deletions tests/repros/repro-pmp11282-trace-lines-iteration-budget.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const expensivePairIds = new Set([
const cloneInputProblem = (): InputProblem =>
JSON.parse(JSON.stringify(inputProblemJson))

test("PMP11282 trace-line parent exhausts its fixed budget across six children", () => {
test("PMP11282 trace-line parent budgets for all six children", () => {
const pipeline = new SchematicTracePipelineSolver(cloneInputProblem(), {
hideRatsNet: true,
})
Expand All @@ -39,9 +39,12 @@ test("PMP11282 trace-line parent exhausts its fixed budget across six children",
solver.solve()

expect(expensivePairs).toHaveLength(6)
expect(solver.solved).toBe(false)
expect(solver.failed).toBe(true)
expect(solver.error).toBe("SchematicTraceLinesSolver ran out of iterations")
expect(solver.iterations).toBe(100_001)
expect(solver.MAX_ITERATIONS).toBe(600_013)
expect(solver.solved).toBe(true)
expect(solver.failed).toBe(false)
expect(solver.error).toBeNull()
expect(solver.failedConnectionPairs).toHaveLength(6)
expect(solver.queuedConnectionPairs).toHaveLength(0)
expect(solver.iterations).toBeLessThan(solver.MAX_ITERATIONS)
expect(solver).toMatchSolverSnapshot(import.meta.path)
}, 30_000)
Loading