From ce9001a3d96e15e26a6bf3b3471fc2d201c19b26 Mon Sep 17 00:00:00 2001 From: Vivek Trivedi Date: Fri, 17 Oct 2025 09:28:17 -0700 Subject: [PATCH] Moving scale fetch later for minor improvement. (#15190) Summary: ### Summary The changes moves the scale fetch later in the code, which can provide a minor improvement. Reviewed By: yipjustin, SS-JIA Differential Revision: D84679168 --- .../graph/ops/glsl/linear_qcsnw_tiled.glsl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/backends/vulkan/runtime/graph/ops/glsl/linear_qcsnw_tiled.glsl b/backends/vulkan/runtime/graph/ops/glsl/linear_qcsnw_tiled.glsl index dd1596cfa35..6f809d57ff8 100644 --- a/backends/vulkan/runtime/graph/ops/glsl/linear_qcsnw_tiled.glsl +++ b/backends/vulkan/runtime/graph/ops/glsl/linear_qcsnw_tiled.glsl @@ -68,14 +68,6 @@ void main() { VEC4_T sums[TILE_ROWS][TILE_TXCOLS]; - VEC4_T scales[TILE_TXCOLS]; - $for c in range(TILE_TXCOLS): - $if SCALES_STORAGE == "buffer": - scales[${c}] = VEC4_T(t_scales[out_txcol + ${c}]); - $else: - scales[${c}] = VEC4_T( - texelFetch(t_scales, u16vec2(out_txcol + ${c}, 0), 0)); - for (int r = 0; r < TILE_ROWS; ++r) { $for c in range(TILE_TXCOLS): sums[r][${c}] = VEC4_T(0.0); @@ -140,6 +132,14 @@ void main() { } } + VEC4_T scales[TILE_TXCOLS]; + $for c in range(TILE_TXCOLS): + $if SCALES_STORAGE == "buffer": + scales[${c}] = VEC4_T(t_scales[out_txcol + ${c}]); + $else: + scales[${c}] = VEC4_T( + texelFetch(t_scales, u16vec2(out_txcol + ${c}, 0), 0)); + // Store to output tensor $if OUT_STORAGE == "buffer": uint out_bufi;