[ET-VK][qconv] Add apply_relu support to q8ta conv operators#17575
Merged
SS-JIA merged 4 commits intogh/SS-JIA/433/origfrom Feb 20, 2026
Merged
[ET-VK][qconv] Add apply_relu support to q8ta conv operators#17575SS-JIA merged 4 commits intogh/SS-JIA/433/origfrom
SS-JIA merged 4 commits intogh/SS-JIA/433/origfrom
Conversation
Pull Request resolved: #17506 The quantized convolution pattern detector correctly identifies ReLU nodes between conv output and the output quantize node, but the pattern replacement did not pass this information to the fused q8ta operator. When the pattern replaced `dequant → conv → relu → quant` with `q8ta_conv2d`, the relu node was removed from the graph but its effect was not preserved. This silently removed all conv-relu non-linearity from int8 quantized models. Add an `apply_relu` parameter throughout the full pipeline: - Custom op schemas and reference implementations (custom_ops_lib.py) - Pattern replacement (quantized_convolution.py) - C++ dispatch logic extracts apply_relu and passes it as a spec constant (Q8taConv2d.cpp, Q8taConv2dDW.cpp, Q8taConv2dPW.cpp, Q8taConv2dIm2Col.cpp) - GLSL shaders apply conditional max(value, 0) after dequantization and before requantization (q8ta_conv2d.glsl, q8ta_conv2d_dw.glsl, q8ta_conv2d_pw.glsl) - Test operator wrappers updated with proper legacy path handling (TestQ8taConv2d.cpp) ghstack-source-id: 342806070 @exported-using-ghexport Differential Revision: [D93511632](https://our.internmc.facebook.com/intern/diff/D93511632/)
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17575
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
added 3 commits
February 19, 2026 20:15
Pull Request resolved: #17507 This adds a fused quantized unary operator (ReLU) that operates directly on int8x4 packed buffer tensors, avoiding the overhead of separate dequantize-relu-requantize dispatches. The implementation follows the same pattern as q8ta_binary: a single GLSL compute shader dequantizes int8x4 blocks to float, applies the unary operation, and requantizes back to int8x4 in one dispatch. The shader uses the OPERATOR macro for parameterization so additional unary ops can be added as YAML variants without new shader code. Components added: - GLSL shader (q8ta_unary.glsl) and YAML config with relu variant - C++ operator implementation (Q8taUnary.cpp/h) registering et_vk.q8ta_relu.default - Export graph fusion pattern (quantized_unary.py) that detects dequant->relu->quant sequences and replaces them with the fused op - Custom op definition (q8ta_relu in custom_ops_lib.py) for the export pipeline - Test harness (TestQ8taUnary.cpp, test_q8ta_unary.cpp) with reference implementation and coverage across multiple shapes and quantized layouts This diff was authored with Claude. ghstack-source-id: 342806073 @exported-using-ghexport Differential Revision: [D93511629](https://our.internmc.facebook.com/intern/diff/D93511629/)
Pull Request resolved: #17508 The batch norm operator registration had a check_batch_norm_node guard that restricted partitioning to 4D input tensors only. Since batch norm is always fused with adjacent operations during graph compilation, this restriction is unnecessary and prevents valid models from being partitioned to the Vulkan backend. Remove the guard so batch norm is always eligible for Vulkan partitioning regardless of input dimensionality. ghstack-source-id: 342806074 @exported-using-ghexport Differential Revision: [D93511630](https://our.internmc.facebook.com/intern/diff/D93511630/)
Previously, the q8ta_binary operator required both inputs to use the same memory layout. This was enforced by using a single `in_layout` specialization constant for both input buffers. However, some models may have inputs with different layouts (e.g., 4W4C and 4C1W) that share the same packed dimension and block size, which should be compatible for binary operations. This change introduces a separate `other_layout` specialization constant for the second input, allowing the shader to correctly load from input_b using its actual layout while input_a continues to use `in_layout`. The C++ side now passes both layout hashes as separate specialization constants to the shader. Differential Revision: [D93768638](https://our.internmc.facebook.com/intern/diff/D93768638/) ghstack-source-id: 342806076 Pull Request resolved: #17563
SS-JIA
approved these changes
Feb 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was created by the merge bot to help merge the original PR into the main branch.
ghstack PR number: #17506 by @SS-JIA
^ Please use this as the source of truth for the PR details, comments, and reviews
ghstack PR base: https://github.com/pytorch/executorch/tree/gh/SS-JIA/434/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/434/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/gh/SS-JIA/433/orig
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/434/orig
Differential Revision: D93511632
@diff-train-skip-merge