Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/23395
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 25e467e with merge base 0b3d26d ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
metascroy
force-pushed
the
coreai-v2/06-pte-inspect
branch
from
October 4, 2026 19:48
7094d5e to
f69015e
Compare
metascroy
force-pushed
the
coreai-v2/07-cache-clear
branch
from
October 4, 2026 19:48
4ab2733 to
d83126b
Compare
Summary:
Add public APIs to clear Core AI cache state, either for a whole assets root
or for the models referenced by one PTE.
- `runtime/coreai_cache.{h,mm}`:
- `clear_cache(coreai_assets_dir)` clears every keyed entry in an explicit
assets root.
- `clear_cache_for_pte(loader, dir)` and `clear_cache_for_pte(pte_path, dir)`
clear only the entries for the current platform and architecture that the
PTE's Core AI delegates reference. They find those delegates with
`inspect_coreai_pte`, so no Program/Method is constructed and no Core AI
assets are materialized. Every selected manifest is validated before any
key is cleared. A null directory selects the backend's default root.
- Per key, clearing preflights the staged source tree, evicts the SDK entry,
removes staging, then removes the bookmark. The bookmark is kept until
staging removal succeeds so a failed clear can be retried. SDK errors other
than confirmed absence preserve the key's files. Keys are processed in
sorted order and the first error is returned. Each removal syncs the
directory it changed. Missing roots and entries are no-ops.
- Everything under a keyed `staging/<key>` directory belongs to the backend
and is removed with that key. Outside keyed entries, PTEs, other files, lock
files and unkeyed temporaries are never removed.
- Supporting changes: descriptor-relative keyed staging removal in
`coreai_storage`, bookmark inventory and removal in `coreai_bookmarks`, and
SDK eviction plus per-key clearing in `coreai_load_coordinator`.
- Tests: cache-clearing and eviction suites in `coreai_host_test`.
`coreai_runtime_smoke` also links every public cache-clearing overload.
- README: "Clearing cached assets".
Callers must unload affected models and stop concurrent loads, inference and
maintenance until these calls return. Per-key locks are not a whole-root
barrier.
No changes outside `backends/apple/coreai`.
Test Plan:
```
# Local: configure and build only
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_DEPLOYMENT_TARGET=27.0 -DEXECUTORCH_BUILD_COREAI=ON \
-DEXECUTORCH_BUILD_TESTS=ON -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON
cmake --build build --target backends/apple/coreai/all
# CI (macOS 27 runner, .github/workflows/coreai.yml)
ctest --test-dir build/backends/apple/coreai --output-on-failure --no-tests=error
```
CTest runs `coreai_host_test` (adding the cache-clearing and eviction suites),
`coreai_swift_bridge_test` and `coreai_runtime_smoke`.
metascroy
force-pushed
the
coreai-v2/07-cache-clear
branch
from
October 5, 2026 03:14
d83126b to
25e467e
Compare
metascroy
force-pushed
the
coreai-v2/06-pte-inspect
branch
from
October 5, 2026 03:14
f69015e to
011fb30
Compare
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds public APIs to clear Core AI cache state, either for a whole assets root or for the models referenced by one PTE (
runtime/coreai_cache.{h,mm}).clear_cache(coreai_assets_dir)clears every keyed entry in an explicit assets root.clear_cache_for_pte(loader, dir)andclear_cache_for_pte(pte_path, dir)clear only the entries for the current platform and architecture that the PTE's Core AI delegates reference. They find those delegates withinspect_coreai_pte, so no Program/Method is constructed and no assets are materialized. Every selected manifest is validated before any key is cleared. A null directory selects the backend's default root.staging/<key>directory belongs to the backend. Outside keyed entries, PTEs, other files, lock files and unkeyed temporaries are never removed.coreai_storage, bookmark inventory/removal incoreai_bookmarks, and SDK eviction plus per-key clearing incoreai_load_coordinator.coreai_host_test;coreai_runtime_smokealso links every public cache-clearing overload.No changes outside
backends/apple/coreai.Stack: 9 of 9, based on #23394. Review only this PR's commit.
Test plan: built locally for macOS 27.0;
ctest -Nlistscoreai_host_test,coreai_swift_bridge_testandcoreai_runtime_smoke, which the Core AI workflow runs on the macOS 27 runner.lintrunneris clean.