|
|
@ -9,6 +9,12 @@ |
|
|
|
#define LROT(x, bits) __funnelshift_l(x, x, bits) |
|
|
|
#define LROT(x, bits) __funnelshift_l(x, x, bits) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if __CUDA_ARCH__ < 500 |
|
|
|
|
|
|
|
#define TPB 576 |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
#define TPB 1024 |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#define ROTATEUPWARDS7(a) LROT(a,7) |
|
|
|
#define ROTATEUPWARDS7(a) LROT(a,7) |
|
|
|
#define ROTATEUPWARDS11(a) LROT(a,11) |
|
|
|
#define ROTATEUPWARDS11(a) LROT(a,11) |
|
|
|
|
|
|
|
|
|
|
@ -186,19 +192,65 @@ void Final(uint32_t x[2][2][2][2][2], uint32_t *hashval) |
|
|
|
hash_fromx(hashval, x); |
|
|
|
hash_fromx(hashval, x); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if __CUDA_ARCH__ >= 500 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
__global__ __launch_bounds__(TPB, 1) |
|
|
|
|
|
|
|
void cubehash256_gpu_hash_32(uint32_t threads, uint32_t startNounce, uint2 *g_hash) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); |
|
|
|
|
|
|
|
if (thread < threads) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
uint2 Hash[4]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Hash[0] = __ldg(&g_hash[thread]); |
|
|
|
|
|
|
|
Hash[1] = __ldg(&g_hash[thread + 1 * threads]); |
|
|
|
|
|
|
|
Hash[2] = __ldg(&g_hash[thread + 2 * threads]); |
|
|
|
|
|
|
|
Hash[3] = __ldg(&g_hash[thread + 3 * threads]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t x[2][2][2][2][2] = |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
0xEA2BD4B4, 0xCCD6F29F, 0x63117E71, 0x35481EAE, |
|
|
|
|
|
|
|
0x22512D5B, 0xE5D94E63, 0x7E624131, 0xF4CC12BE, |
|
|
|
|
|
|
|
0xC2D0B696, 0x42AF2070, 0xD0720C35, 0x3361DA8C, |
|
|
|
|
|
|
|
0x28CCECA4, 0x8EF8AD83, 0x4680AC00, 0x40E5FBAB, |
|
|
|
|
|
|
|
0xD89041C3, 0x6107FBD5, 0x6C859D41, 0xF0B26679, |
|
|
|
|
|
|
|
0x09392549, 0x5FA25603, 0x65C892FD, 0x93CB6285, |
|
|
|
|
|
|
|
0x2AF2B5AE, 0x9E4B4E60, 0x774ABFDD, 0x85254725, |
|
|
|
|
|
|
|
0x15815AEB, 0x4AB6AAD6, 0x9CDAF8AF, 0xD6032C0A |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
x[0][0][0][0][0] ^= Hash[0].x; |
|
|
|
|
|
|
|
x[0][0][0][0][1] ^= Hash[0].y; |
|
|
|
|
|
|
|
x[0][0][0][1][0] ^= Hash[1].x; |
|
|
|
|
|
|
|
x[0][0][0][1][1] ^= Hash[1].y; |
|
|
|
|
|
|
|
x[0][0][1][0][0] ^= Hash[2].x; |
|
|
|
|
|
|
|
x[0][0][1][0][1] ^= Hash[2].y; |
|
|
|
|
|
|
|
x[0][0][1][1][0] ^= Hash[3].x; |
|
|
|
|
|
|
|
x[0][0][1][1][1] ^= Hash[3].y; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rrounds(x); |
|
|
|
|
|
|
|
x[0][0][0][0][0] ^= 0x80U; |
|
|
|
|
|
|
|
rrounds(x); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Final(x, (uint32_t*) Hash); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
g_hash[thread] = Hash[0]; |
|
|
|
|
|
|
|
g_hash[1 * threads + thread] = Hash[1]; |
|
|
|
|
|
|
|
g_hash[2 * threads + thread] = Hash[2]; |
|
|
|
|
|
|
|
g_hash[3 * threads + thread] = Hash[3]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Die Hash-Funktion |
|
|
|
|
|
|
|
#if __CUDA_ARCH__ <500 |
|
|
|
|
|
|
|
__global__ __launch_bounds__(576,1) |
|
|
|
|
|
|
|
#else |
|
|
|
#else |
|
|
|
__global__ __launch_bounds__(576,1) |
|
|
|
|
|
|
|
#endif |
|
|
|
__global__ __launch_bounds__(TPB, 1) |
|
|
|
void cubehash256_gpu_hash_32(uint32_t threads, uint32_t startNounce, uint64_t *g_hash) |
|
|
|
void cubehash256_gpu_hash_32(uint32_t threads, uint32_t startNounce, uint2 *d_hash) |
|
|
|
{ |
|
|
|
{ |
|
|
|
uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); |
|
|
|
uint32_t thread = (blockDim.x * blockIdx.x + threadIdx.x); |
|
|
|
if (thread < threads) |
|
|
|
if (thread < threads) |
|
|
|
{ |
|
|
|
{ |
|
|
|
uint32_t Hash[8]; // = &g_hash[16 * hashPosition]; |
|
|
|
uint32_t Hash[8]; |
|
|
|
|
|
|
|
uint64_t* g_hash = (uint64_t*) d_hash; |
|
|
|
|
|
|
|
|
|
|
|
LOHI(Hash[0], Hash[1], __ldg(&g_hash[thread])); |
|
|
|
LOHI(Hash[0], Hash[1], __ldg(&g_hash[thread])); |
|
|
|
LOHI(Hash[2], Hash[3], __ldg(&g_hash[thread + 1 * threads])); |
|
|
|
LOHI(Hash[2], Hash[3], __ldg(&g_hash[thread + 1 * threads])); |
|
|
@ -239,14 +291,15 @@ void cubehash256_gpu_hash_32(uint32_t threads, uint32_t startNounce, uint64_t *g |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
__host__ |
|
|
|
__host__ |
|
|
|
void cubehash256_cpu_hash_32(int thr_id, uint32_t threads, uint32_t startNounce, uint64_t *d_hash, int order) |
|
|
|
void cubehash256_cpu_hash_32(int thr_id, uint32_t threads, uint32_t startNounce, uint64_t *d_hash, int order) |
|
|
|
{ |
|
|
|
{ |
|
|
|
uint32_t tpb = 576; |
|
|
|
uint32_t tpb = TPB; |
|
|
|
|
|
|
|
|
|
|
|
dim3 grid((threads + tpb-1)/tpb); |
|
|
|
dim3 grid((threads + tpb-1)/tpb); |
|
|
|
dim3 block(tpb); |
|
|
|
dim3 block(tpb); |
|
|
|
|
|
|
|
|
|
|
|
cubehash256_gpu_hash_32 <<<grid, block>>> (threads, startNounce, d_hash); |
|
|
|
cubehash256_gpu_hash_32 <<<grid, block>>> (threads, startNounce, (uint2*) d_hash); |
|
|
|
} |
|
|
|
} |
|
|
|