Skip to content

Preserve distinct mutation output names in graph signatures (#24105) - #24105

Open
ThomasJannaud wants to merge 2 commits into
pytorch:mainfrom
ThomasJannaud:export-D127072149
Open

ThomasJannaud wants to merge 2 commits into
pytorch:mainfrom
ThomasJannaud:export-D127072149

Conversation

@ThomasJannaud

@ThomasJannaud ThomasJannaud commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

Problem
ExportGraphSignature.buffers_to_mutate and user_inputs_to_mutate index writes by output node name. No-op folding and CSE can merge two writes into one node, so one of the mutation entries is lost from the signature.

Solution
Rebuild the signature from output_specs (_get_updated_graph_signature in exir/_program_utils.py). Copy a computed result only when two writes collide in the same mutation map, and keep positional user outputs and ordinary graph uses shared. Select ATen, edge or dim-order cloning from the program's verifier. Preserve value/debug metadata and FX provenance on the copies without inheriting allocation or custom-kernel placement annotations. Mutation output copies keep independent storage, as required by the existing output pointer contract.

This is the ExecuTorch half of D125489522, split out so that ExecuTorch owners can review it on its own. The Helios half (removing the Helios-side duplicated-output splitter that this change makes unnecessary) stays in D125489522, stacked on top. fbcode and xplat copies are identical.

{F2001970137}

Differential Revision: D127072149

@pytorch-bot

pytorch-bot Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 1 Unclassified Failure

As of commit 63a1c00 with merge base 185668b (image):

UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:

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 23, 2026
@meta-codesync

meta-codesync Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

@ThomasJannaud has exported this pull request. If you are a Meta employee, you can view the originating Diff in D127072149.

@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.

@meta-codesync meta-codesync Bot changed the title Preserve distinct mutation output names in graph signatures Preserve distinct mutation output names in graph signatures (#24105) Oct 23, 2026
ThomasJannaud added a commit to ThomasJannaud/executorch that referenced this pull request Oct 23, 2026
…24105)

Summary:

Problem
`ExportGraphSignature.buffers_to_mutate` and `user_inputs_to_mutate` index writes by output node name. No-op folding and CSE can merge two writes into one node, so one of the mutation entries is lost from the signature.

Solution
Rebuild the signature from `output_specs` (`_get_updated_graph_signature` in `exir/_program_utils.py`). Copy a computed result only when two writes collide in the same mutation map, and keep positional user outputs and ordinary graph uses shared. Select ATen, edge or dim-order cloning from the program's verifier. Preserve value/debug metadata and FX provenance on the copies without inheriting allocation or custom-kernel placement annotations. Mutation output copies keep independent storage, as required by the existing output pointer contract.

This is the ExecuTorch half of D125489522, split out so that ExecuTorch owners can review it on its own. The Helios half (removing the Helios-side duplicated-output splitter that this change makes unnecessary) stays in D125489522, stacked on top. fbcode and xplat copies are identical.

 {F2001970137}

Differential Revision: D127072149
@ThomasJannaud
ThomasJannaud force-pushed the export-D127072149 branch 2 times, most recently from aa2f8a4 to 8c4bc17 Compare October 23, 2026 15:28
ThomasJannaud added a commit to ThomasJannaud/executorch that referenced this pull request Oct 23, 2026
…24105)

Summary:

Problem
`ExportGraphSignature.buffers_to_mutate` and `user_inputs_to_mutate` index writes by output node name. No-op folding and CSE can merge two writes into one node, so one of the mutation entries is lost from the signature.

Solution
Rebuild the signature from `output_specs` (`_get_updated_graph_signature` in `exir/_program_utils.py`). Copy a computed result only when two writes collide in the same mutation map, and keep positional user outputs and ordinary graph uses shared. Select ATen, edge or dim-order cloning from the program's verifier. Preserve value/debug metadata and FX provenance on the copies without inheriting allocation or custom-kernel placement annotations. Mutation output copies keep independent storage, as required by the existing output pointer contract.

This is the ExecuTorch half of D125489522, split out so that ExecuTorch owners can review it on its own. The Helios half (removing the Helios-side duplicated-output splitter that this change makes unnecessary) stays in D125489522, stacked on top. fbcode and xplat copies are identical.

 {F2001970137}

Differential Revision: D127072149
ThomasJannaud added a commit to ThomasJannaud/executorch that referenced this pull request Oct 23, 2026
…24105)

Summary:

Problem
`ExportGraphSignature.buffers_to_mutate` and `user_inputs_to_mutate` index writes by output node name. No-op folding and CSE can merge two writes into one node, so one of the mutation entries is lost from the signature.

