Skip to content

Linux GPU: read small title buffers through a guarded copy - #8

Draft
gmankab wants to merge 1 commit into
spidercraft:linux-native-runtimefrom
gmankab:contrib/native-guarded-host-copy
Draft

gmankab wants to merge 1 commit into
spidercraft:linux-native-runtimefrom
gmankab:contrib/native-guarded-host-copy

Conversation

@gmankab

@gmankab gmankab commented Nov 25, 2026 •

Copy link
Copy Markdown

Native GPU submission currently uses process_vm_writev to probe both ends of a host copy one page at a time. For repeated streaming-page reads that work can cost more than the copy and still leaves an interval in which the source can be unmapped.

VICTORY_COPY_PLAIN=1 lets native Linux copy disjoint ranges from 256 bytes through 1 MiB directly into host buffers. The existing signal handler recognizes faults at the copy instruction after giving write watching its normal chance to handle a fault. It returns to the caller's per-page fallback, which still zero-fills the unavailable pages. The size cap keeps large transfers on the existing native memmove path.

On the test PC, each synthetic sample copied 128 MiB, alternating the two paths. The median times across five timed samples were 22.63 ms versus 11.02 ms at 64 KiB and 11.41 ms versus 10.22 ms at 1 MiB. At 16 MiB, the existing path took 25.14 ms versus 31.61 ms with the guarded instruction. These measurements cover CPU copies between ordinary host buffers.

The protected-page regression passed with the option off and on against this PR’s base branch. All 14 native VM tests also passed. An integration build using the same patch also bound all title imports and reached the story loading sequence on the native Wayland and RADV backend. That run ended at its 170-second timeout with no GPU reset. Open-world performance still needs a paired run.

A longer run on the same RX 6800 reached a report with 2,841 draws per frame, then ended at about 171 seconds with D3D12 device removed (0x887a0005). The kernel logged an AMDGPU graphics-ring timeout and a successful ring reset. During its diagnostic dump it logged a failed PCIe read into the card’s BAR5 register range. The machine also recorded graphics resets and PCIe errors in an earlier native run before this patch. The latest result leaves the trigger and open-world performance unresolved.

Based-on: fxceless/victory-fork#1032
Tested-on: RX 6800, Xeon E5-2670 v3, Fedora Linux 45 x86_64
Assisted-by: gpt-6.2 sol xhigh

Native GPU submission probes every page at both ends of each host copy.
That makes repeated copies of streaming pages expensive and leaves a gap
between the probes and the actual read.

With VICTORY_COPY_PLAIN=1, copy disjoint ranges of 256 bytes to 1 MiB
straight into writable host buffers. Recover at the exact copy instruction
so the existing page fallback still restores the readable bytes around a
hole. Limit the size because the existing memmove path measured faster for
16 MiB copies. A native GPU-layer test exercises a protected source page
between two readable pages with the option enabled and disabled.

Based-on: fxceless/victory-fork#1032
Tested-on: RX 6800, Xeon E5-2670 v3, Fedora Linux 45 x86_64
Assisted-by: gpt-6.2 sol xhigh
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.

1 participant