From: Masashi Yoshimura Date: Wed, 13 May 2026 17:22:44 +0000 (+0900) Subject: flush the gpu profile timestamp before the queryset is overflowed (#22995) X-Git-Tag: upstream/0.0.10438~1299 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=527045bfb03ec339150f67d1bb5a581a8e91ec0a;p=pkg%2Fggml%2Fsources%2Fllama.cpp flush the gpu profile timestamp before the queryset is overflowed (#22995) --- diff --git a/ggml/src/ggml-webgpu/ggml-webgpu.cpp b/ggml/src/ggml-webgpu/ggml-webgpu.cpp index b24101c78..401c75c12 100644 --- a/ggml/src/ggml-webgpu/ggml-webgpu.cpp +++ b/ggml/src/ggml-webgpu/ggml-webgpu.cpp @@ -3148,6 +3148,16 @@ static ggml_status ggml_backend_webgpu_graph_compute(ggml_backend_t backend, str } ctx->param_arena.reset(); commands.clear(); +#ifdef GGML_WEBGPU_GPU_PROFILE + // flush before the next batch can overflow the QuerySet + if (ctx->profile_timestamp_query_count + 2 * ctx->global_ctx->command_submit_batch_size >= + WEBGPU_MAX_PROFILE_QUERY_COUNT) { + ggml_backend_webgpu_collect_profile_results(ctx, profile_pipeline_names, num_inflight_batches); + // reset profile timestamp state + ctx->profile_timestamp_query_count = 0; + profile_pipeline_names.clear(); + } +#endif } node_idx += num_encoded_ops;