|
8 | 8 | #include "VprTimingGraphResolver.h" |
9 | 9 | #include "timing_info.h" |
10 | 10 | #include "placer.h" |
| 11 | +#include "draw.h" |
| 12 | +#include "read_place.h" |
11 | 13 |
|
12 | 14 | PlacementLogPrinter::PlacementLogPrinter(const Placer& placer) |
13 | 15 | : placer_(placer) {} |
@@ -136,6 +138,59 @@ void PlacementLogPrinter::print_placement_swaps_stats() const { |
136 | 138 | VTR_LOG("\tSwaps aborted: %*d (%4.1f %%)\n", num_swap_print_digits, |
137 | 139 | swap_stats.num_swap_aborted, 100 * abort_rate); |
138 | 140 | } |
| 141 | +void PlacementLogPrinter::print_initial_placement_stats() const { |
| 142 | + const t_placer_costs& costs = placer_.costs(); |
| 143 | + const t_noc_opts& noc_opts = placer_.noc_opts(); |
| 144 | + const t_placer_opts& placer_opts = placer_.placer_opts(); |
| 145 | + const tatum::TimingPathInfo& critical_path = placer_.critical_path(); |
| 146 | + const std::optional<NocCostHandler>& noc_cost_handler = placer_.noc_cost_handler(); |
| 147 | + std::shared_ptr<const SetupTimingInfo> timing_info = placer_.timing_info(); |
| 148 | + const PlacerState& placer_state = placer_.placer_state(); |
| 149 | + |
| 150 | + VTR_LOG("Initial placement cost: %g bb_cost: %g td_cost: %g\n", |
| 151 | + costs.cost, costs.bb_cost, costs.timing_cost); |
| 152 | + |
| 153 | + if (noc_opts.noc) { |
| 154 | + VTR_ASSERT(noc_cost_handler.has_value()); |
| 155 | + noc_cost_handler->print_noc_costs("Initial NoC Placement Costs", costs, noc_opts); |
| 156 | + } |
| 157 | + |
| 158 | + if (placer_opts.place_algorithm.is_timing_driven()) { |
| 159 | + VTR_LOG("Initial placement estimated Critical Path Delay (CPD): %g ns\n", |
| 160 | + 1e9 * critical_path.delay()); |
| 161 | + VTR_LOG("Initial placement estimated setup Total Negative Slack (sTNS): %g ns\n", |
| 162 | + 1e9 * timing_info->setup_total_negative_slack()); |
| 163 | + VTR_LOG("Initial placement estimated setup Worst Negative Slack (sWNS): %g ns\n", |
| 164 | + 1e9 * timing_info->setup_worst_negative_slack()); |
| 165 | + VTR_LOG("\n"); |
| 166 | + VTR_LOG("Initial placement estimated setup slack histogram:\n"); |
| 167 | + print_histogram(create_setup_slack_histogram(*timing_info->setup_analyzer())); |
| 168 | + } |
| 169 | + |
| 170 | + const BlkLocRegistry& blk_loc_registry = placer_state.blk_loc_registry(); |
| 171 | + size_t num_macro_members = 0; |
| 172 | + for (const t_pl_macro& macro : blk_loc_registry.place_macros().macros()) { |
| 173 | + num_macro_members += macro.members.size(); |
| 174 | + } |
| 175 | + VTR_LOG("Placement contains %zu placement macros involving %zu blocks (average macro size %f)\n", |
| 176 | + blk_loc_registry.place_macros().macros().size(), num_macro_members, |
| 177 | + float(num_macro_members) / blk_loc_registry.place_macros().macros().size()); |
| 178 | + VTR_LOG("\n"); |
| 179 | + |
| 180 | + char msg[vtr::bufsize]; |
| 181 | + sprintf(msg, |
| 182 | + "Initial Placement. Cost: %g BB Cost: %g TD Cost %g \t Channel Factor: %d", |
| 183 | + costs.cost, costs.bb_cost, costs.timing_cost, placer_opts.place_chan_width); |
| 184 | + |
| 185 | + // Draw the initial placement |
| 186 | + update_screen(ScreenUpdatePriority::MAJOR, msg, PLACEMENT, timing_info); |
| 187 | + |
| 188 | + if (placer_opts.placement_saves_per_temperature >= 1) { |
| 189 | + std::string filename = vtr::string_fmt("placement_%03d_%03d.place", 0, 0); |
| 190 | + VTR_LOG("Saving initial placement to file: %s\n", filename.c_str()); |
| 191 | + print_place(nullptr, nullptr, filename.c_str(), blk_loc_registry.block_locs()); |
| 192 | + } |
| 193 | +} |
139 | 194 |
|
140 | 195 | void generate_post_place_timing_reports(const t_placer_opts& placer_opts, |
141 | 196 | const t_analysis_opts& analysis_opts, |
|
0 commit comments