Here are some tips to help using cpu-affinity with hybrid CPUs. Hybrid CPUs have 2 types of cores, big or performance cores with small or efficiency cores.
ARM CPUs have used hybrid CPUs for several years, Intel since Alderlake and now AMD with Zen5.
The first thing is to identify which cores are which. This can be achieved by adding "--hash-meter" option which will display a hashrate for each CPU core.
The different hashrates easily identify the performance vs efficiency cores. This is simple for ARM & AMD but a little more complicated for Intel. Intel hybrid CPUs
only have SMT (hyperthreading) on the performance cores so it would be comparing hyperthreaded P-cores with non hyperthreaded E-cores. This is not
a valid comparison and could show misleading results.
For Intel CPUs hyperthreading can be disabled in the BIOS but that is drastic just for testing. Instead, a single thread can be run affined to each core in turn to
get a reliable comparison not affected by hyperthreading. In the end the best performance may be had on some algos by running only one thread on the P-cores
avoiding hyperthreading, while running a thread on all the E-cores which don't support hyperthreading. This will require a more complicated affinity mask than
would typically be used on Ryzen, ARM or non-hybrid Intel CPUs.
Since Ryzen supports hyperthreading on both P & E cores, and ARM doesn't support hyperthreading at all a simple test with all threads running will quickly identify
which cores are which type. It is less likely to require changing the affinity mask strategy on these CPUs so it's mostly just for informational purposes.
Here's sample output from an Orange Pi 5 Plus clearly showing a hybrid CPU with 2 very distinct performance levels representing the different core types:
[2024-06-30 00:31:57] Thread 0, CPU 0: 26.05 h/s
[2024-06-30 00:31:57] Thread 3, CPU 3: 25.09 h/s
[2024-06-30 00:31:57] Thread 1, CPU 1: 24.14 h/s
[2024-06-30 00:31:57] Thread 2, CPU 2: 23.97 h/s
[2024-06-30 00:31:59] Thread 4, CPU 4: 89.12 h/s
[2024-06-30 00:31:59] Thread 5, CPU 5: 86.82 h/s
[2024-06-30 00:31:59] Thread 6, CPU 6: 88.70 h/s
[2024-06-30 00:31:59] Thread 7, CPU 7: 87.18 h/s
Unfortunately I don't have a sample from an Intel hybrid CPU which would more useful in illustrating its more complicated architecture.