GPU: clean up GPU index detection code

This commit is contained in:
李通洲
2024-09-19 15:38:43 +08:00
parent 503a8d51ab
commit 0bcbae90e9
7 changed files with 14 additions and 12 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ typedef struct FFGPUMemory
typedef struct FFGPUResult
{
uint8_t index;
uint32_t index;
FFGPUType type;
FFstrbuf vendor;
FFstrbuf name;
+3
View File
@@ -65,5 +65,8 @@ const char* ffDetectAmdGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverResu
if (result.type)
*result.type = device->isAPU ? FF_GPU_TYPE_INTEGRATED : FF_GPU_TYPE_DISCRETE;
if (result.index)
*result.type = (uint32_t) device->adlAdapterIndex;
return NULL;
}
+1 -1
View File
@@ -43,7 +43,7 @@ const char* ffGpuDetectMetal(FFlist* gpus)
ffStrbufSetStatic(&gpu->platformApi, "Metal Common 1");
gpu->type = device.hasUnifiedMemory ? FF_GPU_TYPE_INTEGRATED : FF_GPU_TYPE_DISCRETE;
gpu->index = (uint8_t)device.locationNumber;
gpu->index = (uint32_t) device.locationNumber;
#endif
}
return NULL;
+1 -1
View File
@@ -37,7 +37,7 @@ typedef struct FFGpuDriverCondition
// detect x if not NULL
typedef struct FFGpuDriverResult
{
uint8_t* index;
uint32_t* index;
double* temp;
FFGPUMemory* memory;
uint32_t* coreCount;
+1 -1
View File
@@ -138,7 +138,7 @@ const char *ffDetectMthreadsGpuInfo(const FFGpuDriverCondition *cond, FFGpuDrive
{
unsigned int value;
if (mtmlData.ffmtmlDeviceGetIndex(device, &value) == MTML_SUCCESS)
*result.index = (uint8_t)value;
*result.index = value;
}
if (result.temp)
+2 -2
View File
@@ -111,9 +111,9 @@ const char* ffDetectNvidiaGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverR
{
unsigned int value;
if (nvmlData.ffnvmlDeviceGetIndex(device, &value) == NVML_SUCCESS)
*result.index = (uint8_t)value;
*result.index = value;
}
if (result.temp)
{