Skip to content

Channels last: preserve metadata across op replacement - #21923

Draft
rascani wants to merge 1 commit into
gh/rascani/1/basefrom
gh/rascani/1/head
Draft

Channels last: preserve metadata across op replacement#21923
rascani wants to merge 1 commit into
gh/rascani/1/basefrom
gh/rascani/1/head

Conversation

@rascani

@rascani rascani commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Preserve the complete metadata dictionary when replacing an ATen operator with its channels-last dialect counterpart. ExportPass retracing recomputes layout-dependent shape fields such as val and tensor_meta, while source attribution and backend annotations such as debug_handle, from_node, input_qparams, output_qparams, and custom metadata survive the rewrite.

Document the remaining caller contract in terms of every input and output listed by ChannelsLastOpSpec. Semantic metadata tied to a permuted dimension, such as a per-channel quantization axis, must be rejected or remapped by the backend before replacement. This keeps provenance preservation as the default without implying that a metadata allowlist validates layout semantics.

Keep structural-layout helper definitions out of this change; the following optimizer Diff introduces them when they gain multiple consumers. Convert the existing Buck test target to pytest-aware discovery and add coverage for provenance survival together with recomputed NHWC output shape.

Differential Revision: D116372280

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 3 New Failures

As of commit 06f4f6d with merge base ed2d9ec (image):

NEW FAILURES - The following jobs have failed:

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.

@rascani
rascani marked this pull request as draft August 18, 2026 23:07
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