Skip to content

Commit c4156f2

Browse files
authored
Merge pull request #2317 from verilog-to-routing/setup_placer_seed
Clean up and Document Placement
2 parents 02d433d + d88b444 commit c4156f2

File tree

8 files changed

+157
-15
lines changed

8 files changed

+157
-15
lines changed

doc/src/vpr/command_line_usage.rst

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,65 @@ Setting any of the following options selects `Dusty's annealing schedule <dusty_
821821

822822
**Default:** ``0.25``
823823

824+
.. option:: --place_cost_exp <float>
825+
826+
Wiring cost is divided by the average channel width over a net's bounding box
827+
taken to this exponent. Only impacts devices with different channel widths in
828+
different directions or regions.
829+
830+
**Default:** ``1``
831+
832+
.. option:: --RL_agent_placement {on | off}
833+
834+
Uses a Reinforcement Learning (RL) agent in choosing the appropiate move type in placement.
835+
It activates the RL agent placement instead of using a fixed probability for each move type.
836+
837+
**Default:** ``on``
838+
839+
.. option:: --place_agent_multistate {on | off}
840+
841+
Enable a multistate agent in the placement. A second state will be activated late in
842+
the annealing and in the Quench that includes all the timing driven directed moves.
843+
844+
**Default:** ``on``
845+
846+
.. option:: --place_agent_algorithm {e_greedy | softmax}
847+
848+
Controls which placement RL agent is used.
849+
850+
**Default:** ``softmax``
851+
852+
.. option:: --place_agent_epsilon <float>
853+
854+
Placement RL agent's epsilon for the epsilon-greedy agent. Epsilon represents
855+
the percentage of exploration actions taken vs the exploitation ones.
856+
857+
**Default:** ``0.3``
858+
859+
.. option:: --place_agent_gamma <float>
860+
861+
Controls how quickly the agent's memory decays. Values between [0., 1.] specify
862+
the fraction of weight in the exponentially weighted reward average applied to moves
863+
which occured greater than moves_per_temp moves ago. Values < 0 cause the
864+
unweighted reward sample average to be used (all samples are weighted equally)
865+
866+
**Default:** ``0.05``
867+
868+
.. option:: --place_reward_fun {basic | nonPenalizing_basic | runtime_aware | WLbiased_runtime_aware}
869+
870+
The reward function used by the placement RL agent to learn the best action at each anneal stage.
871+
872+
.. note:: The latter two are only available for timing-driven placement.
873+
874+
**Default:** ``WLbiased_runtime_aware``
875+
876+
.. option:: --place_agent_space {move_type | move_block_type}
877+
878+
The RL Agent exploration space can be either based on only move types or also consider different block types moved.
879+
880+
**Default:** ``move_block_type``
881+
882+
824883
.. _timing_driven_placer_options:
825884

826885
Timing-Driven Placer Options
@@ -920,6 +979,82 @@ The following options are only valid when the placement engine is in timing-driv
920979

921980
Name of the post-placement timing report file to generate (not generated if unspecfied).
922981

982+
983+
.. _noc_placement_options:
984+
985+
NoC Options
986+
^^^^^^^^^^^^^^
987+
The following options are only used when FPGA device and netlist contain a NoC router.
988+
989+
.. option:: --noc {on | off}
990+
991+
Enables a NoC-driven placer that optimizes the placement of routers on the NoC. Also, it enables an option in the graphical display that can be used to
992+
display the NoC on the FPGA.
993+
994+
**Default:** ``off``
995+
996+
.. option:: --noc_flows_file <file>
997+
998+
XML file containing the list of traffic flows within the NoC (communication between routers).
999+
1000+
.. note:: noc_flows_file are required to specify if NoC optimization is turned on (--noc on).
1001+
1002+
.. option:: --noc_routing_algorithm {xy_routing | bfs_routing}
1003+
1004+
Controls the algorithm used by the NoC to route packets.
1005+
1006+
* ``xy_routing`` Uses the direction oriented routing algorithm. This is recommended to be used with mesh NoC topologies.
1007+
* ``bfs_routing`` Uses the breadth first search algorithm. The objective is to find a route that uses a minimum number of links. This can be used with any NoC topology.
1008+
1009+
**Default:** ``bfs_routing``
1010+
1011+
.. option:: --noc_placement_weighting <float>
1012+
1013+
Controls the importance of the NoC placement parameters relative to timing and wirelength of the design.
1014+
1015+
* ``noc_placement_weighting = 0`` means the placement is based solely on timing and wirelength.
1016+
* ``noc_placement_weighting = 1`` means noc placement is considered equal to timing and wirelength.
1017+
* ``noc_placement_weighting > 1`` means the placement is increasingly dominated by NoC parameters.
1018+
1019+
**Default:** ``0.6``
1020+
1021+
.. option:: --noc_latency_constraints_weighting <float>
1022+
1023+
Controls the importance of meeting all the NoC traffic flow latency constraints.
1024+
1025+
* ``latency_constraints = 0`` means the latency constraints have no relevance to placement.
1026+
* ``0 < latency_constraints < 1`` means the latency constraints are weighted equally to the sum of other placement cost components.
1027+
* ``latency_constraints > 1`` means the placement is increasingly dominated by reducing the latency constraints of the traffic flows.
1028+
1029+
**Default:** ``1``
1030+
1031+
.. option:: --noc_latency_weighting <float>
1032+
1033+
Controls the importance of reducing the latencies of the NoC traffic flows.
1034+
This value can be >=0,
1035+
1036+
* ``latency = 0`` means the latencies have no relevance to placement.
1037+
* ``0 < latency < 1`` means the latencies are weighted equally to the sum of other placement cost components.
1038+
* ``latency > 1`` means the placement is increasingly dominated by reducing the latencies of the traffic flows.
1039+
1040+
**Default:** ``0.05``
1041+
1042+
.. option:: --noc_swap_percentage <float>
1043+
1044+
Sets the minimum fraction of swaps attempted by the placer that are NoC blocks.
1045+
This value is an integer ranging from [0-100].
1046+
1047+
* ``0`` means NoC blocks will be moved at the same rate as other blocks.
1048+
* ``100`` means all swaps attempted by the placer are NoC router blocks.
1049+
1050+
**Default:** ``40``
1051+
1052+
.. option:: --noc_placement_file_name <file>
1053+
1054+
Name of the output file that contains the NoC placement information.
1055+
1056+
**Default:** ``vpr_noc_placement_output.txt``
1057+
9231058
.. _router_options:
9241059

9251060
Router Options

libs/libarchfpga/src/echo_arch.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,21 @@ void PrintArchInfo(FILE* Echo, const t_arch* arch) {
322322
}
323323
fprintf(Echo, "*************************************************\n\n");
324324

325+
//Router Connection List
326+
if (arch->noc != nullptr) {
327+
fprintf(Echo, "*************************************************\n");
328+
fprintf(Echo, "NoC Router Connection List:\n");
329+
330+
for (auto noc_router : arch->noc->router_list) {
331+
fprintf(Echo, "NoC router %d is connected to:\t", noc_router.id);
332+
for (auto noc_conn_id : noc_router.connection_list) {
333+
fprintf(Echo, "%d\t", noc_conn_id);
334+
}
335+
fprintf(Echo, "\n");
336+
}
337+
fprintf(Echo, "*************************************************\n\n");
338+
}
339+
325340
//Architecture Power
326341
fprintf(Echo, "*************************************************\n");
327342
fprintf(Echo, "Power:\n");

libs/libarchfpga/src/read_xml_arch_file.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4682,16 +4682,6 @@ static void ProcessNoc(pugi::xml_node noc_tag, t_arch* arch, const pugiutil::loc
46824682

46834683
if (noc_mesh_topology) {
46844684
processMeshTopology(noc_mesh_topology, loc_data, noc_ref);
4685-
4686-
for (auto i = noc_ref->router_list.begin(); i != noc_ref->router_list.end(); i++) {
4687-
std::cout << "router " << i->id << ": ";
4688-
4689-
for (auto j = i->connection_list.begin(); j != i->connection_list.end(); j++) {
4690-
std::cout << *j << ",";
4691-
}
4692-
4693-
std::cout << "\n";
4694-
}
46954685
} else {
46964686
noc_topology = pugiutil::get_single_child(noc_tag, "topology", loc_data, pugiutil::REQUIRED);
46974687

vpr/src/base/SetupVPR.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ void SetupVPR(const t_options* Options,
267267
vtr::out_file_prefix = Options->out_file_prefix;
268268

269269
/* Set seed for pseudo-random placement, default seed to 1 */
270-
PlacerOpts->seed = Options->Seed;
271270
vtr::srandom(PlacerOpts->seed);
272271

273272
{
@@ -600,7 +599,6 @@ static void SetupPlacerOpts(const t_options& Options, t_placer_opts* PlacerOpts)
600599
PlacerOpts->inner_loop_recompute_divider = Options.inner_loop_recompute_divider;
601600
PlacerOpts->quench_recompute_divider = Options.quench_recompute_divider;
602601

603-
//TODO: document?
604602
PlacerOpts->place_cost_exp = 1;
605603

606604
PlacerOpts->td_place_exp_first = Options.place_exp_first;
@@ -629,7 +627,6 @@ static void SetupPlacerOpts(const t_options& Options, t_placer_opts* PlacerOpts)
629627
PlacerOpts->delay_model_type = Options.place_delay_model;
630628
PlacerOpts->delay_model_reducer = Options.place_delay_model_reducer;
631629

632-
//TODO: document?
633630
PlacerOpts->place_freq = PLACE_ONCE; /* DEFAULT */
634631

635632
PlacerOpts->post_place_timing_report_file = Options.post_place_timing_report_file;
@@ -666,6 +663,8 @@ static void SetupPlacerOpts(const t_options& Options, t_placer_opts* PlacerOpts)
666663
PlacerOpts->place_constraint_subtile = Options.place_constraint_subtile;
667664
PlacerOpts->floorplan_num_horizontal_partitions = Options.floorplan_num_horizontal_partitions;
668665
PlacerOpts->floorplan_num_vertical_partitions = Options.floorplan_num_vertical_partitions;
666+
667+
PlacerOpts->seed = Options.Seed;
669668
}
670669

671670
static void SetupAnalysisOpts(const t_options& Options, t_analysis_opts& analysis_opts) {

vpr/src/base/vpr_types.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,10 @@ enum class e_place_delta_delay_algorithm {
10381038
* When in CRITICALITY_TIMING_PLACE mode, what is the
10391039
* tradeoff between timing and wiring costs.
10401040
* @param place_cost_exp
1041-
* Power to which denominator is raised for linear_cong.
1041+
* Wiring cost is divided by the average channel width over
1042+
* a net's bounding box taken to this exponent.
1043+
* Only impacts devices with different channel widths in
1044+
* different directions or regions. (Default: 1)
10421045
* @param place_chan_width
10431046
* The channel width assumed if only one placement is performed.
10441047
* @param pad_loc_type
@@ -1050,7 +1053,7 @@ enum class e_place_delta_delay_algorithm {
10501053
* File to read pad locations from if pad_loc_type is USER.
10511054
* @param place_freq
10521055
* Should the placement be skipped, done once, or done
1053-
* for each channel width in the binary search.
1056+
* for each channel width in the binary search. (Default: ONCE)
10541057
* @param recompute_crit_iter
10551058
* How many temperature stages pass before we recompute
10561059
* criticalities based on the current placement and its

0 commit comments

Comments
 (0)