-
Notifications
You must be signed in to change notification settings - Fork 52
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
Toplevel ref
cells interfere with static promotion
#1956
Comments
Thanks for the explanation! I'm not sure if there is anything to do about this. The Anyways, this goes to show that real accelerators need to optimize more than just compute; memory movement often dominates! |
Indeed; thanks, @ayakayorihiro, for the detailed reproduction instructions! I could even reproduce the effect for the simpler
I don't think this is the case here. Here are two VCDs I dumped from Icarus simulation of the two under the two treatments The thing to notice in the waveforms is that the I dug into the way these two are compiled (going pass-by-pass through the compilation pipeline). Critically, it looks like static promotion failed for the
Whereas the "normal" version yields:
(To reproduce this, try:
and add In the end, the problem is that the program's
(The Anyway, it seems pretty clear what's going on: top-level |
ref
-based testbenchref
-based testbench caused by static inference limitations in the presence of ref
Wow, thanks a lot for looking into this @sampsyo ! It's good to know that the problem was from a bug rather than something fundamental about externalizing memories. If we can get this fixed then there seems to be no big obstacles around always externalizing memories via |
Indeed, that would be awesome! Then we would have only one testbench where the |
ref
-based testbench caused by static inference limitations in the presence of ref
ref
cells interfere with static promotion
Branching off of #1603 - one blocker for deprecating
@external
and adoptingref
's synthesis mode everywhere is that currently the version of Verilog generated by synthesis mode (externalizing all memories) incurs a performance cost.Below is a comparison between (1) Calyx's current simulation mode (emitting
readmemh
/writememh
- Calyx) and (2) Usingref
to externalize memories (CalyxRef).Time [ms]
is the average Verilator simulation time in milliseconds, andCycles
is the number of cycles taken by the simulation. The cycle counts for CalyxRef are about 1.5-2x more than those for Calyx, and that affects the simulation time as well.This performance drop is most likely because of additional FSMs generated by the Calyx compiler to keep track of memory updates.
"Reproduction"/Trying out CalyxRef
You can run Calyx programs in CalyxRef by using
fud2
from thefud2-refmem
branch:Once you have fud2 set up, you can run CalyxRef by adding
--through calyx-to-verilog-refmem
to your fud2 simulation command:ex)
should give you
whereas running Calyx without externalized memories (Calyx):
gives you
.
The text was updated successfully, but these errors were encountered: