Skip to content

Commit 2c7d2dd

Browse files
committed
Merge branch 'master' of https://github.com/The-OpenROAD-Project/OpenROAD into ppl_remove_random
2 parents f6a6e97 + eb3857b commit 2c7d2dd

15 files changed

Lines changed: 1725 additions & 1678 deletions

docs/user/Bazel.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,3 +339,23 @@ Now start the bisection as usual with a bad and good commit from the above list:
339339
Use `git bisect --skip` if the version does not build or otherwise should not be tested.
340340

341341
OpenSTA has an additional challenge in that only the https://github.com/The-OpenROAD-Project/OpenSTA fork has the Bazel BUILD file. To bisect the https://github.com/parallaxsw/OpenSTA branch, check out the branch you want, then check out BUILD from the fork and do a `git reset HEAD`. This will leave BUILD as a local file, because it is not in the upstream repository and bisection can be done on the upstream master branch.
342+
343+
## Testing the GUI with gcd on a pull request by number
344+
345+
To test a PR with the GUI on gcd, run:
346+
347+
```
348+
$ git fetch origin pull/7856/head
349+
$ git checkout FETCH_HEAD
350+
$ bazelisk run test/orfs/gcd:gcd_final /tmp/gcd -- gui_final
351+
```
352+
353+
This will:
354+
355+
- fetch and checkout pull request 7856
356+
- build OpenROAD
357+
- run bazel-orfs flow on gcd
358+
- create a /tmp/gcd folder with the ORFS project
359+
- launch the GUI opening gui_final gcd
360+
361+
`bazelisk run test/orfs/gcd:gcd_final` run alone would create the `/tmp/gcd` folder and the arguments. The arguments after `--` are forwarded to the `/tmp/gcd/make` script that invokes make with the gcd ORFS project set up in `/tmp/gcd/_main/config.mk`.

src/gui/include/gui/gui.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,8 @@ class Gui
691691
const std::string& corner = "",
692692
int width_px = 0,
693693
int height_px = 0);
694-
void selectClockviewerClock(const std::string& clock_name);
694+
void selectClockviewerClock(const std::string& clock_name,
695+
std::optional<int> depth);
695696

