Skip to content

Fix wide shader accesses across title-memory pages - #846

Open
gomeaw wants to merge 1 commit into
fxceless:mainfrom
gomeaw:fix/shader-title-memory-boundaries
Open

gomeaw wants to merge 1 commit into
fxceless:mainfrom
gomeaw:fix/shader-title-memory-boundaries

Conversation

@gomeaw

@gomeaw gomeaw commented Nov 25, 2026 •

Copy link
Copy Markdown

Problem

The page directory maps each 64 KiB guest page to a host buffer view and byte offset. Wide global_load_dwordxN, global_store_dwordxN, and s_load_dwordxN instructions lowered through that directory previously resolved only the starting page. When a transfer straddles a boundary, it can pick up unrelated bytes from the first backing buffer or overwrite them. This path is used by compute shaders including the ray-tracing structure builder.

Change

Keep one vector access for each group of up to four dwords that fits in a page. For a straddling group, resolve the next page with the 64-bit address carry and use the appropriate backing view, byte offset, and fault handling for each portion. Root-descriptor loads and the ray-box node reader have their own lowering.

Verification

  • All 61 synthetic D3D12 WARP cases passed across global loads, global stores, and scalar loads. They cover same-page transfers, all split positions, separate backing views with nonzero byte offsets, a boundary at 4 GiB, and an unmapped second page. With the original lowering, both crossing loads returned [17, 17] where [17, 34] was expected, and a crossing store overwrote an unrelated dword beyond the first guest page. Windows WARP comparison
  • An independent RTX 2080 Ti run passed all 61 synthetic cases on physical hardware. Reverting only the shader lowering made all three test families fail. RTX 2080 Ti test report
  • The shader crate passed Windows-target Clippy with all targets and features. Native shader, formats, and xtask tests passed, along with the asset-policy check.
  • Windows workspace checks hit two existing GPU lints and a depth-bounds assertion in a test that compiles its shaders directly from HLSL. Workspace logs

The WARP fixture lives on the fork's validation branch and reuses fixture support from #33. That PR exercises ray-box node reads. This patch addresses the general memory instructions and applies alongside #33. In-game visual impact and hardware timing remain unmeasured.

Resolve the second backing view only when a raw access crosses a 64 KiB page. Use the directory offset and fault reporting for each page, preserving a single vector access for the same-page case.
Testaross added a commit to Testaross/victory-fork that referenced this pull request Nov 25, 2026
@Rezwo

Rezwo commented Nov 25, 2026

Copy link
Copy Markdown

Independent Turing hardware reproduction: NVIDIA GeForce RTX 2080 Ti, Windows driver 32.0.16.2101.

I used your validation/shader-title-memory-boundaries branch at 81746e9, including its fixture support from #33. This is not a test of the production-only PR checkout. The PR head is still df399bd.

Local harness changes: Host::new(true) became Host::new(false), with initialization required (no skip); added actual adapter name/flags and per-case logging. The inputs and assertions were unchanged. Logs identified NVIDIA GeForce RTX 2080 Ti, flags=0.

Command:
cargo test --locked -p victory-shader --lib wide_title_memory_ -- --nocapture

Results:

  • Patched WARP fixture: 3 test families passed, exit 0.
  • Patched hardware: all 61 cases across global loads, global stores and scalar loads passed; 3 test families passed, exit 0.
  • Negative control: replaced only lower.rs with the original 9376fd6 version, keeping the hardware harness and test inputs. All three test families failed, exit 101.
  • Restored patched lower.rs: all 61 cases passed again, exit 0.

The original global and scalar x2 crossing loads returned [17, 17] instead of [17, 34]. The original store changed an unrelated word after the first mapped page:
actual [17, 17, 17, 20, 21, 17, 17, 17]
expected [17, 17, 17, 20, 17, 17, 17, 17]

