Skip to content

Commit

Permalink
Simplify accumulator refreshes
Browse files Browse the repository at this point in the history
Passed Non-Regression STC:
https://tests.stockfishchess.org/tests/view/6631f5d5d01fb9ac9bcdc7d0
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 57472 W: 14979 L: 14784 D: 27709
Ptnml(0-2): 185, 6486, 15192, 6695, 178

closes #5207

No functional change
  • Loading branch information
cj5716 authored and Disservin committed May 5, 2024
1 parent f161261 commit 61f12a4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/nnue/nnue_feature_transformer.h
Original file line number Diff line number Diff line change
Expand Up @@ -668,20 +668,20 @@ class FeatureTransformer {
for (IndexType k = 0; k < NumRegs; ++k)
acc[k] = entryTile[k];

int i0 = 0;
for (; i0 < int(std::min(removed.size(), added.size())); ++i0)
int i = 0;
for (; i < int(std::min(removed.size(), added.size())); ++i)
{
IndexType indexR = removed[i0];
IndexType indexR = removed[i];
const IndexType offsetR = HalfDimensions * indexR + j * TileHeight;
auto columnR = reinterpret_cast<const vec_t*>(&weights[offsetR]);
IndexType indexA = added[i0];
IndexType indexA = added[i];
const IndexType offsetA = HalfDimensions * indexA + j * TileHeight;
auto columnA = reinterpret_cast<const vec_t*>(&weights[offsetA]);

for (unsigned k = 0; k < NumRegs; ++k)
acc[k] = vec_add_16(vec_sub_16(acc[k], columnR[k]), columnA[k]);
}
for (int i = i0; i < int(removed.size()); ++i)
for (; i < int(removed.size()); ++i)
{
IndexType index = removed[i];
const IndexType offset = HalfDimensions * index + j * TileHeight;
Expand All @@ -690,7 +690,7 @@ class FeatureTransformer {
for (unsigned k = 0; k < NumRegs; ++k)
acc[k] = vec_sub_16(acc[k], column[k]);
}
for (int i = i0; i < int(added.size()); ++i)
for (; i < int(added.size()); ++i)
{
IndexType index = added[i];
const IndexType offset = HalfDimensions * index + j * TileHeight;
Expand Down

0 comments on commit 61f12a4

Please sign in to comment.