Xilinx / finn

Dataflow compiler for QNN inference on FPGAs
https://xilinx.github.io/finn
BSD 3-Clause "New" or "Revised" License
742 stars 236 forks source link

Data Mismatch in Default FINN FPGA Flow Tutorial Using MNIST Numerals Example #1211

Open prospersu opened 2 weeks ago

prospersu commented 2 weeks ago

Prerequisites

Quick Summary

When running the FINN FPGA flow using the MNIST Numerals example, the output results do not match the expected values. Despite compiling the code successfully, the simulation shows data mismatches and zero validated data points.

Details

Steps to Reproduce

  1. Clone the FINN repository.
  2. Checkout the dev branch, with commit hash.
  3. Start the Docker container with the command.
  4. Run transformation on the ONNX file or run the dataflow builder inside the tutorial folder.
  5. Compile the FPGA flow using the MNIST Numerals example.
  6. Observe the mismatch in output during the simulation.

Expected Behavior

The simulation should produce output data that matches the expected values, with zero error counts and validated data points.

Actual Behavior

The simulation completes with errors:

Possible Fix

Potential issues could be related to data misalignment between the input samples and expected outputs or timing issues in the testbench synchronization. Verifying the pointers (wr_ptr, rd_ptr) and ensuring data transfer synchronization in the testbench might resolve the problem.

Additional Context

auphelia commented 2 weeks ago

Hi @prospersu ,

Thanks for creating the issue, could you check if this PR solves your issue: https://github.com/Xilinx/finn/pull/1212

The folding configuration wasn't updated with the latest FINN version and so the folding wasn't applied. That might have caused a mismatch between expected folding from the test bench and the actual FINN IP.