Skip to content

Chain pack pattern assertion fix #1591

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

Merged
merged 1 commit into from
Nov 12, 2020

Conversation

mkurc-ant
Copy link
Collaborator

This PR moves an assertion related to chain pack-patterns elsewhere to allow for pb_type modes that break a chain.

Description

Whenever there is a chain pack-pattern that passes through a pb_type with a mode in which chain-related pins are unconnected VPR raises an assertion. This happens at the pre-packing stage (the circuit doesn't matter). I've attached an example arch.xml file to allow reproduction of the issue.

In the attached example arch.xml there is a top-level pb_type PB-CLB that has two modes: LUT4 and LUT4_CARRY. The former hosts the LUT4 BLIF model (a classic LUT4) while the latter hosts a LUT that also has carry input and output pins for adder implementation LUT4_CARRY.

The assertion is throws specifically when the interconnect of the LUT4 mode includes the carry-chain pin connections to the underlying pb_type where they are actually unconnected. The assertion says:

vpr/src/pack/prepack.cpp:1606 get_all_connected_primitive_pins: Assertion 'connected_primitive_pins.size()' failed.

which is kind of misleading.

By digging into the code I've realized that this assertion is placed incorrectly as it is being triggered when no connected pin is found within a specific mode which does not necessary mean that the pin is not connected in other modes.

My proposal in this PR is to move the assertion right after the recursive check done in get_all_connected_primitive_pins to allow for such situations. This way the assertion will get triggered only if a carry pin is completely disconnected (in all modes).

Related Issue

None

Motivation and Context

I'm using the V2X tool (https://github.com/SymbiFlow/python-symbiflow-v2x) to generate pb_type XMLs. The tool automatically generate interconnects for modes regardless whether all pins are connected inside a mode.

I found that the issue can be worked around by simply removing the unconnected pin connections from a mode interconnect. However, I'd like the architecture specification to be more flexible as having such unconnected pins is not an error as the carry chain isn't really broken. Its just requires a specific mode to be selected to complete it. This is the reason for this PR.

How Has This Been Tested?

I wrote a test arch.xml file that is attached below to demonstrate the issue. The upstream VPR (i.e. from master) fails with it while the one with the fix from this PR completes successfully.
arch.xml.tar.gz

The issue can be reproduced by running packing of any circuit with this architecture. The fail occurs at the prepacking stage and is not related to the circuit itself but rather to the arch.

Types of changes

  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

I'm not sure yet how to include the test with the attached arch.xml into the VTR flow but I can do that if it is requested.

@github-actions github-actions bot added the VPR VPR FPGA Placement & Routing Tool label Nov 9, 2020
@mithro
Copy link
Contributor

mithro commented Nov 10, 2020

@mkurc-ant - Could you post some pictures of what you are describing?

@mkurc-ant
Copy link
Collaborator Author

@mithro This is a schematic of the PB-CLB complex block from the attached arch.xml. It has two modes of operation:
VPR carry assert

In the LUT_CARRY mode the carry chain goes through the primitive. In the LUT mode it does not but the CI and CO connections go all the way through the mode interconnect to the LUT4_WRAPPER pb_type where they are unconnected. That specific case triggers the assertion.

@@ -1548,6 +1548,7 @@ static void update_chain_root_pins(t_pack_patterns* chain_pattern,
for (const auto pin_ptr : chain_input_pins) {
std::vector<t_pb_graph_pin*> connected_primitive_pins;
get_all_connected_primitive_pins(pin_ptr, connected_primitive_pins);
VTR_ASSERT(connected_primitive_pins.size());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest a comment here on the assert. I think the assert is checking that some primitive pin in some mode connects to the cluster level chain input pin.

@vaughnbetz
Copy link
Contributor

Thanks for the detailed description and the code looks fine. I suggest adding a comment on what the assert is checking though, as this PR shows this is a pretty subtle test.

@vaughnbetz vaughnbetz merged commit 4fc4b4c into verilog-to-routing:master Nov 12, 2020
@vaughnbetz
Copy link
Contributor

Merged this since CI is green, but I think a comment is still a good idea.

@mkurc-ant
Copy link
Collaborator Author

@vaughnbetz I'm sorry that I haven't added the comment yet. I'm currently on a short holiday leave. I'll add it one I'm back

@vaughnbetz
Copy link
Contributor

No worries and have a good holiday!

@mkurc-ant mkurc-ant mentioned this pull request Nov 18, 2020
7 tasks
vaughnbetz added a commit that referenced this pull request Nov 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VPR VPR FPGA Placement & Routing Tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants