module

Experion::Nnue

Constants

EMBEDDED_NET = {{ read_file("/tmp/tmp.cKHhmP/src/src/experion/../../nets/experion.bin") }}

Net compiled into the binary so a release executable is self-contained.

FEATURES_PER_BUCKET = 1536
KBMAP5 = StaticArray[0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]

Class methods

acc_row
Source
apply_delta(dst : Pointer(Int32), src : Pointer(Int32), rmw1 : Int32, rmb1 : Int32, rmw2 : Int32, rmb2 : Int32, addw1 : Int32, addb1 : Int32, addw2 : Int32, addb2 : Int32, rm_count : Int32, add_count : Int32) : Nil

dst = src adjusted by removals then additions. Indices are per perspective: (w, b) pairs; counts select how many of the two slots apply.

Source
blend

0 = pure classical, 100 = pure NNUE

Source
ctx_for(pos : Position, pov : Int) : Int32

ENN5 per-perspective context: king bucket | mirror<<8. The perspective's own king square is taken from that side's POV (black flipped vertically); kings on files e-h mirror every square horizontally. Bucket context for one perspective: ENN5 packs bucket|mirror, older formats use the plain file-half bucket.

Source
enabled?
Source
evaluate(row : Pointer(Int32), phase : Int32, stm_white : Bool, npieces : Int32 = 32) : Int32

Evaluate from an accumulator row. Returns cp from the POV OF WHITE scaled to centipawns (stm flip applied by caller like classical eval).

Source
evaluate_pos(row : Pointer(Int32), pos : Position) : Int32

Full evaluation from the incremental row plus, for ENN5, the learned material lane. Returns cp from the side to move's POV.

Source
king_bucket(sq : Int) : Int32
Source
king_buckets

Queenside (a-d) vs kingside (e-h) king bucket. Depends only on file, so it is unaffected by the rank-mirroring used for POV1 squares. MUST match tools/nnue_train.py's king_bucket exactly — this is the mapping from square to bucket index, not just the bucket count (which is read from the file header and doesn't need to match code on this side).

Source
king_ctx(king_sq : Int, pov : Int) : Int32
Source
load(path : String) : Bool
Source
load_data(data : String) : Bool
Source
load_embedded
Source
refresh(row : Pointer(Int32), pos : Position) : Nil

Rebuild an accumulator row from scratch (used at root and after any king move, since a moving king changes that perspective's bucket for EVERY feature, not just its own).

Source
refresh_half(row : Pointer(Int32), pos : Position, pov : Int) : Nil

ENN5: rebuild a single perspective's half of the row (bias folded in).

Source
refresh_half_cached(cache : Cache, row : Pointer(Int32), pos : Position, pov : Int) : Nil
Source
set_blend(pct : Int32) : Nil
Source
set_option(on : Bool) : Nil
Source
w1_ptr
Source

Instance methods

feature_index(pc : Int, sq : Int, pov : Int, bucket : Int) : Int32
Source

Nested types