Skip to content

Commit c937ece

Browse files
Di Xu (AR)facebook-github-bot
authored andcommitted
Migrate upsample op to new layout declare using the gen_vulkan_spv.py (#3730)
Summary: Pull Request resolved: #3730 Migrate upsample op to new layout declare using the gen_vulkan_spv.py - layout_declare_tensor: https://www.internalfb.com/code/fbsource/[0ba7858aa186]/fbcode/executorch/backends/vulkan/runtime/api/gen_vulkan_spv.py?lines=219 - layout_declare_ubo, ubo: Uniform Buffer Object, OpenGL data structure bypass-github-export-checks bypass-github-pytorch-ci-checks bypass-github-executorch-ci-checks Reviewed By: jorgep31415 Differential Revision: D57781160 fbshipit-source-id: b881004e05721cf3a65691f7d850cec92c0e3c54
1 parent 79e9b79 commit c937ece

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

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

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,13 @@
1313

1414
#define PRECISION ${PRECISION}
1515

16-
#define VEC4_T ${texel_type(DTYPE)}
16+
#define VEC4_T ${texel_load_type(DTYPE, STORAGE)}
1717

1818
layout(std430) buffer;
1919

20-
layout(set = 0, binding = 0, ${IMAGE_FORMAT[DTYPE]}) uniform PRECISION restrict writeonly ${IMAGE_T[NDIM][DTYPE]} image_out;
21-
22-
layout(set = 0, binding = 1) uniform PRECISION sampler3D image_in;
23-
24-
layout(set = 0, binding = 2) uniform PRECISION restrict OutLimits {
25-
ivec3 out_limits;
26-
};
27-
28-
layout(set = 0, binding = 3) uniform PRECISION restrict Sizes {
29-
ivec4 sizes;
30-
};
20+
${layout_declare_tensor(0, "w", "t_out", DTYPE, STORAGE)}
21+
${layout_declare_tensor(1, "r", "t_in", DTYPE, STORAGE)}
22+
${layout_declare_ubo(2, "ivec3", "out_limits")}
3123

3224
layout(local_size_x_id = 0, local_size_y_id = 1, local_size_z_id = 2) in;
3325

@@ -38,6 +30,6 @@ void main() {
3830
return;
3931
}
4032

41-
VEC4_T in_texel = texelFetch(image_in, pos, 0);
42-
imageStore(image_out, pos, in_texel);
33+
VEC4_T in_texel = texelFetch(t_in, pos, 0);
34+
imageStore(t_out, pos, in_texel);
4335
}

backends/vulkan/runtime/graph/ops/glsl/upsample.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ upsample:
99
NDIM: 3
1010
DTYPE: float
1111
PACKING: C_packed
12+
STORAGE: texture3d
1213
generate_variant_forall:
1314
DTYPE:
1415
- VALUE: half

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void add_upsample_node(
4949
// Inputs and Outputs
5050
{{out, api::MemoryAccessType::WRITE}, {arg, api::MemoryAccessType::READ}},
5151
// Shader params buffers
52-
{t_out->texture_limits_ubo(), graph.create_params_buffer(0.5)},
52+
{t_out->texture_limits_ubo()},
5353
// Specialization Constants
5454
{},
5555
// Resizing Logic

0 commit comments

Comments
 (0)