We have very large MyHDL designs and are in the process of migrating from MyHDL 0.8 to 0.10. Unfortunately some of our designs runs out of memory (> 128Gbyte) when generating Verilog.
It seems there is at least a factor 4x higher memory consumption with 0.10 vs 0.8 for some of our designs.
The memory usage is high both when using toVerilog and .convert methods.
I am working on memory profiling but any hints to what might be causing the large difference between 0.8 and 0.10 would be helpful.
Initially I just measured using “top” but now I’m running guppy/heapy to try to identify where the memory is consumed.
One large part is symdict in the _Instantiator class which holds each blocks variables used to identify which are Signals. But I’m not sure this is the only source.
I have an example that consumes a lot of memory that I will post. It is not from the real design but it shows at least some part of the memory consumption issue.
@kranerup thanks for sharing this issue and an example. I have not encountered memory issues during conversion, however I haven’t looked at the amount of memory used either.
I don’t know if anyone has much bandwidth right now to look at this issue, but it is something that I would like to understand and improve if possible.
Looks similar to what I got from Heapy. The dict that consumed most according to Heapy was the symdict in the _Instantiator class.
I tried various tricks to make it more efficient like replace the dict with a list (very cpu-inefficient of course), pruning unused entries in the dict like __doc__ , __package__ , __name__. That did reduce the memory consumption but I get nowhere near the 0.8 usage.
I think my bottom-up approach is not sufficient. An understanding of how this dict is used and why it is different from 0.8 is probably necessary to get anywhere on this issue.