feat(icts): harden lifecycle and optimize runtime hot paths - #149
Merged
Conversation
High-fanout pin insertion already uses the lazy pointer index from ac04f34, but bulk detach still called disconnectPinFromNet() once per pin. Each call searched/erased a vector and rescanned remaining instance pins, so removeNetSafe(), mergeNetInto(), platform disconnect, and CTS writeback could grow quadratically. Add an iDB-owned disconnectAllPinsFromNet() operation that updates pin-side regular/special net state in one pass, then clears the net-side pin/index and borrowed-instance collections once. Reuse the existing instance-name map before vector fallback, and make platform/iCTS bulk callers delegate to the invariant owner. Keep single-pin behavior and ac04f34 unchanged. This changes bulk detach from O(P^2) to O(P) average without deleting borrowed pins or instances. iDB owns this operation because its public removeNetSafe() and mergeNetInto() APIs promise bulk connectivity changes while the pin-reference index, borrowed instance list, and visible regular/special net-name invariants are private to iDB. Platform DataManager::disconnectNet() and iCTS WrapperClockWriter::DetachIdbNetPins() now delegate instead of duplicating partial per-pin cleanup. The bulk path detaches only pins whose regular net is the target, refreshes each visible name so a surviving special net wins, clears IO/instance reference collections and the existing lazy pointer index once, and resets borrowed instance references without deleting their owners. Reconnect, repeated detach, removeNetSafe(), and mergeNetInto() retain their established semantics. The ac04f34 threshold-32 pointer index is unchanged and no composite instance/pin-name index is introduced. Tests: the focused data-manager IO suite passed 11/11 GoogleTests, including bulk detach ownership, regular/special naming, remove/merge, reconnect/repeat/null detach, lazy-index rebuild, and scale coverage. The data-manager, FastSTA, lifecycle, characterization, and optimization regression set passed 10/10 CTests. Before this commit, python3 ./.trellis/ecc_dev_tools/check.py check --repo-root ecc-tools --path src/operation/iCTS completed all format, deep tidy/analyzer, header, CMake, and IWYU passes with zero in-scope findings. Performance: with one unmeasured 10,000-pin warm-up, five measured 10,000-pin rounds, and three measured 100,000-pin rounds per route, the pre-commit gate measured 10,000-pin legacy/bulk medians of 5012.230/275.687 us (18.181x) and 100,000-pin medians of 680027.005/2744.273 us (247.799x; bulk is 0.4035% of legacy). Bulk growth was 9.954x for 10x more pins, below the 15x gate. Setup/destruction was excluded and all route postconditions matched. An earlier separately allocated fixture run retained matching postconditions and a 93.597x 100,000-pin speedup, but its noisy 100,000-pin bulk samples produced 16.563x scaling and missed the 15x gate. That evidence is retained; contiguous fixture ownership left the measured API workload unchanged, and subsequent independent runs showed stable near-linear scaling. Tier 2 at commit time: the fresh baseline and post-FastSTA bp_fe_top runs passed with matching inputs and normalized effective configs, byte-identical cts.def/cts.v, and unchanged optimization decisions and QoR. The required fresh final post-iDB candidate remains scheduled after this commit in the task's final integration phase.
Yell-walkalone
approved these changes
Aug 11, 2026
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
This PR intentionally preserves the three focused commits and does not import the unrelated Liberty-loader/profiling changes from the reference branch.
Performance
Validation