looncraz
Senior member
- Sep 12, 2011
- 722
- 1,651
- 136
I found this:
Thread Ideal Processor
When you specify a thread ideal processor, the scheduler runs the thread on the specified processor when possible. Use the SetThreadIdealProcessor function to specify a preferred processor for a thread. This does not guarantee that the ideal processor will be chosen but provides a useful hint to the scheduler.
So, a game which is aware of Ryzen's special topology can influence Windows' scheduling behaviour without relying on an affinity mask. This is fortunate since the latter appears to be broken. The problem is that each and every game dev needs to think about and set this correctly.
I remain convinced that the scheduler itself is completely oblivious to SMT, NUMA, etc. Any illusion otherwise is given by the core-parking algorithm (which is at least SMT aware), and by affinity optimisations applied internally or externally to a given process. The documentation linked above talks a lot about applications needing to take responsibility for optimising their own affinity settings for topological considerations.
This wouldn't really help in any case for Ryzen, though. You need to set affinity to a CCX when more than one CCX is involved.
You can set 1111111100000000 for one group of related threads and 0000000011111111 for another group of related threads. Relations, in this case, are all about what memory is accessed most frequently.
CCX 0: Primary game loop thread, networking, sound processing
CCX 1: Graphics queue ordering/submission thread, player AI threads, building/object AI threads
The exact ideal distribution will depend on the game.