Is your bug report related to the C++ slang project or the pyslang Python bindings?
C++ slang
Describe the bug
I've been trying to get a system verilog design that's about 1GB in size through slang. It's been blowing up in memory during def param resolution. Here's the data i have gathered so far:
-
After parsing, the CST is about 22GB. Of this, the tokens take up about 10.5 GB and from that the trivia is about 1.5GB. I added a CST memory profiler for this that provides a detailed breakdown of memory and count per syntax node. Additionally, it also provides a break up of memory usage per SV module/package/program.
-
The first visitor pass (generate level 0) via DefParamVisitor causes the RSS to increase from 24GB to 72GB. Of that, about 35GB is associated with the Configuration clone (initialClone) in the bump allocators. Presumably, the rest of it is in the backing arrays in SymbolMap, PointerMap and ConstantValue, though i can't be fully sure. The next DefParamVisitor within the same generate level 0 loop keep increasing the memory to the point where it got to 350GB and my process got killed.
-
I made a change to ensure that initialClone is deleted before we get to the next DefParamVistor visitor (that iterates maxDefParamSteps times). This resulted in the 48GB of memory associated with initialClone being returned back to the system (RSS got back to 24GB). That's how i'm certain that all the allocated memory was with the initialClone.
-
I'm going to try to add some more memory profiling to see if i can figure out what's going on. It's odd that the first visit took 48GB and completed but the second one took 325GB and still did not complete. Here's the two iterations i'm referring to:
DefParamVisitor v(options.maxInstanceDepth, options.maxDefParamBlocks, generateLevel);
initialClone.getRoot(/* skipDefParamsAndBinds */ true).visit(v);
DefParamVisitor v(options.maxInstanceDepth, options.maxDefParamBlocks, generateLevel);
c.getRoot(/* skipDefParamsAndBinds */ true).visit(v);
Will do some more digging to see what's going on. But any pointers/feedback would be much appreciated to speed this up.
To Reproduce
Cannot share the IP and have been unable to create a small testcase so far.
Additional context
Add any other context about the problem here. If you have a non-standard setup or anything unusual that may be contributing to the problem it's good to include that here.
Is your bug report related to the C++ slang project or the pyslang Python bindings?
C++ slang
Describe the bug
I've been trying to get a system verilog design that's about 1GB in size through slang. It's been blowing up in memory during def param resolution. Here's the data i have gathered so far:
After parsing, the CST is about 22GB. Of this, the tokens take up about 10.5 GB and from that the trivia is about 1.5GB. I added a CST memory profiler for this that provides a detailed breakdown of memory and count per syntax node. Additionally, it also provides a break up of memory usage per SV module/package/program.
The first visitor pass (generate level 0) via DefParamVisitor causes the RSS to increase from 24GB to 72GB. Of that, about 35GB is associated with the Configuration clone (initialClone) in the bump allocators. Presumably, the rest of it is in the backing arrays in SymbolMap, PointerMap and ConstantValue, though i can't be fully sure. The next DefParamVisitor within the same generate level 0 loop keep increasing the memory to the point where it got to 350GB and my process got killed.
I made a change to ensure that initialClone is deleted before we get to the next DefParamVistor visitor (that iterates maxDefParamSteps times). This resulted in the 48GB of memory associated with initialClone being returned back to the system (RSS got back to 24GB). That's how i'm certain that all the allocated memory was with the initialClone.
I'm going to try to add some more memory profiling to see if i can figure out what's going on. It's odd that the first visit took 48GB and completed but the second one took 325GB and still did not complete. Here's the two iterations i'm referring to:
Will do some more digging to see what's going on. But any pointers/feedback would be much appreciated to speed this up.
To Reproduce
Cannot share the IP and have been unable to create a small testcase so far.
Additional context
Add any other context about the problem here. If you have a non-standard setup or anything unusual that may be contributing to the problem it's good to include that here.