Skip to content
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

nexus: LUT and FF clustering #863

Merged
merged 5 commits into from
Nov 24, 2021
Merged

nexus: LUT and FF clustering #863

merged 5 commits into from
Nov 24, 2021

Conversation

mkurc-ant
Copy link
Contributor

This PR adds to the nexus architecture inference of directly connected LUT+FF pairs followed by clustering them together.

For each directly connected LUT and FF nextpnr now creates a new cluster. Moreover it glues FFs to existing clusters comprised of LUTs like wide LUTs and carry-chains.

The new behavior is enabled by default but can be disabled by the --no-pack-lutff option. Another option --carry-lutff-ratio allows to specify a ratio of clustering together FFs and LUTs which are part of carry-chains.

The added clustering approach has been analyzed on a single design (the SoC from https://chromium.googlesource.com/chromiumos/platform/hps-firmware) targeting LIFCL-17 FPGA using 500 chosen seeds. A timeout of 5min was set for each run so that when it expired a run was considered a failure. The conclusions are the following:

  • median runtime was reduced to ~78% of the original,
  • 99% of the runs succeeded instead of 88.2% for without clustering,
  • 16.0% runs met timing instead of 0.6% for without clustering,
  • median router iteration count dropped to 67 from 103.

The following two charts show router2 progression in terms of overused wire count vs. iteration count. Each trace is terminated either with a green circle (indicating a success) or a red "x" (indicating a failure). Plots are clipped to 200 iterations for better clarity.

No clustering:
no-clustering

With clustering:
with-clustering

I'm also attaching CSV files with the gathered statistical results:
no-clustering.csv
with-clustering.csv

As it can be seen in the pictures with the LUT and FF clustering enabled the router is able to converge much quicker and gets stuck more rarely.

The option to specify clustering ratio for FFs and existing carry-chain clusters is meant to mitigate situations when placement of such large clusters of fully populated slices cannot be legalized.

…rameter controlling the ratio of FFs that got glued to carry-chain clusters.

Signed-off-by: Maciej Kurc <[email protected]>
ff->constr_y = lut->constr_y;
ff->constr_z = lut->constr_z + 2;
ff->constr_abs_z = lut->constr_abs_z;
root->constr_children.push_back(ff);
Copy link
Member

Choose a reason for hiding this comment

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

this case also needs to be checking that the FF can legally be added to the cluster (i.e. CLK/LSR/CE sharing etc)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, you are right. I missed that... I'll push a fix soon.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright, should be fixed by now.

@mkurc-ant mkurc-ant requested a review from gatecat November 23, 2021 15:17
@gatecat
Copy link
Member

gatecat commented Nov 24, 2021

Thanks!

@gatecat gatecat merged commit fd2d4a8 into YosysHQ:master Nov 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants