]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
vulkan: for small AMD GPUs, reduce submission threshold based on CU count (#25240)
authorRuben Ortlam <redacted>
Wed, 8 Jul 2026 16:15:18 +0000 (18:15 +0200)
committerGitHub <redacted>
Wed, 8 Jul 2026 16:15:18 +0000 (18:15 +0200)
ggml/src/ggml-vulkan/ggml-vulkan.cpp

index 96d89943aebc87ebbe3efb543e521584bf8bdf8b..15f22ae49ea7c460b9d59d50b510dc0f66e69714 100644 (file)
@@ -16308,7 +16308,18 @@ static ggml_status ggml_backend_vk_graph_compute(ggml_backend_t backend, ggml_cg
     uint32_t submit_count = 0;
     uint64_t batch_flops = 0;
     uint64_t total_flops = 0;
-    uint64_t flops_per_submit = std::min(uint64_t(200'000'000'000), ctx->last_total_flops / 40u);
+    uint64_t flops_cap = 200'000'000'000ULL;
+
+    // On weaker AMD GPUs larger submissions can hit a driver timeout, submit more often to avoid this
+    if (ctx->device->vendor_id == VK_VENDOR_ID_AMD && ctx->device->shader_core_count > 0) {
+        if (ctx->device->architecture == AMD_GCN && ctx->device->shader_core_count < 32) {
+            flops_cap = 500'000'000ULL * ctx->device->shader_core_count;
+        } else if (ctx->device->architecture != AMD_GCN && ctx->device->shader_core_count < 24) {
+            flops_cap = 2'000'000'000ULL * ctx->device->shader_core_count;
+        }
+    }
+    uint64_t flops_per_submit = std::min(flops_cap, ctx->last_total_flops / 40u);
+
     for (int i = 0; i < cgraph->n_nodes; i++) {
         if (first_node_in_batch) {
             submit_node_idx = i;