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

fix CRITICAL overflow and underflow issue in PE.scala #315

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dongdong1203
Copy link

I have found that MacUnit implemented on pull #265 causes overflows and underflows inside the mesh when the supported dataflow of gemmini is dataflow=Dataflow.WS.
This issue does not occur when the supported dataflow is dataflow=Dataflow.BOTH.
The cause is as follows:

The bitwidth of MacUnit.io.in_c is set to cType when the dataflow=Dataflow.WS,
where val cType = if (df == Dataflow.WS) inputType else accType.

MacUnit.io.in_c is the "Partial Sum (from PE above)" of the PE. This net needs width equal to be accType of gemmini,
in order to prevent overflows and underflows of partial sums.
img

So I have changed the width of MacUnit.io.in_c to be same as accType.

And another interesting observation was that, built-in baremetal examples of matmul usually had no issues with the faulty code. This was because the random inputs and weight of the baremetal codes had too small absolute values to cause any overflows or underflows.

I suggest improving the random number generation of the baremetal codes a bit.

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.

None yet

1 participant