mirror of
https://github.com/lone-cloud/gerbil
synced 2026-06-03 09:33:10 -07:00
re-fix clblast for windows
This commit is contained in:
parent
caaf2427d3
commit
ddf42c41db
4 changed files with 17 additions and 61 deletions
|
|
@ -4,5 +4,6 @@
|
|||
"singleQuote": true,
|
||||
"printWidth": 80,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false
|
||||
"useTabs": false,
|
||||
"endOfLine": "lf"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import {
|
|||
memLayout as siMemLayout,
|
||||
} from 'systeminformation';
|
||||
import { safeExecute } from '@/utils/node/logging';
|
||||
import { getGPUData, detectGPUViaSI } from '@/utils/node/gpu';
|
||||
import { getGPUData } from '@/utils/node/gpu';
|
||||
import type {
|
||||
CPUCapabilities,
|
||||
GPUCapabilities,
|
||||
|
|
@ -63,13 +63,10 @@ export async function detectGPU() {
|
|||
return basicGPUInfoCache;
|
||||
}
|
||||
|
||||
const result = await safeExecute(async () => {
|
||||
if (platform === 'linux') {
|
||||
return detectLinuxGPUViaVulkan();
|
||||
}
|
||||
|
||||
return detectGPUViaSI();
|
||||
}, 'GPU detection failed');
|
||||
const result = await safeExecute(
|
||||
() => detectLinuxGPUViaVulkan(),
|
||||
'GPU detection failed'
|
||||
);
|
||||
|
||||
const fallbackGPUInfo = {
|
||||
hasAMD: false,
|
||||
|
|
@ -396,7 +393,10 @@ function findComputeUnitsInClInfo(lines: string[], startIndex: number) {
|
|||
) {
|
||||
const nextLine = lines[j].trim();
|
||||
if (nextLine.includes('Max compute units')) {
|
||||
const units = nextLine.split('Max compute units')[1]?.trim();
|
||||
const units = nextLine
|
||||
.split('Max compute units')[1]
|
||||
?.trim()
|
||||
.replace(/^:?\s*/, '');
|
||||
return units ? parseInt(units, 10) : 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -410,13 +410,9 @@ async function detectCLBlast() {
|
|||
const { stdout } = await execa('clinfo', [], COMMON_EXEC_OPTIONS);
|
||||
|
||||
if (stdout.trim()) {
|
||||
const devices = parseClInfoOutput(stdout);
|
||||
|
||||
const version = 'Available';
|
||||
|
||||
return {
|
||||
devices,
|
||||
version,
|
||||
devices: parseClInfoOutput(stdout),
|
||||
version: 'Available',
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -142,7 +142,10 @@ export async function getAvailableBackends(includeDisabled = false) {
|
|||
}
|
||||
|
||||
if (backendSupport.clblast) {
|
||||
const isSupported = hardwareCapabilities.clblast.devices.length > 0;
|
||||
const discreteDevices = hardwareCapabilities.clblast.devices.filter(
|
||||
(device) => typeof device === 'string' || !device.isIntegrated
|
||||
);
|
||||
const isSupported = discreteDevices.length > 0;
|
||||
if (isSupported || includeDisabled) {
|
||||
backends.push({
|
||||
value: 'clblast',
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import { readFile, readdir } from 'fs/promises';
|
|||
import { join } from 'path';
|
||||
import { platform } from 'process';
|
||||
import { graphics as siGraphics } from 'systeminformation';
|
||||
import { formatDeviceName } from '../format';
|
||||
|
||||
interface CachedGPUInfo {
|
||||
devicePath: string;
|
||||
|
|
@ -215,46 +214,3 @@ export function isDiscreteBusAddress(busAddress?: string) {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
export async function detectGPUViaSI() {
|
||||
const graphics = await siGraphics();
|
||||
|
||||
let hasAMD = false;
|
||||
let hasNVIDIA = false;
|
||||
const gpuInfo: string[] = [];
|
||||
|
||||
const discreteControllers = graphics.controllers.filter((controller) => {
|
||||
if (platform === 'linux' && controller.busAddress) {
|
||||
return isDiscreteBusAddress(controller.busAddress);
|
||||
}
|
||||
|
||||
if (platform === 'win32') {
|
||||
return controller.vram && controller.vram >= 1024;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
for (const controller of discreteControllers) {
|
||||
if (
|
||||
controller.vendor?.toLowerCase().includes('amd') ||
|
||||
controller.vendor?.toLowerCase().includes('ati')
|
||||
) {
|
||||
hasAMD = true;
|
||||
}
|
||||
|
||||
if (controller.vendor?.toLowerCase().includes('nvidia')) {
|
||||
hasNVIDIA = true;
|
||||
}
|
||||
|
||||
if (controller.model) {
|
||||
gpuInfo.push(formatDeviceName(controller.model));
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
hasAMD,
|
||||
hasNVIDIA,
|
||||
gpuInfo: gpuInfo.length > 0 ? gpuInfo : [],
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue