@@ -31,26 +31,33 @@ extern ALIGN64 int16_t in_weights[INSIZE * KPSIZE];
3131extern ALIGN64 int16_t in_biases [KPSIZE ];
3232
3333INLINE NNUEEvaluator * nnue_create_evaluator () {
34+ return align_malloc (sizeof (NNUEEvaluator ));
35+ }
3436
35- NNUEEvaluator * nnue = align_malloc ( sizeof ( NNUEEvaluator ));
37+ INLINE void nnue_reset_evaluator ( NNUEEvaluator * ptr ) {
3638
3739 #if USE_NNUE
3840
39- for (size_t i = 0 ; i < SQUARE_NB ; i ++ ) {
40- memset (nnue -> table [i ].occupancy , 0 , sizeof (nnue -> table [i ].occupancy ));
41- memcpy (nnue -> table [i ].accumulator .values [WHITE ], in_biases , sizeof (int16_t ) * KPSIZE );
42- memcpy (nnue -> table [i ].accumulator .values [BLACK ], in_biases , sizeof (int16_t ) * KPSIZE );
43- }
41+ // Reset the Finny table Accumulators
42+ for (size_t i = 0 ; i < SQUARE_NB ; i ++ ) {
43+ memset (ptr -> table [i ].occupancy , 0 , sizeof (ptr -> table [i ].occupancy ));
44+ memcpy (ptr -> table [i ].accumulator .values [WHITE ], in_biases , sizeof (int16_t ) * KPSIZE );
45+ memcpy (ptr -> table [i ].accumulator .values [BLACK ], in_biases , sizeof (int16_t ) * KPSIZE );
46+ }
4447
45- #endif
48+ // Reset the base of the Accumulator stack
49+ ptr -> current = & ptr -> stack [0 ];
50+ ptr -> current -> accurate [WHITE ] = 0 ;
51+ ptr -> current -> accurate [BLACK ] = 0 ;
4652
47- return nnue ;
53+ #endif
4854}
4955
50- INLINE void nnue_delete_accumulators (NNUEEvaluator * ptr ) {
56+ INLINE void nnue_delete_evaluator (NNUEEvaluator * ptr ) {
5157 align_free (ptr );
5258}
5359
60+
5461INLINE void nnue_pop (Board * board ) {
5562 if (USE_NNUE && board -> thread != NULL )
5663 -- board -> thread -> nnue -> current ;
0 commit comments