-
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
Conversation
… an x, y, subtile location
Question for @sfkhalid and @vaughnbetz. Is this the same or different from #1189? |
Yes, it's the same. I forgot that one got merged, but Sarah found the functionality works (which makes sense, since Keith added it). She's breaking up the options: |
…ters option have the option to provide a constraints file
Sarah, there appear to be conflicts -- can you check and resolve? |
Hi Vaughn, when I check this pull request it says that there are no conflicts with the base branch, are you seeing a different message? Also, I'll be sure to commit the code with the USER option completely removed tonight. |
Looks like it can't be rebased, but it can be directly merged (which would only affect the commit history, making it a bit harder to interpret, which is OK for a straightforward change like this). I see this message: This branch cannot be rebased due to conflicts but if I switch to creating a merge commit it is OK. |
…t functionality of fix_clusters option
…or the fix_clusters reg test but was previously ignored
…ionality has been replaced in the code by fix_clusters
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.
- Make changes listed here, do PR.
- Also take a look at how the blocks are locked down (in initial_place.cpp). Is it clean? If not, could lock them down when reading the constraints_file. If can be cleaned up, do another PR for that.
- It looks like the placement file and constraint file reading could be refactored to have one common routine. Check if that would be cleaner, and if so do a 3rd PR.
- would have to refactor read_place to call a couple of subfunctions: read_place_header and read_place_body
- constraints file would also call read_place_body
- read_place_body should get the error checking from read_constraints_file (stronger checker, assumes user could have typed random stuff)
- parser from read_place_body looks nicer --> probably build off it.
- Check that the cluster_netlist.find_block(block_name) is fast (should be using a map or hash table (unordered_map). read_place_constraints is using my hand-written hash table, which isn't as good (doesn't resize for big circuits).
- Depending on what you did in ODIN II: Instantiating more than one module with dual_port_ram inside fails #2, you might also have to pass in a flag saying whether you are reading as a constraint (set block.locked flag) or a placement file (don't set).
- Test using a placement file and a constraint file together. What happens? Current code looks like it will error in odd ways unless the overall control code avoids parsing the constraint file in that case (which would be fine).
@@ -302,6 +303,13 @@ int main( | |||
" or a file specifying the pad locations.") | |||
.default_value("off") | |||
.show_in(argparse::ShowIn::HELP_ONLY); | |||
place_grp.add_argument(args.fix_clusters, "--fix_clusters") | |||
.help("Fixes block locations during placement." | |||
" Can be 'random' for a random initial assignment," |
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.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Remove pad_loc_file
PlacerOpts->pad_loc_file = Options.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 comment
The 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.
But probably better still to simply have a NULL or empty constraints_file name mean no location constraints.
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.
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).
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Make more user friendly.
should just be PlacerOpts.constraint_file: fname
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.
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.
.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 comment
The 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).
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
remove.
* block_loc_type: Are blocks fixed from a file. * | ||
* 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 comment
The reason will be displayed to describe this comment to others. Learn more.
remove pad_loc_file
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
remove block_loc_type
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 comment
The 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 ().
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
remove block_loc_type
… an x, y, subtile location
VPR had the option fix_pins to allow users to fix I/O pads to certain locations. The fix_clusters option was added to allow them to fix any block (I/O or otherwise) to an x, y, subtile location. It has the same arguments that fix_pins has - free, random, and user. Using the user argument entails providing a .pads file, just like fix_pins.
Description
Added fix_clusters in the place group options in the read_options.cpp and argparse_test.cpp files.
Related Issue
The related issue is: Add Placement Constraints to VPR #932
#932
How Has This Been Tested?
The fix_clusters option was tested with running vpr with an architecture file that has clbs with a block capacity of greater than one. The vtr_reg_basic and vtr_reg_strong tests were also run.
Types of changes
Checklist: