Skip to content

Commit 8338c90

Browse files
Merge branch 'master' into noc_pack_part and resolved conflicts
2 parents 1f2ac0b + 9cc02c3 commit 8338c90

16 files changed

+118
-102
lines changed

doc/src/quickstart/index.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ On most unix-like systems you can run:
4848
4949
> make
5050
51+
The default front-end for VTR is :ref:`Parmys<parmys>`, but you can build with ODIN II instead using the command below. This is required to run :ref:`Synthesizing with ODIN II<synthesizing_with_odin_ii>`.
52+
53+
.. code-block:: bash
54+
55+
> make CMAKE_PARAMS="-DWITH_ODIN=on"
56+
5157
from the VTR root directory (hereafter referred to as :term:`$VTR_ROOT`) to build VTR.
5258

5359
.. note::
@@ -63,6 +69,8 @@ from the VTR root directory (hereafter referred to as :term:`$VTR_ROOT`) to buil
6369
* define VTR_ROOT as a variable in your shell (e.g. if ``~/trees/vtr`` is the path to the VTR source tree on your machine, run the equivalent of ``VTR_ROOT=~/trees/vtr`` in BASH) which will allow you to run the commands as written in this guide, or
6470
* manually replace `$VTR_ROOT` in the example commands below with your path to the VTR source tree.
6571

72+
73+
6674
For more details on building VTR on various operating systems/platforms see :doc:`Building VTR</BUILDING>`.
6775

6876

@@ -235,6 +243,7 @@ Next we need to run the three main sets of tools:
235243
* :ref:`ABC` performs 'logic optimization' which simplifies the circuit logic, and 'technology mapping' which converts logic equations into the Look-Up-Tables (LUTs) available on an FPGA, and
236244
* :ref:`VPR` which performs packing, placement and routing of the circuit to implement it on the targetted FPGA architecture.
237245

246+
.. _synthesizing_with_odin_ii:
238247
Synthesizing with ODIN II
239248
~~~~~~~~~~~~~~~~~~~~~~~~~
240249

