Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions example.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
setx GPU_FORCE_64BIT_PTR 0

setx GPU_MAX_HEAP_SIZE 100

setx GPU_USE_SYNC_OBJECTS 1

setx GPU_MAX_ALLOC_PERCENT 100

del *.bin


sgminer.exe --no-submit-stale --kernel Lyra2RE -o stratum+tcp://92.27.201.170:9174 -u m -p 1 --gpu-platform 2 -I 19 --shaders 2816 -w 64 -g 2

pause
54 changes: 42 additions & 12 deletions kernel/Lyra2.cl
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,49 @@ __constant static const sph_u64 blake2b_IV[8] =
};

/*Blake2b's rotation*/
static inline sph_u64 rotr64( const sph_u64 w, const unsigned c ){
return rotate(w, (ulong)(64-c));
}

/*Blake2b's G function*/
static inline uint2 ror2(uint2 v, unsigned a) {
uint2 result;
unsigned n = 64 - a;
if (n == 32) { return (uint2)(v.y,v.x); }
if (n < 32) {
result.y = ((v.y << (n)) | (v.x >> (32 - n)));
result.x = ((v.x << (n)) | (v.y >> (32 - n)));
}
else {
result.y = ((v.x << (n - 32)) | (v.y >> (64 - n)));
result.x = ((v.y << (n - 32)) | (v.x >> (64 - n)));
}
return result;
}
static inline uint2 ror2l(uint2 v, unsigned a) {
uint2 result;
result.y = ((v.x << (32-a)) | (v.y >> (a)));
result.x = ((v.y << (32-a)) | (v.x >> (a)));
return result;
}
static inline uint2 ror2r(uint2 v, unsigned a) {
uint2 result;
result.y = ((v.y << (64-a)) | (v.x >> (a-32)));
result.x = ((v.x << (64-a)) | (v.y >> (a-32)));
return result;
}
/*
#define G(a,b,c,d) \
do { \
a += b; d ^= a; d = SPH_ROTR64(d, 32); \
c += d; b ^= c; b = SPH_ROTR64(b, 24); \
a += b; d ^= a; d = SPH_ROTR64(d, 16); \
c += d; b ^= c; b = SPH_ROTR64(b, 63); \
a = as_uint2(as_ulong(a)+as_ulong(b)); d ^= a; d = d.yx; \
c = as_uint2(as_ulong(c)+as_ulong(d)); b ^= c; b = ror2l(b, 24); \
a = as_uint2(as_ulong(a)+as_ulong(b)); d ^= a; d = ror2l(d, 16); \
c = as_uint2(as_ulong(c)+as_ulong(d)); b ^= c; b = ror2r(b, 63); \
} while(0)
*/
#define G(a,b,c,d) \
do { \
a = as_uint2(as_ulong(a)+as_ulong(b)); d ^= a; d = d.yx; \
c = as_uint2(as_ulong(c)+as_ulong(d)); b ^= c; b = as_uint2(as_uchar8(b).s34567012); \
a = as_uint2(as_ulong(a)+as_ulong(b)); d ^= a; d = ror2l(d, 16); \
c = as_uint2(as_ulong(c)+as_ulong(d)); b ^= c; b = ror2r(b, 63); \
} while(0)


/*One Round of the Blake2b's compression function*/
#define round_lyra(v) \
Expand All @@ -72,7 +102,7 @@ c += d; b ^= c; b = SPH_ROTR64(b, 63); \
for (int i = 0; i < 8; i++) \
{ \
\
for (int j = 0; j < 12; j++) {state[j] ^= Matrix[12 * i + j][rowIn] + Matrix[12 * i + j][rowInOut];} \
for (int j = 0; j < 12; j++) {state[j] ^= as_uint2(as_ulong(Matrix[12 * i + j][rowIn]) + as_ulong(Matrix[12 * i + j][rowInOut]));} \
round_lyra(state); \
for (int j = 0; j < 12; j++) {Matrix[j + 84 - 12 * i][rowOut] = Matrix[12 * i + j][rowIn] ^ state[j];} \
\
Expand All @@ -97,7 +127,7 @@ c += d; b ^= c; b = SPH_ROTR64(b, 63); \
for (int i = 0; i < 8; i++) \
{ \
for (int j = 0; j < 12; j++) \
state[j] ^= Matrix[12 * i + j][rowIn] + Matrix[12 * i + j][rowInOut]; \
state[j] ^= as_uint2(as_ulong(Matrix[12 * i + j][rowIn]) + as_ulong(Matrix[12 * i + j][rowInOut])); \
\
round_lyra(state); \
for (int j = 0; j < 12; j++) {Matrix[j + 12 * i][rowOut] ^= state[j];} \
Expand Down Expand Up @@ -142,4 +172,4 @@ c += d; b ^= c; b = SPH_ROTR64(b, 63); \
round_lyra(state); \
round_lyra(state); \
round_lyra(state); \
}
}
Loading