696697
// Save histogram view
697698
void saveHistogramImage(const std::string& filename,

src/gui/src/chartsWidget.cpp

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -530,9 +530,23 @@ void HistogramView::clear()
530530
void HistogramView::showToolTip(bool is_hovering, int bar_index)
531531
{
532532
if (is_hovering) {
533+
int num;
534+
if (buckets_.negative.empty()) {
535+
num = buckets_.positive[bar_index].size();
536+
} else {
537+
const int num_of_neg_buckets = static_cast<int>(buckets_.negative.size());
538+
539+
if (bar_index >= num_of_neg_buckets) {
540+
num = buckets_.positive[bar_index - num_of_neg_buckets].size();
541+
;
542+
} else {
543+
num = buckets_.negative[bar_index].size();
544+
;
545+
}
546+
}
547+
533548
const QString number_of_pins
534-
= QString("Number of Endpoints: %1\n")
535-
.arg(static_cast<QBarSet*>(sender())->at(bar_index));
549+
= QString("Number of Endpoints: %1\n").arg(num);
536550

537551
QString scaled_suffix = sta_->getSTA()->units()->timeUnit()->scaledSuffix();
538552

@@ -712,16 +726,22 @@ void HistogramView::setVisualConfig()
712726
return;
713727
}
714728

715-
std::pair<QBarSet*, QBarSet*> bar_sets = createBarSets(); /* <neg, pos> */
716-
populateBarSets(*bar_sets.first, *bar_sets.second);
729+
std::tuple<QBarSet*, QBarSet*, QBarSet*, QBarSet*> bar_sets
730+
= createBarSets(); /* <neg, pos> */
731+
populateBarSets(*std::get<0>(bar_sets),
732+
*std::get<1>(bar_sets),
733+
*std::get<2>(bar_sets),
734+
*std::get<3>(bar_sets));
717735

718736
QStackedBarSeries* series = new QStackedBarSeries(this);
719-
series->append(bar_sets.first);
720-
series->append(bar_sets.second);
737+
series->append(std::get<0>(bar_sets));
738+
series->append(std::get<1>(bar_sets));
739+
series->append(std::get<2>(bar_sets));
740+
series->append(std::get<3>(bar_sets));
721741
series->setBarWidth(1.0);
722742
chart_->addSeries(series);
723743

724-
setXAxisConfig(bar_sets.first->count());
744+
setXAxisConfig(std::get<0>(bar_sets)->count());
725745
setYAxisConfig();
726746
series->attachAxis(axis_y_);
727747

@@ -732,24 +752,43 @@ void HistogramView::setVisualConfig()
732752
chart_->setTitle("Endpoint Slack");
733753
}
734754

735-
std::pair<QBarSet*, QBarSet*> HistogramView::createBarSets()
755+
std::tuple<QBarSet*, QBarSet*, QBarSet*, QBarSet*>
756+
HistogramView::createBarSets()
736757
{
737758
QBarSet* neg_set = new QBarSet("");
738759
neg_set->setBorderColor(0x8b0000); // darkred
739760
neg_set->setColor(0xf08080); // lightcoral
740761
QBarSet* pos_set = new QBarSet("");
741762
pos_set->setBorderColor(0x006400); // darkgreen
742763
pos_set->setColor(0x90ee90); // lightgreen
764+
QBarSet* pos_set_invisible = new QBarSet("");
765+
pos_set_invisible->setBorderColor(Qt::transparent);
766+
pos_set_invisible->setColor(Qt::transparent);
767+
QBarSet* neg_set_invisible = new QBarSet("");
768+
neg_set_invisible->setBorderColor(Qt::transparent);
769+
neg_set_invisible->setColor(Qt::transparent);
743770

744771
connect(neg_set, &QBarSet::hovered, this, &HistogramView::showToolTip);
745772
connect(pos_set, &QBarSet::hovered, this, &HistogramView::showToolTip);
773+
connect(
774+
pos_set_invisible, &QBarSet::hovered, this, &HistogramView::showToolTip);
775+
connect(
776+
neg_set_invisible, &QBarSet::hovered, this, &HistogramView::showToolTip);
746777

747778
connect(
748779
neg_set, &QBarSet::clicked, this, &HistogramView::emitEndPointsInBucket);
749780
connect(
750781
pos_set, &QBarSet::clicked, this, &HistogramView::emitEndPointsInBucket);
782+
connect(pos_set_invisible,
783+
&QBarSet::clicked,
784+
this,
785+
&HistogramView::emitEndPointsInBucket);
786+
connect(neg_set_invisible,
787+
&QBarSet::clicked,
788+
this,
789+
&HistogramView::emitEndPointsInBucket);
751790

752-
return {neg_set, pos_set};
791+
return {neg_set, pos_set, pos_set_invisible, neg_set_invisible};
753792
}
754793

755794
void HistogramView::emitEndPointsInBucket(const int bar_index)
@@ -915,15 +954,23 @@ int HistogramView::computeFirstDigit(int value, int digits)
915954
return static_cast<int>(value / std::pow(10, digits - 1));
916955
}
917956

918-
void HistogramView::populateBarSets(QBarSet& neg_set, QBarSet& pos_set)
957+
void HistogramView::populateBarSets(QBarSet& neg_set,
958+
QBarSet& pos_set,
959+
QBarSet& neg_set_invisible,
960+
QBarSet& pos_set_invisible)
919961
{
962+
const int max_bin_count = histogram_->getMaxBinCount();
920963
for (const auto& bucket : buckets_.negative) {
921964
neg_set << bucket.size();
965+
neg_set_invisible << max_bin_count - bucket.size();
922966
pos_set << 0;
967+
pos_set_invisible << 0;
923968
}
924969
for (const auto& bucket : buckets_.positive) {
925970
neg_set << 0;
971+
neg_set_invisible << 0;
926972
pos_set << bucket.size();
973+
pos_set_invisible << max_bin_count - bucket.size();
927974
}
928975
}
929976

src/gui/src/chartsWidget.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,11 @@ class HistogramView : public QChartView
8282
const std::vector<std::vector<const sta::Pin*>>& pin_bins);
8383
void setVisualConfig();
8484

85-
std::pair<QBarSet*, QBarSet*> createBarSets();
86-
void populateBarSets(QBarSet& neg_set, QBarSet& pos_set);
85+
std::tuple<QBarSet*, QBarSet*, QBarSet*, QBarSet*> createBarSets();
86+
void populateBarSets(QBarSet& neg_set,
87+
QBarSet& pos_set,
88+
QBarSet& neg_set_invisible,
89+
QBarSet& pos_set_invisible);
8790

8891
void setXAxisConfig(int all_bars_count);
8992
void setXAxisTitle();

src/gui/src/clockWidget.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ void ClockTreeRenderer::resetTree()
152152

153153
void ClockTreeRenderer::setMaxColorDepth(int depth)
154154
{
155+
if (depth < 1) {
156+
return;
157+
}
158+
155159
max_depth_ = depth;
156160
redraw();
157161
}
@@ -1651,7 +1655,8 @@ void ClockWidget::postReadLiberty()
16511655
}
16521656
}
16531657

1654-
void ClockWidget::selectClock(const std::string& clock_name)
1658+
void ClockWidget::selectClock(const std::string& clock_name,
1659+
std::optional<int> depth)
16551660
{
16561661
setVisible(true);
16571662

@@ -1662,6 +1667,9 @@ void ClockWidget::selectClock(const std::string& clock_name)
16621667
for (auto& view : views_) {
16631668
if (view->getClockName() == clock_name) {
16641669
clocks_tab_->setCurrentWidget(view.get());
1670+
if (depth) {
1671+
view->updateColorDepth(*depth);
1672+
}
16651673

16661674
return;
16671675
}

src/gui/src/clockWidget.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,12 +404,12 @@ class ClockTreeView : public QGraphicsView
404404
void setRendererState(RendererState state);
405405
void fit();
406406
void save(const QString& path = "");
407+
void updateColorDepth(int depth);
407408

408409
private slots:
409410
void selectionChanged();
410411
void highlightTo(odb::dbITerm* term);
411412
void clearHighlightTo();
412-
void updateColorDepth(int depth);
413413

414414
protected:
415415
void wheelEvent(QWheelEvent* event) override;
@@ -516,7 +516,8 @@ class ClockWidget : public QDockWidget, sta::dbNetworkObserver
516516
const std::string& corner,
517517
const std::optional<int>& width_px,
518518
const std::optional<int>& height_px);
519-
void selectClock(const std::string& clock_name);
519+
void selectClock(const std::string& clock_name,
520+
std::optional<int> depth = {});
520521

521522
void postReadLiberty() override;
522523

src/gui/src/gui.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -832,12 +832,13 @@ void Gui::saveHistogramImage(const std::string& filename,
832832
filename, chart_mode, width, height);
833833
}
834834

835-
void Gui::selectClockviewerClock(const std::string& clock_name)
835+
void Gui::selectClockviewerClock(const std::string& clock_name,
836+
std::optional<int> depth)
836837
{
837838
if (!enabled()) {
838839
return;
839840
}
840-
main_window->getClockViewer()->selectClock(clock_name);
841+
main_window->getClockViewer()->selectClock(clock_name, depth);
841842
}
842843

843844
static QWidget* findWidget(const std::string& name)

src/gui/src/gui.i

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,13 +310,17 @@ void save_clocktree_image(const char* filename, const char* clock_name, const ch
310310
gui->saveClockTreeImage(clock_name, filename, corner, width_px, height_px);
311311
}
312312

313-
void select_clockviewer_clock(const char* clock_name)
313+
void select_clockviewer_clock(const char* clock_name, int depth = 0)
314314
{
315315
if (!check_gui("select_clockviewer_clock")) {
316316
return;
317317
}
318318
auto gui = gui::Gui::get();
319-
gui->selectClockviewerClock(clock_name);
319+
std::optional<int> clock_depth;
320+
if (depth > 0) {
321+
clock_depth = depth;
322+
}
323+
gui->selectClockviewerClock(clock_name, clock_depth);
320324
}
321325

322326
void save_histogram_image(const char* filename, const char* mode, int width_px = 0, int height_px = 0)

src/mpl/src/clusterEngine.cpp

Lines changed: 17 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,21 @@ void ClusteringEngine::setBaseThresholds()
311311
{
312312
if (tree_->base_max_macro <= 0 || tree_->base_min_macro <= 0
313313
|| tree_->base_max_std_cell <= 0 || tree_->base_min_std_cell <= 0) {
314+
// From original implementation: Reset maximum level based on number
315+
// of macros.
316+
const int min_num_macros_for_multilevel = 150;
317+
if (design_metrics_->getNumMacro() <= min_num_macros_for_multilevel) {
318+
tree_->max_level = 1;
319+
debugPrint(
320+
logger_,
321+
MPL,
322+
"multilevel_autoclustering",
323+
1,
324+
"Number of macros is below {}. Resetting number of levels to {}",
325+
min_num_macros_for_multilevel,
326+
tree_->max_level);
327+
}
328+
314329
// Set base values for std cell lower/upper thresholds
315330
const int min_num_std_cells_allowed = 1000;
316331
tree_->base_min_std_cell
@@ -331,21 +346,6 @@ void ClusteringEngine::setBaseThresholds()
331346
}
332347
tree_->base_max_macro
333348
= tree_->base_min_macro * tree_->cluster_size_ratio / 2.0;
334-
335-
// From original implementation: Reset maximum level based on number
336-
// of macros.
337-
const int min_num_macros_for_multilevel = 150;
338-
if (design_metrics_->getNumMacro() <= min_num_macros_for_multilevel) {
339-
tree_->max_level = 1;
340-
debugPrint(
341-
logger_,
342-
MPL,
343-
"multilevel_autoclustering",
344-
1,
345-
"Number of macros is below {}. Resetting number of levels to {}",
346-
min_num_macros_for_multilevel,
347-
tree_->max_level);
348-
}
349349
}
350350