The passing cases include the low-address carry at 4 GiB, independent backing views with byte offsets, all tested split positions, and the missing-second-page checks. Separately executed the local rollback script on a copy and verified byte-for-byte restoration of the original lowering.

No game files or in-game runs. This confirms the synthetic memory corruption and its correction on Turing, not a measured lighting/stability improvement in the title.

AI-assisted (OpenAI Codex); tests executed locally.

@MamaLeVrai

Copy link
Copy Markdown

Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head df399bd into main f85101b in a throwaway tree (no conflict). cargo clippy --workspace --all-targets --locked -- -D warnings fails with exactly the errors main itself has on this machine (placed_filler_twins, depth_written, a sort; PR #841 fixes them), also with --all-features; this PR adds none. cargo test --workspace --locked: run 1: 555 passed, 0 failed, 11 ignored; run 2: 555 passed, 0 failed, 11 ignored (main alone: 555 passed, 0 failed, 11 ignored). The title was not run, so this says nothing about in-game effect. No game data.

AI-assisted (Claude Code); no game data.

KomanderDG88 added a commit to KomanderDG88/VIniVIdiVIci that referenced this pull request Nov 25, 2026
…le-memory page

a_waterfall_loop_serves_helper_lanes_in_its_first_pass: a GFX10 pixel program
whose waterfall loop over v_readfirstlane_b32 must serve the helper lanes of
partly covered quads (each covered pixel reads its quad neighbour's result
through DPP). Bounded to 64 passes, so without the helper-lane fix it fails
instead of hanging. Hardware and WARP; needs VICTORY_PC_DXC for its vertex
shader.

paired_lanes_split_a_wide_title_memory_load_at_the_page_boundary: a wave64
program of 64 threads in the paired form (fxceless#854) with a global_load_dwordx2
across a 64 KiB page (fxceless#846), checked on all 64 lanes of both halves, plus a
wave OR in a per-lane branch that only the paired form gets right: with the
paired form off the test must see it go wrong. Hardware only (WARP refuses
WaveSize(32)).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown

Linux hardware validation of df399bd99828cf41ea2bb38390d0c881fbfad2ac: all 61 synthetic cases pass on CachyOS / RTX 5090 / NVIDIA 620.73.04, using GE-Proton 11-14 Wine, DXC/DXIL 1.9.2609 and a Windows MSVC cross-build. I used gomeaw's three-family fixture from 81746e95de79ac1344f6f763c3407dd6be8f390e, with hardware adapter selection instead of forced WARP (the logs confirm the RTX 5090).

Coverage: 13 global-load, 13 global-store and 35 scalar-load cases, including independent biased mappings, aligned split positions, 4 GiB carry, missing-page values/faults and store canaries. Negative control: retaining the tests but restoring the previous lowering makes all three families fail at the first crossing x2 case. Loads return [17,17] instead of [17,34]; the store overwrites the first buffer's canary. Fixed source restored afterward. Windows build, all-target/all-feature Clippy and asset policy pass.

Integrated with author credits in LinVictory abdae98. This verifies the transfer correction on Linux hardware; it does not establish a gameplay fix. A separate normal-rendering title trial still hit an NVIDIA Xid 13/MMU fault after approximately 127 seconds, without verified scene geometry. That branch contains other Linux fixes, so the title result is not an isolated causal comparison. No game-derived fixtures, logs or shaders are included.

PiloteCode added a commit to PiloteCode/victory-fork that referenced this pull request Nov 25, 2026
…celess#24/fxceless#104), null CBVs (fxceless#304), tables at list cuts (fxceless#742), heap entries (fxceless#589), barriers (fxceless#787), depth-stencil UAV barriers (fxceless#214), windows ending at recorded writes (fxceless#663), sRGB views (fxceless#644), wide accesses across pages (fxceless#846), view-guard costs (fxceless#812/fxceless#853), the fill latch (fxceless#860), pipeline waits (fxceless#709), robustness; opt-in fxceless#868/fxceless#845
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.

4 participants