Skip to content

Commit bfc6930

Browse files
committed
Fix potential issue around empty queue submission
1 parent 75eb99b commit bfc6930

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,10 @@ static void ggml_backend_webgpu_wait_on_submission(webgpu_context & ctx) {
235235

236236
static void ggml_backend_webgpu_submit_queue(webgpu_context & ctx) {
237237
std::lock_guard<std::recursive_mutex> lock(ctx->mutex);
238+
if (ctx->staged_command_bufs.empty()) {
239+
// Nothing to submit
240+
return;
241+
}
238242
ctx->queue.Submit(ctx->staged_command_bufs.size(), ctx->staged_command_bufs.data());
239243
ctx->staged_command_bufs.clear();
240244
std::vector<webgpu_param_bufs> staged_param_bufs = std::move(ctx->staged_param_bufs);

0 commit comments

Comments
 (0)