Skip to content

[WIP] Use compressed grid locations in windowed bimatching detailed placer - #3742

Open
AthavanBalakumar wants to merge 1 commit into
verilog-to-routing:masterfrom
AthavanBalakumar:windowed_bi_matching_dp
Open

[WIP] Use compressed grid locations in windowed bimatching detailed placer#3742
AthavanBalakumar wants to merge 1 commit into
verilog-to-routing:masterfrom
AthavanBalakumar:windowed_bi_matching_dp

Conversation

@AthavanBalakumar

Copy link
Copy Markdown
Contributor

Updating windowed bipartite matching detailed placer to generate candidate moves using VTR's compressed block grids instead of fixed physical-grid neighbor locations.

The placer now searches compatible locations in compressed-grid space based on each block's logical type. Currently the scope is conservative, skips placement macro members, restricts occupied swaps to blocks of the same logical type, allows moves into empty compatible locations, and keeps floorplan legality checks.

This is a step towards heterogeneous architecture support.

@github-actions github-actions Bot added VPR VPR FPGA Placement & Routing Tool lang-cpp C/C++ code labels Aug 4, 2026
@AthavanBalakumar

Copy link
Copy Markdown
Contributor Author

Compared the compressed-grid windowed detailed placer against --ap_detailed_placer none on a hetero test (using k6_frac_N10_frac_chain_mem32K_40nm.xml). Routed wirelength improved on the three tested circuits, min channel width improved on or1200 and sha but worsened on ch_intrinsics.

Circuit None routed_wirelength Windowed routed_wirelength New/old ratio routed_wirelength None min_chan_width Windowed min_chan_width New/old ratio min_chan_width
ch_intrinsics.v 1954 1780 0.910952 32 34 1.062500
or1200.v 41221 39957 0.969336 82 80 0.975610
sha.v 13450 12135 0.902230 82 78 0.951220

@AlexandreSinger AlexandreSinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some comments below. You should take some time to think about where you want to go with this algorithm. We seem to have the infrastructure we need now to get a good understanding of what is possible.

// Currently: only handle 1x1 physical tiles
if (physical_type->width != 1 || physical_type->height != 1) {
return false;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why have this limitation? Currently the Flagship architecture's DSP and RAM blocks are not 1x1. Should probably add a TODO to relax this or else you may never optimize those blocks.

return true;
}
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a very expensive way to check for this information. I think a lookup from blocks to placement macros may already exist. You should either use that, or make one if it does not exist (that you can store locally in your class).

Basically you just want a lookup between a ClusterBlockId -> MacroId / Idx

You can populate the lookup at the start of your detailed placer and use it throughout.

The reason I am worried is that this lookup is linear with the number of macros, and the number of macros is linear with the number of clusters. This makes this lookup O(n); and I think you call this for each cluster in the design, making your overall algorithm potentially O(n^2).

blk_loc_registry.commit_move_blocks(blocks_affected);
blocks_affected.clear_move_blocks();
return true;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As I mentioned in person; I recommend sometimes allowing the cost to be bad. At least at the start of your windowed algorithm, you can allow some bad swaps in an attempt to make them better later (so you would reduce this as you iterate).

// block may have moved, so update its current location.
current_loc = blk_loc_registry.block_locs()[block_id].loc;
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This algorithm is now a bit backwards from our original goals. I recall you wanted to sweep windows across the device and do local optimal moves of blocks to improve quality. This appears to go through each block and create the windows from around them. I am not necessarily against this idea, but I do recommend taking a step back and thinking about where you want to go with this algorithm.

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

Labels

lang-cpp C/C++ code VPR VPR FPGA Placement & Routing Tool

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants