Skip to content

Commit 527045b

Browse files
authored
flush the gpu profile timestamp before the queryset is overflowed (#22995)
1 parent 2dfeca3 commit 527045b

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

ggml/src/ggml-webgpu/ggml-webgpu.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3148,6 +3148,16 @@ static ggml_status ggml_backend_webgpu_graph_compute(ggml_backend_t backend, str
31483148
}
31493149
ctx->param_arena.reset();
31503150
commands.clear();
3151+
#ifdef GGML_WEBGPU_GPU_PROFILE
3152+
// flush before the next batch can overflow the QuerySet
3153+
if (ctx->profile_timestamp_query_count + 2 * ctx->global_ctx->command_submit_batch_size >=
3154+
WEBGPU_MAX_PROFILE_QUERY_COUNT) {
3155+
ggml_backend_webgpu_collect_profile_results(ctx, profile_pipeline_names, num_inflight_batches);
3156+
// reset profile timestamp state
3157+
ctx->profile_timestamp_query_count = 0;
3158+
profile_pipeline_names.clear();
3159+
}
3160+
#endif
31513161
}
31523162

31533163
node_idx += num_encoded_ops;

0 commit comments

Comments
 (0)