Ped skinning on RTX 5070 Ti reads zeros from a populated bindless vertex buffer when the host slot is null #1567

Open
opened 2026-11-26 04:36:41 +00:00 by github-bot · 4 comments
Owner

@⁠YouKnowWh on GitHub · 2026-11-24 19:14 UTC · original

On an RTX 5070 Ti (driver 621.14, Windows, Series X mode), the ped skinning compute shader selected a bindless raw vertex buffer from a CBV at byte offset 0x40. In a local diagnostics build, its selected host slot was null even though the title buffer contained nonzero vertex data. This provides a live case for #413 and the scalar heap-buffer translation discussed in #1015.

How to check this on another build

  1. In CS_PedStandardSkinning_7 (fb332f777bae57fb), record the index consumed at 0x6c, the heap byte offset at 0x70, and the two dwords read by the lane at 0x3204. Match by dispatch, lane, and view-relative byte offset. The descriptor index varies across runs.
  2. Compare the slot state and title bytes at bind time. In the baseline, all 96 paired samples had a null host slot and returned two zeros from nonzero source bytes. With the dynamically selected raw SRV materialized and refreshed, and scalar header reads at 0x8c/0x94 translated through a raw SRV, all 112 paired samples in a later run agreed word for word. This covered 16 distinct offsets.
  3. Follow the other writers as well. In a 32 KiB sampling window, 3,072 mesh lane reads matched the near-zero position encoding seen at the same byte offsets after earlier fenced skinning submissions. The last observed change came from variants _4 and _8, 1,536 lane observations each. Fixing _7 alone left the sampled triangles collapsed.

After extending the local handling to _4 and _8, one run of the instrumented stack recorded 14,521 sampled triangles with nonzero projected area for mesh ef5409053e14aa82 / pixel 94d281151ca58b4f. Pipeline statistics for the tracked indirect mesh draws recorded 634,040 pixel shader invocations across two fences. All 122 sampled groups had allocations matching the vertex and primitive counts in the meshlet record. Another run reached only empty draws. The process still eventually reported device removal.

These are GPU measurements. Final composite visibility was not checked. The local stack also includes mesh and culling translation changes and aligned structured SRV handling related to #984 and #986. Scene scheduling varied, and the host materialization and scalar lowering changes were tested together. An independent check of the source-word comparison on a current integration would help establish which changes are needed upstream.

AI-assisted local instrumentation and analysis. No game files attached.

**@⁠YouKnowWh** on GitHub · 2026-11-24 19:14 UTC · [original](https://github.com/Marvisak/VIctory/issues/1567) On an RTX 5070 Ti (driver 621.14, Windows, Series X mode), the ped skinning compute shader selected a bindless raw vertex buffer from a CBV at byte offset 0x40. In a local diagnostics build, its selected host slot was null even though the title buffer contained nonzero vertex data. This provides a live case for #413 and the scalar heap-buffer translation discussed in #1015. How to check this on another build 1. In CS_PedStandardSkinning_7 (fb332f777bae57fb), record the index consumed at 0x6c, the heap byte offset at 0x70, and the two dwords read by the lane at 0x3204. Match by dispatch, lane, and view-relative byte offset. The descriptor index varies across runs. 2. Compare the slot state and title bytes at bind time. In the baseline, all 96 paired samples had a null host slot and returned two zeros from nonzero source bytes. With the dynamically selected raw SRV materialized and refreshed, and scalar header reads at 0x8c/0x94 translated through a raw SRV, all 112 paired samples in a later run agreed word for word. This covered 16 distinct offsets. 3. Follow the other writers as well. In a 32 KiB sampling window, 3,072 mesh lane reads matched the near-zero position encoding seen at the same byte offsets after earlier fenced skinning submissions. The last observed change came from variants _4 and _8, 1,536 lane observations each. Fixing _7 alone left the sampled triangles collapsed. After extending the local handling to _4 and _8, one run of the instrumented stack recorded 14,521 sampled triangles with nonzero projected area for mesh ef5409053e14aa82 / pixel 94d281151ca58b4f. Pipeline statistics for the tracked indirect mesh draws recorded 634,040 pixel shader invocations across two fences. All 122 sampled groups had allocations matching the vertex and primitive counts in the meshlet record. Another run reached only empty draws. The process still eventually reported device removal. These are GPU measurements. Final composite visibility was not checked. The local stack also includes mesh and culling translation changes and aligned structured SRV handling related to #984 and #986. Scene scheduling varied, and the host materialization and scalar lowering changes were tested together. An independent check of the source-word comparison on a current integration would help establish which changes are needed upstream. AI-assisted local instrumentation and analysis. No game files attached.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:36:41 +00:00
Author
Owner

@⁠DrDarkDK on GitHub · 2026-11-24 19:46 UTC · original

I checked the exact CS_PedStandardSkinning_7 shader (fb332f777bae57fb) offline. The two scalar header loads at 0x8c and 0x94 and the vector load at 0x3204 all use the same dynamically loaded descriptor.

  • ffe310e: both scalar loads use CBV handles. The vector load uses a raw SRV.
  • #1015 alone (b8cfe8c): all three loads use a raw SRV.
  • #1319 (643aef6): same result as #1015 alone.

All three builds emitted DXIL that passed validation, so validation alone misses this handle mismatch. This isolates the shader-lowering half of the report. I haven’t measured whether the host slot is populated at dispatch time or whether the GPU reads the expected vertex words.

AI-assisted with Codex.

**@⁠DrDarkDK** on GitHub · 2026-11-24 19:46 UTC · [original](https://github.com/Marvisak/VIctory/issues/1567#issuecomment-7142577314) I checked the exact `CS_PedStandardSkinning_7` shader (`fb332f777bae57fb`) offline. The two scalar header loads at `0x8c` and `0x94` and the vector load at `0x3204` all use the same dynamically loaded descriptor. - `ffe310e`: both scalar loads use CBV handles. The vector load uses a raw SRV. - #1015 alone (`b8cfe8c`): all three loads use a raw SRV. - #1319 (`643aef6`): same result as #1015 alone. All three builds emitted DXIL that passed validation, so validation alone misses this handle mismatch. This isolates the shader-lowering half of the report. I haven’t measured whether the host slot is populated at dispatch time or whether the GPU reads the expected vertex words. *AI-assisted with Codex.*
Author
Owner

@⁠YouKnowWh on GitHub · 2026-11-24 20:06 UTC · original

Follow-up to the offline check above. I separated raw-SRV materialization/refresh on the host from scalar raw-SRV lowering and measured both on the RTX 5070 Ti. Same local instrumented executable and starting cache for all four configurations in each sweep. These are local diagnostics toggles, not isolated upstream PR builds.

For CS_PedStandardSkinning_7, the probe captured the four destination SGPRs immediately after each load and paired them with the selected source view at byte offsets 0x70 (PC 0x8c) and 0x60 (PC 0x94). Each entry below is exact four-word matches / paired lane observations. Both scalar PCs gave the same counts.

Host raw SRV populated and refreshed Scalar loads use raw SRV Each scalar load Sampled dispatch keys
off off 0/144 9
off on 0/64 4
on off 0/96 6
on on 16/16 1

In all three failing configurations each paired source tuple had nonzero data and all four GPU words were zero. The first on/on run had no paired samples. Its repeat reached one sampled dispatch, so the positive scalar result has limited dispatch coverage. Unpaired lanes were excluded.

Separately, with the same four configurations in the same table order, the vector load at 0x3204 gave 0/112, 0/112, 176/176, and 144/144 exact two-word matches. Thus populating the slot alone restored that vector read on this stack, while the scalar header reads matched only with both changes enabled. Runs still eventually hit device removal. No final-image claim.

AI-assisted local instrumentation and analysis.

**@⁠YouKnowWh** on GitHub · 2026-11-24 20:06 UTC · [original](https://github.com/Marvisak/VIctory/issues/1567#issuecomment-7143045293) Follow-up to the offline check above. I separated raw-SRV materialization/refresh on the host from scalar raw-SRV lowering and measured both on the RTX 5070 Ti. Same local instrumented executable and starting cache for all four configurations in each sweep. These are local diagnostics toggles, not isolated upstream PR builds. For CS_PedStandardSkinning_7, the probe captured the four destination SGPRs immediately after each load and paired them with the selected source view at byte offsets 0x70 (PC 0x8c) and 0x60 (PC 0x94). Each entry below is exact four-word matches / paired lane observations. Both scalar PCs gave the same counts. | Host raw SRV populated and refreshed | Scalar loads use raw SRV | Each scalar load | Sampled dispatch keys | |---|---|---:|---:| | off | off | 0/144 | 9 | | off | on | 0/64 | 4 | | on | off | 0/96 | 6 | | on | on | 16/16 | 1 | In all three failing configurations each paired source tuple had nonzero data and all four GPU words were zero. The first on/on run had no paired samples. Its repeat reached one sampled dispatch, so the positive scalar result has limited dispatch coverage. Unpaired lanes were excluded. Separately, with the same four configurations in the same table order, the vector load at 0x3204 gave 0/112, 0/112, 176/176, and 144/144 exact two-word matches. Thus populating the slot alone restored that vector read on this stack, while the scalar header reads matched only with both changes enabled. Runs still eventually hit device removal. No final-image claim. AI-assisted local instrumentation and analysis.
Author
Owner

@⁠YouKnowWh on GitHub · 2026-11-25 01:24 UTC · original

Follow-up — placed raw SRV creation and submit-time refresh

I traced the descriptor used by CS_PedStandardSkinning_7 (fb332f777bae57fb) back to its heap record and tested the slot lifecycle separately from shader translation. This updates the interpretation of the earlier RTX 5070 Ti report. The original observation stands for the instrumented build based on e50ed36. I have not reproduced the same in-game fault on a9d233fe.

Revision boundary on the actual shader

I built upstream 4f57f46f and its immediate child c75fdba39 separately. I added only trace prints at the two emission paths in the scalar-memory lowering function and ran victory translate --validate on the same container. At both PCs, the parent emitted one cbufferLoadLegacy.i32; the child emitted four rawBufferLoad.f32 operations for the four dwords. Both outputs passed DXIL validation. This pins the translation change to one upstream commit. It does not require #1762. No pipeline was created and no game was launched in this comparison.

The same commit narrows descriptor creation deferral from buffers/placed views to placed textures. A later, distinct change, 86a5ed6ba, mirrors shader-visible heap records copied as bytes before collecting uploads at submission. I do not know whether the original title slot reached the heap via an API write or byte copy.

I also rejoined the four historical _7 hardware logs by probe and shader-selected index, checked the 32-byte slot arithmetic, and compared the lane's pair of dwords at the captured byte offset. The two host-disabled runs each yielded 112 paired lane observations across seven distinct (fence, probe, index) tuples; all had zero cached keys and returned two zeros from nonzero source data. With host handling enabled, 176/176 (11 tuples) and 144/144 (9 tuples) matched, respectively without and with the scalar fix. For each positive pair the cached view's title address and length agreed with the guest source range and a host shadow address was found. That address is a software lookup, not an independent measurement of the GPU descriptor. The counts reuse previously reported runs.

Where the descriptor comes from

In the original GFX10 program, PC 0x40 fetches the descriptor for the upstream constants. PC 0x60 reads the index from byte 0x40 of those constants into s32. PC 0x6c multiplies that index by 32 (bytes per heap slot), and PC 0x70 loads the selected descriptor into s[12:15]. The scalar loads at 0x8c and 0x94 use it at offsets 0x70 and 0x60. The vector load at 0x3204 uses the same descriptor registers with a per-lane byte offset.

All 38 target-view log entries across the earlier four configurations reported a placed raw buffer SRV: buffer dimension, R32_TYPELESS, zero structure stride, RAW flag. These are 38 logged observations, not 38 distinct descriptors. The structured-to-raw conversion proposed by #1762 requires an UNKNOWN format and nonzero structure stride. That conversion does not apply to the sampled views here.

What the old “null slot” measurement meant

In the older stack, describe_slot returned “null” when its cached descriptor-generation key was zero. It was not a hardware descriptor readback. The code in descriptor/host.rs deferred materialization when !for_draw && view.is_buffer(); is_buffer() included every View::Placed. This gives a concrete path from a populated title record to a zero host key and a null descriptor. The earlier diagnostic workaround forced mirroring and refreshed backing data together. The exact write/copy history of the slot in the failing title dispatch was not recorded.

Controlled replay on a9d233fe

Windows, Microsoft WARP, diagnostics build. No title execution. I adapted bindless::tests::heap_views_are_current to place a synthetic 256-byte raw buffer SRV at slot 36379 in a shader-visible heap backed by tracked memory. A small compute shader reads that slot through a table pointing to it. It does not run the title shader or reproduce its dynamic index calculation. Each round changes the title buffer after list recording and before submission, then compares all 64 output dwords.

Case Host key before submit Result
Direct placed-SRV creation Present Three rounds, 64/64 words each. First words 1000, 5000, 9000.
Copy the 32-byte title descriptor record into the tracked heap without a descriptor API call Absent Present after normal submission; same three exact readbacks.
Reintroduce the older deferral condition for this placed buffer only Absent after direct creation despite a valid title record Explicit mirror(..., true) creates the key. No dispatch in this control.
Keep direct creation, omit the list’s bindless-heap upload registration Present Expected negative control: first source word read 0 instead of 1000.

So the two mechanisms can be distinguished. On this revision a zero key before submission is expected for a byte-copied record. Submission calls descriptor::sync_heaps() before collecting the uploads. A present key alone also does not establish that the buffer data was uploaded. Neither negative control demonstrates an in-game failure on this revision.

Separately, on the exact title shader, an observation-only run of the translator at a9d233fe selected heap_constants=true, srv=true at both scalar PCs and emitted validator-accepted DXIL. No PSO or title dispatch was run for this check. The remaining hardware question is whether the selected slot and bytes are correct after heap sync and upload, on the first real dispatch. Before another game run, the synthetic replay can be independently repeated on another adapter. I would keep the historical result scoped to its build until that comparison exists.

Repro for the attached test-only patch: start at a9d233fe5d496b64737419ddf41056d8ab8d36b3, apply lifecycle-reproducer.patch, set VICTORY_D3D12_WARP=1, and run cargo test -p victory-gpu --locked --features diagnostics --lib bindless::tests::heap_views_are_current -- --exact --nocapture --test-threads=1. Use a fresh process for each row. Set SKIN_DESCRIPTOR_REPLAY=api or bytes for the first two; for the controls use api plus only SKIN_OLD_DEFER=1 or only SKIN_NO_UPLOAD=1, respectively. The last row should fail its data assertion.

Rebinding the same slot after recording

On the same revision and WARP adapter I also tested replacing the identity of the source buffer. The compute shader reads 64 dwords from a synthetic placed raw SRV. Its descriptor range is volatile. Each round closes the command list, writes distinct new patterns into both source buffers, changes the guest record, submits, and checks the cached host record identity and all 64 words of GPU output. The next round begins after readback of the previous round. This exercises ordered submissions, not overlapping queues.

At slot 36379 the requested sequence was A → B → null → A. I ran separate cases for direct placed-SRV creation, a 32-byte record copy, and direct creation followed by a byte copy on the A → B transition. Clearing the slot was a byte write in all cases. All four reads in each case matched; their first words were 1000, 21000, 0 and 4000. For the byte-copy transition the cached host record still identified A before submission and identified B after completion.

In the matched negative control I suppressed only the submit-time descriptor-heap scan in the mixed case. The A → B submission kept A. It returned A's freshly updated pattern (first word 2000, all 64 words checked), while the guest record selected B (first word 21000). This isolates stale descriptor identity despite fresh backing data. It is an intentionally induced failure. These tests do not establish that the old game dispatch missed this particular scan or that the same condition occurs on current hardware.

Reproduction: apply the standalone rebind-reproducer.patch to the clean revision identified above; it includes the earlier fixture, so use it instead of stacking the two patches. Run the same test command with SKIN_REBIND=1 and WARP. Use SKIN_DESCRIPTOR_REPLAY=api or bytes; for the matched pair use api with SKIN_COPY_SECOND=1 both times and add SKIN_SUPPRESS_SYNC=1 only for the negative control. That control passes when the old A data is observed.

AI-assisted analysis. The reproducer contains synthetic buffers and project test code only.

lifecycle-reproducer.patch (expand to copy)
diff --git a/crates/victory-gpu/src/bindless.rs b/crates/victory-gpu/src/bindless.rs
index e4c08be..7524902 100644
--- a/crates/victory-gpu/src/bindless.rs
+++ b/crates/victory-gpu/src/bindless.rs
@@ -364,7 +364,7 @@ Texture2D<float4> tex : register(t1);
 [numthreads(16, 1, 1)]
 void main(uint3 id : SV_DispatchThreadID) {
     uint texel = (uint)round(tex.Load(int3(id.x % 4, 0, 0)).x * 255.0);
-    dst.Store(id.x * 4, src.Load(id.x * 4) + texel);
+    dst.Store(id.x * 4, src.Load(id.x * 4));
 }
 "#;
 
@@ -563,11 +563,15 @@ void main(uint3 id : SV_DispatchThreadID) {
     /// submit, check the output's host copy.
     fn rounds(src: This, dst: This, tex: This, write: impl Fn(u32, u8)) {
         let Some(host) = crate::host::host() else {
-            return; // no host GPU here
+            panic!("host required");
         };
         let null = std::ptr::null();
         // A shader-visible view heap of 8 slots, in memory of its own.
-        let heap_desc: [u32; 8] = [0, 8, 1, 0, 0, 0, 0, 0];
+        let mode=std::env::var("SKIN_DESCRIPTOR_REPLAY").unwrap();
+        let index=36379usize;
+        let slots=index+3;
+        let backing=crate::watch::tests::pool((slots*32).div_ceil(crate::watch::PAGE));
+        let heap_desc: [u32; 8]=[0,slots as u32,1,0,backing as u32,(backing as u64>>32) as u32,(slots*32) as u32,0];
         let mut heap = null;
         let iid = crate::object::guid(
             0x8efb471d,
@@ -577,12 +581,38 @@ void main(uint3 id : SV_DispatchThreadID) {
         );
         assert_eq!(crate::descriptor::create_heap(null, heap_desc.as_ptr().cast(), &iid, &mut heap), S_OK);
         let title_heap = crate::descriptor::heap(heap);
-        let slot = |i: u64| title_heap.start + 32 * i;
+        let slot = |i: u64| title_heap.start + 32 * (index as u64 + i);
         // Raw views of 64 dwords: format R32_TYPELESS, buffer dimension,
         // the default mapping, then first element, count, stride, flags.
         let srv: [u32; 10] = [39, 1, 0x1688, 0, 0, 0, 64, 0, 1, 0];
         let uav: [u32; 10] = [39, 1, 0, 0, 64, 0, 0, 0, 1, 0];
-        crate::descriptor::create_srv(null, src, &srv, slot(0));
+        let addr=crate::resource::buffer_bytes(src).unwrap().0 as u64;
+        let res=[1,5,0,0,256,0,1,65537,0,1,0,1,0,5];
+        let mut desc=[0u32;16];desc[..10].copy_from_slice(&srv);
+        desc[10]=addr as u32;desc[11]=(addr>>32) as u32;
+        let heap_host=title_heap.host().expect("host heap required");
+        assert_eq!(title_heap.start,backing as u64);
+        assert!(!heap_host.made(index as u32));
+        let mut staging=[0u64;4];
+        if std::env::var_os("SKIN_OLD_DEFER").is_some(){
+            crate::descriptor::create_placed_srv(null,&res,&desc,slot(0));
+            assert!(!heap_host.made(index as u32));
+            assert!(crate::descriptor::view(slot(0)).is_some());
+            heap_host.mirror(index as u32,slot(0),true);
+            assert!(heap_host.made(index as u32));
+            eprintln!("guest=present made_after_write=false made_after_for_draw=true (no dispatch)");
+            return;
+        }
+        match mode.as_str() {
+            "api"=>{crate::descriptor::create_placed_srv(null,&res,&desc,slot(0));assert!(heap_host.made(index as u32));},
+            "bytes"=>{
+                crate::descriptor::create_placed_srv(null,&res,&desc,staging.as_mut_ptr() as u64);
+                unsafe { std::ptr::copy_nonoverlapping(staging.as_ptr(),slot(0) as *mut u64,4) };
+                assert!(!heap_host.made(index as u32));
+            },
+            _=>panic!("unexpected test mode"),
+        }
+        eprintln!("mode={mode} key_before_submit={}",heap_host.made(index as u32));
         crate::descriptor::create_uav(null, dst, null, &uav, slot(1));
         crate::descriptor::create_srv(null, tex, std::ptr::null(), slot(2));
         let heap_host = title_heap.host().expect("a host view heap");
@@ -598,19 +628,22 @@ void main(uint3 id : SV_DispatchThreadID) {
             unsafe {
                 list.list.SetDescriptorHeaps(&[Some(heap_host.heap.clone())]);
                 list.list.SetComputeRootSignature(&root);
-                list.list.SetComputeRootDescriptorTable(0, heap_host.gpu(0));
+                list.list.SetComputeRootDescriptorTable(0, heap_host.gpu(index as u32));
                 list.list.SetPipelineState(&pso);
                 list.list.Dispatch(4, 1, 1);
             }
-            list.defer_heap(&heap_host.viewed);
+            if std::env::var_os("SKIN_NO_UPLOAD").is_none(){list.defer_heap(&heap_host.viewed);}
             list.close();
             // The title writes after recording, before submitting.
             write(base, texel);
             host.execute(&[&list]);
+            assert!(heap_host.made(index as u32));
             let words = out.read_host(dst_bytes as u64, 64);
+            assert_eq!(words.len(),64);
             for (i, &v) in words.iter().enumerate() {
-                assert_eq!(v, base + i as u32 + u32::from(texel), "round {round}, dword {i}");
+                assert_eq!(v, base + i as u32, "round {round}, dword {i}");
             }
+            eprintln!("mode={mode} round={round} first={} expected={} words_ok=64",words[0],base);
         }
     }
 }
diff --git a/crates/victory-gpu/src/descriptor/host.rs b/crates/victory-gpu/src/descriptor/host.rs
index b23132a..f413756 100644
--- a/crates/victory-gpu/src/descriptor/host.rs
+++ b/crates/victory-gpu/src/descriptor/host.rs
@@ -620,7 +620,7 @@ impl HostHeap {
             // when a draw reads them through a table: a host texture (and a
             // staging copy) for each of the ~20,000 the title has views of
             // ran the host out of memory (run b2).
-            let later = !for_draw && is_placed_texture(&view);
+            let later = !for_draw && (is_placed_texture(&view) || (cfg!(test) && std::env::var_os("SKIN_OLD_DEFER").is_some() && matches!(&view,View::Placed(false, r, _) if r[0]==1)));
             made[index as usize] = if later { 0 } else { key };
             let kept = if later {
                 None
rebind-reproducer.patch (expand to copy)
diff --git a/crates/victory-gpu/src/bindless.rs b/crates/victory-gpu/src/bindless.rs
index e4c08be..9e304c3 100644
--- a/crates/victory-gpu/src/bindless.rs
+++ b/crates/victory-gpu/src/bindless.rs
@@ -356,7 +356,7 @@ mod tests {
     /// slot 1 (raw unordered buffer): through a table over the heap's
     /// start, the same slots a shader indexing the heap reads.
     const SOURCE: &str = r#"
-#define RS "DescriptorTable(SRV(t0), UAV(u0), SRV(t1))"
+#define RS "DescriptorTable(SRV(t0, flags=DESCRIPTORS_VOLATILE | DATA_VOLATILE), UAV(u0, flags=DESCRIPTORS_VOLATILE | DATA_VOLATILE), SRV(t1, flags=DESCRIPTORS_VOLATILE | DATA_VOLATILE))"
 ByteAddressBuffer src : register(t0);
 RWByteAddressBuffer dst : register(u0);
 Texture2D<float4> tex : register(t1);
@@ -364,7 +364,7 @@ Texture2D<float4> tex : register(t1);
 [numthreads(16, 1, 1)]
 void main(uint3 id : SV_DispatchThreadID) {
     uint texel = (uint)round(tex.Load(int3(id.x % 4, 0, 0)).x * 255.0);
-    dst.Store(id.x * 4, src.Load(id.x * 4) + texel);
+    dst.Store(id.x * 4, src.Load(id.x * 4));
 }
 "#;
 
@@ -563,11 +563,15 @@ void main(uint3 id : SV_DispatchThreadID) {
     /// submit, check the output's host copy.
     fn rounds(src: This, dst: This, tex: This, write: impl Fn(u32, u8)) {
         let Some(host) = crate::host::host() else {
-            return; // no host GPU here
+            panic!("host required");
         };
         let null = std::ptr::null();
         // A shader-visible view heap of 8 slots, in memory of its own.
-        let heap_desc: [u32; 8] = [0, 8, 1, 0, 0, 0, 0, 0];
+        let mode=std::env::var("SKIN_DESCRIPTOR_REPLAY").unwrap();
+        let index=36379usize;
+        let slots=index+3;
+        let backing=crate::watch::tests::pool((slots*32).div_ceil(crate::watch::PAGE));
+        let heap_desc: [u32; 8]=[0,slots as u32,1,0,backing as u32,(backing as u64>>32) as u32,(slots*32) as u32,0];
         let mut heap = null;
         let iid = crate::object::guid(
             0x8efb471d,
@@ -577,12 +581,38 @@ void main(uint3 id : SV_DispatchThreadID) {
         );
         assert_eq!(crate::descriptor::create_heap(null, heap_desc.as_ptr().cast(), &iid, &mut heap), S_OK);
         let title_heap = crate::descriptor::heap(heap);
-        let slot = |i: u64| title_heap.start + 32 * i;
+        let slot = |i: u64| title_heap.start + 32 * (index as u64 + i);
         // Raw views of 64 dwords: format R32_TYPELESS, buffer dimension,
         // the default mapping, then first element, count, stride, flags.
         let srv: [u32; 10] = [39, 1, 0x1688, 0, 0, 0, 64, 0, 1, 0];
         let uav: [u32; 10] = [39, 1, 0, 0, 64, 0, 0, 0, 1, 0];
-        crate::descriptor::create_srv(null, src, &srv, slot(0));
+        let addr=crate::resource::buffer_bytes(src).unwrap().0 as u64;
+        let res=[1,5,0,0,256,0,1,65537,0,1,0,1,0,5];
+        let mut desc=[0u32;16];desc[..10].copy_from_slice(&srv);
+        desc[10]=addr as u32;desc[11]=(addr>>32) as u32;
+        let heap_host=title_heap.host().expect("host heap required");
+        assert_eq!(title_heap.start,backing as u64);
+        assert!(!heap_host.made(index as u32));
+        let mut staging=[0u64;4];
+        if std::env::var_os("SKIN_OLD_DEFER").is_some(){
+            crate::descriptor::create_placed_srv(null,&res,&desc,slot(0));
+            assert!(!heap_host.made(index as u32));
+            assert!(crate::descriptor::view(slot(0)).is_some());
+            heap_host.mirror(index as u32,slot(0),true);
+            assert!(heap_host.made(index as u32));
+            eprintln!("guest=present made_after_write=false made_after_for_draw=true (no dispatch)");
+            return;
+        }
+        match mode.as_str() {
+            "api"=>{crate::descriptor::create_placed_srv(null,&res,&desc,slot(0));assert!(heap_host.made(index as u32));},
+            "bytes"=>{
+                crate::descriptor::create_placed_srv(null,&res,&desc,staging.as_mut_ptr() as u64);
+                unsafe { std::ptr::copy_nonoverlapping(staging.as_ptr(),slot(0) as *mut u64,4) };
+                assert!(!heap_host.made(index as u32));
+            },
+            _=>panic!("unexpected test mode"),
+        }
+        eprintln!("mode={mode} key_before_submit={}",heap_host.made(index as u32));
         crate::descriptor::create_uav(null, dst, null, &uav, slot(1));
         crate::descriptor::create_srv(null, tex, std::ptr::null(), slot(2));
         let heap_host = title_heap.host().expect("a host view heap");
@@ -590,6 +620,63 @@ void main(uint3 id : SV_DispatchThreadID) {
         let list = host.new_list().unwrap();
         let (dst_bytes, _) = crate::resource::buffer_bytes(dst).unwrap();
         let out = crate::shadow::find(dst_bytes as u64, 256).expect("the output's host copy");
+        if std::env::var_os("SKIN_REBIND").is_some() {
+            let second=resource(1,256,1,0,1);
+            let second_addr=crate::resource::buffer_bytes(second).unwrap().0 as u64;
+            assert_ne!(addr,second_addr);
+            let mut second_desc=desc;
+            second_desc[10]=second_addr as u32;second_desc[11]=(second_addr>>32) as u32;
+            let label=|v:Option<(u64,u64)>| match v {
+                Some((a,256)) if a==addr => "A",
+                Some((a,256)) if a==second_addr => "B",
+                None=>"null",_=>"other",
+            };
+            for (round,target) in ["A","B","null","A"].into_iter().enumerate() {
+                if round>0 {list.reset();}
+                unsafe {
+                    list.list.SetDescriptorHeaps(&[Some(heap_host.heap.clone())]);
+                    list.list.SetComputeRootSignature(&root);
+                    list.list.SetComputeRootDescriptorTable(0,heap_host.gpu(index as u32));
+                    list.list.SetPipelineState(&pso);
+                    list.list.Dispatch(4,1,1);
+                }
+                list.defer_heap(&heap_host.viewed);list.close();
+                let a_value=1000+round as u32*1000;
+                let b_value=20000+round as u32*1000;
+                write(a_value,0);
+                unsafe {
+                    for (i,x) in std::slice::from_raw_parts_mut(second_addr as *mut u32,64).iter_mut().enumerate(){
+                        *x=b_value+i as u32;
+                    }
+                }
+                if target=="null" {
+                    unsafe{std::ptr::write_bytes(slot(0) as *mut u8,0,32);}
+                } else {
+                    let d=if target=="A"{&desc}else{&second_desc};
+                    if mode=="api" && !(round==1 && std::env::var_os("SKIN_COPY_SECOND").is_some()) {
+                        crate::descriptor::create_placed_srv(null,&res,d,slot(0));
+                    }else{
+                        crate::descriptor::create_placed_srv(null,&res,d,staging.as_mut_ptr() as u64);
+                        unsafe{std::ptr::copy_nonoverlapping(staging.as_ptr(),slot(0) as *mut u64,4);}
+                    }
+                }
+                let before=label(heap_host.replay_range(index as u32));
+                host.execute(&[&list]);
+                let after=label(heap_host.replay_range(index as u32));
+                let words=out.read_host(dst_bytes as u64,64);
+                assert_eq!(words.len(),64);
+                let first=match target{"A"=>a_value,"B"=>b_value,_=>0};
+                let misses=words.iter().enumerate().filter(|(i,x)|**x!=if target=="null"{0}else{first+*i as u32}).count();
+                eprintln!("round={round} guest={target} host_before={before} host_after={after} gpu0={} expected0={first} mismatches={misses}/64",words[0]);
+                if std::env::var_os("SKIN_SUPPRESS_SYNC").is_some() && round==1 {
+                    assert_eq!(after,"A");
+                    for (i,x) in words.iter().enumerate(){assert_eq!(*x,a_value+i as u32);}
+                    return;
+                }
+                assert_eq!(after,target);assert_eq!(misses,0);
+            }
+            return;
+        }
         for (round, (base, texel)) in [(1000u32, 0x40u8), (5000, 0x10), (9000, 0x22)].into_iter().enumerate() {
             if round > 0 {
                 list.reset();
@@ -598,19 +685,22 @@ void main(uint3 id : SV_DispatchThreadID) {
             unsafe {
                 list.list.SetDescriptorHeaps(&[Some(heap_host.heap.clone())]);
                 list.list.SetComputeRootSignature(&root);
-                list.list.SetComputeRootDescriptorTable(0, heap_host.gpu(0));
+                list.list.SetComputeRootDescriptorTable(0, heap_host.gpu(index as u32));
                 list.list.SetPipelineState(&pso);
                 list.list.Dispatch(4, 1, 1);
             }
-            list.defer_heap(&heap_host.viewed);
+            if std::env::var_os("SKIN_NO_UPLOAD").is_none(){list.defer_heap(&heap_host.viewed);}
             list.close();
             // The title writes after recording, before submitting.
             write(base, texel);
             host.execute(&[&list]);
+            assert!(heap_host.made(index as u32));
             let words = out.read_host(dst_bytes as u64, 64);
+            assert_eq!(words.len(),64);
             for (i, &v) in words.iter().enumerate() {
-                assert_eq!(v, base + i as u32 + u32::from(texel), "round {round}, dword {i}");
+                assert_eq!(v, base + i as u32, "round {round}, dword {i}");
             }
+            eprintln!("mode={mode} round={round} first={} expected={} words_ok=64",words[0],base);
         }
     }
 }
diff --git a/crates/victory-gpu/src/descriptor/host.rs b/crates/victory-gpu/src/descriptor/host.rs
index b23132a..a53635a 100644
--- a/crates/victory-gpu/src/descriptor/host.rs
+++ b/crates/victory-gpu/src/descriptor/host.rs
@@ -620,7 +620,7 @@ impl HostHeap {
             // when a draw reads them through a table: a host texture (and a
             // staging copy) for each of the ~20,000 the title has views of
             // ran the host out of memory (run b2).
-            let later = !for_draw && is_placed_texture(&view);
+            let later = !for_draw && (is_placed_texture(&view) || (cfg!(test) && std::env::var_os("SKIN_OLD_DEFER").is_some() && matches!(&view,View::Placed(false, r, _) if r[0]==1)));
             made[index as usize] = if later { 0 } else { key };
             let kept = if later {
                 None
@@ -661,6 +661,13 @@ impl HostHeap {
 
     /// Whether slot `index` was made from a record (tests).
     #[cfg(test)]
+    pub(crate) fn replay_range(&self, index: u32) -> Option<(u64,u64)> {
+        let key=self.made.lock().unwrap()[index as usize];
+        if key==0 { return None; }
+        let v=view_at(key as u32,(key>>32) as u32)?;
+        buffer_range(&v)
+    }
+    #[cfg(test)]
     pub(crate) fn made(&self, index: u32) -> bool {
         self.made.lock().unwrap_or_else(|e| e.into_inner())[index as usize] != 0
     }
diff --git a/crates/victory-gpu/src/host.rs b/crates/victory-gpu/src/host.rs
index b92e55d..028e003 100644
--- a/crates/victory-gpu/src/host.rs
+++ b/crates/victory-gpu/src/host.rs
@@ -592,7 +592,9 @@ impl Host {
         crate::copystat::add(crate::copystat::C::Submissions, 1);
         // Descriptors the title copied into its heaps itself, before the
         // heaps' views are brought up to date below.
-        crate::descriptor::sync_heaps();
+        if !(cfg!(test) && std::env::var_os("SKIN_SUPPRESS_SYNC").is_some()) {
+            crate::descriptor::sync_heaps();
+        }
         // Textures heap-indexing shaders may read, uploaded first by a list
         // of ours where their title memory changed.
         let heaps: Vec<std::sync::Arc<crate::bindless::Viewed>> = runs
**@⁠YouKnowWh** on GitHub · 2026-11-25 01:24 UTC · [original](https://github.com/Marvisak/VIctory/issues/1567#issuecomment-7149521561) ### Follow-up — placed raw SRV creation and submit-time refresh I traced the descriptor used by `CS_PedStandardSkinning_7` (`fb332f777bae57fb`) back to its heap record and tested the slot lifecycle separately from shader translation. This updates the interpretation of the earlier RTX 5070 Ti report. The original observation stands for the instrumented build based on `e50ed36`. I have not reproduced the same in-game fault on `a9d233fe`. ### Revision boundary on the actual shader I built upstream [4f57f46f](https://github.com/Marvisak/VIctory/commit/4f57f46f83fe72a7561169079da155475f3e7481) and its immediate child [c75fdba39](https://github.com/Marvisak/VIctory/commit/c75fdba39f4e188d5016fff71533a36c48a4e150) separately. I added only trace prints at the two emission paths in the scalar-memory lowering function and ran `victory translate --validate` on the same container. At both PCs, the parent emitted one `cbufferLoadLegacy.i32`; the child emitted four `rawBufferLoad.f32` operations for the four dwords. Both outputs passed DXIL validation. This pins the translation change to one upstream commit. It does not require #1762. No pipeline was created and no game was launched in this comparison. The same commit narrows descriptor creation deferral from buffers/placed views to placed textures. A later, distinct change, [86a5ed6ba](https://github.com/Marvisak/VIctory/commit/86a5ed6bace9c789396494438f6ca75ba9084146), mirrors shader-visible heap records copied as bytes before collecting uploads at submission. I do not know whether the original title slot reached the heap via an API write or byte copy. I also rejoined the four historical _7 hardware logs by probe and shader-selected index, checked the 32-byte slot arithmetic, and compared the lane's pair of dwords at the captured byte offset. The two host-disabled runs each yielded 112 paired lane observations across seven distinct (fence, probe, index) tuples; all had zero cached keys and returned two zeros from nonzero source data. With host handling enabled, 176/176 (11 tuples) and 144/144 (9 tuples) matched, respectively without and with the scalar fix. For each positive pair the cached view's title address and length agreed with the guest source range and a host shadow address was found. That address is a software lookup, not an independent measurement of the GPU descriptor. The counts reuse previously reported runs. ### Where the descriptor comes from In the original GFX10 program, PC `0x40` fetches the descriptor for the upstream constants. PC `0x60` reads the index from byte `0x40` of those constants into `s32`. PC `0x6c` multiplies that index by 32 (bytes per heap slot), and PC `0x70` loads the selected descriptor into `s[12:15]`. The scalar loads at `0x8c` and `0x94` use it at offsets `0x70` and `0x60`. The vector load at `0x3204` uses the same descriptor registers with a per-lane byte offset. All 38 target-view log entries across the earlier four configurations reported a placed raw buffer SRV: buffer dimension, R32_TYPELESS, zero structure stride, RAW flag. These are 38 logged observations, not 38 distinct descriptors. The structured-to-raw conversion proposed by #1762 requires an UNKNOWN format and nonzero structure stride. That conversion does not apply to the sampled views here. ### What the old “null slot” measurement meant In the older stack, `describe_slot` returned “null” when its cached descriptor-generation key was zero. It was not a hardware descriptor readback. The code in `descriptor/host.rs` deferred materialization when `!for_draw && view.is_buffer()`; `is_buffer()` included every `View::Placed`. This gives a concrete path from a populated title record to a zero host key and a null descriptor. The earlier diagnostic workaround forced mirroring and refreshed backing data together. The exact write/copy history of the slot in the failing title dispatch was not recorded. ### Controlled replay on a9d233fe Windows, Microsoft WARP, diagnostics build. No title execution. I adapted `bindless::tests::heap_views_are_current` to place a synthetic 256-byte raw buffer SRV at slot 36379 in a shader-visible heap backed by tracked memory. A small compute shader reads that slot through a table pointing to it. It does not run the title shader or reproduce its dynamic index calculation. Each round changes the title buffer after list recording and before submission, then compares all 64 output dwords. | Case | Host key before submit | Result | |---|---|---| | Direct placed-SRV creation | Present | Three rounds, 64/64 words each. First words 1000, 5000, 9000. | | Copy the 32-byte title descriptor record into the tracked heap without a descriptor API call | Absent | Present after normal submission; same three exact readbacks. | | Reintroduce the older deferral condition for this placed buffer only | Absent after direct creation despite a valid title record | Explicit `mirror(..., true)` creates the key. No dispatch in this control. | | Keep direct creation, omit the list’s bindless-heap upload registration | Present | Expected negative control: first source word read 0 instead of 1000. | So the two mechanisms can be distinguished. On this revision a zero key *before* submission is expected for a byte-copied record. Submission calls `descriptor::sync_heaps()` before collecting the uploads. A present key alone also does not establish that the buffer data was uploaded. Neither negative control demonstrates an in-game failure on this revision. Separately, on the exact title shader, an observation-only run of the translator at `a9d233fe` selected `heap_constants=true, srv=true` at both scalar PCs and emitted validator-accepted DXIL. No PSO or title dispatch was run for this check. The remaining hardware question is whether the selected slot and bytes are correct **after heap sync and upload, on the first real dispatch**. Before another game run, the synthetic replay can be independently repeated on another adapter. I would keep the historical result scoped to its build until that comparison exists. Repro for the attached test-only patch: start at `a9d233fe5d496b64737419ddf41056d8ab8d36b3`, apply `lifecycle-reproducer.patch`, set `VICTORY_D3D12_WARP=1`, and run `cargo test -p victory-gpu --locked --features diagnostics --lib bindless::tests::heap_views_are_current -- --exact --nocapture --test-threads=1`. Use a fresh process for each row. Set `SKIN_DESCRIPTOR_REPLAY=api` or `bytes` for the first two; for the controls use `api` plus only `SKIN_OLD_DEFER=1` or only `SKIN_NO_UPLOAD=1`, respectively. The last row should fail its data assertion. ### Rebinding the same slot after recording On the same revision and WARP adapter I also tested replacing the *identity* of the source buffer. The compute shader reads 64 dwords from a synthetic placed raw SRV. Its descriptor range is volatile. Each round closes the command list, writes distinct new patterns into both source buffers, changes the guest record, submits, and checks the cached host record identity and all 64 words of GPU output. The next round begins after readback of the previous round. This exercises ordered submissions, not overlapping queues. At slot 36379 the requested sequence was A → B → null → A. I ran separate cases for direct placed-SRV creation, a 32-byte record copy, and direct creation followed by a byte copy on the A → B transition. Clearing the slot was a byte write in all cases. All four reads in each case matched; their first words were 1000, 21000, 0 and 4000. For the byte-copy transition the cached host record still identified A before submission and identified B after completion. In the matched negative control I suppressed only the submit-time descriptor-heap scan in the mixed case. The A → B submission kept A. It returned A's freshly updated pattern (first word 2000, all 64 words checked), while the guest record selected B (first word 21000). This isolates **stale descriptor identity despite fresh backing data**. It is an intentionally induced failure. These tests do not establish that the old game dispatch missed this particular scan or that the same condition occurs on current hardware. Reproduction: apply the standalone `rebind-reproducer.patch` to the clean revision identified above; it includes the earlier fixture, so use it instead of stacking the two patches. Run the same test command with `SKIN_REBIND=1` and WARP. Use `SKIN_DESCRIPTOR_REPLAY=api` or `bytes`; for the matched pair use `api` with `SKIN_COPY_SECOND=1` both times and add `SKIN_SUPPRESS_SYNC=1` only for the negative control. That control passes when the old A data is observed. AI-assisted analysis. The reproducer contains synthetic buffers and project test code only. <details><summary>lifecycle-reproducer.patch (expand to copy)</summary> ````diff diff --git a/crates/victory-gpu/src/bindless.rs b/crates/victory-gpu/src/bindless.rs index e4c08be..7524902 100644 --- a/crates/victory-gpu/src/bindless.rs +++ b/crates/victory-gpu/src/bindless.rs @@ -364,7 +364,7 @@ Texture2D<float4> tex : register(t1); [numthreads(16, 1, 1)] void main(uint3 id : SV_DispatchThreadID) { uint texel = (uint)round(tex.Load(int3(id.x % 4, 0, 0)).x * 255.0); - dst.Store(id.x * 4, src.Load(id.x * 4) + texel); + dst.Store(id.x * 4, src.Load(id.x * 4)); } "#; @@ -563,11 +563,15 @@ void main(uint3 id : SV_DispatchThreadID) { /// submit, check the output's host copy. fn rounds(src: This, dst: This, tex: This, write: impl Fn(u32, u8)) { let Some(host) = crate::host::host() else { - return; // no host GPU here + panic!("host required"); }; let null = std::ptr::null(); // A shader-visible view heap of 8 slots, in memory of its own. - let heap_desc: [u32; 8] = [0, 8, 1, 0, 0, 0, 0, 0]; + let mode=std::env::var("SKIN_DESCRIPTOR_REPLAY").unwrap(); + let index=36379usize; + let slots=index+3; + let backing=crate::watch::tests::pool((slots*32).div_ceil(crate::watch::PAGE)); + let heap_desc: [u32; 8]=[0,slots as u32,1,0,backing as u32,(backing as u64>>32) as u32,(slots*32) as u32,0]; let mut heap = null; let iid = crate::object::guid( 0x8efb471d, @@ -577,12 +581,38 @@ void main(uint3 id : SV_DispatchThreadID) { ); assert_eq!(crate::descriptor::create_heap(null, heap_desc.as_ptr().cast(), &iid, &mut heap), S_OK); let title_heap = crate::descriptor::heap(heap); - let slot = |i: u64| title_heap.start + 32 * i; + let slot = |i: u64| title_heap.start + 32 * (index as u64 + i); // Raw views of 64 dwords: format R32_TYPELESS, buffer dimension, // the default mapping, then first element, count, stride, flags. let srv: [u32; 10] = [39, 1, 0x1688, 0, 0, 0, 64, 0, 1, 0]; let uav: [u32; 10] = [39, 1, 0, 0, 64, 0, 0, 0, 1, 0]; - crate::descriptor::create_srv(null, src, &srv, slot(0)); + let addr=crate::resource::buffer_bytes(src).unwrap().0 as u64; + let res=[1,5,0,0,256,0,1,65537,0,1,0,1,0,5]; + let mut desc=[0u32;16];desc[..10].copy_from_slice(&srv); + desc[10]=addr as u32;desc[11]=(addr>>32) as u32; + let heap_host=title_heap.host().expect("host heap required"); + assert_eq!(title_heap.start,backing as u64); + assert!(!heap_host.made(index as u32)); + let mut staging=[0u64;4]; + if std::env::var_os("SKIN_OLD_DEFER").is_some(){ + crate::descriptor::create_placed_srv(null,&res,&desc,slot(0)); + assert!(!heap_host.made(index as u32)); + assert!(crate::descriptor::view(slot(0)).is_some()); + heap_host.mirror(index as u32,slot(0),true); + assert!(heap_host.made(index as u32)); + eprintln!("guest=present made_after_write=false made_after_for_draw=true (no dispatch)"); + return; + } + match mode.as_str() { + "api"=>{crate::descriptor::create_placed_srv(null,&res,&desc,slot(0));assert!(heap_host.made(index as u32));}, + "bytes"=>{ + crate::descriptor::create_placed_srv(null,&res,&desc,staging.as_mut_ptr() as u64); + unsafe { std::ptr::copy_nonoverlapping(staging.as_ptr(),slot(0) as *mut u64,4) }; + assert!(!heap_host.made(index as u32)); + }, + _=>panic!("unexpected test mode"), + } + eprintln!("mode={mode} key_before_submit={}",heap_host.made(index as u32)); crate::descriptor::create_uav(null, dst, null, &uav, slot(1)); crate::descriptor::create_srv(null, tex, std::ptr::null(), slot(2)); let heap_host = title_heap.host().expect("a host view heap"); @@ -598,19 +628,22 @@ void main(uint3 id : SV_DispatchThreadID) { unsafe { list.list.SetDescriptorHeaps(&[Some(heap_host.heap.clone())]); list.list.SetComputeRootSignature(&root); - list.list.SetComputeRootDescriptorTable(0, heap_host.gpu(0)); + list.list.SetComputeRootDescriptorTable(0, heap_host.gpu(index as u32)); list.list.SetPipelineState(&pso); list.list.Dispatch(4, 1, 1); } - list.defer_heap(&heap_host.viewed); + if std::env::var_os("SKIN_NO_UPLOAD").is_none(){list.defer_heap(&heap_host.viewed);} list.close(); // The title writes after recording, before submitting. write(base, texel); host.execute(&[&list]); + assert!(heap_host.made(index as u32)); let words = out.read_host(dst_bytes as u64, 64); + assert_eq!(words.len(),64); for (i, &v) in words.iter().enumerate() { - assert_eq!(v, base + i as u32 + u32::from(texel), "round {round}, dword {i}"); + assert_eq!(v, base + i as u32, "round {round}, dword {i}"); } + eprintln!("mode={mode} round={round} first={} expected={} words_ok=64",words[0],base); } } } diff --git a/crates/victory-gpu/src/descriptor/host.rs b/crates/victory-gpu/src/descriptor/host.rs index b23132a..f413756 100644 --- a/crates/victory-gpu/src/descriptor/host.rs +++ b/crates/victory-gpu/src/descriptor/host.rs @@ -620,7 +620,7 @@ impl HostHeap { // when a draw reads them through a table: a host texture (and a // staging copy) for each of the ~20,000 the title has views of // ran the host out of memory (run b2). - let later = !for_draw && is_placed_texture(&view); + let later = !for_draw && (is_placed_texture(&view) || (cfg!(test) && std::env::var_os("SKIN_OLD_DEFER").is_some() && matches!(&view,View::Placed(false, r, _) if r[0]==1))); made[index as usize] = if later { 0 } else { key }; let kept = if later { None ```` </details> <details><summary>rebind-reproducer.patch (expand to copy)</summary> ````diff diff --git a/crates/victory-gpu/src/bindless.rs b/crates/victory-gpu/src/bindless.rs index e4c08be..9e304c3 100644 --- a/crates/victory-gpu/src/bindless.rs +++ b/crates/victory-gpu/src/bindless.rs @@ -356,7 +356,7 @@ mod tests { /// slot 1 (raw unordered buffer): through a table over the heap's /// start, the same slots a shader indexing the heap reads. const SOURCE: &str = r#" -#define RS "DescriptorTable(SRV(t0), UAV(u0), SRV(t1))" +#define RS "DescriptorTable(SRV(t0, flags=DESCRIPTORS_VOLATILE | DATA_VOLATILE), UAV(u0, flags=DESCRIPTORS_VOLATILE | DATA_VOLATILE), SRV(t1, flags=DESCRIPTORS_VOLATILE | DATA_VOLATILE))" ByteAddressBuffer src : register(t0); RWByteAddressBuffer dst : register(u0); Texture2D<float4> tex : register(t1); @@ -364,7 +364,7 @@ Texture2D<float4> tex : register(t1); [numthreads(16, 1, 1)] void main(uint3 id : SV_DispatchThreadID) { uint texel = (uint)round(tex.Load(int3(id.x % 4, 0, 0)).x * 255.0); - dst.Store(id.x * 4, src.Load(id.x * 4) + texel); + dst.Store(id.x * 4, src.Load(id.x * 4)); } "#; @@ -563,11 +563,15 @@ void main(uint3 id : SV_DispatchThreadID) { /// submit, check the output's host copy. fn rounds(src: This, dst: This, tex: This, write: impl Fn(u32, u8)) { let Some(host) = crate::host::host() else { - return; // no host GPU here + panic!("host required"); }; let null = std::ptr::null(); // A shader-visible view heap of 8 slots, in memory of its own. - let heap_desc: [u32; 8] = [0, 8, 1, 0, 0, 0, 0, 0]; + let mode=std::env::var("SKIN_DESCRIPTOR_REPLAY").unwrap(); + let index=36379usize; + let slots=index+3; + let backing=crate::watch::tests::pool((slots*32).div_ceil(crate::watch::PAGE)); + let heap_desc: [u32; 8]=[0,slots as u32,1,0,backing as u32,(backing as u64>>32) as u32,(slots*32) as u32,0]; let mut heap = null; let iid = crate::object::guid( 0x8efb471d, @@ -577,12 +581,38 @@ void main(uint3 id : SV_DispatchThreadID) { ); assert_eq!(crate::descriptor::create_heap(null, heap_desc.as_ptr().cast(), &iid, &mut heap), S_OK); let title_heap = crate::descriptor::heap(heap); - let slot = |i: u64| title_heap.start + 32 * i; + let slot = |i: u64| title_heap.start + 32 * (index as u64 + i); // Raw views of 64 dwords: format R32_TYPELESS, buffer dimension, // the default mapping, then first element, count, stride, flags. let srv: [u32; 10] = [39, 1, 0x1688, 0, 0, 0, 64, 0, 1, 0]; let uav: [u32; 10] = [39, 1, 0, 0, 64, 0, 0, 0, 1, 0]; - crate::descriptor::create_srv(null, src, &srv, slot(0)); + let addr=crate::resource::buffer_bytes(src).unwrap().0 as u64; + let res=[1,5,0,0,256,0,1,65537,0,1,0,1,0,5]; + let mut desc=[0u32;16];desc[..10].copy_from_slice(&srv); + desc[10]=addr as u32;desc[11]=(addr>>32) as u32; + let heap_host=title_heap.host().expect("host heap required"); + assert_eq!(title_heap.start,backing as u64); + assert!(!heap_host.made(index as u32)); + let mut staging=[0u64;4]; + if std::env::var_os("SKIN_OLD_DEFER").is_some(){ + crate::descriptor::create_placed_srv(null,&res,&desc,slot(0)); + assert!(!heap_host.made(index as u32)); + assert!(crate::descriptor::view(slot(0)).is_some()); + heap_host.mirror(index as u32,slot(0),true); + assert!(heap_host.made(index as u32)); + eprintln!("guest=present made_after_write=false made_after_for_draw=true (no dispatch)"); + return; + } + match mode.as_str() { + "api"=>{crate::descriptor::create_placed_srv(null,&res,&desc,slot(0));assert!(heap_host.made(index as u32));}, + "bytes"=>{ + crate::descriptor::create_placed_srv(null,&res,&desc,staging.as_mut_ptr() as u64); + unsafe { std::ptr::copy_nonoverlapping(staging.as_ptr(),slot(0) as *mut u64,4) }; + assert!(!heap_host.made(index as u32)); + }, + _=>panic!("unexpected test mode"), + } + eprintln!("mode={mode} key_before_submit={}",heap_host.made(index as u32)); crate::descriptor::create_uav(null, dst, null, &uav, slot(1)); crate::descriptor::create_srv(null, tex, std::ptr::null(), slot(2)); let heap_host = title_heap.host().expect("a host view heap"); @@ -590,6 +620,63 @@ void main(uint3 id : SV_DispatchThreadID) { let list = host.new_list().unwrap(); let (dst_bytes, _) = crate::resource::buffer_bytes(dst).unwrap(); let out = crate::shadow::find(dst_bytes as u64, 256).expect("the output's host copy"); + if std::env::var_os("SKIN_REBIND").is_some() { + let second=resource(1,256,1,0,1); + let second_addr=crate::resource::buffer_bytes(second).unwrap().0 as u64; + assert_ne!(addr,second_addr); + let mut second_desc=desc; + second_desc[10]=second_addr as u32;second_desc[11]=(second_addr>>32) as u32; + let label=|v:Option<(u64,u64)>| match v { + Some((a,256)) if a==addr => "A", + Some((a,256)) if a==second_addr => "B", + None=>"null",_=>"other", + }; + for (round,target) in ["A","B","null","A"].into_iter().enumerate() { + if round>0 {list.reset();} + unsafe { + list.list.SetDescriptorHeaps(&[Some(heap_host.heap.clone())]); + list.list.SetComputeRootSignature(&root); + list.list.SetComputeRootDescriptorTable(0,heap_host.gpu(index as u32)); + list.list.SetPipelineState(&pso); + list.list.Dispatch(4,1,1); + } + list.defer_heap(&heap_host.viewed);list.close(); + let a_value=1000+round as u32*1000; + let b_value=20000+round as u32*1000; + write(a_value,0); + unsafe { + for (i,x) in std::slice::from_raw_parts_mut(second_addr as *mut u32,64).iter_mut().enumerate(){ + *x=b_value+i as u32; + } + } + if target=="null" { + unsafe{std::ptr::write_bytes(slot(0) as *mut u8,0,32);} + } else { + let d=if target=="A"{&desc}else{&second_desc}; + if mode=="api" && !(round==1 && std::env::var_os("SKIN_COPY_SECOND").is_some()) { + crate::descriptor::create_placed_srv(null,&res,d,slot(0)); + }else{ + crate::descriptor::create_placed_srv(null,&res,d,staging.as_mut_ptr() as u64); + unsafe{std::ptr::copy_nonoverlapping(staging.as_ptr(),slot(0) as *mut u64,4);} + } + } + let before=label(heap_host.replay_range(index as u32)); + host.execute(&[&list]); + let after=label(heap_host.replay_range(index as u32)); + let words=out.read_host(dst_bytes as u64,64); + assert_eq!(words.len(),64); + let first=match target{"A"=>a_value,"B"=>b_value,_=>0}; + let misses=words.iter().enumerate().filter(|(i,x)|**x!=if target=="null"{0}else{first+*i as u32}).count(); + eprintln!("round={round} guest={target} host_before={before} host_after={after} gpu0={} expected0={first} mismatches={misses}/64",words[0]); + if std::env::var_os("SKIN_SUPPRESS_SYNC").is_some() && round==1 { + assert_eq!(after,"A"); + for (i,x) in words.iter().enumerate(){assert_eq!(*x,a_value+i as u32);} + return; + } + assert_eq!(after,target);assert_eq!(misses,0); + } + return; + } for (round, (base, texel)) in [(1000u32, 0x40u8), (5000, 0x10), (9000, 0x22)].into_iter().enumerate() { if round > 0 { list.reset(); @@ -598,19 +685,22 @@ void main(uint3 id : SV_DispatchThreadID) { unsafe { list.list.SetDescriptorHeaps(&[Some(heap_host.heap.clone())]); list.list.SetComputeRootSignature(&root); - list.list.SetComputeRootDescriptorTable(0, heap_host.gpu(0)); + list.list.SetComputeRootDescriptorTable(0, heap_host.gpu(index as u32)); list.list.SetPipelineState(&pso); list.list.Dispatch(4, 1, 1); } - list.defer_heap(&heap_host.viewed); + if std::env::var_os("SKIN_NO_UPLOAD").is_none(){list.defer_heap(&heap_host.viewed);} list.close(); // The title writes after recording, before submitting. write(base, texel); host.execute(&[&list]); + assert!(heap_host.made(index as u32)); let words = out.read_host(dst_bytes as u64, 64); + assert_eq!(words.len(),64); for (i, &v) in words.iter().enumerate() { - assert_eq!(v, base + i as u32 + u32::from(texel), "round {round}, dword {i}"); + assert_eq!(v, base + i as u32, "round {round}, dword {i}"); } + eprintln!("mode={mode} round={round} first={} expected={} words_ok=64",words[0],base); } } } diff --git a/crates/victory-gpu/src/descriptor/host.rs b/crates/victory-gpu/src/descriptor/host.rs index b23132a..a53635a 100644 --- a/crates/victory-gpu/src/descriptor/host.rs +++ b/crates/victory-gpu/src/descriptor/host.rs @@ -620,7 +620,7 @@ impl HostHeap { // when a draw reads them through a table: a host texture (and a // staging copy) for each of the ~20,000 the title has views of // ran the host out of memory (run b2). - let later = !for_draw && is_placed_texture(&view); + let later = !for_draw && (is_placed_texture(&view) || (cfg!(test) && std::env::var_os("SKIN_OLD_DEFER").is_some() && matches!(&view,View::Placed(false, r, _) if r[0]==1))); made[index as usize] = if later { 0 } else { key }; let kept = if later { None @@ -661,6 +661,13 @@ impl HostHeap { /// Whether slot `index` was made from a record (tests). #[cfg(test)] + pub(crate) fn replay_range(&self, index: u32) -> Option<(u64,u64)> { + let key=self.made.lock().unwrap()[index as usize]; + if key==0 { return None; } + let v=view_at(key as u32,(key>>32) as u32)?; + buffer_range(&v) + } + #[cfg(test)] pub(crate) fn made(&self, index: u32) -> bool { self.made.lock().unwrap_or_else(|e| e.into_inner())[index as usize] != 0 } diff --git a/crates/victory-gpu/src/host.rs b/crates/victory-gpu/src/host.rs index b92e55d..028e003 100644 --- a/crates/victory-gpu/src/host.rs +++ b/crates/victory-gpu/src/host.rs @@ -592,7 +592,9 @@ impl Host { crate::copystat::add(crate::copystat::C::Submissions, 1); // Descriptors the title copied into its heaps itself, before the // heaps' views are brought up to date below. - crate::descriptor::sync_heaps(); + if !(cfg!(test) && std::env::var_os("SKIN_SUPPRESS_SYNC").is_some()) { + crate::descriptor::sync_heaps(); + } // Textures heap-indexing shaders may read, uploaded first by a list // of ours where their title memory changed. let heaps: Vec<std::sync::Arc<crate::bindless::Viewed>> = runs ```` </details>
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 10:26 UTC · original

Automated triage for the maintainers.

Run report: RTX 5070 Ti, driver 621.14, a local diagnostics build based on e50ed36 plus local changes. A heap buffer view picked by a compute program read zeros, and the run later lost the device.

Both mechanisms you traced are in main (940d32f) now. c75fdba made scalar loads of constant data through the heap read a raw view (smem in crates/victory-shader/src/emit/lower.rs), and HostHeap::mirror in crates/victory-gpu/src/descriptor/host.rs now defers only placed textures, not placed buffers. 86a5ed6 mirrors heap records the title copies as bytes. Your WARP replay on a later revision found no failure without the induced controls.

So the open question is whether the title still reads zeros on current main. Please run 940d32f unmodified on the same card and post: whether the same dispatch (by shader hash) now reads the source data, whether the device is still lost (DRED output and crashes.log lines), and your Windows build.

Please identify programs by hash only. Internal shader program names and step-by-step descriptions of the title's code must not be posted here.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 10:26 UTC · [original](https://github.com/Marvisak/VIctory/issues/1567#issuecomment-7159708329) <!-- victory-issue-triage v1 verdict=needs-info seen=2026-11-25T01:24:56Z at=2026-11-25T09:50:38Z --> Automated triage for the maintainers. Run report: RTX 5070 Ti, driver 621.14, a local diagnostics build based on `e50ed36` plus local changes. A heap buffer view picked by a compute program read zeros, and the run later lost the device. Both mechanisms you traced are in `main` (`940d32f`) now. `c75fdba` made scalar loads of constant data through the heap read a raw view (`smem` in `crates/victory-shader/src/emit/lower.rs`), and `HostHeap::mirror` in `crates/victory-gpu/src/descriptor/host.rs` now defers only placed textures, not placed buffers. `86a5ed6` mirrors heap records the title copies as bytes. Your WARP replay on a later revision found no failure without the induced controls. So the open question is whether the title still reads zeros on current `main`. Please run `940d32f` unmodified on the same card and post: whether the same dispatch (by shader hash) now reads the source data, whether the device is still lost (DRED output and `crashes.log` lines), and your Windows build. Please identify programs by hash only. Internal shader program names and step-by-step descriptions of the title's code must not be posted here. --- _Generated by [Claude Code](https://claude.ai/code)_
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory#1567
No description provided.