Skip to content

Commit

Permalink
use snake_case
Browse files Browse the repository at this point in the history
  • Loading branch information
prathikr committed Dec 18, 2024
1 parent 3831e22 commit 034c47a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions onnxruntime/core/providers/webgpu/tensor/gather_elements.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ Status GatherElementsProgram::GenerateShaderCode(ShaderHelper& shader) const {
<< "let output_indices = " << output.OffsetToIndices("global_idx") << ";\n"
<< "var idx = " << indices.GetByOffset("global_idx") << ";\n"
<< "if (idx < 0) {\n"
<< " idx = idx + uniforms.axisDimLimit;\n"
<< " idx = idx + uniforms.axis_dim_limit;\n"
<< "}\n"
<< "var inputIndices = output_indices;\n"
<< input.IndicesSet("inputIndices", "uniforms.axis", "u32(idx)") << ";\n"
<< "let value = " << input.GetByIndices("inputIndices") << ";\n"
<< "var input_indices = output_indices;\n"
<< input.IndicesSet("input_indices", "uniforms.axis", "u32(idx)") << ";\n"
<< "let value = " << input.GetByIndices("input_indices") << ";\n"
<< output.SetByOffset("global_idx", "value") << ";\n";

return Status::OK();
Expand All @@ -59,7 +59,7 @@ Status GatherElements::ComputeInternal(ComputeContext& context) const {
axis += input_rank;
}

auto axisDimLimit = input_shape[axis];
auto axis_dim_limit = input_shape[axis];

auto output_dims = indices_shape.AsShapeVector();
TensorShape output_shape(output_dims);
Expand All @@ -77,7 +77,7 @@ Status GatherElements::ComputeInternal(ComputeContext& context) const {
.AddOutputs({output_tensor})
.SetDispatchGroupSize((output_size + WORKGROUP_SIZE - 1) / WORKGROUP_SIZE)
.AddUniformVariables({{static_cast<uint32_t>(output_size)},
{static_cast<int32_t>(axisDimLimit)},
{static_cast<int32_t>(axis_dim_limit)},
{static_cast<int32_t>(axis)}});
return context.RunProgram(program);
}
Expand Down
2 changes: 1 addition & 1 deletion onnxruntime/core/providers/webgpu/tensor/gather_elements.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class GatherElementsProgram final : public Program<GatherElementsProgram> {
Status GenerateShaderCode(ShaderHelper& sh) const override;

WEBGPU_PROGRAM_DEFINE_UNIFORM_VARIABLES({"output_size", ProgramUniformVariableDataType::Uint32},
{"axisDimLimit", ProgramUniformVariableDataType::Int32},
{"axis_dim_limit", ProgramUniformVariableDataType::Int32},
{"axis", ProgramUniformVariableDataType::Int32});
};

Expand Down

0 comments on commit 034c47a

Please sign in to comment.