Skip to content

[CoreAI] Coordinate model acquisition - #23392

Draft
metascroy wants to merge 1 commit into
coreai-v2/04-sdk-bridgefrom
coreai-v2/05a-load-coordinator
Draft

metascroy wants to merge 1 commit into
coreai-v2/04-sdk-bridgefrom
coreai-v2/05a-load-coordinator

Conversation

@metascroy

@metascroy metascroy commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

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_model restores 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.
  • Restore errors fail without a source fallback. Sources and SDK pins are retained across completion.
  • The backend that uses this lands in the next PR.
  • Tests:
    • An acquisition-only fake SDK loader (runtime/test/coreai_fake_loader.{h,mm}) runs the coordinator in coreai_host_test without Swift or CoreAI.
    • The acquisition suite calls acquire_bookmark_model directly: 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.
  • README: the "Asset storage" acquisition flow.

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 -N lists coreai_host_test and coreai_swift_bridge_test, which the Core AI workflow runs on the macOS 27 runner. lintrunner is clean.

@pytorch-bot

pytorch-bot Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

🔗 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

As of commit 1beeef8 with merge base 0b3d26d (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 3, 2026
@metascroy
metascroy force-pushed the coreai-v2/05a-load-coordinator branch from 2f63441 to 12fd39f Compare October 4, 2026 19:48
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:
```
# 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 acquisition suite) and
`coreai_swift_bridge_test`.
@metascroy
metascroy force-pushed the coreai-v2/04-sdk-bridge branch from dae7df4 to 756e906 Compare October 5, 2026 03:14
@metascroy
metascroy force-pushed the coreai-v2/05a-load-coordinator branch from 12fd39f to 1beeef8 Compare October 5, 2026 03:14

This branch was successfully deployed

1 active deployment
cadence — 1beeef8f Deployed Oct 5, 2026 by metascroy via hifi-op-test / hifi4 #31512
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant