Structured buffers: runtime stride channel (design + anchors) #155
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#155
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@zebraso on GitHub · 2026-11-24 01:00 UTC · original
Structured-buffer accesses whose stride the shader analysis loses (
buffer_load_dword ... idxen,buffer_store_dword ... idxen, atomics) currently fail translation (a structured buffer of unknown stride, 36 programs in the world run) or, underVICTORY_LOOSE_BUFFERS, read the wrong element (raw view at the instruction offset).The descriptor's stride is known at bind time (
D3D12_BUFFER_SRV.StructureByteStride, parsed today bydescriptor/host.rs's element()) but there is no channel to the shader: the console S# is virtualized into a heap handle, so the emitted DXIL cannot computeindex * stride.Design (full note + anchors in
docs/runtime-stride.mdon branchsync):victory-shader: a stride-table root SRV (t0, space STRIDE_SPACE), one dword per host view-heap slot; at the three "unknown stride" sites emitslot = heap_index(load, first),stride = rawBufferLoad(table, slot * 4),address = index * stride + off.HostShadergains the table as a root SRV.signature.rs/pipeline/host.rs: declare and bind the table.descriptor/host.rs/draw.rs: keepslot -> StructureByteStridein sync with the heap (4 bytes per slot) and write it when a view is placed.Success criterion: the 36
unknown stridetranslations disappear, and the AMD iGPU world run (VICTORY_D3D12_ADAPTER=amd,VICTORY_D3D12_DRED=1) no longer faults at0x3598000(or the fault moves to the next producer).Context: on the iGPU the world reaches 1178 draws/frame with native wave64 (
host wave lanes min=32 max=64, compute refusals 0) and then faults withpage fault at 0x3598000and NaN CBV constants — the garbage comes from the passes whose shaders are dropped. On NVIDIA the same garbage ends inDEVICE_HUNG(see #71).@Mesrine67 on GitHub · 2026-11-24 01:21 UTC · original
Rechecked against the current upstream
main(d2a4bae) using the local game shader archive andtranslate --validate --jobs 8(CPU-only; no game executable or GPU pipeline was launched). This run found 26,503 containers / 26,084 programs, emitted 22,156 DXIL containers, and validated 21,971.The refusal
a structured buffer of unknown strideaccounts for 117 programs in this archive. The three refusal sites are incrates/victory-shader/src/emit/lower.rsaround lines 5908, 5991, and 6052. The descriptor index flows throughheap_index; host heap mirroring is incrates/victory-gpu/src/descriptor/host.rs::HostHeap::mirror, andcrates/victory-gpu/src/draw.rs::State::tablescan remap descriptor tables into dynamic slots.This gives an up-to-date corpus check for the proposed runtime stride channel. I am checking the raw-view and dynamic-slot semantics before sending an implementation PR, so the extra byte-address calculation does not silently change how structured, typed, or raw descriptors are interpreted.
@zebraso on GitHub · 2026-11-24 02:58 UTC · original
Regression found while running the retail title on NVIDIA (RTX 5080, driver 32.0.16.1714):
syncat3258644, upstream maind2a4baemerged;DEVICE_HUNG, DRED stops atdispatch 128x64x1 [compute 42683eebec081520], right after atexture upload (
128x72x1 f41 mips 7);VICTORY_STRIDE_TABLE=0reaches the intro cutscene (text, ~1 fps in theworld-load, 4032 draws/frame, 942 dropped) and does not crash there;
bef8bde) behaves likeVICTORY_STRIDE_TABLE=0(cutscene).So the table itself (or the
t0, space 2root SRV binding it adds) is what kills the loadingscreen. Verified the benefit is real though: with the table on,
a structured buffer of unknown stridedisappears from the log (was 36 programs).Repro:
VICTORY_D3D12_ADAPTERunset,VICTORY_D3D12_DRED=1,target\release\victory.exe run C:\GTA6\GTA6.Xbox.v1.0.2.1-CYBERLEEK\game_scarlett_master.exe --execute.@Marvisak on GitHub · 2026-11-25 01:46 UTC · original
Automated triage for the maintainers.
Part of this design is now in
main. Commit0b35b7f("... bindless strides", 2026-11-24) added a per-slot view-stride table,VIEW_STRIDES.crates/victory-gpu/src/descriptor/host.rskeeps the table anddraw.rsbinds it as a root SRV. Incrates/victory-shader/src/emit/lower.rs,Lower::view_strideandLower::stride_atread it, so a heap-indexed buffer load by element (buffer, theused.is_none() && !typedcase) now computes element × stride from the host's table. Indexed stores and atomics still stop with "a structured buffer of unknown stride" when the resource tracking has no stride for them (thestride < 4checks in the store and atomic paths). That remainder is what is left of this request.The implementation here is on a fork branch (
sync). Pull requests are open to everyone, so please open one against the currentmainfor the part that is still missing. Rebase it onto the table that is already there, and include the loading-screenDEVICE_HUNGyou saw with the table on, so that can be reviewed together. Whether the remaining store and atomic sites should use the table is for the maintainers to decide.Generated by Claude Code