-
Notifications
You must be signed in to change notification settings - Fork 835
[ET-VK] Add nchw_to_int8x4_buffer shader for prepacking int8 staging data #17392
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
base: gh/SS-JIA/423/base
Are you sure you want to change the base?
Conversation
…data This adds a GLSL compute shader and supporting C++ dispatch logic to transfer int8 tensor data from a staging buffer (in NCHW contiguous order) to a GPU buffer in any PackedInt8 layout (4W, 4C, 4W4C, 4H4W, 4C1W). Previously there was no prepack path for kInt8x4 tensors, so constant int8 tensors (TensorRef inputs) could not be transferred to GPU buffers. This is needed to support constant quantized weights in q8ta operators. The shader uses texel-level dispatch where each thread writes one texel (one int32 = 4 packed int8 values). It decomposes the texel index into block-space coordinates using BufferMetadata strides and hashed_layout dim_order, then reads the corresponding int8 bytes from the staging buffer (interpreted as int32 for device compatibility, avoiding the need for 8-bit buffer support). New files: - nchw_to_int8x4_buffer.glsl: Compute shader handling all PackedInt8 layouts - nchw_to_int8x4_buffer.yaml: Shader variant config - Q8taStaging.h/cpp: C++ dispatch function creating the PrepackNode Modified files: - Staging.cpp: Routes kInt8x4 tensors in prepack_op() to the new function - TestQ8taBinary.cpp: Prepacks TensorRef inputs before quantization - test_q8ta_binary.cpp: Adds const_b test cases for constant tensor B inputs This diff was authored with Claude. Differential Revision: [D93000169](https://our.internmc.facebook.com/intern/diff/D93000169/) [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17392
Note: Links to docs will display an error until the docs builds have been completed. ❌ 3 New Failures, 1 Unrelated FailureAs of commit b58d3cb with merge base 964c565 ( NEW FAILURES - The following jobs have failed:
BROKEN TRUNK - The following job 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. |
This PR needs a
|
…t8 staging data" This adds a GLSL compute shader and supporting C++ dispatch logic to transfer int8 tensor data from a staging buffer (in NCHW contiguous order) to a GPU buffer in any PackedInt8 layout (4W, 4C, 4W4C, 4H4W, 4C1W). Previously there was no prepack path for kInt8x4 tensors, so constant int8 tensors (TensorRef inputs) could not be transferred to GPU buffers. This is needed to support constant quantized weights in q8ta operators. The shader uses texel-level dispatch where each thread writes one texel (one int32 = 4 packed int8 values). It decomposes the texel index into block-space coordinates using BufferMetadata strides and hashed_layout dim_order, then reads the corresponding int8 bytes from the staging buffer (interpreted as int32 for device compatibility, avoiding the need for 8-bit buffer support). New files: - nchw_to_int8x4_buffer.glsl: Compute shader handling all PackedInt8 layouts - nchw_to_int8x4_buffer.yaml: Shader variant config - Q8taStaging.h/cpp: C++ dispatch function creating the PrepackNode Modified files: - Staging.cpp: Routes kInt8x4 tensors in prepack_op() to the new function - TestQ8taBinary.cpp: Prepacks TensorRef inputs before quantization - test_q8ta_binary.cpp: Adds const_b test cases for constant tensor B inputs This diff was authored with Claude. Differential Revision: [D93000169](https://our.internmc.facebook.com/intern/diff/D93000169/) [ghstack-poisoned]
…t8 staging data" This adds a GLSL compute shader and supporting C++ dispatch logic to transfer int8 tensor data from a staging buffer (in NCHW contiguous order) to a GPU buffer in any PackedInt8 layout (4W, 4C, 4W4C, 4H4W, 4C1W). Previously there was no prepack path for kInt8x4 tensors, so constant int8 tensors (TensorRef inputs) could not be transferred to GPU buffers. This is needed to support constant quantized weights in q8ta operators. The shader uses texel-level dispatch where each thread writes one texel (one int32 = 4 packed int8 values). It decomposes the texel index into block-space coordinates using BufferMetadata strides and hashed_layout dim_order, then reads the corresponding int8 bytes from the staging buffer (interpreted as int32 for device compatibility, avoiding the need for 8-bit buffer support). New files: - nchw_to_int8x4_buffer.glsl: Compute shader handling all PackedInt8 layouts - nchw_to_int8x4_buffer.yaml: Shader variant config - Q8taStaging.h/cpp: C++ dispatch function creating the PrepackNode Modified files: - Staging.cpp: Routes kInt8x4 tensors in prepack_op() to the new function - TestQ8taBinary.cpp: Prepacks TensorRef inputs before quantization - test_q8ta_binary.cpp: Adds const_b test cases for constant tensor B inputs This diff was authored with Claude. Differential Revision: [D93000169](https://our.internmc.facebook.com/intern/diff/D93000169/) [ghstack-poisoned]
Stack from ghstack (oldest at bottom):
This adds a GLSL compute shader and supporting C++ dispatch logic to transfer
int8 tensor data from a staging buffer (in NCHW contiguous order) to a GPU
buffer in any PackedInt8 layout (4W, 4C, 4W4C, 4H4W, 4C1W).
Previously there was no prepack path for kInt8x4 tensors, so constant int8
tensors (TensorRef inputs) could not be transferred to GPU buffers. This is
needed to support constant quantized weights in q8ta operators.
The shader uses texel-level dispatch where each thread writes one texel (one
int32 = 4 packed int8 values). It decomposes the texel index into block-space
coordinates using BufferMetadata strides and hashed_layout dim_order, then reads
the corresponding int8 bytes from the staging buffer (interpreted as int32 for
device compatibility, avoiding the need for 8-bit buffer support).
New files:
Modified files:
This diff was authored with Claude.
Differential Revision: D93000169