Skip to content

Commit 86f16a0

Browse files
committed
[ET-VK] Modify conv 2d pw op shader and dispatch settings to linearly dispatch work accounting for linearity texture to improve performance.
This diff modifies the convolution 2D pointwise op shader and dispatch settings to linearly dispatch work accounting for linearity texture to improve performance. Differential Revision: [D67683411](https://our.internmc.facebook.com/intern/diff/D67683411/) ghstack-source-id: 259692390 Pull Request resolved: #7452
1 parent 541e05b commit 86f16a0

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

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

+6-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ layout(local_size_x_id = 0, local_size_y_id = 1, local_size_z_id = 2) in;
4040
* size is only 1x1, making it easier to re-use loaded texels from t_kernel.
4141
*/
4242
void main() {
43-
const u16vec3 gpos = u16vec3(gl_GlobalInvocationID);
43+
const uint16_t out_limits_y_scaled = uint16_t((out_limits.y + TILE_SIZE - 1) / TILE_SIZE);
44+
45+
const u16vec3 gpos = u16vec3(
46+
gl_GlobalInvocationID.x / (out_limits_y_scaled * out_limits.z),
47+
(gl_GlobalInvocationID.x / out_limits.z) % out_limits_y_scaled,
48+
gl_GlobalInvocationID.x % out_limits.z);
4449

4550
// Output position for TILE_SIZE = 2
4651
// +--------+--------+

backends/vulkan/runtime/graph/ops/impl/Convolution.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,10 @@ void add_conv2d_node(
372372

373373
utils::uvec3 wg_size = create_conv2d_global_wg_size(graph, method, out);
374374

375+
if (method == Conv2dMethod::Pointwise) {
376+
wg_size = {wg_size[0] * wg_size[1] * wg_size[2], 1, 1};
377+
}
378+
375379
graph.execute_nodes().emplace_back(new DispatchNode(
376380
graph,
377381
shader,

0 commit comments

Comments
 (0)