Skip to content

Commit 90ac024

Browse files
trivedivivekfacebook-github-bot
authored andcommitted
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
1 parent f995ff7 commit 90ac024

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

backends/vulkan/runtime/graph/ops/glsl/linear_qcsnw_tiled.glsl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@ void main() {
6868

6969
VEC4_T sums[TILE_ROWS][TILE_TXCOLS];
7070

71-
VEC4_T scales[TILE_TXCOLS];
72-
$for c in range(TILE_TXCOLS):
73-
$if SCALES_STORAGE == "buffer":
74-
scales[${c}] = VEC4_T(t_scales[out_txcol + ${c}]);
75-
$else:
76-
scales[${c}] = VEC4_T(
77-
texelFetch(t_scales, u16vec2(out_txcol + ${c}, 0), 0));
78-
7971
for (int r = 0; r < TILE_ROWS; ++r) {
8072
$for c in range(TILE_TXCOLS):
8173
sums[r][${c}] = VEC4_T(0.0);
@@ -140,6 +132,14 @@ void main() {
140132
}
141133
}
142134

135+
VEC4_T scales[TILE_TXCOLS];
136+
$for c in range(TILE_TXCOLS):
137+
$if SCALES_STORAGE == "buffer":
138+
scales[${c}] = VEC4_T(t_scales[out_txcol + ${c}]);
139+
$else:
140+
scales[${c}] = VEC4_T(
141+
texelFetch(t_scales, u16vec2(out_txcol + ${c}, 0), 0));
142+
143143
// Store to output tensor
144144
$if OUT_STORAGE == "buffer":
145145
uint out_bufi;

0 commit comments

Comments
 (0)