Skip to content

Commit f7954f6

Browse files
SS-JIAfacebook-github-bot
authored andcommitted
Fix batch dimension adjustment in shader indexing utils (#5399)
Summary: Pull Request resolved: #5399 ## Context In the GLSL shader utility functions, the functions which use the axis map to obtain texture position or tensor index had a small bug where the size of the tensor dimension used to concatenate with the batch dimension was incorrectly retrieved as `sizes.w`. The correct way to retrieve this size is `sizes[axis_map[3]]`. This diff fixes this bug. ghstack-source-id: 242840432 exported-using-ghexport Reviewed By: jorgep31415 Differential Revision: D62772113 fbshipit-source-id: 1285b1509ff652703c7ecf16dbb2cc30d6d70769
1 parent 30ab618 commit f7954f6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

backends/vulkan/runtime/graph/ops/glsl/indexing_utils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ ivec3 to_texture_pos(
270270

271271
// Adjust batch dim if needed
272272
if (sizes.w > 1) {
273-
pos[axis_map[axis_map[3]]] += idx.w * sizes.w;
273+
pos[axis_map[axis_map.w]] += idx.w * sizes[axis_map.w];
274274
}
275275

276276
// Adjust packed dim. Moving 1 texel unit along the packed dim traverses 4
@@ -317,7 +317,7 @@ ivec4 to_texture_elem_pos(
317317

318318
// Adjust batch dim if needed
319319
if (sizes.w > 1) {
320-
pos[axis_map[axis_map[3]]] += idx.w * sizes.w;
320+
pos[axis_map[axis_map.w]] += idx.w * sizes[axis_map.w];
321321
}
322322

323323
// Adjust packed dim. Moving 1 texel unit along the packed dim traverses 4

0 commit comments

Comments
 (0)