perf(vk): the capture's streaming-store copy opt-in (RX_VK_CAPTURE_NT=1): more stutters, no gain measured #1841

Merged
NotRexed merged 2 commits from fix/capture-nt-opt-in into main 2026-11-10 19:57:44 +00:00
NotRexed commented 2026-11-10 17:56:19 +00:00 (Migrated from github.com)

#1619 (merged) made the memory capture copy pages with non-temporal stores by default. On this machine it neither shortened the capture nor smoothed the frame, and it added stutter.

Measured

One build (main + #1619), RTX desktop, 2560x1440 docked, the field smoothness walk. Four runs interleaved (off, on, off, on):

Run Median p99 1% low Stutters Capture taken a submit
off 1 49 fps 58.5 ms 9.2 fps 3.08% 0.400 ms
on 1 50 fps 61.9 ms 9.1 fps 3.43% 0.410 ms
off 2 50 fps 54.7 ms 9.6 fps 2.89% 0.413 ms
on 2 49 fps 65.8 ms 8.2 fps 4.22% 0.436 ms

Both 'on' runs are worse than both 'off' runs in stutters, p99 and 1% low. The capture time per submit doesn't drop.

Change

capture_nt() defaults to off; RX_VK_CAPTURE_NT=1 turns it on. The copy and tests/test_capture_copy_nt.py stay (it passes, SSE2 and AVX2), so a CPU where it helps can still use it. The comment records the numbers.

🤖 Generated with Claude Code

#1619 (merged) made the memory capture copy pages with non-temporal stores by default. On this machine it neither shortened the capture nor smoothed the frame, and it added stutter. ## Measured One build (main + #1619), RTX desktop, 2560x1440 docked, the field smoothness walk. Four runs interleaved (off, on, off, on): | Run | Median | p99 | 1% low | Stutters | Capture taken a submit | |---|---|---|---|---|---| | off 1 | 49 fps | 58.5 ms | 9.2 fps | 3.08% | 0.400 ms | | **on 1** | 50 fps | 61.9 ms | 9.1 fps | **3.43%** | 0.410 ms | | off 2 | 50 fps | 54.7 ms | 9.6 fps | 2.89% | 0.413 ms | | **on 2** | 49 fps | 65.8 ms | 8.2 fps | **4.22%** | 0.436 ms | Both 'on' runs are worse than both 'off' runs in stutters, p99 and 1% low. The capture time per submit doesn't drop. ## Change `capture_nt()` defaults to off; `RX_VK_CAPTURE_NT=1` turns it on. The copy and `tests/test_capture_copy_nt.py` stay (it passes, SSE2 and AVX2), so a CPU where it helps can still use it. The comment records the numbers. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
hckrman101 (Migrated from github.com) approved these changes 2026-11-10 18:12:23 +00:00
hckrman101 (Migrated from github.com) left a comment

Looks good. The flip is right: unset or 0 gives plain memcpy, any non-zero integer turns the streaming copy on, and copy_fence() already keys off capture_nt(), so the off path doesn't pay for an sfence either. The four interleaved runs are a reasonable basis for making it opt-in, and keeping copy_nt and tests/test_capture_copy_nt.py (its capture_nt() ? copy_nt : std::memcpy check still matches) means it stays tested for anyone who sets the variable.

No conflict with #1375 (merged today): its copy_split/copy_part changes sit below this in vk_memory.cpp and GitHub reports the branch as mergeable. The env var isn't documented anywhere outside this comment block, so there are no docs to update.

CI: the finished jobs (Windows Vulkan back end, appimage, F2I lowering) pass; the Python checks were still pending when I looked.

Looks good. The flip is right: unset or `0` gives plain memcpy, any non-zero integer turns the streaming copy on, and `copy_fence()` already keys off `capture_nt()`, so the off path doesn't pay for an sfence either. The four interleaved runs are a reasonable basis for making it opt-in, and keeping copy_nt and `tests/test_capture_copy_nt.py` (its `capture_nt() ? copy_nt : std::memcpy` check still matches) means it stays tested for anyone who sets the variable. No conflict with #1375 (merged today): its copy_split/copy_part changes sit below this in vk_memory.cpp and GitHub reports the branch as mergeable. The env var isn't documented anywhere outside this comment block, so there are no docs to update. CI: the finished jobs (Windows Vulkan back end, appimage, F2I lowering) pass; the Python checks were still pending when I looked.
hckrman101 (Migrated from github.com) commented 2026-11-10 18:12:23 +00:00

Nit: atoi means RX_VK_CAPTURE_NT=true or =yes quietly stays off. That's the same parsing the other RX_VK_* switches use, so it's fine as is. The comment above says =1, which is what people will copy.

Nit: `atoi` means `RX_VK_CAPTURE_NT=true` or `=yes` quietly stays off. That's the same parsing the other RX_VK_* switches use, so it's fine as is. The comment above says `=1`, which is what people will copy.
hckrman101 commented 2026-11-10 18:21:29 +00:00 (Migrated from github.com)

Can you sync with @itaskaev2 and figure out proper solution

Can you sync with @itaskaev2 and figure out proper solution
Commenting is not possible because the repository is archived.
No description provided.