From 455c40ced60c3c5dc00530bfb5e98660bc3d2bfe Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 30 Oct 2021 21:31:05 +0200 Subject: [PATCH] More consistent verbosity levels for cell mapping --- src/buddies/src/bd/strmxor.cc | 12 +++++---- src/db/db/dbCellMapping.cc | 42 ++++++++++++++++---------------- src/unit_tests/unit_test_main.cc | 3 ++- 3 files changed, 30 insertions(+), 27 deletions(-) diff --git a/src/buddies/src/bd/strmxor.cc b/src/buddies/src/bd/strmxor.cc index 6072e1e73..ba165cd4b 100644 --- a/src/buddies/src/bd/strmxor.cc +++ b/src/buddies/src/bd/strmxor.cc @@ -598,6 +598,8 @@ bool run_deep_xor (const XORData &xor_data) } else { + tl::SelfTimer timer (tl::verbosity () >= 11, "XOR on layer " + ll->first.to_string ()); + db::RecursiveShapeIterator ri_a, ri_b; if (ll->second.first >= 0) { @@ -612,15 +614,14 @@ bool run_deep_xor (const XORData &xor_data) db::Region in_b (ri_b, dss, db::ICplxTrans (xor_data.layout_b->dbu () / dbu)); db::Region xor_res; - xor_res = in_a ^ in_b; + { + tl::SelfTimer timer (tl::verbosity () >= 21, "Basic XOR on layer " + ll->first.to_string ()); + xor_res = in_a ^ in_b; + } int tol_index = 0; for (std::vector::const_iterator t = xor_data.tolerances.begin (); t != xor_data.tolerances.end (); ++t) { - if (tl::verbosity () >= 20) { - tl::log << "Running XOR on layer " << ll->first.to_string () << " with tolerance " << *t; - } - db::LayerProperties lp = ll->first; if (lp.layer >= 0) { lp.layer += tol_index * xor_data.tolerance_bump; @@ -633,6 +634,7 @@ bool run_deep_xor (const XORData &xor_data) result.top_cell = xor_data.output_cell; if (*t > db::epsilon) { + tl::SelfTimer timer (tl::verbosity () >= 21, "Tolerance " + tl::to_string (*t) + " on layer " + ll->first.to_string ()); xor_res.size (-db::coord_traits::rounded (0.5 * *t / dbu)); xor_res.size (db::coord_traits::rounded (0.5 * *t / dbu)); } diff --git a/src/db/db/dbCellMapping.cc b/src/db/db/dbCellMapping.cc index 4e138fb20..e945ca153 100644 --- a/src/db/db/dbCellMapping.cc +++ b/src/db/db/dbCellMapping.cc @@ -409,9 +409,9 @@ CellMapping::do_create_missing_mapping (db::Layout &layout_a, const db::Layout & void CellMapping::create_from_geometry (const db::Layout &layout_a, db::cell_index_type cell_index_a, const db::Layout &layout_b, db::cell_index_type cell_index_b) { - tl::SelfTimer timer (tl::verbosity () >= 11, tl::to_string (tr ("Cell mapping"))); + tl::SelfTimer timer (tl::verbosity () >= 31, tl::to_string (tr ("Cell mapping"))); - if (tl::verbosity () >= 20) { + if (tl::verbosity () >= 40) { tl::info << "Cell mapping - first step: mapping instance count and instance identity"; } @@ -449,7 +449,7 @@ CellMapping::create_from_geometry (const db::Layout &layout_a, db::cell_index_ty ++a; } else { - if (tl::verbosity () >= 30) { + if (tl::verbosity () >= 50) { size_t na = 0, nb = 0; for (std::multimap::const_iterator aa = a; aa != cm_a.end () && aa->first == w; ++aa) { ++na; @@ -497,7 +497,7 @@ CellMapping::create_from_geometry (const db::Layout &layout_a, db::cell_index_ty } - if (tl::verbosity () >= 40) { + if (tl::verbosity () >= 60) { tl::info << "Checked cell " << layout_a.cell_name (a->second) << ": " << candidates [a->second].size () << " candidates remaining."; } @@ -519,7 +519,7 @@ CellMapping::create_from_geometry (const db::Layout &layout_a, db::cell_index_ty ++a; } - if (tl::verbosity () >= 40) { + if (tl::verbosity () >= 60) { tl::info << "Mapping candidates:"; dump_mapping (candidates, layout_a, layout_b); } @@ -536,7 +536,7 @@ CellMapping::create_from_geometry (const db::Layout &layout_a, db::cell_index_ty reduction = false; ++iteration; - if (tl::verbosity () >= 20) { + if (tl::verbosity () >= 40) { tl::info << "Cell mapping - iteration " << iteration << ": cross-instance cone reduction"; } @@ -553,7 +553,7 @@ CellMapping::create_from_geometry (const db::Layout &layout_a, db::cell_index_ty refined_cand.clear (); refined_cand.insert (refined_cand.end (), cand->second.begin (), cand->second.end ()); - if (tl::verbosity () >= 50) { + if (tl::verbosity () >= 70) { tl::info << "--- Cell: " << layout_a.cell_name (cand->first); tl::info << "Before reduction: " << tl::noendl; for (size_t i = 0; i < refined_cand.size (); ++i) { @@ -582,7 +582,7 @@ CellMapping::create_from_geometry (const db::Layout &layout_a, db::cell_index_ty } } - if (tl::verbosity () >= 50 && cout != refined_cand.end ()) { + if (tl::verbosity () >= 70 && cout != refined_cand.end ()) { tl::info << "Reduction because of caller mapping: " << layout_a.cell_name (*c) << " <-> " << layout_b.cell_name (others[0]); tl::info << " -> " << tl::noendl; for (size_t i = 0; i < size_t (cout - refined_cand.begin ()); ++i) { @@ -619,7 +619,7 @@ CellMapping::create_from_geometry (const db::Layout &layout_a, db::cell_index_ty } } - if (tl::verbosity () >= 50 && cout != refined_cand.end ()) { + if (tl::verbosity () >= 70 && cout != refined_cand.end ()) { tl::info << "Reduction because of callee mapping: " << layout_a.cell_name (*c) << " <-> " << layout_b.cell_name (others[0]); tl::info << " -> " << tl::noendl; for (size_t i = 0; i < size_t (cout - refined_cand.begin ()); ++i) { @@ -646,7 +646,7 @@ CellMapping::create_from_geometry (const db::Layout &layout_a, db::cell_index_ty int ed = tl::edit_distance (layout_a.cell_name (ca), layout_b.cell_name (cb)); if (ed < uc->second.second) { uc->second = std::make_pair (ca, ed); - if (tl::verbosity () >= 40) { + if (tl::verbosity () >= 60) { tl::info << "Choosing " << layout_b.cell_name (cb) << " (layout_b) as new unique mapping for " << layout_a.cell_name (ca) << " (layout_a)"; } } @@ -654,7 +654,7 @@ CellMapping::create_from_geometry (const db::Layout &layout_a, db::cell_index_ty } else { int ed = tl::edit_distance (layout_a.cell_name (ca), layout_b.cell_name (cb)); unique_candidates.insert (std::make_pair (cb, std::make_pair (ca, ed))); - if (tl::verbosity () >= 40) { + if (tl::verbosity () >= 60) { tl::info << "Choosing " << layout_b.cell_name (cb) << " (layout_b) as unique mapping for " << layout_a.cell_name (ca) << " (layout_a)"; } } @@ -679,12 +679,12 @@ CellMapping::create_from_geometry (const db::Layout &layout_a, db::cell_index_ty } - if (tl::verbosity () >= 40) { + if (tl::verbosity () >= 60) { tl::info << "Further refined candidates:"; dump_mapping (candidates, layout_a, layout_b); } - if (tl::verbosity () >= 20) { + if (tl::verbosity () >= 40) { tl::info << "Cell mapping - iteration " << iteration << ": removal of uniquely mapped cells on B side"; } @@ -709,15 +709,15 @@ CellMapping::create_from_geometry (const db::Layout &layout_a, db::cell_index_ty } } - - if (tl::verbosity () >= 40) { + + if (tl::verbosity () >= 60) { tl::info << "After reduction of mapped cells on b side:"; dump_mapping (candidates, layout_a, layout_b); } } - if (tl::verbosity () >= 20) { + if (tl::verbosity () >= 40) { int total = 0; int not_mapped = 0; @@ -747,7 +747,7 @@ CellMapping::create_from_geometry (const db::Layout &layout_a, db::cell_index_ty // Resolve mapping according to string match - if (tl::verbosity () >= 20) { + if (tl::verbosity () >= 40) { tl::info << "Cell mapping - string mapping as last resort"; } @@ -784,7 +784,7 @@ CellMapping::create_from_geometry (const db::Layout &layout_a, db::cell_index_ty } - if (tl::verbosity () >= 20) { + if (tl::verbosity () >= 40) { int total = 0; int not_mapped = 0; @@ -795,7 +795,7 @@ CellMapping::create_from_geometry (const db::Layout &layout_a, db::cell_index_ty for (std::map >::iterator cand = candidates.begin (); cand != candidates.end (); ++cand) { ++total; if (cand->second.size () == 0) { - if (tl::verbosity () >= 30) { + if (tl::verbosity () >= 50) { tl::info << "Unmapped cell: " << layout_a.cell_name (cand->first); } ++not_mapped; @@ -823,12 +823,12 @@ CellMapping::extract_unique (std::map second.size () == 1) { - if (tl::verbosity () >= 20) { + if (tl::verbosity () >= 40) { tl::info << " (U) " << layout_a.cell_name (cand->first) << " -> " << layout_b.cell_name (cand->second.front ()) << " (" << cand->first << " -> " << cand->second.front () << ")"; } unique_mapping.insert (std::make_pair (cand->second.front (), cand->first)); - } else if (tl::verbosity () >= 30) { + } else if (tl::verbosity () >= 50) { tl::info << " " << layout_a.cell_name (cand->first) << " ->" << tl::noendl; int n = 5; diff --git a/src/unit_tests/unit_test_main.cc b/src/unit_tests/unit_test_main.cc index b506ff893..51b675222 100644 --- a/src/unit_tests/unit_test_main.cc +++ b/src/unit_tests/unit_test_main.cc @@ -246,7 +246,8 @@ run_tests (const std::vector &selected_tests, bool editable, boo timer.stop(); ut::noctrl << "Time: " << timer.sec_wall () << "s (wall) " << timer.sec_user () << "s (user) " << timer.sec_sys () << "s (sys)"; - ut::ctrl << ""; + ut::noctrl << "Memory: " << timer.memory_size () / 1024 << "k"; + ut::ctrl << ""; } catch (tl::CancelException &) {