-
Notifications
You must be signed in to change notification settings - Fork 415
vpr: Add fix_clusters option to allow users to lock down any block to… #1433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
96ccbb8
8e29f41
4af32fa
40a8d08
8f11883
877adb2
5822076
15ffd79
9f0515f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -503,8 +503,10 @@ static void SetupPlacerOpts(const t_options& Options, t_placer_opts* PlacerOpts) | |
|
||
PlacerOpts->place_algorithm = Options.PlaceAlgorithm; | ||
|
||
PlacerOpts->constraints_file = Options.constraints_file; | ||
PlacerOpts->pad_loc_file = Options.pad_loc_file; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove pad_loc_file |
||
PlacerOpts->pad_loc_type = Options.pad_loc_type; | ||
PlacerOpts->block_loc_type = Options.block_loc_type; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. block_loc_type isn't a great name; not obvious it goes with the constraints file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the best thing is to delete block_loc_type entirely and use a NULL constraints file name to mean no constraints. Comment it when you do the test for a NULL constraints file (means none specified). |
||
|
||
PlacerOpts->place_chan_width = Options.PlaceChanWidth; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -509,13 +509,22 @@ static void ShowPlacerOpts(const t_placer_opts& PlacerOpts, | |
case RANDOM: | ||
VTR_LOG("RANDOM\n"); | ||
break; | ||
case USER: | ||
VTR_LOG("USER '%s'\n", PlacerOpts.pad_loc_file.c_str()); | ||
break; | ||
default: | ||
VPR_FATAL_ERROR(VPR_ERROR_UNKNOWN, "Unknown I/O pad location type\n"); | ||
} | ||
|
||
VTR_LOG("PlacerOpts.block_loc_type: "); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make more user friendly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At the same time, put a blank line before the first placer option (or after last packer option). Other groups have a blank line between them; placer and packer should too. |
||
switch (PlacerOpts.block_loc_type) { | ||
case NOT_LOCKED: | ||
VTR_LOG("NOT_LOCKED\n"); | ||
break; | ||
case LOCKED: | ||
VTR_LOG("LOCKED '%s'\n", PlacerOpts.constraints_file.c_str()); | ||
break; | ||
default: | ||
VPR_FATAL_ERROR(VPR_ERROR_UNKNOWN, "Unknown block location type\n"); | ||
} | ||
|
||
VTR_LOG("PlacerOpts.place_cost_exp: %f\n", PlacerOpts.place_cost_exp); | ||
|
||
VTR_LOG("PlacerOpts.place_chan_width: %d\n", PlacerOpts.place_chan_width); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1568,13 +1568,19 @@ argparse::ArgumentParser create_arg_parser(std::string prog_name, t_options& arg | |
|
||
place_grp.add_argument(args.pad_loc_file, "--fix_pins") | ||
.help( | ||
"Fixes I/O pad locations during placement. Valid options:\n" | ||
"Fixes I/O pad locations randomly during placement. Valid options:\n" | ||
" * 'free' allows placement to optimize pad locations\n" | ||
" * 'random' fixes pad locations to arbitraray locations\n" | ||
" * path to a file specifying pad locations (.place format with only pads specified).") | ||
" * 'random' fixes pad locations to arbitrary locations\n.") | ||
.default_value("free") | ||
.show_in(argparse::ShowIn::HELP_ONLY); | ||
|
||
place_grp.add_argument(args.constraints_file, "--fix_clusters") | ||
.help( | ||
"Fixes block locations during placement. Valid options:\n" | ||
" * path to a file specifying block locations (.place format with block locations specified).") | ||
.default_value("not_locked") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update this to just have a filename, default is empty string (no constraint file). |
||
.show_in(argparse::ShowIn::HELP_ONLY); | ||
|
||
place_grp.add_argument<e_place_algorithm, ParsePlaceAlgorithm>(args.PlaceAlgorithm, "--place_algorithm") | ||
.help("Controls which placement algorithm is used") | ||
.default_value("path_timing_driven") | ||
|
@@ -2201,7 +2207,7 @@ void set_conditional_defaults(t_options& args) { | |
args.anneal_sched_type.set(AUTO_SCHED, Provenance::INFERRED); | ||
} | ||
|
||
//Are the pad locations specified? | ||
//Are the pads free to be moved during placement or randomly locked to certain locations? | ||
if (std::string(args.pad_loc_file) == "free") { | ||
args.pad_loc_type.set(FREE, Provenance::INFERRED); | ||
|
||
|
@@ -2211,8 +2217,15 @@ void set_conditional_defaults(t_options& args) { | |
|
||
args.pad_loc_file.set("", Provenance::SPECIFIED); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pad_loc_file should be removed. |
||
} else { | ||
args.pad_loc_type.set(USER, Provenance::INFERRED); | ||
VTR_ASSERT(!args.pad_loc_file.value().empty()); | ||
VPR_FATAL_ERROR(VPR_ERROR_UNKNOWN, "Unknown I/O pad location type\n"); | ||
} | ||
|
||
//Are the blocks locked to locations given by a constraints file? | ||
if (std::string(args.constraints_file) == "not_locked") { | ||
args.block_loc_type.set(NOT_LOCKED, Provenance::INFERRED); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove, and use constraints_file variable instead. |
||
} else { | ||
args.block_loc_type.set(LOCKED, Provenance::INFERRED); | ||
VTR_ASSERT(!args.constraints_file.value().empty()); | ||
} | ||
|
||
/* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ struct t_options { | |
argparse::ArgValue<e_circuit_format> circuit_format; | ||
|
||
argparse::ArgValue<std::string> out_file_prefix; | ||
argparse::ArgValue<std::string> constraints_file; | ||
argparse::ArgValue<std::string> pad_loc_file; | ||
argparse::ArgValue<std::string> write_rr_graph_file; | ||
argparse::ArgValue<std::string> read_rr_graph_file; | ||
|
@@ -100,6 +101,7 @@ struct t_options { | |
argparse::ArgValue<sched_type> anneal_sched_type; | ||
argparse::ArgValue<e_place_algorithm> PlaceAlgorithm; | ||
argparse::ArgValue<e_pad_loc_type> pad_loc_type; | ||
argparse::ArgValue<e_block_loc_type> block_loc_type; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. delete |
||
argparse::ArgValue<int> PlaceChanWidth; | ||
argparse::ArgValue<float> place_rlim_escape_fraction; | ||
argparse::ArgValue<std::string> place_move_stats_file; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,8 +139,8 @@ void read_place(const char* net_file, | |
place_ctx.placement_id = vtr::secure_digest_file(place_file); | ||
} | ||
|
||
///@brief Reads in the locations of the IO pads from a file. | ||
void read_user_pad_loc(const char* pad_loc_file) { | ||
void read_user_block_loc(const char* constraints_file) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This takes a comment out of doxygen. See https://www.doxygen.nl/manual/docblocks.html for how doxygen works. Should put the comment before the function, using ///@brief so doxygen finds it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should expand this comment. Comment should include: |
||
/* Reads in the locations of the blocks from a file. */ | ||
t_hash **hash_table, *h_ptr; | ||
int xtmp, ytmp; | ||
FILE* fp; | ||
|
@@ -152,11 +152,11 @@ void read_user_pad_loc(const char* pad_loc_file) { | |
auto& place_ctx = g_vpr_ctx.mutable_placement(); | ||
|
||
VTR_LOG("\n"); | ||
VTR_LOG("Reading locations of IO pads from '%s'.\n", pad_loc_file); | ||
fp = fopen(pad_loc_file, "r"); | ||
VTR_LOG("Reading locations of blocks from '%s'.\n", constraints_file); | ||
fp = fopen(constraints_file, "r"); | ||
if (!fp) VPR_FATAL_ERROR(VPR_ERROR_PLACE_F, | ||
"'%s' - Cannot find IO pads location file.\n", | ||
pad_loc_file); | ||
"'%s' - Cannot find block locations file.\n", | ||
constraints_file); | ||
|
||
hash_table = alloc_hash_table(); | ||
for (auto blk_id : cluster_ctx.clb_nlist.blocks()) { | ||
|
@@ -189,41 +189,41 @@ void read_user_pad_loc(const char* pad_loc_file) { | |
if (strlen(ptr) + 1 < vtr::bufsize) { | ||
strcpy(bname, ptr); | ||
} else { | ||
vpr_throw(VPR_ERROR_PLACE_F, pad_loc_file, vtr::get_file_line_number_of_last_opened_file(), | ||
vpr_throw(VPR_ERROR_PLACE_F, constraints_file, vtr::get_file_line_number_of_last_opened_file(), | ||
"Block name exceeded buffer size of %zu characters", vtr::bufsize); | ||
} | ||
|
||
ptr = vtr::strtok(nullptr, TOKENS, fp, buf); | ||
if (ptr == nullptr) { | ||
vpr_throw(VPR_ERROR_PLACE_F, pad_loc_file, vtr::get_file_line_number_of_last_opened_file(), | ||
vpr_throw(VPR_ERROR_PLACE_F, constraints_file, vtr::get_file_line_number_of_last_opened_file(), | ||
"Incomplete.\n"); | ||
} | ||
sscanf(ptr, "%d", &xtmp); | ||
|
||
ptr = vtr::strtok(nullptr, TOKENS, fp, buf); | ||
if (ptr == nullptr) { | ||
vpr_throw(VPR_ERROR_PLACE_F, pad_loc_file, vtr::get_file_line_number_of_last_opened_file(), | ||
vpr_throw(VPR_ERROR_PLACE_F, constraints_file, vtr::get_file_line_number_of_last_opened_file(), | ||
"Incomplete.\n"); | ||
} | ||
sscanf(ptr, "%d", &ytmp); | ||
|
||
ptr = vtr::strtok(nullptr, TOKENS, fp, buf); | ||
if (ptr == nullptr) { | ||
vpr_throw(VPR_ERROR_PLACE_F, pad_loc_file, vtr::get_file_line_number_of_last_opened_file(), | ||
vpr_throw(VPR_ERROR_PLACE_F, constraints_file, vtr::get_file_line_number_of_last_opened_file(), | ||
"Incomplete.\n"); | ||
} | ||
int k; | ||
sscanf(ptr, "%d", &k); | ||
|
||
ptr = vtr::strtok(nullptr, TOKENS, fp, buf); | ||
if (ptr != nullptr) { | ||
vpr_throw(VPR_ERROR_PLACE_F, pad_loc_file, vtr::get_file_line_number_of_last_opened_file(), | ||
vpr_throw(VPR_ERROR_PLACE_F, constraints_file, vtr::get_file_line_number_of_last_opened_file(), | ||
"Extra characters at end of line.\n"); | ||
} | ||
|
||
h_ptr = get_hash_entry(hash_table, bname); | ||
if (h_ptr == nullptr) { | ||
VTR_LOG_WARN("[Line %d] Block %s invalid, no such IO pad.\n", | ||
VTR_LOG_WARN("[Line %d] Block %s invalid, no such block.\n", | ||
vtr::get_file_line_number_of_last_opened_file(), bname); | ||
ptr = vtr::fgets(buf, vtr::bufsize, fp); | ||
continue; | ||
|
@@ -233,12 +233,12 @@ void read_user_pad_loc(const char* pad_loc_file) { | |
int j = ytmp; | ||
|
||
if (place_ctx.block_locs[bnum].loc.x != OPEN) { | ||
VPR_THROW(VPR_ERROR_PLACE_F, pad_loc_file, vtr::get_file_line_number_of_last_opened_file(), | ||
"Block %s is listed twice in pad file.\n", bname); | ||
VPR_THROW(VPR_ERROR_PLACE_F, constraints_file, vtr::get_file_line_number_of_last_opened_file(), | ||
"Block %s is listed twice in constraints file.\n", bname); | ||
} | ||
|
||
if (i < 0 || i > int(device_ctx.grid.width() - 1) || j < 0 || j > int(device_ctx.grid.height() - 1)) { | ||
VPR_THROW(VPR_ERROR_PLACE_F, pad_loc_file, 0, | ||
VPR_THROW(VPR_ERROR_PLACE_F, constraints_file, 0, | ||
"Block #%zu (%s) location, (%d,%d) is out of range.\n", size_t(bnum), bname, i, j); | ||
} | ||
|
||
|
@@ -250,13 +250,13 @@ void read_user_pad_loc(const char* pad_loc_file) { | |
auto physical_tile = device_ctx.grid[i][j].type; | ||
auto logical_block = cluster_ctx.clb_nlist.block_type(bnum); | ||
if (!is_sub_tile_compatible(physical_tile, logical_block, place_ctx.block_locs[bnum].loc.sub_tile)) { | ||
VPR_THROW(VPR_ERROR_PLACE_F, pad_loc_file, 0, | ||
VPR_THROW(VPR_ERROR_PLACE_F, constraints_file, 0, | ||
"Attempt to place block %s at illegal location (%d, %d).\n", bname, i, j); | ||
} | ||
|
||
if (k >= physical_tile->capacity || k < 0) { | ||
VPR_THROW(VPR_ERROR_PLACE_F, pad_loc_file, vtr::get_file_line_number_of_last_opened_file(), | ||
"Block %s subblock number (%d) is out of range.\n", bname, k); | ||
VPR_THROW(VPR_ERROR_PLACE_F, constraints_file, vtr::get_file_line_number_of_last_opened_file(), | ||
"Block %s subtile number (%d) is out of range.\n", bname, k); | ||
} | ||
place_ctx.grid_blocks[i][j].blocks[k] = bnum; | ||
place_ctx.grid_blocks[i][j].usage++; | ||
|
@@ -273,14 +273,14 @@ void read_user_pad_loc(const char* pad_loc_file) { | |
} | ||
|
||
if (place_ctx.block_locs[blk_id].loc.x == OPEN) { | ||
VPR_THROW(VPR_ERROR_PLACE_F, pad_loc_file, 0, | ||
"IO block %s location was not specified in the pad file.\n", cluster_ctx.clb_nlist.block_name(blk_id).c_str()); | ||
VPR_THROW(VPR_ERROR_PLACE_F, constraints_file, 0, | ||
"Block %s location was not specified in the constraints file.\n", cluster_ctx.clb_nlist.block_name(blk_id).c_str()); | ||
} | ||
} | ||
|
||
fclose(fp); | ||
free_hash_table(hash_table); | ||
VTR_LOG("Successfully read %s.\n", pad_loc_file); | ||
VTR_LOG("Successfully read %s.\n", constraints_file); | ||
VTR_LOG("\n"); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -504,16 +504,21 @@ enum pfreq { | |
}; | ||
|
||
/** | ||
* @brief Are the pads free to be moved, locked in a random configuration, or | ||
* locked in user-specified positions? | ||
* @brief Are the pads free to be moved or locked in a random configuration? | ||
*/ | ||
enum e_pad_loc_type { | ||
FREE, | ||
RANDOM, | ||
USER | ||
RANDOM | ||
}; | ||
|
||
/*Are the blocks not locked (free to be moved) or locked in user-specified positions?*/ | ||
enum e_block_loc_type { | ||
NOT_LOCKED, | ||
LOCKED | ||
}; | ||
|
||
///@brief Power data for t_netlist structure | ||
|
||
struct t_net_power { | ||
///@brief Signal probability - long term probability that signal is logic-high | ||
float probability; | ||
|
@@ -816,8 +821,10 @@ struct t_annealing_sched { | |
* place_chan_width: The channel width assumed if only one placement is * | ||
* performed. * | ||
* pad_loc_type: Are pins FREE, fixed randomly, or fixed from a file. * | ||
* pad_loc_file: File to read pin locations form if pad_loc_type * | ||
* is USER. * | ||
* block_loc_type: Are blocks fixed from a file. * | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove. |
||
* constraints_file: File to read block locations from if block_loc_type * | ||
* is LOCKED. * | ||
* pad_loc_file: File to read pad locations from if pad_loc_type is USER. * | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove pad_loc_file |
||
* place_freq: Should the placement be skipped, done once, or done for each * | ||
* channel width in the binary search. * | ||
* recompute_crit_iter: how many temperature stages pass before we recompute * | ||
|
@@ -870,6 +877,8 @@ struct t_placer_opts { | |
float place_cost_exp; | ||
int place_chan_width; | ||
enum e_pad_loc_type pad_loc_type; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove block_loc_type |
||
enum e_block_loc_type block_loc_type; | ||
std::string constraints_file; | ||
std::string pad_loc_file; | ||
enum pfreq place_freq; | ||
int recompute_crit_iter; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -392,9 +392,9 @@ static t_physical_tile_type_ptr pick_placement_type(t_logical_block_type_ptr log | |
return nullptr; | ||
} | ||
|
||
void initial_placement(enum e_pad_loc_type pad_loc_type, | ||
const char* pad_loc_file) { | ||
void initial_placement(enum e_pad_loc_type pad_loc_type, enum e_block_loc_type block_loc_type, const char* constraints_file) { | ||
vtr::ScopedStartFinishTimer timer("Initial Placement"); | ||
|
||
/* Randomly places the blocks to create an initial placement. We rely on | ||
* the legal_pos array already being loaded. That legal_pos[itype] is an | ||
* array that gives every legal value of (x,y,z) that can accommodate a block. | ||
|
@@ -445,8 +445,9 @@ void initial_placement(enum e_pad_loc_type pad_loc_type, | |
place_ctx.block_locs[blk_id].loc = t_pl_loc(); | ||
} | ||
|
||
if (pad_loc_type == USER) { | ||
read_user_pad_loc(pad_loc_file); | ||
/*If the user specified block locations using a constraints file, read those locations in here*/ | ||
if (block_loc_type == LOCKED) { | ||
read_user_block_loc(constraints_file); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change to just call read_user_block_loc (can have it return if constraints_file is NULL or an empty string). Or could check before calling it with this if (). |
||
} | ||
|
||
initial_placement_pl_macros(MAX_NUM_TRIES_TO_PLACE_MACROS_RANDOMLY, free_locations); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
|
||
#include "vpr_types.h" | ||
|
||
void initial_placement(enum e_pad_loc_type pad_loc_type, | ||
const char* pad_loc_file); | ||
void initial_placement(enum e_pad_loc_type pad_loc_type, enum e_block_loc_type block_loc_type, const char* constraints_file); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove block_loc_type |
||
|
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
################################################### | ||
# Architecture Files | ||
################################################### | ||
|
||
This directory contains architecture files that are used in regression testing. | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to remove random option.