Skip to content

Fix Inspector losing debug handles when given an ETRecord object - #23692

Open
u7k4rs6 wants to merge 1 commit into
pytorch:mainfrom
u7k4rs6:fix-inspector-etrecord-object-keys
Open

u7k4rs6 wants to merge 1 commit into
pytorch:mainfrom
u7k4rs6:fix-inspector-etrecord-object-keys

Conversation

@u7k4rs6

@u7k4rs6 u7k4rs6 commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

If you pass an ETRecord object to the Inspector (Inspector(etdump_path=..., etrecord=program_manager.get_etrecord())) instead of a path, debug handle resolution quietly finds nothing. The ETRecord object keys _debug_handle_map, _delegate_map and _instruction_id_to_num_outs_map by int instruction id, but once an ETRecord goes through save() / parse_etrecord() (JSON) the keys are strs, and _gen_resolve_debug_handles looks them up as strs. So with the object every event ends up with debug_handles=None and no op_types, and things like calculate_numeric_gap just return an empty DataFrame. No error or warning.

The fix converts those keys to str once in _consume_etrecord, before handing the maps to the event blocks. It builds new dicts, so the caller's ETRecord isn't modified, and the file path case behaves the same as before.

Test plan

Added test_inspector_with_etrecord_object_resolves_debug_handles to devtools/inspector/tests/inspector_test.py. It builds one Inspector from the ETRecord object and one from the same ETRecord saved to a file, and checks they resolve the same debug handles and op types. It fails on main (the object version gets None) 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

Copilot AI balanced review requested due to automatic review settings October 11, 2026 18:49
@u7k4rs6
u7k4rs6 requested a review from Gasoonjia as a code owner October 11, 2026 18:49
@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/23692

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

⚠️ 15 Awaiting Approval

As of commit 4088ba1 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

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.

@u7k4rs6

u7k4rs6 commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

@pytorchbot label "release notes: devtools"

@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