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

new backend interface prototype #2092

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

borg323
Copy link
Member

@borg323 borg323 commented Dec 16, 2024

This is a prototype for the new backend interface, that doesn't have any dependence on the position encoding. For now only the search-cache interface is changed, the cache-backend interface is still the old one. The main changes to the interface are:

 // Check if entry is in the cache.
  bool CacheLookup(const PositionHistory& history, const MoveList& moves = {},
                   CachedNNRequest* entry = nullptr);
  // Adds a sample to the batch. Also calls EncodePositionForNN() if needed.
  void AddInput(const PositionHistory& history, const MoveList& moves);

The other change is that GetPVal() returns directly the 16 bit compressed float we used, now formalized to pfloat16:

// Returns compressed P value @move_id of @sample.
pfloat16 GetPVal(int sample, int move_ct) const;

// TODO(mooskagh) Don't really need index if using perfect hash.
SmallArray<IdxAndProb> p;
// Store p only for valid moves.
std::vector<pfloat16> p;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe still SmallArray to save 14 bytes per entry?

@borg323 borg323 marked this pull request as draft December 24, 2024 13:56
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.

2 participants