Commit 67c4ada1b781e9cec6e2519ef60881dadc3d2fd7

Con Kolivas 2012-02-16T01:10:11

Provide warning on each startup about sdk 2.6 and decrease poclbm kernel selection to LOG_INFO.

diff --git a/ocl.c b/ocl.c
index bd3f72e..ff2551e 100644
--- a/ocl.c
+++ b/ocl.c
@@ -111,6 +111,12 @@ int clDevicesNum(void) {
 		status = clGetPlatformInfo(platform, CL_PLATFORM_VERSION, sizeof(pbuff), pbuff, NULL);
 		if (status == CL_SUCCESS)
 			applog(LOG_INFO, "CL Platform %d version: %s", i, pbuff);
+		if (strstr(pbuff, "844.4") /* Linux 64 bit ATI 2.6 SDK */	||
+		    strstr(pbuff, "851.4") /* Windows 64 bit "" */		||
+		    strstr(pbuff, "831.4") /* Windows & Linux 32 bit "" */ ) {
+				applog(LOG_WARNING, "AMD OpenCL SDK 2.6 installed giving POOR PERFORMANCE on R5xxx and R6xxx.");
+				applog(LOG_WARNING, "Downgrade SDK, delete .bin files and restart cgminer to fix this.");
+		}
 		status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &numDevices);
 		if (status != CL_SUCCESS) {
 			applog(LOG_ERR, "Error: Getting Device IDs (num)");
@@ -231,6 +237,13 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
 	if (status == CL_SUCCESS)
 		applog(LOG_INFO, "CL Platform version: %s", vbuff);
 
+	if (strstr(vbuff, "844.4") /* Linux 64 bit ATI 2.6 SDK */	||
+	    strstr(vbuff, "851.4") /* Windows 64 bit "" */		||
+	    strstr(vbuff, "831.4") /* Windows & Linux 32 bit "" */ ) {
+			applog(LOG_WARNING, "AMD OpenCL SDK 2.6 installed giving POOR PERFORMANCE on R5xxx and R6xxx.");
+			applog(LOG_WARNING, "Downgrade SDK, delete .bin files and restart cgminer to fix this.");
+	}
+
 	status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &numDevices);
 	if (status != CL_SUCCESS) {
 		applog(LOG_ERR, "Error: Getting Device IDs (num)");
@@ -356,15 +369,21 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
 	char numbuf[10];
 
 	if (chosen_kernel == KL_NONE) {
+		/* If no binary is available, and we have a card that suffers with phatk
+		 * on SDK2.6, use the poclbm kernel instead if one has not been
+		 * selected. */
 		if (strstr(name, "Tahiti") // GCN
 		    || !clState->hasBitAlign // Older Radeon & Nvidia
 		    || strstr(vbuff, "844.4") // Linux 64 bit ATI 2.6 SDK
 		    || strstr(vbuff, "851.4") // Windows 64 bit ""
 		    || strstr(vbuff, "831.4") // Windows & Linux 32 bit ""
-		)
+		) {
+			applog(LOG_INFO, "Selecting poclbm kernel");
 			clState->chosen_kernel = KL_POCLBM;
-		else
+		} else {
+			applog(LOG_INFO, "Selecting phatk kernel");
 			clState->chosen_kernel = KL_PHATK;
+		}
 	} else
 		clState->chosen_kernel = chosen_kernel;
 
@@ -481,20 +500,6 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
 	/////////////////////////////////////////////////////////////////
 
 build:
-	/* If no binary is available, and we have a card that suffers with phatk
-	 * on SDK2.6, use the poclbm kernel instead if one has not been
-	 * selected. */
-	if (clState->chosen_kernel == KL_POCLBM && chosen_kernel == KL_NONE &&
-		!strstr(name, "Tahiti") && clState->hasBitAlign &&
-		(strstr(vbuff, "844.4") /* Linux 64 bit ATI 2.6 SDK */	||
-		 strstr(vbuff, "851.4") /* Windows 64 bit "" */		||
-		 strstr(vbuff, "831.4") /* Windows & Linux 32 bit "" */ )) {
-			applog(LOG_WARNING, "AMD OpenCL SDK 2.6 detected, using poclbm kernel");
-			applog(LOG_WARNING, "This SDK will give POOR PERFORMANCE on this device");
-			applog(LOG_WARNING, "To get best performance, remove any .bin files generated by cgminer,");
-			applog(LOG_WARNING, "downgrade your SDK to 2.1-2.5 and restart cgminer.");
-	}
-
 	clState->program = clCreateProgramWithSource(clState->context, 1, (const char **)&source, sourceSize, &status);
 	if (status != CL_SUCCESS) {
 		applog(LOG_ERR, "Error: Loading Binary into cl_program (clCreateProgramWithSource)");