Browse Source

opencl: Only attempt to BFI_INT patch SHA256d kernels

Luke Dashjr 11 years ago
parent
commit
71fe0192d0
1 changed files with 20 additions and 1 deletions
  1. 20 1
      ocl.c

+ 20 - 1
ocl.c

@@ -696,7 +696,10 @@ _clState *opencl_create_clState(unsigned int gpu, char *name, size_t nameSize)
 bool opencl_load_kernel(struct cgpu_info * const cgpu, _clState * const clState, const char * const name, struct opencl_kernel_info * const kernelinfo, const char * const kernel_file, __maybe_unused const struct mining_algorithm * const malgo)
 {
 	const int gpu = cgpu->device_id;
-	bool patchbfi = false, prog_built = false;
+#ifdef USE_SHA256D
+	bool patchbfi = false;
+#endif
+	bool prog_built = false;
 	struct opencl_device_data * const data = cgpu->device_data;
 	const char * const vbuff = clState->platform_ver_str;
 	char *s;
@@ -941,6 +944,7 @@ build:
 	if (clState->hasBitAlign) {
 		strcat(CompilerOptions, " -D BITALIGN");
 		applog(LOG_DEBUG, "cl_amd_media_ops found, setting BITALIGN");
+#ifdef USE_SHA256D
 		if (strstr(name, "Cedar") ||
 		    strstr(name, "Redwood") ||
 		    strstr(name, "Juniper") ||
@@ -962,9 +966,21 @@ build:
 			if ((s = strstr(vbuff, "AMD-APP")) && (s = strchr(s, '(')) && atoi(&s[1]) < 1085)
 				patchbfi = true;
 		}
+#endif
 	} else
 		applog(LOG_DEBUG, "cl_amd_media_ops not found, will not set BITALIGN");
 
+#ifdef USE_SHA256D
+	switch (kernelinfo->interface)
+	{
+		case KL_DIABLO: case KL_DIAKGCN: case KL_PHATK: case KL_POCLBM:
+			// Okay, these actually use BFI_INT hacking
+			break;
+		default:
+			// Anything else has never needed it
+			patchbfi = false;
+			break;
+	}
 	if (patchbfi) {
 		if (data->opt_opencl_binaries == OBU_LOADSAVE)
 		{
@@ -978,6 +994,7 @@ build:
 		}
 	} else
 		applog(LOG_DEBUG, "BFI_INT patch requiring device not found, will not BFI_INT patch");
+#endif
 
 	if (kernelinfo->goffset)
 		strcat(CompilerOptions, " -D GOFFSET");
@@ -1030,6 +1047,7 @@ build:
 		return false;
 	}
 
+#ifdef USE_SHA256D
 	/* Patch the kernel if the hardware supports BFI_INT but it needs to
 	 * be hacked in */
 	if (patchbfi) {
@@ -1079,6 +1097,7 @@ build:
 		/* Program needs to be rebuilt */
 		prog_built = false;
 	}
+#endif
 
 	free(source);