Skip to content

platform/win: Keep all logical processors on hybrid CPUs and elevate critical thread priorities (Fixes #639) - #650

Open
jfpaardoo wants to merge 1 commit into
Revivedx:testfrom
jfpaardoo:perf/hybrid-cpu-scheduling
Open

jfpaardoo wants to merge 1 commit into
Revivedx:testfrom
jfpaardoo:perf/hybrid-cpu-scheduling

Conversation

@jfpaardoo

Copy link
Copy Markdown
Contributor

What this changes

Fixes #639.

On Windows, plat_cpu_placement() enabled one logical processor per physical core by default for systems with SMT and 4+ physical cores (plat_one_per_core_default). On heterogeneous/hybrid architectures (Intel 12th/13th/14th Gen, Core Ultra, and AMD hybrid architectures with P-cores and E-cores), this truncated the process affinity mask by masking out the second SMT thread on every P-core while keeping all E-cores intact (e.g. an 8-core / 12-thread i5-12450H had threads 1, 3, 5, 7 disabled, leaving only 4 P-threads and 4 E-threads).

Because Savage Wind runs multiple active threads (guest main thread, job workers, audio, file streaming, NVN queue/render thread, Vulkan recorder, present thread, plus graphics driver submission/compiler threads), halving the available P-core execution slots starved the system and forced Windows Thread Director to spill latency-critical threads (the main game thread and render queue) onto low-clock, lower-IPC E-cores. When running on E-cores, frame rate plummeted from 60 FPS down to 40-45 FPS randomly until threads were migrated back.

This change:

  1. Detects hybrid architectures in plat_cpu_placement() by comparing EfficiencyClass across RelationProcessorCore records. When min_eff != max_eff, it keeps all logical processors enabled by default (while still allowing explicit override via SAVAGEWIND_ONE_PER_CORE=1).
  2. Introduces plat_thread_elevate(), setting THREAD_PRIORITY_ABOVE_NORMAL on Windows for the three critical path threads of frame generation: the guest main thread (KThread id == 1), the NVN render queue thread (queue_thread), and the Vulkan packet recorder thread (run). This ensures Windows Thread Director preferentially schedules the critical path on high-performance P-cores even during heavy bursts of worker activity (such as rune effects, teleporting, or asset streaming).

How it was tested

  • Build verification: make runtime-objs -j8 compiled with 0 warnings or errors under MSYS2 UCRT64 / Clang on Windows 11.
  • Subsystem test suite:
    • make test-pc-controls: PASS
    • make test-actions: PASS
    • python3 tools/i18n_check.py: PASS
    • git diff --check: PASS
  • Verified [cpu] logging on Windows outputs whether hybrid architecture is detected and confirms that all logical processors are retained when P/E cores are present.

Checklist

  • Based on the latest test and opened against test
  • Built and run locally, and checked in the game
  • No game files, keys, firmware, generated game code or save files in the changes

Copilot AI balanced review requested due to automatic review settings November 9, 2026 19:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

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