Size thread pools by the CPUs of the process's affinity mask

Eight places sized a pool (pipeline workers, library prebuild, translator prewarm and seeding, the multithreaded ASTC decoder) by GetActiveProcessorCount, every logical processor of the machine. A process limited with start /affinity, Task Manager or a launcher then started a pool for 16 CPUs on 4. plat_cpu_usable counts the affinity mask (all active processors for a process that spans processor groups); plat_cpu_count, the machine's count, stays for the system info. Idea from MMadmer's UsableCpuCount in a fork of the Shadow of the Colossus PC port.
This commit is contained in:
Lucas-blip-png committed 2026-10-31 04:51:14 -04:00
1 parent adf9c768c3
commit 91c5312932
6 files changed
+24 -9

No files matched your search

+1 -1
View File
@@ -416,7 +416,7 @@ static void test_cores(Cpu *c) {
for (int i = 0; i < CORE_WORKERS; i++) join(c, h[i]);
int now, held_max;
kern_core_stats(&now, &held_max);
DWORD cpus = GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
DWORD cpus = plat_cpu_usable();
int gate = !cfg_bool("TOTK_FREE_CORES"); // the kernel's own switch
int ok = g_run_max <= 3 && held_max <= 3 && !g_core_clash && (cpus < 4 || g_run_max == 3);
printf("virtual cores: %d threads x %d runs on %lu host CPUs: at most %ld running guest code at once, at most %d "