implement OpAsmInterface
for TileElement
to get good debug SSA names
#718
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.
MLIR has an interface that helps with debugging (OpAsmOpInterface) so let's use it on
TileElements
(for which I've seen many tests that hard code the indices of the tile...). The result (no pun intended) is thatpretty prints to
automatically.
The only thing that really needed to be done to make this work is a little fiddling with how interface inheritance works in MLIR1.
Note, the first commit changes a lot of tests that were not using capturing so it couldn't be verified that the change was correct (because the names for the SSA values were
%0, %1,...
, i.e. hardcoded). By the way, I generated the capturing version of the tests automatically using generate-test-checks.py, e.g.It would be good if we used this from now on.
Footnotes
The
TileElement
interface has everything needed to implementgetAsmResultNames
but there's no simple way to share that implementation across ops that subscribe to the interface. So you need to stick the implementation in the trait associated with interface (henceextraTraitClassDeclaration
). Then our classes end up looking like thiswhich is almost right except with both
::mlir::OpAsmOpInterface::Trait
and::xilinx::AIE::TileElement::Trait
having implementations ofgetAsmResultNames
(OpAsmOpInterface::Trait
has a default implementation) the call (togetAsmResultNames
) is ambiguous. Hence theusing
declaration. ↩