Commit d4f77e5
Re land asset management (#14768)
Summary:
This re-lands #13560
To see changes from first attempt, see 16ff41b...428c1c4
Several notable changes:
1. In the original PR, we removed a backup path where if the transaction to store the compiled asset fails, the prediction could still succeed (https://github.com/pytorch/executorch/pull/13560/files#r2289523798). This is restored here: 16ff41b...428c1c4#diff-ce24872f2e45ee7bf53f50b319b8f77f2f340b01b0889748deaaa754084d4fefR495-R509
2. We add new logic to re-create the asset directory if needed inside _storeAssetAtURL: 16ff41b...428c1c4#diff-4178f5b6716f52c9cb12ee99be51a9d69d3ed0e4609e9afb0429571cf9cf84a3R468
3. We add new logic to re-create the trash directory if needed inside moveItemAtURLToTrash (16ff41b...428c1c4#diff-4178f5b6716f52c9cb12ee99be51a9d69d3ed0e4609e9afb0429571cf9cf84a3R432). Previously this function was called move_to_directory.
4. The previous code had a nested transaction inside _storeAssetAtURL (because _removeAssetAtURL also starts a transaction). We remove the nested transaction by passing in alreadyInsideTransaction to _removeAssetAtURL).
5. We add new NSFileProtectionCompleteUntilFirstUserAuthentication to our directories and database files.
In addition to the above changes, we cleaned up some code:
1. The function create_directory_if_needed is removed from backend_delegate.mm: 16ff41b...428c1c4#diff-89543b8e2fe49bec8243d18801819bc2594e86d60af8823c03ac2c3e6fc7607dL48. An equivalent function exists in the asset manager.
2. Introduced loadModelWithCompiledAsset and use it rather than using loadModelWithContentsOfURL (16ff41b...428c1c4#diff-ce24872f2e45ee7bf53f50b319b8f77f2f340b01b0889748deaaa754084d4fefL585)
Reviewed By: mergennachin
Differential Revision: D83893376
Pulled By: metascroy1 parent 06ea3d6 commit d4f77e5
File tree
6 files changed
+372
-189
lines changed- backends/apple/coreml/runtime/delegate
6 files changed
+372
-189
lines changedLines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
102 | 113 | | |
103 | 114 | | |
104 | 115 | | |
| |||
117 | 128 | | |
118 | 129 | | |
119 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
120 | 137 | | |
121 | 138 | | |
122 | 139 | | |
| |||
0 commit comments