doc/src/tutorials/flow/basic_flow.rst

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,9 @@ The following steps show you to run the VTR design flow to map a sample circuit
1717
1818
$VTR_ROOT/vtr_flow/scripts/run_vtr_task.py basic_no_timing
1919
20-
The subdirectory ``regression_tests/vtr_reg_basic`` contains tests that are to be run before each commit. They check for basic functionallity to make sure nothing was extremely out of order. This command runs the VTR flow on a set of circuits and a single architecture.
20+
The subdirectory ``regression_tests/vtr_reg_basic`` contains tests that are to be run before each commit. They check for basic functionality to make sure nothing was extremely out of order. This command runs the VTR flow on a set of circuits and a single architecture.
2121
The files generated from the run are stored in ``basic_no_timing/run[#]`` where ``[#]`` is the number of runs you have done.
22-
If this is your first time running the flow, the results will be stored in basic_no_timing/run001.
23-
When the script completes, enter the following command:
24-
25-
.. code-block:: shell
26-
27-
../../../scripts/python_libs/vtr/parse_vtr_task.py basic_no_timing/
28-
29-
This parses out the information of the VTR run and outputs the results in a text file called ``run[#]/parse_results.txt``.
22+
If this is your first time running the flow, the results will be stored in basic_no_timing/run001. The command parses out the information of the VTR run and outputs the results in a text file called ``run[#]/parse_results.txt``.
3023

3124
More info on how to run the flow on multiple circuits and architectures along with different options later.
3225
Before that, we need to ensure that the run that you have done works.

doc/src/vpr/basic_flow.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Basic flow
44
The Place and Route process in VPR consists of several steps:
55

66
- Packing (combinines primitives into complex blocks)
7-
- Placment (places complex blocks within the FPGA grid)
7+
- Placement (places complex blocks within the FPGA grid)
88
- Routing (determines interconnections between blocks)
99
- Analysis (analyzes the implementation)
1010

doc/src/vpr/command_line_usage.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,6 +1299,7 @@ The following options are only valid when the router is in timing-driven mode (t
12991299
**Default:** ``1.2``
13001300

13011301
.. option:: --router_profiler_astar_fac <float>
1302+
13021303
Controls the directedness of the timing-driven router's exploration when doing router delay profiling of an architecture.
13031304
The router delay profiling step is currently used to calculate the place delay matrix lookup.
13041305
Values between 1 and 2 are resonable; higher values trade some quality for reduced run-time.

odin_ii/src/verilog/verilog_bison.y

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ int yylex(void);
5252
%define parse.error verbose
5353

5454
%locations
55+
%expect 2
5556

5657
%union{
5758
char *id_name;
@@ -208,6 +209,8 @@ int yylex(void);
208209
%type <node> list_of_generate_block_items generate_item generate_block_item generate loop_generate_construct if_generate_construct
209210
%type <node> case_generate_construct case_generate_item_list case_generate_items generate_block generate_localparam_declaration generate_defparam_declaration
210211

212+
213+
211214
/* capture wether an operation is signed or not */
212215
%type <op> var_signedness
213216

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ psutil
44

55
# Python linter and formatter
66
click==8.0.2 # Our version of black needs an older version of click (https://stackoverflow.com/questions/71673404/importerror-cannot-import-name-unicodefun-from-click)
7-
black==20.8b1
7+
black==21.4b0
88
pylint==2.7.4
99

1010
# Surelog

vpr/src/base/CheckSetup.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,20 @@ void CheckSetup(const t_packer_opts& PackerOpts,
4343
"A block location file requires that placement is enabled.\n");
4444
}
4545

46-
if (PlacerOpts.place_static_move_prob.size() != NUM_PL_MOVE_TYPES) {
46+
if (PlacerOpts.place_algorithm.is_timing_driven() &&
47+
PlacerOpts.place_static_move_prob.size() > NUM_PL_MOVE_TYPES) {
4748
VPR_FATAL_ERROR(VPR_ERROR_OTHER,
48-
"The number of placer move probabilities should equal to the total number of supported moves. %d\n", PlacerOpts.place_static_move_prob.size());
49+
"The number of provided placer move probabilities (%d) should equal or less than the total number of supported moves (%d).\n",
50+
PlacerOpts.place_static_move_prob.size(),
51+
NUM_PL_MOVE_TYPES);
4952
}
5053

51-
if (PlacerOpts.place_static_notiming_move_prob.size() != NUM_PL_NONTIMING_MOVE_TYPES) {
54+
if (!PlacerOpts.place_algorithm.is_timing_driven() &&
55+
PlacerOpts.place_static_move_prob.size() > NUM_PL_NONTIMING_MOVE_TYPES) {
5256
VPR_FATAL_ERROR(VPR_ERROR_OTHER,
53-
"The number of placer non timing move probabilities should equal to the total number of supported moves. %d\n", PlacerOpts.place_static_notiming_move_prob.size());
57+
"The number of placer non timing move probabilities (%d) should equal to or less than the total number of supported moves (%d).\n",
58+
PlacerOpts.place_static_move_prob.size(),
59+
NUM_PL_MOVE_TYPES);
5460
}
5561

5662
if (RouterOpts.doRouting) {

vpr/src/base/SetupVPR.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,8 @@ static void SetupPlacerOpts(const t_options& Options, t_placer_opts* PlacerOpts)
661661
PlacerOpts->effort_scaling = Options.place_effort_scaling;
662662
PlacerOpts->timing_update_type = Options.timing_update_type;
663663
PlacerOpts->enable_analytic_placer = Options.enable_analytic_placer;
664-
PlacerOpts->place_static_move_prob = Options.place_static_move_prob;
665-
PlacerOpts->place_static_notiming_move_prob = Options.place_static_notiming_move_prob;
664+
PlacerOpts->place_static_move_prob = vtr::vector<e_move_type, float>(Options.place_static_move_prob.value().begin(),
665+
Options.place_static_move_prob.value().end());
666666
PlacerOpts->place_high_fanout_net = Options.place_high_fanout_net;
667667
PlacerOpts->place_bounding_box_mode = Options.place_bounding_box_mode;
668668
PlacerOpts->RL_agent_placement = Options.RL_agent_placement;

vpr/src/base/read_options.cpp

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,24 +2032,17 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
20322032

20332033
place_grp.add_argument(args.place_static_move_prob, "--place_static_move_prob")
20342034
.help(
2035-
"The percentage probabilities of different moves in Simulated Annealing placement."
2036-
"This option is only effective for timing-driven placement."
2037-
"The numbers listed are interpreted as the percentage probabilities of {uniformMove, MedianMove, CentroidMove, "
2035+
"The percentage probabilities of different moves in Simulated Annealing placement. "
2036+
"For non-timing-driven placement, only the first 3 probabilities should be provided. "
2037+
"For timing-driven placement, all probabilities should be provided. "
2038+
"When the number of provided probabilities is less then the number of move types, zero probability "
2039+
"is assumed."
2040+
"The numbers listed are interpreted as the percentage probabilities of {UniformMove, MedianMove, CentroidMove, "
20382041
"WeightedCentroid, WeightedMedian, Critical UniformMove, Timing feasible Region(TFR)}, in that order.")
20392042
.nargs('+')
2040-
.default_value({"100", "0", "0", "0", "0", "0", "0"})
2041-
2043+
.default_value({"100"})
20422044
.show_in(argparse::ShowIn::HELP_ONLY);
20432045

2044-
place_grp.add_argument(args.place_static_notiming_move_prob, "--place_static_notiming_move_prob")
2045-
.help(
2046-
"The Probability of different non timing move in Simulated Annealing."
2047-
"This option is only effective for nontiming driven placement."
2048-
" The numbers listed are interpreted as the percentage probabilities of {uniformMove, MedianMove, CentroidMove}, in that order.")
2049-
.nargs('+')
2050-
.default_value({"100", "0", "0"})
2051-
2052-
.show_in(argparse::ShowIn::HELP_ONLY);
20532046

20542047
place_grp.add_argument(args.place_high_fanout_net, "--place_high_fanout_net")
20552048
.help(

vpr/src/base/read_options.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ struct t_options {
126126
argparse::ArgValue<e_place_delta_delay_algorithm> place_delta_delay_matrix_calculation_method;
127127
argparse::ArgValue<bool> enable_analytic_placer;
128128
argparse::ArgValue<std::vector<float>> place_static_move_prob;
129-
argparse::ArgValue<std::vector<float>> place_static_notiming_move_prob;
130129
argparse::ArgValue<int> place_high_fanout_net;
131130
argparse::ArgValue<e_place_bounding_box_mode> place_bounding_box_mode;
132131

vpr/src/base/vpr_types.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,6 +1152,8 @@ enum class e_place_delta_delay_algorithm {
11521152
DIJKSTRA_EXPANSION,
11531153
};
11541154

1155+
enum class e_move_type;
1156+
11551157
/**
11561158
* @brief Various options for the placer.
11571159
*
@@ -1250,8 +1252,7 @@ struct t_placer_opts {
12501252

12511253
std::string write_placement_delay_lookup;
12521254
std::string read_placement_delay_lookup;
1253-
std::vector<float> place_static_move_prob;
1254-
std::vector<float> place_static_notiming_move_prob;
1255+
vtr::vector<e_move_type, float> place_static_move_prob;
12551256
bool RL_agent_placement;
12561257
bool place_agent_multistate;
12571258
bool place_checkpointing;

vpr/src/place/RL_agent_util.cpp

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,25 @@
11
#include "RL_agent_util.h"
2+
#include "static_move_generator.h"
23
#include "manual_move_generator.h"
34

45
void create_move_generators(std::unique_ptr<MoveGenerator>& move_generator,
56
std::unique_ptr<MoveGenerator>& move_generator2,
67
const t_placer_opts& placer_opts,
78
int move_lim,
89
float noc_attraction_weight) {
9-
if (!placer_opts.RL_agent_placement) {
10-
if (placer_opts.place_algorithm.is_timing_driven()) {
11-
VTR_LOG("Using static probabilities for choosing each move type\n");
12-
VTR_LOG("Probability of Uniform_move : %f \n", placer_opts.place_static_move_prob[(int)e_move_type::UNIFORM]);
13-
VTR_LOG("Probability of Median_move : %f \n", placer_opts.place_static_move_prob[(int)e_move_type::MEDIAN]);
14-
VTR_LOG("Probability of Centroid_move : %f \n", placer_opts.place_static_move_prob[(int)e_move_type::CENTROID]);
15-
VTR_LOG("Probability of Weighted_centroid_move : %f \n", placer_opts.place_static_move_prob[(int)e_move_type::W_CENTROID]);
16-
VTR_LOG("Probability of Weighted_median_move : %f \n", placer_opts.place_static_move_prob[(int)e_move_type::W_MEDIAN]);
17-
VTR_LOG("Probability of Critical_uniform_move : %f \n", placer_opts.place_static_move_prob[(int)e_move_type::CRIT_UNIFORM]);
18-
VTR_LOG("Probability of Timing_feasible_region_move : %f \n", placer_opts.place_static_move_prob[(int)e_move_type::FEASIBLE_REGION]);
19-
move_generator = std::make_unique<StaticMoveGenerator>(placer_opts.place_static_move_prob);
20-
move_generator2 = std::make_unique<StaticMoveGenerator>(placer_opts.place_static_move_prob);
21-
} else { //Non-timing driven placement
22-
VTR_LOG("Using static probabilities for choosing each move type\n");
23-
VTR_LOG("Probability of Uniform_move : %f \n", placer_opts.place_static_notiming_move_prob[(int)e_move_type::UNIFORM]);
24-
VTR_LOG("Probability of Median_move : %f \n", placer_opts.place_static_notiming_move_prob[(int)e_move_type::MEDIAN]);
25-
VTR_LOG("Probability of Centroid_move : %f \n", placer_opts.place_static_notiming_move_prob[(int)e_move_type::CENTROID]);
26-
move_generator = std::make_unique<StaticMoveGenerator>(placer_opts.place_static_notiming_move_prob);
27-
move_generator2 = std::make_unique<StaticMoveGenerator>(placer_opts.place_static_notiming_move_prob);
10+
if (!placer_opts.RL_agent_placement) { // RL agent is disabled
11+
auto move_types = placer_opts.place_static_move_prob;
12+
move_types.resize((int)e_move_type::NUMBER_OF_AUTO_MOVES, 0.0f);
13+
14+
VTR_LOG("Using static probabilities for choosing each move type\n");
15+
for (const auto move_type : placer_opts.place_static_move_prob.keys()) {
16+
const std::string& move_name = move_type_to_string(move_type);
17+
VTR_LOG("Probability of %s : %f \n",
18+
move_name.c_str(),
19+
placer_opts.place_static_move_prob[move_type]);
2820
}
21+
move_generator = std::make_unique<StaticMoveGenerator>(placer_opts.place_static_move_prob);
22+
move_generator2 = std::make_unique<StaticMoveGenerator>(placer_opts.place_static_move_prob);
2923
} else { //RL based placement
3024
/* For the non timing driven placement: the agent has a single state *
3125
* - Available moves are (Uniform / Median / Centroid) *
@@ -127,7 +121,7 @@ void assign_current_move_generator(std::unique_ptr<MoveGenerator>& move_generato
127121
else
128122
current_move_generator = std::move(move_generator);
129123
} else {
130-
if (agent_state == EARLY_IN_THE_ANNEAL || !placer_opts.place_agent_multistate)
124+
if (agent_state == e_agent_state::EARLY_IN_THE_ANNEAL || !placer_opts.place_agent_multistate)
131125
current_move_generator = std::move(move_generator);
132126
else
133127
current_move_generator = std::move(move_generator2);
@@ -146,7 +140,7 @@ void update_move_generator(std::unique_ptr<MoveGenerator>& move_generator,
146140
else
147141
move_generator = std::move(current_move_generator);
148142
} else {
149-
if (agent_state == EARLY_IN_THE_ANNEAL || !placer_opts.place_agent_multistate)
143+
if (agent_state == e_agent_state::EARLY_IN_THE_ANNEAL || !placer_opts.place_agent_multistate)
150144
move_generator = std::move(current_move_generator);
151145
else
152146
move_generator2 = std::move(current_move_generator);

vpr/src/place/RL_agent_util.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#ifndef RL_AGENT_UTIL_H
22
#define RL_AGENT_UTIL_H
33

4-
#include "static_move_generator.h"
5-
#include "simpleRL_move_generator.h"
6-
#include "manual_move_generator.h"
4+
#include "move_generator.h"
5+
76

87
//enum represents the available agent states
9-
enum e_agent_state {
8+
enum class e_agent_state {
109
EARLY_IN_THE_ANNEAL,
1110
LATE_IN_THE_ANNEAL
1211
};

vpr/src/place/place.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ void try_place(const Netlist<>& net_list,
981981
#endif /* ENABLE_ANALYTIC_PLACE */
982982

983983
//RL agent state definition
984-
e_agent_state agent_state = EARLY_IN_THE_ANNEAL;
984+
e_agent_state agent_state = e_agent_state::EARLY_IN_THE_ANNEAL;
985985

986986
std::unique_ptr<MoveGenerator> current_move_generator;
987987

@@ -1011,7 +1011,7 @@ void try_place(const Netlist<>& net_list,
10111011
//see if we should save the current placement solution as a checkpoint
10121012

10131013
if (placer_opts.place_checkpointing
1014-
&& agent_state == LATE_IN_THE_ANNEAL) {
1014+
&& agent_state == e_agent_state::LATE_IN_THE_ANNEAL) {
10151015
save_placement_checkpoint_if_needed(placement_checkpoint,
10161016
timing_info, costs, critical_path.delay());
10171017
}
@@ -1045,9 +1045,9 @@ void try_place(const Netlist<>& net_list,
10451045

10461046
if (placer_opts.place_algorithm.is_timing_driven()
10471047
&& placer_opts.place_agent_multistate
1048-
&& agent_state == EARLY_IN_THE_ANNEAL) {
1048+
&& agent_state == e_agent_state::EARLY_IN_THE_ANNEAL) {
10491049
if (state.alpha < 0.85 && state.alpha > 0.6) {
1050-
agent_state = LATE_IN_THE_ANNEAL;
1050+
agent_state = e_agent_state::LATE_IN_THE_ANNEAL;
10511051
VTR_LOG("Agent's 2nd state: \n");
10521052
}
10531053
}

0 commit comments

Comments
 (0)