Skip to content

Commit

Permalink
Nit
Browse files Browse the repository at this point in the history
  • Loading branch information
axinging committed Sep 15, 2024
1 parent 0021013 commit 2ddd64b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion onnxruntime/core/providers/webgpu/tensor/transpose.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,25 @@ Status Transpose::ComputeInternal(ComputeContext& context) const {

uint32_t output_size = gsl::narrow_cast<int32_t>(input_tensor->Shape().Size());
TransposeProgram program{*p_perm, use_shared};
const auto tileSize = 16; //todo
program.SetWorkgroupSize(tileSize,tileSize,1);

/*
useShared
.SetDispatchGroupSize(use_shared ? (new_output_shape[1] + tileSize-1 / tileSize, (new_output_shape[0] +tileSize -1 / tileSize): (output_size + WORKGROUP_SIZE - 1) / WORKGROUP_SIZE))
*/
// const auto dispatch_group_size = use_shared ? (new_output_shape[1] + tileSize-1 / tileSize, (new_output_shape[0] +tileSize -1 / tileSize): (output_size + WORKGROUP_SIZE - 1) / WORKGROUP_SIZE);
program
.CacheHint(absl::StrJoin(*p_perm, "-"))
.AddInputs({{input_tensor, ProgramTensorMetadataDependency::TypeAndRank, new_input_shape, 1}})
.AddOutputs({{output_tensor, ProgramTensorMetadataDependency::TypeAndRank, new_output_shape, 1}})
.SetDispatchGroupSize((output_size + WORKGROUP_SIZE - 1) / WORKGROUP_SIZE)
.SetDispatchGroupSize(static_cast<uint32_t>((new_output_shape[1] + tileSize-1) / tileSize), static_cast<uint32_t>(((new_output_shape[0] +tileSize -1) / tileSize)))
.AddUniformVariables({
{static_cast<uint32_t>(output_size)},
});

use_shared? program.SetDispatchGroupSize(static_cast<uint32_t>((new_output_shape[1] + tileSize-1) / tileSize), static_cast<uint32_t>(((new_output_shape[0] +tileSize -1) / tileSize)))
: program.SetDispatchGroupSize((output_size + WORKGROUP_SIZE - 1) / WORKGROUP_SIZE);
return context.RunProgram(program);
}

Expand Down

0 comments on commit 2ddd64b

Please sign in to comment.