Support int8 texture tensors without requiring int8 buffers (#4485)
Summary: Pull Request resolved: https://github.com/pytorch/executorch/pull/4485 ## Context By default, storage buffers in Vulkan must contain 32 bit data types; using 8 bit and 16 bit data types in buffers can be enabled optionally by supporting the [VK_KHR_8bit_storage](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_8bit_storage.html) extension or the [VK_KHR_16bit_storage](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_16bit_storage.html) extension respectively. Previously, 8-bit and 16-bit tensors were enabled by using those extensions; however, this meant that 8-bit and 16-bit tensors could not be used if the Vulkan driver does not support the corresponding extension. This diff adds support for 8-bit texture-backed tensors without the need for the VK_KHR_8bit_storage extension. This is done by introducing shaders that manually pack and repack 4 8-bit integers into a single int32 value. Once the tensor data has been transferred to an image texture (which will use the `VK_FORMAT_R8G8B8A8_SINT` image format) the extension will no longer be required. Reviewed By: jorgep31415 Differential Revision: D60536832 fbshipit-source-id: 8d3d8b069582ab8c18d41701c864778621d2f6e3
S
Stephen Jia committed
448c7d3c07125c1f13e24ff81de7473a6a446916
Parent: 4483bb6
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
on 8/2/2024, 5:43:16 PM