Skip to content

Commit 8c77b4d

Browse files
committed
Update on "[ET-VK] Replace Uniform buffers with push constants for copy op"
This diff replaces uniform buffers with push constants for copy op in the Vulkan backend of Executorch. The changes include updating the GLSL code to use push constants instead of uniform buffers and updating the C++ code to pass the sizes as push constants to the shader. Differential Revision: [D66890851](https://our.internmc.facebook.com/intern/diff/D66890851/) [ghstack-poisoned]
1 parent 63f650a commit 8c77b4d

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ layout(push_constant) uniform restrict Block {
2222
ivec4 out_sizes;
2323
ivec4 in_sizes;
2424
// Operates on (x, y, z) logical extents.
25+
// channel_range is stored in range.w
2526
ivec4 range;
2627
// Analogus to range variable in copy. It defines the # of channel being
2728
// copied.
28-
// channel_range is stored in range.w
29+
// dst channel offset is stored in dst_offset.w
2930
ivec4 dst_offset;
3031
int src_channel_offset;
3132
};

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,8 @@ void add_copy_channel_offset_node(
160160
{graph.hashed_layout_of(out), graph.hashed_layout_of(in)},
161161
nullptr,
162162
{},
163-
{PushConstantDataInfo(
164-
t_out->get_uniform_data(), api::vTensor::Attribute::SIZES),
165-
PushConstantDataInfo(
166-
t_in->get_uniform_data(), api::vTensor::Attribute::SIZES),
163+
{graph.sizes_pc_of(out),
164+
graph.sizes_pc_of(in),
167165
PushConstantDataInfo(&range_params, sizeof(range_params)),
168166
PushConstantDataInfo(&offset_params, sizeof(offset_params)),
169167
PushConstantDataInfo(

0 commit comments

Comments
 (0)