Skip to content

Commit 8983705

Browse files
committed
Update on "[ET-VK] Storing positions in uint16 to instead of int in conv2d pw shader."
This diff modifies the `conv2d_pw_s1p0.glsl` shader to store positions in `uint16` instead of `int`. The changes include adding the necessary extension for explicit arithmetic types, updating the type definitions for `TILE_SIZE_X` and `TILE_SIZE_Y`, and changing the type of the `pos` array. Differential Revision: [D75423935](https://our.internmc.facebook.com/intern/diff/D75423935/) [ghstack-poisoned]
2 parents 03ec17e + 8e03910 commit 8983705

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
#define VEC4_T ${texel_type(DTYPE)}
1616

17-
#define TILE_SIZE_X ${TILE_SIZE_X}us
18-
#define TILE_SIZE_Y ${TILE_SIZE_Y}us
17+
#define TILE_SIZE_X uint16_t(${TILE_SIZE_X})
18+
#define TILE_SIZE_Y uint16_t(${TILE_SIZE_Y})
1919

2020
#define op(X, A, B) ${OPERATOR}
2121

@@ -66,8 +66,8 @@ void main() {
6666
// | pos[2] | pos[3] |
6767
// +--------+--------+
6868
uint16_t pos[TILE_SIZE_X * TILE_SIZE_Y * 2];
69-
for (uint16_t y = 0us, i = 0us; y < TILE_SIZE_Y; ++y) {
70-
for (uint16_t x = 0us; x < TILE_SIZE_X; ++x) {
69+
for (uint16_t y = uint16_t(0), i = uint16_t(0); y < TILE_SIZE_Y; ++y) {
70+
for (uint16_t x = uint16_t(0); x < TILE_SIZE_X; ++x) {
7171
pos[i * 2] = uint16_t(out_pos[0]) * TILE_SIZE_X + x;
7272
pos[i * 2 + 1] = uint16_t(out_pos[1]) * TILE_SIZE_Y + y;
7373
i++;

0 commit comments

Comments
 (0)