Skip to content

[CoreAI] Reject mutated user inputs at lowering - #23317

Merged
metascroy merged 2 commits into
mainfrom
coreai-v2/00c-mutated-inputs
Oct 1, 2026
Merged

metascroy merged 2 commits into
mainfrom
coreai-v2/00c-mutated-inputs

Conversation

@metascroy

Copy link
Copy Markdown
Contributor

ExecuTorch owns user inputs, so a Core AI delegate can never take over their in-place mutation. coreai-torch lowers such a mutation to Core AI state, which leaves the .aimodel boundary unable to match what ExecuTorch passes in.

  • CoreAIBackend.preprocess now raises before conversion when the program mutates a user input: Core AI delegates cannot mutate ExecuTorch-owned user inputs: [...].
  • Mutated buffers that the delegate owns are unaffected.
  • Tests (test_io_compat.py):
    • test_mutated_user_input_is_rejected lowers a model that mutates its input and expects the error.
    • The MutableBufferBoundaryTest docstring now describes the current behavior.

Test plan: python -m pytest backends/apple/coreai gives 126 passed.

Summary:
List every delivered file with its byte size, and a SHA-256 digest per bundle,
in the delegate manifest for both inline and sidecar delivery, so a runtime can
check the payloads it reads and key its cache on bundle contents. The digest
covers a fixed prefix, the file count, and each file's path, size and bytes in
UTF-8 path order. `files` changes from a list of paths (inline only) to a map
of path to size.

Test Plan:
```
python -m pytest backends/apple/coreai
```
126 passed (coreai-core 1.0.0b3, coreai-torch 0.4.3).
Summary:
ExecuTorch owns user inputs, so a Core AI delegate can never take over their
in-place mutation. `CoreAIBackend.preprocess` now rejects a delegate whose
program mutates a user input, naming the inputs, before conversion. Mutated
buffers the delegate owns are unaffected.

Test Plan:
```
python -m pytest backends/apple/coreai
```
126 passed (coreai-core 1.0.0b3, coreai-torch 0.4.3).
@pytorch-bot

pytorch-bot Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⏳ No Failures, 1 Pending

As of commit d47e711 with merge base 273ecf9 (image):
💚 Looks good so far! There are no failures yet. 💚

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 1, 2026
@metascroy
metascroy marked this pull request as ready for review October 1, 2026 17:27
@metascroy
metascroy requested a review from shoumikhin as a code owner October 1, 2026 17:27
@metascroy
metascroy requested a review from SS-JIA October 1, 2026 17:27
Base automatically changed from coreai-v2/00b-asset-digests to main October 1, 2026 18:56
@metascroy
metascroy merged commit b5aaeee into main Oct 1, 2026
230 of 232 checks passed
@metascroy
metascroy deleted the coreai-v2/00c-mutated-inputs branch October 1, 2026 18:57

This branch was successfully deployed

1 active deployment
cadence — d47e711f Deployed Oct 1, 2026 by metascroy via hifi-op-test / hifi4 #30870
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.

2 participants