Skip to content

Commit f9b29d1

Browse files
committed
[ET-VK] Minor unroll tuning to improve conv2d pw perf.
Pull Request resolved: #11134 This diff provides a minor unroll tuning to improve the performance of the conv2d pointwise (pw) operation in the Executorch Vulkan backend. ghstack-source-id: 286439496 @exported-using-ghexport Differential Revision: [D75420510](https://our.internmc.facebook.com/intern/diff/D75420510/)
1 parent 49cbbf6 commit f9b29d1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ layout(push_constant) uniform restrict Block {
3838

3939
layout(local_size_x_id = 0, local_size_y_id = 1, local_size_z_id = 2) in;
4040

41+
#extension GL_EXT_control_flow_attributes : require
42+
4143
/*
4244
* Computes a 2D pointwise convolution of an NxN output tile. Calculating an
4345
* output tile for pointwise convolution is more efficient because the kernel
@@ -105,7 +107,7 @@ void main() {
105107
float kernel_values[4 * 4]; // 4 channels, 4 elements per channel
106108

107109
// Load kernel values from texels to array
108-
for (int i = 0; i < 4; ++i) {
110+
[[unroll]] for (int i = 0; i < 4; ++i) {
109111
const vec4 k_tex = texelFetch(t_kernel, ivec2(z + i, gpos.z), 0);
110112
kernel_values[i * 4 + 0] = k_tex.x;
111113
kernel_values[i * 4 + 1] = k_tex.y;

0 commit comments

Comments
 (0)