Repository navigation
GPU: give table slots without a view a null descriptor of the kind the shader reads - #568
BastienRodz wants to merge 6 commits into
Conversation
|
Local validation on Windows 11 with an AMD Radeon RX 6750 XT (driver 32.0.21045.29003), against PR head 0845e8d: Focused tests:
Full regression suites on the same head:
Integration check:
The synthetic tests verify typed-null descriptor creation and mirror transitions on an RX 6750 XT. They do not establish that #508's page fault is fixed or that the title fault reported in #533 disappears. Full logs: E:\GTA_6\LOGS\VIctory_pr568_rx6750_tests_2026-11-24.log and E:\GTA_6\LOGS\VIctory_pr568_release_preflight_2026-11-24.log. |
|
Check on Linux, not Windows: pass. Head
On: AMD Ryzen 7 5700, 62 GB RAM, Artix Linux 7.3.4-artix1-2, rustc 1.98.1 (the repo's pinned toolchain), cargo-xwin 0.24.1. No game data. Automated check only: the code itself was not reviewed. |
|
Tested on an RX 6950 XT (RDNA2), Windows 11,
All runs end in a page fault in the same low range ( |
|
Thank you, that's the first in-game result for this PR: from 3–4 s to ~78 s in the world on RDNA2. On the 3 remaining
So those three entries probably aren't untyped nulls left behind. The new last command, an indirect mesh draw ( AI-assisted (Claude Code). |
|
Thanks for the explanation. A correction and the data you asked about:
|
The device-removed report's table lines describe the title's view at each entry; the u<n> part describes only the first host slot of a table, and not the copy a table made afresh is read from. So a report could not tell whether an empty entry got a typed null (Marvisak#568) or the plain null 2D view. Each table line now ends with the shaders' annotation for that entry ([annotated <kind> <more>]) or [not annotated]: with no view, the first means a null of that kind, the second the plain null. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the second run and the correction. Agreed: one run each can't tell anything apart, so the ~78 s says nothing on its own. On the missing To make it visible,
If you run it again (several runs, as you say), the table lines of the faulting dispatch or draw would show which case the empty entries are. Thanks also for checking AI-assisted (Claude Code). |
The device-removed report's table lines describe the title's view at each entry; the u<n> part describes only the first host slot of a table, and not the copy a table made afresh is read from. So a report could not tell whether an empty entry got a typed null (Marvisak#568) or the plain null 2D view. Each table line now ends with the shaders' annotation for that entry ([annotated <kind> <more>]) or [not annotated]: with no view, the first means a null of that kind, the second the plain null. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4d45bc9 to
ad7b7ea
Compare
The device-removed report's table lines describe the title's view at each entry; the u<n> part describes only the first host slot of a table, and not the copy a table made afresh is read from. So a report could not tell whether an empty entry got a typed null (Marvisak#568) or the plain null 2D view. Each table line now ends with the shaders' annotation for that entry ([annotated <kind> <more>]) or [not annotated]: with no view, the first means a null of that kind, the second the plain null. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The device-removed report's table lines describe the title's view at each entry; the u<n> part describes only the first host slot of a table, and not the copy a table made afresh is read from. So a report could not tell whether an empty entry got a typed null (Marvisak#568) or the plain null 2D view. Each table line now ends with the shaders' annotation for that entry ([annotated <kind> <more>]) or [not annotated]: with no view, the first means a null of that kind, the second the plain null. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ad7b7ea to
04feb6c
Compare
|
Thanks — tested on the RDNA3 iGPU setup you asked for. The page fault is gone; the device is no longer removed. Details below. Setup
Baseline (main, same machine, same settings)Dies at ~63 s into the world load: Immediately before: With #568
Memory stayed at 12–17 GB private the whole time, so this is not the commit wall either. What it looks like nowThe frame time is dominated by the copy bridge and by shaders being translated on the fly — 341 pipelines were still "dropped without a host pipeline" during the run. GPU-side work is only ~300–450 ms. Caveats
Also confirmed (for #471)Raising the page file from 1 GB/8 GB to 16 GB/40 GB removed the Happy to run a DRED build on this adapter when the debug layer is available, and to re-run after your next revision. |
|
Thank you, that's the setup this was for, and a clear before/after: on Two notes:
AI-assisted (Claude Code). |
|
checked: #568 on RDNA3 (you asked for one) | base: result: 4 runs into the first mission's intro cutscene (2 min 39 s to 11 min 39 s). None of the device removals pointed at a null or typed-null slot: every one was a page fault "inside freed" a texture (and once a title buffer), details on #609 and #431. #568 applies cleanly on #431; on #609 it has one conflict in AI-assisted (Claude Code). |
|
Thank you for the four runs. That's the result this PR needed on RDNA3: no device removal points at a null slot any more, and what's left is the freed-resource faults #609 and #431 deal with. Added to the description. On the AI-assisted (Claude Code). |
…e shader reads A descriptor slot the title never wrote a view we know into is a null Texture2D SRV on the host: every host heap slot starts as one, and fresh tables get one for an empty entry. The translated shaders index the heap directly (SM 6.6), with the kind they expect in each handle's annotation, so a shader that writes such a slot as a UAV, or reads it as a buffer, uses a descriptor of the wrong type. That is undefined; two UAV entries without a view. The translator now records, for each descriptor it loads from a table at a constant offset, the resource properties it annotates the handle with (HostShader::table_views; UAV annotations win when one slot is read both ways; dynamically indexed loads are not recorded). Where the title has no view, the host makes a null descriptor of that kind: SRV or UAV, typed, raw or structured buffer, or the texture dimension, so writes are dropped and reads return zero. This covers fresh tables, mirrored title slots (a later real descriptor still replaces the null) and annotated slots past the used-resource entries. Slots no shader annotates keep the null 2D view. The shader cache format is bumped (VSH2, converter version 2) for the new field. Co-Authored-By: Gemini 4 Neon <noreply@google.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The device-removed report's table lines describe the title's view at each entry; the u<n> part describes only the first host slot of a table, and not the copy a table made afresh is read from. So a report could not tell whether an empty entry got a typed null (Marvisak#568) or the plain null 2D view. Each table line now ends with the shaders' annotation for that entry ([annotated <kind> <more>]) or [not annotated]: with no view, the first means a null of that kind, the second the plain null. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…elect choices, the lanes argument of track) Rebased onto main ffe310e: a waterfall loop's load reads each lane's own entry, so its first-lane offset is not recorded as a table view; both table loads of an s_cselect choice are recorded, as a phi's are; the test helper passes the structure to resource::track, and the waterfall test's HostShader gets its table_views. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Closing: |
…ator-fixes Shaders: fix DXIL signature mismatches and prune oversized mesh outputs
…l properties" This reverts commit cd6d934.
…83ad7a) Upstream closed Marvisak#568: main now guards buffer reads through slots holding texture views and reads table constants in place, the faults Marvisak#568's typed null slots were for. Marvisak#189's Wave64 options, which landed beside it, stay.
Upstream superseded Marvisak#635 and Marvisak#568 (reverted just before this merge); Marvisak#189, Marvisak#334, Marvisak#437, Marvisak#542, Marvisak#587 and Marvisak#1529 are still open upstream and are kept. Resolutions: - emit::Options is upstream's struct with Marvisak#189's `wave64` added; TranslateOptions stays as its alias. lower::Parts carries both `options` and upstream's `view_marks`. - Shader cache: upstream's cached refusals and hit flag, keyed by Marvisak#189's Wave64 mode byte as before. - lower.rs: Marvisak#542's 2 GiB bound applies to raw and structured views; title memory (upstream's MEMORY path and root views read as memory) is not bounded again, being checked where it is looked up. Scalar loads take upstream's raw views plus Marvisak#437's UAVs. The descriptor-kind use keeps Marvisak#437's preference for image/vector uses inside upstream's fallback. image() is upstream's (its own a16 bias/compare, gather4_l and _cl grads), replacing Marvisak#437's parallel version. - Marvisak#189: AddH (upstream's f16 wave sum) in apply_wave_op; 16-bit reductions are refused in an emulated 64-lane wave. mask_dword checks Marvisak#189's deferred ballot errors before upstream's mask_number. - Marvisak#334: indirect arguments keep the per-list buffer states (no indirect::done); upstream's single-group clamp dispatch is taken, and its diagnostics readback copies from the read state without barriers. - GPU adapter: upstream still creates its device on the default adapter, so host_adapter() stays. The shader test host keeps the high-performance adapter pick and adds upstream's dedicated-memory requirement. - Marvisak#1529: gameinput.rs as the PR's own merge of main (scripted keys first, then keyboard and mouse); run.rs configures controls and FidelityFX.
For #508. Whether it ends that page fault still needs someone with the RDNA3 setup to check (see the end).
What
A host descriptor slot for which the title has no view we know is a null Texture2D SRV. Every host heap slot starts as one (
HostHeap::fill_null), and fresh tables use one for empty entries (make_null). The translated shaders index the heap directly (SM 6.6), and each handle's annotation says what they expect. So a shader that writes such a slot as a UAV, or reads it as a buffer, uses a descriptor of the wrong type. That is undefined behavior. The dispatch in #508 hasUav s1+8: uav NoneandUav s1+16: uav Nonein its table, and RDNA3 page-faults.Now, where the title has no view, the host makes a null descriptor of the kind the shader annotates: SRV or UAV; typed, raw or structured buffer; or a texture of the right dimension. Writes are dropped and reads return zero.
How
emit/lower.rs):handle()records, for each descriptor loaded from a table at a constant offset, the root parameter slot, the dword within the table and the resource properties it annotates the handle with. Both arms of a control-flow join are recorded.shortcut:). Their empty slots keep the old null.HostShader::table_views.shader_cache.rs): the new field is encoded. The magic goes toVSH2and the converter version to 2, so old entries are rejected and translated again.descriptor::host::null_desc_for_propsmaps an annotation to a null SRV, UAV or CBV description. Formats areR32_{FLOAT,UINT,SINT}by component type, raw buffers areR32_TYPELESS+RAW, structured buffers use the stride from the annotation, and textures get their dimension. Kinds without a valid null (MSAA UAVs, samplers) giveNone, and those slots keep the old null.State::tablesmakes these nulls in three places:HostHeap::mirror_for_drawremembers a typed null in the slot state, so a later real descriptor still replaces it;4b4d504, traced by @alladeen321123 on WARP).cd6d559,b2a6bd2, raised by @SamuelReeder).null_viewnote recording that untyped null buffer views did not stop the world's low-address page faults (run w10) is kept, and now says that annotated slots get typed nulls.Tested
Native Windows: the upstream CI's checks (clippy
-D warningswith and without--all-features, thencargo test --workspace --locked) pass on GitHub'swindows-latestat this head: https://github.com/BastienRodz/VIctory/actions/runs/45461216241Linux x86_64, cross-built with
cargo xwinforx86_64-pc-windows-msvc, run under Wine 11. GPU tests ran on vkd3d-proton 3.1 over Mesa lavapipe (VKD3D_FEATURE_LEVEL=12_0). No game data used: every test input is synthetic.cargo xwin test -p victory-gpu: 52 passed, 0 failed, 1 ignored.cargo xwin test -p victory-shader: 107 passed, 15 failed;mainffe310egives 105 passed and the same 15 failed. They areemit::valu_tests::*and twoemit::waterfall_tests::*, which need an SM 6.6 device. Rebased ontoffe310e. With the waterfall loops there, a per-lane load (resource::Waterfall) reads each lane's own entry, so it is not recorded as a table view (its offset is only the first lane's). The two table loads of ans_cselectchoice are recorded, as a phi's are.victory-gpu51 passed and 1 failed, the environment failurea_rejected_blob_gives_an_empty_librarythatmainhas there too.table_views_record_srv_uav_structured_and_skip_dynamic: hand-assembled compute program; raw SRV, raw UAV and structured UAV recorded with their dwords, and a load with a dynamicsoffset(fromv_readfirstlane) not recorded.table_views_prefer_uav_and_record_phi_arms: UAV wins in both orders; both arms of a branch are recorded.null_desc_maps_buffer_and_texture_annotations: every buffer kind, every texture SRV and UAV dimension, the component-type formats, the CBV, and the unsupported kinds.host_accepts_typed_null_descriptors_and_mirror_transitions(host-gated; ran on vkd3d-proton): the device takes every typed null. A mirrored slot goes from empty to typed null, then to another typed null, then to a real view once the title writes one. A slot past the heap is ignored. Device not removed.5bab0e2): each table line of the device-removed report ends with the shaders' annotation for that entry, or[not annotated].shader_cacheround-trip includestable_views, andVSH1entries are rejected.cargo clippy --workspace --all-targets --locked -- -D warnings, with and without--all-features(as the CI runs it): clean.main).cargo xtask policy: 151 files ok.Tested by others (thanks)
mainffe310e+ GPU: build the indirect-argument clamp with our own writer (no shader compiler at run time) #190 Loader: opt-in VICTORY_NO_WATCHDOG hook for the title's watchdog (build 1.0.2.1) #454 GPU: bind root SRVs as one-view tables bounded to their host copy #493 GPU: VICTORY_SKIP_WAVE64 diagnostics switch for wave64 programs #579 + this PR (comment): no regression on AMD. WithVICTORY_SHADER_LOOP_LIMIT=1000, ~3.5 min in the world, then a GPUVM fault at0x0that also happens without this PR (after ~14 min), so it is not from it. Without a loop limit, a slow compute dispatch hangs earlier, also unrelated.d2a4bae, WARP), the device was removed in compute269b802f878c24e1with UAV slots without a view (the GPU: writing unbound UAVs removes the device on an RDNA3 iGPU #508 signature). With it (mainffe310e+ this PR, RTX 5060 Ti, debug layer and DRED on), that crash doesn't happen and the run continues ~2 min 47 s into the world load, stopping at a vertex buffer left inUNORDERED_ACCESS(GPU: transition host copies of title memory between shader writes and reads #334). Not a strict A/B (adapter and base differ).22e6676onmainffe310e(comment): first NVIDIA run.cargo test --workspace --locked346 passed, 0 failed (main: 342, so +4, the new tests); the GPU-executedvalu_testsandwaterfall_testspass (thediff_testsskip there: they need the console SDK'sdxc.exe). The driver accepts every typed null SRV, UAV and CBV. Workspace clippy with-D warnings: clean.diag+VICTORY_D3D12_DRED=1,main@8e79c80+ this PR + GPU: implement CopyTextureRegion texture-to-buffer readbacks #67 + GPU: retain and retire released host textures, staging, shadow buffers, and descriptor resources across submissions #609 or GPU: free host textures only after running submissions, and make them on first use #431 (comment): 4 runs into the first mission's intro (2 min 39 s to 11 min 39 s). None of the device removals pointed at a null or typed-null slot: all were page faults inside freed textures or a buffer, covered by GPU: retain and retire released host textures, staging, shadow buffers, and descriptor resources across submissions #609 and GPU: free host textures only after running submissions, and make them on first use #431. No regressions seen. One conflict with GPU: retain and retire released host textures, staging, shadow buffers, and descriptor resources across submissions #609, indescribe_slot(diagnostics only).diag,VICTORY_SHADER_LOOP_LIMIT=1000, atad7b7ea(comment):mainremoved the device ~63 s into the world. With this PR: no device removal, no ERROR lines, the world renders (0.3–0.9 fps), stopped by hand at 210 s. One run each, with no debug layer on that machine, so no DRED.diag+VICTORY_D3D12_DRED=1(comment): one run reached ~78 s in the world (against ~3–4 s without), but a second run with this PR faulted after ~2 s, so timing is not conclusive yet (correction). The report's[heap N: null]entries could not show whether the typed nulls were placed.5bab0e2adds the annotation to each table line of the diagnostics report ([annotated <kind> <more>]/[not annotated]) so the next run can show it.0845e8d(comment): bothtable_views_*tests,null_desc_maps_buffer_and_texture_annotations, andhost_accepts_typed_null_descriptors_and_mirror_transitionsall pass. The last ran on a real device (checked that it did not return early), and the device was not removed. Full suites:victory-gpu --lib45 passed, 0 failed, 1 ignored;victory-shader --lib71 passed, 0 failed, including the sevenvalu_teststhat need an SM 6.6 device.Not run
diagrun on the RDNA3 iGPU from GPU: writing unbound UAVs removes the device on an RDNA3 iGPU #508 withVICTORY_D3D12_DRED=1would settle it: does the fault in2dc602192abf6288stop, or does it move?AI-assisted: implemented with Gemini 4 Neon, then reviewed, corrected and tested with Claude Code. Corrections: annotated slots that have a view are no longer made outside
readable; the dynamic-offset test was fixed; the run-w10 note is kept. Every command above was really run.🤖 Generated with Claude Code