Skip to content

Pool immutable integer constants during EXIR emission - #22915

Open
rascani wants to merge 1 commit into
pytorch:mainfrom
rascani:codex/integer-constant-pooling-pr
Open

rascani wants to merge 1 commit into
pytorch:mainfrom
rascani:codex/integer-constant-pooling-pr

Conversation

@rascani

@rascani rascani commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Repeated literal operator arguments allocate separate EValue slots, and integer lists also duplicate persistent boxed-list storage. Pool read-only integer literals and lists made entirely from literal integers within each execution plan, using the argument schema to exclude out and aliased values.

Preserve existing abstract values, method inputs and outputs, symbolic values, and opaque delegate arguments. Construct references with their final pooled IDs during emission so no serialization-time remapping is needed.

Add tests for type distinctions, signed 64-bit limits, list references, mutation and aliasing boundaries, plan scope, and repeated control flow. Update the keyword-argument test to follow instruction argument IDs.

Test plan

Validation: 78 emitter tests and 14 subtests passed, with two existing skips. All four trained MLPerf Tiny models produced exact before/after outputs on 67,029 Cortex-M55 FVP validation inputs. Operator calls and planned memory were unchanged, and independent re-exports were byte-identical. DS-CNN persistent method metadata decreased from 8,008 to 5,056 measured bytes.

Authored with OpenAI Codex.

Repeated literal operator arguments allocate separate EValue slots, and
integer lists also duplicate persistent boxed-list storage. Pool read-only
integer literals and lists made entirely from literal integers within each
execution plan, using the argument schema to exclude out and aliased values.

Preserve existing abstract values, method inputs and outputs, symbolic
values, and opaque delegate arguments. Construct references with their final
pooled IDs during emission so no serialization-time remapping is needed.

Add tests for type distinctions, signed 64-bit limits, list references,
mutation and aliasing boundaries, plan scope, and repeated control flow.
Update the keyword-argument test to follow instruction argument IDs.

Validation: 78 emitter tests and 14 subtests passed, with two existing skips.
All four trained MLPerf Tiny models produced exact before/after outputs on
67,029 Cortex-M55 FVP validation inputs. Operator calls and planned memory
were unchanged, and independent re-exports were byte-identical. DS-CNN
persistent method metadata decreased from 8,008 to 5,056 measured bytes.

Authored with OpenAI Codex.
@pytorch-bot

pytorch-bot Bot commented Sep 17, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 2 New Failures

As of commit 912d80d with merge base d32fa30 (image):

NEW FAILURES - The following jobs have failed:

  • Build documentation / build (buck2) / Build doc (gh)
    Could not load credentials from any providers
  • Cadence Build & Test / Resolve CI docker image / resolve (gh)
    ##[error]Refusing to check out fork pull request code from a 'pull_request_target' workflow. This workflow runs with the base repository's GITHUB_TOKEN, secrets, default-branch cache scope, and runner access. Fetching and executing a fork's code in that trusted context commonly leads to "pwn request" vulnerabilities. To opt in, review the risks at https://gh.io/securely-using-pull_request_target and set 'allow-unsafe-pr-checkout: true' on the actions/checkout step.

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 Sep 17, 2026
@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 ready for review September 17, 2026 22:36
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