Skip to content

Commit d658ef0

Browse files
committed
pext names
1 parent 80f8661 commit d658ef0

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

docs/AlphaDeepChess/Capitulos/AnalysisOfImprovements.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ \subsection*{Transposition table}
170170

171171
\subsection*{Move generator with magic bitboards and pext instruction}
172172

173-
\noindent In addition to the transposition table, we now accelerate the move generation process using \texttt{PEXT} instructions. We chose not to analyze the magic bitboards technique at this stage, as both approaches provide constant-time (\( O(1) \)) access to legal moves for sliding pieces, and would yield similar performance results.
173+
\noindent In addition to the transposition table, we now accelerate the move generation process using PEXT instructions. We chose not to analyze the magic bitboards technique at this stage, as both approaches provide constant-time (\( O(1) \)) access to legal moves for sliding pieces, and would yield similar performance results.
174174

175175
\vspace{1em}
176176

docs/AlphaDeepChess/Capitulos/DescripcionTrabajo.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ \section{Evaluation: materialistic approach}\label{sec:evaluation}
190190
\vspace{1em}
191191

192192
\noindent The full implementation can be found in \\
193-
\texttt{src\textbackslash{}evaluation\textbackslash{}evaluation\_dynamic.cpp.}.
193+
\texttt{src\textbackslash{}evaluation\textbackslash{}evaluation\_dynamic.cpp}.
194194

195195
\vspace{1em}
196196

@@ -409,7 +409,7 @@ \section{Move generator}
409409

410410
\vspace{1em}
411411

412-
\noindent \parbox{\textwidth}{The full implementation of the move generator can be found in \texttt{src\textbackslash{}move\_generator\textbackslash{}move\_generator\_basic.cpp}.}
412+
\noindent The full implementation of the move generator can be found in\\ \texttt{src\textbackslash{}move\_generator\textbackslash{}move\_generator\_basic.cpp}.
413413

414414
\vspace{1em}
415415

@@ -643,4 +643,4 @@ \subsection*{Killer moves}
643643

644644
\vspace{1em}
645645

646-
\noindent If a quiet move being evaluated matches one of the killer moves stored at the current search depth, we increase its score by 70 points. The value 70 is chosen empirically to ensure that killer moves are prioritized above most quiet moves, but still allow the most valuable captures (according to the MVV-LVA heuristic) to take precedence when appropriate. This balance helps improve pruning efficiency without overlooking critical tactical opportunities.
646+
\noindent If a quiet move being evaluated matches one of the killer moves stored at the current search depth, we increase its score by 70 points. This value is chosen to ensure that killer moves are prioritized above most quiet moves, but still allow the most valuable captures (according to the MVV-LVA heuristic) to take precedence when appropriate. This balance helps improve pruning efficiency without overlooking critical tactical opportunities.

docs/AlphaDeepChess/Capitulos/ImprovementTechniques.tex

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ \chapter{Improvement techniques}\label{cap:ImprovementTechniques}
33
This chapter documents the implementation of the following techniques used to improve the playing strenght of the chess engine:
44

55
\begin{itemize}[itemsep=2pt]
6-
\item Transposition tables with zobrist hashing.
6+
\item Transposition tables with Zobrist hashing.
77
\item Move generator with magic bitboards and PEXT instructions.
88
\item Evaluation with king safety and piece mobility parameters.
99
\item Multithread search.
10-
\item Search with Late move Reductions.
10+
\item Search with late move reductions.
1111
\end{itemize}
1212

1313
\newpage
@@ -27,13 +27,13 @@ \section{Transposition table}\label{sec:tt}
2727
markmoves={c1-e3,e3-g3,c1-g1,g1-g3},
2828
arrow=to
2929
]
30-
\caption*{Lasker-Reichhelm Position, transposition example}\label{fig:transposition_example}
30+
\caption*{Lasker-Reichhelm Position, transposition example.}\label{fig:transposition_example}
3131
\end{figure}
3232

3333
\vspace{1em}
3434

35-
\noindent Taking advantage of dynamic programming, we create a look-up table of chess positions and its evaluation. So if we encounter the same position again, the evaluation is already precalculated. However, we ask ourselves the following question: how much space does the look-up table take up if there are an astronomical amount of chess positions? What we can do is assign a hash to each position and make the table index the last bits of the hash. The larger the table, the less likely access collisions will be. We also want a hash that is fast to calculate and has collision-reducing properties.
36-
~\cite{TranspositionTable}
35+
\noindent Taking advantage of dynamic programming, we create a look-up table of chess positions and its evaluation. So if we encounter the same position again, the evaluation is already precalculated. However, we ask ourselves the following question: how much space does the look-up table take up if there are an astronomical amount of chess positions? What we can do is assign a hash to each position and make the table index the last bits of the hash. The larger the table, the less likely access collisions will be. We also want a hash that is fast to calculate and has collision-reducing properties~\cite{TranspositionTable}.
36+
3737

