Browse Source

opencl: ADL: ADL_Adapter_ID_Get fails with newer drivers, so tolerate its failure best we can

Luke Dashjr 12 years ago
parent
commit
41b944e965
1 changed files with 7 additions and 9 deletions
  1. 7 9
      adl.c

+ 7 - 9
adl.c

@@ -251,12 +251,16 @@ void init_adl(int nDevs)
 			applog(LOG_INFO, "Failed to ADL_Adapter_ID_Get. Error %d", result);
 			if (result == -10)
 				applog(LOG_INFO, "This error says the device is not enabled");
-			continue;
 		}
-
+		else
 		/* Each adapter may have multiple entries */
 		if (lpAdapterID == last_adapter)
 			continue;
+		else
+		if (!lpAdapterID)
+			applog(LOG_INFO, "Adapter returns ID 0 meaning not AMD. Card order might be confused");
+		else
+			last_adapter = lpAdapterID;
 
 		applog(LOG_DEBUG, "GPU %d "
 		       "iAdapterIndex %d "
@@ -289,12 +293,6 @@ void init_adl(int nDevs)
 			applog(LOG_ERR, "Use the gpu map feature to reliably map OpenCL to ADL");
 			devs_match = false;
 		}
-		last_adapter = lpAdapterID;
-
-		if (!lpAdapterID) {
-			applog(LOG_INFO, "Adapter returns ID 0 meaning not AMD. Card order might be confused");
-			continue;
-		}
 	}
 
 	if (devices < nDevs) {
@@ -367,7 +365,7 @@ void init_adl(int nDevs)
 		result = ADL_Adapter_ID_Get(iAdapterIndex, &lpAdapterID);
 		if (result != ADL_OK) {
 			applog(LOG_INFO, "Failed to ADL_Adapter_ID_Get. Error %d", result);
-			continue;
+			lpAdapterID = -1;
 		}
 
 		if (gpus[gpu].deven == DEV_DISABLED) {