From b0590b8c571c12a8e3f3a0510c2121d53c80d49a Mon Sep 17 00:00:00 2001 From: Arthur Koucher Date: Mon, 18 Nov 2024 14:18:04 -0300 Subject: [PATCH] mpl2: allow multi threading when using final result drawing in debug Signed-off-by: Arthur Koucher --- src/mpl2/src/graphics.cpp | 24 ++---------------------- src/mpl2/src/hier_rtlmp.cpp | 17 ++++++++++++----- src/mpl2/src/hier_rtlmp.h | 1 + 3 files changed, 15 insertions(+), 27 deletions(-) diff --git a/src/mpl2/src/graphics.cpp b/src/mpl2/src/graphics.cpp index f0c8af53b82..f1ae532e682 100644 --- a/src/mpl2/src/graphics.cpp +++ b/src/mpl2/src/graphics.cpp @@ -71,7 +71,7 @@ void Graphics::startSA() return; } - if (only_final_result_ || skip_steps_) { + if (skip_steps_) { return; } @@ -90,7 +90,7 @@ void Graphics::endSA(const float norm_cost) return; } - if (only_final_result_ || skip_steps_) { + if (skip_steps_) { return; } @@ -113,10 +113,6 @@ bool Graphics::isTargetCluster() void Graphics::saStep(const std::vector& macros) { - if (only_final_result_) { - return; - } - resetPenalties(); soft_macros_ = macros; hard_macros_.clear(); @@ -124,10 +120,6 @@ void Graphics::saStep(const std::vector& macros) void Graphics::saStep(const std::vector& macros) { - if (only_final_result_) { - return; - } - resetPenalties(); hard_macros_ = macros; soft_macros_.clear(); @@ -162,10 +154,6 @@ void Graphics::report(const float norm_cost) void Graphics::drawResult() { - if (!only_final_result_) { - return; - } - if (max_level_) { std::vector> outlines(max_level_.value() + 1); int level = 0; @@ -221,10 +209,6 @@ void Graphics::penaltyCalculated(float norm_cost) return; } - if (only_final_result_) { - return; - } - if (is_skipping_) { return; } @@ -591,10 +575,6 @@ void Graphics::setTargetClusterId(const int target_cluster_id) void Graphics::setOutline(const odb::Rect& outline) { - if (only_final_result_) { - return; - } - outline_ = outline; } diff --git a/src/mpl2/src/hier_rtlmp.cpp b/src/mpl2/src/hier_rtlmp.cpp index e08582e23c5..9afe4030ed8 100644 --- a/src/mpl2/src/hier_rtlmp.cpp +++ b/src/mpl2/src/hier_rtlmp.cpp @@ -249,9 +249,20 @@ void HierRTLMP::run() resetSAParameters(); } + std::unique_ptr save_graphics; + if (is_debug_only_final_result_) { + save_graphics = std::move(graphics_); + } + runCoarseShaping(); runHierarchicalMacroPlacement(); + if (save_graphics) { + graphics_ = std::move(save_graphics); + graphics_->setMaxLevel(tree_->max_level); + graphics_->drawResult(); + } + Pusher pusher(logger_, tree_->root.get(), block_, boundary_to_io_blockage_); pusher.pushMacrosToCoreBoundaries(); @@ -314,11 +325,6 @@ void HierRTLMP::runHierarchicalMacroPlacement() } else { runHierarchicalMacroPlacementWithoutBusPlanning(tree_->root.get()); } - - if (graphics_) { - graphics_->setMaxLevel(tree_->max_level); - graphics_->drawResult(); - } } void HierRTLMP::resetSAParameters() @@ -4122,6 +4128,7 @@ void HierRTLMP::setDebugSkipSteps(bool skip_steps) void HierRTLMP::setDebugOnlyFinalResult(bool only_final_result) { graphics_->setOnlyFinalResult(only_final_result); + is_debug_only_final_result_ = only_final_result; } void HierRTLMP::setDebugTargetClusterId(const int target_cluster_id) diff --git a/src/mpl2/src/hier_rtlmp.h b/src/mpl2/src/hier_rtlmp.h index b8c4c1be438..350338b7d29 100644 --- a/src/mpl2/src/hier_rtlmp.h +++ b/src/mpl2/src/hier_rtlmp.h @@ -345,6 +345,7 @@ class HierRTLMP bool skip_macro_placement_ = false; std::unique_ptr graphics_; + bool is_debug_only_final_result_{false}; }; class Pusher