From 9d5b1183091169392ebfe2c4f917858cc1e6ddb7 Mon Sep 17 00:00:00 2001 From: Louis Date: Tue, 11 Feb 2025 09:28:21 +0700 Subject: [PATCH 1/3] chore: bump cortex to the latest version 1.0.10-rc1 to address hardware API issues --- extensions/inference-cortex-extension/bin/version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/inference-cortex-extension/bin/version.txt b/extensions/inference-cortex-extension/bin/version.txt index 00a5e9492a..2c85ca1805 100644 --- a/extensions/inference-cortex-extension/bin/version.txt +++ b/extensions/inference-cortex-extension/bin/version.txt @@ -1 +1 @@ -1.0.9-rc8 +1.0.10-rc1 From baeb305290f3ece2cfc83782ef5bd7b8146b7a90 Mon Sep 17 00:00:00 2001 From: Louis Date: Tue, 11 Feb 2025 09:42:03 +0700 Subject: [PATCH 2/3] fix: app crashes while reading properties from undefined value --- web/screens/Settings/Hardware/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/screens/Settings/Hardware/index.tsx b/web/screens/Settings/Hardware/index.tsx index 7a13dbec9c..cd9c302db1 100644 --- a/web/screens/Settings/Hardware/index.tsx +++ b/web/screens/Settings/Hardware/index.tsx @@ -317,7 +317,7 @@ const Hardware = () => { Compute Capability - {item.additional_information.compute_cap} + {item.additional_information?.compute_cap} From f2fe980b62b365350081d212287b45c915d53c36 Mon Sep 17 00:00:00 2001 From: Louis Date: Tue, 11 Feb 2025 10:05:33 +0700 Subject: [PATCH 3/3] fix: cuda engine variant selection logic --- core/src/types/hardware/index.ts | 2 +- .../types/miscellaneous/systemResourceInfo.ts | 17 ++++---- .../engine-management-extension/src/utils.ts | 43 +++++++++---------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/core/src/types/hardware/index.ts b/core/src/types/hardware/index.ts index f729ba4e53..d154a44179 100644 --- a/core/src/types/hardware/index.ts +++ b/core/src/types/hardware/index.ts @@ -13,7 +13,7 @@ export type GpuAdditionalInformation = { export type Gpu = { activated: boolean - additional_information: GpuAdditionalInformation + additional_information?: GpuAdditionalInformation free_vram: number id: string name: string diff --git a/core/src/types/miscellaneous/systemResourceInfo.ts b/core/src/types/miscellaneous/systemResourceInfo.ts index c29327e743..9361b79b62 100644 --- a/core/src/types/miscellaneous/systemResourceInfo.ts +++ b/core/src/types/miscellaneous/systemResourceInfo.ts @@ -1,4 +1,4 @@ - +import { GpuAdditionalInformation } from '../hardware' export type SystemResourceInfo = { memAvailable: number @@ -12,13 +12,14 @@ export type GpuSetting = { } export type GpuSettingInfo = { - activated: boolean; - free_vram: number; - id: string; - name: string; - total_vram: number; - uuid: string; - version: string; + activated: boolean + free_vram: number + id: string + name: string + total_vram: number + uuid: string + version: string + additional_information?: GpuAdditionalInformation } export type SystemInformation = { diff --git a/extensions/engine-management-extension/src/utils.ts b/extensions/engine-management-extension/src/utils.ts index 588fd938cd..eb2b47e539 100644 --- a/extensions/engine-management-extension/src/utils.ts +++ b/extensions/engine-management-extension/src/utils.ts @@ -1,8 +1,4 @@ - -import { - GpuSetting, - log, -} from '@janhq/core' +import { GpuSetting, log } from '@janhq/core' /** * The GPU runMode that will be set - either 'vulkan', 'cuda', or empty for cpu. @@ -10,14 +6,15 @@ import { * @returns */ - const gpuRunMode = (settings?: GpuSetting): string => { - - if (!settings) return '' - - return settings.vulkan === true || - settings.gpus?.some((gpu) => gpu.activated !== true) - ? '' - : 'cuda' +const gpuRunMode = (settings?: GpuSetting): string => { + return settings.gpus?.some( + (gpu) => + gpu.activated === true && + gpu.additional_information && + gpu.additional_information.driver_version + ) + ? 'cuda' + : '' } /** @@ -28,10 +25,10 @@ const os = (settings?: GpuSetting): string => { return PLATFORM === 'win32' ? 'windows-amd64' : PLATFORM === 'darwin' - ? settings?.cpu?.arch === 'arm64' - ? 'mac-arm64' - : 'mac-amd64' - : 'linux-amd64' + ? settings?.cpu?.arch === 'arm64' + ? 'mac-arm64' + : 'mac-amd64' + : 'linux-amd64' } /** @@ -60,16 +57,18 @@ const cudaVersion = (settings?: GpuSetting): '12-0' | '11-7' | undefined => { /** * Find which variant to run based on the current platform. */ -export const engineVariant = async (gpuSetting?: GpuSetting): Promise => { +export const engineVariant = async ( + gpuSetting?: GpuSetting +): Promise => { let engineVariant = [ os(gpuSetting), gpuSetting?.vulkan ? 'vulkan' : (gpuRunMode(gpuSetting) === 'cuda' && // GPU mode - packaged CUDA variants of avx2 and noavx - gpuSetting.cpu.instructions.some((inst) => inst === 'avx2')) || - gpuSetting.cpu.instructions.some((inst) => inst === 'avx512') - ? 'avx2' - : 'noavx', + gpuSetting.cpu.instructions.some((inst) => inst === 'avx2')) || + gpuSetting.cpu.instructions.some((inst) => inst === 'avx512') + ? 'avx2' + : 'noavx', gpuRunMode(gpuSetting), cudaVersion(gpuSetting), ]