Skip to content

Commit 9a77eb8

Browse files
committed
[ET-VK] Minor tuning for conv2d pw op to improve performance.
The diff introduces minor tuning for the Conv2d pointwise (PW) operation in the Vulkan backend to improve performance. Conv 2d pw now issues a 2D dispatch instead of 1D, where dispatch axis y is now sized based on output texture's batch size. Differential Revision: [D75251145](https://our.internmc.facebook.com/intern/diff/D75251145/) ghstack-source-id: 285961874 Pull Request resolved: #11113
1 parent 5814dda commit 9a77eb8

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ void main() {
4949
const uint div_by_x = gl_GlobalInvocationID.x / out_limits_scaled.x;
5050
const ivec3 gpos = ivec3(
5151
gl_GlobalInvocationID.x % out_limits_scaled.x,
52-
div_by_x % out_limits_scaled.y,
53-
div_by_x / out_limits_scaled.y);
52+
div_by_x,
53+
gl_GlobalInvocationID.y);
5454

5555
// If the top left position is out of bounds, then this invocation will have
5656
// no work to do.
57-
if (gpos.z >= out_limits.z) {
57+
if (gpos.y >= out_limits_scaled.y || gpos.z >= out_limits.z) {
5858
return;
5959
}
6060

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,10 @@ void add_conv2d_node(
398398
utils::uvec3 wg_size = create_conv2d_global_wg_size(
399399
graph, method, out, weight_data, stride_equals_dilation);
400400

401-
if (method == Conv2dMethod::Pointwise || method == Conv2dMethod::Depthwise) {
401+
if (method == Conv2dMethod::Depthwise) {
402402
wg_size = {wg_size[0] * wg_size[1] * wg_size[2], 1, 1};
403+
} else if (method == Conv2dMethod::Pointwise) {
404+
wg_size = {wg_size[0] * wg_size[1], wg_size[2], 1};
403405
}
404406

405407
vkapi::ParamsBindList param_buffers;

0 commit comments

Comments
 (0)