This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add LLDB visualizers for MLIR constructs
ClosedPublic

Authored by rriddle on Dec 7 2022, 8:09 PM.

Details

Summary

This commit adds a significant amount of visualizers attempting
to cover the majority of our visualization needs. It covers:

  • Operations/OperationName/Ops/OpInterfaces
  • Attributes/Types/Attr|TypeInterfaces/NamedAttribute
  • Blocks/Regions
  • Various range types (e.g. ValueRange/TypeRange)
  • Values/BlockArguments/OpResults

This does require an NFC change to interfaces to rename
the concept field to avoid clash with the base class. It
also requires exposing a few method to the debugger
to help resolve information that is non-trivial to reconstruct.
These methods are re-exported using a debug_Blah naming
scheme to avoid messing with hot methods.

Note that this makes use of the new callback feature in lldb-16
(currently trunk) that allows for providing visualizers based on
a dynamic callback, instead of just the typename. It requires
a very new lldb, but allows for providing good default visualization
for all attributes/operations/types out of the box.

Diff Detail

Event Timeline

rriddle created this revision.Dec 7 2022, 8:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 7 2022, 8:09 PM
rriddle requested review of this revision.Dec 7 2022, 8:09 PM

Example:

This isn't just LLDB in a terminal, is it? Seems like there is some IDE integration here.

Should some doc be updated as well on the website?

mlir/utils/lldb-scripts/mlirDataFormatters.py
77

determining

Example:

This isn't just LLDB in a terminal, is it? Seems like there is some IDE integration here.

Should some doc be updated as well on the website?

Yeah technically it's the LLDB extension for vscode, but it works in the same way as lldb on the terminal (you run the same command script import <path> command).

rriddle updated this revision to Diff 481871.Dec 10 2022, 11:29 AM
rriddle edited the summary of this revision. (Show Details)
rriddle marked an inline comment as done.
mehdi_amini accepted this revision.Dec 10 2022, 5:43 PM

LGTM, it'd be great if we had a doc on the website on how to use this, both with and without VSCode, either on this page https://mlir.llvm.org/getting_started/Debugging/ or a separate subpage linked from there :)

This revision is now accepted and ready to land.Dec 10 2022, 5:43 PM

LGTM, it'd be great if we had a doc on the website on how to use this, both with and without VSCode, either on this page https://mlir.llvm.org/getting_started/Debugging/ or a separate subpage linked from there :)

I'll look at this next week!

This revision was automatically updated to reflect the committed changes.

I just realized we're missing some doc for this, possibly here: https://mlir.llvm.org/getting_started/Debugging/ ?