Skip to content

Commit 03b820a

Browse files
committed
simplified find_subtile_in_location, improved commenting and updated results.
1 parent 05e2917 commit 03b820a

File tree

5 files changed

+31
-35
lines changed

5 files changed

+31
-35
lines changed

vpr/src/place/initial_placement.cpp

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,17 @@ static bool is_loc_legal(const t_pl_loc& loc,
148148
t_logical_block_type_ptr block_type);
149149

150150
/**
151-
* @brief Helper function to choose a subtile in specified location if compatible and available one exits.
151+
* @brief Helper function to choose a subtile in specified location if the type is compatible and an available one exists.
152152
*
153-
* @param centroid The centroid location at which the subtile will be selected using its x,y, and layer.
154-
* @param block_type Logical block type of the macro head member.
155-
* @param block_loc_registry Placement block location information. To be filled with the location
156-
* where pl_macro is placed.
157-
* @param pr The PartitionRegion of the macro head member - represents its floorplanning constraints, is the size of
158-
* the whole chip if the macro is not constrained.
159-
* @param rng A random number generator to select subtile from available and compatible ones.
153+
* @param centroid The centroid location at which the subtile will be selected using its x, y, and layer.
154+
* @param block_type Logical block type we would like to place here.
155+
* @param block_loc_registry Information on where other blocks have been placed.
156+
* @param pr The PartitionRegion of the block we are trying to place - represents its floorplanning constraints;
157+
* it is the size of the whole chip if the block is not constrained.
158+
* @param rng A random number generator to select a subtile from the available and compatible ones.
160159
*
161-
* @return False if location on chip, legal, but no available subtile found. True otherwise. False leads us to
162-
* neighbour placement currently.
160+
* @return True if the location is on the chip, legal, and at least one available subtile is found at that location;
161+
* false otherwise.
163162
*/
164163
static bool find_subtile_in_location(t_pl_loc& centroid,
165164
t_logical_block_type_ptr block_type,
@@ -367,13 +366,13 @@ bool find_subtile_in_location(t_pl_loc& centroid,
367366
vtr::RngContainer& rng) {
368367
//check if the location is on chip and legal, if yes try to update subtile
369368
if (is_loc_on_chip({centroid.x, centroid.y, centroid.layer}) && is_loc_legal(centroid, pr, block_type)) {
370-
//finding the subtile location
369+
//find the compatible subtiles
371370
const auto& device_ctx = g_vpr_ctx.device();
372371
const auto& compressed_block_grid = g_vpr_ctx.placement().compressed_block_grids[block_type->index];
373372
const auto& type = device_ctx.grid.get_physical_type({centroid.x, centroid.y, centroid.layer});
374373
const auto& compatible_sub_tiles = compressed_block_grid.compatible_sub_tile_num(type->index);
375374

376-
//filter out occupied subtiles
375+
//filter out the occupied subtiles
377376
const GridBlock& grid_blocks = blk_loc_registry.grid_blocks();
378377
std::vector<int> available_sub_tiles;
379378
available_sub_tiles.reserve(compatible_sub_tiles.size());
@@ -384,16 +383,13 @@ bool find_subtile_in_location(t_pl_loc& centroid,
384383
}
385384
}
386385

387-
//If there is at least one available subtile, update the centroid. Otherwise, sincel location
388-
//is legal and on chip but no subtile found, return false for trying neighbour placement.
389386
if (!available_sub_tiles.empty()) {
390387
centroid.sub_tile = available_sub_tiles[rng.irand((int)available_sub_tiles.size() - 1)];
391-
} else {
392-
return false;
388+
return true;
393389
}
394390
}
395391

396-
return true;
392+
return false;
397393
}
398394

