-
Notifications
You must be signed in to change notification settings - Fork 450
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
1,478 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"home": "https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK", | ||
"license": "MIT (embeded in source)", | ||
"version": "AGS v6.2.0", | ||
"author": "Advanced Micro Devices, Inc" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#include "gpu_driver_specific.h" | ||
|
||
// Everything detected in this file is static. | ||
// The real time monitoring requires ADLX, whose interface is much more complicated than AGS | ||
// Whoever has AMD graphic cards interested in this may contribute | ||
// * ADLX (AMD Device Library eXtra): https://github.com/GPUOpen-LibrariesAndSDKs/ADLX | ||
|
||
#include "3rdparty/ags/amd_ags.h" | ||
#include "common/library.h" | ||
#include "util/mallocHelper.h" | ||
|
||
const char* ffDetectAmdGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverResult result, const char* soName) | ||
{ | ||
static bool inited = false; | ||
static AGSGPUInfo gpuInfo; | ||
|
||
if (!inited) | ||
{ | ||
inited = true; | ||
FF_LIBRARY_LOAD(libags, NULL, "dlopen amd_ags failed", soName , 1); | ||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libags, agsInitialize) | ||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libags, agsDeInitialize) | ||
|
||
struct AGSContext* apiHandle; | ||
if (ffagsInitialize(AGS_CURRENT_VERSION, NULL, &apiHandle, &gpuInfo) != AGS_SUCCESS) | ||
return "loading ags library failed"; | ||
|
||
ffagsDeInitialize(apiHandle); | ||
} | ||
|
||
if (!gpuInfo.numDevices == 0) | ||
return "loading ags library failed or no AMD gpus found"; | ||
|
||
AGSDeviceInfo* device = NULL; | ||
|
||
for (int iDev = 0; iDev < gpuInfo.numDevices; iDev++) | ||
{ | ||
if (cond->type & FF_GPU_DRIVER_CONDITION_TYPE_DEVICE_ID) | ||
{ | ||
if ( | ||
cond->pciDeviceId.deviceId == (uint32_t) gpuInfo.devices[iDev].deviceId && | ||
cond->pciDeviceId.vendorId == (uint32_t) gpuInfo.devices[iDev].vendorId && | ||
cond->pciDeviceId.revId == (uint32_t) gpuInfo.devices[iDev].revisionId) | ||
{ | ||
device = &gpuInfo.devices[iDev]; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
if (!device) | ||
return "Device not found"; | ||
|
||
if (result.coreCount) | ||
*result.coreCount = (uint32_t) device->numCUs; | ||
|
||
if (result.memory) | ||
{ | ||
result.memory->total = device->localMemoryInBytes; | ||
result.memory->used = FF_GPU_VMEM_SIZE_UNSET; | ||
} | ||
|
||
if (result.frequency) | ||
*result.frequency = device->coreClock / 1000.; // Maximum frequency | ||
|
||
return NULL; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters