Skip to content

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

Open
dongdong1203 wants to merge 1 commit intoucb-bar:masterfrom
dongdong1203:patch-1
Open

fix CRITICAL overflow and underflow issue in PE.scala #315
dongdong1203 wants to merge 1 commit intoucb-bar:masterfrom
dongdong1203:patch-1

Conversation

@dongdong1203
Copy link
Copy Markdown

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.

1 participant