399395
static bool find_centroid_neighbor(t_pl_loc& centroid_loc,
@@ -607,14 +603,14 @@ static bool try_centroid_placement(const t_pl_macro& pl_macro,
607603
t_pl_loc centroid_loc(OPEN, OPEN, OPEN, OPEN);
608604
std::vector<ClusterBlockId> unplaced_blocks_to_update_their_score;
609605

610-
bool try_neighbour_due_to_subtile = false;
606+
bool found_legal_subtile = false;
611607

612608
if (!flat_placement_info.valid) {
613609
// If a flat placement is not provided, use the centroid of connected
614610
// blocks which have already been placed.
615611
unplaced_blocks_to_update_their_score = find_centroid_loc(pl_macro, centroid_loc, blk_loc_registry);
616-
if(!find_subtile_in_location(centroid_loc, block_type, blk_loc_registry, pr, rng)) {
617-
try_neighbour_due_to_subtile = true;
612+
if(find_subtile_in_location(centroid_loc, block_type, blk_loc_registry, pr, rng)) {
613+
found_legal_subtile = true;
618614
}
619615
} else {
620616
// If a flat placement is provided, use the flat placement to get the
@@ -628,8 +624,8 @@ static bool try_centroid_placement(const t_pl_macro& pl_macro,
628624
if (!is_loc_on_chip({centroid_loc.x, centroid_loc.y, centroid_loc.layer}) ||
629625
!is_loc_legal(centroid_loc, pr, block_type)) {
630626
unplaced_blocks_to_update_their_score = find_centroid_loc(pl_macro, centroid_loc, blk_loc_registry);
631-
if(!find_subtile_in_location(centroid_loc, block_type, blk_loc_registry, pr, rng)) {
632-
try_neighbour_due_to_subtile = true;
627+
if(find_subtile_in_location(centroid_loc, block_type, blk_loc_registry, pr, rng)) {
628+
found_legal_subtile = true;
633629
}
634630
}
635631
}
@@ -641,7 +637,7 @@ static bool try_centroid_placement(const t_pl_macro& pl_macro,
641637

642638
//centroid suggestion was either occupied or does not match block type
643639
//try to find a near location that meet these requirements
644-
if (!is_loc_legal(centroid_loc, pr, block_type) || try_neighbour_due_to_subtile) {
640+
if (!found_legal_subtile) {
645641
bool neighbor_legal_loc = find_centroid_neighbor(centroid_loc, block_type, false, blk_loc_registry, rng);
646642
if (!neighbor_legal_loc) { //no neighbor candidate found
647643
return false;
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
arch circuit script_params vtr_flow_elapsed_time vtr_max_mem_stage vtr_max_mem error odin_synth_time max_odin_mem parmys_synth_time max_parmys_mem abc_depth abc_synth_time abc_cec_time abc_sec_time max_abc_mem ace_time max_ace_mem num_clb num_io num_memories num_mult vpr_status vpr_revision vpr_build_info vpr_compiler vpr_compiled hostname rundir max_vpr_mem num_primary_inputs num_primary_outputs num_pre_packed_nets num_pre_packed_blocks num_netlist_clocks num_post_packed_nets num_post_packed_blocks device_width device_height device_grid_tiles device_limiting_resources device_name pack_mem pack_time placed_wirelength_est total_swap accepted_swap rejected_swap aborted_swap place_mem place_time place_quench_time placed_CPD_est placed_setup_TNS_est placed_setup_WNS_est placed_geomean_nonvirtual_intradomain_critical_path_delay_est place_delay_matrix_lookup_time place_quench_timing_analysis_time place_quench_sta_time place_total_timing_analysis_time place_total_sta_time ap_mem ap_time ap_full_legalizer_mem ap_full_legalizer_time min_chan_width routed_wirelength min_chan_width_route_success_iteration logic_block_area_total logic_block_area_used min_chan_width_routing_area_total min_chan_width_routing_area_per_tile min_chan_width_route_time min_chan_width_total_timing_analysis_time min_chan_width_total_sta_time crit_path_num_rr_graph_nodes crit_path_num_rr_graph_edges crit_path_collapsed_nodes crit_path_routed_wirelength crit_path_route_success_iteration crit_path_total_nets_routed crit_path_total_connections_routed crit_path_total_heap_pushes crit_path_total_heap_pops critical_path_delay geomean_nonvirtual_intradomain_critical_path_delay setup_TNS setup_WNS hold_TNS hold_WNS crit_path_routing_area_total crit_path_routing_area_per_tile router_lookahead_computation_time crit_path_route_time crit_path_create_rr_graph_time crit_path_create_intra_cluster_rr_graph_time crit_path_tile_lookahead_computation_time crit_path_router_lookahead_computation_time crit_path_total_timing_analysis_time crit_path_total_sta_time
2-
k6_frac_N10_mem32K_40nm.xml multiclock_output_and_latch.v common 0.52 vpr 66.02 MiB 0.02 7040 -1 -1 1 0.06 -1 -1 35596 -1 -1 2 6 0 0 success v8.0.0-12164-g463dd1c36-dirty Release VTR_ASSERT_LEVEL=2 GNU 11.4.0 on Linux-6.8.0-51-generic x86_64 2025-02-20T15:42:53 haydar-Precision-5820-Tower /home/haydar/vtr-verilog-to-routing 67604 6 1 13 14 2 8 9 4 4 16 clb auto 27.5 MiB 0.01 18 27 14 11 2 66.0 MiB 0.00 0.00 1.02737 -3.59667 -1.02737 0.545 0.01 5.3292e-05 4.5019e-05 0.000306591 0.000256921 -1 -1 -1 -1 20 15 7 107788 107788 10441.3 652.579 0.01 0.00211307 0.00189921 742 1670 -1 17 14 34 34 409 236 1.40641 0.545 -4.27839 -1.40641 0 0 13748.8 859.301 0.00 0.00 0.00 -1 -1 0.00 0.00189972 0.00171949
3-
k6_frac_N10_mem32K_40nm.xml multiclock_reader_writer.v common 0.61 vpr 65.82 MiB 0.02 6912 -1 -1 1 0.06 -1 -1 35588 -1 -1 2 3 0 0 success v8.0.0-12164-g463dd1c36-dirty Release VTR_ASSERT_LEVEL=2 GNU 11.4.0 on Linux-6.8.0-51-generic x86_64 2025-02-20T15:42:53 haydar-Precision-5820-Tower /home/haydar/vtr-verilog-to-routing 67396 3 1 25 26 2 8 6 4 4 16 clb auto 27.5 MiB 0.02 20 15 4 1 10 65.8 MiB 0.00 0.00 0.620042 -8.9502 -0.620042 0.557849 0.01 8.2682e-05 6.9909e-05 0.000633195 0.000565801 -1 -1 -1 -1 20 22 1 107788 107788 10441.3 652.579 0.01 0.00358735 0.00333372 742 1670 -1 27 6 18 18 703 470 0.865467 0.557849 -9.14332 -0.865467 0 0 13748.8 859.301 0.00 0.00 0.00 -1 -1 0.00 0.00327369 0.00304055
4-
k6_frac_N10_mem32K_40nm.xml multiclock_separate_and_latch.v common 0.48 vpr 66.14 MiB 0.02 6912 -1 -1 1 0.02 -1 -1 33640 -1 -1 2 6 0 0 success v8.0.0-12164-g463dd1c36-dirty Release VTR_ASSERT_LEVEL=2 GNU 11.4.0 on Linux-6.8.0-51-generic x86_64 2025-02-20T15:42:53 haydar-Precision-5820-Tower /home/haydar/vtr-verilog-to-routing 67724 6 2 10 12 2 8 10 4 4 16 clb auto 27.8 MiB 0.00 19 30 14 9 7 66.1 MiB 0.00 0.00 0.620297 -2.13808 -0.620297 nan 0.01 4.1509e-05 3.0578e-05 0.000200894 0.000157769 -1 -1 -1 -1 20 27 14 107788 107788 10441.3 652.579 0.01 0.00213275 0.00183214 742 1670 -1 19 15 33 33 727 463 0.716884 nan -2.60018 -0.716884 0 0 13748.8 859.301 0.00 0.00 0.00 -1 -1 0.00 0.00208972 0.00189128
2+
k6_frac_N10_mem32K_40nm.xml multiclock_output_and_latch.v common 0.52 vpr 312.19 MiB 0.02 7040 -1 -1 1 0.06 -1 -1 35596 -1 -1 2 6 0 0 success v8.0.0-12164-g463dd1c36-dirty Release VTR_ASSERT_LEVEL=2 GNU 11.4.0 on Linux-6.8.0-51-generic x86_64 2025-02-20T15:42:53 haydar-Precision-5820-Tower /home/haydar/vtr-verilog-to-routing 67604 6 1 13 14 2 8 9 4 4 16 clb auto 27.5 MiB 0.01 18 27 14 11 2 66.0 MiB 0.00 0.00 1.02737 -3.59667 -1.02737 0.545 0.01 5.3292e-05 4.5019e-05 0.000306591 0.000256921 -1 -1 -1 -1 20 15 7 107788 107788 10441.3 652.579 0.01 0.00211307 0.00189921 742 1670 -1 17 14 34 34 409 236 1.40641 0.545 -4.27839 -1.40641 0 0 13748.8 859.301 0.00 0.00 0.00 -1 -1 0.00 0.00189972 0.00171949
3+
k6_frac_N10_mem32K_40nm.xml multiclock_reader_writer.v common 0.61 vpr 313.48 MiB 0.02 6912 -1 -1 1 0.06 -1 -1 35588 -1 -1 2 3 0 0 success v8.0.0-12164-g463dd1c36-dirty Release VTR_ASSERT_LEVEL=2 GNU 11.4.0 on Linux-6.8.0-51-generic x86_64 2025-02-20T15:42:53 haydar-Precision-5820-Tower /home/haydar/vtr-verilog-to-routing 67396 3 1 25 26 2 8 6 4 4 16 clb auto 27.5 MiB 0.02 20 15 4 1 10 65.8 MiB 0.00 0.00 0.620042 -8.9502 -0.620042 0.557849 0.01 8.2682e-05 6.9909e-05 0.000633195 0.000565801 -1 -1 -1 -1 20 22 1 107788 107788 10441.3 652.579 0.01 0.00358735 0.00333372 742 1670 -1 27 6 18 18 703 470 0.865467 0.557849 -9.14332 -0.865467 0 0 13748.8 859.301 0.00 0.00 0.00 -1 -1 0.00 0.00327369 0.00304055
4+
k6_frac_N10_mem32K_40nm.xml multiclock_separate_and_latch.v common 0.48 vpr 312.78 MiB 0.02 6912 -1 -1 1 0.02 -1 -1 33640 -1 -1 2 6 0 0 success v8.0.0-12164-g463dd1c36-dirty Release VTR_ASSERT_LEVEL=2 GNU 11.4.0 on Linux-6.8.0-51-generic x86_64 2025-02-20T15:42:53 haydar-Precision-5820-Tower /home/haydar/vtr-verilog-to-routing 67724 6 2 10 12 2 8 10 4 4 16 clb auto 27.8 MiB 0.00 19 30 14 9 7 66.1 MiB 0.00 0.00 0.620297 -2.13808 -0.620297 nan 0.01 4.1509e-05 3.0578e-05 0.000200894 0.000157769 -1 -1 -1 -1 20 27 14 107788 107788 10441.3 652.579 0.01 0.00213275 0.00183214 742 1670 -1 19 15 33 33 727 463 0.716884 nan -2.60018 -0.716884 0 0 13748.8 859.301 0.00 0.00 0.00 -1 -1 0.00 0.00208972 0.00189128

0 commit comments

Comments
 (0)