Skip to content

Commit b5a9adf

Browse files
committed
Make tuning engine bw512
1 parent 429d256 commit b5a9adf

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

.github/workflows/libcxx17.imp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
{ include: [ "<__math/logarithms.h>", private, "<cmath>", public ] },
1111
{ include: [ "<__ostream/basic_ostream.h>", private, "<ostream>", public ] },
1212
{ include: [ "<__system_error/errc.h>", private, "<system_error>", public ] },
13+
{ include: [ "<__vector/vector.h>", private, "<vector>", public ] },
1314

1415
# Mappings for includes between public headers
1516
{ include: [ "<ios>", public, "<iostream>", public ] },

.github/workflows/tuning.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
env:
1111
COMPCXX: clang++
1212
COMP: clang
13-
ARCH: x86-64-bmi2
13+
ARCH: x86-64-bw512
1414
defaults:
1515
run:
1616
working-directory: src
@@ -30,10 +30,12 @@ jobs:
3030
sudo update-alternatives --set clang++ /usr/bin/clang++-20
3131
3232
- name: make
33-
run: make clean && make -j build && make strip
33+
run: |
34+
make clean && make -j build ARCH=x86-64-bmi2 && make strip && mv pikafish pikafish-bmi2
35+
make clean && make -j build && make strip
3436
3537
- name: upload to fishtest
3638
run: curl https://test.pikafish.org/api/pre_upload -F file=@pikafish -F "file_type=engine" -F "password=${{ secrets.NOTHING }}"
3739

3840
- name: print variables table
39-
run: printf 'quit' | ./pikafish
41+
run: printf 'quit' | ./pikafish-bmi2

src/position.cpp

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -789,8 +789,10 @@ bool Position::see_ge(Move m, int threshold) const {
789789
}
790790

791791

792-
// Like do_move(), but a little lighter
793-
std::pair<Piece, int> Position::light_do_move(Move m) {
792+
// A lighter version of do_move(), used in chasing detection
793+
std::pair<Piece, int> Position::do_move(Move m) {
794+
795+
assert(capture(m));
794796

795797
Square from = m.from_sq();
796798
Square to = m.to_sq();
@@ -801,10 +803,8 @@ std::pair<Piece, int> Position::light_do_move(Move m) {
801803
idBoard[to] = idBoard[from];
802804
idBoard[from] = 0;
803805

804-
if (captured)
805-
// Update board and piece lists
806-
remove_piece(to);
807-
806+
// Update board and piece lists
807+
remove_piece(to);
808808
move_piece(from, to);
809809

810810
sideToMove = ~sideToMove;
@@ -813,8 +813,8 @@ std::pair<Piece, int> Position::light_do_move(Move m) {
813813
}
814814

815815

816-
// Like undo_move(), but a little lighter
817-
void Position::light_undo_move(Move m, Piece captured, int id) {
816+
// A lighter version of undo_move(), used in chasing detection
817+
void Position::undo_move(Move m, Piece captured, int id) {
818818

819819
sideToMove = ~sideToMove;
820820

@@ -828,11 +828,7 @@ void Position::light_undo_move(Move m, Piece captured, int id) {
828828
move_piece(to, from); // Put the piece back at the source square
829829

830830
if (captured)
831-
{
832-
Square capsq = to;
833-
834-
put_piece(captured, capsq); // Restore the captured piece
835-
}
831+
put_piece(captured, to); // Restore the captured piece
836832
}
837833

838834

@@ -899,7 +895,7 @@ uint16_t Position::chased(Color c) {
899895
else
900896
{
901897
bool trueChase = true;
902-
const auto& [captured, id] = light_do_move(m);
898+
const auto& [captured, id] = do_move(m);
903899
Bitboard recaptures = attackers_to(to) & pieces(sideToMove);
904900
while (recaptures)
905901
{
@@ -910,7 +906,7 @@ uint16_t Position::chased(Color c) {
910906
break;
911907
}
912908
}
913-
light_undo_move(m, captured, id);
909+
undo_move(m, captured, id);
914910

915911
if (trueChase)
916912
{
@@ -959,13 +955,13 @@ Value Position::detect_chases(int d, int ply) {
959955
{
960956
if (!chase[sideToMove])
961957
break;
962-
light_undo_move(st->move, st->capturedPiece);
958+
undo_move(st->move, st->capturedPiece);
963959
st = st->previous;
964960
}
965961
else
966962
{
967963
uint16_t after = chased(~sideToMove);
968-
light_undo_move(st->move, st->capturedPiece);
964+
undo_move(st->move, st->capturedPiece);
969965
st = st->previous;
970966
// Take the exact diff to detect the chase
971967
chase[sideToMove] &= after & ~chased(sideToMove);

src/position.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ class Position {
169169

170170
// Other helpers
171171
void move_piece(Square from, Square to);
172-
std::pair<Piece, int> light_do_move(Move m);
173-
void light_undo_move(Move m, Piece captured, int id = 0);
172+
std::pair<Piece, int> do_move(Move m);
173+
void undo_move(Move m, Piece captured, int id = 0);
174174
Value detect_chases(int d, int ply = 0);
175175
bool chase_legal(Move m) const;
176176
template<bool AfterMove>

src/types.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,13 @@ enum Piece : std::int8_t {
187187
B_ROOK = ROOK + 8, B_ADVISOR, B_CANNON, B_PAWN, B_KNIGHT, B_BISHOP, B_KING,
188188
PIECE_NB
189189
};
190-
191-
constexpr Value PieceValue[PIECE_NB] = {
192-
VALUE_ZERO, RookValue, AdvisorValue, CannonValue, PawnValue, KnightValue, BishopValue, VALUE_ZERO,
193-
VALUE_ZERO, RookValue, AdvisorValue, CannonValue, PawnValue, KnightValue, BishopValue, VALUE_ZERO};
194190
// clang-format on
195191

192+
constexpr Value PieceValue[PIECE_NB] = {VALUE_ZERO, RookValue, AdvisorValue, CannonValue,
193+
PawnValue, KnightValue, BishopValue, VALUE_ZERO,
194+
VALUE_ZERO, RookValue, AdvisorValue, CannonValue,
195+
PawnValue, KnightValue, BishopValue, VALUE_ZERO};
196+
196197
using Depth = int;
197198

198199
// The following DEPTH_ constants are used for transposition table entries

0 commit comments

Comments
 (0)