Running ResNet-50 on FPGA with Gemmini SoC
We have successfully built a DNN system using the DNN accelerator Gemmini and the RISC-V CPU Rocket on a Digilent FPGA board and run ResNet-50.
Click here for related articles.
- Running Test Programs on Gemmini Simulators
- Running ResNet-50 on FPGA with Gemmini SoC (this article)
Gemmini
Gemmini is one of the RTL generators included in Chipyard, an agile RISC-V SoC design framework, and can generate a systolic array based DNN accelerator.
You can build a DNN hardware platform by combining RISC-V CPU Rocket or BOOM with Gemmini, as described in the README.md in the Gemmini repository below.
The Gemmini project is developing a full-system, full-stack DNN hardware exploration and evaluation platform.
Gemmini SoC for Nexys Video
We have created an SoC that combines a Gemmini and a Rocket for the Digilent FPGA board, a Nexys Video.
The figure below quoted from the Gemmini repository gives an overview of the Gemmini SoC.
The cycle accurate simulator using Verilator introduced in the previous article is difficult to execute such as ResNet-50 with many cycles, but it can be executed on the FPGA board.
Running Test Programs on FPGA
We loaded the SoC gateware on the FPGA board and ran ResNet-50 and MobileNet included in the test program gemmini-rocc-tests.
ResNet-50
The following shows the console output when running resnet50-linux
.
# ./resnet50-linux ... Prediction: 75 (score: 45) Prediction: 900 (score: 43) Prediction: 641 (score: 40) Prediction: 897 (score: 57) Total cycles: 1358733049 (100%) Matmul cycles: 508263409 (37%) Im2col cycles: 0 (0%) Conv cycles: 818013564 (60%) Pooling cycles: 0 (0%) Depthwise convolution cycles: 0 (0%) Res add cycles: 32258198 (2%) Other cycles: 197878 (0%) PASS
MobileNet
The following shows the console output when running mobilenet-linux
.
# ./mobilenet-linux ... Prediction: 75 (score: 127) Prediction: 900 (score: 127) Prediction: 125 (score: 103) Prediction: 897 (score: 98) Total cycles: 1045338662 (100%) Matmul cycles: 89629901 (8%) Im2col cycles: 0 (0%) Conv cycles: 7498801 (0%) Pooling cycles: 0 (0%) Depthwise convolution cycles: 943204581 (90%) Res add cycles: 1936088 (0%) Other cycles: 3069291 (0%) PASS
Summary
We have successfully built a DNN system using Gemmini and Rocket on Digilent’s Nexys Video and run ResNet-50 and MobileNet included in the test program gemmini-rocc-tests
.