Skip to content

[executorch][native] Add native runtime Program reader + Graphviz visualizer - #22097

Open
SS-JIA wants to merge 1 commit into
gh/SS-JIA/586/basefrom
gh/SS-JIA/586/head
Open

[executorch][native] Add native runtime Program reader + Graphviz visualizer#22097
SS-JIA wants to merge 1 commit into
gh/SS-JIA/586/basefrom
gh/SS-JIA/586/head

Conversation

@SS-JIA

@SS-JIA SS-JIA commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

First C++ runtime components for the native backend, under
backends/native/runtime/:

  • ptn::Program (Program.h / Program.cpp): a standalone reader that parses
    and verifies a serialized native graph (*.nptg). Program::load() copies
    the bytes, checks the NPTG FlatBuffer file identifier, runs the FlatBuffer
    verifier, and exposes a zero-copy view of the root; it throws
    std::runtime_error on failure. No ExecuTorch or torch dependency
    (flatbuffers only); exceptions allowed, C++11/17.
  • Program::to_graphviz() (utils/ToGraphViz.cpp): renders the program to
    Graphviz DOT text — methods as clusters, dataflow / def-use as labeled edges,
    tensor metadata, constants, alias / mutation facts, quant, and HOP subgraphs.
    Pure string builder, no I/O. Doubles as the reference walk of
    native_backend::Program.

Also wires a --dot flag into the native_executor tool: load + verify via the
reader, then print the DOT to stdout.

The schema header is generated from serialization/native_graph.fbs via a
flatc genrule (:native_graph_schema). Mirrored into both the fbcode/ and
xplat/ trees to match the native backend layout.

Authored with Claude Code.

Differential Revision: D114396768

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/22097

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit adbe877 with merge base 9a2d135 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@github-actions

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant