Browse Source

Add hardware name to binary kernel name allowing for unique kernels for different cards on the same machine.

Con Kolivas 14 years ago
parent
commit
821da37c84
1 changed files with 4 additions and 3 deletions
  1. 4 3
      ocl.c

+ 4 - 3
ocl.c

@@ -334,7 +334,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
 	/* Create binary filename based on parameters passed to opencl
 	/* Create binary filename based on parameters passed to opencl
 	 * compiler to ensure we only load a binary that matches what would
 	 * compiler to ensure we only load a binary that matches what would
 	 * have otherwise created. The filename is:
 	 * have otherwise created. The filename is:
-	 * kernelname +/i bitalign + v + vectors + w + work_size + sizeof(long) + .bin
+	 * name + kernelname +/i bitalign + v + vectors + w + work_size + sizeof(long) + .bin
 	 */
 	 */
 	char binaryfilename[255];
 	char binaryfilename[255];
 	char numbuf[10];
 	char numbuf[10];
@@ -367,11 +367,12 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
 		return NULL;
 		return NULL;
 	}
 	}
 
 
+	strcpy(binaryfilename, name);
 	if (clState->hasBitAlign) {
 	if (clState->hasBitAlign) {
-		strcpy(binaryfilename, "phatk");
+		strcat(binaryfilename, "phatk");
 		strcat(binaryfilename, "bitalign");
 		strcat(binaryfilename, "bitalign");
 	} else
 	} else
-		strcpy(binaryfilename, "poclbm");
+		strcat(binaryfilename, "poclbm");
 	strcat(binaryfilename, "v");
 	strcat(binaryfilename, "v");
 	sprintf(numbuf, "%d", clState->preferred_vwidth);
 	sprintf(numbuf, "%d", clState->preferred_vwidth);
 	strcat(binaryfilename, numbuf);
 	strcat(binaryfilename, numbuf);