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

Add example accelerator using HLS #2056

Merged
merged 9 commits into from
Sep 30, 2024
Merged

Add example accelerator using HLS #2056

merged 9 commits into from
Sep 30, 2024

Conversation

schwarz-em
Copy link
Contributor

@schwarz-em schwarz-em commented Sep 18, 2024

Related PRs / Issues:

Type of change:

  • Bug fix
  • New feature
  • Other enhancement

Impact:

  • RTL change
  • Software change (RISC-V software)
  • Build system change
  • Other

.github/workflows/chipyard-run-tests.yml Outdated Show resolved Hide resolved
the Great Common Denominator (GCD) of two integers. This tutorial
builds on the sections :ref:`mmio-accelerators` and
:ref:`incorporating-verilog-blocks`. The code for this example can
be found in ``/generators/hls-example``
Copy link
Contributor

Choose a reason for hiding this comment

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

I would use gh-file-ref to have it auto-generate a link:

This :gh-file-ref:`scripts/firesim-setup.sh` script initializes additional submodules and then invokes FireSim's ``build-setup.sh`` script with the ``--library`` to properly initialize FireSim as a library submodule in Chipyard.

Adding an HLS project
---------------------------------------

In this tutorial, we use Vitis HLS, version 2023.2.
Copy link
Contributor

Choose a reason for hiding this comment

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

The CI is using an older version of the tool FYI.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also maybe I would point to some docs/link to Vitis HLS. Isn't there restrictions on where this can be used (and if so, should we mention something about that here)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I looked closer on the product site and the documentation but I couldn't find any restrictions on where Vitis HLS can be used. Possibly it's in the license somewhere, but I don't really want to crawl through that... Some forum comments implied that Vitis HLS has been used in commercial tapeouts, so if there are rules they don't seem to be very strict. We should be able to just leave it up to the user to know what they're doing.

Comment on lines 28 to 29
.. code-block:: none
vitis_hls run_hls.tcl
Copy link
Contributor

Choose a reason for hiding this comment

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

All code block directives need an empty space before the main text of the block.

Comment on lines 34 to 35
In our case, we include a ``Makefile`` to script running HLS. To generate the
verilog files using the Makefile, run:
Copy link
Contributor

Choose a reason for hiding this comment

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

Below you mention this also does the "move files to vsrc" step. So maybe I would add some extra saying "to script running HLS (as well as copying files around as explained later)"

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we change the naming to something like CanHavePeripheryHLSGCD. Ditto for the config. fragment name.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you also mention the TODO of how to connect up to an AXI interface.

@@ -0,0 +1,8 @@
open_project -reset proj_gcd_example
add_files accel/HLSAccel.cpp
Copy link
Contributor

Choose a reason for hiding this comment

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

HPP is missing?

add_files accel/HLSAccel.cpp
set_top HLSAccelBlackBox
open_solution -reset "solution1"
set_part {xcvu9p-flgb2104-2-i}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need a part number? This is FPGA specific so maybe the docs should mention this RTL that is made is specific to an FPGA (with part number listed here) but can be run in RTL sim.

set_top HLSAccelBlackBox
open_solution -reset "solution1"
set_part {xcvu9p-flgb2104-2-i}
create_clock -period 10
Copy link
Contributor

Choose a reason for hiding this comment

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

I see that both the FPGA part number and the clock period should probably configurable from the makefile and piped to the Chisel.

@abejgonzalez
Copy link
Contributor

Super super cool! Thanks Ella!

Copy link
Contributor

@abejgonzalez abejgonzalez left a comment

Choose a reason for hiding this comment

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

Also, I think it might be good to combine this into the existing GCD example area instead of separate SBT project s.t. people can either create a GCD with 1. Chisel 2. SV 3. SV from HLS

build.sbt Outdated
@@ -263,6 +263,11 @@ lazy val rocc_acc_utils = (project in file("generators/rocc-acc-utils"))
.settings(libraryDependencies ++= rocketLibDeps.value)
.settings(commonSettings)

lazy val hls_accel = (project in file("generators/hls-example"))
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should go in generators/chipyard/example, instead of its own project

Copy link
Contributor

@abejgonzalez abejgonzalez left a comment

Choose a reason for hiding this comment

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

Small nits otherwise LGTM

generators/chipyard/src/main/scala/example/GCD.scala Outdated Show resolved Hide resolved
generators/chipyard/src/main/scala/example/GCD.scala Outdated Show resolved Hide resolved
Copy link
Contributor

@abejgonzalez abejgonzalez left a comment

Choose a reason for hiding this comment

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

LGTM pending CI

@jerryz123 jerryz123 merged commit 66d10ad into main Sep 30, 2024
67 checks passed
@jerryz123 jerryz123 deleted the hls-example branch September 30, 2024 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants