Skip to content

feat(icts): harden lifecycle and optimize runtime hot paths - #149

Merged
ZhishengZeng merged 3 commits into
mainfrom
cts_main
Aug 11, 2026
Merged

feat(icts): harden lifecycle and optimize runtime hot paths#149
ZhishengZeng merged 3 commits into
mainfrom
cts_main

Conversation

@dawnli139

Copy link
Copy Markdown
Collaborator

Summary

  • add deterministic iCTS destruction lifecycle and public destroy bindings
  • optimize FastSTA batch sizing trials with indexed node lookup and one incremental dirty-region replay
  • make iDB high-fanout bulk disconnect linear while preserving the existing ac04f34 lazy pointer index

This PR intentionally preserves the three focused commits and does not import the unrelated Liberty-loader/profiling changes from the reference branch.

Performance

  • FastSTA 10k nodes: full/incremental medians 1800.51/31.71 us
  • FastSTA 100k nodes: full/incremental medians 26250.4/756.593 us (incremental is 2.882% of full)
  • iDB 10k pins: legacy/bulk medians 5012.230/275.687 us (18.181x)
  • iDB 100k pins: legacy/bulk medians 680027.005/2744.273 us (247.799x)
  • iDB 100k/10k bulk scaling: 9.954x for 10x input growth

Validation

  • Release product build passed
  • all 22 configured iCTS CTests passed
  • FastSTA and iDB phases each passed the full local ecc_dev_tools format/tidy/header/CMake/IWYU gate with zero in-scope findings before commit
  • baseline, FastSTA candidate, and final bp_fe_top runs passed with matching inputs and normalized configs
  • cts.def and cts.v are byte-identical to baseline
  • optimization decisions, QoR reports, and normalized semantic CTS logs are unchanged

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.
@ZhishengZeng
ZhishengZeng merged commit edd7d91 into main Aug 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants