Repository navigation
Avoid rebuilding a connection set on every cluster join - #2466
nikosavola wants to merge 5 commits into
Conversation
Co-Authored-By: GLM 5.3 <noreply@z.ai>
- erase_after unlinked and deleted the node but did not update mp_last or m_size - erasing the last element left mp_last dangling, so the next push_back or splice wrote through freed memory, and size () over-counted after any erase - reachable from connected_clusters::rename_connection, which uses erase_after on connection lists Co-Authored-By: GLM 5.3 <noreply@z.ai>
Co-Authored-By: GLM 5.3 <noreply@z.ai>
- join_cluster_with built a std::set over the whole target connection list on every join, which is quadratic for big nets absorbing many instance clusters - small joins scan the target directly, large joins build the set once; join_clusters_with builds it once per call; list contents and order are unchanged | vexriscv LVS, 1 thread (n=10) | before (s) | after (s) | |---|---:|---:| | total | 33.56 ± 0.29 | 23.25 ± 0.12 | | connect | 19.65 ± 0.24 | 9.32 ± 0.08 | hier_clusters_big_net/8000: 2255 ± 71 ms -> 313 ± 12 ms (n=6). Measured on 2x Intel Xeon Gold 6148 (40 cores), g++ 13 -O2, mean ± standard deviation. Co-Authored-By: GLM 5.3 <noreply@z.ai>
cab899c to
aacbf75
Compare
|
Hmm ... I don't see how exactly how the patch basically solves the problem of quadratic complexity (?). With Still it's a cheap gain. I think the loop can be optimized somewhat (see my comments). |
|
You are right, it is still O(N*M), so not a real fix. The gain is that small joins no longer build a std::set of the whole target each time. That was the main cost when a big net takes in many small clusters. A real fix needs an index per cluster, and that costs memory. I added a commit for your two comments. |
connected_clusters::join_cluster_withbuilt astd::setover the whole target connection list on every join to drop duplicates; on big nets (supply nets absorbing thousands of instance clusters one by one) that is quadratic and was about 28% of connectivity time on the vexriscv LVS testdatajoin_clusters_withbuilds its set once per call; connection lists keep exactly the same contents and ordervexriscv LVS flow (C++ reproduction of
testdata/lvs/vexriscv.lvs), same netlist hash in every run:Peak RSS unchanged (475 MB vs 465 MB at 1 thread).
The benchmarks use the Google Benchmark suite from
parallelize-rebasedon my fork, which is not part of this PR. Numbers: 2x Intel Xeon Gold 6148 (40 cores, exclusive node), g++ 13 -O2, mean ± standard deviation.The numbers were measured on the
parallelizebranch (with #2453 on top, since that branch crashes in multi-threaded connectivity otherwise); the changed code is the same on master.Benchmark code
This PR was carried out with AI assistance (open-weight GLM 5.3) and reviewed before submission.