pytorch/caffe2/serialize
Dhruv Matani 725d98bab6 [Prototype] [PyTorch Edge] Speed up model loading by 12% by directly calling the C file API from FileAdapter (#61997)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/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

Test Plan: See the AI Bench links above.

Reviewed By: raziel

Differential Revision: D29812191

fbshipit-source-id: 57810fdc1ac515305f5504f88ac5e9e4319e9d28
2021-07-29 20:14:49 -07:00
..
CMakeLists.txt [JIT] Make new zip serialization for torch save/load significantly (~70%) faster (#38379) 2020-05-29 01:56:18 -07:00
crc_alt.h Avoid redefining __BYTE_ORDER (#60346) 2021-07-14 14:55:04 -07:00
crc.cc Forbid trailing whitespace (#53406) 2021-03-05 17:22:55 -08:00
file_adapter.cc [Prototype] [PyTorch Edge] Speed up model loading by 12% by directly calling the C file API from FileAdapter (#61997) 2021-07-29 20:14:49 -07:00
file_adapter.h [Prototype] [PyTorch Edge] Speed up model loading by 12% by directly calling the C file API from FileAdapter (#61997) 2021-07-29 20:14:49 -07:00
inline_container_test.cc Disable avoid-non-const-global-variables lint check (#62008) 2021-07-22 18:04:40 -07:00
inline_container.cc ban PyTorchStreamWriter from writing the same file twice (#61805) 2021-07-19 18:23:43 -07:00
inline_container.h ban PyTorchStreamWriter from writing the same file twice (#61805) 2021-07-19 18:23:43 -07:00
istream_adapter.cc Make PyTorch code-base clang-tidy compliant (#56892) 2021-04-28 14:10:25 -07:00
istream_adapter.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
read_adapter_interface.cc Make PyTorch code-base clang-tidy compliant (#56892) 2021-04-28 14:10:25 -07:00
read_adapter_interface.h Renaming CAFFE2_API to TORCH_API (#49496) 2020-12-18 10:54:50 -08:00
versions.h Enable implicit operator versioning via number of arguments (#58852) 2021-06-15 02:07:40 -07:00