-
Notifications
You must be signed in to change notification settings - Fork 428
Switching to Non-Blocking Assigns in Single/Dual Port Ram Primitives #3239
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the correct change with respect to synthesis; are there any HDL simulation tests that need to be checked to ensure that our behavior change is not breaking?
I'm honestly not sure. It's probably best for either @AlexandreSinger or @vaughnbetz to answer this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@loglav03 I am ok with this change, I understand why you are doing this. My concern is that we are implicitly changing the behavior of the RAMs. We are changing the RAMs from a write-first behavior to a read-first behavior. I am honestly not sure what affect this has... I guess we would need to know the context as to why write-first behavior was chosen in the first place. The reason I have concern is that the author of this file explicitly wrote that they wanted "read-during write behaviour"; so I am wondering if that was a coin-flip choice or not.
@vaughnbetz I think you may have the best judgement on this one. I do not think this would affect pack place and route all that much, but I am not sure if VTR follows a standard for RAM R/W behaviors?
@petergrossmann21 and @loglav03 do we need to turn this into read-first behavior, or does slang support write-first RAM inference?
I believe slang doesn't forbid write-first, but when using blocking assignments with slang as the parser, the RTL it passes to yosys doesn't match the pattern yosys's memory inference pass would use to infer RAM. However, when using the default yosys parser it doesn't seem to have a problem with this. So, it seems it's parser dependent when it comes to using write-first with blocking assignments. |
@AlexandreSinger Slang is just a parser, which is too early in the synthesis flow to dictate whether read-first/write-first support is present or not. The change to the flow is that RAM inference is now required at all, vs. in the original flow the memories were more or less blackboxed. This does raise the question as to how the memories are getting back into a technology-mapped form (we know they are, but it's a bit opaque as to how) -- I assume parmys is taking care of this? |
@petergrossmann21 - It does appear parmys takes care of this. I found the following functions that occur at some point during the parmys elaboration pass: resolve_single_port_ram -> calls create_single_port_ram. These functions hint towards this. These can be found in vtr-root/parmys/parmys-plugin/core/memory.cc at line 1990 or by following the resolve_top call in parmys.cc at line 749 And these only appear after the parmys pass (which I assume are the memories in tech-mapped form):
|
As we discussed in the meeting, we can make this change:
|
@vaughnbetz @AlexandreSinger @petergrossmann21 - I've attached a QoR comparison result section to the description of this PR, that compares metrics when using write-first vs read-first behaviour with the default yosys parser. This seemed to generally yield gains in flow times, and have minimal or no difference in other metrics. I think this change can be kept across the board since it has minimal metric differences with original designs using the default yosys parser, and fixes the issue we've encountered when using the slang parser on modified designs. |
@loglav03 : I think you forgot to attach the QoR comparison? |
@vaughnbetz It should be at the bottom of the PR description below the checklist section? It includes a .zip of the QoR comparison tables of vtr_reg_qor_chain and koios_medium. I'm also going to include a single summary spreadsheet for both comparisons. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks!
Description
Switched read and write updates to use non-blocking assigns instead of blocking assigns for single/dual port ram primitives.
Related Issue
#3195
Motivation and Context
This change is needed to resolve issue with block RAMs being expanded into LUTs and FFs in some cases when parsing with Slang.
How Has This Been Tested?
Tested locally with cloned version of vtr_reg_qor test that uses modified benchmarks from #3195 and uses Yosys-Slang as the parser. Most of these benchmarks pass the flow but still fail golden results, which is expected.
Also locally tested vtr_reg_qor with old version of benchmarks using default yosys parser. [PASSED]
Passes all existing CI tests.
Types of changes
Checklist:
QoR Comparison Results (Using Default Yosys Parser, comparing write-first vs. read-first):
Comparison Tables: compare_tables.zip
Summary of Tables: summary.xlsx
vtr_reg_qor_chain:
koios_medium: