Skip to content

Commit 5b1c980

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.
Pull Request resolved: #7452 This diff modifies the convolution 2D pointwise op shader and dispatch settings to linearly dispatch work accounting for linearity texture to improve performance. ghstack-source-id: 260166247 @exported-using-ghexport Differential Revision: [D67683411](https://our.internmc.facebook.com/intern/diff/D67683411/)
1 parent f139e39 commit 5b1c980

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)