Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/23392
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 2 PendingAs of commit 7872a72 with merge base 61ec450 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
2f63441 to
12fd39f
Compare
dae7df4 to
756e906
Compare
12fd39f to
1beeef8
Compare
|
@claude review this PR |
|
Claude finished @metascroy's task in 2m 41s —— View job The coordinator logic looks correct, but I'd ask for changes: the specialize-error and empty-bookmark paths have no tests, the fake loader carries unused knobs, and a repeated bookmark-save failure leaks one SDK cache entry per load attempt. Detailed reviewPR Review: #23392SummaryThis PR adds Code Quality
Testing
Performance
RecommendationRequest Changes Nothing here is a correctness bug in the coordinator. Before merging I'd ask for the missing error-path tests (specialize error, empty bookmark), the unused fake knobs to be removed or tested, and a decision on the save-failure leak. |
756e906 to
66fd8b0
Compare
1beeef8 to
61e2774
Compare
|
@claude review this code Updated head: Context on the previous findings: a fresh UUID from the fake does not establish that the SDK leaks a distinct entry on every failed bookmark save. A real-SDK experiment found that evicting the first specialization's bookmark invalidated subsequent bookmarks too, consistent with cache reuse, but not a universal guarantee. We intentionally return save errors without automatic retry or blind eviction; a post-rename flush failure can already leave a published bookmark. This revision also removes staged sources only after durable bookmark publication. Cleanup errors are returned while the bookmark remains available, without automatic eviction or retries. Real SDK regression tests on the tested macOS 27 system cover portable and AOT weighted models, live inference after source removal, fresh-process bookmark restoration, and misses after explicit eviction. This is empirical evidence, not a promise covering reboots, OS upgrades, or all devices. The missing acquisition failure-path tests and test-fixture issues were addressed. |
|
Claude finished @metascroy's task in 3m 56s —— View job The earlier findings are fixed, but I'd hold this until one new problem is settled. If staging cleanup fails partway and the SDK later misses, that model can't be loaded again, and nothing in the runtime can clear the damaged entry. Detailed reviewPR Review: #23392SummaryThis PR adds Code Quality
Infrastructure
Testing
RecommendationRequest Changes The partial-cleanup lockout is the only blocker. It makes a model permanently unloadable after one transient filesystem error plus a routine SDK cache miss, and the documented workaround ("explicitly cleared") has no API behind it. The remaining items are minor. |
66fd8b0 to
aedabbb
Compare
61e2774 to
0ac18e1
Compare
Summary:
Acquire a prepared Core AI model for a selected bundle: restore it from the
persisted bookmark, or materialize the source and specialize it.
- `runtime/coreai_load_coordinator.{h,mm}`: `acquire_bookmark_model` restores
from the persisted bookmark, or on a miss materializes the source and
specializes it with the persistent default SDK cache, then publishes the
new bookmark atomically. Restore errors fail without a source fallback.
Sources and SDK pins are retained across completion.
- Tests: an acquisition-only fake SDK loader
(`runtime/test/coreai_fake_loader.{h,mm}`) lets the coordinator run in
`coreai_host_test` without Swift or CoreAI. The acquisition suite calls
`acquire_bookmark_model` directly and covers cold specialization, warm
restores, restore errors and misses, bookmark-save failures, contention on
one key versus independent keys across processes, and a crash after the
SDK call.
- The backend that uses this lands separately.
- README: the "Asset storage" acquisition flow.
No changes outside `backends/apple/coreai`.
Test Plan:
```
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
ctest --test-dir build/backends/apple/coreai --output-on-failure --no-tests=error
```
CTest runs `coreai_host_test` (adding the acquisition suite) and
`coreai_swift_bridge_test`.
Summary: Avoid retaining redundant staged model bundles once persistent specialization and durable bookmark publication succeed. Preserve the bookmark and return cleanup failures without automatic retries or eviction, keeping warm restoration independent of staging. Tighten acquisition error coverage and test-fixture behavior. Test Plan: All three Core AI CTest suites passed on macOS 27. The source-lifetime regression verified portable and AOT model inference after source deletion, bookmark restoration in fresh processes, and a restore miss after explicit eviction. Native tests covered publication ordering, unsafe staging entries, and cleanup failures preserving durable bookmarks. The full Core AI Python suite passed: 113 tests. # Conflicts: # backends/apple/coreai/README.md # backends/apple/coreai/runtime/test/coreai_host_test.mm # backends/apple/coreai/runtime/test/export_bridge_fixture.py # Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # interactive rebase in progress; onto aedabbb # Last commands done (2 commands done): # pick 664cd4a # [CoreAI] Coordinate model acquisition # pick 61e2774 # [CoreAI] Remove staged sources after durable bookmark publication # No commands remaining. # You are currently rebasing branch 'coreai-v2/05a-load-coordinator' on 'aedabbb695'. # # Changes to be committed: # modified: backends/apple/coreai/CMakeLists.txt # modified: backends/apple/coreai/README.md # modified: backends/apple/coreai/runtime/coreai_bookmarks.h # modified: backends/apple/coreai/runtime/coreai_bookmarks.mm # modified: backends/apple/coreai/runtime/coreai_load_coordinator.mm # modified: backends/apple/coreai/runtime/coreai_storage.h # modified: backends/apple/coreai/runtime/coreai_storage.mm # new file: backends/apple/coreai/runtime/test/SDKSourceLifetimeTest.swift # modified: backends/apple/coreai/runtime/test/coreai_acquisition_fixture.h # modified: backends/apple/coreai/runtime/test/coreai_acquisition_fixture.mm # modified: backends/apple/coreai/runtime/test/coreai_acquisition_test.mm # modified: backends/apple/coreai/runtime/test/coreai_fake_loader.h # modified: backends/apple/coreai/runtime/test/coreai_fake_loader.mm # modified: backends/apple/coreai/runtime/test/coreai_host_test.mm # modified: backends/apple/coreai/runtime/test/coreai_storage_test.mm # modified: backends/apple/coreai/runtime/test/export_bridge_fixture.py # new file: backends/apple/coreai/runtime/test/test_sdk_source_lifetime.py # # Changes not staged for commit: # modified: backends/mlx/third-party/mlx (modified content) #
Rebuild damaged staged source under the key lock after a cache miss. Treat cleanup after successful restoration or durable publication as best-effort. Exercise the production bridge in lifetime probes and cover cleanup, interruption, and crash boundaries. Test Plan: CMake build and CTest passed (134 native tests, 18 Swift tests, portable and AOT lifetime probes). Full Python suite: 121 passed; updated driver tests: 7 passed. Seven recovery/crash/contention tests passed ten repetitions. Formatters, Ruff, and diff whitespace checks passed. Generic Buck owner validation failed without diagnostics.
Add key-correlated Info logs for lookup, restore hits and misses, specialization start and success, and durable bookmark publication. Keep SDK-internal reuse distinct from observable bookmark hits and cover successful and failed acquisition paths. Test Plan: All three acquisition-layer CTest targets passed with Info logging enabled, including six new lifecycle-log tests. No dependency on the later cache-clear API.
aedabbb to
7d02145
Compare
0ac18e1 to
7872a72
Compare
Acquires a prepared Core AI model for a selected bundle: restore it from the persisted bookmark, or materialize the source and specialize it (
runtime/coreai_load_coordinator.{h,mm}).acquire_bookmark_modelrestores from the persisted bookmark; on a miss it materializes the source, specializes it with the persistent default SDK cache and publishes the new bookmark atomically.runtime/test/coreai_fake_loader.{h,mm}) runs the coordinator incoreai_host_testwithout Swift or CoreAI.acquire_bookmark_modeldirectly: cold specialization, warm restores, restore errors and misses, bookmark-save failures, same-key versus independent-key contention across processes, and a crash after the SDK call.No changes outside
backends/apple/coreai.Stack: 6 of 9, based on #23391. Review only this PR's commit. Next: #23393.
Test plan: built locally for macOS 27.0;
ctest -Nlistscoreai_host_testandcoreai_swift_bridge_test, which the Core AI workflow runs on the macOS 27 runner.lintrunneris clean.