|
|
@ -1,16 +1,11 @@ |
|
|
|
#include <cuda.h> |
|
|
|
|
|
|
|
#include "cuda_runtime.h" |
|
|
|
|
|
|
|
#include "device_launch_parameters.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdio.h> |
|
|
|
#include <stdio.h> |
|
|
|
#include <memory.h> |
|
|
|
#include <memory.h> |
|
|
|
|
|
|
|
|
|
|
|
#define USE_SHUFFLE 0 |
|
|
|
#include "cuda_helper.h" |
|
|
|
|
|
|
|
|
|
|
|
// Folgende Definitionen später durch header ersetzen |
|
|
|
#define ROTR(x,n) ROTR64(x,n) |
|
|
|
typedef unsigned char uint8_t; |
|
|
|
|
|
|
|
typedef unsigned int uint32_t; |
|
|
|
#define USE_SHUFFLE 0 |
|
|
|
typedef unsigned long long uint64_t; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// aus heavy.cu |
|
|
|
// aus heavy.cu |
|
|
|
extern cudaError_t MyStreamSynchronize(cudaStream_t stream, int situation, int thr_id); |
|
|
|
extern cudaError_t MyStreamSynchronize(cudaStream_t stream, int situation, int thr_id); |
|
|
@ -42,49 +37,8 @@ const uint8_t host_sigma[16][16] = |
|
|
|
{ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } |
|
|
|
{ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// das Hi Word aus einem 64 Bit Typen extrahieren |
|
|
|
__device__ __constant__ |
|
|
|
static __device__ uint32_t HIWORD(const uint64_t &x) { |
|
|
|
const uint64_t c_u512[16] = |
|
|
|
#if __CUDA_ARCH__ >= 130 |
|
|
|
|
|
|
|
return (uint32_t)__double2hiint(__longlong_as_double(x)); |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
return (uint32_t)(x >> 32); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// das Hi Word in einem 64 Bit Typen ersetzen |
|
|
|
|
|
|
|
static __device__ uint64_t REPLACE_HIWORD(const uint64_t &x, const uint32_t &y) { |
|
|
|
|
|
|
|
return (x & 0xFFFFFFFFULL) | (((uint64_t)y) << 32ULL); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// das Lo Word aus einem 64 Bit Typen extrahieren |
|
|
|
|
|
|
|
static __device__ uint32_t LOWORD(const uint64_t &x) { |
|
|
|
|
|
|
|
#if __CUDA_ARCH__ >= 130 |
|
|
|
|
|
|
|
return (uint32_t)__double2loint(__longlong_as_double(x)); |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
return (uint32_t)(x & 0xFFFFFFFFULL); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#if 0 |
|
|
|
|
|
|
|
// das Lo Word in einem 64 Bit Typen ersetzen |
|
|
|
|
|
|
|
static __device__ uint64_t REPLACE_LOWORD(const uint64_t &x, const uint32_t &y) { |
|
|
|
|
|
|
|
return (x & 0xFFFFFFFF00000000ULL) | ((uint64_t)y); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
__device__ __forceinline__ uint64_t SWAP64(uint64_t x) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Input: 77665544 33221100 |
|
|
|
|
|
|
|
// Output: 00112233 44556677 |
|
|
|
|
|
|
|
uint64_t temp[2]; |
|
|
|
|
|
|
|
temp[0] = __byte_perm(HIWORD(x), 0, 0x0123); |
|
|
|
|
|
|
|
temp[1] = __byte_perm(LOWORD(x), 0, 0x0123); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return temp[0] | (temp[1]<<32); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
__constant__ uint64_t c_u512[16]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const uint64_t host_u512[16] = |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
0x243f6a8885a308d3ULL, 0x13198a2e03707344ULL, |
|
|
|
0x243f6a8885a308d3ULL, 0x13198a2e03707344ULL, |
|
|
|
0xa4093822299f31d0ULL, 0x082efa98ec4e6c89ULL, |
|
|
|
0xa4093822299f31d0ULL, 0x082efa98ec4e6c89ULL, |
|
|
@ -96,24 +50,6 @@ const uint64_t host_u512[16] = |
|
|
|
0x0801f2e2858efc16ULL, 0x636920d871574e69ULL |
|
|
|
0x0801f2e2858efc16ULL, 0x636920d871574e69ULL |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// diese 64 Bit Rotates werden unter Compute 3.5 (und besser) mit dem Funnel Shifter beschleunigt |
|
|
|
|
|
|
|
#if __CUDA_ARCH__ >= 350 |
|
|
|
|
|
|
|
__forceinline__ __device__ uint64_t ROTR(const uint64_t value, const int offset) { |
|
|
|
|
|
|
|
uint2 result; |
|
|
|
|
|
|
|
if(offset < 32) { |
|
|
|
|
|
|
|
asm("shf.r.wrap.b32 %0, %1, %2, %3;" : "=r"(result.x) : "r"(__double2loint(__longlong_as_double(value))), "r"(__double2hiint(__longlong_as_double(value))), "r"(offset)); |
|
|
|
|
|
|
|
asm("shf.r.wrap.b32 %0, %1, %2, %3;" : "=r"(result.y) : "r"(__double2hiint(__longlong_as_double(value))), "r"(__double2loint(__longlong_as_double(value))), "r"(offset)); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
asm("shf.r.wrap.b32 %0, %1, %2, %3;" : "=r"(result.x) : "r"(__double2hiint(__longlong_as_double(value))), "r"(__double2loint(__longlong_as_double(value))), "r"(offset)); |
|
|
|
|
|
|
|
asm("shf.r.wrap.b32 %0, %1, %2, %3;" : "=r"(result.y) : "r"(__double2loint(__longlong_as_double(value))), "r"(__double2hiint(__longlong_as_double(value))), "r"(offset)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return __double_as_longlong(__hiloint2double(result.y, result.x)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
#define ROTR(x, n) (((x) >> (n)) | ((x) << (64 - (n)))) |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define G(a,b,c,d,e) \ |
|
|
|
#define G(a,b,c,d,e) \ |
|
|
|
v[a] += (m[sigma[i][e]] ^ u512[sigma[i][e+1]]) + v[b];\ |
|
|
|
v[a] += (m[sigma[i][e]] ^ u512[sigma[i][e+1]]) + v[b];\ |
|
|
|
v[d] = ROTR( v[d] ^ v[a],32); \ |
|
|
|
v[d] = ROTR( v[d] ^ v[a],32); \ |
|
|
@ -125,14 +61,14 @@ __forceinline__ __device__ uint64_t ROTR(const uint64_t value, const int offset) |
|
|
|
v[b] = ROTR( v[b] ^ v[c],11); |
|
|
|
v[b] = ROTR( v[b] ^ v[c],11); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
__device__ void quark_blake512_compress( uint64_t *h, const uint64_t *block, const uint8_t ((*sigma)[16]), const uint64_t *u512, const int bits ) |
|
|
|
__device__ static |
|
|
|
|
|
|
|
void quark_blake512_compress( uint64_t *h, const uint64_t *block, const uint8_t ((*sigma)[16]), const uint64_t *u512, const int bits ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
uint64_t v[16], m[16], i; |
|
|
|
uint64_t v[16], m[16], i; |
|
|
|
|
|
|
|
|
|
|
|
#pragma unroll 16 |
|
|
|
#pragma unroll 16 |
|
|
|
for( i = 0; i < 16; ++i ) |
|
|
|
for( i = 0; i < 16; ++i ) { |
|
|
|
{ |
|
|
|
m[i] = cuda_swab64(block[i]); |
|
|
|
m[i] = SWAP64(block[i]); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#pragma unroll 8 |
|
|
|
#pragma unroll 8 |
|
|
@ -169,24 +105,8 @@ __device__ void quark_blake512_compress( uint64_t *h, const uint64_t *block, con |
|
|
|
for( i = 0; i < 16; ++i ) h[i % 8] ^= v[i]; |
|
|
|
for( i = 0; i < 16; ++i ) h[i % 8] ^= v[i]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Endian Drehung für 32 Bit Typen |
|
|
|
__device__ __constant__ |
|
|
|
|
|
|
|
static const uint64_t d_constMem[8] = { |
|
|
|
static __device__ uint32_t cuda_swab32(uint32_t x) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return __byte_perm(x, 0, 0x0123); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
// Endian Drehung für 64 Bit Typen |
|
|
|
|
|
|
|
static __device__ uint64_t cuda_swab64(uint64_t x) { |
|
|
|
|
|
|
|
uint32_t h = (x >> 32); |
|
|
|
|
|
|
|
uint32_t l = (x & 0xFFFFFFFFULL); |
|
|
|
|
|
|
|
return (((uint64_t)cuda_swab32(l)) << 32) | ((uint64_t)cuda_swab32(h)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static __constant__ uint64_t d_constMem[8]; |
|
|
|
|
|
|
|
static const uint64_t h_constMem[8] = { |
|
|
|
|
|
|
|
0x6a09e667f3bcc908ULL, |
|
|
|
0x6a09e667f3bcc908ULL, |
|
|
|
0xbb67ae8584caa73bULL, |
|
|
|
0xbb67ae8584caa73bULL, |
|
|
|
0x3c6ef372fe94f82bULL, |
|
|
|
0x3c6ef372fe94f82bULL, |
|
|
@ -197,8 +117,8 @@ static const uint64_t h_constMem[8] = { |
|
|
|
0x5be0cd19137e2179ULL }; |
|
|
|
0x5be0cd19137e2179ULL }; |
|
|
|
|
|
|
|
|
|
|
|
// Hash-Padding |
|
|
|
// Hash-Padding |
|
|
|
static __constant__ uint64_t d_constHashPadding[8]; |
|
|
|
__device__ __constant__ |
|
|
|
static const uint64_t h_constHashPadding[8] = { |
|
|
|
static const uint64_t d_constHashPadding[8] = { |
|
|
|
0x0000000000000080ull, |
|
|
|
0x0000000000000080ull, |
|
|
|
0, |
|
|
|
0, |
|
|
|
0, |
|
|
|
0, |
|
|
@ -208,7 +128,8 @@ static const uint64_t h_constHashPadding[8] = { |
|
|
|
0, |
|
|
|
0, |
|
|
|
0x0002000000000000ull }; |
|
|
|
0x0002000000000000ull }; |
|
|
|
|
|
|
|
|
|
|
|
__global__ __launch_bounds__(256, 2) void quark_blake512_gpu_hash_64(int threads, uint32_t startNounce, uint32_t *g_nonceVector, uint64_t *g_hash) |
|
|
|
__global__ __launch_bounds__(256, 4) |
|
|
|
|
|
|
|
void quark_blake512_gpu_hash_64(int threads, uint32_t startNounce, uint32_t *g_nonceVector, uint64_t *g_hash) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int thread = (blockDim.x * blockIdx.x + threadIdx.x); |
|
|
|
int thread = (blockDim.x * blockIdx.x + threadIdx.x); |
|
|
|
|
|
|
|
|
|
|
@ -224,70 +145,49 @@ __global__ __launch_bounds__(256, 2) void quark_blake512_gpu_hash_64(int threads |
|
|
|
if (thread < threads) |
|
|
|
if (thread < threads) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
uint8_t i; |
|
|
|
// bestimme den aktuellen Zähler |
|
|
|
// bestimme den aktuellen Zähler |
|
|
|
uint32_t nounce = (g_nonceVector != NULL) ? g_nonceVector[thread] : (startNounce + thread); |
|
|
|
uint32_t nounce = (g_nonceVector != NULL) ? g_nonceVector[thread] : (startNounce + thread); |
|
|
|
|
|
|
|
|
|
|
|
int hashPosition = nounce - startNounce; |
|
|
|
int hashPosition = nounce - startNounce; |
|
|
|
//uint64_t *inpHash = &g_hash[8 * hashPosition]; |
|
|
|
uint64_t *inpHash = &g_hash[hashPosition<<3]; // hashPosition * 8 |
|
|
|
uint64_t *inpHash = &g_hash[hashPosition<<3]; |
|
|
|
|
|
|
|
|
|
|
|
// 128 Byte für die Message |
|
|
|
|
|
|
|
uint64_t buf[16]; |
|
|
|
|
|
|
|
|
|
|
|
// State vorbereiten |
|
|
|
// State vorbereiten |
|
|
|
uint64_t h[8]; |
|
|
|
uint64_t h[8]; |
|
|
|
/* |
|
|
|
#pragma unroll 8 |
|
|
|
h[0] = 0x6a09e667f3bcc908ULL; |
|
|
|
for (i=0;i<8;i++) |
|
|
|
h[1] = 0xbb67ae8584caa73bULL; |
|
|
|
|
|
|
|
h[2] = 0x3c6ef372fe94f82bULL; |
|
|
|
|
|
|
|
h[3] = 0xa54ff53a5f1d36f1ULL; |
|
|
|
|
|
|
|
h[4] = 0x510e527fade682d1ULL; |
|
|
|
|
|
|
|
h[5] = 0x9b05688c2b3e6c1fULL; |
|
|
|
|
|
|
|
h[6] = 0x1f83d9abfb41bd6bULL; |
|
|
|
|
|
|
|
h[7] = 0x5be0cd19137e2179ULL; |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
#pragma unroll 8 |
|
|
|
|
|
|
|
for(int i=0;i<8;i++) |
|
|
|
|
|
|
|
h[i] = d_constMem[i]; |
|
|
|
h[i] = d_constMem[i]; |
|
|
|
|
|
|
|
|
|
|
|
// 128 Byte für die Message |
|
|
|
|
|
|
|
uint64_t buf[16]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Message für die erste Runde in Register holen |
|
|
|
// Message für die erste Runde in Register holen |
|
|
|
#pragma unroll 8 |
|
|
|
#pragma unroll 8 |
|
|
|
for (int i=0; i < 8; ++i) buf[i] = inpHash[i]; |
|
|
|
for (i=0; i < 8; ++i) |
|
|
|
|
|
|
|
buf[i] = inpHash[i]; |
|
|
|
/* |
|
|
|
|
|
|
|
buf[ 8] = 0x0000000000000080ull; |
|
|
|
#pragma unroll 8 |
|
|
|
buf[ 9] = 0; |
|
|
|
for (i=0; i < 8; i++) |
|
|
|
buf[10] = 0; |
|
|
|
|
|
|
|
buf[11] = 0; |
|
|
|
|
|
|
|
buf[12] = 0; |
|
|
|
|
|
|
|
buf[13] = 0x0100000000000000ull; |
|
|
|
|
|
|
|
buf[14] = 0; |
|
|
|
|
|
|
|
buf[15] = 0x0002000000000000ull; |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
#pragma unroll 8 |
|
|
|
|
|
|
|
for(int i=0;i<8;i++) |
|
|
|
|
|
|
|
buf[i+8] = d_constHashPadding[i]; |
|
|
|
buf[i+8] = d_constHashPadding[i]; |
|
|
|
|
|
|
|
|
|
|
|
// die einzige Hashing-Runde |
|
|
|
// die einzige Hashing-Runde |
|
|
|
quark_blake512_compress( h, buf, c_sigma, c_u512, 512 ); |
|
|
|
quark_blake512_compress( h, buf, c_sigma, c_u512, 512 ); |
|
|
|
|
|
|
|
|
|
|
|
// Hash rauslassen |
|
|
|
|
|
|
|
#if __CUDA_ARCH__ >= 130 |
|
|
|
#if __CUDA_ARCH__ >= 130 |
|
|
|
// ausschliesslich 32 bit Operationen sofern die SM1.3 double intrinsics verfügbar sind |
|
|
|
// ausschliesslich 32 bit Operationen sofern die SM1.3 double intrinsics verfügbar sind |
|
|
|
uint32_t *outHash = (uint32_t*)&g_hash[8 * hashPosition]; |
|
|
|
uint32_t *outHash = (uint32_t*)&g_hash[8 * hashPosition]; |
|
|
|
#pragma unroll 8 |
|
|
|
#pragma unroll 8 |
|
|
|
for (int i=0; i < 8; ++i) { |
|
|
|
for (i=0; i < 8; ++i) { |
|
|
|
outHash[2*i+0] = cuda_swab32( HIWORD(h[i]) ); |
|
|
|
outHash[2*i+0] = cuda_swab32( _HIWORD(h[i]) ); |
|
|
|
outHash[2*i+1] = cuda_swab32( LOWORD(h[i]) ); |
|
|
|
outHash[2*i+1] = cuda_swab32( _LOWORD(h[i]) ); |
|
|
|
} |
|
|
|
} |
|
|
|
#else |
|
|
|
#else |
|
|
|
// in dieser Version passieren auch ein paar 64 Bit Shifts |
|
|
|
// in dieser Version passieren auch ein paar 64 Bit Shifts |
|
|
|
uint64_t *outHash = &g_hash[8 * hashPosition]; |
|
|
|
uint64_t *outHash = &g_hash[8 * hashPosition]; |
|
|
|
#pragma unroll 8 |
|
|
|
#pragma unroll 8 |
|
|
|
for (int i=0; i < 8; ++i) |
|
|
|
for (i=0; i < 8; ++i) |
|
|
|
{ |
|
|
|
{ |
|
|
|
//outHash[i] = cuda_swab64( h[i] ); |
|
|
|
outHash[i] = cuda_swab64(h[i]); |
|
|
|
outHash[i] = SWAP64(h[i]); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
@ -298,30 +198,21 @@ __global__ void quark_blake512_gpu_hash_80(int threads, uint32_t startNounce, vo |
|
|
|
int thread = (blockDim.x * blockIdx.x + threadIdx.x); |
|
|
|
int thread = (blockDim.x * blockIdx.x + threadIdx.x); |
|
|
|
if (thread < threads) |
|
|
|
if (thread < threads) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// bestimme den aktuellen Zähler |
|
|
|
|
|
|
|
uint32_t nounce = startNounce + thread; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// State vorbereiten |
|
|
|
// State vorbereiten |
|
|
|
uint64_t h[8]; |
|
|
|
uint64_t h[8]; |
|
|
|
/* |
|
|
|
|
|
|
|
h[0] = 0x6a09e667f3bcc908ULL; |
|
|
|
|
|
|
|
h[1] = 0xbb67ae8584caa73bULL; |
|
|
|
|
|
|
|
h[2] = 0x3c6ef372fe94f82bULL; |
|
|
|
|
|
|
|
h[3] = 0xa54ff53a5f1d36f1ULL; |
|
|
|
|
|
|
|
h[4] = 0x510e527fade682d1ULL; |
|
|
|
|
|
|
|
h[5] = 0x9b05688c2b3e6c1fULL; |
|
|
|
|
|
|
|
h[6] = 0x1f83d9abfb41bd6bULL; |
|
|
|
|
|
|
|
h[7] = 0x5be0cd19137e2179ULL; |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
#pragma unroll 8 |
|
|
|
|
|
|
|
for(int i=0;i<8;i++) |
|
|
|
|
|
|
|
h[i] = d_constMem[i]; |
|
|
|
|
|
|
|
// 128 Byte für die Message |
|
|
|
// 128 Byte für die Message |
|
|
|
uint64_t buf[16]; |
|
|
|
uint64_t buf[16]; |
|
|
|
|
|
|
|
uint8_t i; |
|
|
|
|
|
|
|
// bestimme den aktuellen Zähler |
|
|
|
|
|
|
|
uint32_t nounce = startNounce + thread; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma unroll 8 |
|
|
|
|
|
|
|
for(i=0;i<8;i++) |
|
|
|
|
|
|
|
h[i] = d_constMem[i]; |
|
|
|
|
|
|
|
|
|
|
|
// Message für die erste Runde in Register holen |
|
|
|
// Message für die erste Runde in Register holen |
|
|
|
#pragma unroll 16 |
|
|
|
#pragma unroll 16 |
|
|
|
for (int i=0; i < 16; ++i) buf[i] = c_PaddedMessage80[i]; |
|
|
|
for (i=0; i < 16; ++i) buf[i] = c_PaddedMessage80[i]; |
|
|
|
|
|
|
|
|
|
|
|
// die Nounce durch die thread-spezifische ersetzen |
|
|
|
// die Nounce durch die thread-spezifische ersetzen |
|
|
|
buf[9] = REPLACE_HIWORD(buf[9], cuda_swab32(nounce)); |
|
|
|
buf[9] = REPLACE_HIWORD(buf[9], cuda_swab32(nounce)); |
|
|
@ -333,19 +224,17 @@ __global__ void quark_blake512_gpu_hash_80(int threads, uint32_t startNounce, vo |
|
|
|
#if __CUDA_ARCH__ >= 130 |
|
|
|
#if __CUDA_ARCH__ >= 130 |
|
|
|
// ausschliesslich 32 bit Operationen sofern die SM1.3 double intrinsics verfügbar sind |
|
|
|
// ausschliesslich 32 bit Operationen sofern die SM1.3 double intrinsics verfügbar sind |
|
|
|
uint32_t *outHash = (uint32_t *)outputHash + 16 * thread; |
|
|
|
uint32_t *outHash = (uint32_t *)outputHash + 16 * thread; |
|
|
|
#pragma unroll 8 |
|
|
|
#pragma unroll 8 |
|
|
|
for (int i=0; i < 8; ++i) { |
|
|
|
for (i=0; i < 8; ++i) { |
|
|
|
outHash[2*i+0] = cuda_swab32( HIWORD(h[i]) ); |
|
|
|
outHash[2*i+0] = cuda_swab32( _HIWORD(h[i]) ); |
|
|
|
outHash[2*i+1] = cuda_swab32( LOWORD(h[i]) ); |
|
|
|
outHash[2*i+1] = cuda_swab32( _LOWORD(h[i]) ); |
|
|
|
} |
|
|
|
} |
|
|
|
#else |
|
|
|
#else |
|
|
|
// in dieser Version passieren auch ein paar 64 Bit Shifts |
|
|
|
// in dieser Version passieren auch ein paar 64 Bit Shifts |
|
|
|
uint64_t *outHash = (uint64_t *)outputHash + 8 * thread; |
|
|
|
uint64_t *outHash = (uint64_t *)outputHash + 8 * thread; |
|
|
|
#pragma unroll 8 |
|
|
|
#pragma unroll 8 |
|
|
|
for (int i=0; i < 8; ++i) |
|
|
|
for (i=0; i < 8; ++i) { |
|
|
|
{ |
|
|
|
outHash[i] = cuda_swab64( h[i] ); |
|
|
|
//outHash[i] = cuda_swab64( h[i] ); |
|
|
|
|
|
|
|
outHash[i] = SWAP64(h[i]); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
@ -362,21 +251,6 @@ __host__ void quark_blake512_cpu_init(int thr_id, int threads) |
|
|
|
host_sigma, |
|
|
|
host_sigma, |
|
|
|
sizeof(host_sigma), |
|
|
|
sizeof(host_sigma), |
|
|
|
0, cudaMemcpyHostToDevice); |
|
|
|
0, cudaMemcpyHostToDevice); |
|
|
|
|
|
|
|
|
|
|
|
cudaMemcpyToSymbol( c_u512, |
|
|
|
|
|
|
|
host_u512, |
|
|
|
|
|
|
|
sizeof(host_u512), |
|
|
|
|
|
|
|
0, cudaMemcpyHostToDevice); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cudaMemcpyToSymbol( d_constMem, |
|
|
|
|
|
|
|
h_constMem, |
|
|
|
|
|
|
|
sizeof(h_constMem), |
|
|
|
|
|
|
|
0, cudaMemcpyHostToDevice); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cudaMemcpyToSymbol( d_constHashPadding, |
|
|
|
|
|
|
|
h_constHashPadding, |
|
|
|
|
|
|
|
sizeof(h_constHashPadding), |
|
|
|
|
|
|
|
0, cudaMemcpyHostToDevice); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Blake512 für 80 Byte grosse Eingangsdaten |
|
|
|
// Blake512 für 80 Byte grosse Eingangsdaten |
|
|
|