1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-10 14:58:01 +00:00

Add debugging output if buffer allocation fails for scrypt and round up bufsize to a multiple of 256.

This commit is contained in:
Con Kolivas 2012-07-23 16:37:13 +10:00
parent 94c94d659a
commit 5087ff9069

17
ocl.c
View File

@ -761,11 +761,22 @@ built:
if (opt_scrypt) {
size_t ipt = (1024 / gpus[gpu].lookup_gap + (1024 % gpus[gpu].lookup_gap > 0));
size_t bufsize = 128 * ipt * gpus[gpu].thread_concurrency;
applog(LOG_DEBUG, "Creating scrypt buffer sized %d", bufsize);
clState->CLbuffer0 = clCreateBuffer(clState->context, CL_MEM_READ_ONLY, 80, NULL, &status);
clState->padbuffer8 = clCreateBuffer(clState->context, CL_MEM_READ_WRITE, bufsize, NULL, &status);
if (bufsize % 256)
bufsize += (256 - bufsize % 256);
applog(LOG_DEBUG, "Creating scrypt buffer sized %d", bufsize);
clState->padbufsize = bufsize;
clState->padbuffer8 = clCreateBuffer(clState->context, CL_MEM_READ_WRITE, bufsize, NULL, &status);
if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error %d: clCreateBuffer (padbuffer8), decrease CT or increase LG", status);
return NULL;
}
clState->CLbuffer0 = clCreateBuffer(clState->context, CL_MEM_READ_ONLY, 128, NULL, &status);
if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error %d: clCreateBuffer (CLbuffer0)", status);
return NULL;
}
}
#endif
clState->outputBuffer = clCreateBuffer(clState->context, CL_MEM_WRITE_ONLY, BUFFERSIZE, NULL, &status);