From 6f76a0bb6c609b8443008dd750fadeb57f5d338f Mon Sep 17 00:00:00 2001 From: Vivek Trivedi Date: Wed, 20 Nov 2024 14:49:00 -0800 Subject: [PATCH] Minor perf improvements to quantized linear 8 bit shader. (#6944) Summary: This diff slightly improves the performance of quantized linear op by reducing few heavy math ops such as mod and divide. Reviewed By: Polyomino, SS-JIA Differential Revision: D66134239 --- backends/vulkan/runtime/graph/ops/glsl/q_8w_linear.glsl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backends/vulkan/runtime/graph/ops/glsl/q_8w_linear.glsl b/backends/vulkan/runtime/graph/ops/glsl/q_8w_linear.glsl index 60c67c34c49..962282348d1 100644 --- a/backends/vulkan/runtime/graph/ops/glsl/q_8w_linear.glsl +++ b/backends/vulkan/runtime/graph/ops/glsl/q_8w_linear.glsl @@ -117,10 +117,10 @@ VEC4_T q_8w_linear(const u16vec3 out_pos, const uint16_t K) { void main() { const u16vec3 out_pos = u16vec3( - gl_GlobalInvocationID.x / (out_limits.y * out_limits.z), - (gl_GlobalInvocationID.x / out_limits.z) % out_limits.y, - gl_GlobalInvocationID.x % out_limits.z); - if (any(greaterThanEqual(out_pos, out_limits))) { + gl_GlobalInvocationID.x / out_limits.y, + gl_GlobalInvocationID.x % out_limits.y, + 0); + if (out_pos.x >= out_limits.x) { return; }