29
29
#include "algorithm/bitblock.h"
30
30
#include "algorithm/x14.h"
31
31
#include "algorithm/fresh.h"
32
+ #include "algorithm/whirlcoin.h"
32
33
#include "algorithm/neoscrypt.h"
33
34
34
35
#include "compat.h"
@@ -49,7 +50,9 @@ const char *algorithm_type_str[] = {
49
50
"Twecoin" ,
50
51
"Fugue256" ,
51
52
"NIST" ,
52
- "Fresh"
53
+ "Fresh" ,
54
+ "Whirlcoin" ,
55
+ "Neoscrypt"
53
56
};
54
57
55
58
void sha256 (const unsigned char * message , unsigned int len , unsigned char * digest )
@@ -96,11 +99,11 @@ static void append_scrypt_compiler_options(struct _build_kernel_data *data, stru
96
99
static void append_neoscrypt_compiler_options (struct _build_kernel_data * data , struct cgpu_info * cgpu , struct _algorithm_t * algorithm )
97
100
{
98
101
char buf [255 ];
99
- sprintf (buf , " -D MAX_GLOBAL_THREADS=%u" ,
100
- ( unsigned int )cgpu -> thread_concurrency );
102
+ sprintf (buf , " %s -D MAX_GLOBAL_THREADS=%lu " ,
103
+ (( cgpu -> lookup_gap > 0 )? " -D LOOKUP_GAP=2 " : "" ), ( unsigned long )cgpu -> thread_concurrency );
101
104
strcat (data -> compiler_options , buf );
102
-
103
- sprintf (buf , "tc%u " , (unsigned int )cgpu -> thread_concurrency );
105
+
106
+ sprintf (buf , "%stc%lu " , (( cgpu -> lookup_gap > 0 )? "lg" : "" ), ( unsigned long )cgpu -> thread_concurrency );
104
107
strcat (data -> binary_filename , buf );
105
108
}
106
109
@@ -158,21 +161,20 @@ static cl_int queue_neoscrypt_kernel(_clState *clState, dev_blk_ctx *blk, __mayb
158
161
unsigned int num = 0 ;
159
162
cl_uint le_target ;
160
163
cl_int status = 0 ;
161
-
164
+
162
165
/* This looks like a unnecessary double cast, but to make sure, that
163
166
* the target's most significant entry is adressed as a 32-bit value
164
167
* and not accidently by something else the double cast seems wise.
165
- * The compiler will get rid of it anyway.
166
- */
168
+ * The compiler will get rid of it anyway. */
167
169
le_target = (cl_uint )le32toh (((uint32_t * )blk -> work -> /*device_*/ target )[7 ]);
168
170
memcpy (clState -> cldata , blk -> work -> data , 80 );
169
- status = clEnqueueWriteBuffer (clState -> commandQueue , clState -> CLbuffer0 , true, 0 , 80 , clState -> cldata , 0 , NULL , NULL );
170
-
171
+ status = clEnqueueWriteBuffer (clState -> commandQueue , clState -> CLbuffer0 , true, 0 , 80 , clState -> cldata , 0 , NULL ,NULL );
172
+
171
173
CL_SET_ARG (clState -> CLbuffer0 );
172
174
CL_SET_ARG (clState -> outputBuffer );
173
175
CL_SET_ARG (clState -> padbuffer8 );
174
176
CL_SET_ARG (le_target );
175
-
177
+
176
178
return status ;
177
179
}
178
180
@@ -600,6 +602,34 @@ static cl_int queue_fresh_kernel(struct __clState *clState, struct _dev_blk_ctx
600
602
return status ;
601
603
}
602
604
605
+ static cl_int queue_whirlcoin_kernel (struct __clState * clState , struct _dev_blk_ctx * blk , __maybe_unused cl_uint threads )
606
+ {
607
+ cl_kernel * kernel ;
608
+ cl_ulong le_target ;
609
+ cl_int status = 0 ;
610
+
611
+ le_target = * (cl_ulong * )(blk -> work -> device_target + 24 );
612
+ flip80 (clState -> cldata , blk -> work -> data );
613
+ status = clEnqueueWriteBuffer (clState -> commandQueue , clState -> CLbuffer0 , true, 0 , 80 , clState -> cldata , 0 , NULL ,NULL );
614
+
615
+ //clbuffer, hashes
616
+ kernel = & clState -> kernel ;
617
+ CL_SET_ARG_N (0 ,clState -> CLbuffer0 );
618
+ CL_SET_ARG_N (1 ,clState -> padbuffer8 );
619
+
620
+ kernel = clState -> extra_kernels ;
621
+ CL_SET_ARG_N (0 ,clState -> padbuffer8 );
622
+
623
+ CL_NEXTKERNEL_SET_ARG_N (0 ,clState -> padbuffer8 );
624
+
625
+ //hashes, output, target
626
+ CL_NEXTKERNEL_SET_ARG_N (0 ,clState -> padbuffer8 );
627
+ CL_SET_ARG_N (1 ,clState -> outputBuffer );
628
+ CL_SET_ARG_N (2 ,le_target );
629
+
630
+ return status ;
631
+ }
632
+
603
633
typedef struct _algorithm_settings_t {
604
634
const char * name ; /* Human-readable identifier */
605
635
algorithm_type_t type ; //common algorithm type
@@ -624,23 +654,24 @@ typedef struct _algorithm_settings_t {
624
654
static algorithm_settings_t algos [] = {
625
655
// kernels starting from this will have difficulty calculated by using litecoin algorithm
626
656
#define A_SCRYPT (a ) \
627
- { a , ALGO_SCRYPT , "" , 1 , 65536 , 65536 , 0 , 0 , 0xFF , 0xFFFFFFFFULL , 0x0000ffffUL , 0 , -1 , CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE , scrypt_regenhash , queue_scrypt_kernel , gen_hash , append_scrypt_compiler_options }
657
+ { a , ALGO_SCRYPT , "" , 1 , 65536 , 65536 , 0 , 0 , 0xFF , 0xFFFFFFFFULL , 0x0000ffffUL , 0 , -1 , CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE , scrypt_regenhash , queue_scrypt_kernel , gen_hash , append_scrypt_compiler_options }
628
658
A_SCRYPT ( "ckolivas" ),
629
659
A_SCRYPT ( "alexkarnew" ),
630
660
A_SCRYPT ( "alexkarnold" ),
631
661
A_SCRYPT ( "bufius" ),
632
662
A_SCRYPT ( "psw" ),
633
663
A_SCRYPT ( "zuikkis" ),
664
+ A_SCRYPT ( "arebyp" ),
634
665
#undef A_SCRYPT
635
666
636
667
#define A_NEOSCRYPT (a ) \
637
- { a , ALGO_NEOSCRYPT , "" , 1 , 65536 , 65536 , 0 , 0 , 0xFF , 0xFFFF000000000000ULL , 0x0000ffffUL , 0 , -1 , CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE , neoscrypt_regenhash , queue_neoscrypt_kernel , gen_hash , append_neoscrypt_compiler_options }
668
+ { a , ALGO_NEOSCRYPT , "" , 1 , 65536 , 65536 , 0 , 0 , 0xFF , 0xFFFF000000000000ULL , 0x0000ffffUL , 0 , -1 , CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE , neoscrypt_regenhash , queue_neoscrypt_kernel , gen_hash , append_neoscrypt_compiler_options }
638
669
A_NEOSCRYPT ("neoscrypt "),
639
670
#undef A_NEOSCRYPT
640
671
641
672
// kernels starting from this will have difficulty calculated by using quarkcoin algorithm
642
673
#define A_QUARK (a , b ) \
643
- { a , ALGO_QUARK , "" , 256 , 256 , 256 , 0 , 0 , 0xFF , 0xFFFFFFULL , 0x0000ffffUL , 0 , 0 , CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE , b , queue_sph_kernel , gen_hash , append_x11_compiler_options }
674
+ { a , ALGO_QUARK , "" , 256 , 256 , 256 , 0 , 0 , 0xFF , 0xFFFFFFULL , 0x0000ffffUL , 0 , 0 , CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE , b , queue_sph_kernel , gen_hash , append_x11_compiler_options }
644
675
A_QUARK ( "quarkcoin ", quarkcoin_regenhash ),
645
676
A_QUARK ( "qubitcoin" , qubitcoin_regenhash ),
646
677
A_QUARK ( "animecoin" , animecoin_regenhash ),
@@ -649,40 +680,43 @@ static algorithm_settings_t algos[] = {
649
680
650
681
// kernels starting from this will have difficulty calculated by using bitcoin algorithm
651
682
#define A_DARK (a , b ) \
652
- { a , ALGO_X11 , "" , 1 , 1 , 1 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 0 , 0 , CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE , b , queue_sph_kernel , gen_hash , append_x11_compiler_options }
683
+ { a , ALGO_X11 , "" , 1 , 1 , 1 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 0 , 0 , CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE , b , queue_sph_kernel , gen_hash , append_x11_compiler_options }
653
684
A_DARK ( "darkcoin ", darkcoin_regenhash ),
654
685
A_DARK ( "inkcoin" , inkcoin_regenhash ),
655
686
A_DARK ( "myriadcoin-groestl" , myriadcoin_groestl_regenhash ),
656
687
#undef A_DARK
657
688
658
689
{ "twecoin" , ALGO_TWE , "" , 1 , 1 , 1 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 0 , 0 , CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE , twecoin_regenhash , queue_sph_kernel , sha256 , NULL },
659
- { "maxcoin" , ALGO_KECCAK , "" , 1 , 256 , 1 , 4 , 15 , 0x0F , 0xFFFFULL , 0x000000ffUL , 0 , 0 , CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE , maxcoin_regenhash , queue_maxcoin_kernel , sha256 , NULL },
690
+ { "maxcoin" , ALGO_KECCAK , "" , 1 , 256 , 1 , 4 , 15 , 0x0F , 0xFFFFULL , 0x000000ffUL , 0 , 0 , CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE , maxcoin_regenhash , queue_maxcoin_kernel , sha256 , NULL },
660
691
661
- { "darkcoin-mod" , ALGO_X11 , "" , 1 , 1 , 1 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 10 , 8 * 16 * 4194304 , 0 , darkcoin_regenhash , queue_darkcoin_mod_kernel , gen_hash , append_x11_compiler_options },
692
+ { "darkcoin-mod" , ALGO_X11 , "" , 1 , 1 , 1 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 10 , 8 * 16 * 4194304 , 0 , darkcoin_regenhash , queue_darkcoin_mod_kernel , gen_hash , append_x11_compiler_options },
662
693
663
- { "marucoin" , ALGO_X13 , "" , 1 , 1 , 1 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 0 , 0 , CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE , marucoin_regenhash , queue_sph_kernel , gen_hash , append_x13_compiler_options },
664
- { "marucoin-mod" , ALGO_X13 , "" , 1 , 1 , 1 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 12 , 8 * 16 * 4194304 , 0 , marucoin_regenhash , queue_marucoin_mod_kernel , gen_hash , append_x13_compiler_options },
665
- { "marucoin-modold" , ALGO_X13 , "" , 1 , 1 , 1 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 10 , 8 * 16 * 4194304 , 0 , marucoin_regenhash , queue_marucoin_mod_old_kernel , gen_hash , append_x13_compiler_options },
694
+ { "marucoin" , ALGO_X13 , "" , 1 , 1 , 1 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 0 , 0 , CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE , marucoin_regenhash , queue_sph_kernel , gen_hash , append_x13_compiler_options },
695
+ { "marucoin-mod" , ALGO_X13 , "" , 1 , 1 , 1 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 12 , 8 * 16 * 4194304 , 0 , marucoin_regenhash , queue_marucoin_mod_kernel , gen_hash , append_x13_compiler_options },
696
+ { "marucoin-modold" , ALGO_X13 , "" , 1 , 1 , 1 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 10 , 8 * 16 * 4194304 , 0 , marucoin_regenhash , queue_marucoin_mod_old_kernel , gen_hash , append_x13_compiler_options },
666
697
667
- { "x14" , ALGO_X14 , "" , 1 , 1 , 1 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 13 , 8 * 16 * 4194304 , 0 , x14_regenhash , queue_x14_kernel , gen_hash , append_x13_compiler_options },
668
- { "x14old" , ALGO_X14 , "" , 1 , 1 , 1 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 10 , 8 * 16 * 4194304 , 0 , x14_regenhash , queue_x14_old_kernel , gen_hash , append_x13_compiler_options },
698
+ { "x14" , ALGO_X14 , "" , 1 , 1 , 1 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 13 , 8 * 16 * 4194304 , 0 , x14_regenhash , queue_x14_kernel , gen_hash , append_x13_compiler_options },
699
+ { "x14old" , ALGO_X14 , "" , 1 , 1 , 1 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 10 , 8 * 16 * 4194304 , 0 , x14_regenhash , queue_x14_old_kernel , gen_hash , append_x13_compiler_options },
669
700
670
- { "bitblock" , ALGO_X15 , "" , 1 , 1 , 1 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 14 , 4 * 16 * 4194304 , 0 , bitblock_regenhash , queue_bitblock_kernel , gen_hash , append_x13_compiler_options },
671
- { "bitblockold" , ALGO_X15 , "" , 1 , 1 , 1 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 10 , 4 * 16 * 4194304 , 0 , bitblock_regenhash , queue_bitblockold_kernel , gen_hash , append_x13_compiler_options },
701
+ { "bitblock" , ALGO_X15 , "" , 1 , 1 , 1 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 14 , 4 * 16 * 4194304 , 0 , bitblock_regenhash , queue_bitblock_kernel , gen_hash , append_x13_compiler_options },
702
+ { "bitblockold" , ALGO_X15 , "" , 1 , 1 , 1 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 10 , 4 * 16 * 4194304 , 0 , bitblock_regenhash , queue_bitblockold_kernel , gen_hash , append_x13_compiler_options },
672
703
673
- { "talkcoin-mod" , ALGO_NIST , "" , 1 , 1 , 1 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 4 , 8 * 16 * 4194304 , 0 , talkcoin_regenhash , queue_talkcoin_mod_kernel , gen_hash , append_x11_compiler_options },
704
+ { "talkcoin-mod" , ALGO_NIST , "" , 1 , 1 , 1 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 4 , 8 * 16 * 4194304 , 0 , talkcoin_regenhash , queue_talkcoin_mod_kernel , gen_hash , append_x11_compiler_options },
674
705
675
- { "fresh" , ALGO_FRESH , "" , 1 , 256 , 256 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 4 , 4 * 16 * 4194304 , 0 , fresh_regenhash , queue_fresh_kernel , gen_hash , NULL },
706
+ { "fresh" , ALGO_FRESH , "" , 1 , 256 , 256 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 4 , 4 * 16 * 4194304 , 0 , fresh_regenhash , queue_fresh_kernel , gen_hash , NULL },
676
707
677
708
// kernels starting from this will have difficulty calculated by using fuguecoin algorithm
678
- #define A_FUGUE (a , b ) \
679
- { a , ALGO_FUGUE , "" , 1 , 256 , 256 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 0 , 0 , CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE , b , queue_sph_kernel , sha256 , NULL }
680
- A_FUGUE ( "fuguecoin ", fuguecoin_regenhash ),
681
- A_FUGUE ( "groestlcoin" , groestlcoin_regenhash ),
682
- #undef A_FUGUE
709
+ #define A_FUGUE (a , b , c ) \
710
+ { a , ALGO_FUGUE , "" , 1 , 256 , 256 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 0 , 0 , CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE , b , queue_sph_kernel , c , NULL }
711
+ A_FUGUE ("fuguecoin ", fuguecoin_regenhash , sha256 ),
712
+ A_FUGUE ("groestlcoin" , groestlcoin_regenhash , sha256 ),
713
+ A_FUGUE ("diamond" , groestlcoin_regenhash , gen_hash ),
714
+ #undef A_FUGUE
715
+
716
+ { "whirlcoin" , ALGO_WHIRL , "" , 1 , 1 , 1 , 0 , 0 , 0xFF , 0xFFFFULL , 0x0000ffffUL , 3 , 8 * 16 * 4194304 , CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE , whirlcoin_regenhash , queue_whirlcoin_kernel , sha256 , NULL },
683
717
684
718
// Terminator (do not remove)
685
- { NULL , ALGO_UNK , "" , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , NULL , NULL , NULL , NULL }
719
+ { NULL , ALGO_UNK , "" , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , NULL , NULL , NULL , NULL }
686
720
};
687
721
688
722
void copy_algorithm_settings (algorithm_t * dest , const char * algo )
@@ -695,7 +729,7 @@ void copy_algorithm_settings(algorithm_t* dest, const char* algo)
695
729
if (strcmp (src -> name , algo ) == 0 )
696
730
{
697
731
strcpy (dest -> name , src -> name );
698
- dest -> kernelfile = src -> kernelfile ;
732
+ dest -> kernelfile = src -> kernelfile ;
699
733
dest -> type = src -> type ;
700
734
701
735
dest -> diff_multiplier1 = src -> diff_multiplier1 ;
@@ -751,6 +785,7 @@ static const char *lookup_algorithm_alias(const char *lookup_alias, uint8_t *nfa
751
785
ALGO_ALIAS ("x15old" , "bitblockold" );
752
786
ALGO_ALIAS ("nist5" , "talkcoin-mod" );
753
787
ALGO_ALIAS ("keccak" , "maxcoin" );
788
+ ALGO_ALIAS ("whirlpool" , "whirlcoin" );
754
789
755
790
#undef ALGO_ALIAS
756
791
#undef ALGO_ALIAS_NF
@@ -760,7 +795,8 @@ static const char *lookup_algorithm_alias(const char *lookup_alias, uint8_t *nfa
760
795
761
796
void set_algorithm (algorithm_t * algo , const char * newname_alias )
762
797
{
763
- const char * newname ;
798
+ const char * newname ;
799
+
764
800
//load previous algorithm nfactor in case nfactor was applied before algorithm... or default to 10
765
801
uint8_t old_nfactor = ((algo -> nfactor )?algo -> nfactor :0 );
766
802
//load previous kernel file name if was applied before algorithm...
@@ -811,5 +847,6 @@ void set_algorithm_nfactor(algorithm_t* algo, const uint8_t nfactor)
811
847
812
848
bool cmp_algorithm (algorithm_t * algo1 , algorithm_t * algo2 )
813
849
{
850
+ // return (strcmp(algo1->name, algo2->name) == 0) && (algo1->nfactor == algo2->nfactor);
814
851
return (!safe_cmp (algo1 -> name , algo2 -> name ) && !safe_cmp (algo1 -> kernelfile , algo2 -> kernelfile ) && (algo1 -> nfactor == algo2 -> nfactor ));
815
852
}
0 commit comments