-
Notifications
You must be signed in to change notification settings - Fork 415
[VTR][Util] Added Prefix Sum Class #2914
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
[VTR][Util] Added Prefix Sum Class #2914
Conversation
@vaughnbetz I needed to use a Prefix Sum in the new Partial Legalizer I am working on. Instead of writing a custom one for my use-case, I made a general class which can be found in the vtr_util library. I found that a Prefix Sum was already being used for 3D connections, I think written by @amin1377; so I wrapped that into this class. All tests are passing. Please review when you have a moment. |
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.
Nice change! A couple of thoughts embedded.
I believe also use 1D prefix sums in the placer in case you want to also pull those out. See
void NetCostHandler::alloc_and_load_chan_w_factors_for_place_cost_() { |
6752031
to
bea6a90
Compare
@vaughnbetz Thank you for your feedback on this! I did not realize that those were 1D Prefix Sums; I have created a class for PrefixSum1D and have converted them into using this class. I found that the original code was a little confusing with how it handled 0 channel widths, so I rewrote it slightly to make this more obvious. This does not change the functionality at all, just makes it more explicit that we assume the channel widths are at least 1. |
A prefix sum is a classic data structure for quickly finding the sum of any sub-region of fixed N-Dimensional array of values. It pre-computes the partial sums of regions within an array and uses that information later to save time. This is currently used in the net_cost_handler to pre-compute number of inter-die connections. This class can be useful in other algorithms. For example, in a Partial Legalizer in an AP flow, it can allow for quick lookups into the capacity and utilization of regions on the FPGA. Moved the Prefix Sum class from the net_cost_handler into the VTR Util.
bea6a90
to
2fd0bdc
Compare
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.
Thanks, LGTM!
Cool! Ill merge when it passes CI. |
A prefix sum is a classic data structure for quickly finding the sum of any sub-region of fixed N-Dimensional array of values. It pre-computes the partial sums of regions within an array and uses that information later to save time.
This is currently used in the net_cost_handler to pre-compute number of inter-die connections.
This class can be useful in other algorithms. For example, in a Partial Legalizer in an AP flow, it can allow for quick lookups into the capacity and utilization of regions on the FPGA.
Moved the Prefix Sum class from the net_cost_handler into the VTR Util.