Skip to content

Test structured root-buffer operations against the host view size - #4

Draft
MichaelSmithAI wants to merge 3 commits into
test/world-structured-root-viewsfrom
test/world-bounded-structured-root
Draft

MichaelSmithAI wants to merge 3 commits into
test/world-structured-root-viewsfrom
test/world-bounded-structured-root

Conversation

@MichaelSmithAI

@MichaelSmithAI MichaelSmithAI commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

This tester branch combines the structured root SRV/UAV lowering from #709 with the host-side view sizes from #650. The base is the published structured-root comparison at 879ecc8. The production changes are pinned at 66ac451; the additional commit on this PR is test-only. Both include the same spill-table and root-UAV prerequisites.

A matched offline report on four world compute programs found that the spill-aware translator reaches the root-UAV/typed-view refusal. The five opening-cutscene pipelines reported in Marvisak#709 were measured on a different stack. We have no per-program evidence that these populations overlap.

The synthetic GPU test allocates eight dwords and uses a structured root UAV with stride eight. With a 24-byte logical view it stores, atomically updates, and loads the expected values. At 20 bytes the atomic update remains visible. At 16 bytes all eight dwords remain zero. Each case checks the entire physical allocation. The low-level shader harness supplies the logical size directly. A second test exercises the ordinary State::dispatch path with the root address eight bytes into a registered buffer. The runtime computes the remaining 24, 20, or 16 bytes. All three guest readbacks matched, including prefix sentinels and a check that the backing padding was untouched. Two independent controls deliberately report the wrong start or the wrong size within the allocated storage. The test caught both errors.

To run the fixture on a supported Windows device:

cargo test --locked -p victory-shader --lib structured_access_through_a_root_uav_reaches_index_times_stride -- --nocapture --test-threads=1
cargo test --locked -p victory-gpu --lib dispatch_binds_the_remaining_bytes_of_an_interior_structured_root_uav -- --nocapture --test-threads=1

The fixture passed on an RTX 4090 under Wine 11.22 and vkd3d-proton 3.1, including an independent replay. DXVK routed the WARP request to the same adapter. A fresh Linux build passed 69 shader tests, the Windows diagnostics CLI and GPU/shader test targets type-checked, and the asset policy passed. Title dispatch results, depth/lighting changes, and visible world rendering remain unmeasured.

The source histories retain the original authors of Marvisak#294, Marvisak#650, and Marvisak#709. Integration and validation were AI-assisted.

wbkepler and others added 3 commits November 24, 2026 07:11
A root SRV or CBV has no bounds on the host: a shader access past the
memory the host mapped there is a GPU page fault. The console's buffer
views of the same memory have record counts, and the offsets come from
title data the host may not have mirrored (zeros, stale memory), so such
accesses happen. Some hosts' GPUs stall on the fault until the driver
resets the device as hung: a mesh dispatch of a program that reads its
vertex streams through a root view with a formatted load hangs an
RTX 5090 and the device is removed.

The host now passes each root view's byte size in the user-data dword of
its address (which the shader never reads, the view being bound as a root
argument), and every raw, formatted and constant access through a root
view checks the bytes it touches against it: reads past it give 0, writes
are dropped, as for a console view past its records.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	crates/victory-gpu/src/draw.rs
#	crates/victory-shader/src/emit/lower.rs
#	crates/victory-shader/src/emit/valu_tests.rs
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.

3 participants