Skip to content

[CoreAI] Record file sizes and bundle digests in the delegate manifest - #23316

Merged
metascroy merged 1 commit into
mainfrom
coreai-v2/00b-asset-digests
Oct 1, 2026
Merged

metascroy merged 1 commit into
mainfrom
coreai-v2/00b-asset-digests

Conversation

@metascroy

Copy link
Copy Markdown
Contributor

The Core AI runtime checks the payloads it reads against the manifest and keys its asset cache on bundle contents. This PR records both in the delegate manifest.

  • Asset metadata (compiler/preprocess.py): the new _asset_metadata walks the staged bundles (model.aimodel or model.<arch>.aimodelc) and returns:
    • files: each file's path relative to the asset root, mapped to its byte size. This replaces the previous inline-only list of paths.
    • bundle_digests: one SHA-256 per bundle, over a fixed prefix, the file count, and each file's path length, path, size and bytes in UTF-8 path order.
  • _deliver merges this metadata into the manifest before choosing a delivery, so every delivery reports identical metadata.
  • Tests (test_preprocess.py):
    • AssetMetadataTest checks that files exactly covers the delivered files and sizes, with one digest per bundle, for source and AOT.
    • A second test checks that changing a file's bytes changes its digest when the size stays the same.
    • The real-toolchain AOT sidecar test no longer greps the .pte for a compiled filename, which now appears in the manifest by design. Its named_data_store_output is None check still covers "contents not embedded".

Test plan: python -m pytest backends/apple/coreai gives 125 passed (coreai-core 1.0.0b3, coreai-torch 0.4.3).

Summary:
List every delivered file with its byte size, and a SHA-256 digest per bundle,
in the delegate manifest for both inline and sidecar delivery, so a runtime can
check the payloads it reads and key its cache on bundle contents. The digest
covers a fixed prefix, the file count, and each file's path, size and bytes in
UTF-8 path order. `files` changes from a list of paths (inline only) to a map
of path to size.

Test Plan:
```
python -m pytest backends/apple/coreai
```
126 passed (coreai-core 1.0.0b3, coreai-torch 0.4.3).
@pytorch-bot

pytorch-bot Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/23316

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 57d9517 with merge base 273ecf9 (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 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@metascroy
metascroy marked this pull request as ready for review October 1, 2026 17:26
@metascroy
metascroy requested a review from shoumikhin as a code owner October 1, 2026 17:26
@metascroy
metascroy requested a review from SS-JIA October 1, 2026 17:27
@metascroy
metascroy merged commit 4c3d3bd into main Oct 1, 2026
236 of 239 checks passed
@metascroy
metascroy deleted the coreai-v2/00b-asset-digests branch October 1, 2026 18:56

This branch was successfully deployed

1 active deployment
cadence — 57d9517a Deployed Oct 1, 2026 by metascroy via hifi-op-test / hifi4 #30869
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.

2 participants