Skip to content

Commit 19d3bce

Browse files
authored
[ET-VK] Removing un used push constants for conv2d pw. (#10841)
Pull Request resolved: #10814 This change removes unused push constants from conv2d pw op to reduce memory usage. ghstack-source-id: 283597017 @exported-using-ghexport Differential Revision: [D74523769](https://our.internmc.facebook.com/intern/diff/D74523769/)
1 parent aa73a55 commit 19d3bce

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,8 @@ ${layout_declare_tensor(3, "r", "t_bias", DTYPE, "texture2d")}
2929

3030
layout(push_constant) uniform restrict Block {
3131
ivec4 out_limits;
32-
ivec4 in_sizes;
33-
ivec2 kernel_size;
3432
ivec2 stride;
3533
ivec2 padding;
36-
ivec2 dilation;
37-
ivec2 overlay_region;
3834
int in_group_size;
3935
int dummy_padding;
4036
float out_min;

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,27 @@ void add_conv2d_node(
404404

405405
vkapi::ParamsBindList param_buffers;
406406
std::vector<PushConstantDataInfo> push_constants;
407-
if (method == Conv2dMethod::Pointwise || method == Conv2dMethod::Depthwise) {
407+
if (method == Conv2dMethod::Pointwise) {
408+
const utils::ivec4 kernel_param_stride_pad = {
409+
kernel_params.stride[0],
410+
kernel_params.stride[1],
411+
kernel_params.padding[0],
412+
kernel_params.padding[1],
413+
};
414+
415+
struct Conv2dPWParams final {
416+
int in_group_size;
417+
int dummy_padding;
418+
OutputParams out_params;
419+
} param{extra_params.in_group_size, 0, out_params};
420+
421+
push_constants = {
422+
graph.logical_limits_pc_of(out),
423+
PushConstantDataInfo(
424+
&kernel_param_stride_pad, sizeof(kernel_param_stride_pad)),
425+
PushConstantDataInfo(&param, sizeof(param)),
426+
};
427+
} else if (method == Conv2dMethod::Depthwise) {
408428
const utils::ivec4 kernel_param_size_stride = {
409429
kernel_params.kernel_size[0],
410430
kernel_params.kernel_size[1],

0 commit comments

Comments
 (0)