Skip to content

Refactor init place for floorplanning #1817

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

Merged
merged 15 commits into from
Aug 31, 2021

Conversation

sfkhalid
Copy link
Contributor

@sfkhalid sfkhalid commented Aug 3, 2021

Description

During initial placement, the blocks are sorted according to how difficult they are to place according to three criteria - whether they are part of a macro, the floorplan constraints they have, and the number of equivalent tiles they have. Based on these criteria, the blocks are placed in order from most difficult to place to least difficult to place.

In this pull request, the sorting of the blocks was made more robust in the following ways:

  1. The exact number of compatible grid tiles covered by each floorplan region is calculated so that the blocks constrained to regions with less tiles can be placed first.

  2. The macros are also placed in a sorted order based on the three criteria above. Previously, they were just sorted by the number of equivalent tiles.

Related Issue

Part of adding floorplan placement constraints to VPR #932

Motivation and Context

In some cases, the placer would get stuck during initial placement, because the blocks that had tight floorplan constraints would be impossible to place when all of their valid locations had already been taken up by previous blocks.

sfkhalid added 3 commits July 31, 2021 15:51
…re also placed in order of most to least difficult, like other non-macro blocks. Also, called sorting blocks functions after propogating place constraints, so that the accurate floorplan regions are used for macros
@github-actions github-actions bot added the VPR VPR FPGA Placement & Routing Tool label Aug 3, 2021
…l block score so that blocks with tighter constraints get placed first
// Sorting blocks to place to have most constricted ones to be placed first
std::vector<t_pl_macro> sorted_pl_macros(pl_macros.begin(), pl_macros.end());

auto criteria = [block_scores](const t_pl_macro lhs, t_pl_macro rhs) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be refactored to place blocks & macros in one loop, with the sorted_blocks vector controlling it all.

… in grids for each logical block type, to be used when calculating region size
…btile_size function to ensure accurate grid tile counting in the subtile and non subtile case. Functions tested to ensure correctness
@sfkhalid
Copy link
Contributor Author

QoR Results Comparison between this branch and the master branch:
init_place_qor_comparison.xlsx

Overall, the total runtime, place time, and pack time do not show any significant differences between this branch and the master branch.

However, there are slight differences noticeable in the total wirelength and critical path delay for three circuits: LU8PEEng.v, LU32PEEng.v, and mcml.v. The rest of the circuits show no difference in wirelength or critical path delay.

The difference in wirelength and critical path delay in the above-mentioned 3 circuits comes from the fact that macros are placed in a different order during initial placement. On this branch, code was added that sorted macros from biggest (most blocks) to smallest (least blocks) and placed them in that order during initial placement. The 3 circuits are the only circuits to have macros of different sizes, which is why they are the only ones showing differences in wirelength and critical path delay.

@vaughnbetz
Copy link
Contributor

QoR looks good. Small changes make sense and are not a problem.

To be thorough you should do a titan quick qor comparison too.

@sfkhalid
Copy link
Contributor Author

Titan_quick_qor comparison:
init_place_titan_comparison.xlsx
No significant differences between run times, critical path delay, etc.

@sfkhalid
Copy link
Contributor Author

@vaughnbetz Does this PR look ok to merge? I added the results comparison from titan_quick_qor runs as well, and those results look okay.

@sfkhalid
Copy link
Contributor Author

New qor comparison after code changes:
init_place_qor_comparison_2.xlsx
There was no significant change in total runtime, place time, pack time, or critical path delay.

@vaughnbetz
Copy link
Contributor

The changes look good; I just have one suggestion for improved commenting of the data members in your new class, and perhaps a name change for a member variable. You can make that change after we merge if CI finishes soon and you want to get this in, but I'd like the data structure comments added in any case.

@sfkhalid
Copy link
Contributor Author

sfkhalid commented Aug 27, 2021

The changes look good; I just have one suggestion for improved commenting of the data members in your new class, and perhaps a name change for a member variable. You can make that change after we merge if CI finishes soon and you want to get this in, but I'd like the data structure comments added in any case.

The 3rd nightly test seemed to be stuck on pending so I added the comments to the GridTileLookup class and pushed to the PR again.

@vaughnbetz
Copy link
Contributor

Looks good; will merge when CI is green.

@sfkhalid
Copy link
Contributor Author

@vaughnbetz The 3rd nightly test had one qor failure - vtr_reg_qor_chain_predictor_off. This test has failed a couple of times on this branch, it has passed some times as well. I remember you said that it was a noisy test and we could update the golden results for it. Would it be ok to merge this branch and update the golden results on another PR?

@vaughnbetz
Copy link
Contributor

It's OK to update the golden results for that test. I'd update them here (in this PR) if possible though so others don't hit spurious QoR failures once this change goes in.

@sfkhalid
Copy link
Contributor Author

It's OK to update the golden results for that test. I'd update them here (in this PR) if possible though so others don't hit spurious QoR failures once this change goes in.

Makes sense, I'll update it here.

@sfkhalid
Copy link
Contributor Author

@vaughnbetz I think this can be merged now - I updated the golden results for vtr_reg_qor_chain_predictor_off. All the tests have passed except for the Yosys+Odin ones.

@vaughnbetz vaughnbetz merged commit eea0df0 into master Aug 31, 2021
@vaughnbetz vaughnbetz deleted the refactor_init_place_for_floorplanning branch August 31, 2021 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VPR VPR FPGA Placement & Routing Tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants