Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ET-VK] Replace Uniform buffers with push constants for permute op #7231

Merged
merged 18 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
ebe3da9
[ET-VK] Replace Uniform buffers with push constants for permute op
trivedivivek Dec 6, 2024
effdf25
Update on "[ET-VK] Replace Uniform buffers with push constants for pe…
trivedivivek Dec 6, 2024
fd6e847
Update on "[ET-VK] Replace Uniform buffers with push constants for pe…
trivedivivek Dec 6, 2024
405da50
Update on "[ET-VK] Replace Uniform buffers with push constants for pe…
trivedivivek Dec 9, 2024
e5c079d
Update on "[ET-VK] Replace Uniform buffers with push constants for pe…
trivedivivek Dec 9, 2024
96ca1be
Update on "[ET-VK] Replace Uniform buffers with push constants for pe…
trivedivivek Dec 10, 2024
a3e4c01
Update on "[ET-VK] Replace Uniform buffers with push constants for pe…
trivedivivek Dec 11, 2024
37ed966
Update on "[ET-VK] Replace Uniform buffers with push constants for pe…
trivedivivek Dec 11, 2024
d0cc067
Update on "[ET-VK] Replace Uniform buffers with push constants for pe…
trivedivivek Dec 12, 2024
15b5b1c
Update on "[ET-VK] Replace Uniform buffers with push constants for pe…
trivedivivek Dec 12, 2024
97f1806
Update on "[ET-VK] Replace Uniform buffers with push constants for pe…
trivedivivek Dec 12, 2024
5a4de9d
Update on "[ET-VK] Replace Uniform buffers with push constants for pe…
trivedivivek Dec 12, 2024
bfe548d
Update on "[ET-VK] Replace Uniform buffers with push constants for pe…
trivedivivek Dec 16, 2024
a76f3f2
Update on "[ET-VK] Replace Uniform buffers with push constants for pe…
trivedivivek Dec 17, 2024
60bd2f1
Update on "[ET-VK] Replace Uniform buffers with push constants for pe…
trivedivivek Dec 17, 2024
99d1037
Update on "[ET-VK] Replace Uniform buffers with push constants for pe…
trivedivivek Dec 17, 2024
76e0ebb
Update on "[ET-VK] Replace Uniform buffers with push constants for pe…
trivedivivek Dec 17, 2024
71da2e4
Update on "[ET-VK] Replace Uniform buffers with push constants for pe…
trivedivivek Dec 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions backends/vulkan/runtime/graph/ops/glsl/permute.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,9 @@ layout(std430) buffer;
layout(set = 0, binding = 0, ${IMAGE_FORMAT[DTYPE]}) uniform PRECISION restrict writeonly ${IMAGE_T[NDIM][DTYPE]} image_out;
layout(set = 0, binding = 1) uniform PRECISION ${SAMPLER_T[NDIM][DTYPE]} image_in;

layout(set = 0, binding = 2) uniform PRECISION restrict OutLimits {
ivec3 out_limits;
};

layout(set = 0, binding = 3) uniform PRECISION restrict Sizes {
layout(push_constant) uniform PRECISION restrict Block {
ivec4 out_limits;
ivec4 sizes;
};

layout(set = 0, binding = 4) uniform PRECISION restrict Block {
// output dims
ivec4 out_ndims;
// x = output channels aligned to 4, y = input channels aligned to 4
Expand All @@ -41,7 +35,7 @@ layout(local_size_x_id = 0, local_size_y_id = 1, local_size_z_id = 2) in;
void main() {
const u16vec3 pos = u16vec3(gl_GlobalInvocationID);

if (any(greaterThanEqual(pos, out_limits))) {
if (any(greaterThanEqual(pos, out_limits.xyz))) {
return;
}

Expand Down
18 changes: 7 additions & 11 deletions backends/vulkan/runtime/graph/ops/impl/Permute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,7 @@ void add_permute_node(
int32_t out_c_aligned = utils::align_up_4(out_channels);
int32_t in_c_aligned = utils::align_up_4(in_channels);

const struct Block final {
ivec4 out_ndims;
ivec2 ch_info;
} params{
out_dims,
{out_c_aligned, in_c_aligned},
};
const ivec2 ch_info = {out_c_aligned, in_c_aligned};

graph.execute_nodes().emplace_back(new DispatchNode(
graph,
Expand All @@ -90,14 +84,16 @@ void add_permute_node(
graph.create_local_wg_size(out),
{{out, vkapi::MemoryAccessType::WRITE},
{in, vkapi::MemoryAccessType::READ}},
{t_out->logical_limits_ubo(),
t_out->sizes_ubo(),
graph.create_params_buffer(params)},
{},
// Specialization Constants
{},
// Resizing Logic
nullptr,
{}));
{},
{{graph.logical_limits_pc_of(out),
graph.sizes_pc_of(out),
PushConstantDataInfo(&out_dims, sizeof(out_dims)),
PushConstantDataInfo(&ch_info, sizeof(ch_info))}}));
}

void add_permute_node(
Expand Down