Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ ${layout_declare_tensor(B, "r", "mat1_tensor", DTYPE, "texture3d")}
${layout_declare_tensor(B, "r", "mat2_tensor", DTYPE, "texture3d")}
$if HAS_BIAS:
${layout_declare_tensor(B, "r", "bias_tensor", DTYPE, "texture3d")}
${layout_declare_ubo(B, "ivec4", "out_sizes")}
${layout_declare_ubo(B, "ivec3", "out_limits")}
${layout_declare_ubo(B, "ivec4", "mat1_sizes")}
${layout_declare_ubo(B, "ivec4", "mat2_sizes")}
$if HAS_BIAS:
${layout_declare_ubo(B, "ivec4", "bias_sizes")}
${layout_declare_ubo(B, "float", "alpha", "float", "beta")}

layout(push_constant) uniform restrict Block {
ivec4 out_sizes;
ivec4 mat1_sizes;
ivec4 mat2_sizes;
ivec3 out_limits;
$if HAS_BIAS:
ivec4 bias_sizes;
float alpha;
float beta;
};

#include "indexing_utils.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ ${layout_declare_tensor(B, "r", "t_in", DTYPE, STORAGE)}
${layout_declare_ubo(B, "BufferMetadata", "outp")}
${layout_declare_ubo(B, "BufferMetadata", "inp")}

${layout_declare_ubo(B, "float", "scalar_value")}
layout(push_constant) uniform restrict Block {
float scalar_value;
};

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ ${layout_declare_tensor(B, "r", "t_in", DTYPE, STORAGE)}
${layout_declare_ubo(B, "TextureMetadata", "outp")}
${layout_declare_ubo(B, "TextureMetadata", "inp")}

${layout_declare_ubo(B, "float", "scalar_value")}
layout(push_constant) uniform restrict Block {
float scalar_value;
};

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

Expand Down
5 changes: 4 additions & 1 deletion backends/vulkan/runtime/graph/ops/glsl/clone.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ layout(std430) buffer;

${layout_declare_tensor(B, "w", "t_out", DTYPE, STORAGE)}
${layout_declare_tensor(B, "r", "t_in", DTYPE, STORAGE)}
${layout_declare_ubo(B, "ivec3", "out_limits")}

layout(push_constant) uniform restrict Block {
ivec3 out_limits;
};

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

Expand Down
6 changes: 4 additions & 2 deletions backends/vulkan/runtime/graph/ops/glsl/softmax.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ layout(std430) buffer;
${layout_declare_tensor(B, "w", "tout", DTYPE, STORAGE)}
${layout_declare_tensor(B, "r", "tin", DTYPE, STORAGE)}

${layout_declare_ubo(B, "ivec3", "tout_limits")}
${layout_declare_ubo(B, "ivec4", "tin_sizes")}
layout(push_constant) uniform restrict Block {
ivec4 tin_sizes;
ivec3 tout_limits;
};

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

Expand Down
5 changes: 2 additions & 3 deletions backends/vulkan/runtime/graph/ops/impl/BinaryScalarOp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ void add_binary_scalar_op_node(

vkapi::ParamsBindList param_ubos = {
graph.meta_ubo(out),
graph.meta_ubo(in),
graph.create_params_buffer(scalar_val)};
graph.meta_ubo(in)};

graph.execute_nodes().emplace_back(new DynamicDispatchNode(
graph,
Expand All @@ -63,7 +62,7 @@ void add_binary_scalar_op_node(
// Shader params buffers
param_ubos,
// Push Constants
{},
{PushConstantDataInfo(&scalar_val, sizeof(scalar_val))},
// Specialization Constants
{},
// Resize Args
Expand Down
4 changes: 2 additions & 2 deletions backends/vulkan/runtime/graph/ops/impl/Clone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ void add_clone_node(
// Inputs and Outputs
{{out, vkapi::kWrite}, {in, vkapi::kRead}},
// Parameter Buffers
{graph.logical_limits_ubo(out)},
// Push Constants
{},
// Push Constants
{graph.logical_limits_pc_of(out)},
// Specialization Constants
{},
// Resize Args
Expand Down
16 changes: 7 additions & 9 deletions backends/vulkan/runtime/graph/ops/impl/Linear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,14 @@ void add_addmm_naive_texture_node(
// Inputs and Outputs
{{out, vkapi::kWrite}, {{mat1, mat2, self}, vkapi::kRead}},
// Shader params buffers
{
graph.sizes_ubo(out),
graph.logical_limits_ubo(out),
graph.sizes_ubo(mat1),
graph.sizes_ubo(mat2),
graph.sizes_ubo(self),
graph.create_params_buffer(params),
},
// Push Constants
{},
// Push Constants
{graph.sizes_pc_of(out),
graph.sizes_pc_of(mat1),
graph.sizes_pc_of(mat2),
graph.logical_limits_pc_of(out),
graph.sizes_pc_of(self),
PushConstantDataInfo(&params, sizeof(params))},
// Specialization Constants
{graph.hashed_layout_of(out),
graph.hashed_layout_of(mat1),
Expand Down
13 changes: 6 additions & 7 deletions backends/vulkan/runtime/graph/ops/impl/MatMul.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,13 @@ void add_matmul_naive_texture3d_node(
// Inputs and Outputs
{{out, vkapi::kWrite}, {{mat1, mat2}, vkapi::kRead}},
// Shader params buffers
{
graph.sizes_ubo(out),
graph.logical_limits_ubo(out),
graph.sizes_ubo(mat1),
graph.sizes_ubo(mat2),
},
// Push Constants
{},
// Push Constants
{graph.sizes_pc_of(out),
graph.sizes_pc_of(mat1),
graph.sizes_pc_of(mat2),
graph.logical_limits_pc_of(out)
},
// Specialization Constants
{graph.hashed_layout_of(out),
graph.hashed_layout_of(mat1),
Expand Down
4 changes: 2 additions & 2 deletions backends/vulkan/runtime/graph/ops/impl/Softmax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ void add_softmax_node(
// Inputs and Outputs
{{out, vkapi::kWrite}, {in, vkapi::kRead}},
// Shader params buffers
{graph.logical_limits_ubo(out), graph.sizes_ubo(in)},
// Push Constants
{},
// Push Constants
{graph.sizes_pc_of(in), graph.logical_limits_pc_of(out)},
// Specialization Constants
{graph.packed_dim_of(out), reduce_dim_xyz, group_dim},
// Resize Args
Expand Down
Loading