Skip to content

Commit 0291286

Browse files
authored
[ET-VK] Using vec2 to store output positions to reudce shader register footprint.
Differential Revision: D67726229 Pull Request resolved: #7474
1 parent 6f284be commit 0291286

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,18 @@ void main() {
5353
// +--------+--------+
5454
// | pos[2] | pos[3] |
5555
// +--------+--------+
56-
u16vec3 pos[TILE_SIZE * TILE_SIZE];
56+
u16vec2 pos[TILE_SIZE * TILE_SIZE];
5757
for (int y = 0, i = 0; y < TILE_SIZE; ++y) {
5858
for (int x = 0; x < TILE_SIZE; ++x) {
59-
pos[i] = u16vec3(
60-
gpos.x * TILE_SIZE + x, gpos.y * TILE_SIZE + y, gpos.z);
59+
pos[i] = u16vec2(
60+
gpos.x * TILE_SIZE + x, gpos.y * TILE_SIZE + y);
6161
i++;
6262
}
6363
}
6464

6565
// If the top left position is out of bounds, then this invocation will have
6666
// no work to do.
67-
if (any(greaterThanEqual(pos[0], out_limits))) {
67+
if (any(greaterThanEqual(u16vec3(pos[0], gpos.z), out_limits))) {
6868
return;
6969
}
7070

@@ -138,8 +138,8 @@ void main() {
138138
}
139139

140140
for (int i = 0; i < TILE_SIZE * TILE_SIZE; ++i) {
141-
if (all(lessThan(pos[i], out_limits))) {
142-
imageStore(t_out, pos[i], op(sum[i], out_min, out_max));
141+
if (all(lessThan(u16vec3(pos[i], gpos.z), out_limits))) {
142+
imageStore(t_out, u16vec3(pos[i], gpos.z), op(sum[i], out_min, out_max));
143143
}
144144
}
145145
}

0 commit comments

Comments
 (0)