Preserve partial overlaps with CPU-written report words #442

Merged
klimovich008 merged 1 commit from codex/protect-partial-report-writeback into main 2026-11-08 16:49:22 +00:00
klimovich008 commented 2026-11-08 02:01:51 +00:00 (Migrated from github.com)

What this fixes

Mirrored GPU writes can overwrite a newer CPU-written timestamp or query result when the copied range starts halfway through its 8-byte report word.

Why merge

  • One-line change. Start the ownership lookup at the containing report word so partial overlaps are excluded too.
  • Preserve every nonowned byte, including prefixes and suffixes around protected words.
  • Keep the existing write-back path, defaults and RX_VK_WB_REPORTS override unchanged.

Change

gpu/vk/vk_memory.cpp: use cpu_words.lower_bound((p.lo + at) & ~7ull) when cutting protected ranges.
tests/test_report_words.py: check the actual helper against expected bytes for partial starts, partial ends, adjacent words and all 4-byte-aligned ranges in the fixture.

Tested

  • python -I -B tests/test_report_words.py --cxx clang++ checks protected and nonowned bytes. Fails on the old code, passes now.
  • Matching Windows host and renderer build successfully.
  • RX 9070 XT, Windows: 182-second headless Kokiri smoke test, zero VUIDs. No game data is included.

Not covered

  • Tested on AMD only. The game run is a smoke check; the CPU regression reproduces the partial-overlap failure.
  • A partial overlap was not captured in the game run; no visual flicker fix is claimed.
## What this fixes Mirrored GPU writes can overwrite a newer CPU-written timestamp or query result when the copied range starts halfway through its 8-byte report word. ## Why merge - One-line change. Start the ownership lookup at the containing report word so partial overlaps are excluded too. - Preserve every nonowned byte, including prefixes and suffixes around protected words. - Keep the existing write-back path, defaults and `RX_VK_WB_REPORTS` override unchanged. ## Change `gpu/vk/vk_memory.cpp`: use `cpu_words.lower_bound((p.lo + at) & ~7ull)` when cutting protected ranges. `tests/test_report_words.py`: check the actual helper against expected bytes for partial starts, partial ends, adjacent words and all 4-byte-aligned ranges in the fixture. ## Tested - `python -I -B tests/test_report_words.py --cxx clang++` checks protected and nonowned bytes. Fails on the old code, passes now. - Matching Windows host and renderer build successfully. - RX 9070 XT, Windows: 182-second headless Kokiri smoke test, zero VUIDs. No game data is included. ## Not covered - Tested on AMD only. The game run is a smoke check; the CPU regression reproduces the partial-overlap failure. - A partial overlap was not captured in the game run; no visual flicker fix is claimed.
Commenting is not possible because the repository is archived.
No description provided.