Skip to content

[Prototype] [PyTorch Edge] Speed up model loading by 12% by directly calling the C file API from FileAdapter #61997

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
wants to merge 8 commits into from

Conversation

dhruvbird
Copy link
Contributor

@dhruvbird dhruvbird commented Jul 21, 2021

Stack from ghstack:

After profiling the model loading latency on AI Bench (Android Galaxy S8 US), it seems like a significant amount of time was spent reading data using FileAdapter, which internally calls IStreamAdapter. However, IStreamAdapter uses std::istream under the hood, which is not that efficient. This change reduces the model loading time from ~293ms to ~254ms, which is a reduction of ~12%.

Differential Revision: D29812191

…calling the C file API from FileAdapter

After profiling the model loading latency on AI Bench (Android Galaxy S8 US), it seems like a significant amount of time was spent reading data using FileAdapter, which internally calls IStreamAdapter. However, IStreamAdapter uses `std::istream` under the hood, which is not that efficient. This change reduces the model loading time from [~293ms](https://www.internalfb.com/intern/aibench/details/600870874797229) to [~254ms](https://www.internalfb.com/intern/aibench/details/163731416457694), which is a reduction of ~12%.

Differential Revision: [D29812191](https://our.internmc.facebook.com/intern/diff/D29812191/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Jul 21, 2021

🔗 Helpful links

💊 CI failures summary and remediations

As of commit 19c3dfc (more details on the Dr. CI page):


💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

…y directly calling the C file API from FileAdapter"

After profiling the model loading latency on AI Bench (Android Galaxy S8 US), it seems like a significant amount of time was spent reading data using FileAdapter, which internally calls IStreamAdapter. However, IStreamAdapter uses `std::istream` under the hood, which is not that efficient. This change reduces the model loading time from [~293ms](https://www.internalfb.com/intern/aibench/details/600870874797229) to [~254ms](https://www.internalfb.com/intern/aibench/details/163731416457694), which is a reduction of ~12%.

Differential Revision: [D29812191](https://our.internmc.facebook.com/intern/diff/D29812191/)

[ghstack-poisoned]
…y directly calling the C file API from FileAdapter"

After profiling the model loading latency on AI Bench (Android Galaxy S8 US), it seems like a significant amount of time was spent reading data using FileAdapter, which internally calls IStreamAdapter. However, IStreamAdapter uses `std::istream` under the hood, which is not that efficient. This change reduces the model loading time from [~293ms](https://www.internalfb.com/intern/aibench/details/600870874797229) to [~254ms](https://www.internalfb.com/intern/aibench/details/163731416457694), which is a reduction of ~12%.

Differential Revision: [D29812191](https://our.internmc.facebook.com/intern/diff/D29812191/)

[ghstack-poisoned]
…y directly calling the C file API from FileAdapter"

After profiling the model loading latency on AI Bench (Android Galaxy S8 US), it seems like a significant amount of time was spent reading data using FileAdapter, which internally calls IStreamAdapter. However, IStreamAdapter uses `std::istream` under the hood, which is not that efficient. This change reduces the model loading time from [~293ms](https://www.internalfb.com/intern/aibench/details/600870874797229) to [~254ms](https://www.internalfb.com/intern/aibench/details/163731416457694), which is a reduction of ~12%.

Differential Revision: [D29812191](https://our.internmc.facebook.com/intern/diff/D29812191/)

[ghstack-poisoned]
dhruvbird added a commit that referenced this pull request Jul 23, 2021
…calling the C file API from FileAdapter

Pull Request resolved: #61997

After profiling the model loading latency on AI Bench (Android Galaxy S8 US), it seems like a significant amount of time was spent reading data using FileAdapter, which internally calls IStreamAdapter. However, IStreamAdapter uses `std::istream` under the hood, which is not that efficient. This change reduces the model loading time from [~293ms](https://www.internalfb.com/intern/aibench/details/600870874797229) to [~254ms](https://www.internalfb.com/intern/aibench/details/163731416457694), which is a reduction of ~12%.
ghstack-source-id: 134206924

Differential Revision: [D29812191](https://our.internmc.facebook.com/intern/diff/D29812191/)
…y directly calling the C file API from FileAdapter"

After profiling the model loading latency on AI Bench (Android Galaxy S8 US), it seems like a significant amount of time was spent reading data using FileAdapter, which internally calls IStreamAdapter. However, IStreamAdapter uses `std::istream` under the hood, which is not that efficient. This change reduces the model loading time from [~293ms](https://www.internalfb.com/intern/aibench/details/600870874797229) to [~254ms](https://www.internalfb.com/intern/aibench/details/163731416457694), which is a reduction of ~12%.

Differential Revision: [D29812191](https://our.internmc.facebook.com/intern/diff/D29812191/)

[ghstack-poisoned]
dhruvbird added a commit that referenced this pull request Jul 23, 2021
…calling the C file API from FileAdapter

Pull Request resolved: #61997

After profiling the model loading latency on AI Bench (Android Galaxy S8 US), it seems like a significant amount of time was spent reading data using FileAdapter, which internally calls IStreamAdapter. However, IStreamAdapter uses `std::istream` under the hood, which is not that efficient. This change reduces the model loading time from [~293ms](https://www.internalfb.com/intern/aibench/details/600870874797229) to [~254ms](https://www.internalfb.com/intern/aibench/details/163731416457694), which is a reduction of ~12%.
ghstack-source-id: 134223858

Differential Revision: [D29812191](https://our.internmc.facebook.com/intern/diff/D29812191/)
QYP-842653 pushed a commit to QYP-842653/Pytorch that referenced this pull request Jul 27, 2021
…calling the C file API from FileAdapter

Pull Request resolved: pytorch/pytorch#61997

After profiling the model loading latency on AI Bench (Android Galaxy S8 US), it seems like a significant amount of time was spent reading data using FileAdapter, which internally calls IStreamAdapter. However, IStreamAdapter uses `std::istream` under the hood, which is not that efficient. This change reduces the model loading time from [~293ms](https://www.internalfb.com/intern/aibench/details/600870874797229) to [~254ms](https://www.internalfb.com/intern/aibench/details/163731416457694), which is a reduction of ~12%.
ghstack-source-id: 134042630

Differential Revision: [D29812191](https://our.internmc.facebook.com/intern/diff/D29812191/)
…y directly calling the C file API from FileAdapter"

After profiling the model loading latency on AI Bench (Android Galaxy S8 US), it seems like a significant amount of time was spent reading data using FileAdapter, which internally calls IStreamAdapter. However, IStreamAdapter uses `std::istream` under the hood, which is not that efficient. This change reduces the model loading time from [~293ms](https://www.internalfb.com/intern/aibench/details/600870874797229) to [~254ms](https://www.internalfb.com/intern/aibench/details/163731416457694), which is a reduction of ~12%.

Differential Revision: [D29812191](https://our.internmc.facebook.com/intern/diff/D29812191/)

[ghstack-poisoned]
dhruvbird added a commit that referenced this pull request Jul 28, 2021
…calling the C file API from FileAdapter

Pull Request resolved: #61997

After profiling the model loading latency on AI Bench (Android Galaxy S8 US), it seems like a significant amount of time was spent reading data using FileAdapter, which internally calls IStreamAdapter. However, IStreamAdapter uses `std::istream` under the hood, which is not that efficient. This change reduces the model loading time from [~293ms](https://www.internalfb.com/intern/aibench/details/600870874797229) to [~254ms](https://www.internalfb.com/intern/aibench/details/163731416457694), which is a reduction of ~12%.
ghstack-source-id: 134489363

Differential Revision: [D29812191](https://our.internmc.facebook.com/intern/diff/D29812191/)
…y directly calling the C file API from FileAdapter"

After profiling the model loading latency on AI Bench (Android Galaxy S8 US), it seems like a significant amount of time was spent reading data using FileAdapter, which internally calls IStreamAdapter. However, IStreamAdapter uses `std::istream` under the hood, which is not that efficient. This change reduces the model loading time from [~293ms](https://www.internalfb.com/intern/aibench/details/600870874797229) to [~254ms](https://www.internalfb.com/intern/aibench/details/163731416457694), which is a reduction of ~12%.

Differential Revision: [D29812191](https://our.internmc.facebook.com/intern/diff/D29812191/)

[ghstack-poisoned]
dhruvbird added a commit that referenced this pull request Jul 28, 2021
…calling the C file API from FileAdapter

Pull Request resolved: #61997

After profiling the model loading latency on AI Bench (Android Galaxy S8 US), it seems like a significant amount of time was spent reading data using FileAdapter, which internally calls IStreamAdapter. However, IStreamAdapter uses `std::istream` under the hood, which is not that efficient. This change reduces the model loading time from [~293ms](https://www.internalfb.com/intern/aibench/details/600870874797229) to [~254ms](https://www.internalfb.com/intern/aibench/details/163731416457694), which is a reduction of ~12%.
ghstack-source-id: 134529654

Differential Revision: [D29812191](https://our.internmc.facebook.com/intern/diff/D29812191/)
…y directly calling the C file API from FileAdapter"

After profiling the model loading latency on AI Bench (Android Galaxy S8 US), it seems like a significant amount of time was spent reading data using FileAdapter, which internally calls IStreamAdapter. However, IStreamAdapter uses `std::istream` under the hood, which is not that efficient. This change reduces the model loading time from [~293ms](https://www.internalfb.com/intern/aibench/details/600870874797229) to [~254ms](https://www.internalfb.com/intern/aibench/details/163731416457694), which is a reduction of ~12%.

Differential Revision: [D29812191](https://our.internmc.facebook.com/intern/diff/D29812191/)

[ghstack-poisoned]
dhruvbird added a commit that referenced this pull request Jul 29, 2021
…calling the C file API from FileAdapter

Pull Request resolved: #61997

After profiling the model loading latency on AI Bench (Android Galaxy S8 US), it seems like a significant amount of time was spent reading data using FileAdapter, which internally calls IStreamAdapter. However, IStreamAdapter uses `std::istream` under the hood, which is not that efficient. This change reduces the model loading time from [~293ms](https://www.internalfb.com/intern/aibench/details/600870874797229) to [~254ms](https://www.internalfb.com/intern/aibench/details/163731416457694), which is a reduction of ~12%.
ghstack-source-id: 134634610

Differential Revision: [D29812191](https://our.internmc.facebook.com/intern/diff/D29812191/)
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 725d98b.

@facebook-github-bot facebook-github-bot deleted the gh/dhruvbird/54/head branch August 2, 2021 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants