mirror of
https://github.com/GOSTSec/sgminer
synced 2025-09-14 15:11:56 +00:00
Set scrypt settings and buffer size in ocl.c code to be future modifiable.
This commit is contained in:
parent
bd10764e76
commit
243d005b1b
@ -1004,8 +1004,8 @@ static cl_int queue_scrypt_kernel(_clState *clState, dev_blk_ctx *blk, cl_uint t
|
|||||||
CL_SET_ARG(clState->CLbuffer0);
|
CL_SET_ARG(clState->CLbuffer0);
|
||||||
CL_SET_ARG(clState->outputBuffer);
|
CL_SET_ARG(clState->outputBuffer);
|
||||||
CL_SET_ARG(clState->padbuffer8);
|
CL_SET_ARG(clState->padbuffer8);
|
||||||
CL_SET_VARG(4, &midstate[0]);
|
CL_SET_ARG(midstate[0]);
|
||||||
CL_SET_VARG(4, &midstate[16]);
|
CL_SET_ARG(midstate[16]);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
clSetKernelArg(clState->kernel,0,sizeof(cl_mem), &clState->CLbuffer[0]);
|
clSetKernelArg(clState->kernel,0,sizeof(cl_mem), &clState->CLbuffer[0]);
|
||||||
|
23
ocl.c
23
ocl.c
@ -464,6 +464,13 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_SCRYPT
|
||||||
|
if (opt_scrypt) {
|
||||||
|
clState->lookup_gap = 1;
|
||||||
|
clState->thread_concurrency = 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
strcat(binaryfilename, name);
|
strcat(binaryfilename, name);
|
||||||
if (clState->goffset)
|
if (clState->goffset)
|
||||||
strcat(binaryfilename, "g");
|
strcat(binaryfilename, "g");
|
||||||
@ -535,10 +542,13 @@ build:
|
|||||||
/* create a cl program executable for all the devices specified */
|
/* create a cl program executable for all the devices specified */
|
||||||
char *CompilerOptions = calloc(1, 256);
|
char *CompilerOptions = calloc(1, 256);
|
||||||
|
|
||||||
if (opt_scrypt) {
|
#ifdef USE_SCRYPT
|
||||||
sprintf(CompilerOptions, "-D LOOKUP_GAP=1 -D CONCURRENT_THREADS=1 -D WORKSIZE=%d",
|
if (opt_scrypt)
|
||||||
(int)clState->wsize);
|
sprintf(CompilerOptions, "-D LOOKUP_GAP=%d -D CONCURRENT_THREADS=%d -D WORKSIZE=%d",
|
||||||
} else {
|
(int)clState->lookup_gap, (int)clState->thread_concurrency, (int)clState->wsize);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
sprintf(CompilerOptions, "-D WORKSIZE=%d -D VECTORS%d -D WORKVEC=%d",
|
sprintf(CompilerOptions, "-D WORKSIZE=%d -D VECTORS%d -D WORKVEC=%d",
|
||||||
(int)clState->wsize, clState->vwidth, (int)clState->wsize * clState->vwidth);
|
(int)clState->wsize, clState->vwidth, (int)clState->wsize * clState->vwidth);
|
||||||
}
|
}
|
||||||
@ -734,8 +744,11 @@ built:
|
|||||||
|
|
||||||
#ifdef USE_SCRYPT
|
#ifdef USE_SCRYPT
|
||||||
if (opt_scrypt) {
|
if (opt_scrypt) {
|
||||||
|
size_t ipt = (1024 / clState->lookup_gap + (1024 % clState->lookup_gap > 0));
|
||||||
|
size_t bufsize = 128 * ipt * clState->thread_concurrency;
|
||||||
|
|
||||||
clState->CLbuffer0 = clCreateBuffer(clState->context, CL_MEM_READ_ONLY, 128, NULL, &status);
|
clState->CLbuffer0 = clCreateBuffer(clState->context, CL_MEM_READ_ONLY, 128, NULL, &status);
|
||||||
clState->padbuffer8 = clCreateBuffer(clState->context, CL_MEM_READ_WRITE, 131072, NULL, &status);
|
clState->padbuffer8 = clCreateBuffer(clState->context, CL_MEM_READ_WRITE, bufsize, NULL, &status);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
clState->outputBuffer = clCreateBuffer(clState->context, CL_MEM_WRITE_ONLY, BUFFERSIZE, NULL, &status);
|
clState->outputBuffer = clCreateBuffer(clState->context, CL_MEM_WRITE_ONLY, BUFFERSIZE, NULL, &status);
|
||||||
|
2
ocl.h
2
ocl.h
@ -22,6 +22,8 @@ typedef struct {
|
|||||||
#ifdef USE_SCRYPT
|
#ifdef USE_SCRYPT
|
||||||
cl_mem CLbuffer0;
|
cl_mem CLbuffer0;
|
||||||
cl_mem padbuffer8;
|
cl_mem padbuffer8;
|
||||||
|
size_t lookup_gap;
|
||||||
|
size_t thread_concurrency;
|
||||||
#endif
|
#endif
|
||||||
bool hasBitAlign;
|
bool hasBitAlign;
|
||||||
bool hasOpenCL11plus;
|
bool hasOpenCL11plus;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user