Repository navigation
Commit 2cd8f26
authored
Stop reading a backend config field that no longer exists (pytorch#22298)
## Summary
The code fix this pull request opened with has since landed on main
separately, so what is left here is
the test that keeps it from coming back.
The bug: exporting llama for Core ML failed before it started, because
the branch selecting the Core ML
lowering read a backend config field that no longer existed.
```
AttributeError: 'BackendConfig' object has no attribute 'mps'
```
`or` short-circuits, so this raised only when Vulkan was off. Core ML
alone and Core ML with QNN
raised; Core ML with Vulkan did not, because the first term was already
true.
## What is in this change now
Three tests, one per route through that branch, with the lowering
patched so they need no macOS and no
coremltools:
| case | routes to |
| --- | --- |
| Core ML alone | the Core ML lowering |
| Core ML with QNN | the combined lowering, QNN partitioner kept |
| Core ML with Vulkan | the combined lowering, Vulkan partitioner kept |
The second and third cases matter on their own. The exclusion clause
exists to keep those two
partitioners, and the Core ML lowering takes neither as an argument, so
routing there would drop them
in silence. Both cases assert the backend flags actually reach the
shared lowering, since a call count
cannot see them.
The mutation matrix is complete:
```
drop the vulkan term the Vulkan case fails
drop the qnn term the QNN case fails
delete the whole clause both combined cases fail
restore the removed field both Core ML cases fail
```
The model preparation is stubbed, because routing is decided before the
model is touched. That takes
the three cases from about 4.3 GB of peak memory to 420 MB. The KV cache
is pinned off with a comment
saying why: with it on, the source transforms import the Qualcomm SDK,
which routing does not need.
## Test plan
All three pass against main as it stands now, and each fails on the
mutation named above.1 parent 2b3a32d commit 2cd8f26
1 file changed
Lines changed: 55 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
44 | 99 | | |
45 | 100 | | |
46 | 101 | | |
| |||
0 commit comments