Repository navigation
GPU: view addresses for tables made afresh (dynamic slots) - #1906
Conversation
|
Test report: RDNA4 on Linux (RADV/Proton). This fixes the world device loss I was hitting there too. Tested
Merging
Not tested
AI use
|
catminou4
left a comment
There was a problem hiding this comment.
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
View addresses for tables made afresh…: GPU table address fix. DRAFT — fine to iterate.
|
In-game on an RTX 5070 (Blackwell, 32-lane waves, view heap capped at 1,000,000): the removal this PR names is gone NVIDIA GeForce RTX 5070, driver 32.0.16.1714, Windows 11 26200, Ryzen 5 7600X. Before (V2 The table was rebuilt at slot 978,223, past the 934,464 title slots, in the dynamic slots the view addresses had no entry for. After (with this PR). Same scene, same build flags. There was no device removal in 8½ minutes; the cutscene plays on past the point where it used to stop. The run ended in an out-of-commit abort, What still keeps that scene from looking right, for whoever picks it up next. None of it is in this PR's scope:
Tests on the merged branch, |
|
Automated triage for the maintainers. Merge candidate. The buffer is now sized by New since the last review: the branch is rebased onto current CI: passing. Generated by Claude Code |
|
In-game on an RTX 3070 (Ampere) on Windows 10, merged onto current Setup: RTX 3070 8 GB (32-lane waves, view heap capped at 1,000,000), driver 621.14, Windows 10 22H2 (19045).
Without this PR and with nothing skipped, the same stack hung within about 3 minutes, and DRED stopped at the same The conflict with
With that, I'm testing with Claude's help, and Claude drafted this comment. |
|
In case it saves you the rebase triage asked for: both commits on RTX 5080, driver 620.73.04, Wine 11.22: It also merges cleanly with #1779's rebase, with a capped-heap test of both: https://github.com/astrosteveo/VIctory/tree/test/1779-1906. Not tested: Windows, the title. AI-assisted (Claude). |
c84cbaa to
bcd0d3d
Compare
|
Rebased onto current The only conflict was in
This is the same resolution as in the rebase offered above ( On the rebased head (RTX 3070): Thanks to everyone who tested this: RX 9060 XT (Linux), RTX 5070 and RTX 3070. |
bcd0d3d to
4c06e50
Compare
|
In-game on current
So on 13f91ca this PR still removes the A stop on Ampere. The next stop on this card is W. W takes 10.1-11.6 s per submission (21 submissions, average 11.3 s), and one eventually goes past the timeout. The AI-assisted (Claude Code); the runs are on my machine. |
|
Thanks, davesousa: that matches what I see on an RTX 3070, and the W stop has a likely fix that is not on W ( On my RTX 3070 (local test branch on
If you can, try this PR plus #1762 on your 3070 Ti; I would expect the W stop to go away as well. AI-assisted. |
|
Short status for whoever reviews this: the head In-game confirmations of the fixed stop (the indirect dispatch that read the view-address buffer past its end): RX 9060 XT on Linux (xstraok), RTX 5070 (mikoreal), RTX 3070 (walterwallaceson and mine) and RTX 3070 Ti (davesousa). The next stops reported after it (program W, and a 50-series barrier issue in #2024) are separate. Happy to rebase again if AI-assisted. |
|
Tested on an RTX 5070 Ti (Blackwell, driver 617.42, view heap capped at 1,000,000), retail 1.0.2.1, diag build with DRED, on
Details and the frame timings are in #1968. AI use: Claude Code (Claude Opus 5.5). |
GPU: view addresses for tables made afresh (dynamic slots) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upstream main merged Marvisak#2143, Marvisak#2162, Marvisak#158, Marvisak#1906 and Marvisak#1152 and took up what Marvisak#1769 (LDS bounds, Marvisak#1949) and Marvisak#1763 (typed UAV formats, Marvisak#2462) did; main's code is kept for those. - emit/lower.rs: ds_bpermute within each half (main's Marvisak#573, same as Marvisak#439's); LDS bounds as main's Marvisak#1949 (Marvisak#1769's test-only counter kept, its and_guard dropped); title-memory marks: main's straddling-write lookup (Marvisak#2484) with Marvisak#2167's current head (3cb308d, rebased on 63bcca4): guarded dirty atomics, raw_dword2, memory_null, synthetic_mark_dxil in lower/mark_tests.rs; the old Marvisak#2167 head taken out first. - emit/host.rs: main's shared WARP device and lock (Marvisak#244) with Marvisak#439's adapter list and Host::on (create_device takes an optional adapter). - descriptor/host.rs: main's Marvisak#2462 format checks; Marvisak#1763's tests kept. - gpu host.rs: main's multi-plane present with Marvisak#2310's crumbed copy. - pipeline.rs: Marvisak#2118/Marvisak#2311's builder and BVH checks with main's skip hashes (Marvisak#1320); draw.rs, shadow.rs, main.rs: both sides. - Tests main added since get Marvisak#439's Parts fields and emit's Target. - README: base 63bcca4; rows of PRs merged upstream, superseded or closed taken out, with a note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous renderer (old upstream base 940d32f) is the first parent and is also kept as the branch renderer-2026-11-25-oldbase; the second parent is the rebuild: fork main (upstream main 63bcca4 + our pull requests) with the renderer stack merged on it: Marvisak#439 (on main: update/439-main's resolution), Marvisak#2309, Marvisak#2167, Marvisak#2118, Marvisak#2311, Marvisak#1722, Marvisak#1751, Marvisak#688, Marvisak#1872, Marvisak#2292, Marvisak#2310, Marvisak#2112 (opt-in), Marvisak#2230 (latch on by default), Marvisak#2389, Marvisak#2088 (small windows opt-in), Marvisak#2099's new head, and tonight's Marvisak#491 journal fixes. Merged upstream since: Marvisak#2143, Marvisak#2162, Marvisak#158, Marvisak#1906, Marvisak#1152; superseded by main: Marvisak#1769, Marvisak#1763, Marvisak#2366. The picture on this base still shows the overlay that plain upstream main shows too; that is being looked into. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Could the combination tested on the 5070 Ti be published as one stacked branch? regiumlepidi's report above ( The problem is assembling it. So: would someone with both trees in front of them push a single branch with all four? Either I will run it here as soon as it exists: diag build, For completeness, the remaining failure on plain main + #1630 + #1832 + #1780 + #1906 here is the barrier mismatch in #2024 ( |
`view_stride` and `view_addresses` read the view-stride table and the view addresses, root SRVs with no bounds of their own, at a heap index taken from data, without clamping it as `heap_handle` and `buffer_guard` do. An index past the table read whatever memory follows it. Both now clamp the index to `HEAP_VIEWS` - 1 first (`clamp_view_index`, which `buffer_guard` now uses too). The host's view-address buffer had 16 bytes per title and dynamic slot only (`address_slots`), fewer than `HEAP_VIEWS` (about 1.2 million against 2^21 for this title), so even a clamped index could read past it. It now covers the larger of the two, as the view-stride table already does. The entries past the dynamic slots are cleared when it is made rather than left to the new allocation's contents, and nothing writes them after. Tests: a structured read through a heap descriptor clamps once more than a raw one (the stride lookup), and reading a descriptor's dwords 0 and 1 as data clamps twice. Without the clamps it fails (3 against 4). `view_addresses_cover_tables_made_afresh` (Marvisak#1906) now checks that the buffer reaches `HEAP_VIEWS`, that the entries past the dynamic slots read 0 up to the last and are not written, and that there is none past it. Clearing the tail was suggested by brainbudt in review; the conflict resolution with Marvisak#1906 and its test follow r4tedx's reference rebase. Co-Authored-By: r4. <192970269+r4tedx@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`view_stride` and `view_addresses` read the view-stride table and the view addresses, root SRVs with no bounds of their own, at a heap index taken from data, without clamping it as `heap_handle` and `buffer_guard` do. An index past the table read whatever memory follows it. Both now clamp the index to `HEAP_VIEWS` - 1 first (`clamp_view_index`, which `buffer_guard` now uses too). The host's view-address buffer had 16 bytes per title and dynamic slot only (`address_slots`), fewer than `HEAP_VIEWS` (about 1.2 million against 2^21 for this title), so even a clamped index could read past it. It now covers the larger of the two, as the view-stride table already does. The entries past the dynamic slots are cleared when it is made rather than left to the new allocation's contents, and nothing writes them after. Tests: a structured read through a heap descriptor clamps once more than a raw one (the stride lookup), and reading a descriptor's dwords 0 and 1 as data clamps twice. Without the clamps it fails (3 against 4). `view_addresses_cover_tables_made_afresh` (Marvisak#1906) now checks that the buffer reaches `HEAP_VIEWS`, that the entries past the dynamic slots read 0 up to the last and are not written, and that there is none past it. The new lowering test lives in `emit/lower/tests/descriptors.rs`, a child of `lower`'s tests: `lower.rs` is within a few KiB of the repository's 512 KiB limit on a file, and with the test it would pass it. Clearing the tail was suggested by brainbudt in review; the conflict resolution with Marvisak#1906 and its test follow r4tedx's reference rebase. Co-Authored-By: r4. <192970269+r4tedx@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem
On an RTX 3070 the host view heap is capped at 1,000,000 descriptors (
host view heap capped at 1000000 ... count=1245184), smaller than the title's. A table that reaches past the host heap is made afresh in the dynamic slots, and the shader gets that table's offset.A shader that reads a view's address as data (
HostHeap::view_addresses, e.g. the BVH builder's base) then indexes the view addresses at the fresh table's slots. That buffer had one entry per title slot only and is bound as a root view, which has no bounds. So the read went past the end of the buffer, and no address was ever entered for a dynamic slot.A per-command fence diagnostic (local, not part of this PR) names the command that never finishes. It is the same indirect compute dispatch, with the same argument address, in two runs (one on
main+ #1763, one onmainwith a local format workaround instead of #1763):The view-address buffer has 934,464 entries (1,000,000 minus 65,536 dynamic slots); the fresh table starts at slot 935,376.
Change
HostHeap::view_addresseshas one entry per title slot and per dynamic slot (address_slots()); the dynamic ones start empty.make_atthe view's address,make_nullzero, andraw_view_at/raw_pair_at(our root views and view pairs) zero, so no entry of an earlier table stays. A slot given back keeps its entry until it is made again; every fresh table makes all of its slots.note_addressignores an index past the buffer.State::bindcreates the view addresses before the stage's tables are made, so a table made afresh in the same bind enters its addresses.descriptor::host::tests::view_addresses_cover_tables_made_afresh. It covers a dynamic slot's entry before and aftermake_at, its neighbour, the last dynamic slot, a slot given back,make_null,raw_view_at,raw_pair_at, and a write past the end. With the test and its helperaddress_atapplied tomain, it fails (not made yet: left None, right Some(0)); it passes with the change. It coversHostHeaponly, not theState::bindpart.The buffer grows once by the dynamic slots (on this card from 934,464 to 1,000,000 entries, about 0.5 MB more).
Tested
Windows 11 (10.0.26200), RTX 3070 8 GB, driver 32.0.16.1088, Ryzen 7 7700, 32 GB. Title v1.0.2.1.
VICTORY_KEYSsends Enter every 5 s from 15 s to 100 s, then every 10 s to 170 s; the world starts about 90 s in.On this card
mainalone removes the device 12-14 s after start (B4G4R4A4 render targets and B5G5R5A1 typed UAVs, see #1753). All runs below therefore include #1763.Before (
main70564ae + #1763):VICTORY_D3D12_DEBUG=1,VICTORY_D3D12_DRED=1DXGI_ERROR_DEVICE_HUNGafter 161 sVICTORY_SHADER_LOOP_LIMIT=4096DXGI_ERROR_DEVICE_HUNGafter 118 sVICTORY_DIAG_FENCE_EACH=1DXGI_ERROR_DEVICE_HUNGafter 123 s (the log line above)After (
main70564ae + #1763 + this change):diagnostics, earlier revision of this change (without theraw_view_at/raw_pair_atentries)diagnostics, this PR's headBefore this change, removals on this card came 118-386 s in across several local bases, so 420 s runs are not a large margin; they are what I have.
cargo test -p victory-gpu: 77 passed, 2 failed, 1 ignored; with--features diagnostics80 passed, 2 failed, 1 ignored. The two failures (descriptor::host::tests::dynamic_slots_are_held_until_released,memory::tests::lists_share_a_table_and_copies_keep_their_views) fail the same way onmainon this card (NumDescriptors >= HEAP_VIEWS,past the dynamic slots).cargo clippy --workspace --all-targets -- -D warnings: clean.cargo xtask policy: 174 files ok.Not addressed
No game data is in this PR.
AI-assisted.