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

Vivado FIFO optimization overestimates first FIFO depth #1049

Open
rfforelli opened this issue Aug 8, 2024 · 0 comments
Open

Vivado FIFO optimization overestimates first FIFO depth #1049

rfforelli opened this issue Aug 8, 2024 · 0 comments
Labels

Comments

@rfforelli
Copy link

Quick summary

hls4ml's fifo optimization overestimates the size of my CNN's first layer output fifo.

Details

I am synthesizing a small CNN and using hls4ml's fifo optimization. The size of the output stream (layer28_out) of the first layer (zp2d_q_conv2d) is 6500 by default. However the FIFO optimization greatly overestimates this depth at 12238, almost double. I am using hls4ml 0.8.1 from pip.

Steps to Reproduce

files.zip

  1. download and unzip files.zip
  2. install conda environment with conda env create -f environment.yml.
  3. activate environment conda activate fifo_opt_issue.
  4. install kernel in jupyteripython kernel install --user --name=fifo_opt_issue.
  5. run notebook and wait for FIFO optimization to complete.
  6. See myproject.cpp, layer28_out is set to 12238.

image

Expected behavior

I would expect the layer depth to be equal to+1 or lower than the default hls4ml depth of 6500, since this is the full output size of the previous layer.

Actual behavior

The layer depth is set to almost double the size that should be required to accommodate the activations.

Optional

Possible fix

I understand the optimization reads the FIFO's internal usedw signal in vivado co-sim. Perhaps this is an issue with Xilinx software.

Additional context

I am using the extensions API to implement a custom layer. I am not sure if that might have any effect.
I can set the problematic stream's depth to 6500 post-fifo opt and the design runs on hardware without issue.

@rfforelli rfforelli added the bug label Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant