-
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
Mapping logical memories to physical memories #1151
Comments
This plan sounds great. I just want to add that this seems like a pretty chunky piece of work—we'd need to design the high-level abstraction, adapt front-ends, create a library of interesting backing RAM implementations, and then implement the pass. So if anyone is ever looking for a discrete project to sink their teeth into, this could be one. |
I think @calebmkim might have this on his critical path towards writing the sharing paper (to some extent). We can’t really get resource numbers for bigger designs without this. |
Also, worth thinking about how this can enable HBM support: #1106 |
Indeed! As far as the "discussion needed" for this one, maybe what we should chat about is how to sidestep the need for the "full version" of this, or to build something minimal and easy that just enables big designs to compile in a reasonable way. (Just because I worry this could be a super interesting problem that would distract from sharing per se.) |
Yeah, I think the minimal thing to do to get sharing results is to port the Dahlia and TVM frontends to use the sequential read/write memories and default them to URAM for now. This is probably not the best thing to do but fine as a way to get started. |
I think this will be a good use case for evaluating the new Calyx static stuff |
Just to revive this issue, @paili0628 and I talked about how we should implement this and we think the following might be a good idea: we could define components in Calyx that delay memory reads/writes by two cycles. E.g.,
I think it would probably be best to add this component as a primitive. The only question I have is: can we use |
That sounds like a great starting point! Couple of notes:
|
With #1145, Calyx has rudimentary support for memories with sequential read and writes. While the specific implementation of the memory in that PR is a 1-cycle read, 1-cycle write memory, the interface actually admits arbitrary latencies for reads and writes. This is because reads needs to be "primed" by setting the
read_en
signal and waiting on theread_done
signal. Similarly, the write interface needs to usewrite_en
andwrite_done
signals. The only way Calyx knows that reads and writes take one cycle is because of the@static
annotations on the read and write paths. We can imagine exposing a weaker interface without the@static
annotations which will force frontends to assume that reads and writes can take arbitrary number of cycles.Next, we can design a pass that analyses memories and remaps them to physical memories with different latencies. For example, we can say (these numbers are completely made up):
Side note: the reason to map onto BRAMs with more than 1-cycle of read/write latency is because of the way synthesis tools construct bigger memories from BRAM building blocks; if a memory is too big, it needs to be constructed out of multiple BRAM blocks each of which add wire delay. By taking more cycles for reads and writes, we can help the synthesis tool get better timing results since it doesn't have to fit all reads and writes into 1 cycle.
The pass itself will use a set of primitive/generated memories which have the required characteristics. The best part of this is that we don't have to give up on latency-sensitivity; the pass, once it figures out which kind of memory to use, can insert the right
@static
attributes into the groups that use the memories.FWIW, this pass is a much simpler version of the compiler @andrew1999 is building.
The text was updated successfully, but these errors were encountered: