Skip to content

Fix Inspector crash on multi-method ETRecords - #23691

Open
u7k4rs6 wants to merge 1 commit into
pytorch:mainfrom
u7k4rs6:fix-inspector-multi-method-etrecord
Open

u7k4rs6 wants to merge 1 commit into
pytorch:mainfrom
u7k4rs6:fix-inspector-multi-method-etrecord

Conversation

@u7k4rs6

@u7k4rs6 u7k4rs6 commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Inspector can't be built from an ETRecord of a multi-method program. Since #17185, ETRecord stores edge_dialect_program as a dict of method name -> program when there's more than one method, but gen_graphs_from_etrecord and _resolve_reference_graph still do .graph_module on it, so Inspector(etdump_path=..., etrecord=...) fails right away with AttributeError: 'dict' object has no attribute 'graph_module'.

This adds a small helper, get_forward_edge_dialect_program, that returns the program as-is when it's a single one, or the "forward" entry when it's a dict, and uses it in those two places. The Inspector already only correlates the forward method, so that's the graph it should use.

Programs with no method named "forward" still fail earlier in ETRecord handling (KeyError: 'forward'). That needs a bigger decision about which method to inspect, so I left it out of this one.

Test plan

Added test_inspector_with_multi_method_etrecord to devtools/inspector/tests/inspector_test.py. It exports a two-method program (forward + times_two) with generate_etrecord=True, builds an Inspector from the saved ETRecord, and checks the reference graph is the forward graph. It fails on main with the AttributeError above and passes with the fix, and the rest of devtools/inspector/tests passes. ufmt and flake8 are clean with the versions from requirements-lintrunner.txt.

cc @nil-is-all

@u7k4rs6
u7k4rs6 requested a review from Gasoonjia as a code owner October 11, 2026 18:48
Copilot AI balanced review requested due to automatic review settings October 11, 2026 18:48
@pytorch-bot

pytorch-bot Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⚠️ 15 Awaiting Approval

As of commit ede3bea with merge base f2575be (image):

AWAITING APPROVAL - The following workflows need approval before CI can run:

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

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 11, 2026
@u7k4rs6

u7k4rs6 commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

@pytorchbot label "release notes: devtools"

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@pytorch-bot pytorch-bot Bot added the release notes: devtools Changes to dev tooling, for example the debugger & profiler label Oct 11, 2026
@executorch-triage executorch-triage Bot added the community: contribution PRs coming from community (excluding hardware partners) label Oct 11, 2026

This branch has not been deployed

No deployments
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. community: contribution PRs coming from community (excluding hardware partners) release notes: devtools Changes to dev tooling, for example the debugger & profiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants