Update license headers, clean up README, clarify licensing of third party content (bench 5834033)
This commit is contained in:
72 files changed
+888
-104
No files matched your search
@@ -1 +1,15 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
*
|
||||
@@ -0,0 +1,13 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
@@ -1,3 +1,17 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: Linux release
|
||||
|
||||
on:
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: Windows release
|
||||
|
||||
on:
|
||||
|
||||
+14
@@ -1,3 +1,17 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# ---> Nim
|
||||
nimcache/
|
||||
nimblecache/
|
||||
|
||||
+14
@@ -1,3 +1,17 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
[submodule "networks"]
|
||||
path = networks
|
||||
url = https://git.nocturn9x.space/heimdall-engine/networks
|
||||
@@ -1,3 +1,17 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
repos:
|
||||
- repo: local
|
||||
hooks:
|
||||
|
||||
Vendored
+14
@@ -1,3 +1,17 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Copied from src/heimdall/nnue.nim INPUT_BUCKETS.
|
||||
0, 1, 2, 3, 3, 2, 1, 0,
|
||||
4, 5, 6, 7, 7, 6, 5, 4,
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
<!--
|
||||
Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
# Working on Heimdall
|
||||
|
||||
Heimdall is a UCI chess engine written in Nim, with NNUE evaluation and an
|
||||
@@ -43,21 +59,98 @@ available. Choose tests relevant to the affected behavior:
|
||||
requires Python and Stockfish on `PATH`; see `python tests/suite.py -h` for
|
||||
explicit binary paths.
|
||||
- `make bench`: builds with `make dev` and runs the engine's search benchmark.
|
||||
For performance work, compare baseline and candidate binaries built with the
|
||||
same flags and network. Use `scripts/compare_performance.py` for repeated paired
|
||||
measurements; confirm microbenchmark results with full search.
|
||||
|
||||
Build standalone Nim tests through `make dev` as well. For example, to compare
|
||||
incremental NNUE evaluation with fresh evaluation:
|
||||
<!-- Testing documentation consolidated with assistance from AI agents. -->
|
||||
|
||||
### Focused correctness tests
|
||||
|
||||
Build standalone Nim tests through `make dev`, using `MAIN`, `EXE_BASE`, and an
|
||||
absolute `EVALFILE` path. Use `IS_TEST=1` for correctness checks and optimized
|
||||
default builds for speed measurements.
|
||||
|
||||
Use focused tests for incremental/fresh NNUE evaluation, threat indexing,
|
||||
move-generation and state/hash invariants, and search limits. NNUE checks include
|
||||
pending updates, cloning, the 255-ply boundary, and all 960 castling arrangements
|
||||
for both colors:
|
||||
|
||||
```sh
|
||||
make dev MAIN=tests/test_nnue.nim IS_TEST=1 EXE_BASE=bin/test-nnue EVALFILE="$PWD/networks/files/gramr.bin"
|
||||
bin/test-nnue
|
||||
make dev MAIN=tests/test_movegen.nim IS_TEST=1 EXE_BASE=bin/test-movegen EVALFILE="$PWD/networks/files/gramr.bin"
|
||||
bin/test-movegen
|
||||
make dev MAIN=tests/test_limits.nim IS_TEST=1 EXE_BASE=bin/test-limits EVALFILE="$PWD/networks/files/gramr.bin"
|
||||
bin/test-limits
|
||||
make dev MAIN=tests/test_threat_index.nim IS_TEST=1 EXE_BASE=bin/test-threat-index EVALFILE="$PWD/networks/files/gramr.bin"
|
||||
bin/test-threat-index
|
||||
make dev MAIN=tests/test_threats.nim IS_TEST=1 EXE_BASE=bin/test-threats EVALFILE="$PWD/networks/files/gramr.bin"
|
||||
bin/test-threats
|
||||
```
|
||||
|
||||
Use the same `MAIN`/`EXE_BASE`/absolute `EVALFILE` pattern for other Nim tests or
|
||||
benchmarks in `tests/`. Use `IS_TEST=1` for correctness checks and optimized
|
||||
default builds for speed measurements. See `README.md` for more testing details.
|
||||
The threat-index test checks every table entry against geometric attacks and
|
||||
explicit exclusion rules, verifies the color bounds, and checks retained feature
|
||||
indices for collisions and overflow. It also checks both indexers across perspectives
|
||||
and mirroring, and verifies the perspective masks. The threat-collection test compares
|
||||
runtime attacks and collected features against independent board geometry, including
|
||||
friendly pawn defenses, writable output slices, and positions before and after special
|
||||
moves and undo. Fixed expected indices from Viridithas additionally verify both
|
||||
perspectives of the starting position and Kiwipete.
|
||||
|
||||
To check the scalar NNUE path, repeat its build with
|
||||
`AVX2_SUPPORTED=0 AVX512_SUPPORTED=0 VNNI_SUPPORTED=0`; the diagnostic prints
|
||||
the selected backend. Native builds append SIMD defines after `EXTRA_NFLAGS`,
|
||||
so `EXTRA_NFLAGS=-u:simd` alone does not select the scalar path.
|
||||
|
||||
`tests/test_alloc.nim` checks allocation alignment. Add `EXTRA_NFLAGS=-d:noTHP`
|
||||
to its build to exercise the allocator without huge-page advice; the same flag
|
||||
can be used with the NNUE test.
|
||||
|
||||
### Performance comparisons
|
||||
|
||||
For performance comparisons, build separate baseline and candidate executables
|
||||
with identical flags and network, then alternate runs on one CPU:
|
||||
|
||||
```sh
|
||||
python scripts/compare_performance.py bin/baseline bin/candidate --cpu 2 --pairs 12 --perf --output comparison.json
|
||||
```
|
||||
|
||||
The script checks node counts and saves paired timings, hardware counters and a
|
||||
bootstrap interval. Omit `--perf` if hardware counters are unavailable. Use
|
||||
`--mode perft --depth 7` for movegen comparisons. `tests/bench_nnue.nim` and
|
||||
`tests/bench_setup.nim` provide separate inference and worker-setup benchmarks;
|
||||
build them with the same `MAIN`/`EVALFILE` pattern. Measure optimized builds for
|
||||
speed and use `IS_TEST=1` for correctness checks. Confirm microbenchmark gains
|
||||
with full search: a repeated NNUE input corpus can hide branch-prediction costs.
|
||||
|
||||
For real UCI node/time budgets on a selected FEN corpus, use `--mode uci`:
|
||||
|
||||
```sh
|
||||
python scripts/compare_performance.py bin/baseline bin/candidate --mode uci --positions src/heimdall/resources/misc/bench.txt --count 24 --offset 1 --stride 2 --limit-kind nodes --limit 200000 --cpu 2 --pairs 8 --perf --output comparison-uci.json
|
||||
```
|
||||
|
||||
Use `--limit-kind time --limit 200` for 200 milliseconds per position. UCI NPS
|
||||
uses the summed final search node/time reports, excluding engine startup and
|
||||
position resets; raw results also record whole-process wall time. Fixed-node,
|
||||
single-thread comparisons require matching per-position nodes, depths and best
|
||||
moves. Timed and multithreaded searches do not have identical trees and are not
|
||||
playing-strength tests. `--count`, `--offset` and `--stride` select distinct,
|
||||
normalized FENs; too-short or incomplete searches are rejected.
|
||||
|
||||
### Profile-guided compilation
|
||||
|
||||
Optional profile-guided compilation is available through the same dev target:
|
||||
|
||||
```sh
|
||||
make dev PGO=1 EXE_BASE=bin/heimdall-pgo
|
||||
```
|
||||
|
||||
This needs Python and a matching `llvm-profdata` installation. It builds an
|
||||
instrumented engine, trains with node and time budgets, merges the profiles, and
|
||||
rebuilds using them. The default training set is 24 even-indexed positions from
|
||||
the built-in benchmark corpus; the odd-indexed selection above is held out.
|
||||
The ordinary full benchmark includes training positions, so it is not a held-out
|
||||
PGO validation. Profile artifacts stay in ignored `build/pgo/`. Override
|
||||
`PGO_DIR`, `PGO_POSITIONS`, `PGO_TRAIN_ARGS`, `PGO_TRAIN_NODES`, or `PGO_TRAIN_MSEC`
|
||||
to customize training. Normal dev and OpenBench builds do not enable PGO.
|
||||
|
||||
## Project layout
|
||||
|
||||
|
||||
+14
@@ -1,3 +1,17 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# By @agethereal. Thanks Andy!
|
||||
FROM ubuntu:24.04
|
||||
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
.DEFAULT_GOAL := openbench
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
<!--
|
||||
Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||

|
||||
|
||||
[](https://deepwiki.com/nocturn9x/heimdall)
|
||||
@@ -57,96 +73,10 @@ All of the targets require a 64 bit processor: Heimdall does not (and will never
|
||||
|
||||
## Testing
|
||||
|
||||
For a quick regression pass with the installed dependencies and network, run
|
||||
For a quick regression pass with dependencies and network weights installed, run
|
||||
`make dev` followed by `python -m unittest discover -s tests -p 'test_*.py'`.
|
||||
The Python tests cover UCI handling and test/benchmark tools. Set `HEIMDALL` to
|
||||
test a different engine binary, for example after building with
|
||||
`make dev IS_TEST=1 EXE_BASE=bin/testdall` to enable runtime checks.
|
||||
|
||||
Use focused tests for incremental/fresh NNUE evaluation, threat indexing,
|
||||
move-generation and state/hash invariants, and search limits. NNUE checks include
|
||||
pending updates, cloning, the 255-ply boundary, and all 960 castling arrangements
|
||||
for both colors:
|
||||
|
||||
```sh
|
||||
make dev MAIN=tests/test_nnue.nim IS_TEST=1 EXE_BASE=bin/test-nnue EVALFILE="$PWD/networks/files/gramr.bin"
|
||||
bin/test-nnue
|
||||
make dev MAIN=tests/test_movegen.nim IS_TEST=1 EXE_BASE=bin/test-movegen EVALFILE="$PWD/networks/files/gramr.bin"
|
||||
bin/test-movegen
|
||||
make dev MAIN=tests/test_limits.nim IS_TEST=1 EXE_BASE=bin/test-limits EVALFILE="$PWD/networks/files/gramr.bin"
|
||||
bin/test-limits
|
||||
make dev MAIN=tests/test_threat_index.nim IS_TEST=1 EXE_BASE=bin/test-threat-index EVALFILE="$PWD/networks/files/gramr.bin"
|
||||
bin/test-threat-index
|
||||
make dev MAIN=tests/test_threats.nim IS_TEST=1 EXE_BASE=bin/test-threats EVALFILE="$PWD/networks/files/gramr.bin"
|
||||
bin/test-threats
|
||||
```
|
||||
|
||||
The threat-index test checks every table entry against geometric attacks and
|
||||
explicit exclusion rules, verifies the color bounds, and checks retained feature
|
||||
indices for collisions and overflow. It also checks both indexers across perspectives
|
||||
and mirroring, and verifies the perspective masks. The threat-collection test compares
|
||||
runtime attacks and collected features against independent board geometry, including
|
||||
friendly pawn defenses, writable output slices, and positions before and after special
|
||||
moves and undo.
|
||||
|
||||
To check the scalar NNUE path, repeat its build with
|
||||
`AVX2_SUPPORTED=0 AVX512_SUPPORTED=0 VNNI_SUPPORTED=0`; the diagnostic prints
|
||||
the selected backend. Native builds append SIMD defines after `EXTRA_NFLAGS`,
|
||||
so `EXTRA_NFLAGS=-u:simd` alone does not select the scalar path.
|
||||
|
||||
For performance comparisons, build separate baseline and candidate executables
|
||||
with identical flags, then alternate runs on one CPU:
|
||||
|
||||
```sh
|
||||
python scripts/compare_performance.py bin/baseline bin/candidate --cpu 2 --pairs 12 --perf --output comparison.json
|
||||
```
|
||||
|
||||
The script checks node counts and saves paired timings, hardware counters and a
|
||||
bootstrap interval. Omit `--perf` if hardware counters are unavailable. Use
|
||||
`--mode perft --depth 7` for movegen comparisons. `tests/bench_nnue.nim` and
|
||||
`tests/bench_setup.nim` provide separate inference and worker-setup benchmarks;
|
||||
build them with the same `MAIN`/`EVALFILE` pattern. Measure optimized builds for
|
||||
speed and use `IS_TEST=1` for correctness checks. Confirm microbenchmark gains
|
||||
with full search: a repeated NNUE input corpus can hide branch-prediction costs.
|
||||
|
||||
For real UCI node/time budgets on a selected FEN corpus, use `--mode uci`:
|
||||
|
||||
```sh
|
||||
python scripts/compare_performance.py bin/baseline bin/candidate --mode uci --positions src/heimdall/resources/misc/bench.txt --count 24 --offset 1 --stride 2 --limit-kind nodes --limit 200000 --cpu 2 --pairs 8 --perf --output comparison-uci.json
|
||||
```
|
||||
|
||||
Use `--limit-kind time --limit 200` for 200 milliseconds per position. UCI NPS
|
||||
uses the summed final search node/time reports, excluding engine startup and
|
||||
position resets; raw results also record whole-process wall time. Fixed-node,
|
||||
single-thread comparisons require matching per-position nodes, depths and best
|
||||
moves. Timed and multithreaded searches do not have identical trees and are not
|
||||
playing-strength tests. `--count`, `--offset` and `--stride` select distinct,
|
||||
normalized FENs; too-short or incomplete searches are rejected.
|
||||
|
||||
Optional profile-guided compilation is available through the same dev target:
|
||||
|
||||
```sh
|
||||
make dev PGO=1 EXE_BASE=bin/heimdall-pgo
|
||||
```
|
||||
|
||||
This needs Python and a matching `llvm-profdata` installation. It builds an
|
||||
instrumented engine, trains with node and time budgets, merges the profiles, and
|
||||
rebuilds using them. The default training set is 24 even-indexed positions from
|
||||
the built-in benchmark corpus; the odd-indexed selection above is held out.
|
||||
The ordinary full benchmark includes training positions, so it is not a held-out
|
||||
PGO validation. Profile artifacts stay in ignored `build/pgo/`. Override
|
||||
`PGO_DIR`, `PGO_POSITIONS`, `PGO_TRAIN_ARGS`, `PGO_TRAIN_NODES`, or `PGO_TRAIN_MSEC`
|
||||
to customize training. Normal dev and OpenBench builds do not enable PGO.
|
||||
|
||||
`tests/test_alloc.nim` checks allocation alignment. Add `EXTRA_NFLAGS=-d:noTHP`
|
||||
to its build to exercise the allocator without huge-page advice; the same flag
|
||||
can be used with the NNUE test.
|
||||
|
||||
Just run `make test-suite`: sit back, relax, get yourself a cup of coffee and wait for it to finish (it _will_ take a long time)
|
||||
|
||||
|
||||
**Note**: The test suite requires Python (stdlib only) and expects stockfish to be installed and in the system's PATH. Alternatively, it
|
||||
is possible to specify the location of both Heimdall and Stockfish (run `python tests/suite.py -h` for more information)
|
||||
See [AGENTS.md](AGENTS.md#tests-and-benchmarks) for focused tests, the full test
|
||||
suite, and performance comparisons.
|
||||
|
||||
|
||||
## Configuration
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
version = 1
|
||||
|
||||
# These formats are consumed as data. Keep license notices here so that adding
|
||||
# comments does not change their contents or break their readers.
|
||||
[[annotations]]
|
||||
path = [
|
||||
".vscode/settings.json",
|
||||
"Engines/Heimdall.json",
|
||||
"src/heimdall/resources/magics/*.json",
|
||||
"src/heimdall/resources/misc/bench.txt",
|
||||
"tests/all.txt",
|
||||
"tests/chess960.txt",
|
||||
"tests/illegal_edge_cases.txt",
|
||||
"tests/standard.txt",
|
||||
"tests/standard_heavy.txt",
|
||||
]
|
||||
SPDX-FileCopyrightText = "Mattia Giambirtone & All Contributors"
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
# Generated from https://github.com/lichess-org/chess-openings.
|
||||
# Retain the upstream dataset's CC0 dedication when the index is regenerated.
|
||||
[[annotations]]
|
||||
path = "src/heimdall/resources/openings/lichess.tsv"
|
||||
SPDX-FileCopyrightText = "lichess.org contributors"
|
||||
SPDX-License-Identifier = "CC0-1.0"
|
||||
@@ -1,3 +1,19 @@
|
||||
<!--
|
||||
Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
# TODO list for Heimdall releases
|
||||
|
||||
## 1.5 - ETA: ~1-2 month(s)
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
<!--
|
||||
Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Authored with assistance from AI agents.
|
||||
-->
|
||||
|
||||
# Project audit progress
|
||||
|
||||
Started: 2026-09-05
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
<!--
|
||||
Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Authored with assistance from AI agents.
|
||||
-->
|
||||
|
||||
# Performance audit, follow-up pass
|
||||
|
||||
Started: 2026-09-05
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
<!--
|
||||
Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Authored with assistance from AI agents.
|
||||
-->
|
||||
|
||||
# Search-optimization carryover experiments
|
||||
|
||||
Started: 2026-09-06
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Package
|
||||
|
||||
# TODO: Can we do some nimscript stuff to generate this automagically?
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Add a tunable parameter to src/heimdall/util/tunables.nim.
|
||||
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import std/[algorithm, httpclient, os, sequtils, strutils, tables]
|
||||
|
||||
import heimdall/[board, movegen]
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
|
||||
@@ -1,4 +1,20 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
"""Alternate paired engine workloads on one CPU and save raw samples."""
|
||||
|
||||
import argparse
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Run bench and extract the node count
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""Publish release artifacts to a Gitea release."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -1,4 +1,20 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
"""Run a selected FEN corpus with real UCI node or time limits (also PGO training)."""
|
||||
|
||||
import argparse
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Copyright 2Pawn26 Mattia Giambirtone & All Contributors
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.Pawn (the "License");
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.Pawn
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Search integration for the TUI: background search thread + live polling
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## TUI application entry point and main event loop
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Key event dispatch for the TUI.
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Board interaction, promotion, premove, and arrow input handling.
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Board setup mode state transitions and input handling.
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Replay navigation and shared post-navigation refresh helpers.
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Board rendering: composites pre-rendered piece images onto the
|
||||
## board SVG and sends the result via the kitty graphics protocol.
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Pixel buffer and pre-rendered chess piece/board assets
|
||||
##
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Composes the full TUI layout into an illwill TerminalBuffer
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Text input parsing and top-level command dispatch.
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Engine, search, and position-management commands extracted from input.nim.
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Play/replay/PGN command handling extracted from input.nim.
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Move parsing and keyboard move-entry handling extracted from input.nim.
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Public play-mode API facade.
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Shared play-mode limit and clock helpers.
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Active play-mode game orchestration and watch/ponder runtime.
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Play/watch setup prompts and configuration parsing.
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Raw terminal input reader with SGR mouse support.
|
||||
## Bypasses illwill's getKey() for input to properly handle
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Central application state for the TUI
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Chess clock with increment support.
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Kitty graphics protocol for transmitting images to the terminal.
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Bundled opening-name lookup for replay mode.
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## PGN (Portable Game Notation) parser.
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Premove pseudo-legal validation and virtual-board simulation helpers.
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## SAN (Standard Algebraic Notation) parser and formatter.
|
||||
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import std/[strutils, terminal, strformat, options]
|
||||
|
||||
import heimdall/[board, search, movegen]
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
type
|
||||
M512i* {.importc: "__m512i", header: "immintrin.h", bycopy.} = object
|
||||
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import heimdall/[eval, board, moves, search, movegen, position, transpositions]
|
||||
import heimdall/util/[wdl, limits, tunables]
|
||||
import std/[sets, math, times, strformat, atomics, random, terminal, os, strutils]
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
import std/[atomics, math, options, os, strformat, syncio, terminal, times]
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Reader, writer and move decoder for viriformat 3.0.0.
|
||||
##
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Isolate forward inference from board updates and search. Including eval makes
|
||||
## its private accumulator layout available to this diagnostic program only.
|
||||
## Build with make dev MAIN=tests/bench_nnue.nim EXE_BASE=bin/bench-nnue
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Measure repeated position setup, including worker NNUE state preparation.
|
||||
## Build with make dev MAIN=tests/bench_setup.nim EXE_BASE=bin/bench-setup
|
||||
## and an absolute EVALFILE path. Arguments: threads (default 8), repetitions.
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import builtins
|
||||
import re
|
||||
import sys
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import sys
|
||||
import timeit
|
||||
from pathlib import Path
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Check the alignment contract with and without huge-page advice.
|
||||
## Build with make dev MAIN=tests/test_alloc.nim EXE_BASE=bin/test-alloc.
|
||||
import heimdall/util/memory/thp/alloc
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
"""OpenBench genfens regressions. Build first with make dev."""
|
||||
|
||||
import os
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Deterministic limiter checks, including depth/MultiPV and mixed hard limits.
|
||||
## Build via make dev MAIN=tests/test_limits.nim IS_TEST=1 with absolute EVALFILE.
|
||||
import std/[atomics, monotimes, times]
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Focused move-generation invariants for performance-sensitive specializations.
|
||||
## Build with:
|
||||
## make dev MAIN=tests/test_movegen.nim IS_TEST=1 EXE_BASE=bin/test-movegen \
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Exercise incremental and delayed NNUE updates against a full refresh.
|
||||
## Build using make dev MAIN=tests/test_nnue.nim EXE_BASE=bin/test-nnue
|
||||
## with EVALFILE set to the absolute path of the desired network.
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
"""Regression checks for the UCI performance/PGO workload driver."""
|
||||
import importlib.util
|
||||
import tempfile
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Packed piece representation and public API checks.
|
||||
## Build with make dev MAIN=tests/test_pieces.nim IS_TEST=1 EXE_BASE=bin/test-pieces
|
||||
## and EVALFILE set to the absolute network path.
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
"""Regression tests for the perft comparison tools; no engines required."""
|
||||
|
||||
import contextlib
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Threat geometry, indexing, perspective masks, bounds and collision regressions.
|
||||
## Build with make dev MAIN=tests/test_threat_index.nim IS_TEST=1
|
||||
## EXE_BASE=bin/test-threat-index and an absolute EVALFILE path.
|
||||
|
||||
+67
-4
@@ -1,3 +1,19 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
## Runtime threat attacks and full collection against independent board geometry.
|
||||
## Build with make dev MAIN=tests/test_threats.nim IS_TEST=1
|
||||
## EXE_BASE=bin/test-threats and an absolute EVALFILE path.
|
||||
@@ -6,7 +22,11 @@ import heimdall/[board, movegen, nnue, pieces, position]
|
||||
import heimdall/threats/index
|
||||
|
||||
|
||||
var attackChecks, collectionChecks: int
|
||||
const
|
||||
STARTPOS_FEN = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
|
||||
KIWIPETE_FEN = "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1"
|
||||
|
||||
var attackChecks, collectionChecks, knownIndexChecks: int
|
||||
|
||||
|
||||
proc geometricAttack(piece: Piece, origin, target: Square, occupancy: Bitboard): bool =
|
||||
@@ -117,12 +137,54 @@ for mirrored in [false, true]:
|
||||
verifyCollection(fromFEN("4k3/8/8/8/8/8/8/4K3 w - - 0 1"), 0)
|
||||
verifyCollection(fromFEN("4k3/8/8/8/8/r7/K7/R7 w - - 0 1"), 0)
|
||||
|
||||
|
||||
proc verifyKnownIndices(fen: string, whiteExpected, blackExpected: openArray[uint16]) =
|
||||
let position = fromFEN(fen)
|
||||
for perspective in White..Black:
|
||||
var output: array[1024, uint16]
|
||||
let count = collectRefreshThreats(output, position, perspective).int
|
||||
var actual: seq[uint16]
|
||||
for i in 0..<count:
|
||||
actual.add output[i]
|
||||
actual.sort()
|
||||
let expected = if perspective == White: @whiteExpected else: @blackExpected
|
||||
doAssert actual == expected,
|
||||
&"known index mismatch for {perspective}: {fen}\nexpected: {expected}\nactual: {actual}"
|
||||
inc knownIndexChecks
|
||||
|
||||
|
||||
# Fixed expected indices from Viridithas, independent of Heimdall's indexer.
|
||||
# https://github.com/cosmobobak/viridithas/blob/89a83b692e175eddaeeb1a626d314927e614d48d/src/nnue/network/threat_updates.rs#L765
|
||||
# Both engines normalize features to a1=0, so board-coordinate differences
|
||||
# must not change these row numbers. The starting position is symmetric.
|
||||
const
|
||||
startposIndices = [
|
||||
506'u16, 525, 3878, 3879, 3899, 3900, 8351, 8449, 9240, 9344, 15603, 15604,
|
||||
15605, 18512, 32570, 32589, 36699, 36700, 36720, 36721, 42790, 42888, 43687,
|
||||
43791, 54247, 54248, 54249, 57166
|
||||
]
|
||||
kiwipeteWhiteIndices = [
|
||||
34'u16, 95, 605, 606, 608, 1276, 2034, 2374, 2376, 2377, 4517, 8351, 8449,
|
||||
15907, 15908, 15919, 17370, 18821, 23190, 24659, 30086, 30134, 30195, 30397,
|
||||
30398, 30401, 30488, 30491, 30807, 30809, 30840, 32491, 32521, 33531, 35486,
|
||||
37185, 38306, 42786, 42888, 54045, 54050, 54054, 54055, 55505
|
||||
]
|
||||
kiwipeteBlackIndices = [
|
||||
3'u16, 4, 7, 94, 97, 389, 581, 612, 1619, 2263, 2265, 2293, 4490, 5607,
|
||||
8355, 8449, 15752, 15753, 15758, 15765, 17213, 30107, 30143, 30372, 30489,
|
||||
30710, 30711, 30712, 32510, 32512, 32515, 33186, 33740, 35517, 37212, 42790,
|
||||
42888, 46560, 48008, 53839, 53847, 53848, 55300, 56761
|
||||
]
|
||||
|
||||
verifyKnownIndices(STARTPOS_FEN, startposIndices, startposIndices)
|
||||
verifyKnownIndices(KIWIPETE_FEN, kiwipeteWhiteIndices, kiwipeteBlackIndices)
|
||||
|
||||
var
|
||||
rng = initRand(90210)
|
||||
moveFlags: set[MoveFlag]
|
||||
for fen in [
|
||||
"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
|
||||
"r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1",
|
||||
STARTPOS_FEN,
|
||||
KIWIPETE_FEN,
|
||||
"r3k2r/8/8/8/8/8/8/R3K2R w KQkq - 0 1",
|
||||
"4k3/8/8/3pP3/8/8/8/4K3 w - d6 0 1",
|
||||
"4k3/8/8/8/3Pp3/8/8/4K3 b - d3 0 1",
|
||||
@@ -161,4 +223,5 @@ for flag in [Normal, DoublePush, Capture, EnPassant, ShortCastling, LongCastling
|
||||
CapturePromotionQueen, CapturePromotionRook, CapturePromotionBishop, CapturePromotionKnight]:
|
||||
doAssert flag in moveFlags, &"missing move coverage: {flag}"
|
||||
|
||||
echo &"Threat collection: {attackChecks} attack-square checks; {collectionChecks} full collector comparisons"
|
||||
echo &"Threat collection: {attackChecks} attack-square checks; {collectionChecks} full collector comparisons; " &
|
||||
&"{knownIndexChecks} known index comparisons"
|
||||
@@ -1,3 +1,19 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
"""UCI regressions. Build first with make dev; override the binary with HEIMDALL."""
|
||||
|
||||
import os
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
# Copyright 2026 Mattia Giambirtone & All Contributors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Authored with assistance from AI agents.
|
||||
|
||||
import std/[os, syncio, tempfiles, unittest]
|
||||
|
||||
import heimdall/[movegen, moves, pieces, position]
|
||||
|
||||
Reference in new issue
Block a user