Browse Source

Simplify macros in output kernels avoiding apparent loops and local variables.

nfactor-troky
Con Kolivas 12 years ago
parent
commit
9bec1e158e
  1. 34
      diablo120823.cl
  2. 34
      diakgcn120823.cl
  3. 34
      phatk120823.cl
  4. 29
      poclbm120823.cl
  5. 18
      scrypt120823.cl

34
diablo120823.cl

@ -1245,49 +1245,35 @@ void search(
#define FOUND (0x0F) #define FOUND (0x0F)
#if defined(OCL1) #if defined(OCL1)
#define SETFOUND(Xfound, Xnonce) do { \ #define SETFOUND(Xnonce) output[output[FOUND]++] = Xnonce
(Xfound) = output[FOUND]; \
output[FOUND] += 1; \
output[Xfound] = Xnonce; \
} while (0)
#else #else
#define SETFOUND(Xfound, Xnonce) do { \ #define SETFOUND(Xnonce) output[atomic_add(&output[FOUND], 1)] = Xnonce
Xfound = atomic_add(&output[FOUND], 1); \
output[Xfound] = Xnonce; \
} while (0)
#endif #endif
#if defined(VECTORS4) #if defined(VECTORS4)
bool result = any(ZA[924] == 0x136032EDU); bool result = any(ZA[924] == 0x136032EDU);
if (result) { if (result) {
uint found;
if (ZA[924].x == 0x136032EDU) if (ZA[924].x == 0x136032EDU)
SETFOUND(found, Znonce.x); SETFOUND(Znonce.x);
if (ZA[924].y == 0x136032EDU) if (ZA[924].y == 0x136032EDU)
SETFOUND(found, Znonce.y); SETFOUND(Znonce.y);
if (ZA[924].z == 0x136032EDU) if (ZA[924].z == 0x136032EDU)
SETFOUND(found, Znonce.z); SETFOUND(Znonce.z);
if (ZA[924].w == 0x136032EDU) if (ZA[924].w == 0x136032EDU)
SETFOUND(found, Znonce.w); SETFOUND(Znonce.w);
} }
#elif defined(VECTORS2) #elif defined(VECTORS2)
bool result = any(ZA[924] == 0x136032EDU); bool result = any(ZA[924] == 0x136032EDU);
if (result) { if (result) {
uint found;
if (ZA[924].x == 0x136032EDU) if (ZA[924].x == 0x136032EDU)
SETFOUND(found, Znonce.x); SETFOUND(Znonce.x);
if (ZA[924].y == 0x136032EDU) if (ZA[924].y == 0x136032EDU)
SETFOUND(found, Znonce.y); SETFOUND(Znonce.y);
} }
#else #else
if (ZA[924] == 0x136032EDU) { if (ZA[924] == 0x136032EDU)
uint found; SETFOUND(Znonce);
SETFOUND(found, Znonce);
}
#endif #endif
} }

34
diakgcn120823.cl

@ -574,45 +574,31 @@ __kernel
#define FOUND (0x0F) #define FOUND (0x0F)
#if defined(OCL1) #if defined(OCL1)
#define SETFOUND(Xfound, Xnonce) do { \ #define SETFOUND(Xnonce) output[output[FOUND]++] = Xnonce
(Xfound) = output[FOUND]; \
output[FOUND] += 1; \
output[Xfound] = Xnonce; \
} while (0)
#else #else
#define SETFOUND(Xfound, Xnonce) do { \ #define SETFOUND(Xnonce) output[atomic_add(&output[FOUND], 1)] = Xnonce
Xfound = atomic_add(&output[FOUND], 1); \
output[Xfound] = Xnonce; \
} while (0)
#endif #endif
#ifdef VECTORS4 #ifdef VECTORS4
if ((V[7].x == 0x136032edU) ^ (V[7].y == 0x136032edU) ^ (V[7].z == 0x136032edU) ^ (V[7].w == 0x136032edU)) { if ((V[7].x == 0x136032edU) ^ (V[7].y == 0x136032edU) ^ (V[7].z == 0x136032edU) ^ (V[7].w == 0x136032edU)) {
uint found;
if (V[7].x == 0x136032edU) if (V[7].x == 0x136032edU)
SETFOUND(found, nonce.x); SETFOUND(nonce.x);
if (V[7].y == 0x136032edU) if (V[7].y == 0x136032edU)
SETFOUND(found, nonce.y); SETFOUND(nonce.y);
if (V[7].z == 0x136032edU) if (V[7].z == 0x136032edU)
SETFOUND(found, nonce.z); SETFOUND(nonce.z);
if (V[7].w == 0x136032edU) if (V[7].w == 0x136032edU)
SETFOUND(found, nonce.w); SETFOUND(nonce.w);
} }
#elif defined VECTORS2 #elif defined VECTORS2
if ((V[7].x == 0x136032edU) + (V[7].y == 0x136032edU)) { if ((V[7].x == 0x136032edU) + (V[7].y == 0x136032edU)) {
uint found;
if (V[7].x == 0x136032edU) if (V[7].x == 0x136032edU)
SETFOUND(found, nonce.x); SETFOUND(nonce.x);
if (V[7].y == 0x136032edU) if (V[7].y == 0x136032edU)
SETFOUND(found, nonce.y); SETFOUND(nonce.y);
} }
#else #else
if (V[7] == 0x136032edU) { if (V[7] == 0x136032edU)
uint found; SETFOUND(nonce);
SETFOUND(found, nonce);
}
#endif #endif
} }

34
phatk120823.cl

