Skip to content

Commit f351721

Browse files
committed
OpenCL GOST/Streebog: Request not to inline update/final functions
For the corresponding crypt formats, build times went from minutes (worst case) to a few seconds while speeds were unaffected and gost94crypt-opencl stopped failing self-test on super's AMD Vega.
1 parent 685f7f9 commit f351721

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

run/opencl/gost12512hash_kernel.cl

-5
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@
1212
#define STREEBOG_LOCAL_AX 1
1313
#endif
1414
#define STREEBOG_VECTOR 1
15-
/*
16-
* Without unroll: Build time: 45.125 s, binary size 2542391, 10402 c/s
17-
* Pragma unroll: Build time: 21 min 14.788 s, binary size 11502092, 10051 c/s
18-
* Manual unroll: Build time: 4 min 26.142 s, binary size 5961490, 9959 c/s
19-
*/
2015
#define STREEBOG_UNROLL 0
2116
#include "opencl_streebog.h"
2217

run/opencl/opencl_gost94.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ inline void rhash_gost94_compute_sum_and_hash(gost94_ctx * ctx, const uint* bloc
300300
* @param msg message chunk
301301
* @param size length of the message chunk
302302
*/
303-
inline void gost94_update(gost94_ctx *ctx, const uchar* msg, uint size, MAYBE_LOCAL const rhash_gost94_sbox *sbox)
303+
__attribute__((noinline)) void gost94_update(gost94_ctx *ctx, const uchar* msg, uint size, MAYBE_LOCAL const rhash_gost94_sbox *sbox)
304304
{
305305
uint index = ctx->length & 31;
306306
ctx->length += size;
@@ -361,7 +361,7 @@ inline void rhash_u32_swap_copy(void* to, const void* from, uint length) {
361361
* @param ctx the algorithm context containing current hashing state
362362
* @param result calculated hash in binary form
363363
*/
364-
inline void gost94_final(gost94_ctx *ctx, uchar *result, MAYBE_LOCAL const rhash_gost94_sbox *sbox)
364+
__attribute__((noinline)) void gost94_final(gost94_ctx *ctx, uchar *result, MAYBE_LOCAL const rhash_gost94_sbox *sbox)
365365
{
366366
uint index = ctx->length & 31;
367367
uint* msg32 = (uint*)ctx->message;

run/opencl/opencl_streebog.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ stage3(GOST34112012Context *CTX, __local localbuf *loc_buf)
906906
g0(&(CTX->h), &(CTX->Sigma), loc_buf);
907907
}
908908

909-
inline void
909+
__attribute__((noinline)) void
910910
GOST34112012Update(GOST34112012Context *CTX, const uchar *data, uint len, __local localbuf *loc_buf)
911911
{
912912
if (CTX->bufsize) {
@@ -937,7 +937,7 @@ GOST34112012Update(GOST34112012Context *CTX, const uchar *data, uint len, __loca
937937
}
938938
}
939939

940-
inline void
940+
__attribute__((noinline)) void
941941
GOST34112012Final(GOST34112012Context *CTX,
942942
#if STREEBOG512CRYPT
943943
uint512_u

0 commit comments

Comments
 (0)