Solution
Rebuild the signature from `output_specs` (`_get_updated_graph_signature` in `exir/_program_utils.py`). Copy a computed result only when two writes collide in the same mutation map, and keep positional user outputs and ordinary graph uses shared. Select ATen, edge or dim-order cloning from the program's verifier. Preserve value/debug metadata and FX provenance on the copies without inheriting allocation or custom-kernel placement annotations. Mutation output copies keep independent storage, as required by the existing output pointer contract.

This is the ExecuTorch half of D125489522, split out so that ExecuTorch owners can review it on its own. The Helios half (removing the Helios-side duplicated-output splitter that this change makes unnecessary) stays in D125489522, stacked on top. fbcode and xplat copies are identical.

 {F2001970137}

Differential Revision: D127072149
@ThomasJannaud
ThomasJannaud force-pushed the export-D127072149 branch 2 times, most recently from 206f7ce to 50b94d4 Compare October 23, 2026 21:52
ThomasJannaud added a commit to ThomasJannaud/executorch that referenced this pull request Oct 23, 2026
…24105)

Summary:

Problem
`ExportGraphSignature.buffers_to_mutate` and `user_inputs_to_mutate` index writes by output node name. No-op folding and CSE can merge two writes into one node, so one of the mutation entries is lost from the signature.

Solution
Rebuild the signature from `output_specs` (`_get_updated_graph_signature` in `exir/_program_utils.py`). Copy a computed result only when two writes collide in the same mutation map, and keep positional user outputs and ordinary graph uses shared. Select ATen, edge or dim-order cloning from the program's verifier. Preserve value/debug metadata and FX provenance on the copies without inheriting allocation or custom-kernel placement annotations. Mutation output copies keep independent storage, as required by the existing output pointer contract.

This is the ExecuTorch half of D125489522, split out so that ExecuTorch owners can review it on its own. The Helios half (removing the Helios-side duplicated-output splitter that this change makes unnecessary) stays in D125489522, stacked on top. fbcode and xplat copies are identical.

 {F2001970137}

Differential Revision: D127072149
@pytorch-bot
pytorch-bot Bot deployed to upload-benchmark-results October 24, 2026 12:42 Active
Summary:
Problem
External constants can be represented by an integer address rather than a host pointer. Treating both representations as a directly accessible pointer can dereference an invalid address or accept a truncated/overflowing extent.

Solution
Distinguish pointer-backed and address-backed `FreeableBuffer` storage in the tensor parser, validate requested ranges and resolve address-backed storage through the loader. Keep fbcode/xplat mirrors and dual-address loader regressions together.

Dependencies and priority
Generic loader correctness change; independent of the mask, embedding splitting and hybrid optimizations. Shared resident views consume it.
P0 for address-backed loading correctness.

History provenance
Resolve local external tensor data through checked pointer or integer addresses. Preserve both mirrored parsers and keep pointer-backed, overflow, short-storage, and shared `FlatTensor` loader regressions together.

Differential Revision: D125508895
…24105)

Summary:

Problem
`ExportGraphSignature.buffers_to_mutate` and `user_inputs_to_mutate` index writes by output node name. No-op folding and CSE can merge two writes into one node, so one of the mutation entries is lost from the signature.

Solution
Rebuild the signature from `output_specs` (`_get_updated_graph_signature` in `exir/_program_utils.py`). Copy a computed result only when two writes collide in the same mutation map, and keep positional user outputs and ordinary graph uses shared. Select ATen, edge or dim-order cloning from the program's verifier. Preserve value/debug metadata and FX provenance on the copies without inheriting allocation or custom-kernel placement annotations. Mutation output copies keep independent storage, as required by the existing output pointer contract.

This is the ExecuTorch half of D125489522, split out so that ExecuTorch owners can review it on its own. The Helios half (removing the Helios-side duplicated-output splitter that this change makes unnecessary) stays in D125489522, stacked on top. fbcode and xplat copies are identical.

 {F2001970137}

Differential Revision: D127072149
@pytorch-bot
pytorch-bot Bot deployed to upload-benchmark-results October 24, 2026 17:22 Active
@pytorch-bot
pytorch-bot Bot deployed to upload-benchmark-results October 24, 2026 20:39 Active

This branch was successfully deployed

1 active deployment
upload-benchmark-results — 63a1c003 Deployed Oct 24, 2026 by pytorch-bot[bot] via upload-benchmark-results #21279
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/android Trigger Android CI ciflow/cuda ciflow/metal ciflow/mlx ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants