Skip to content

Commit

Permalink
Merge pull request #2089 from psychocrypt/topic-OpenCLOptimizeStrided…
Browse files Browse the repository at this point in the history
…Index1

OpenCl: optimize strided index 1
  • Loading branch information
fireice-uk authored Nov 22, 2018
2 parents ff204b2 + 39fa7c6 commit 76f0de7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions xmrstak/backend/amd/amd_gpu/opencl/cryptonight.cl
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ R"===(
#if(STRIDED_INDEX==0)
# define IDX(x) (x)
#elif(STRIDED_INDEX==1)
# define IDX(x) ((x) * (Threads))
# define IDX(x) (mul24(((uint)(x)), Threads))
#elif(STRIDED_INDEX==2)
# define IDX(x) (((x) % MEM_CHUNK) + ((x) / MEM_CHUNK) * WORKSIZE * MEM_CHUNK)
#elif(STRIDED_INDEX==3)
Expand Down Expand Up @@ -867,7 +867,7 @@ __kernel void JOIN(cn2,ALGO) (__global uint4 *Scratchpad, __global ulong *states
#pragma unroll 2
for(int i = 0, i1 = get_local_id(1); i < (MEMORY >> 7); ++i, i1 = (i1 + 16) % (MEMORY >> 4))
{
text ^= Scratchpad[IDX(i1)];
text ^= Scratchpad[IDX((uint)i1)];
barrier(CLK_LOCAL_MEM_FENCE);
text ^= *xin2_load;

Expand All @@ -877,7 +877,7 @@ __kernel void JOIN(cn2,ALGO) (__global uint4 *Scratchpad, __global ulong *states

*xin1_store = text;

text ^= Scratchpad[IDX(i1 + 8)];
text ^= Scratchpad[IDX((uint)i1 + 8u)];
barrier(CLK_LOCAL_MEM_FENCE);
text ^= *xin1_load;

Expand All @@ -894,7 +894,7 @@ __kernel void JOIN(cn2,ALGO) (__global uint4 *Scratchpad, __global ulong *states
#else
#pragma unroll 2
for (int i = 0; i < (MEMORY >> 7); ++i) {
text ^= Scratchpad[IDX((i << 3) + get_local_id(1))];
text ^= Scratchpad[IDX((uint)((i << 3) + get_local_id(1)))];

#pragma unroll 10
for(int j = 0; j < 10; ++j)
Expand Down

0 comments on commit 76f0de7

Please sign in to comment.