Speed up named data map + add uint32 support#17257
Speed up named data map + add uint32 support#17257meta-codesync[bot] merged 1 commit intopytorch:mainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17257
Note: Links to docs will display an error until the docs builds have been completed. ❌ 6 New Failures, 2 Pending, 2 Unrelated FailuresAs of commit 4211221 with merge base fdb386c ( NEW FAILURES - The following jobs have failed:
BROKEN TRUNK - The following jobs failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@metascroy has exported this pull request. If you are a Meta employee, you can view the originating Diff in D92447071. |
This PR needs a
|
Summary: his diff significantly speeds up named data map insertion by switching from bytes(tensor.untyped_storage()) to tensor.numpy().tobytes() for converting tensors to bytes. The new _tensor_to_bytes() helper function provides a much faster conversion path, which should noticeably improve XNNPACK and Vulkan lowering times since these backends heavily use the named data store during serialization. Additionally, this diff adds torch.uint32 to the ScalarType mapping, enabling support for unsigned 32-bit integer tensors in ExecuTorch. Changes: _named_data_store.py: Added _tensor_to_bytes() helper that uses numpy().tobytes() for fast tensor-to-bytes conversion, with special handling for bfloat16 (which numpy doesn't support natively) tensor.py: Added torch.uint32 → ScalarType.UINT32 mapping Reviewed By: GregoryComer Differential Revision: D92447071
fbed243 to
b4baf16
Compare
Summary: his diff significantly speeds up named data map insertion by switching from bytes(tensor.untyped_storage()) to tensor.numpy().tobytes() for converting tensors to bytes. The new _tensor_to_bytes() helper function provides a much faster conversion path, which should noticeably improve XNNPACK and Vulkan lowering times since these backends heavily use the named data store during serialization. Additionally, this diff adds torch.uint32 to the ScalarType mapping, enabling support for unsigned 32-bit integer tensors in ExecuTorch. Changes: _named_data_store.py: Added _tensor_to_bytes() helper that uses numpy().tobytes() for fast tensor-to-bytes conversion, with special handling for bfloat16 (which numpy doesn't support natively) tensor.py: Added torch.uint32 → ScalarType.UINT32 mapping Reviewed By: GregoryComer Differential Revision: D92447071
b4baf16 to
4211221
Compare
Summary:
his diff significantly speeds up named data map insertion by switching from bytes(tensor.untyped_storage()) to tensor.numpy().tobytes() for converting tensors to bytes. The new _tensor_to_bytes() helper function provides a much faster conversion path, which should noticeably improve XNNPACK and Vulkan lowering times since these backends heavily use the named data store during serialization.
Additionally, this diff adds torch.uint32 to the ScalarType mapping, enabling support for unsigned 32-bit integer tensors in ExecuTorch.
Changes:
_named_data_store.py: Added _tensor_to_bytes() helper that uses numpy().tobytes() for fast tensor-to-bytes conversion, with special handling for bfloat16 (which numpy doesn't support natively)
tensor.py: Added torch.uint32 → ScalarType.UINT32 mapping
Differential Revision: D92447071