Skip to content

Conversation

@pb00068
Copy link
Contributor

@pb00068 pb00068 commented Mar 13, 2023

Since st is a member of position we don't need to pass it separately as parameter.
This allows us to use unique variable name 'st' for all occurences.

Passed non-regression test
https://tests.stockfishchess.org/tests/view/64098d562644b62c33942b35
LLR: 3.24 (-2.94,2.94) <-1.75,0.25>
Total: 548960 W: 145834 L: 146134 D: 256992
Ptnml(0-2): 1617, 57652, 156261, 57314, 1636

While being there also remove some line in pos_is_ok, where a copy of StateInfo was made by using default copy constructor and then verified it's correctedness by doing a memcmp. There is no point in doing that.

no functional change
bench: 4747020

Since st is a member of position we don't need to pass it separately as
parameter.

Passed non-regression test
https://tests.stockfishchess.org/tests/view/64098d562644b62c33942b35
LLR: 3.24 (-2.94,2.94) <-1.75,0.25>
Total: 548960 W: 145834 L: 146134 D: 256992
Ptnml(0-2): 1617, 57652, 156261, 57314, 1636

While being there also remove some line in pos_is_ok,
where a copy of StateInfo was made by using default copy constructor and
then verified it's correctedness by doing a memcmp.
There is no point in doing that.

no functional change
bench:  4747020
@mstembera
Copy link
Contributor

While being there also remove some line in pos_is_ok, where a copy of StateInfo was made by using default copy constructor and then verified it's correctedness by doing a memcmp. There is no point in doing that.

There is a call to set_state() before the memcmp. Since it's inside of pos_is_ok() which is used for debug verification purposes only it may just be there to confirm the current StateInfo is correct (self consistent with the current position).

@pb00068
Copy link
Contributor Author

pb00068 commented Mar 13, 2023

OK, missed that.
So this Check is there to ensure that we don't use positions with incorrect (uninitialized) stateInfo. If that should be preserved, I have in mind a solution how to implement it.

@vondele
Copy link
Member

vondele commented Mar 14, 2023

I think the check can be removed, we have other ways of checking against using uninitialized data.

@pb00068
Copy link
Contributor Author

pb00068 commented Mar 14, 2023

I think the check can be removed, we have other ways of checking against using uninitialized data.

Ups, I just pushed a restore-commit, just in these minutes.

@mstembera
Copy link
Contributor

mstembera commented Mar 14, 2023

OK, missed that. So this Check is there to ensure that we don't use positions with incorrect (uninitialized) stateInfo. If that should be preserved, I have in mind a solution how to implement it.

I am indifferent to keeping it or removing it but there should be no need for any special implementation to keep it. If you simply change line 1330 in master from set_state(&si); to set_state(); the check will perform the same as before.

[Edit] @vondele Are you still in favor of removing it given that nothing special has to happen?

@vondele
Copy link
Member

vondele commented Mar 15, 2023

I'm still fine with deleting the check. However, CI is repeatedly failing... I wonder what's going on?

@dubslow
Copy link
Contributor

dubslow commented Mar 15, 2023

signature mismatch: reference 4747020 obtained: 4776866 .

4776866 is indeed the current master bench, which is correctly obtained by the CI test.

the reference bench is in the commits shown in this PR. I think simply rebasing this PR on master would suffice to fix the CI.

Since st is a member of position we don't need to pass it separately as
parameter.

Passed non-regression test
https://tests.stockfishchess.org/tests/view/64098d562644b62c33942b35
LLR: 3.24 (-2.94,2.94) <-1.75,0.25>
Total: 548960 W: 145834 L: 146134 D: 256992
Ptnml(0-2): 1617, 57652, 156261, 57314, 1636

While being there also remove some line in pos_is_ok,
where correct initialization of StateInfo is being verified.

no functional change
bench:  4776866
set_check_info(st);
set_check_info();

st->repetition = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this line st->repetition = 0; could be removed also, it generates the same bench for me, I would appreciate it if someone explained how though?

Copy link
Contributor Author

@pb00068 pb00068 Mar 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think even if we omit zeroing st->repetition on null move the bench remains stable because of the st->pliesFromNull guard which prevents to consider a move-sequence as 3-fold-repetition when there's a null-move in the chain.

P.S.: all related methods do_move, has_repeated, has_game_cycle take care of st->pliesFromNull

@vondele vondele added the to be merged Will be merged shortly label Mar 19, 2023
@vondele vondele closed this in 02e4697 Mar 19, 2023
Joachim26 pushed a commit to Joachim26/StockfishNPS that referenced this pull request Mar 19, 2023
Since st is a member of position we don't need to pass it separately as
parameter.

While being there also remove some line in pos_is_ok, where
a copy of StateInfo was made by using default copy constructor and
then verified it's correctedness by doing a memcmp.
There is no point in doing that.

Passed non-regression test
https://tests.stockfishchess.org/tests/view/64098d562644b62c33942b35
LLR: 3.24 (-2.94,2.94) <-1.75,0.25>
Total: 548960 W: 145834 L: 146134 D: 256992
Ptnml(0-2): 1617, 57652, 156261, 57314, 1636

closes official-stockfish#4444

No functional change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

to be merged Will be merged shortly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants