Skip to content

[AP][Legalizer] Added Ability to Generate a Mass Report #3095

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

AlexandreSinger
Copy link
Contributor

While working on the mass abstraction in the partial legalizer of the globlal placer, found that I needed a lot more information on the device to be able to debug the mass calculations.

Added a command-line option which will generate a mass report if requested. This mass report contains useful information on the device, the netlist, and the mass / capacities computed in the mass calculator.

Example reports:

Notably, I added the ability to print the complex block graph; which is extremely useful for debugging the mass calculator:

image

@AlexandreSinger AlexandreSinger requested a review from amin1377 May 29, 2025 22:26
@github-actions github-actions bot added VPR VPR FPGA Placement & Routing Tool docs Documentation lang-cpp C/C++ code labels May 29, 2025
@AlexandreSinger
Copy link
Contributor Author

@amin1377 I am not sure how much use you will get out of this report, but I think it wouldn't hurt! Can you please review when you have a moment?

@AlexandreSinger AlexandreSinger force-pushed the feature-ap-mass-report branch from d651165 to 4f8e10f Compare May 29, 2025 22:34
While working on the mass abstraction in the partial legalizer of the
globlal placer, found that I needed a lot more information on the device
to be able to debug the mass calculations.

Added a command-line option which will generate a mass report if
requested. This mass report contains useful information on the device,
the netlist, and the mass / capacities computed in the mass calculator.
@AlexandreSinger AlexandreSinger force-pushed the feature-ap-mass-report branch from 4f8e10f to 39ad2b7 Compare May 29, 2025 22:34
Copy link
Contributor

@amin1377 amin1377 left a comment

Choose a reason for hiding this comment

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

Thanks, Alex! As we discussed before, I really liked the idea of generating this report. I’ve added a bunch of small comments.

The most important one is that generating this report; at least the parts based solely on the architecture file shouldn’t be made AP-specific. For the other parts (like generating the mass report), it would probably be more challenging, since that would require adding the capability to calculate mass for the placed atom netlist, which is likely beyond the scope of this PR.

@@ -1336,6 +1336,15 @@ Analytical Placement is generally split into three stages:

**Default:** ``1``

.. option:: --ap_generate_mass_report {on | off}
Copy link
Contributor

Choose a reason for hiding this comment

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

I looked at the report and noticed that there is no AP-specific section in it. So, I think it might be better to change the name of the option to avoid implying that it's AP-specific, and instead treat it as one of the general options for generating a report.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The mass calculation is AP specific, the report cannot be generated outside of the AP flow. The drawing of the complex graph is useful for understanding the mass report, hence why it is part of this report.

I do not want to gate this PR on this, but in a future PR I can move this to an external report which reports on the structure of the architecture file. I think that is beyond the scope of this PR and would include more features. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. Let's do it in another PR.

@@ -657,6 +657,7 @@ static void ShowAnalyticalPlacerOpts(const t_ap_opts& APOpts) {

VTR_LOG("AnalyticalPlacerOpts.ap_timing_tradeoff: %f\n", APOpts.ap_timing_tradeoff);
VTR_LOG("AnalyticalPlacerOpts.log_verbosity: %d\n", APOpts.log_verbosity);
VTR_LOG("AnalyticalPlacerOpts.generate_mass_report: %s\n", APOpts.generate_mass_report ? "true" : "false");
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure what the convention is for displaying parameter values in the vpr.out report. I think it would be better to avoid printing all parameter values and instead only include those that are necessary for analyzing the results. If you agree, I suggest we omit the value of the generate_mass_report parameter (or any similar parameter that simply controls whether a report should be generated).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think thats a fair point. I am actually not sure the convention, but I have just been adding all options that the user would pass in. This provides feedback that their input was observed.

#include "vtr_time.h"
#include "vtr_vector.h"

namespace {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just out of curiosity: I think the main reason for using an anonymous namespace here is because of the structs. But if the structs weren't present, is there any real difference between using static functions and defining functions in an anonymous namespace?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There should be no difference between labelling functions as static or putting them into the anonymous namespace. Generally I prefer using the static keyword, but if an anonymous namespace already exists I like to put them in there.

* @param prefix
* The prefix that all children of this node will print before their names.
*/
void print_tree_node(const PrintingTreeNode& node,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure whether it's a common convention or not, but in other parts of VTR, the "recur" suffix is added to the names of recursive functions.

@AlexandreSinger AlexandreSinger merged commit d2585f8 into verilog-to-routing:master May 30, 2025
32 checks passed
@AlexandreSinger AlexandreSinger deleted the feature-ap-mass-report branch May 30, 2025 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation lang-cpp C/C++ code VPR VPR FPGA Placement & Routing Tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants