Repository navigation
Commit b5aaeee
authored
[CoreAI] Reject mutated user inputs at lowering (pytorch#23317)
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.1 parent 4c3d3bd commit b5aaeee
2 files changed
Lines changed: 23 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
603 | 603 | | |
604 | 604 | | |
605 | 605 | | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
606 | 612 | | |
607 | 613 | | |
608 | 614 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| |||
299 | 302 | | |
300 | 303 | | |
301 | 304 | | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
| 305 | + | |
307 | 306 | | |
308 | 307 | | |
309 | 308 | | |
310 | 309 | | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
311 | 322 | | |
312 | 323 | | |
313 | 324 | | |
0 commit comments