Skip to content

Commit e3e6290

Browse files
[ET-VK] Minor fix to conv 2d op using wg_size from create_conv2d_global_wg_size to determine local wg size. (#7500)
* [ET-VK] Reduced int precision for all int storage in conv pw op to improve performance. Pull Request resolved: #7447 This diff reduces the precision of all int storage in the conv pw op to improve performance. The code changes include adding the extension GL_EXT_shader_explicit_arithmetic_types_int16 and changing the data type of ints to uint16. ghstack-source-id: 260166244 @exported-using-ghexport Differential Revision: [D67674212](https://our.internmc.facebook.com/intern/diff/D67674212/) * [ET-VK] Minor fix to conv 2d op using wg_size from create_conv2d_global_wg_size to determine local wg size. Pull Request resolved: #7450 This diff contains changes to the Convolution.cpp file in the Vulkan backend of Executorch. The changes involve updating the code to use the create_conv2d_global_wg_size function to determine the local workgroup size for the convolution operation. This is done to ensure that the correct workgroup size is used for the operation, which can improve performance. ghstack-source-id: 260166246 @exported-using-ghexport Differential Revision: [D67676422](https://our.internmc.facebook.com/intern/diff/D67676422/) * [ET-VK] Modify conv 2d pw op shader and dispatch settings to linearly dispatch work accounting for linearity texture to improve performance. (#7501) 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/) Co-authored-by: Vivek Trivedi <[email protected]> --------- Co-authored-by: Vivek Trivedi <[email protected]>
1 parent 2395da9 commit e3e6290

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

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

Lines changed: 6 additions & 1 deletion
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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,11 +370,17 @@ void add_conv2d_node(
370370
weight_data,
371371
clamp_out);
372372

373+
utils::uvec3 wg_size = create_conv2d_global_wg_size(graph, method, out);
374+
375+
if (method == Conv2dMethod::Pointwise) {
376+
wg_size = {wg_size[0] * wg_size[1] * wg_size[2], 1, 1};
377+
}
378+
373379
graph.execute_nodes().emplace_back(new DispatchNode(
374380
graph,
375381
shader,
376-
create_conv2d_global_wg_size(graph, method, out),
377-
graph.create_local_wg_size(out),
382+
wg_size,
383+
graph.create_local_wg_size(wg_size),
378384
// Inputs and Outputs
379385
{{out, vkapi::MemoryAccessType::WRITE},
380386
{{in, arg_weight, arg_bias}, vkapi::MemoryAccessType::READ}},

0 commit comments

Comments
 (0)