Skip to content
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

[Packer] Load The ClusteredNetlist Directly From The ClusterLegalizer #2731

Open
AlexandreSinger opened this issue Sep 20, 2024 · 0 comments
Labels
VPR VPR FPGA Placement & Routing Tool

Comments

@AlexandreSinger
Copy link
Contributor

The current behaviour of the Packer is as follows:

  1. It performs prepacking on the atoms to create pack molecules (using the Prepacker)
  2. It uses these molecules to create LegalizationClusters (using the ClusterLegalizer)
  3. It writes these LegalizationClusters to a .net file (using output clustering)
    //check clustering and output it
    check_and_output_clustering(cluster_legalizer, *packer_opts, is_clock, arch);
  4. It then destroys all of the LegalizationClusters
  5. Then it reads back in this .net file to generate the ClusteredNetlist (using load packing)
    //TODO: to be consistent with placement/routing vpr_pack should really
    // load the netlist data structures itself, instead of re-loading
    // the netlist from the .net file
    //Load the result from the .net file
    vpr_load_packing(vpr_setup, arch);

This is very inefficient since a lot of the information from the clustering state is being regenerated again, which wastes a lot of time. It also means that a .net file MUST be made to run VPR, even though it is not necessary.

Instead, the ClusterLegalizer could have a method to convert all of its LegalizationClusters into a valid ClusteredNetlist. The write_packing_results_to_xml method could then be used to write the ClusteredNetlist directly to a file (instead of generating it from the LegalizationClusters), if the .net file is needed.

/********************************************************************
* A useful API to output packing results to a XML file
* This function is a wrapper for the function output_clustering()
* but remove all the requirements on input data structures that
* have to be built with other APIs
*
* As such, this function is expected to be a standard API
* which can be called anytime and anywhere after packing is finished.
********************************************************************/
void write_packing_results_to_xml(const bool& global_clocks,
const std::string& architecture_id,
const char* out_fname) {
std::unordered_set<AtomNetId> is_clock = alloc_and_load_is_clock();
// Since the cluster legalizer is not being used to output the clustering
// (from_legalizer is false), passing in nullptr.
output_clustering(nullptr,
global_clocks,
is_clock,
architecture_id,
out_fname,
false, /*skip_clustering*/
false /*from_legalizer*/);
}

This should be a straightforward change, but the biggest thing is making sure that the ClusteredNetlist generated from the ClusterLegalizer EXACTLY matches the ClusteredNetlist generated from reading a .net file. A unit test should be added which compares these two ClusteredNetlists and ensures they exactly match.

@AlexandreSinger AlexandreSinger added the VPR VPR FPGA Placement & Routing Tool label Sep 20, 2024
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

No branches or pull requests

1 participant