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

Micro-optimize NNUE implementation #533

Merged
merged 6 commits into from
Oct 1, 2023
Merged

Micro-optimize NNUE implementation #533

merged 6 commits into from
Oct 1, 2023

Conversation

brunocodutra
Copy link
Owner

@brunocodutra brunocodutra commented Sep 30, 2023

Gauntlet

Base

cutechess-cli -tournament gauntlet -games 2 -rounds 1500 -openings file=engines/openings-6ply-1000.pgn plies=6 policy=round -concurrency 4 -ratinginterval 10 -resultformat wide -recover -engine conf=base -engine conf=Vajolet2_2.8 -engine conf=Monolith-2 -engine conf=Wahoo_v4 -each tc=3+0.025

Rank Name                          Elo     +/-   Games    Wins  Losses   Draws   Points   Score    Draw 
   0 base                          -39       6    9000    2663    3658    2679   4002.5   44.5%   29.8% 
   1 Wahoo_v4                       47      10    3000    1242     835     923   1703.5   56.8%   30.8% 
   2 Monolith-2                     35      10    3000    1189     891     920   1649.0   55.0%   30.7% 
   3 Vajolet2_2.8                   34      11    3000    1227     937     836   1645.0   54.8%   27.9%

Dev

cutechess-cli -tournament gauntlet -games 2 -rounds 1500 -openings file=engines/openings-6ply-1000.pgn plies=6 policy=round -concurrency 4 -ratinginterval 10 -resultformat wide -recover -engine conf=dev -engine conf=Vajolet2_2.8 -engine conf=Monolith-2 -engine conf=Wahoo_v4 -each tc=3+0.025

Rank Name                          Elo     +/-   Games    Wins  Losses   Draws   Points   Score    Draw 
   0 dev                           -19       6    9000    2873    3374    2753   4249.5   47.2%   30.6% 
   1 Monolith-2                     30      10    3000    1133     876     991   1628.5   54.3%   33.0% 
   2 Wahoo_v4                       25      10    3000    1162     944     894   1609.0   53.6%   29.8% 
   3 Vajolet2_2.8                    3      10    3000    1079    1053     868   1513.0   50.4%   28.9%

STS1-STS15_LAN_v6.epd

python sts_rating.py -f "./epd/STS1-STS15_LAN_v6.epd" -e dev -t 8 --movetime 100 --maxpoint 100

STS Rating v14.2
Engine: chessboard
Hash: 32, Threads: 8, time/pos: 0.100s

Number of positions in ./epd/STS1-STS15_LAN_v6.epd: 1188
Max score = 1188 x 100 = 118800
Test duration: 00h:02m:01s
Expected time to finish: 00h:02m:34s

  STS ID   STS1   STS2   STS3   STS4   STS5   STS6   STS7   STS8   STS9  STS10  STS11  STS12  STS13  STS14  STS15    ALL
  NumPos     85     80     86     89     85     80     82     80     71     79     70     74     75     79     73   1188
 BestCnt     56     50     53     64     63     48     44     50     42     52     44     42     50     51     40    749
   Score   6954   6354   6816   7740   7608   7458   6223   6493   5321   6738   5894   5759   6519   6647   6149  98673
Score(%)   81.8   79.4   79.3   87.0   89.5   93.2   75.9   81.2   74.9   85.3   84.2   77.8   86.9   84.1   84.2   83.1

:: STS ID and Titles ::
STS 01: Undermining
STS 02: Open Files and Diagonals
STS 03: Knight Outposts
STS 04: Square Vacancy
STS 05: Bishop vs Knight
STS 06: Re-Capturing
STS 07: Offer of Simplification
STS 08: Advancement of f/g/h Pawns
STS 09: Advancement of a/b/c Pawns
STS 10: Simplification
STS 11: Activity of the King
STS 12: Center Control
STS 13: Pawn Play in the Center
STS 14: Queens and Rooks to the 7th rank
STS 15: Avoid Pointless Exchange

:: Top 5 STS with high result ::
1. STS 06, 93.2%, "Re-Capturing"
2. STS 05, 89.5%, "Bishop vs Knight"
3. STS 04, 87.0%, "Square Vacancy"
4. STS 13, 86.9%, "Pawn Play in the Center"
5. STS 10, 85.3%, "Simplification"

:: Top 5 STS with low result ::
1. STS 09, 74.9%, "Advancement of a/b/c Pawns"
2. STS 07, 75.9%, "Offer of Simplification"
3. STS 12, 77.8%, "Center Control"
4. STS 03, 79.3%, "Knight Outposts"
5. STS 02, 79.4%, "Open Files and Diagonals"

@codecov
Copy link

codecov bot commented Sep 30, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (f773e93) 80.69% compared to head (c0f4d3b) 83.63%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #533      +/-   ##
==========================================
+ Coverage   80.69%   83.63%   +2.94%     
==========================================
  Files          39       39              
  Lines        1186     1167      -19     
==========================================
+ Hits          957      976      +19     
+ Misses        229      191      -38     
Files Coverage Δ
lib/nnue.rs 100.00% <100.00%> (ø)
lib/nnue/affine.rs 100.00% <100.00%> (ø)
lib/nnue/crelu.rs 100.00% <100.00%> (ø)
lib/nnue/damp.rs 100.00% <100.00%> (ø)
lib/nnue/evaluator.rs 98.73% <100.00%> (ø)
lib/nnue/fallthrough.rs 100.00% <100.00%> (ø)
lib/nnue/output.rs 100.00% <100.00%> (ø)
lib/nnue/psqt.rs 100.00% <100.00%> (ø)
lib/nnue/transformer.rs 100.00% <100.00%> (ø)
lib/nnue/vector.rs 100.00% <100.00%> (ø)

... and 4 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@brunocodutra brunocodutra marked this pull request as ready for review October 1, 2023 15:12
@brunocodutra brunocodutra merged commit c0e9a39 into master Oct 1, 2023
14 of 15 checks passed
@brunocodutra brunocodutra deleted the vectorization branch October 1, 2023 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant