Skip to content

Conversation

@pnewlin-amd
Copy link

@pnewlin-amd pnewlin-amd commented Jan 5, 2026

A series of QoL features and additions to the partitioner branch.

  • Added hierarchical mapping output (mapping.txt), if an entire submodule TOP/Counter is wholly contained in partition 1 (FPGA_B) then produce only one line TOP/Counter FPGA_B
  • Added optional human readable hypergraph reports. After a partition a user can easily see which nets have been cut and their names.
  • Added a dedicated LUT report .txt file output which shows how many LUTs have been assigned per partition.
  • Exposed KaHyPar hypergraph switches to command line interface
  • Added partition constraints, this allows the user to specify a mapping constraint which KaHyPar will interpret as a .fix input for assigning some submodule to exactly one partition.
  • Changed partition naming to be FPGA_<...>.
  • Added a cells.txt output which displays every partition name.
  • Added command line interface option to specify output location of partition.
  • Relocated the LUT counting functionality to a single location (source of truth)
  • Added verbose logging to partition process to display caught edge cases and memory usage.
  • Enabled KaHyPar verbose timing output.
  • Added partition support for .DCP input.
  • Added read netlist command line interface tool. Allows user to test memory usage on monolithic netlists.
  • Added LUT count command line interface tool. Allows user to provide a netlist and RapidWright will return total LUT count of top level.

…partition report, human readable hypergraph reports

Signed-off-by: Perry Newlin <perry.newlin@amd.com>
@pnewlin-amd pnewlin-amd changed the title Partitioner Feature Additions: Mapping generation, net-span repor, LUTs/partition report, verbose hypergraph reports Partitioner Feature Additions: Mapping generation, net-span partition report, LUTs/partition report, verbose hypergraph reports, LUTCount CLI, mapping constraint partition input Jan 5, 2026
Copy link
Member

@clavin-xlnx clavin-xlnx left a comment

Choose a reason for hiding this comment

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

First round of feedback, please reach out with questions. I didn't make comments on every occurrence, but hopefully you'll be able to apply the patterns across all the changes.

Thanks for the PR!

/**
* Memory audit utility for reading netlists.
*/
public class ReadNetlist {
Copy link
Member

Choose a reason for hiding this comment

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

This class seems to duplicate functionality in the CodePerfTracker class. This class is employed when loading a DCP and, when set with the right options, can produce a similar report. When calling Design.readCheckpoint() there are overload options to provide a custom configured CodePerfTracker instance. Have a look to see if that would meet your needs.

I'm thinking that having something like a DesignAnalyzer that can provide an array of analysis options while simply loading a design would be useful, but I'm not sure this is the right PR for it.

* - counts: aggregated counts over this node’s subtree (leafCounts + all children)
* lets us easily decide if wholly contained or not
*/
private static final class Node {
Copy link
Member

Choose a reason for hiding this comment

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

Node is an overloaded term. Perhaps we could refactor to something more unique such as HierNode, or something similar.

/**
* CLI utility to count logic LUT usage from EDIF (.edf/.edif) or Vivado DCP (.dcp).
*/
public final class LUTCount {
Copy link
Member

Choose a reason for hiding this comment

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

I think the functionality of this class should be absorbed into a DesignAnalyzer class. See my comment on ReadNetlist.java.

Files.createDirectories(parent);
}
Files.write(out, lines, StandardCharsets.UTF_8);
} catch (IOException e) { // more guards the better.
Copy link
Member

Choose a reason for hiding this comment

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

Not sure what you mean by this comment?

* @param partitions A map of partition IDs to sets of instance names.
* @param instLutCountMap A map of instance LUT counts (unused but kept for API consistency).
*/
public static void write(Path outDir
Copy link
Member

Choose a reason for hiding this comment

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

This method is confusingly named as the Javadoc says it writes the mapping file, but there is a method just above it that is called writeMappingFile().

Comment on lines +125 to +127



Copy link
Member

Choose a reason for hiding this comment

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

Remove extra whitespace.



// ============================================================================
// ARGUMENT PARSING & INITIALIZATION
Copy link
Member

Choose a reason for hiding this comment

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

It seems like main() is broken up into various tasks, but they are all in the same method (its over 700 lines long). This should be broken up into separate methods.

int backfillAttempts = 0;
int backfillSuccess = 0;
int backfillSkipped = 0;
java.util.Map<com.xilinx.rapidwright.edif.EDIFCell, java.lang.Integer> lutCountCache;
Copy link
Member

Choose a reason for hiding this comment

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

Please avoid fully qualified references and instead just import the class at the top of the file.

@@ -0,0 +1,62 @@
/*
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if this functionality needs its own class. Perhaps refactor to make it a bit more generic and put it in StringTools?

String partitionLabelB = pairKey.substring(separatorIndex + 1);
int pairCount = pairCounts.get(pairKey);

//format will be "FPGA_A--count--FPGA_B".
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
//format will be "FPGA_A--count--FPGA_B".
// format will be "FPGA_A--count--FPGA_B".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants