Skip to content

[CoreML Backend] Optimize memory when exporting. #2341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

cymbalrush
Copy link
Contributor

@cymbalrush cymbalrush commented Mar 11, 2024

CoreML delegate when converting the mlpackage to an in-memory representation reads the directory contents in the mlpackage directory and writes it to a memory buffer this is expensive and the copying is not required.

The change in the PR addresses by memory mapping the file contents to fixed addresses in the allocated memory, no memory is dirtied and the OS will bring the pages only when the bytes are read.

Copy link

pytorch-bot bot commented Mar 11, 2024

🔗 Helpful Links

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

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

❌ 1 New Failure

As of commit c418ec4 with merge base 2458717 (image):

NEW FAILURE - The following job has failed:

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

@facebook-github-bot facebook-github-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 Mar 11, 2024
@cymbalrush cymbalrush force-pushed the coreml_export_optimize_memory branch from 3f0fbff to 8a224c6 Compare March 11, 2024 06:07
@cymbalrush cymbalrush marked this pull request as draft March 11, 2024 21:27
@cymbalrush cymbalrush force-pushed the coreml_export_optimize_memory branch from 8a224c6 to f010dc6 Compare March 16, 2024 05:54
@cymbalrush cymbalrush marked this pull request as ready for review March 16, 2024 06:00
@cymbalrush cymbalrush force-pushed the coreml_export_optimize_memory branch from f010dc6 to 9acd21e Compare March 16, 2024 06:04
@cymbalrush cymbalrush changed the title Optimize memory when exporting. [CoreML Backend] Optimize memory when exporting. Mar 17, 2024
@facebook-github-bot
Copy link
Contributor

@shoumikhin has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@cymbalrush cymbalrush force-pushed the coreml_export_optimize_memory branch 2 times, most recently from 9566034 to 4d6922f Compare March 17, 2024 18:08
@facebook-github-bot
Copy link
Contributor

@shoumikhin has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@cymbalrush cymbalrush force-pushed the coreml_export_optimize_memory branch from 4d6922f to c418ec4 Compare March 17, 2024 19:45
@facebook-github-bot
Copy link
Contributor

@shoumikhin has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@shoumikhin merged this pull request in b3456eb.

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. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants