[webgpu] Add kernel type to profile info (#23167)

### Description
This PR is convenient to do post processing for the generated json file
when profiling is enabled. Kernel type can be used to aggregate the same
type kernels' overall time.
This commit is contained in:
Jiajia Qin 2025-01-04 06:28:48 +08:00 committed by GitHub
parent 5c2e60c5af
commit 4247153bb2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

@ -239,6 +239,7 @@ Status WebGpuContext::Run(ComputeContext& context, const ProgramBase& program) {
if (is_profiling_) {
PendingKernelInfo pending_kernel_info(context.KernelContext().GetNodeName(),
context.KernelContext().GetOpType(),
program.Name(),
key,
inputs,

View file

@ -147,11 +147,12 @@ class WebGpuContext final {
struct PendingKernelInfo {
PendingKernelInfo(std::string_view kernel_name,
std::string_view kernel_type,
std::string_view program_name,
std::string_view cache_key,
const std::vector<ProgramInput>& inputs,
const std::vector<ProgramOutput>& outputs)
: name{absl::StrJoin({kernel_name, program_name}, "_")}, cache_key{cache_key}, inputs{inputs}, outputs{outputs} {}
: name{absl::StrJoin({kernel_name, kernel_type, program_name}, "&")}, cache_key{cache_key}, inputs{inputs}, outputs{outputs} {}
PendingKernelInfo(PendingKernelInfo&&) = default;
PendingKernelInfo& operator=(PendingKernelInfo&&) = default;