Skip to content

Commit 942c11d

Browse files
Address PR comments
1 parent 2853329 commit 942c11d

File tree

11 files changed

+34
-43
lines changed

11 files changed

+34
-43
lines changed

libs/librrgraph/src/base/rr_graph_storage.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,12 @@ void t_rr_graph_storage::init_fan_in() {
138138
}
139139

140140

141-
// Functor for sorting edges according to destination node's ID.
141+
/// Functor for sorting edges according to destination node's ID.
142142
class edge_compare_dest_node {
143143
public:
144144
edge_compare_dest_node(const t_rr_graph_storage& rr_graph_storage) : rr_graph_storage_(rr_graph_storage) {}
145145

146-
bool operator()(size_t lhs_idx, size_t rhs_idx) const {
147-
RREdgeId lhs = RREdgeId(lhs_idx);
148-
RREdgeId rhs = RREdgeId(rhs_idx);
149-
146+
bool operator()(RREdgeId lhs, RREdgeId rhs) const {
150147
RRNodeId lhs_dest_node = rr_graph_storage_.edge_sink_node(lhs);
151148
RRNodeId rhs_dest_node = rr_graph_storage_.edge_sink_node(rhs);
152149

@@ -262,26 +259,24 @@ void t_rr_graph_storage::mark_edges_as_rr_switch_ids() {
262259
remapped_edges_ = true;
263260
}
264261

265-
// Functor for sorting edges according to source node, with configurable edges coming first
262+
/// Functor for sorting edges according to source node, with configurable edges coming first
266263
class edge_compare_src_node_and_configurable_first {
267264
public:
268265
edge_compare_src_node_and_configurable_first(const vtr::vector<RRSwitchId, t_rr_switch_inf>& rr_switch_inf, const t_rr_graph_storage& rr_graph_storage)
269266
: rr_switch_inf_(rr_switch_inf),
270267
rr_graph_storage_(rr_graph_storage) {}
271268

272-
bool operator()(size_t lhs_idx, size_t rhs_idx) const {
273-
RREdgeId lhs = RREdgeId(lhs_idx);
274-
RREdgeId rhs = RREdgeId(rhs_idx);
269+
bool operator()(RREdgeId lhs, RREdgeId rhs) const {
275270

276271
RRNodeId lhs_dest_node = rr_graph_storage_.edge_sink_node(lhs);
277272
RRNodeId lhs_src_node = rr_graph_storage_.edge_source_node(lhs);
278273
RRSwitchId lhs_switch_type = RRSwitchId(rr_graph_storage_.edge_switch(lhs));
279-
bool lhs_is_configurable = rr_switch_inf_[RRSwitchId(lhs_switch_type)].configurable();
274+
bool lhs_is_configurable = rr_switch_inf_[lhs_switch_type].configurable();
280275

281276
RRNodeId rhs_dest_node = rr_graph_storage_.edge_sink_node(rhs);
282277
RRNodeId rhs_src_node = rr_graph_storage_.edge_source_node(rhs);
283278
RRSwitchId rhs_switch_type = RRSwitchId(rr_graph_storage_.edge_switch(rhs));
284-
bool rhs_is_configurable = rr_switch_inf_[RRSwitchId(rhs_switch_type)].configurable();
279+
bool rhs_is_configurable = rr_switch_inf_[rhs_switch_type].configurable();
285280

286281
return std::make_tuple(lhs_src_node, !lhs_is_configurable, lhs_dest_node, lhs_switch_type) < std::make_tuple(rhs_src_node, !rhs_is_configurable, rhs_dest_node, rhs_switch_type);
287282
}

libs/librrgraph/src/base/rr_graph_storage.h

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -825,25 +825,26 @@ class t_rr_graph_storage {
825825
void sort_edges(t_comp_func comparison_function) {
826826

827827
size_t num_edges = edge_src_node_.size();
828-
std::vector<size_t> edge_indices(num_edges, 0);
829-
830-
std::iota(edge_indices.begin(), edge_indices.end(), 0);
828+
vtr::StrongIdRange<RREdgeId> edge_range(RREdgeId(0), RREdgeId(num_edges));
829+
std::vector<RREdgeId> edge_indices(edge_range.begin(), edge_range.end());
831830

832831
std::ranges::stable_sort(edge_indices, comparison_function);
833832

834-
835-
836833
vtr::vector<RREdgeId, RRNodeId> new_edge_src_node_(num_edges, RRNodeId::INVALID());
837834
vtr::vector<RREdgeId, RRNodeId> new_edge_dest_node_(num_edges, RRNodeId::INVALID());
838835
vtr::vector<RREdgeId, short> new_edge_switch_(num_edges, LIBRRGRAPH_UNDEFINED_VAL);
839836
vtr::vector<RREdgeId, bool> new_edge_remapped_(num_edges, false);
840837

841838
size_t new_index = 0;
842-
for (size_t edge_index : edge_indices) {
843-
new_edge_src_node_[RREdgeId(new_index)] = edge_src_node_[RREdgeId(edge_index)];
844-
new_edge_dest_node_[RREdgeId(new_index)] = edge_dest_node_[RREdgeId(edge_index)];
845-
new_edge_switch_[RREdgeId(new_index)] = edge_switch_[RREdgeId(edge_index)];
846-
new_edge_remapped_[RREdgeId(new_index)] = edge_remapped_[RREdgeId(edge_index)];
839+
for (RREdgeId edge_index : edge_indices) {
840+
841+
RREdgeId new_edge_index = RREdgeId(new_index);
842+
843+
new_edge_src_node_[new_edge_index] = edge_src_node_[edge_index];
844+
new_edge_dest_node_[new_edge_index] = edge_dest_node_[edge_index];
845+
new_edge_switch_[new_edge_index] = edge_switch_[edge_index];
846+
new_edge_remapped_[new_edge_index] = edge_remapped_[edge_index];
847+
847848
new_index++;
848849
}
849850

@@ -898,9 +899,6 @@ class t_rr_graph_storage {
898899
}
899900

900901
private:
901-
friend class edge_compare_dest_node;
902-
friend class edge_compare_src_node_and_configurable_first;
903-
904902
/** @brief
905903
* Take allocated edges in edge_src_node_/ edge_dest_node_ / edge_switch_
906904
* sort, and assign the first edge for each

vpr/src/analytical_place/ap_draw_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ void APDrawManager::update_graphics(unsigned int iteration, enum APDrawType draw
4646
(void)iteration;
4747
(void)draw_type;
4848
#endif
49-
}
49+
}

vpr/src/analytical_place/ap_draw_manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ enum class APDrawType {
2727
* with NO_GRAPHICS conditional compilation directives.
2828
*/
2929
class APDrawManager {
30-
public:
30+
public:
3131
/**
3232
* @brief Constructor initializes the draw manager with a reference to the
3333
* current partial placement.

vpr/src/analytical_place/global_placer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ PartialPlacement SimPLGlobalPlacer::place() {
356356
// Initialize graphics for analytical placement, setting the reference in
357357
// the draw state.
358358
APDrawManager draw_manager(p_placement);
359-
359+
360360
// Run the global placer.
361361
for (size_t i = 0; i < max_num_iterations_; i++) {
362362
float iter_start_time = runtime_timer.elapsed_sec();
@@ -366,7 +366,7 @@ PartialPlacement SimPLGlobalPlacer::place() {
366366
solver_->solve(i, p_placement);
367367
float solver_end_time = runtime_timer.elapsed_sec();
368368
double lb_hpwl = p_placement.get_hpwl(ap_netlist_);
369-
369+
370370
// Update graphics after analytical solver
371371
draw_manager.update_graphics(i, APDrawType::Solver);
372372

@@ -375,7 +375,7 @@ PartialPlacement SimPLGlobalPlacer::place() {
375375
partial_legalizer_->legalize(p_placement);
376376
float legalizer_end_time = runtime_timer.elapsed_sec();
377377
double ub_hpwl = p_placement.get_hpwl(ap_netlist_);
378-
378+
379379
// Update graphics after legalizer
380380
draw_manager.update_graphics(i, APDrawType::Legalizer);
381381

vpr/src/draw/draw.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ void update_screen(ScreenUpdatePriority priority,
298298
* value controls whether or not the Proceed button must be clicked to *
299299
* continue. Saves the pic_on_screen_val to allow pan and zoom redraws. */
300300
t_draw_state* draw_state = get_draw_state_vars();
301-
301+
302302
strcpy(draw_state->default_message, msg);
303303

304304
if (!draw_state->show_graphics)
@@ -529,7 +529,7 @@ void set_initial_world() {
529529
initial_world = ezgl::rectangle(
530530
{-VISIBLE_MARGIN * draw_width, -VISIBLE_MARGIN * draw_height},
531531
{(1. + VISIBLE_MARGIN) * draw_width, (1. + VISIBLE_MARGIN)
532-
* draw_height});
532+
* draw_height});
533533
}
534534

535535
void set_initial_world_ap() {
@@ -539,7 +539,6 @@ void set_initial_world_ap() {
539539
const size_t grid_w = device_ctx.grid.width();
540540
const size_t grid_h = device_ctx.grid.height();
541541

542-
543542
float draw_width = static_cast<float>(grid_w);
544543
float draw_height = static_cast<float>(grid_h);
545544

vpr/src/draw/draw.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ void update_screen(ScreenUpdatePriority priority,
5656
void init_draw_coords(float clb_width, const BlkLocRegistry& blk_loc_registry);
5757

5858
/**
59-
* @brief Set the intial_world ezgl::rectangle for analytical placement
60-
*
61-
* This function sets graphic initial dimensions so there are no gaps between blocks
62-
*/
59+
* @brief Set the intial_world ezgl::rectangle for analytical placement
60+
*
61+
* This function sets graphic initial dimensions so there are no gaps between blocks
62+
*/
6363
void set_initial_world_ap();
6464

6565
/**

vpr/src/draw/draw_interposer.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ void draw_interposer_cuts(ezgl::renderer* g) {
2424
{draw_coords->tile_x.front() - draw_coords->get_tile_width(),
2525
draw_coords->tile_y.front() - draw_coords->get_tile_height()},
2626
{draw_coords->tile_x.back() + 2 * draw_coords->get_tile_width(),
27-
draw_coords->tile_y.back() + 2 * draw_coords->get_tile_height()}
28-
};
27+
draw_coords->tile_y.back() + 2 * draw_coords->get_tile_height()}};
2928

3029
g->set_color(ezgl::BLACK, 255);
3130
g->set_line_dash(ezgl::line_dash::asymmetric_5_3);
@@ -80,4 +79,4 @@ void draw_interposer_cuts(ezgl::renderer* g) {
8079
}
8180
}
8281

83-
#endif
82+
#endif

vpr/src/draw/draw_interposer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ class renderer;
2121
/// which side of the cut owns the channel.
2222
void draw_interposer_cuts(ezgl::renderer* g);
2323

24-
#endif
24+
#endif

vpr/src/draw/draw_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ struct t_draw_state {
415415
*/
416416
std::optional<std::reference_wrapper<const PartialPlacement>> ap_partial_placement_ref_;
417417

418-
public:
418+
public:
419419
// Set/clear/get the AP partial placement reference used during AP drawing
420420
void set_ap_partial_placement_ref(const PartialPlacement& p) { ap_partial_placement_ref_ = std::cref(p); }
421421
void clear_ap_partial_placement_ref() { ap_partial_placement_ref_.reset(); }

0 commit comments

Comments
 (0)