-
Notifications
You must be signed in to change notification settings - Fork 414
FPGA interchange: add RR graph generation #1999
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
base: master
Are you sure you want to change the base?
FPGA interchange: add RR graph generation #1999
Conversation
995f575
to
ed6bbd6
Compare
ed6bbd6
to
e686856
Compare
Signed-off-by: Maciej Dudek <[email protected]>
Signed-off-by: Maciej Dudek <[email protected]>
Signed-off-by: Maciej Dudek <[email protected]>
Code refactor Signed-off-by: Maciej Dudek <[email protected]>
Small improvements to RR graph generation Signed-off-by: Maciej Dudek <[email protected]>
Signed-off-by: Maciej Dudek <[email protected]>
…on step Combine node forest to single tree Signed-off-by: Maciej Dudek <[email protected]>
Update to new mainline Signed-off-by: Maciej Dudek <[email protected]>
Signed-off-by: Maciej Dudek <[email protected]>
…208f3 54f6208f3 Merge pull request SymbiFlow#69 from antmicro/mdudel/fix_annotations d8a0567a5 Fix annotations in DeviceResources git-subtree-dir: libs/EXTERNAL/libinterchange git-subtree-split: 54f6208f32e20b746863da6ea54e3051fc9a830e
Signed-off-by: Maciej Dudek <[email protected]>
Signed-off-by: Maciej Dudek <[email protected]>
Signed-off-by: Alessandro Comodi <[email protected]>
Signed-off-by: Alessandro Comodi <[email protected]>
Signed-off-by: Alessandro Comodi <[email protected]>
Signed-off-by: Maciej Dudek <[email protected]>
Also fixes RR Graph generation with alternative site types Signed-off-by: Maciej Dudek <[email protected]>
Signed-off-by: Alessandro Comodi <[email protected]>
e686856
to
f2ae4e5
Compare
@vaughnbetz I have fixed formatting, as the PR was red, and everything is passing at the moment. I believe it is ready for an initial review |
Adding @amin1377 and @tangxifan as this will be a big one for me to review on my own. |
@vaughnbetz No problem. Will do by the end of next week. |
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.
@acomodi Some more comments.
- In the rr_graph build-up, I cannot find any codes to build the edges. If there is, can you point me to it? If no, should we address it in later PR?
- I also do not find any code to validate the rr_graph once it is finished. Can you double check?
vtr-verilog-to-routing/libs/librrgraph/src/base/rr_graph_view.h
Lines 457 to 465 in b7a94b9
public: /* Validators */ | |
/** brief Validate that edge data is partitioned correctly | |
* @note This function is used to validate the correctness of the routing resource graph in terms | |
* of graph attributes. Strongly recommend to call it when you finish the building a routing resource | |
* graph. If you need more advance checks, which are related to architecture features, you should | |
* consider to use the check_rr_graph() function or build your own check_rr_graph() function. */ | |
inline bool validate_node(RRNodeId node_id) const { | |
return node_storage_.validate_node(node_id, rr_switch_inf_); | |
} |
|
||
auto timing_data = ar_.getPipTimings(); | ||
arch_->num_switches = seen.size() + 2; |
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.
Would you mind to add comments to explain the magic number 2? It looks to me about the hidden switches added by VPR. But not sure about it.
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.
This +2 is to store MUX and SHORT switch types. arch_->Switches
is filled out in process_switches_array
function, where SHORT is give id 0 and MUX is given id 1, and rest is used for architecture switches.
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.
I'll add comment in code explaining this.
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. That will help developers a lot!
@@ -2295,10 +2235,10 @@ struct ArchReader { | |||
grid_def.loc_defs.emplace_back(std::move(single)); | |||
} | |||
|
|||
// The constant source tile will be placed at (0, 0) | |||
// The constant source tile will be placed at (1, max_height) |
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.
It makes sense to have a fixed layout when using FPGA interchange file format.
Should we comment more about the regulation? Or find a way to document this?
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.
In line 2194 fixed grid size is forced, so there is no option to select auto size for FPGA,
but there is no comment about it. Maybe I could add information about this restriction in VPR help for fpga_interchange option? What is your opinion about this?
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.
Yes. Because this is a restriction, we should have necessary code comments to alert developers.
@@ -258,6 +168,29 @@ static t_pin_to_pin_annotation get_pack_pattern(std::string pp_name, std::string | |||
return pp; | |||
} | |||
|
|||
static void add_segment_with_default_values(t_segment_inf& seg, std::string name) { |
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.
I guess the default values are consistent with this function
vtr-verilog-to-routing/libs/libarchfpga/src/read_xml_arch_file.cpp
Lines 3524 to 3530 in b7a94b9
static void ProcessSegments(pugi::xml_node Parent, | |
std::vector<t_segment_inf>& Segs, | |
const t_arch_switch_inf* Switches, | |
const int NumSwitches, | |
const bool timing_enabled, | |
const bool switchblocklist_required, | |
const pugiutil::loc_data& loc_data) { |
Should we consider to deposit these value when creating the object?
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.
I've looked at this function, and fpga_interchange defaults are different to ones set in xml reader.
So I'm not positive moving default value into object constructor is good idea.
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.
O.K. Not a problem to me.
} | ||
} | ||
|
||
void fill_switch(t_arch_switch_inf* switch_, |
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.
I see you use template here to be compatible with t_switch_inf
and t_rr_switch_inf
. Maybe it is better to note in code comments for developers.
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.
I'll add comment that process_switches_array()
is template function.
void finish_rr_generation() { | ||
for (t_rr_type rr_type : RR_TYPES) | ||
if (rr_type == CHANX) | ||
device_ctx_.rr_graph_builder.node_lookup().resize_nodes(grid_.height(), grid_.width(), rr_type, NUM_SIDES); |
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.
I cannot find any node registered to the node_lookup()
.
This may cause router failed due to the needs on node_lookup().find_node()
.
Can you double check?
Some example:
rr_graph_builder.node_lookup().add_node(inode, chan, start, type, track); |
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.
As far as I know function finish_rr_generation()
is responsible for building node_lookup when running loop in lines 1771 to 1774. Calling add_mode_to_all_locs(node)
should be enough to register node
in lookup.
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.
Got it. Sorry for missing the details.
Signed-off-by: Maciej Dudek <[email protected]>
@tangxifan RR graph correctness is checked by running |
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.
@mtdudek Changes look good to me. Just need some code comments to be added.
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.
Is there a spot I can look for the overall comment (big one) on how the architecture interchange format works with vtr, and for pointers to the arch interchange format documentation? I don't see any such large scale comment in this PR -- is it already in the code somewhere else? If so, please point me at it, and if not, please add such a comment.
I suspect that some more high-level commenting on the overall arch interchange interface (what is getting built when) is needed, along with pointers to bel, pip etc. definitions and how they are used in the architecture interchange format. But maybe those are already in the code base and I just am not familiar with where to look.
|
||
device_ctx_.rr_graph_builder.init_fan_in(); | ||
|
||
// Creates a temporary copy to convert from vtr::vector to sitd::vector. |
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.
typo:
std::vector
Should also file an issue to track changing alloc_and_load_rr_indexed_data to a vtr::vector
int* wire_to_rr_ipin_switch, | ||
std::string& read_rr_graph_filename, | ||
bool do_check_rr_graph); | ||
|
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.
Add comment saying we need to hash tuples (and why) and that the following utility functions achieve that.
VCC, | ||
}; | ||
|
||
enum node_sides { |
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.
Comment what these are used for. Side of a block that an rr_node is on? Or something else?
@@ -1480,7 +1480,9 @@ argparse::ArgumentParser create_arg_parser(std::string prog_name, t_options& arg | |||
.help( | |||
"File format for the input atom-level circuit/netlist.\n" |
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.
This comment looks wrong -- it's not the atom-level circuit/netlist but the arch file we're talking about here.
Description
This PR adds the RR graph generation, built from the RR interchange data.
The code present in the PR does mainly the following things:
Being the Interchange nodes and PIPs information different from the VTR RR graph data model, an intermediate step is required to read and preprocess the interchange data to be suitable for building the RR graph in VTR.
Motivation and Context
One of the missing steps in VTR to enable the Interchange format is to add the RR graph generation.
Types of changes
Checklist: