-
Notifications
You must be signed in to change notification settings - Fork 614
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
Stop Emitting BlackBoxResourceAnno #1954
Conversation
Change HasBlackBoxResource to resolve resources immediately and emit BlackBoxInlineAnno instead of a BlackBoxResourceAnno. This removes the need for a FIRRTL compiler to grok the Java Resource API in order to handle BlackBoxResourceAnno. Signed-off-by: Schuyler Eldridge <[email protected]>
Emit BlackBoxInlineAnno from HasExtModuleResource instead of BlackBoxResourceAnno. Signed-off-by: Schuyler Eldridge <[email protected]>
Here is a unrelated quetion: is possible to replace and a potential issue we might need to concern is: if there is a really huge blackbox verilog, something like 16 core Boom Verilog(maybe 1G+), will this become another performance issue to JVM? It will directly consume 1G from JVM, and Maybe another work around is that we can copy all blackboxes to |
Yes. I was aiming to keep this PR narrowly focused, though. Fundamentally, only one of the three blackbox annotations are actually needed. They all encode the same information with differences in how the path is encoded and at what time.
Possibly. Using
This could probably be done with some |
“happen at the end of the first stage” sounds reasonable! if FIRRTL doesn’t need any modification in the later passes, I think we can free this memory as early as possible to save the effort of copying potential large text file. |
Converting these to a path has the downside of not being able to represent the full space of URLs that resources can resolve to (e.g., if this is getting dug out of some JAR file which may be package in a library). If we run into a problem with this requiring too much memory, I can look into an alternative solution. |
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.
is there anything in the website docs that should be updated for this change? https://www.chisel-lang.org/chisel3/docs/explanations/blackboxes.html#providing-implementations-for-blackboxes
@mwachs wrote:
No, I don't think so. 😄 What's cool about this is that the Chisel-level API doesn't change at all. Users can continue to use |
I think this is okay to backport, it could affect some advanced users doing stuff in FIRRTL. That being said, since it is technically equivalent, it shouldn't cause any problems. |
@chick, @jackkoenig: I tested this locally using https://github.com/seldridge/chisel-resource-test. This was initially not working. However, after cleaning my environment (again) it worked. This is pulling the JAR out of dsptools. |
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 looks good to me. I like the tests. One quibble (which can be ignored regarding DRY code).
Only other consideration. Since we can anticipate that large files in a resource dir could cause problems whether
we could issue some warning based on size or copy time that would alert users to this situation. Just a thought
@chick. Can you take one more look? Updated with your changes. To DRY it out, I used a implicit class on the object to get a |
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.
LGTM
* Change HasBlackBoxResource to Resolve Resources Change HasBlackBoxResource to resolve resources immediately and emit BlackBoxInlineAnno instead of a BlackBoxResourceAnno. This removes the need for a FIRRTL compiler to grok the Java Resource API in order to handle BlackBoxResourceAnno. Emit BlackBoxInlineAnno from HasExtModuleResource instead of BlackBoxResourceAnno. Signed-off-by: Schuyler Eldridge <[email protected]> (cherry picked from commit 820200b) # Conflicts: # src/main/scala/chisel3/util/BlackBoxUtils.scala
* Stop Emitting BlackBoxResourceAnno (#1954) * Change HasBlackBoxResource to Resolve Resources Change HasBlackBoxResource to resolve resources immediately and emit BlackBoxInlineAnno instead of a BlackBoxResourceAnno. This removes the need for a FIRRTL compiler to grok the Java Resource API in order to handle BlackBoxResourceAnno. Emit BlackBoxInlineAnno from HasExtModuleResource instead of BlackBoxResourceAnno. Signed-off-by: Schuyler Eldridge <[email protected]> (cherry picked from commit 820200b) # Conflicts: # src/main/scala/chisel3/util/BlackBoxUtils.scala * fixup! Stop Emitting BlackBoxResourceAnno (#1954) Co-authored-by: Schuyler Eldridge <[email protected]>
Contributor Checklist
docs/src
?Type of Improvement
Other.
API Impact
Change Chisel to never emit
BlackBoxResourceAnno
. This improves the separation between Chisel and a FIRRTL compiler. The semantics of locating the file associated with aBlackBoxResourceAnno
is that of Java Resources. This is fine if a FIRRTL compiler is implemented on top of the JVM. However, if the FIRRTL compiler is not implemented on the JVM, then it makes the Chisel classpath part of what is necessary to pass to the FIRRTL compiler (and that a FIRRTL compiler needs to handle Java resource finding).Backend Code Generation Impact
No.
Desired Merge Strategy
Release Notes
Reviewer Checklist (only modified by reviewer)
Please Merge
?