]> git.sesse.net Git - stockfish/blob - src/nnue/nnue_feature_transformer.h
Read NNUE net faster
[stockfish] / src / nnue / nnue_feature_transformer.h
1 /*
2   Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3   Copyright (C) 2004-2021 The Stockfish developers (see AUTHORS file)
4
5   Stockfish is free software: you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by
7   the Free Software Foundation, either version 3 of the License, or
8   (at your option) any later version.
9
10   Stockfish is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   GNU General Public License for more details.
14
15   You should have received a copy of the GNU General Public License
16   along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 // A class that converts the input features of the NNUE evaluation function
20
21 #ifndef NNUE_FEATURE_TRANSFORMER_H_INCLUDED
22 #define NNUE_FEATURE_TRANSFORMER_H_INCLUDED
23
24 #include "nnue_common.h"
25 #include "nnue_architecture.h"
26
27 #include <cstring> // std::memset()
28
29 namespace Stockfish::Eval::NNUE {
30
31   // If vector instructions are enabled, we update and refresh the
32   // accumulator tile by tile such that each tile fits in the CPU's
33   // vector registers.
34   #define VECTOR
35
36   static_assert(PSQTBuckets == 8, "Assumed by the current choice of constants.");
37
38   #ifdef USE_AVX512
39   typedef __m512i vec_t;
40   typedef __m256i psqt_vec_t;
41   #define vec_load(a) _mm512_load_si512(a)
42   #define vec_store(a,b) _mm512_store_si512(a,b)
43   #define vec_add_16(a,b) _mm512_add_epi16(a,b)
44   #define vec_sub_16(a,b) _mm512_sub_epi16(a,b)
45   #define vec_load_psqt(a) _mm256_load_si256(a)
46   #define vec_store_psqt(a,b) _mm256_store_si256(a,b)
47   #define vec_add_psqt_32(a,b) _mm256_add_epi32(a,b)
48   #define vec_sub_psqt_32(a,b) _mm256_sub_epi32(a,b)
49   #define vec_zero_psqt() _mm256_setzero_si256()
50   static constexpr IndexType NumRegs = 8; // only 8 are needed
51   static constexpr IndexType NumPsqtRegs = 1;
52
53   #elif USE_AVX2
54   typedef __m256i vec_t;
55   typedef __m256i psqt_vec_t;
56   #define vec_load(a) _mm256_load_si256(a)
57   #define vec_store(a,b) _mm256_store_si256(a,b)
58   #define vec_add_16(a,b) _mm256_add_epi16(a,b)
59   #define vec_sub_16(a,b) _mm256_sub_epi16(a,b)
60   #define vec_load_psqt(a) _mm256_load_si256(a)
61   #define vec_store_psqt(a,b) _mm256_store_si256(a,b)
62   #define vec_add_psqt_32(a,b) _mm256_add_epi32(a,b)
63   #define vec_sub_psqt_32(a,b) _mm256_sub_epi32(a,b)
64   #define vec_zero_psqt() _mm256_setzero_si256()
65   static constexpr IndexType NumRegs = 16;
66   static constexpr IndexType NumPsqtRegs = 1;
67
68   #elif USE_SSE2
69   typedef __m128i vec_t;
70   typedef __m128i psqt_vec_t;
71   #define vec_load(a) (*(a))
72   #define vec_store(a,b) *(a)=(b)
73   #define vec_add_16(a,b) _mm_add_epi16(a,b)
74   #define vec_sub_16(a,b) _mm_sub_epi16(a,b)
75   #define vec_load_psqt(a) (*(a))
76   #define vec_store_psqt(a,b) *(a)=(b)
77   #define vec_add_psqt_32(a,b) _mm_add_epi32(a,b)
78   #define vec_sub_psqt_32(a,b) _mm_sub_epi32(a,b)
79   #define vec_zero_psqt() _mm_setzero_si128()
80   static constexpr IndexType NumRegs = Is64Bit ? 16 : 8;
81   static constexpr IndexType NumPsqtRegs = 2;
82
83   #elif USE_MMX
84   typedef __m64 vec_t;
85   typedef __m64 psqt_vec_t;
86   #define vec_load(a) (*(a))
87   #define vec_store(a,b) *(a)=(b)
88   #define vec_add_16(a,b) _mm_add_pi16(a,b)
89   #define vec_sub_16(a,b) _mm_sub_pi16(a,b)
90   #define vec_load_psqt(a) (*(a))
91   #define vec_store_psqt(a,b) *(a)=(b)
92   #define vec_add_psqt_32(a,b) _mm_add_pi32(a,b)
93   #define vec_sub_psqt_32(a,b) _mm_sub_pi32(a,b)
94   #define vec_zero_psqt() _mm_setzero_si64()
95   static constexpr IndexType NumRegs = 8;
96   static constexpr IndexType NumPsqtRegs = 4;
97
98   #elif USE_NEON
99   typedef int16x8_t vec_t;
100   typedef int32x4_t psqt_vec_t;
101   #define vec_load(a) (*(a))
102   #define vec_store(a,b) *(a)=(b)
103   #define vec_add_16(a,b) vaddq_s16(a,b)
104   #define vec_sub_16(a,b) vsubq_s16(a,b)
105   #define vec_load_psqt(a) (*(a))
106   #define vec_store_psqt(a,b) *(a)=(b)
107   #define vec_add_psqt_32(a,b) vaddq_s32(a,b)
108   #define vec_sub_psqt_32(a,b) vsubq_s32(a,b)
109   #define vec_zero_psqt() psqt_vec_t{0}
110   static constexpr IndexType NumRegs = 16;
111   static constexpr IndexType NumPsqtRegs = 2;
112
113   #else
114   #undef VECTOR
115
116   #endif
117
118   // Input feature converter
119   class FeatureTransformer {
120
121    private:
122     // Number of output dimensions for one side
123     static constexpr IndexType HalfDimensions = TransformedFeatureDimensions;
124
125     #ifdef VECTOR
126     static constexpr IndexType TileHeight = NumRegs * sizeof(vec_t) / 2;
127     static constexpr IndexType PsqtTileHeight = NumPsqtRegs * sizeof(psqt_vec_t) / 4;
128     static_assert(HalfDimensions % TileHeight == 0, "TileHeight must divide HalfDimensions");
129     static_assert(PSQTBuckets % PsqtTileHeight == 0, "PsqtTileHeight must divide PSQTBuckets");
130     #endif
131
132    public:
133     // Output type
134     using OutputType = TransformedFeatureType;
135
136     // Number of input/output dimensions
137     static constexpr IndexType InputDimensions = FeatureSet::Dimensions;
138     static constexpr IndexType OutputDimensions = HalfDimensions * 2;
139
140     // Size of forward propagation buffer
141     static constexpr std::size_t BufferSize =
142         OutputDimensions * sizeof(OutputType);
143
144     // Hash value embedded in the evaluation file
145     static constexpr std::uint32_t get_hash_value() {
146       return FeatureSet::HashValue ^ OutputDimensions;
147     }
148
149     // Read network parameters
150     bool read_parameters(std::istream& stream) {
151
152       read_little_endian<BiasType      >(stream, biases     , HalfDimensions                  );
153       read_little_endian<WeightType    >(stream, weights    , HalfDimensions * InputDimensions);
154       read_little_endian<PSQTWeightType>(stream, psqtWeights, PSQTBuckets    * InputDimensions);
155
156       return !stream.fail();
157     }
158
159     // Write network parameters
160     bool write_parameters(std::ostream& stream) const {
161
162       write_little_endian<BiasType      >(stream, biases     , HalfDimensions                  );
163       write_little_endian<WeightType    >(stream, weights    , HalfDimensions * InputDimensions);
164       write_little_endian<PSQTWeightType>(stream, psqtWeights, PSQTBuckets    * InputDimensions);
165
166       return !stream.fail();
167     }
168
169     // Convert input features
170     std::int32_t transform(const Position& pos, OutputType* output, int bucket) const {
171       update_accumulator(pos, WHITE);
172       update_accumulator(pos, BLACK);
173
174       const Color perspectives[2] = {pos.side_to_move(), ~pos.side_to_move()};
175       const auto& accumulation = pos.state()->accumulator.accumulation;
176       const auto& psqtAccumulation = pos.state()->accumulator.psqtAccumulation;
177
178       const auto psqt = (
179             psqtAccumulation[perspectives[0]][bucket]
180           - psqtAccumulation[perspectives[1]][bucket]
181         ) / 2;
182
183
184   #if defined(USE_AVX512)
185
186       constexpr IndexType NumChunks = HalfDimensions / (SimdWidth * 2);
187       static_assert(HalfDimensions % (SimdWidth * 2) == 0);
188       const __m512i Control = _mm512_setr_epi64(0, 2, 4, 6, 1, 3, 5, 7);
189       const __m512i Zero = _mm512_setzero_si512();
190
191       for (IndexType p = 0; p < 2; ++p)
192       {
193           const IndexType offset = HalfDimensions * p;
194           auto out = reinterpret_cast<__m512i*>(&output[offset]);
195           for (IndexType j = 0; j < NumChunks; ++j)
196           {
197               __m512i sum0 = _mm512_load_si512(&reinterpret_cast<const __m512i*>
198                                               (accumulation[perspectives[p]])[j * 2 + 0]);
199               __m512i sum1 = _mm512_load_si512(&reinterpret_cast<const __m512i*>
200                                               (accumulation[perspectives[p]])[j * 2 + 1]);
201
202               _mm512_store_si512(&out[j], _mm512_permutexvar_epi64(Control,
203                                  _mm512_max_epi8(_mm512_packs_epi16(sum0, sum1), Zero)));
204           }
205       }
206       return psqt;
207
208   #elif defined(USE_AVX2)
209
210       constexpr IndexType NumChunks = HalfDimensions / SimdWidth;
211       constexpr int Control = 0b11011000;
212       const __m256i Zero = _mm256_setzero_si256();
213
214       for (IndexType p = 0; p < 2; ++p)
215       {
216           const IndexType offset = HalfDimensions * p;
217           auto out = reinterpret_cast<__m256i*>(&output[offset]);
218           for (IndexType j = 0; j < NumChunks; ++j)
219           {
220               __m256i sum0 = _mm256_load_si256(&reinterpret_cast<const __m256i*>
221                                               (accumulation[perspectives[p]])[j * 2 + 0]);
222               __m256i sum1 = _mm256_load_si256(&reinterpret_cast<const __m256i*>
223                                               (accumulation[perspectives[p]])[j * 2 + 1]);
224
225               _mm256_store_si256(&out[j], _mm256_permute4x64_epi64(
226                                  _mm256_max_epi8(_mm256_packs_epi16(sum0, sum1), Zero), Control));
227           }
228       }
229       return psqt;
230
231   #elif defined(USE_SSE2)
232
233       #ifdef USE_SSE41
234       constexpr IndexType NumChunks = HalfDimensions / SimdWidth;
235       const __m128i Zero = _mm_setzero_si128();
236       #else
237       constexpr IndexType NumChunks = HalfDimensions / SimdWidth;
238       const __m128i k0x80s = _mm_set1_epi8(-128);
239       #endif
240
241       for (IndexType p = 0; p < 2; ++p)
242       {
243           const IndexType offset = HalfDimensions * p;
244           auto out = reinterpret_cast<__m128i*>(&output[offset]);
245           for (IndexType j = 0; j < NumChunks; ++j)
246           {
247               __m128i sum0 = _mm_load_si128(&reinterpret_cast<const __m128i*>
248                                            (accumulation[perspectives[p]])[j * 2 + 0]);
249               __m128i sum1 = _mm_load_si128(&reinterpret_cast<const __m128i*>
250                                            (accumulation[perspectives[p]])[j * 2 + 1]);
251               const __m128i packedbytes = _mm_packs_epi16(sum0, sum1);
252
253               #ifdef USE_SSE41
254               _mm_store_si128(&out[j], _mm_max_epi8(packedbytes, Zero));
255               #else
256               _mm_store_si128(&out[j], _mm_subs_epi8(_mm_adds_epi8(packedbytes, k0x80s), k0x80s));
257               #endif
258           }
259       }
260       return psqt;
261
262   #elif defined(USE_MMX)
263
264       constexpr IndexType NumChunks = HalfDimensions / SimdWidth;
265       const __m64 k0x80s = _mm_set1_pi8(-128);
266
267       for (IndexType p = 0; p < 2; ++p)
268       {
269           const IndexType offset = HalfDimensions * p;
270           auto out = reinterpret_cast<__m64*>(&output[offset]);
271           for (IndexType j = 0; j < NumChunks; ++j)
272           {
273               __m64 sum0 = *(&reinterpret_cast<const __m64*>(accumulation[perspectives[p]])[j * 2 + 0]);
274               __m64 sum1 = *(&reinterpret_cast<const __m64*>(accumulation[perspectives[p]])[j * 2 + 1]);
275               const __m64 packedbytes = _mm_packs_pi16(sum0, sum1);
276               out[j] = _mm_subs_pi8(_mm_adds_pi8(packedbytes, k0x80s), k0x80s);
277           }
278       }
279       _mm_empty();
280       return psqt;
281
282   #elif defined(USE_NEON)
283
284       constexpr IndexType NumChunks = HalfDimensions / (SimdWidth / 2);
285       const int8x8_t Zero = {0};
286
287       for (IndexType p = 0; p < 2; ++p)
288       {
289           const IndexType offset = HalfDimensions * p;
290           const auto out = reinterpret_cast<int8x8_t*>(&output[offset]);
291           for (IndexType j = 0; j < NumChunks; ++j)
292           {
293               int16x8_t sum = reinterpret_cast<const int16x8_t*>(accumulation[perspectives[p]])[j];
294               out[j] = vmax_s8(vqmovn_s16(sum), Zero);
295           }
296       }
297       return psqt;
298
299   #else
300
301       for (IndexType p = 0; p < 2; ++p)
302       {
303           const IndexType offset = HalfDimensions * p;
304           for (IndexType j = 0; j < HalfDimensions; ++j)
305           {
306               BiasType sum = accumulation[perspectives[p]][j];
307               output[offset + j] = static_cast<OutputType>(std::max<int>(0, std::min<int>(127, sum)));
308           }
309       }
310       return psqt;
311
312   #endif
313
314    } // end of function transform()
315
316
317
318    private:
319     void update_accumulator(const Position& pos, const Color perspective) const {
320
321       // The size must be enough to contain the largest possible update.
322       // That might depend on the feature set and generally relies on the
323       // feature set's update cost calculation to be correct and never
324       // allow updates with more added/removed features than MaxActiveDimensions.
325       using IndexList = ValueList<IndexType, FeatureSet::MaxActiveDimensions>;
326
327   #ifdef VECTOR
328       // Gcc-10.2 unnecessarily spills AVX2 registers if this array
329       // is defined in the VECTOR code below, once in each branch
330       vec_t acc[NumRegs];
331       psqt_vec_t psqt[NumPsqtRegs];
332   #endif
333
334       // Look for a usable accumulator of an earlier position. We keep track
335       // of the estimated gain in terms of features to be added/subtracted.
336       StateInfo *st = pos.state(), *next = nullptr;
337       int gain = FeatureSet::refresh_cost(pos);
338       while (st->accumulator.state[perspective] == EMPTY)
339       {
340         // This governs when a full feature refresh is needed and how many
341         // updates are better than just one full refresh.
342         if (   FeatureSet::requires_refresh(st, perspective)
343             || (gain -= FeatureSet::update_cost(st) + 1) < 0)
344           break;
345         next = st;
346         st = st->previous;
347       }
348
349       if (st->accumulator.state[perspective] == COMPUTED)
350       {
351         if (next == nullptr)
352           return;
353
354         // Update incrementally in two steps. First, we update the "next"
355         // accumulator. Then, we update the current accumulator (pos.state()).
356
357         // Gather all features to be updated.
358         const Square ksq = pos.square<KING>(perspective);
359         IndexList removed[2], added[2];
360         FeatureSet::append_changed_indices(
361           ksq, next, perspective, removed[0], added[0]);
362         for (StateInfo *st2 = pos.state(); st2 != next; st2 = st2->previous)
363           FeatureSet::append_changed_indices(
364             ksq, st2, perspective, removed[1], added[1]);
365
366         // Mark the accumulators as computed.
367         next->accumulator.state[perspective] = COMPUTED;
368         pos.state()->accumulator.state[perspective] = COMPUTED;
369
370         // Now update the accumulators listed in states_to_update[], where the last element is a sentinel.
371         StateInfo *states_to_update[3] =
372           { next, next == pos.state() ? nullptr : pos.state(), nullptr };
373   #ifdef VECTOR
374         for (IndexType j = 0; j < HalfDimensions / TileHeight; ++j)
375         {
376           // Load accumulator
377           auto accTile = reinterpret_cast<vec_t*>(
378             &st->accumulator.accumulation[perspective][j * TileHeight]);
379           for (IndexType k = 0; k < NumRegs; ++k)
380             acc[k] = vec_load(&accTile[k]);
381
382           for (IndexType i = 0; states_to_update[i]; ++i)
383           {
384             // Difference calculation for the deactivated features
385             for (const auto index : removed[i])
386             {
387               const IndexType offset = HalfDimensions * index + j * TileHeight;
388               auto column = reinterpret_cast<const vec_t*>(&weights[offset]);
389               for (IndexType k = 0; k < NumRegs; ++k)
390                 acc[k] = vec_sub_16(acc[k], column[k]);
391             }
392
393             // Difference calculation for the activated features
394             for (const auto index : added[i])
395             {
396               const IndexType offset = HalfDimensions * index + j * TileHeight;
397               auto column = reinterpret_cast<const vec_t*>(&weights[offset]);
398               for (IndexType k = 0; k < NumRegs; ++k)
399                 acc[k] = vec_add_16(acc[k], column[k]);
400             }
401
402             // Store accumulator
403             accTile = reinterpret_cast<vec_t*>(
404               &states_to_update[i]->accumulator.accumulation[perspective][j * TileHeight]);
405             for (IndexType k = 0; k < NumRegs; ++k)
406               vec_store(&accTile[k], acc[k]);
407           }
408         }
409
410         for (IndexType j = 0; j < PSQTBuckets / PsqtTileHeight; ++j)
411         {
412           // Load accumulator
413           auto accTilePsqt = reinterpret_cast<psqt_vec_t*>(
414             &st->accumulator.psqtAccumulation[perspective][j * PsqtTileHeight]);
415           for (std::size_t k = 0; k < NumPsqtRegs; ++k)
416             psqt[k] = vec_load_psqt(&accTilePsqt[k]);
417
418           for (IndexType i = 0; states_to_update[i]; ++i)
419           {
420             // Difference calculation for the deactivated features
421             for (const auto index : removed[i])
422             {
423               const IndexType offset = PSQTBuckets * index + j * PsqtTileHeight;
424               auto columnPsqt = reinterpret_cast<const psqt_vec_t*>(&psqtWeights[offset]);
425               for (std::size_t k = 0; k < NumPsqtRegs; ++k)
426                 psqt[k] = vec_sub_psqt_32(psqt[k], columnPsqt[k]);
427             }
428
429             // Difference calculation for the activated features
430             for (const auto index : added[i])
431             {
432               const IndexType offset = PSQTBuckets * index + j * PsqtTileHeight;
433               auto columnPsqt = reinterpret_cast<const psqt_vec_t*>(&psqtWeights[offset]);
434               for (std::size_t k = 0; k < NumPsqtRegs; ++k)
435                 psqt[k] = vec_add_psqt_32(psqt[k], columnPsqt[k]);
436             }
437
438             // Store accumulator
439             accTilePsqt = reinterpret_cast<psqt_vec_t*>(
440               &states_to_update[i]->accumulator.psqtAccumulation[perspective][j * PsqtTileHeight]);
441             for (std::size_t k = 0; k < NumPsqtRegs; ++k)
442               vec_store_psqt(&accTilePsqt[k], psqt[k]);
443           }
444         }
445
446   #else
447         for (IndexType i = 0; states_to_update[i]; ++i)
448         {
449           std::memcpy(states_to_update[i]->accumulator.accumulation[perspective],
450               st->accumulator.accumulation[perspective],
451               HalfDimensions * sizeof(BiasType));
452
453           for (std::size_t k = 0; k < PSQTBuckets; ++k)
454             states_to_update[i]->accumulator.psqtAccumulation[perspective][k] = st->accumulator.psqtAccumulation[perspective][k];
455
456           st = states_to_update[i];
457
458           // Difference calculation for the deactivated features
459           for (const auto index : removed[i])
460           {
461             const IndexType offset = HalfDimensions * index;
462
463             for (IndexType j = 0; j < HalfDimensions; ++j)
464               st->accumulator.accumulation[perspective][j] -= weights[offset + j];
465
466             for (std::size_t k = 0; k < PSQTBuckets; ++k)
467               st->accumulator.psqtAccumulation[perspective][k] -= psqtWeights[index * PSQTBuckets + k];
468           }
469
470           // Difference calculation for the activated features
471           for (const auto index : added[i])
472           {
473             const IndexType offset = HalfDimensions * index;
474
475             for (IndexType j = 0; j < HalfDimensions; ++j)
476               st->accumulator.accumulation[perspective][j] += weights[offset + j];
477
478             for (std::size_t k = 0; k < PSQTBuckets; ++k)
479               st->accumulator.psqtAccumulation[perspective][k] += psqtWeights[index * PSQTBuckets + k];
480           }
481         }
482   #endif
483       }
484       else
485       {
486         // Refresh the accumulator
487         auto& accumulator = pos.state()->accumulator;
488         accumulator.state[perspective] = COMPUTED;
489         IndexList active;
490         FeatureSet::append_active_indices(pos, perspective, active);
491
492   #ifdef VECTOR
493         for (IndexType j = 0; j < HalfDimensions / TileHeight; ++j)
494         {
495           auto biasesTile = reinterpret_cast<const vec_t*>(
496               &biases[j * TileHeight]);
497           for (IndexType k = 0; k < NumRegs; ++k)
498             acc[k] = biasesTile[k];
499
500           for (const auto index : active)
501           {
502             const IndexType offset = HalfDimensions * index + j * TileHeight;
503             auto column = reinterpret_cast<const vec_t*>(&weights[offset]);
504
505             for (unsigned k = 0; k < NumRegs; ++k)
506               acc[k] = vec_add_16(acc[k], column[k]);
507           }
508
509           auto accTile = reinterpret_cast<vec_t*>(
510               &accumulator.accumulation[perspective][j * TileHeight]);
511           for (unsigned k = 0; k < NumRegs; k++)
512             vec_store(&accTile[k], acc[k]);
513         }
514
515         for (IndexType j = 0; j < PSQTBuckets / PsqtTileHeight; ++j)
516         {
517           for (std::size_t k = 0; k < NumPsqtRegs; ++k)
518             psqt[k] = vec_zero_psqt();
519
520           for (const auto index : active)
521           {
522             const IndexType offset = PSQTBuckets * index + j * PsqtTileHeight;
523             auto columnPsqt = reinterpret_cast<const psqt_vec_t*>(&psqtWeights[offset]);
524
525             for (std::size_t k = 0; k < NumPsqtRegs; ++k)
526               psqt[k] = vec_add_psqt_32(psqt[k], columnPsqt[k]);
527           }
528
529           auto accTilePsqt = reinterpret_cast<psqt_vec_t*>(
530             &accumulator.psqtAccumulation[perspective][j * PsqtTileHeight]);
531           for (std::size_t k = 0; k < NumPsqtRegs; ++k)
532             vec_store_psqt(&accTilePsqt[k], psqt[k]);
533         }
534
535   #else
536         std::memcpy(accumulator.accumulation[perspective], biases,
537             HalfDimensions * sizeof(BiasType));
538
539         for (std::size_t k = 0; k < PSQTBuckets; ++k)
540           accumulator.psqtAccumulation[perspective][k] = 0;
541
542         for (const auto index : active)
543         {
544           const IndexType offset = HalfDimensions * index;
545
546           for (IndexType j = 0; j < HalfDimensions; ++j)
547             accumulator.accumulation[perspective][j] += weights[offset + j];
548
549           for (std::size_t k = 0; k < PSQTBuckets; ++k)
550             accumulator.psqtAccumulation[perspective][k] += psqtWeights[index * PSQTBuckets + k];
551         }
552   #endif
553       }
554
555   #if defined(USE_MMX)
556       _mm_empty();
557   #endif
558     }
559
560     using BiasType = std::int16_t;
561     using WeightType = std::int16_t;
562     using PSQTWeightType = std::int32_t;
563
564     alignas(CacheLineSize) BiasType biases[HalfDimensions];
565     alignas(CacheLineSize) WeightType weights[HalfDimensions * InputDimensions];
566     alignas(CacheLineSize) PSQTWeightType psqtWeights[InputDimensions * PSQTBuckets];
567   };
568
569 }  // namespace Stockfish::Eval::NNUE
570
571 #endif // #ifndef NNUE_FEATURE_TRANSFORMER_H_INCLUDED