Skip to content

Missing datatype checks causing precision inaccuracies #803

@DEVANSH-DVJ

Description

@DEVANSH-DVJ

I was experimenting with datatypes and came across a potential bug caused by missing datatype checks.

In this message, I'll summarize where I detected this bug, and then I'll try to create a simple test for the same.

Reproducing the bug:

Aim: Compile the Gemmini kernels in ./apps/gemmini/src/exo/matmul.py

Exp 1. Default behavior

Modification: No change
Expected behavior: It compiles successfully
Observed behavior: It compiles and passes functional tests

Exp 2. Invalid datatype between @instrs like acc_scale, matmul_acc_i8

Modification: Changed line 35 from src_tmp: i32 to src_tmp: i8
Expected behavior: Compilation error
Observed behavior: TypeError: Errors occurred during precision checking

Exp 3. Invalid datatype within an @instr like matmul_acc_i8

Modification: Changed lines 29 & 30 from a2: i32 & b2: i32 to a2: i8 and b2: i8
Expected behavior: Compilation error (similar to Exp 2)
Observed behavior: No error; compiles to the same Gemmini code as Exp 1 and therefore, fails functional tests.

Conclusion: Compilation passes regardless of the datatype for lines 29 & 30, including valid (i32) and invalid (i8, f32, f16). This leads to precision inaccuracies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: CodegenThe final C code generationT: BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions