runtime: release the virtual core during GPU invalidation #485

Merged
monsterlag merged 4 commits from fix/release-vcore-for-invalidate into main 2026-11-08 16:49:22 +00:00
monsterlag commented 2026-11-08 05:34:45 +00:00 (Migrated from github.com)

Mapped-range invalidation can wait for replay or GPU write-back while its guest thread still owns an emulated CPU core. Other guest threads eligible for that core cannot run during the wait, violating the runtime's existing blocking-call contract.

Release the caller's core around the invalidate callback and reacquire it only if that call released one, after the renderer returns and its locks unwind. Backend arguments and callback counts are preserved, following the existing sync-wait, queue-finish and virtual-map-change patterns.

Validation:

  • A game-free fixture compiles the actual wrapper, native hos_vcore_away/back functions and renderer API header. Nine cases cover a queued producer, both backends, immediate returns, zero arguments, already-suspended/non-guest callers, disabled vcores, balanced ownership and reacquisition after renderer-lock release.
  • The original wrapper fails the no-core-at-callback invariant and independently prevents bounded producer progress. Fixed cases pass with Windows llvm-mingw Clang and MSVC, and Linux WSL GCC, with fixture warnings treated as errors.
  • The complete Windows translation unit compiled using production warnings. A separate strict check reports the same five unchanged partial early_call initializers in both baseline and fix.
  • Normal merges retain latest honest-eta (a598b9f) and the shared #488 fixture repair. At d462a10, the actual nine-case fixture passes again with Windows llvm-mingw Clang and Linux WSL GCC. The released, unpatched wrapper independently fails the bounded producer-progress assertion. The current renderer API header and queue callback are preserved; whitespace checks pass. All four hosted checks also pass at this refreshed head: Windows and Linux source checks, SPIR-V lowering, and AppImage packaging.

No full game/live GPU check is claimed for this PR. The synthetic producer establishes the scheduling contract; it does not reproduce a particular Vulkan dependency cycle or prove the cause of the separately observed portrait/fullscreen slowdown.

Mapped-range invalidation can wait for replay or GPU write-back while its guest thread still owns an emulated CPU core. Other guest threads eligible for that core cannot run during the wait, violating the runtime's existing blocking-call contract. Release the caller's core around the invalidate callback and reacquire it only if that call released one, after the renderer returns and its locks unwind. Backend arguments and callback counts are preserved, following the existing sync-wait, queue-finish and virtual-map-change patterns. Validation: - A game-free fixture compiles the actual wrapper, native `hos_vcore_away/back` functions and renderer API header. Nine cases cover a queued producer, both backends, immediate returns, zero arguments, already-suspended/non-guest callers, disabled vcores, balanced ownership and reacquisition after renderer-lock release. - The original wrapper fails the no-core-at-callback invariant and independently prevents bounded producer progress. Fixed cases pass with Windows llvm-mingw Clang and MSVC, and Linux WSL GCC, with fixture warnings treated as errors. - The complete Windows translation unit compiled using production warnings. A separate strict check reports the same five unchanged partial `early_call` initializers in both baseline and fix. - Normal merges retain latest `honest-eta` (`a598b9f`) and the shared #488 fixture repair. At `d462a10`, the actual nine-case fixture passes again with Windows llvm-mingw Clang and Linux WSL GCC. The released, unpatched wrapper independently fails the bounded producer-progress assertion. The current renderer API header and queue callback are preserved; whitespace checks pass. All four hosted checks also pass at this refreshed head: Windows and Linux source checks, SPIR-V lowering, and AppImage packaging. No full game/live GPU check is claimed for this PR. The synthetic producer establishes the scheduling contract; it does not reproduce a particular Vulkan dependency cycle or prove the cause of the separately observed portrait/fullscreen slowdown.
Commenting is not possible because the repository is archived.
No description provided.