Skip to content

Conversation

@Menkib64
Copy link
Contributor

This reserves an unique cores for SearchWorker. Assumption is that a second thread on the same core would increase latency when SearchWorker has a deadline to supply more data to GPU. It uses lscpu because it looks like the easiest way to get information about NUMA and threads sharing a core. There is a basic fallback implementation because lscpu is an optional utility.

Windows support is missing. I had a quick look into Windows API. I couldn't immediately figure out correct way to do the same thread binding.

@Menkib64
Copy link
Contributor Author

Menkib64 commented Nov 12, 2025

meson configure on circleci Ubuntu fails to detect pthread_setaffinity_np. It does work when I test it locally. Search worker thread affinity settings require passing --threads=2 because I couldn't figure out a way to implement auto detection without creating backend threads. I try to figure out a solution how to change affinity for existing threads when we know thread number.

Good way to check thread affinities is to run

$ ./lc0 dag-preview -t 2
go

Another terminal: pgrep -wg $(pidof lc0) | xargs -n1 taskset -cp

@Menkib64
Copy link
Contributor Author

There is now windows code. I tested win 10 version but I couldn't test win 11 code paths. They are untested.

project('hwloc', 'c')

if not (host_machine.system() == 'windows' and host_machine.cpu_family() == 'x86_64')
error('This wrap of hwloc is a binary wrap for x64_64 Windows, and will not work on your system')
Copy link
Member

Choose a reason for hiding this comment

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

Returning a disabler object here will simplify the logic in the top level meson.build.

@Menkib64 Menkib64 marked this pull request as draft November 30, 2025 18:16
@Menkib64
Copy link
Contributor Author

Windows 11 returned an unknown error when setting thread affinity. I will have to figure out what caused the problem.

@Menkib64 Menkib64 marked this pull request as ready for review December 1, 2025 18:41
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