[xls][mlir] Fix emission of debug locations in xls_translate
#1992
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As noted in #1916, I was not able to easily add a round-trip test for channel attributes due to some issues with debug locations in
xls_translate
.While fixing this, I wanted to verify that round-trip conversion worked by smoke testing with
ops_translate.mlir
, where I noticed that my xls->mlir translation did not supporttrace
and that my naming of the fifo flop kind enum was inconsistent.Poping the stack, this PR contains the following commits addressing all of the above:
[xls][mlir] Use underscore in zero latency enum case name
Makes it consistent with all other values in XLS MLIR assembly.
[xls][mlir] Add xls->mlir translation of trace IR node
[xls][mlir] Emit well-formed XLS source location infos in xls_translate
xls_translate
previously assigned an ID to every source file encountered in the MLIRLocation
of input ops and referenced these IDs in the XLSpos
attribute of the produced IR nodes, but did not actually add these source file names to the XLS package, leading to invalidpos
attributes.This patch fixes this by relying on
Package::AddSourceLocation
to both construct theSourceLocation
for nodes and automatically registering the file with the package.With this,
xls_translate
can also re-use the file name ID assignment/lookup from XLS proper.[xls][mlir] Add round-trip conversion test for channel properties
This was previously not easily possible due to the incorrect emission of XLS file locations in
xls_translate
.[xls][mlir] Expand ops_translate.mlir test to round-trip verification.
I rolled all this into a single PR because these are all interdependent, probably making review a bit more annoying. Sorry 😇
@jpienaar @jmolloy