ucb-bar / gemmini-rocc-tests

Fork of seldridge/rocket-rocc-examples with tests for a systolic array based matmul accelerator
Other
52 stars 40 forks source link

Fix matmul_cpu to use mvin_acc_scale #11

Closed abejgonzalez closed 3 years ago

abejgonzalez commented 3 years ago

This fixes a bug where you couldn't check=true on MobileNet and ResNet-50 due to the CPU matmul differing from the Gemmini implementation. This PR also gets rid of extra whitespace at EOL's in gemmini.h.

Matches with the following names that come from the gemmini_params.h file:

https://github.com/ucb-bar/gemmini/blob/4907ba3a291dac3085f840a117e4bfd248bae8a2/src/main/scala/gemmini/GemminiConfigs.scala#L282-L290

https://github.com/ucb-bar/gemmini/blob/4907ba3a291dac3085f840a117e4bfd248bae8a2/src/main/scala/gemmini/GemminiConfigs.scala#L341-L346

abejgonzalez commented 3 years ago

On a side note, to speed up "checking" results. I think there should be two different ways to do the "check against CPU":

  1. Check during simulation with RISC-V CPU (i.e. this is the same as the current check=true functionality)
  2. Check outside of simulation with other (x86) CPU (i.e. have some uniform way to dump the matmul inputs/outputs at each step... then have a C/C++ program read that output and run matmul_cpu on the x86 machine)

I think that (2) should be faster in some cases because doing matmul_cpu in simulation can be really costly. The problem with this approach would be 1. having to dump the matmuls at each step and 2. not being able to stop immediately when an error is found.

hngenc commented 3 years ago

Thanks for this PR, @abejgonzalez. I agree that option 2 would be pretty helpful.

Before merging this PR, I'll create a new PR in gemmini which bumps to this branch, because that's the only way to run CI on it. Your changes are highly unlikely to break anything, but we're trying to be more disciplined about CI and PR-merges.

hngenc commented 3 years ago

Subsumed into #14.

The ideas about checking against the CPU are good; I'm intending to get around to them after some more urgent tasks are completed.