feat: Moore Threads GPU add support to query number of cores (#1259)

Signed-off-by: Xiaodong Ye <xiaodong.ye@mthreads.com>
This commit is contained in:
R0CKSTAR 2024-09-12 19:30:02 +08:00 committed by GitHub
parent 119de2e91a
commit 0c4edf7d0e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View File

@ -5,6 +5,7 @@
struct FFMtmlData
{
FF_LIBRARY_SYMBOL(mtmlDeviceCountGpuCores)
FF_LIBRARY_SYMBOL(mtmlDeviceGetBrand)
FF_LIBRARY_SYMBOL(mtmlDeviceGetIndex)
FF_LIBRARY_SYMBOL(mtmlDeviceGetName)
@ -43,6 +44,7 @@ const char *ffDetectMthreadsGpuInfo(const FFGpuDriverCondition *cond, FFGpuDrive
mtmlData.inited = true;
FF_LIBRARY_LOAD(libmtml, "dlopen mtml failed", soName, 1);
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libmtml, mtmlLibraryInit)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libmtml, mtmlData, mtmlDeviceCountGpuCores)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libmtml, mtmlData, mtmlDeviceGetBrand)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libmtml, mtmlData, mtmlDeviceGetIndex)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libmtml, mtmlData, mtmlDeviceGetName)
@ -158,6 +160,9 @@ const char *ffDetectMthreadsGpuInfo(const FFGpuDriverCondition *cond, FFGpuDrive
}
}
if (result.coreCount)
mtmlData.ffmtmlDeviceCountGpuCores(device, result.coreCount);
if (result.frequency)
{
MtmlGpu *gpu = NULL;

View File

@ -56,6 +56,8 @@ typedef struct
int rsvd[6]; //!< Reserved for future extension.
} MtmlPciInfo;
// Retrieves the number of cores of a device.
MtmlReturn MTML_API mtmlDeviceCountGpuCores(const MtmlDevice* device, unsigned int* numCores);
// Retrieves the brand of a device.
MtmlReturn MTML_API mtmlDeviceGetBrand(const MtmlDevice *dev, MtmlBrandType *type);
// Retrieves the index associated with the specified device.