3838
\vspace{1em}
3939

@@ -303,18 +303,18 @@ \subsection*{Index calculation}
303303

304304
\subsection*{PEXT instruction}
305305

306-
\noindent The \texttt{PEXT} (Parallel Bits Extract) is an instruction available on modern CPUs. They extracts bits from a source operand according to a mask and packs them into the lower bits of the destination operand~\cite{PextInstruction}. It is ideally suited for computing our table index.
306+
\noindent The PEXT (Parallel Bits Extract) is an instruction available on modern CPUs. They extracts bits from a source operand according to a mask and packs them into the lower bits of the destination operand~\cite{PextInstruction}. It is ideally suited for computing our table index.
307307

308308
\vspace{1em}
309309

310-
\noindent\cref{fig:pext_instruction_example} illustrates how \texttt{PEXT} works: it selects specific bits from register \texttt{r2}, as specified by the mask in \texttt{r3}, and packs the result into the lower bits of the destination register \texttt{r1}.
310+
\noindent\cref{fig:pext_instruction_example} illustrates how PEXT works: it selects specific bits from register \texttt{r2}, as specified by the mask in \texttt{r3}, and packs the result into the lower bits of the destination register \texttt{r1}.
311311

312312
\vspace{1em}
313313

314314
\begin{figure}[H]
315315
\centering
316316
\includegraphics[width=0.5\textwidth]{Imagenes/pext.png}
317-
\caption{Example of the \texttt{PEXT} instruction.}\label{fig:pext_instruction_example}
317+
\caption{Example of the PEXT instruction.}\label{fig:pext_instruction_example}
318318
\end{figure}
319319

320320
\noindent For our previous example (see~\cref{fig:magics_position}), we only need the full bitboard of blockers and the rook's attack pattern (excluding the borders to reduce space), as illustrated below.
@@ -326,29 +326,29 @@ \subsection*{PEXT instruction}
326326
\begin{minipage}[c]{0.3\textwidth}
327327
\centering
328328
\includegraphics[width=\textwidth]{Imagenes/magics_blockers.png}
329-
\caption{Blockers bitboard}
329+
\caption*{Blockers bitboard}
330330
\end{minipage}
331331
\hfill
332332
\begin{minipage}[c]{0.3\textwidth}
333333
\centering
334334
\includegraphics[width=\textwidth]{Imagenes/magics_rook_attacks.png}
335-
\caption{Rook attack mask}
335+
\caption*{Rook attack mask}
336336
\end{minipage}
337337
\hfill
338338
\begin{minipage}[c]{0.05\textwidth}
339339
\centering
340-
\Huge\texttt{->}
340+
\Huge\texttt{$\rightarrow$}
341341
\end{minipage}
342342
\hfill
343343
\begin{minipage}[c]{0.3\textwidth}
344344
\centering
345345
\includegraphics[width=\textwidth]{Imagenes/pext_final_index.png}
346-
\caption{Final extracted index}
346+
\caption*{Final extracted index}
347347
\end{minipage}
348-
\caption*{index extraction with Pext example}\label{fig:pext_bitboards}
348+
\caption*{Index extraction with PEXT example.}\label{fig:pext_bitboards}
349349
\end{figure}
350350

351-
\noindent The final index used to access the lookup table is calculated using the \texttt{pext} instruction as follows:
351+
\noindent The final index used to access the lookup table is calculated using the PEXT instruction as follows:
352352
\begin{align*}
353353
\text{index}
354354
&= \text{\_pext\_u64}(\text{blockers},\,\texttt{attack\_pattern})\,.
@@ -359,7 +359,7 @@ \subsection*{Conditional implementation}
359359
\noindent To maintain compatibility and performance across different hardware platforms, we provide two implementations for computing the indices:
360360

361361
\begin{itemize}[itemsep=1pt]
362-
\item If \texttt{PEXT} support is detected at compile time, the engine uses it to compute the index directly.
362+
\item If PEXT support is detected at compile time, the engine uses it to compute the index directly.
363363
\item Otherwise, the engine falls back to the magic bitboards approach using multiplication and bit shifts.
364364
\end{itemize}
365365

docs/AlphaDeepChess/TFGTeXiS.pdf

65 KB
Binary file not shown.

0 commit comments

Comments
 (0)