@ -390,47 +390,33 @@ void search( const uint state0, const uint state1, const uint state2, const uint
#define FOUND (0x0F) #define FOUND (0x0F)
#if defined(OCL1) #if defined(OCL1)
#define SETFOUND(Xfound, Xnonce) do { \ #define SETFOUND(Xnonce) output[output[FOUND]++] = Xnonce
(Xfound) = output[FOUND]; \
output[FOUND] += 1; \
output[Xfound] = Xnonce; \
} while (0)
#else #else
#define SETFOUND(Xfound, Xnonce) do { \ #define SETFOUND(Xnonce) output[atomic_add(&output[FOUND], 1)] = Xnonce
Xfound = atomic_add(&output[FOUND], 1); \
output[Xfound] = Xnonce; \
} while (0)
#endif #endif
#ifdef VECTORS4 #ifdef VECTORS4
bool result = W[117].x & W[117].y & W[117].z & W[117].w; bool result = W[117].x & W[117].y & W[117].z & W[117].w;
if (!result) { if (!result) {
uint found;
if (!W[117].x) if (!W[117].x)
SETFOUND(found, W[3].x); SETFOUND(W[3].x);
if (!W[117].y) if (!W[117].y)
SETFOUND(found, W[3].y); SETFOUND(W[3].y);
if (!W[117].z) if (!W[117].z)
SETFOUND(found, W[3].z); SETFOUND(W[3].z);
if (!W[117].w) if (!W[117].w)
SETFOUND(found, W[3].w); SETFOUND(W[3].w);
} }
#elif defined VECTORS2 #elif defined VECTORS2
bool result = W[117].x & W[117].y; bool result = W[117].x & W[117].y;
if (!result) { if (!result) {
uint found;
if (!W[117].x) if (!W[117].x)
SETFOUND(found, W[3].x); SETFOUND(W[3].x);
if (!W[117].y) if (!W[117].y)
SETFOUND(found, W[3].y); SETFOUND(W[3].y);
} }
#else #else
if (!W[117]) { if (!W[117])
uint found; SETFOUND(W[3]);
SETFOUND(found, W[3]);
}
#endif #endif
} }

29
poclbm120823.cl

@ -1324,39 +1324,26 @@ Vals[2]+=ch(Vals[1],Vals[4],Vals[3]);
#define FOUND (0x0F) #define FOUND (0x0F)
#if defined(OCL1) #if defined(OCL1)
#define SETFOUND(Xfound, Xnonce) do { \ #define SETFOUND(Xnonce) output[output[FOUND]++] = Xnonce
(Xfound) = output[FOUND]; \
output[FOUND] += 1; \
output[Xfound] = Xnonce; \
} while (0)
#else #else
#define SETFOUND(Xfound, Xnonce) do { \ #define SETFOUND(Xnonce) output[atomic_add(&output[FOUND], 1)] = Xnonce
Xfound = atomic_add(&output[FOUND], 1); \
output[Xfound] = Xnonce; \
} while (0)
#endif #endif
#if defined(VECTORS2) || defined(VECTORS4) #if defined(VECTORS2) || defined(VECTORS4)
if (any(Vals[2] == 0x136032edU)) { if (any(Vals[2] == 0x136032edU)) {
uint found;
if (Vals[2].x == 0x136032edU) if (Vals[2].x == 0x136032edU)
SETFOUND(found, nonce.x); SETFOUND(nonce.x);
if (Vals[2].y == 0x136032edU) if (Vals[2].y == 0x136032edU)
SETFOUND(found, nonce.y); SETFOUND(nonce.y);
#if defined(VECTORS4) #if defined(VECTORS4)
if (Vals[2].z == 0x136032edU) if (Vals[2].z == 0x136032edU)
SETFOUND(found, nonce.z); SETFOUND(nonce.z);
if (Vals[2].w == 0x136032edU) if (Vals[2].w == 0x136032edU)
SETFOUND(found, nonce.w); SETFOUND(nonce.w);
#endif #endif
} }
#else #else
if (Vals[2] == 0x136032edU) { if (Vals[2] == 0x136032edU)
uint found; SETFOUND(nonce);
SETFOUND(found, nonce);
}
#endif #endif
} }

18
scrypt120823.cl

@ -685,16 +685,9 @@ void scrypt_core(uint4 X[8], __global uint4*restrict lookup)
#define FOUND (0x0F) #define FOUND (0x0F)
#if defined(OCL1) #if defined(OCL1)
#define SETFOUND(Xfound, Xnonce) do { \ #define SETFOUND(Xnonce) output[output[FOUND]++] = Xnonce
(Xfound) = output[FOUND]; \
output[FOUND] += 1; \
output[Xfound] = Xnonce; \
} while (0)
#else #else
#define SETFOUND(Xfound, Xnonce) do { \ #define SETFOUND(Xnonce) output[atomic_add(&output[FOUND], 1)] = Xnonce
Xfound = atomic_add(&output[FOUND], 1); \
output[Xfound] = Xnonce; \
} while (0)
#endif #endif
__attribute__((reqd_work_group_size(WORKSIZE, 1, 1))) __attribute__((reqd_work_group_size(WORKSIZE, 1, 1)))
@ -734,11 +727,8 @@ const uint4 midstate0, const uint4 midstate16, const uint target)
SHA256(&ostate0,&ostate1, tmp0, tmp1, (uint4)(0x80000000U, 0U, 0U, 0U), (uint4)(0U, 0U, 0U, 0x300U)); SHA256(&ostate0,&ostate1, tmp0, tmp1, (uint4)(0x80000000U, 0U, 0U, 0U), (uint4)(0U, 0U, 0U, 0x300U));
bool result = (EndianSwap(ostate1.w) <= target); bool result = (EndianSwap(ostate1.w) <= target);
if (result) { if (result)
uint found; SETFOUND(gid);
SETFOUND(found, gid);
}
} }
/*- /*-

Loading…
Cancel
Save