From 2f204eaa21a94918e9b7bf0ef22a7ea2dcf9eff1 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Mon, 26 Apr 2021 23:15:27 +0200 Subject: [PATCH] Some refactoring of the instance-to-instance test in hier processor: gives some performance improvement with less memory for cache. --- src/db/db/dbHierNetworkProcessor.cc | 51 +++++++----------- src/db/db/dbLayoutToNetlist.cc | 4 +- ...ice_extract_au1_dup_inst_with_rec_nets.gds | Bin 55954 -> 54738 bytes 3 files changed, 21 insertions(+), 34 deletions(-) diff --git a/src/db/db/dbHierNetworkProcessor.cc b/src/db/db/dbHierNetworkProcessor.cc index 9f05c3746..d3eac046f 100644 --- a/src/db/db/dbHierNetworkProcessor.cc +++ b/src/db/db/dbHierNetworkProcessor.cc @@ -1563,13 +1563,9 @@ private: db::ICplxTrans i1t, i2t; bool fill_cache = false; - // Cache is only used for single instances or simple arrays. - // Other schemes make the cache taking a lot of memory - because array vs. array testing may result in - // N x N cache entries when the arrayed cells contain child cells. - // We still allow the case of array vs. array when i1.size == i2.size as this efficiently caches - // array/array interactions. - if ((! i1element.at_end () || i1.size () == 1 || i1.size () == i2.size ()) && - (! i2element.at_end () || i2.size () == 1 || i1.size () == i2.size ())) { + // Cache is only used for single instances or simple and regular arrays. + if ((! i1element.at_end () || i1.size () == 1 || ! i1.is_iterated_array ()) && + (! i2element.at_end () || i2.size () == 1 || ! i2.is_iterated_array ())) { i1t = i1element.at_end () ? i1.complex_trans () : i1.complex_trans (*i1element); db::ICplxTrans tt1 = t1 * i1t; @@ -1653,6 +1649,22 @@ private: } + // dive into cell of ii1 + const db::Cell &cell1 = mp_layout->cell (i1.cell_index ()); + for (db::Cell::touching_iterator jj1 = cell1.begin_touching (common12.transformed (tt1.inverted ())); ! jj1.at_end (); ++jj1) { + + std::list > ii_interactions; + consider_instance_pair (common12, *jj1, tt1, db::CellInstArray::iterator (), i2, t2, ii2, ii_interactions); + + for (std::list >::iterator i = ii_interactions.begin (); i != ii_interactions.end (); ++i) { + propagate_cluster_inst (i->first, i1.cell_index (), i1t, i1.prop_id ()); + } + + ii_interactions.unique (); + interacting_clusters.splice (interacting_clusters.end (), ii_interactions, ii_interactions.begin (), ii_interactions.end ()); + + } + } if (! i2element.at_end ()) { @@ -1661,27 +1673,6 @@ private: } - box_type common1 = ib1 & b2 & common; - if (! common1.empty ()) { - - // dive into cell of ii1 - const db::Cell &cell1 = mp_layout->cell (i1.cell_index ()); - for (db::Cell::touching_iterator jj1 = cell1.begin_touching (common1.transformed (tt1.inverted ())); ! jj1.at_end (); ++jj1) { - - std::list > ii_interactions; - consider_instance_pair (common1, *jj1, tt1, db::CellInstArray::iterator (), i2, t2, i2element, ii_interactions); - - for (std::list >::iterator i = ii_interactions.begin (); i != ii_interactions.end (); ++i) { - propagate_cluster_inst (i->first, i1.cell_index (), i1t, i1.prop_id ()); - } - - ii_interactions.unique (); - interacting_clusters.splice (interacting_clusters.end (), ii_interactions, ii_interactions.begin (), ii_interactions.end ()); - - } - - } - if (! i1element.at_end ()) { break; } @@ -2245,11 +2236,9 @@ hier_clusters::do_build (cell_clusters_box_converter &cbc, const db::Layou build_hier_connections_for_cells (cbc, layout, todo, conn, breakout_cells, progress, instance_interaction_cache); } - // @@@ - if (tl::verbosity () >= 0) { + if (tl::verbosity () >= 51) { tl::info << "Cluster build cache statistics: size=" << instance_interaction_cache.size () << ", hits=" << instance_interaction_cache.hits () << ", misses=" << instance_interaction_cache.misses (); } - // @@@ } template diff --git a/src/db/db/dbLayoutToNetlist.cc b/src/db/db/dbLayoutToNetlist.cc index 0dbeac6cc..ac8d0adfe 100644 --- a/src/db/db/dbLayoutToNetlist.cc +++ b/src/db/db/dbLayoutToNetlist.cc @@ -397,13 +397,11 @@ void LayoutToNetlist::extract_netlist () netex.set_include_floating_subcircuits (m_include_floating_subcircuits); netex.extract_nets (dss (), m_layout_index, m_conn, *mp_netlist, m_net_clusters); - // @@@ - if (tl::verbosity () >= 0) { + if (tl::verbosity () >= 41) { MemStatisticsCollector m (false); mem_stat (&m, db::MemStatistics::None, 0); m.print (); } - // @@@ m_netlist_extracted = true; } diff --git a/testdata/algo/device_extract_au1_dup_inst_with_rec_nets.gds b/testdata/algo/device_extract_au1_dup_inst_with_rec_nets.gds index 639924e76841d6230304f2cda52d171ef7ec1686..8df8f437445d59cdfd38867405d027dc41ac6b44 100644 GIT binary patch delta 1361 zcmbQVmHE1}3Hm1{p>s_NNRi3{ni@3_J|%$ZQ4{WCk6%)W>!1LPIK>L z%RgAU?9g8@J1T@hh83s2iBXZ_IELxC!$-5YF%57f7B*}Vq>L z$x9x1B)9nDk(?H^8@GcpqI%hIx|S#LEbegokcvBIH$Tb3BY7hqkK~yWJdy`0=W^n7 zZAr7VB2LL=OYlhEINHsOQ)ku5**Jr5vd+cXI5pn8h`ZpJ%y;<+qv7O-CSsFcUOs`- Kh!a;%u>t_x>-13o delta 1396 zcmcb#nt9Sz<|qa>1}3Hm1{p>s_QyarFAz#Im>{zmIGEUcJe?RAM3`Ca96Qauk1hXT z>9RwA!R)9I1{qeI`X)w2isLYH;;Easq$clT#3{FV6_X?*E{&USG2@ZsV&%lGQ;Y2; zPRYqq9Jt-X#TklIp$WJgu;$teoOllP19 z0_o3_?ZtUFKT-J1IJq9kNKq_in!H~UD57M{IC-r*kfE%@IQf{U$Yd3j&p5p(rvHY0 zvXi;P$SAae6K`6k~=G@2~O#Wz{Q(0H=8 zAot{mB$LTnf;^LFfN8$TFAQ}i8(6X9w9L;6Pk0*GZ z4X0~;V$R}>zs&}TxMP2_N*W$XiEKQQJO#KVHg;T5mcn$|b