Skip to content

Add tileable RR Graph #3134

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

Open
wants to merge 56 commits into
base: master
Choose a base branch
from
Open

Add tileable RR Graph #3134

wants to merge 56 commits into from

Conversation

amin1377
Copy link
Contributor

@amin1377 amin1377 commented Jun 11, 2025

Merging OpenFPGA branch into master branch. PR #2135 explains features of OpenFPGA.

@github-actions github-actions bot added VPR VPR FPGA Placement & Routing Tool libarchfpga Library for handling FPGA Architecture descriptions docs Documentation lang-cpp C/C++ code libvtrutil labels Jun 11, 2025
@amin1377
Copy link
Contributor Author

Hi @AlexandreSinger,

I think the PR is ready for your first round of review. I'd appreciate it if you could take a look. Thanks!

@amin1377 amin1377 requested a review from AlexandreSinger June 19, 2025 22:36
@amin1377
Copy link
Contributor Author

Hi @soheilshahrouz,

This PR is ready for your review. Since you're familiar with the RR Graph code, it would be great if you could take a look at the tileable RR Graph implementation.

@amin1377 amin1377 requested a review from soheilshahrouz June 19, 2025 22:37
Copy link
Contributor

@AlexandreSinger AlexandreSinger left a comment

Choose a reason for hiding this comment

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

Hi @amin1377 thanks for bringing this in! I recognize not all of this is your code. Overall the code is well structured however it needs some code style and data structure cleanup so it can fit in better with the rest of the VTR flow.

Some. of the data structure changes can be made into issues; however, the coding style things should probably be fixed now.


.. note:: These options are required

In the OpenFPGA architecture file, you may define additional attributes for each VPR's direct connection:
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we destinguishing OpenFPGA architecture files from regular architecture files?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Based on the meeting we had before, I guess the conclusion was to not support all OpenFPGA features in the standard RR Graph generation (at least for now). As a result, I’m creating a separate section to clearly outline the additional features that are exclusively supported by the tileable RR Graph.

@@ -0,0 +1,254 @@
.. _VIB:

VIB Architecture
Copy link
Contributor

Choose a reason for hiding this comment

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

What does VIB. I think this file also needs some context. Why is it here? Who should be using this architecture?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I moved it under the Tileable Architecture section. The vib.rst file explains what VIB is. In short, VIB combines the connection block (CB), switch block (SB), and intra-block crossbar into a single block. As a result, each tile consists of two sub-blocks: the functional block and the VIB (Versatile Interconnect Block). This design facilitates switch architecture exploration and ideally improves router flexibility.

@amin1377
Copy link
Contributor Author

QoR comparison:
Titan: Link
Large VTR: Link

@amin1377
Copy link
Contributor Author

Thanks @AlexandreSinger; reviewing this amount of code is no small task, and I really appreciate your time. I've addressed your comments. Regarding your suggestions about replacing the vector of vectors with VTR data structures: while I agree with them in principle, I didn’t apply all of them since this part of the code is not performance-critical.

I think the code is now ready for the next round of reviews. I’ve also added @AmirhosseinPoolad to help with it.

Copy link
Contributor

@soheilshahrouz soheilshahrouz left a comment

Choose a reason for hiding this comment

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

Thanks for this PR.
Since it's a large one, I’ve reviewed some files for now and will go through the rest soon.

@@ -2336,8 +2387,13 @@ struct t_arch {
//If the layout is not specified in the command line options, this variable will be set to "auto"
std::string device_layout;

std::vector<t_vib_grid_def> vib_grid_layouts;
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a doxygen comment for this with ///

@@ -700,6 +700,10 @@ void ProcessMemoryClass(t_pb_type* mem_pb_type) {
mem_pb_type->model_id = LogicalModelId::INVALID();

mem_pb_type->modes[0].num_interconnect = mem_pb_type->num_ports * num_pb;

std::stringstream ss;
Copy link
Contributor

Choose a reason for hiding this comment

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

give a meaningful name to ss

std::string err_msg = (std::stringstream() << "Memory pb_type " << mem_pb_type->name << " has no interconnect").str();
VTR_ASSERT_MSG(mem_pb_type->modes[0].num_interconnect > 0, msg.c_str());

@@ -13,8 +13,11 @@
* @param segment_inf Unified list of all segments.
* @param seg_index_map Map from unified to axis-specific segment indices.
* @param parallel_axis Axis to filter segments by.
* @param keep_original_index Whether to keep the original index of the segment. Currently,
* it is only set to true when building the tileable rr_graph.
Copy link
Contributor

Choose a reason for hiding this comment

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

All @param descriptions before this are aligned. It's probably a good idea to keep them aligned

@@ -2,14 +2,17 @@

std::vector<t_segment_inf> get_parallel_segs(const std::vector<t_segment_inf>& segment_inf,
t_unified_to_parallel_seg_index& seg_index_map,
enum e_parallel_axis parallel_axis) {
enum e_parallel_axis parallel_axis,
bool keep_original_index) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Might not be a bad idea to add a comment in front of keep_original_index to mention its default value

`bool keep_original_index/=false/

std::vector<t_segment_inf> result;
for (size_t i = 0; i < segment_inf.size(); ++i) {
if (segment_inf[i].parallel_axis == parallel_axis || segment_inf[i].parallel_axis == BOTH_AXIS) {
result.push_back(segment_inf[i]);
result[result.size() - 1].seg_index = i;
if (!keep_original_index) {
result[result.size() - 1].seg_index = i;
Copy link
Contributor

Choose a reason for hiding this comment

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

result.back() is more readable

short node_bend_start(RRNodeId id) const {
return node_bend_start_[id];
}
short node_bend_end(RRNodeId id) const {
Copy link
Contributor

Choose a reason for hiding this comment

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

add empty line

@@ -804,6 +844,9 @@ int t_rr_graph_view::node_track_num(RRNodeId id) const {
int t_rr_graph_view::node_class_num(RRNodeId id) const {
return get_node_class_num(node_storage_, node_ptc_, id);
}
int t_rr_graph_view::node_mux_num(RRNodeId id) const {
Copy link
Contributor

Choose a reason for hiding this comment

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

empty line

vtr::array_view_id<RRNodeId, const t_rr_node_data> node_storage,
vtr::array_view_id<RRNodeId, const t_rr_node_ptc_data> node_ptc,
RRNodeId id) {
auto node_type = node_storage[id].type_;
Copy link
Contributor

Choose a reason for hiding this comment

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

auto

@@ -571,6 +574,11 @@ t_edge_size t_rr_graph_storage::num_non_configurable_edges(RRNodeId node, const
return num_edges(node) - num_configurable_edges(node, rr_switches);
}

bool t_rr_graph_storage::edge_is_configurable(RREdgeId edge, const vtr::vector<RRSwitchId, t_rr_switch_inf>& rr_switches) const {
auto iswitch = edge_switch(edge);
Copy link
Contributor

Choose a reason for hiding this comment

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

auto

const pugiutil::loc_data& loc_data);

static void process_bend(pugi::xml_node Node, std::vector<int>& list, std::vector<int>& part_len, bool& is_bend, const int len, const pugiutil::loc_data& loc_data);

Copy link
Contributor

Choose a reason for hiding this comment

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

This file is already too large
I think these functions should be moved to a new source file

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 libarchfpga Library for handling FPGA Architecture descriptions libvtrutil VPR VPR FPGA Placement & Routing Tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants