Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure stats updates are never bigger than maximum value of stats. #5116

Closed

Conversation

Vizvezdenec
Copy link
Contributor

In current master you always need to keep track if you may update stats with values too big for them.
This patch makes sure that even if you pass such update it would be lowered to value low enough, so is a QoL change.
Passed non-regression bounds :
https://tests.stockfishchess.org/tests/view/65ef2af40ec64f0526c44cbc
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 179232 W: 46513 L: 46450 D: 86269
Ptnml(0-2): 716, 20323, 47452, 20432, 693
non-functional change

Copy link

github-actions bot commented Mar 15, 2024

clang-format 17 needs to be run on this PR.
If you do not have clang-format installed, the maintainer will run it when merging.
For the exact version please see https://packages.ubuntu.com/mantic/clang-format-17.

(execution 8299644774 / attempt 1)

@Disservin Disservin added the simplification A simplification patch label Mar 15, 2024
@Disservin
Copy link
Member

you also add to include #include <algorithm> again :d

@Viren6
Copy link
Contributor

Viren6 commented Mar 16, 2024

I think you should keep the assert. While the clamp guards the overflow, its still likely not intended behaviour.

@Vizvezdenec
Copy link
Contributor Author

Removing assert and thus allowing to sometimes pass overflowing bonuses is the sole purpose of this patch.
It's pretty important for patches like this https://tests.stockfishchess.org/tests/view/65eeeee00ec64f0526c44832 or patches like this https://tests.stockfishchess.org/tests/view/65ef5ed70ec64f0526c450af where with master you need to calculate "can this cause an overflow" while patch makes everything bulletproof.
Also master way is extremely inconvenient since you pass bonuses in search but max value is listed in movepicker so you need to constantly check different files to see if you did smth wrong.

@Disservin
Copy link
Member

Yeah I agree with viz, I don't see much value of keeping the assert while adding the clamp, will just make a fishtest patch pass but then fail our ci.

@Disservin Disservin added the to be merged Will be merged shortly label Mar 20, 2024
@Disservin Disservin closed this in ed60460 Mar 20, 2024
linrock pushed a commit to linrock/Stockfish that referenced this pull request Mar 27, 2024
Before, one always had to keep track of the bonus one assigns to a history to stop
the stats from overflowing. This is a quality of life improvement. Since this would often go unnoticed during benching.

Passed non-regression bounds:
https://tests.stockfishchess.org/tests/view/65ef2af40ec64f0526c44cbc
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 179232 W: 46513 L: 46450 D: 86269
Ptnml(0-2): 716, 20323, 47452, 20432, 693

closes official-stockfish#5116

No functional change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
simplification A simplification patch to be merged Will be merged shortly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants