Switch to serialize_xnnpack_binary for perf gain (#1544)
Summary: Pull Request resolved: https://github.com/pytorch/executorch/pull/1544 In this diff, we switch the serialization method from `convert_to_flatbuffer` to `serialize_xnnpack_binary` This change now switches the way constant data is serialized by moving constant data out of the flatbuffer, and using the XNNHeader to manage the constant data after the flatbuffer payload. This offers significant serialization speed up as we can now avoid converting large amounts of byte data to json before serializing for flatbuffer. Some timing data with the ~300mb Test Model introduced below: ``` convert_to_flatbuffer: 121.3371160030365 sec serialize_xnnpack_binary: 0.7753796577453613 sec ``` Delegating a 1gb Test model: ``` convert_to_flatbuffer: 16523.1796875 MB serialize_xnnpack_binary: 9026.05859375 MB ``` Reviewed By: digantdesai Differential Revision: D52556132 fbshipit-source-id: cd9194f38278c61525646b4633e1bd6132f6e15f
M
Max Ren committed
4d7e25bf0f47db80037d3a8174b6e2b8bc051105
Parent: a8da94a
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
on 1/12/2024, 1:41:15 AM