Skip to content

Commit 053158b

Browse files
authored
feat: add CUDA 13 support to backend (#6996)
Add a new feature flag `cuda13` and update feature detection for CUDA 11/12/13 drivers. Include support for the new `cuda-13` backend string, update the supported‑backends list to include Vulkan backends when CUDA 13 is available, and add a download item for the CUDA 13 runtime/library. The minimum driver versions for Linux and Windows have been set to 580, matching the latest CUDA 13 requirements. This extends the llama.cpp extension to work with the newest NVIDIA CUDA toolkit and ensures correct runtime files are fetched during installation.
1 parent 8be6819 commit 053158b

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

extensions/llamacpp-extension/src/backend.ts

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ export async function listSupportedBackends(): Promise<
160160
if (features.cuda12) {
161161
supportedBackends.push('win-cuda-12-common_cpus-x64')
162162
}
163-
if (features.vulkan) supportedBackends.push('win-vulkan-common_cpus-x64')
163+
if (features.cuda13)
164+
if (features.vulkan) supportedBackends.push('win-vulkan-common_cpus-x64')
164165
}
165166
// not available yet, placeholder for future
166167
else if (sysType === 'windows-aarch64' || sysType === 'windows-arm64') {
@@ -287,7 +288,7 @@ export async function downloadBackend(
287288

288289
// also download CUDA runtime + cuBLAS + cuBLASLt if needed
289290
if (
290-
backend.includes('cu11.7') &&
291+
(backend.includes('cu11.7') || backend.includes('cuda-11')) &&
291292
!(await _isCudaInstalled(backendDir, '11.7'))
292293
) {
293294
downloadItems.push({
@@ -299,7 +300,7 @@ export async function downloadBackend(
299300
proxy: proxyConfig,
300301
})
301302
} else if (
302-
backend.includes('cu12.0') &&
303+
(backend.includes('cu12.0') || backend.includes('cuda-12')) &&
303304
!(await _isCudaInstalled(backendDir, '12.0'))
304305
) {
305306
downloadItems.push({
@@ -310,6 +311,18 @@ export async function downloadBackend(
310311
save_path: await joinPath([backendDir, 'build', 'bin', 'cuda12.tar.gz']),
311312
proxy: proxyConfig,
312313
})
314+
} else if (
315+
backend.includes('cuda-13') &&
316+
!(await _isCudaInstalled(backendDir, '13.0'))
317+
) {
318+
downloadItems.push({
319+
url:
320+
source === 'github'
321+
? `https://github.com/janhq/llama.cpp/releases/download/${version}/cudart-llama-bin-${platformName}-cu13.0-x64.tar.gz`
322+
: `https://catalog.jan.ai/llama.cpp/releases/${version}/cudart-llama-bin-${platformName}-cu13.0-x64.tar.gz`,
323+
save_path: await joinPath([backendDir, 'build', 'bin', 'cuda12.tar.gz']),
324+
proxy: proxyConfig,
325+
})
313326
}
314327

315328
const taskId = `llamacpp-${version}-${backend}`.replace(/\./g, '-')
@@ -373,18 +386,22 @@ async function _getSupportedFeatures() {
373386
avx512: sysInfo.cpu.extensions.includes('avx512'),
374387
cuda11: false,
375388
cuda12: false,
389+
cuda13: false,
376390
vulkan: false,
377391
}
378392

379393
// https://docs.nvidia.com/deploy/cuda-compatibility/#cuda-11-and-later-defaults-to-minor-version-compatibility
380394
let minCuda11DriverVersion: string
381395
let minCuda12DriverVersion: string
396+
let minCuda13DriverVersion: string
382397
if (sysInfo.os_type === 'linux') {
383398
minCuda11DriverVersion = '450.80.02'
384399
minCuda12DriverVersion = '525.60.13'
400+
minCuda13DriverVersion = '580'
385401
} else if (sysInfo.os_type === 'windows') {
386402
minCuda11DriverVersion = '452.39'
387403
minCuda12DriverVersion = '527.41'
404+
minCuda13DriverVersion = '580'
388405
}
389406

390407
// TODO: HIP and SYCL
@@ -396,6 +413,9 @@ async function _getSupportedFeatures() {
396413
features.cuda11 = true
397414
if (compareVersions(driverVersion, minCuda12DriverVersion) >= 0)
398415
features.cuda12 = true
416+
if (compareVersions(driverVersion, minCuda13DriverVersion) >= 0) {
417+
features.cuda13 = true
418+
}
399419
}
400420
// Vulkan support check
401421
if (gpuInfo.vulkan_info?.api_version) {
@@ -443,8 +463,10 @@ async function _isCudaInstalled(
443463
const libnameLookup = {
444464
'windows-11.7': `cudart64_110.dll`,
445465
'windows-12.0': `cudart64_12.dll`,
466+
'windows-13.0': `cudart64_130.dll`,
446467
'linux-11.7': `libcudart.so.11.0`,
447468
'linux-12.0': `libcudart.so.12`,
469+
'linux-13.0': `libcudart.so.13`,
448470
}
449471

450472
const key = `${os_type}-${version}`

0 commit comments

Comments
 (0)