Skip to content

NXP backend: Save the partitioned graph when intermediates_dir is set - #25761

Draft
robert-kalmar wants to merge 1 commit into
pytorch:mainfrom
nxp-upstream:EIEX-1252-neutronpartitioner-automatically-save-the-partitioned-graph-when-intermediates-dir-is-set-upstream
Draft

robert-kalmar wants to merge 1 commit into
pytorch:mainfrom
nxp-upstream:EIEX-1252-neutronpartitioner-automatically-save-the-partitioned-graph-when-intermediates-dir-is-set-upstream

Conversation

@robert-kalmar

@robert-kalmar robert-kalmar commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

When intermediates_dir is set, the NeutronPartitioner now saves the tagged program as JSON for the Model Explorer GUI. A missing model_explorer installation is reported as a warning and the export continues, because the dump is only a debugging aid.

The partitioner API does not expose the name of the partitioned method, so the dumps of a multi-method program are kept apart by the number of the partition() call: neutron_partitioned.json,
neutron_partitioned_1.json, ... See EIEX-1255.

Compile specs are now read by key through the new module-level get_compile_spec_value() helper in nxp_backend.py, replacing the index-based access in the partitioner and the long key comparison chain in NeutronBackend.preprocess. The helper maps the encoded "None" to None, so intermediates_dir is no longer compared against a string literal.

The test helper in tests/nsys_testing.py no longer patches NeutronPartitioner.partition to produce the dump, because it already passes intermediates_dir.

Test plan

Already covered by existing unittest

cc @JakeStevens @digantdesai @rascani

When `intermediates_dir` is set, the `NeutronPartitioner` now saves the
tagged program as JSON for the Model Explorer GUI. A missing
`model_explorer` installation is reported as a warning and the export
continues, because the dump is only a debugging aid.

The partitioner API does not expose the name of the partitioned method,
so the dumps of a multi-method program are kept apart by the number of
the `partition()` call: neutron_partitioned.json,
neutron_partitioned_1.json, ... See EIEX-1255.

Compile specs are now read by key through the new module-level
`get_compile_spec_value()` helper in nxp_backend.py, replacing the
index-based access in the partitioner and the long key comparison chain
in `NeutronBackend.preprocess`. The helper maps the encoded "None" to
`None`, so `intermediates_dir` is no longer compared against a string
literal.

The test helper in tests/nsys_testing.py no longer patches
`NeutronPartitioner.partition` to produce the dump, because it already
passes `intermediates_dir`.
@pytorch-bot

pytorch-bot Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ You can merge normally! (1 Unrelated Failure)

As of commit 885f303 with merge base ddb19ca (image):

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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 Nov 26, 2026
@robert-kalmar robert-kalmar added module: nxp Issues related to NXP Neutron NPU delegation and code under backends/nxp/ release notes: nxp Changes to the NXP Neutron backend delegate labels Nov 26, 2026
@robert-kalmar

robert-kalmar commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

Might conflicts with #25002 , once merge will rebase and mark the PR as READY.

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. module: nxp Issues related to NXP Neutron NPU delegation and code under backends/nxp/ release notes: nxp Changes to the NXP Neutron backend delegate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant