fastmachinelearning / hls4ml

Machine learning on FPGAs using HLS
https://fastmachinelearning.org/hls4ml
Apache License 2.0
1.17k stars 388 forks source link

Using the Extension API; always the same resource usage #787

Open YumingChang666 opened 1 year ago

YumingChang666 commented 1 year ago

Hi! We are using the extension API (referring to the kl_layer template) to create a custom layer. But we noticed that we always get similar resource usage (that seem very low), even though we changed the reuse factor, precision and input length of the custom layer. Like the figure below (The Model below is the Small Model). WhatsApp 图像 2023-05-11 于 15 57 36 WhatsApp 图像 2023-05-11 于 15 55 58 So, I would like to ask: Does this same resource usage represent some kind of error? Does this indicate that I Am using the extension API wrong?

These are what I tested with different values (Whole Models and Small Models). Our model has a lot multiplications and accumulations. The layer input is a List[C x L x V]. WhatsApp 图像 2023-05-11 于 16 03 45 Mention: The 'Result' about 'too long waiting' in the figure above is that if we use a large input shape(big C and V value), it always takes too long time in building Keras Model part. We are also looking for the reason, and sometimes it needs the CPU memory larger than 50G.

Thank you in advance! Yuming