@@ -77,17 +77,17 @@ void GraphicsImpl::debugForNesterovPlace(
7777
7878 if (enabled ()) {
7979 // Setup the chart
80- chart_ = gui::Gui::get ()-> addChart (
81- " GPL" , " Iteration" , {" HPWL (μm)" , " Overflow" });
82- chart_ ->setXAxisFormat (" %d" );
83- chart_ ->setYAxisFormats ({" %.2e" , " %.2f" });
84- chart_ ->setYAxisMin ({std::nullopt , 0 });
80+ gui::Gui* gui = gui::Gui::get ();
81+ main_chart_ = gui-> addChart ( " GPL" , " Iteration" , {" HPWL (μm)" , " Overflow" });
82+ main_chart_ ->setXAxisFormat (" %d" );
83+ main_chart_ ->setYAxisFormats ({" %.2e" , " %.2f" });
84+ main_chart_ ->setYAxisMin ({std::nullopt , 0 });
8585
8686 // Useful for debugging multiple NesterovBase: Density penalty and PhiCoef
8787 if (logger_->debugCheck (utl::GPL, " penaltyPlot" , 1 )) {
8888 if (!nbVec_.empty ()) {
89- std::vector<std::string> series_names ;
90- series_names .reserve (nbVec_.size ());
89+ std::vector<std::string> region_names ;
90+ region_names .reserve (nbVec_.size ());
9191 for (size_t i = 0 ; i < nbVec_.size (); ++i) {
9292 std::string name;
9393 if (nbVec_[i] && nbVec_[i]->getPb () && nbVec_[i]->getPb ()->group ()) {
@@ -96,24 +96,38 @@ void GraphicsImpl::debugForNesterovPlace(
9696 } else {
9797 name = fmt::format (" nb[{}]" , i);
9898 }
99- series_names .push_back (name);
99+ region_names .push_back (name);
100100 }
101- density_chart_ = gui::Gui::get () ->addChart (
102- " GPL Density Penalty" , " Iteration" , series_names );
101+ density_chart_ = gui->addChart (
102+ " GPL Density Penalty" , " Iteration" , { " DensityPenalty " , " phiCoef " } );
103103 density_chart_->setXAxisFormat (" %d" );
104- std::vector<std::string> y_formats (nbVec_.size (), " %.3f" );
105- density_chart_->setYAxisFormats (y_formats);
106- std::vector<std::optional<double >> y_mins (nbVec_.size (), 0.0 );
107- density_chart_->setYAxisMin (y_mins);
108-
109- phi_chart_ = gui::Gui::get ()->addChart (
110- " GPL PhiCoef" , " Iteration" , series_names);
111- phi_chart_->setXAxisFormat (" %d" );
112- phi_chart_->setYAxisFormats (y_formats);
113- phi_chart_->setYAxisMin (y_mins);
104+ density_chart_->setYAxisFormats ({" %.2e" , " %.2f" });
105+ density_chart_->setYAxisMin ({0.0 , nbc_->getNbVars ().minPhiCoef });
106+
107+ stepLength_chart_ = gui->addChart (
108+ " GPL StepLength" ,
109+ " Iteration" ,
110+ {" StepLength" , " CoordiDistance" , " GradDistance" , " Std area" });
111+ stepLength_chart_->setXAxisFormat (" %d" );
112+ stepLength_chart_->setYAxisFormats ({" %.2e" , " %.2f" , " %.2f" });
113+ stepLength_chart_->setYAxisMin ({0.0 , 0.0 , 0.0 });
114+
115+ // Version with regions
116+ // density_chart_
117+ // = gui->addChart("GPL Density Penalty", "Iteration",
118+ // series_names);
119+ // density_chart_->setXAxisFormat("%d");
120+ // std::vector<std::string> y_formats(nbVec_.size(), "%.3f");
121+ // density_chart_->setYAxisFormats(y_formats);
122+ // std::vector<std::optional<double>> y_mins(nbVec_.size(), 0.0);
123+ // density_chart_->setYAxisMin(y_mins);
124+
125+ // phi_chart_ = gui->addChart("GPL PhiCoef", "Iteration", series_names);
126+ // phi_chart_->setXAxisFormat("%d");
127+ // phi_chart_->setYAxisFormats(y_formats);
128+ // phi_chart_->setYAxisMin(y_mins);
114129 }
115130 }
116-
117131 initHeatmap ();
118132 if (inst) {
119133 for (size_t idx = 0 ; idx < nbc_->getGCells ().size (); ++idx) {
@@ -284,10 +298,19 @@ void GraphicsImpl::drawSingleGCell(const GCell* gCell,
284298 // Highlight modified instances (overrides base color, unless selected)
285299 switch (gCell ->changeType ()) {
286300 case GCell::GCellChange::kRoutability :
287- color = {255 , 255 , 255 , 100 }; // White
301+ color = gui::Painter::kWhite ;
302+ break ;
303+ case GCell::GCellChange::kNewInstance :
304+ color = gui::Painter::kDarkRed ;
305+ break ;
306+ case GCell::GCellChange::kDownsize :
307+ color = gui::Painter::kDarkBlue ;
288308 break ;
289- case GCell::GCellChange::kTimingDriven :
290- color = {180 , 150 , 255 , 100 }; // Light purple
309+ case GCell::GCellChange::kUpsize :
310+ color = gui::Painter::kOrange ;
311+ break ;
312+ case GCell::GCellChange::kResizeNoChange :
313+ color = gui::Painter::kDarkYellow ;
291314 break ;
292315 default :
293316 if (gCell ->isInstance ()) {
@@ -537,48 +560,80 @@ void GraphicsImpl::reportSelected()
537560void GraphicsImpl::addIter (const int iter, const double overflow)
538561{
539562 odb::dbBlock* block = pbc_->db ()->getChip ()->getBlock ();
540- chart_ ->addPoint (iter, {block->dbuToMicrons (nbc_->getHpwl ()), overflow});
563+ main_chart_ ->addPoint (iter, {block->dbuToMicrons (nbc_->getHpwl ()), overflow});
541564
542565 // Add density penalties snapshot for each NesterovBase
543566 if (logger_->debugCheck (utl::GPL, " penaltyPlot" , 1 )) {
544567 if (density_chart_) {
545- std::vector<double > penalties;
546- penalties.reserve (nbVec_.size ());
547- for (const auto & nb : nbVec_) {
548- double penalty
549- = nb ? static_cast <double >(nb->getDensityPenalty ()) : 0.0 ;
550- penalties.push_back (penalty);
568+ std::vector<double > values;
569+ if (!nbVec_.empty () && nbVec_[0 ]) {
570+ // values.push_back(std::log(static_cast<double>(nbVec_[0]->getDensityPenalty())));
571+ values.push_back ((static_cast <double >(nbVec_[0 ]->getDensityPenalty ())));
572+ values.push_back (static_cast <double >(nbVec_[0 ]->getStoredPhiCoef ()));
573+ } else {
574+ values.push_back (0.0 );
575+ values.push_back (0.0 );
551576 }
552- density_chart_->addPoint (iter, penalties );
577+ density_chart_->addPoint (iter, values );
553578 }
554579
555- if (phi_chart_) {
556- std::vector<double > coefs;
557- coefs.reserve (nbVec_.size ());
558- for (const auto & nb : nbVec_) {
559- double coef = nb ? static_cast <double >(nb->getStoredPhiCoef ()) : 0.0 ;
560- coefs.push_back (coef);
580+ // Version with regions
581+ // if (density_chart_) {
582+ // std::vector<double> penalties;
583+ // penalties.reserve(nbVec_.size());
584+ // for (const auto& nb : nbVec_) {
585+ // double penalty
586+ // = nb ? static_cast<double>(nb->getDensityPenalty()) : 0.0;
587+ // penalties.push_back(penalty);
588+ // }
589+ // density_chart_->addPoint(iter, penalties);
590+ // }
591+ // if (phi_chart_) {
592+ // std::vector<double> coefs;
593+ // coefs.reserve(nbVec_.size());
594+ // for (const auto& nb : nbVec_) {
595+ // double coef = nb ? static_cast<double>(nb->getStoredPhiCoef()) : 0.0;
596+ // coefs.push_back(coef);
597+ // }
598+ // phi_chart_->addPoint(iter, coefs);
599+ // }
600+
601+ if (stepLength_chart_) {
602+ std::vector<double > values;
603+ if (!nbVec_.empty () && nbVec_[0 ]) {
604+ values.push_back (static_cast <double >(nbVec_[0 ]->getStoredStepLength ()));
605+ values.push_back (
606+ static_cast <double >(nbVec_[0 ]->getStoredCoordiDistance ()));
607+ values.push_back (
608+ static_cast <double >(nbVec_[0 ]->getStoredGradDistance ()));
609+ values.push_back (
610+ static_cast <double >(nbVec_[0 ]->getNesterovInstsArea ()));
611+ } else {
612+ values.push_back (0.0 );
613+ values.push_back (0.0 );
614+ values.push_back (0.0 );
615+ values.push_back (0.0 );
561616 }
562- phi_chart_ ->addPoint (iter, coefs );
617+ stepLength_chart_ ->addPoint (iter, values );
563618 }
564619 }
565620}
566621
567622void GraphicsImpl::addTimingDrivenIter (const int iter)
568623{
569- chart_ ->addVerticalMarker (iter, gui::Painter::kTurquoise );
624+ main_chart_ ->addVerticalMarker (iter, gui::Painter::kTurquoise );
570625}
571626
572627void GraphicsImpl::addRoutabilitySnapshot (int iter)
573628{
574- chart_ ->addVerticalMarker (iter, gui::Painter::kYellow );
629+ main_chart_ ->addVerticalMarker (iter, gui::Painter::kYellow );
575630}
576631
577632void GraphicsImpl::addRoutabilityIter (const int iter, const bool revert)
578633{
579634 gui::Painter::Color color
580635 = revert ? gui::Painter::kRed : gui::Painter::kGreen ;
581- chart_ ->addVerticalMarker (iter, color);
636+ main_chart_ ->addVerticalMarker (iter, color);
582637}
583638
584639void GraphicsImpl::cellPlotImpl (bool pause)
0 commit comments