Repository navigation
Conversation
|
Overlaps #2461 (lhnizdo), the same port from victory-fork/ztrx, opened earlier today. #2461 conflicts with |
DrDarkDK
left a comment
There was a problem hiding this comment.
I ran a standalone D3D12 probe that explicitly selected the RTX 4070 Ti (driver 621.01, Windows 11 build 26300).
| Shader-visible CBV/SRV/UAV slots requested | CreateDescriptorHeap |
|---|---|
| 2,097,152 | E_INVALIDARG |
| 1,000,001 | E_INVALIDARG |
| 1,000,000 | S_OK |
For a large title heap on this layout, the dynamic range starts at 737_853. The direct texture heap clamp checks the physical limit, so a title index like 800_000 passes the clamp and can select a live dynamic descriptor. That index was still in the mirrored title range on the base.
Could direct title-heap accesses check the mirrored range separately from host-generated indices? A focused test could populate a dynamic slot and verify that a title-derived index with the same number resolves to a null view.
The probe confirms the heap size. I traced the descriptor overlap in the code and didn’t run the PR or the title.
AI-assisted with Codex.
|
@DrDarkDK Thanks, you're right. Moving the dynamic slots down to the title's end (
Tests: the new I didn't write the end-to-end test you suggested (fill a dynamic slot, read a title index with the same number). The shader test harness doesn't build the host's heap layout, so it would mean new harness work. The unit test checks the generated select and compare instead. In game (RTX 4070 SUPER, with #2464 on top so that the world draws): a 6-minute run with no device removal, no draws dropped for lack of dynamic slots, and the world draws at 0.6–1.7 fps. |
|
Reviewed: pulling |
|
First independent run, on Blackwell: RTX 5060 8 GB, driver 621.01, Windows 11, Rust 1.98.1. Base is
This PR merges cleanly onto Written with AI help (Claude Code); the numbers are from runs on my machine. |
|
RTX 4060 test (AI-assisted)
|
|
Thanks @alonso49noob and @Vedoxdev123 for the RTX 5060 and 4060 runs: the same 197/0 here. Agreed on |
|
Automated triage for the maintainers. Thanks. Noted: if #1777 lands first, you will rebase this as a follow-up that keeps only the full Generated by Claude Code |
…first shader On NVIDIA the shader-visible CBV/SRV/UAV heap holds at most 1,000,000 descriptors, while translated shaders clamp their heap indices below HEAP_VIEWS (2^21). Programs translated before the title made its heap, and any index past the host heap, read descriptors that do not exist. The host now probes the largest view heap it can make before the first translation and gives the translator that limit: indices at or past it go to a null slot the capped heap keeps, and the limit is part of the shader cache key. Raw-memory view pairs and dynamic slots keep their ranges. On this RTX 4070 SUPER, `cargo test -p victory-gpu` goes from 2 failures (`dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views`) to none. Ported from Zettrox/ztrx (commit 578d459), based on fxceless/victory-fork. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With 2^16 dynamic slots on NVIDIA's 1,000,000-view heap, draws were dropped for lack of dynamic slots in game (40 to 103 times a run). The title's slots now give way to the full 2^18; about 737,000 remain, above the highest title slot seen (about 720,000). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the null view The capped layout puts the host's dynamic slots right after the title's 737,853 (PORTABLE_TITLE_VIEWS). An index the title takes from the resource heap itself past them passed the clamp at the heap's end and could name a live dynamic descriptor. Such indices (every path from the heap) now read the general null view; table indices, which may name dynamic slots, keep the heap-wide clamp. The GPU layout asserts the title slot count shaders assume. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
46d530a to
e2cdafe
Compare
|
On the choice with #1777: whichever the maintainer prefers. If #1777 lands, I'll rebase this onto it as a follow-up carrying only what #1777 doesn't have: the full |
…locked merge plan
…r than zero-match portable filter
Problem
On NVIDIA the shader-visible CBV/SRV/UAV heap holds at most 1,000,000 descriptors, while translated shaders clamp their heap indices below
HEAP_VIEWS(2^21).mainalready rebuilds tables past the cap and falls back to fewer dynamic slots (3827767,3c81420,e8d3b64). The translator still lets a shader index anywhere belowHEAP_VIEWS, including programs translated before the title made its heap. On a capped heap those indices name descriptors that do not exist.On an RTX 4070 SUPER this is visible in
main's own tests.cargo test -p victory-gpufailsdynamic_slots_are_held_until_releasedandlists_share_a_table_and_copies_keep_their_views(NumDescriptors >= HEAP_VIEWS).Change
HEAP_VIEWSview heap (portable_view_heap). If it cannot, every heap uses the portable layout (PORTABLE_VIEWS,MIN_DYNAMICdynamic slots).emit::Options::view_heap_limit). Indices at or past it go to null views.view_layout), so a redirected index never reaches a live resource.PORTABLE_TITLE_VIEWS) reads the null view, so it never reaches the dynamic slots that follow them. Table indices keep the heap-wide clamp.maindrops to 2^16 there, which ran out in game). The title keeps about 737,000 slots, above the highest it was seen to use (about 720,000).HEAP_VIEWS, the layout matchesmain.Ported from Zettrox/ztrx (commit
578d459:probe_view_limit,set_view_heap_limit), which is based on fxceless/victory-fork. Both are GPL-3.0-or-later. Unlike the fork, the probe asks for the size actually used (HEAP_VIEWS, not 1,000,001), and the null slots are reserved on large heaps too.Tested
RTX 4070 SUPER, driver 32.0.16.1742, Windows 11 26300.
cargo test -p victory-gpu --locked: 197 passed, 0 failed (also at36ccd6e);mainfails the two tests above here. New tests cover the probe choosing the layout before translation, every requested heap size, and mirrored and dynamic slots ending before the null views.cargo test -p victory-shader --lib, with--skip heap_direct_texture_reads_mark_their_heap_index, which crashes the test process onmainhere too: 267 passed. 3 failed (stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride,a_heap_buffer_read_where_no_buffer_view_is_reads_zeros,synthetic_tests::gathers_at_a_level_match_the_hardware), as onmainwith NVIDIA.cargo clippy --workspace --all-targets --locked -- -D warnings, also with--all-features: clean.cargo xtask policy: ok.67e8ae1+ GPU: view addresses for tables made afresh (dynamic slots) #1906 + GPU: an acceleration structure's view address is its location #2098 + both PRs runs 6 min without a device removal and reaches the world.main+ GPU: view addresses for tables made afresh (dynamic slots) #1906 + GPU: an acceleration structure's view address is its location #2098 dies at 30 s on the format-115 target, which is the other PR's fix. With review fixes folded in (head11339f3), a second 6-minute run: no device removal,no host texture0, 141 compute pipelines refused (theWaveSize(64)programs of Shaders: emulate Wave64 compute shaders on Wave32 and narrower hosts #189). The world stays black at about 8 s a frame on this stack because it leaves out GPU+shader: back structured buffer views with raw descriptors for NVIDIA rawBufferLoad #2178 (structured views as raw), which no longer merges withmain. That run still dropped draws for lack of dynamic slots (40 times); with36ccd6e(the full dynamic range) a third 6-minute run dropped none, with no device removal.AI-assisted (Claude Code, with a review pass by Codex). Runs done on my machine.
🤖 Generated with Claude Code