351351
// Set sizes for root
@@ -1978,14 +1978,7 @@ void ClusteringEngine::breakMixedLeaves(
19781978
// A1 A2 A3
19791979
void ClusteringEngine::breakMixedLeaf(Cluster* mixed_leaf)
19801980
{
1981-
Cluster* parent = mixed_leaf;
1982-
const float macro_dominated_cluster_ratio = 0.01;
1983-
1984-
// Split by replacement if macro dominated.
1985-
if (mixed_leaf->getNumStdCell() * macro_dominated_cluster_ratio
1986-
< mixed_leaf->getNumMacro()) {
1987-
parent = mixed_leaf->getParent();
1988-
}
1981+
Cluster* parent = mixed_leaf->getParent();
19891982

19901983
mapMacroInCluster2HardMacro(mixed_leaf);
19911984

@@ -2027,12 +2020,7 @@ void ClusteringEngine::breakMixedLeaf(Cluster* mixed_leaf)
20272020
// Never use SetInstProperty in the following lines for the reason above!
20282021
std::vector<int> virtual_conn_clusters;
20292022

2030-
// Deal with the std cells
2031-
if (parent == mixed_leaf) {
2032-
addStdCellClusterToSubTree(parent, mixed_leaf, virtual_conn_clusters);
2033-
} else {
2034-
replaceByStdCellCluster(mixed_leaf, virtual_conn_clusters);
2035-
}
2023+
replaceByStdCellCluster(mixed_leaf, virtual_conn_clusters);
20362024

20372025
// Deal with the macros
20382026
for (int i = 0; i < macro_class.size(); i++) {
@@ -2256,29 +2244,6 @@ void ClusteringEngine::groupSingleMacroClusters(
22562244
}
22572245
}
22582246

2259-
void ClusteringEngine::addStdCellClusterToSubTree(
2260-
Cluster* parent,
2261-
Cluster* mixed_leaf,
2262-
std::vector<int>& virtual_conn_clusters)
2263-
{
2264-
std::string std_cell_cluster_name = mixed_leaf->getName();
2265-
auto std_cell_cluster
2266-
= std::make_unique<Cluster>(id_, std_cell_cluster_name, logger_);
2267-
2268-
std_cell_cluster->copyInstances(*mixed_leaf);
2269-
std_cell_cluster->clearLeafMacros();
2270-
std_cell_cluster->setClusterType(StdCellCluster);
2271-
2272-
setClusterMetrics(std_cell_cluster.get());
2273-
2274-
virtual_conn_clusters.push_back(std_cell_cluster->getId());
2275-
2276-
tree_->maps.id_to_cluster[id_++] = std_cell_cluster.get();
2277-
std_cell_cluster->setParent(parent);
2278-
parent->addChild(std::move(std_cell_cluster));
2279-
}
2280-
2281-
// We don't modify the physical hierarchy when spliting by replacement
22822247
void ClusteringEngine::replaceByStdCellCluster(
22832248
Cluster* mixed_leaf,
22842249
std::vector<int>& virtual_conn_clusters)

src/mpl/src/clusterEngine.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,6 @@ class ClusteringEngine
230230
const std::vector<int>& signature_class,
231231
std::vector<int>& interconn_class,
232232
std::vector<int>& macro_class);
233-
void addStdCellClusterToSubTree(Cluster* parent,
234-
Cluster* mixed_leaf,
235-
std::vector<int>& virtual_conn_clusters);
236233
void replaceByStdCellCluster(Cluster* mixed_leaf,
237234
std::vector<int>& virtual_conn_clusters);
238235

0 commit comments

Comments
 (0)