Skip to content

Commit

Permalink
Fix the alignment of the transformer buffer
Browse files Browse the repository at this point in the history
Fixes the issue mentioned in
official-stockfish@584d9ef#r138417600.
Thanks to @cj5716 and @peregrineshahin for
spotting this!

closes official-stockfish#5042

No functional change
  • Loading branch information
mstembera authored and Disservin committed Feb 9, 2024
1 parent 96837bc commit 9699f4f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/nnue/evaluate_nnue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,10 @@ Value evaluate(const Position& pos, bool adjusted, int* complexity) {
constexpr int delta = 24;

#if defined(ALIGNAS_ON_STACK_VARIABLES_BROKEN)
TransformedFeatureType
transformedFeaturesUnaligned[FeatureTransformer < Small ? TransformedFeatureDimensionsSmall
: TransformedFeatureDimensionsBig,
nullptr
> ::BufferSize + alignment / sizeof(TransformedFeatureType)];
TransformedFeatureType transformedFeaturesUnaligned
[FeatureTransformer < Net_Size == Small ? TransformedFeatureDimensionsSmall
: TransformedFeatureDimensionsBig,
nullptr > ::BufferSize + alignment / sizeof(TransformedFeatureType)];

auto* transformedFeatures = align_ptr_up<alignment>(&transformedFeaturesUnaligned[0]);
#else
Expand Down

0 comments on commit 9699f4f

Please sign in to comment.