-
Notifications
You must be signed in to change notification settings - Fork 298
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
[DebugInfo][HGLDD] Consuming Tywaves annotations containing extra source language information from Chisel and improve HGLDD format #7246
base: main
Are you sure you want to change the base?
Conversation
…uctor parameters information) The source language type information is now available to CIRCT (through the tywaves annotation mechanism): - Consume and transform tywaves annotations to mlir operations. - The annotations are added to the firrtl dialect (`applyTywaves`) if the debug information should be enabled (-g). Otherwise useless. - Add tests for `applyTywaves`.
- Modified the debug dialect to support source language type information (type and constructor parameters): - Added optional (depending on the user debug level chosen they may not be present) `type` and `params` attributes to `VariableOp` - Created `SubFieldOp` + `SubFieldType` return type. - A `SubFieldOp` contains the source language information and the reference to the actual operation which is preserved (it can be any type). - A `SubFieldOp` is contained in a `dbg.struct` or`dbg.array`. - Add the `SubFieldOp` to represent source language information for subfields of aggregates and keep the distinction between subfields and variables in the debug dialect - Updated `MaterializeDebugInfo` to create proper debug operations: - Convert Tywaves annotations to the respective debug dialect operations - If the tywaves annotations are not present, the behaviour does not change - Checks for the number of tywaves annotations associated to a target/operation - A specific target should have only 1 tywaves annotation - The annotations must not have errors in the format - Tests: - Conversion to dbg dialect operations - Error handling tests
The related PR in chisel: chipsalliance/chisel#4224 |
Some general comments: |
@darthscsi thanks for the comment. |
I have also noticed another thing. HGLDD also missed reference to enum variants, so I'm trying to add that. |
Related to: - issue: rameloni/tywaves-chisel#27 - commit in chisel: rameloni/chisel@2d57816
This allows external tools to transform a raw value of that signal into a string (enum variant). Related issue in tywaves: rameloni/tywaves-chisel#21
To support debug info about Other CIRCT contributions (supporting enums in HGLDD)
|
Hey @rameloni, sorry for taking so long to respond. Your work is very exciting! Thanks for pushing on getting debug information communicated from Chisel to CIRCT 🥳. I agree with @darthscsi that using intrinsics here would be very nice. They would allow you to directly annotate information onto Chisel and FIRRTL values directly in the IR, without going through the annotations mechanism which we are trying to phase out as much as possible. Intrinsics should be almost identical in handling as annotations, with the difference that you have more control over where they appear in the IR and you never have to magically materialize MLIR ops from a JSON data structure. One concern regarding debug info output: the HGLDD format is used by Synopsys VCS/Verdi to ingest debug information. I'm pretty sure that changes to the format, especially things that add new constructs and fields and operators, will break the Synopsys-side implementation. The format is also tailored to work with VCS-internal code patterns and limitations. Since you are working on your own waveform viewer, would it be possible to simply create a new, more streamlined debug info format for your viewer? You could just copy-paste the HGLDD emission code with your changes, if you want to stick with those. But I'm pretty sure you've found a few things in HGLDD to be weird or cumbersome, and creating your own output format would be an opportunity to make things more streamlined for you 😃. But it would be great to keep the HGLDD format unchanged since we don't control the other half of its implementation. |
Hey @fabianschuiki, thanks for the feedback. At the beginning I created a draft file format different from HGLDD but later I thought that extending HGLDD could've been also an opportunity to make the new features available to tools using that. I also though that two formats could create confusion 😅. My thesis deadline is soon and, at this point, I am not sure if creating a new format is a good idea, emitting the updated HGLDD as "another" format is super fast instead. Regarding intrinsics, I'd really like to replace my annotations with them, I'm trying to finish quickly my remaining tasks to do so by the end of July, but it is more likely that I'll make it after my defense. Also, annotations are already used for the Chisel enums, which means that also those would need to be replaced. |
- basic.mlir - materialize-debug-info.mlir - emit-hgldd.mlir
This PR adds new functionality to CIRCT for emitting source language type information in HGLDD
#6983.
This new functionality support the new backend of my project. Tywaves: a type-based waveform viewer. Tywaves adds support for Chisel to Surfer through HGLDD, however it misses of Chisel-type information and a proper documentation.
So, in addition to the changes I made to CIRCT, I also created a library for reading and documenting HGLDD in rust. I noticed that HGLDD misses a formal specification, so the rust documentation is a first attempt to provide more formal description of the fields contained in the file.
Specific contribution to CIRCT
TywavesAnnotation
by Chisel [DebugInfo] Emit source language scala type information and pass it to CIRCT chipsalliance/chisel#4224MaterializeDebugInfo
and convert to debug dialect operationsdbg.subfield
anddbg.moduleinfo
)circt/include/circt/Dialect/Debug/DebugOps.td
Lines 87 to 114 in a1f795e
circt/include/circt/Dialect/Debug/DebugOps.td
Lines 154 to 168 in a1f795e
circt/lib/Target/DebugInfo/EmitHGLDD.cpp
Lines 558 to 580 in a1f795e
circt/lib/Target/DebugInfo/EmitHGLDD.cpp
Lines 612 to 615 in a1f795e
circt/lib/Target/DebugInfo/EmitHGLDD.cpp
Lines 702 to 705 in a1f795e