Allow adapterid 0 cards to enumerate as a device as they will be non-AMD cards, and enable ADL on any AMD card.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
diff --git a/adl.c b/adl.c
index 7789319..4f21444 100644
--- a/adl.c
+++ b/adl.c
@@ -192,17 +192,15 @@ void init_adl(int nDevs)
applog(LOG_INFO, "Failed to ADL_Adapter_ID_Get");
continue;
}
- if (!lpAdapterID)
- continue;
/* Each adapter may have multiple entries */
if (lpAdapterID == last_adapter)
continue;
/* We found a truly new adapter instead of a logical
- * one. Now since there's no way of correlating the
- * opencl enumerated devices and the ADL enumerated
- * ones, we have to assume they're in the same order.*/
+ * one. Now since there's no way of correlating the
+ * opencl enumerated devices and the ADL enumerated
+ * ones, we have to assume they're in the same order.*/
if (++devices > nDevs) {
applog(LOG_ERR, "ADL found more devices than opencl");
return;
@@ -210,6 +208,11 @@ void init_adl(int nDevs)
gpu = devices - 1;
last_adapter = lpAdapterID;
+ if (!lpAdapterID) {
+ applog(LOG_INFO, "Adapter returns ID 0 meaning not AMD. Card order might be confused");
+ continue;
+ }
+
/* From here on we know this device is a discrete device and
* should support ADL */
ga = &gpus[gpu].adl;
@@ -218,18 +221,14 @@ void init_adl(int nDevs)
ga->DefPerfLev = NULL;
/* Save whatever the current speed setting is to restore on exit */
- if (ADL_Adapter_Speed_Get(iAdapterIndex, &ga->lpCurrent, &dummy) != ADL_OK) {
+ if (ADL_Adapter_Speed_Get(iAdapterIndex, &ga->lpCurrent, &dummy) != ADL_OK)
applog(LOG_INFO, "Failed to ADL_Adapter_Speed_Get");
- continue;
- }
/* Force the speed to high, whether it's ignored or not */
ADL_Adapter_Speed_Set(iAdapterIndex, ADL_CONTEXT_SPEED_FORCEHIGH);
- if (ADL_Overdrive5_ODParameters_Get(iAdapterIndex, &ga->lpOdParameters) != ADL_OK) {
+ if (ADL_Overdrive5_ODParameters_Get(iAdapterIndex, &ga->lpOdParameters) != ADL_OK)
applog(LOG_INFO, "Failed to ADL_Overdrive5_ODParameters_Get");
- continue;
- }
lev = ga->lpOdParameters.iNumberOfPerformanceLevels - 1;
/* We're only interested in the top performance level */
@@ -237,10 +236,8 @@ void init_adl(int nDevs)
lpOdPerformanceLevels->iSize = sizeof(ADLODPerformanceLevels) + sizeof(ADLODPerformanceLevel) * lev;
/* Get default performance levels first */
- if (ADL_Overdrive5_ODPerformanceLevels_Get(iAdapterIndex, 1, lpOdPerformanceLevels) != ADL_OK) {
+ if (ADL_Overdrive5_ODPerformanceLevels_Get(iAdapterIndex, 1, lpOdPerformanceLevels) != ADL_OK)
applog(LOG_INFO, "Failed to ADL_Overdrive5_ODPerformanceLevels_Get");
- continue;
- }
/* Set the limits we'd use based on default gpu speeds */
ga->maxspeed = ga->minspeed = lpOdPerformanceLevels->aLevels[lev].iEngineClock;