chore: bump cortex to the latest version 1.0.10-rc1 to address hardware UI issues (#4622)

* chore: bump cortex to the latest version 1.0.10-rc1 to address hardware API issues

* fix: app crashes while reading properties from undefined value

* fix: cuda engine variant selection logic
This commit is contained in:
Louis 2025-02-11 10:24:47 +07:00 committed by GitHub
parent 386d41028a
commit ceb93cafef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 33 additions and 33 deletions

View File

@ -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

View File

@ -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 = {

View File

@ -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<string> => {
export const engineVariant = async (
gpuSetting?: GpuSetting
): Promise<string> => {
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),
]

View File

@ -1 +1 @@
1.0.9-rc8
1.0.10-rc1

View File

@ -317,7 +317,7 @@ const Hardware = () => {
Compute Capability
</div>
<span>
{item.additional_information.compute_cap}
{item.additional_information?.compute_cap}
</span>
</div>
</div>