From fec4cce56038ea2d6524f7d79598c129d67a2a1b Mon Sep 17 00:00:00 2001 From: Akarshan Biswas Date: Wed, 6 Aug 2025 07:20:44 +0530 Subject: [PATCH] fix: Add conditional Vulkan support check for better GPU compatibility (#6066) Changes: - Introduce conditional Vulkan support check for discrete GPUs with 6GB+ VRAM fixes: #6009 --- extensions/llamacpp-extension/src/backend.ts | 24 ++++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/extensions/llamacpp-extension/src/backend.ts b/extensions/llamacpp-extension/src/backend.ts index e8068f63b..3bf6a2675 100644 --- a/extensions/llamacpp-extension/src/backend.ts +++ b/extensions/llamacpp-extension/src/backend.ts @@ -50,14 +50,18 @@ export async function listSupportedBackends(): Promise< if (features.avx2) supportedBackends.push('linux-avx2-x64') if (features.avx512) supportedBackends.push('linux-avx512-x64') if (features.cuda11) { - if (features.avx512) supportedBackends.push('linux-avx512-cuda-cu11.7-x64') - else if (features.avx2) supportedBackends.push('linux-avx2-cuda-cu11.7-x64') + if (features.avx512) + supportedBackends.push('linux-avx512-cuda-cu11.7-x64') + else if (features.avx2) + supportedBackends.push('linux-avx2-cuda-cu11.7-x64') else if (features.avx) supportedBackends.push('linux-avx-cuda-cu11.7-x64') else supportedBackends.push('linux-noavx-cuda-cu11.7-x64') } if (features.cuda12) { - if (features.avx512) supportedBackends.push('linux-avx512-cuda-cu12.0-x64') - else if (features.avx2) supportedBackends.push('linux-avx2-cuda-cu12.0-x64') + if (features.avx512) + supportedBackends.push('linux-avx512-cuda-cu12.0-x64') + else if (features.avx2) + supportedBackends.push('linux-avx2-cuda-cu12.0-x64') else if (features.avx) supportedBackends.push('linux-avx-cuda-cu12.0-x64') else supportedBackends.push('linux-noavx-cuda-cu12.0-x64') } @@ -256,10 +260,16 @@ async function _getSupportedFeatures() { if (compareVersions(driverVersion, minCuda12DriverVersion) >= 0) features.cuda12 = true } - - if (gpuInfo.vulkan_info?.api_version) features.vulkan = true + // Vulkan support check - only discrete GPUs with 6GB+ VRAM + if ( + gpuInfo.vulkan_info?.api_version && + gpuInfo.vulkan_info?.device_type === 'DISCRETE_GPU' && + gpuInfo.total_memory >= 6 * 1024 + ) { + // 6GB (total_memory is in MB) + features.vulkan = true + } } - return features }