You will also probably need this, this is how the midstate for kernel is computed:
Thanks for sharing! I'm trying to use your kernel in cgminer. Could you please take a look at this:
int skeinhashmid(unsigned char *out, const unsigned char *in)
{
Skein_512_Ctxt_t ctx;
Skein_512_Init (&ctx,8*64);
Skein_512_Update(&ctx,in,(size_t) 80);
memcpy(out, ctx.X, 64);
return 0;
}
#define CL_SET_BLKARG(blkvar) status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->blkvar)
#define CL_SET_ARG(var) status |= clSetKernelArg(*kernel, num++, sizeof(var), (void *)&var)
cl_int queue_skein_kernel(_clState *clState, dev_blk_ctx *blk, __maybe_unused cl_uint threads)
{
cl_kernel *kernel = &clState->kernel;
unsigned int i, num = 0;
cl_int status = 0;
unsigned char swap[80];
uint32_t *swap32 = swap;
flip80(swap32, (uint32_t *)blk->work->data); // convert getwork data to big-endian
unsigned char mid[64];
skeinhashmid(mid, swap); // calc skein midstate?
uint64_t *state64 = (uint64_t *)mid;
uint32_t *data32 = (uint32_t *)swap;
CL_SET_ARG(state64[0]); // kernel state0
CL_SET_ARG(state64[1]); // kernel state1
CL_SET_ARG(state64[2]); // kernel state2
CL_SET_ARG(state64[3]); // kernel state3
CL_SET_ARG(state64[4]); // kernel state4
CL_SET_ARG(state64[5]); // kernel state5
CL_SET_ARG(state64[6]); // kernel state6
CL_SET_ARG(state64[7]); // kernel state7
CL_SET_ARG(data32[16]); // kernel data16
CL_SET_ARG(data32[17]); // kernel data17
CL_SET_ARG(data32[18]); // kernel data18
CL_SET_BLKARG(nonce); // kernel base, i.e. base nonce
CL_SET_ARG(clState->outputBuffer);
return status;
}
Am i doing this right?
Thanks!