Skip to content

Commit

Permalink
mpl2: allow multi threading when using final result drawing in debug
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
  • Loading branch information
AcKoucher committed Nov 18, 2024
1 parent 82450fd commit b0590b8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 27 deletions.
24 changes: 2 additions & 22 deletions src/mpl2/src/graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void Graphics::startSA()
return;
}

if (only_final_result_ || skip_steps_) {
if (skip_steps_) {
return;
}

Expand All @@ -90,7 +90,7 @@ void Graphics::endSA(const float norm_cost)
return;
}

if (only_final_result_ || skip_steps_) {
if (skip_steps_) {
return;
}

Expand All @@ -113,21 +113,13 @@ bool Graphics::isTargetCluster()

void Graphics::saStep(const std::vector<SoftMacro>& macros)
{
if (only_final_result_) {
return;
}

resetPenalties();
soft_macros_ = macros;
hard_macros_.clear();
}

void Graphics::saStep(const std::vector<HardMacro>& macros)
{
if (only_final_result_) {
return;
}

resetPenalties();
hard_macros_ = macros;
soft_macros_.clear();
Expand Down Expand Up @@ -162,10 +154,6 @@ void Graphics::report(const float norm_cost)

void Graphics::drawResult()
{
if (!only_final_result_) {
return;
}

if (max_level_) {
std::vector<std::vector<odb::Rect>> outlines(max_level_.value() + 1);
int level = 0;
Expand Down Expand Up @@ -221,10 +209,6 @@ void Graphics::penaltyCalculated(float norm_cost)
return;
}

if (only_final_result_) {
return;
}

if (is_skipping_) {
return;
}
Expand Down Expand Up @@ -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;
}

Expand Down
17 changes: 12 additions & 5 deletions src/mpl2/src/hier_rtlmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,20 @@ void HierRTLMP::run()
resetSAParameters();
}

std::unique_ptr<Mpl2Observer> 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();

Expand Down Expand Up @@ -314,11 +325,6 @@ void HierRTLMP::runHierarchicalMacroPlacement()
} else {
runHierarchicalMacroPlacementWithoutBusPlanning(tree_->root.get());
}

if (graphics_) {
graphics_->setMaxLevel(tree_->max_level);
graphics_->drawResult();
}
}

void HierRTLMP::resetSAParameters()
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/mpl2/src/hier_rtlmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ class HierRTLMP
bool skip_macro_placement_ = false;

std::unique_ptr<Mpl2Observer> graphics_;
bool is_debug_only_final_result_{false};
};

class Pusher
Expand Down

0 comments on commit b0590b8

Please sign in to comment.