Shaders, GPU: unknown-stride buffers are read through a raw view of the same bytes (stacked on #193) #704
No reviewers
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!704
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/704/head"
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?
@r4tedx on GitHub · 2026-11-24 07:07 UTC · original
r4tedx:shader/unknown-stride-view-kinds→main· +1921 −77 · 12 files · 13 commits · closed without mergingCurrent head
1f3c184, integrated withmainatffe310e.1f3c184makes the three unknown-stride GPU tests take the shared one-at-a-time lock. Without it,VICTORY_WARP=1 cargo test -p victory-shader --libcrashed with an access violation in 2 of 4 local runs, as CI did on505d5b1. With it, 6 of 6 runs passed.505d5b1is the same tree as7f77cca, re-authored with the GitHub no-reply address. When a waterfall descriptor load selects a different raw alias per lane, the generated heap handle now carries the nonuniform flag. The stride table on this branch still uses register space 2. Downstream stacks that also use space 2 for root addresses need the remapping described in the comments. Local Windows verification:cargo test --workspace --locked(348 passed, 6 ignored) and all-target, all-feature Clippy with warnings denied. No title run for this update. AI-assisted (Codex).Stacked on #193 (its head
4322b61, merged withmaind2a4bae). Five commits on top are the change:fc07d59,5708fa1,30a93f9, and4e03086andfb8ea43by MichaelSmithAI (a release-order fix and its test, below). If #193 is merged first this rebases to those five; its author is welcome to take them into #193 instead.Merged with
main7374bfb(headd5b23e1, 2026-11-24). #336 landed and conflicted with #193 and this branch inHostHeap::new:mainnow tries the heap withDYNAMICdynamic slots, thenMIN_DYNAMIC, then capped. The merge keeps that and asks for the alias (raw-view) slots on top in each attempt; the capped count leaves room for them. It is a merge commit so #193's commits keep their ids. Atd5b23e1:cargo test -p victory-gpu50 passed, 1 ignored;cargo test -p victory-shader82 passed, 1 ignored (RTX 5070). Not exercised: theMIN_DYNAMICand capped paths, which need a title-sized heap.What
#193 lets a program whose structured buffer has no stride known at translation read it through a raw (
ByteAddressBuffer) handle, at a byte offset computed from a run-time stride table. Four reviewers showed that this returns wrong data on NVIDIA whenever the heap slot holds a structured or typed view, which is what a title's structured buffer is: the raw handle resolves to the view the title made, not to a raw view.This PR makes the read go through a raw view of the same bytes, so the handle's kind always matches the view it resolves to.
StrideEntry): the stride, then the heap slot that holds a raw view of the same bytes (plus one; 0 means the slot itself is raw), with a 4-bit byte bias on top.index * stride + offset + bias. Loads, stores and atomics share the path.HostHeapmakes a structured or typed buffer view (SRV or UAV), it also makes a raw view of the same bytes in a pool of 65,536 slots after the dynamic ones, and writes the entry. Raw views keep their own slot. Remaking a slot reuses its pool slot; a null, raw or constant view, or a released dynamic slot, returns it. The entry is written wherever the slot's descriptor is written, so it is as current as the descriptor.4e03086, from r4tedx/VIctory#7): when a list gives its dynamic slots back, their table entries and raw views are cleared before the slots are marked free.30a93f9did it the other way round, in two separate lock scopes, so another list could lease a slot, write its entry, and have it wiped by the retiring list.fb8ea43(from r4tedx/VIctory#8) tests it without a scheduler race: it leases the whole dynamic pool, then asks the allocator for a slot at the start of the last slot's cleanup, which must fail until the cleanup is done. With the old order restored the test fails here (the slot is leased during cleanup); with the fix it passes.Why not pick the handle kind in the shader
That was the first design tried, and it does not hold. Probed here with
dxil.dllvalidating, on a buffer whose dword i holds 100 + i:0the reviewers reported.Values loaded:
[index 2, offset 4]"Before" is #193's lowering with only the view changed. Stores and atomics through a UAV of each kind were already right on all three adapters and still are; they are now asserted. The Radeon column comes from a local patch that runs the tests on every adapter; this base has no adapter switch, so it is not in the commits.
Measured on the title's shaders (by a tester)
iurysf ran
victory translate --list --validateover the title'sshaders.rpfand executable (26,096 programs, dxil.dll 1.9.2602.17),mainc2e7254against this branch, program by program (comment): translation failures 3,734 to 3,663. All 71a structured buffer of unknown strideprograms translate; 70 validate, and one compute module is rejected withincompatible with the shader stage, the implicit-derivative case #306 fixes. No program that emitted or validated onmaingets worse. This counts translation only: it says nothing about what the programs read when they run.elamriz ran an in-game A/B on an RTX 4070 Ti (driver 621.14), comparing #439
c153b21+ #322 with and without this PR's delta at7f77cca, under D3D12 Debug and DRED (comment). With the baseline, all seven compute producers from their #638 report stopped on the unknown-stride refusal. With this PR, all seven loggedshader translated. Both runs ended inDEVICE_HUNGinsideDispatchMesh, as the baseline did. This verifies translation only. What the programs read is still unverified.On h0useadv's #293 stack (
ffe310e+ #180 + the lane-mask branch + #305 + #160), this PR adds 116 validated programs (113 compute) and loses none.a structured buffer of unknown stridegoes from 174 to 0. This was an offline census of the title'sshaders.rpfwith local title data. The merged branch istesters/293-stack-with-704(comment).Cecerw ran
cargo test --workspaceon an RTX 3060 Ti at1f3c184: 348 passed, 0 failed, 6 ignored, against 342 / 0 / 6 onmain(comment). bittertea0323's offline count onffe310efounda structured buffer of unknown stride148 → 0 and +39 programs emitting DXIL, 36 of them compute.NuraadGit ran 12-minute title runs on an RTX 2080 (JMAN730's fork + #493 + #189 + #206 + #667; three runs without this PR, one with it) (comment). Title memory copied per frame was 203 MB with this PR against 215–238 MB without it. Draws and dispatches dropped for lack of a host pipeline fell from 845–891 to 704 per frame, and programs refused from 383–390 to 343. Frame time was 7–11% higher in the one run with it. The four instance-culling programs stay refused in that stack (by #189), so this doesn't measure their bindings.
justlovett0 checked it on an RTX 3080 (Windows 10, driver 621.24) with and without the raw-alias slots (comment, details on #193). Without them, #193's
ByteAddressBufferreads return 0 against structured host views. With them, the unknown-stride class is gone at runtime.Slots reached only by a run-time index (below) have a follow-up branch that is not part of this PR:
gpu/run-time-indexed-views.Not verified, and what this does not fix
make's shadow and skipping unchanged aliases would remove most of it (details).d5b23e1) onto the tester tree at update 5 plus fork PR #10 and ran it in the title on an RTX 5060 Ti (comment). All four runtime-identified instance-culling programs translated and got host pipelines, and the device then hung on a compute dispatch after 111 s. The same tree without this PR has run 10+ minutes on other cards. That is one run, on another card and heap layout, and from before #193's zero-element guard, so it does not show that this PR causes a hang. A run withVICTORY_SKIP_PIPELINESset to those four hashes would separate it. Until then, translating these programs should not be read as their running correctly. notquiteog later skipped producers one at a time on the tester tree's update 9 (RTX 5060 Ti) (comment). TheDEVICE_HUNGmoved to the next of the seven producers each time, always a ~5 s single-list compute submission with the same root layout. So the hang follows what that family shares, such as a buffer it reads or a slot reached only by a run-time index, not one program's code.HostHeap::mirrormakes buffer views only for draws, that is, for slots a dispatch names through its tables. A buffer view the title writes into a slot that a shader reaches only through an index it loads at run time stays a null view with a zero entry, and its data is not refreshed (shadow.rssays so in ashortcut:). That is the state ofmain, not something this PR changes, and it matters: testers report that the instance-culling compute programs behind the world's geometry pick their structured buffer exactly that way. This PR is necessary for them, not sufficient.a structured buffer of unknown stride117 → 0, 71 programs translating (EduAzevedo); the lowering here refuses nothing #193 accepted, as far as the tests show.1f3c184: victory-shader 124 passed and victory-gpu 55 passed, includingraw_view_tests, with no debug-layer errors or warnings (comment). Not exercised: GPU-based validation; views on buffer resource objects (the GPU test uses placed views); pool exhaustion; a view that starts off a dword of its host copy; a heap capped at 1,000,000 views (the pool takes 65,536 more slots there); stages other than compute; the cost of one more table read per access and one more view per structured or typed buffer view.draw.rsstill logs and continues when the table cannot be bound, as in #193.shortcut:comments added: an access whose offset plus width passes the element's end reaches the next element, where the console reads zeros; the pool size is a guess, and views beyond it read zeros with a one-time warning; a view starting off a dword gets a null raw view; the raw view starts up to 12 bytes early and ends on the dword holding the last byte.Tested
Windows 11, NVIDIA RTX 5070 and WARP, hand-assembled programs only:
structured_buffer_unknown_stride_uses_runtime_stride_table(#193's test, rewritten): raw, structured 12 / 16 / 20 and typed views in the slot each load the expected value, on the hardware adapter and WARP; stores and atomics through UAVs of each kind. With the raw views switched off it fails on the RTX 5070 with 121 for 107.unknown_stride_views_chosen_by_a_loaded_heap_index: the heap slot is loaded from a buffer per thread group, with a 12-byte structured view in one slot and a 16-byte one in the other; each group's lanes read the bytes of the view their group chose, and a lane past the chosen view's elements reads zero.unknown_stride_descriptor_chosen_by_control_flow, and unit tests of the entry and window arithmetic.victory-gpu:unknown_stride_reads_reach_the_bytes_of_the_view_in_the_slotmakes placed structured, typed and raw views in a realHostHeap, runs the translated run-time-index program on it, and rebinds slots.cargo test -p victory-shader: 73 passed.cargo test -p victory-gpu: 44 passed, 1 ignored. In full-workspace runsframe::tests::waits_end_on_ticks_and_count_frames, a frame-clock timing test this PR does not touch, fails intermittently here; it also fails on plainmainin full runs and passes alone.cargo clippy -p victory-shader -p victory-gpu --all-targets: one warning, invictory-gpu/src/host.rs, which is onmain.cargo xtask policy: ok.AI-assisted.
🤖 Generated with Claude Code
7374bfb) into shader/unknown-stride-view-kinds d5b23e13df8e79c80) into shader/unknown-stride-view-kinds dbda4caedff99b792) into shader/unknown-stride-view-kinds 42538cdec9@iurysf on GitHub · 2026-11-24 08:16 UTC · original
Measured offline against main
c2e7254withvictory translate --list --validateover the title'sshaders.rpf+ executable (26,096 programs), dxil.dll 1.9.2602.17, comparing outcomes program by program (this branch carries #193):dx.valvercase that #306 fixes.AI-assisted.
@LAKSHYA-cmd-tech on GitHub · 2026-11-24 08:24 UTC · original
Re:
We investigated the resulting GPU hangs in #619 and #625 (where pixel shaders \633c1f8872ed8c6d\ and \ef9b757c9c1e4b26\ hit [heap 330192: null]\ via dynamically indexed root constants \u8 = 0xa13a00).
We have solved this in branch \ix/mirror-buffer-views-for-dynamic-indexing:
In \crates/victory-gpu/src/descriptor/host.rs, removing the artificial \let later = !for_draw && view.is_buffer();\ deferral allows \mirror()\ to immediately mirror buffer views upon creation whenever their host shadow buffer is available (falling back to
ull_for\ and setting \made[index] = 0\ only when unbacked for subsequent draw-time retry).
Combined with your raw-view aliasing for unknown strides in this PR, dynamically indexed structured buffer loads will resolve to valid descriptors rather than null slots!
@r4tedx on GitHub · 2026-11-24 08:30 UTC · original
@iurysf thank you, that is the first count of this branch over the title's shaders: all 71
a structured buffer of unknown strideprograms translate, 70 validate, the one that does not is #306'sdx.valvercase, and nothing that emitted or validated onmaingets worse. I have put it in the description with your name.@LAKSHYA-cmd-tech thank you for following the null slot down to
mirror. Onfix/mirror-buffer-views-for-dynamic-indexing(c6020d4), from reading it; I have not built or run it:What it fixes: the slot no longer holds a null view, which is the
[heap 330192: null]you saw.What it leaves, as far as I can read
main:shadow.rssays so at its top: "buffers read through directly indexed heaps keep what their first use copied". So the view is valid, but once the title rewrites the buffer the shader reads the old bytes.Your test covers the null fallback (a view of a null resource); it does not yet show a buffer read through such a slot.
There is a branch for this gap on top of this PR:
gpu/run-time-indexed-views, head1d946e8, two commits ond5b23e1. It is not part of this PR; new upstream PRs are closed for now and I would rather not grow this one with something unmeasured in the title.[0, 0, 0, 0, 0, 0, 0, 0]where[110, 113, 116, 0, 209, 213, 217, 221]is expected).cargo test -p victory-gpu: 53 passed, 1 ignored;-p victory-shader: 82 passed, 1 ignored.If you can run the title with diagnostics, the useful numbers would be, for
main+ this PR against the same with that branch: frame time, and the heap lines for633c1f8872ed8c6dandef9b757c9c1e4b26(null or not). If your simpler change measures as correct for those two shaders and cheaper, that is worth knowing too; the three points above are from reading, not from a run.The title was not used in these tests. AI-assisted.
@walterwallaceson on GitHub · 2026-11-24 09:12 UTC · original
Tested this branch (
d5b23e1) in the title on Windows 10, RTX 3070, merged into a local stack that also carries #439, #483 and #688. Two things came up, one of them a crash this branch exposes.A buffer view of zero elements removes the device. About a minute in, still in the loading screens, the device was removed with
DXGI_ERROR_INVALID_CALL(0x887A0001). With the debug layer and DRED on, the only error before the removal wasCreateUnorderedAccessViewrefusing a structured buffer view withNumElements0 (stride 16). That run lasted about 100 ms past the error. It never happened in my earlier runs without this branch, so I think it comes from programs that were refused before (the 71 unknown-stride ones) and now run, so their views get made.A guard in
buffer_uavandbuffer_srv(descriptor/host.rs) fixed it here: a view of no elements becomes a null view, which reads zeros:(same in
buffer_srv; returningNonemakes the caller usenull_for). With it, the debug layer reported no errors, and the warning fired once per run.Results with the guard:
VICTORY_SHADER_LOOP_LIMIT, the next failure was a TDR (DXGI_ERROR_DEVICE_HUNG) after an 11.7 s submission at the switch from loading to the world, which looks like a never-ending loop in one of the newly running programs.VICTORY_SHADER_LOOP_LIMIT=4096, it ran 20 minutes with no crash and reached player control. It ran at about 1 fps, the longest submission was 681 ms, and no descriptor slots ran out. The world is still blank: near-white now, where it was flat grey before this branch. That fits your note that this is necessary but not sufficient.A merge note with #483: #483's guard slot and this branch's alias pool both start at
count + dynamic. I put the alias pool after the guard (alias_base: count + extra + guard, heap sizecount + extra + guard + aliases), and the raw-view retirement test then needs its capacity taken fromguard_slot() - count(). All of victory-gpu's tests pass with that, including the raw-view tests, on the RTX 3070.I haven't tried
gpu/run-time-indexed-viewsyet.I'm testing with Claude's help, and Claude drafted this comment.
@slint6614-dev on GitHub · 2026-11-24 09:30 UTC · original
Measured on the full retail shader pack (26,503 containers) with
victory translate --validate --pipelines(pipelines on an AMD RX 9070, Windows 11, dxil.dll from SDK 10.0.26100). Counts are emitted / validated / pipelines. Merged locally with current mainc7a5f49first (main: VS/PS 12224 / 12148, CS 1440 / 1417, MS 8163 / 8101).@SkillIssueXO on GitHub · 2026-11-24 09:32 UTC · original
Native Windows title run on RTX 5070 Ti (621.24), Windows 11 26300.9974, Series S mode, diagnostics build, cold cache and default loop limit.
The comparison held
main8e79c80, #43960a126a, #493c48b240, #20605981ddand both #431 commits through23ced70fixed. Before #704, the four culling shaders discussed in #71 all bound in the first scene and failed translation witha structured buffer of unknown stride.Adding #704
42538cd(includes #193f99b792) gave all four afirst bind,shader translated, and D3D12host pipelineline during the live run:fdd56d97a806bcca,17af15c4015cb4b6,55679a0547649d0b,89d08e561897d4e5. None logged a translation failure or host refusal. Frame 1400 was visually dark and its presented capture matched the control byte for byte. The memory guard stopped the run after 67.6 s of world FPS samples at 0.7–1.5 fps.The local merge kept #206’s misaligned raw fallback and applied #193’s nonempty view clamp after resolving the host stride and first element. I also updated the raw-view fixture to pass
Target::ANYto #439’s emitter API. The GPU test suite passed 59 tests with one ignored, including raw-view reads, slot retirement, and the merged bounds check.One run per build. This confirms D3D12 pipeline creation for the four live bindings. Their output data was not checked. AI-assisted (Codex, with Claude checking current heads and test overlap).
@Exorion1er on GitHub · 2026-11-24 09:34 UTC · original
A Linux data point to go with the two above: RX 9070 XT (RDNA4), Mesa 26.2.7 RADV, GE-Proton11-12's Wine, vkd3d-proton 3.2.0. Diagnostics build of this PR at
d5b23e1(before42538cd) onmain58fed37+ #190, #454, #493, #579, #591 and #638, compared with the same stack without it, in short runs into the first mission:f26targetAs on the 5070 Ti, the four culling programs from #71 translate. Here, though, one
f26target that was empty gets written.Merge note: with #190 this conflicts in
emit/shader.rs, where both add a root view kind (root_uavsandstride_table) to the same struct, constructor and handle helpers. Keeping both sides works: the stride table goes into the SRV list inSTRIDE_SPACEand the root UAVs into the UAV list, and the result builds and runs.Counts only. AI-assisted (Claude Code).
@walterwallaceson on GitHub · 2026-11-24 09:40 UTC · original
A correction and a follow-up to my comment above.
Correction: I tested
d5b23e1. The new head42538cdbrings in #193'sf99b792, which already clampsNumElementsto what is left of the buffer and returnsNoneat zero inbuffer_srvandbuffer_uav. That covers the zero-element crash I reported, so my local guard isn't needed on top of it. Sorry for the noise.gpu/run-time-indexed-views(1d946e8) in the title. Same machine and stack as above (Windows 10, RTX 3070, with #439, #483 and #688), diagnostics build,VICTORY_SHADER_LOOP_LIMIT=4096, no debug layer. I compared it with a run ofd5b23e1alone under the same settings.d5b23e1)Nearly all of the extra time is in the copies. Keeping the run-time-picked views current seems to re-upload whole buffers every frame, about 50 times the data of
d5b23e1alone. Draws per frame stay about the same (about 2,000).Once-warnings that appeared only with the branch:
no free dynamic descriptor slots: a table is not made(n=4), once, about a minute in. Our heap is capped at 1,000,000 views, and the alias pool comes out of the same cap.unordered access views picked at run time too big to copy back to title memory(views=16).a buffer view off the dwords of its host copy has no raw view, once.No device removal and no debug-layer run this time. I'm happy to run it again with the debug layer or DRED, or on a newer head of the branch.
I'm testing with Claude's help, and Claude drafted this comment.
@dcastell1 on GitHub · 2026-11-24 09:58 UTC · original
Verified on native Windows, no Wine: NVIDIA GeForce RTX 5090 (driver 621.24), Windows 11 10.0.26300, Rust 1.98.1, MSVC 14.44.35207, debug build.
main@8e79c80baseline on this box: 311 passed, 0 failed, 6 ignored.With this PR at
42538cdeapplied clean (patch -p1, no fuzz):Six more passing tests than the baseline; nothing else in the workspace changes verdict.
Tree restored afterwards (full diff against a clean checkout); no game data, the tests are synthetic. AI-assisted (opencode): applied the patch to a built tree, ran
cargo test --workspace, reverted it.@MartinIndra02 on GitHub · 2026-11-24 10:37 UTC · original
Second Ampere A/B data point for
d5b23e1in the title (opening world load, noVICTORY_SHADER_LOOP_LIMIT), confirming @walterwallaceson's RTX 3070 observation:621.24), Ryzen 7 5800X3D, 32 GB RAM, Rust 1.98.1, diag build,VICTORY_D3D12_DRED=1.d5b23e1alone:victory-shader82 passed, 0 failed (1 ignored);victory-gpu50 passed, 0 failed (1 ignored), includingunknown_stride_reads_reach_the_bytes_of_the_view_in_the_slotandretiring_slot_is_unavailable_until_its_alias_is_cleared.#439+#55+#688+#635+#89):#704#704(d5b23e1)host pipeline refusedno dynamic slotsslow host submission0x887A0006(DEVICE_HUNG, 30 lists, no page fault)0x887A0006(DEVICE_HUNG, 5 lists, no page fault)Note:
#635was in the stack, so zero-element buffer views were already guarded (0DXGI_ERROR_INVALID_CALLremovals).No game data. AI-assisted; all builds and runs executed on my machine.
@LAKSHYA-cmd-tech on GitHub · 2026-11-24 10:54 UTC · original
Verified and merged downstream in https://github.com/LAKSHYA-cmd-tech/VIctory/pull/6.
Key integration notes:
@r4tedx on GitHub · 2026-11-24 11:10 UTC · original
@MartinIndra02, both sides of your A/B still hit
DEVICE_HUNG, even with fewer slow submissions on the patched stack. I’m treating those as separate outcomes. @LAKSHYA-cmd-tech, thanks for flagging the register-space collision when stacking the root-address work. I’ve recorded your downstream remapping in the description. The updated upstream PR head is7f77cca. Its verified change is in descriptor translation and integration withmain. The latest workspace run here was synthetic.AI-assisted (Codex).
@dcastell1 on GitHub · 2026-11-24 11:38 UTC · original
Re-verified on the new head
7f77ccad(based onffe310e); this supersedes my note on42538cde, which was measured on8e79c80:Six more passing tests than main, nothing else changes verdict.
Environment: Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.98.1, MSVC 14.44.35207, debug. AI-assisted (opencode).
@elamriz on GitHub · 2026-11-24 12:33 UTC · original
Tested
7f77ccaon RTX 4070 Ti (Windows D3D12, driver 621.14) using this A/B: #439c153b21+ #322b58d198, then the same build plus the #704 delta fromffe310eto7f77cca. Both used D3D12 Debug and DRED, fresh caches and the same scripted input in an offline AppContainer.All seven dropped compute producers previously identified in my #638 report hit unknown structured-buffer stride with the baseline. With #704 added, all seven explicitly logged
shader translated:1c4b3c0547e3e6fa,17af15c4015cb4b6,fdd56d97a806bcca,55679a0547649d0b,89d08e561897d4e5,9209777e8face9dd,42f717f1b4d18e94. This verifies translation, with runtime buffer contents still unverified.The combined build showed the mission title card. Both runs still ended in DEVICE_HUNG with DRED inside DispatchMesh (532/696 baseline, 116/747 with #704). One run per configuration. AI-assisted testing. No raw logs or title files attached.
@r4tedx on GitHub · 2026-11-24 13:37 UTC · original
@elamriz, thanks for the A/B on the RTX 4070 Ti. All seven producers from your #638 report went from the unknown-stride refusal to
shader translated. Those are runtime programs, and an offline census of the shader pack can't show them, so this is coverage I didn't have. I've added it to the PR description.On the hang: both configurations ended in
DEVICE_HUNGinsideDispatchMesh, and the baseline already hung there without #704. So this run doesn't point at #704 as the cause. With one run per configuration, I'm not reading anything into the different positions (532/696 vs 116/747).What it doesn't settle is whether those seven programs now read the right data. One gap is already known. A slot that a shader reaches only through an index it loads at run time still holds a null view, because
HostHeap::mirroronly makes buffer views for slots a dispatch names through its tables. Instance-culling compute has been reported to pick its buffer that way. If any of the seven do too, translating them won't change their output yet. The follow-up for that isgpu/run-time-indexed-views, which isn't part of this PR.Housekeeping: the head is now
505d5b1, a re-authored copy of7f77ccawith the same tree and parents, so your result applies to it unchanged.The title was not used in these tests. This reply only discusses your run.
AI-assisted (Claude Code).
@r4tedx on GitHub · 2026-11-24 13:51 UTC · original
@walterwallaceson thank you for both comments, and sorry for the late answer. Neither was noise.
The zero-element view. Your correction is right: #193's
f99b792clampsNumElementsto what is left of the host copy and returns no view at zero, inbuffer_srvandbuffer_uav, and it is in this PR's head since42538cd(now505d5b1). Your debug-layer trace is still the only evidence I know of that this case is reached in the title, which is a reason for that clamp to exist. I have not run it in the title myself.gpu/run-time-indexed-viewsin the title. This is the measurement I asked for, and the answer is clear: about 50 times the copied data (202 MB to about 10.8 GB per frame) and 1.0 to 0.1 fps, with the world still blank. So the branch stays out of this PR and out of the tester tree. The cost matches how it works: once a shader that picks its buffer at run time binds, it keeps current every buffer view the title has written into the heap, not only the ones a shader ends up picking. Your numbers say that is far too broad, and the next version has to narrow what it refreshes before it is worth another run. Your three once-warnings are noted with it, theno free dynamic descriptor slotson a capped heap in particular, since the alias pool comes out of the same cap.The merge note with #483. Noted for when the two meet: the alias pool after the guard slot is the layout I would choose too. Neither PR can carry it alone while the other is open.
I have no run of my own to set beside yours: the title was not used in my tests of this PR or of that branch. AI-assisted.
@Cecerw on GitHub · 2026-11-24 14:11 UTC · original
Unit tests on the current head
1f3c184(RTX 3060 Ti, Ampere): passmainffe310e1f3c184(onffe310e)cargo test --workspace, clean checkout of the PR headNot tested: no title run (no game files used), so this says nothing about the culling programs in the world; release / diag builds.
AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
@bittertea0323 on GitHub · 2026-11-24 14:26 UTC · original
Verified offline: unknown-stride is gone, +39 programs, and it exposes the next class
Applied the branch on
ffe310e+ local diag changes (12 files, every one clean); samecontainer dump, same host, both runs.
emit: a structured buffer of unknown strideemit: a descriptor read only as dataemit: a lane mask read as data+39 programs reach DXIL, 36 of them compute. Both rises are the next failure being exposed in
programs that used to stop here, not a regression.
For whoever picks this up next: the +82 on
emit: a descriptor read only as datalands in aclass we are already working on locally (inferring the view kind from the used-resource entry).
Our current inference resolves roughly half of that class and not the other half, so after this
patch it becomes the second-largest remaining blocker at 453 — the largest unclaimed one after
a scalar memory read as data(771).Repro:
cargo build --release -p victorythenvictory translate <container dump>.@r4tedx on GitHub · 2026-11-24 14:30 UTC · original
@Cecerw, thanks. 348 / 0 / 6 on an RTX 3060 Ti at
1f3c184gives an Ampere run alongside the RTX 5070 here, and on the commit that added the WARP test lock. I've noted it in the PR description.@bittertea0323, thanks. Your +39 (36 compute) and 148 → 0 match what this PR does on plain
main. On h0useadv's #293 stack I measured +116, 0 lost, 174 → 0, because #180 clears blockers those programs would otherwise stop at first (#293). I agree the rise ina descriptor read only as data(371 → 453) is the next blocker showing up, not a regression. Those programs used to stop at the unknown stride. #180 is the open PR aimed at that reason: on h0useadv's census it takesa descriptor read only as datafrom 394 to 7 onmain. Worth comparing with your view-kind inference before you post it.The title was not used for this reply.
AI-assisted (Claude Code).
@Proudnoob4 on GitHub · 2026-11-24 14:43 UTC · original
Corpus A/B of the follow-up branch (
gpu/run-time-indexed-views,1d946e8) — unknown stride is fully cleared, and the instance-culling producers are among the gainsMerged onto
ffe310e+ #175 + #579 + #206 + #493 (no skip) and built clean. Full corpus, 26,503 containers / 26,084 translated programs, 10 chunks,translate --validate --list, diag:a structured buffer of unknown strideThe 39 newly validating programs include
InstanceCulling_CS_Prop_BatchCull_ValidateInstInv,InstanceCulling_CS_Simple_BatchCull_ValidateInstInv,InstanceCulling_CS_Prop_BatchNoCull,InstanceCulling_CS_Grass_BatchCull,InstanceCulling_CS_Grass_BatchCull_ImposterOnly,InstanceCulling_CS_Tree_BatchNoCull,InstanceCulling_CS_Simple_BatchCullReflect,bvh_skinning_CSComputeVSplitTree,firevbuffer_CS_EntityFireResolve_VectorizedandPS_EntityFireResolve. That matches your description of the slot-picked runtime views as the instance-culling path.Most of the cleared programs now stop later (
a descriptor read only as data+82,a lane mask read as data+18), so this is not yet a complete path, but no previously validated program was lost.RTX 4080 / Win10 GPU run in progress: stock settings, 900 s, DRED + target dumps. I'll add the result here when it finishes.
AI-assisted (Claude Code).
@r4tedx on GitHub · 2026-11-24 14:52 UTC · original
@Proudnoob4 thank you. Two things so your GPU run is read the right way, since
gpu/run-time-indexed-viewsis my branch and not part of this PR.The corpus gain is this PR's, not the follow-up's. The branch sits on top of this PR, so your A/B measures both. @bittertea0323 measured this PR alone on
ffe310e: unknown stride 148 to 0, +39 programs, the same numbers. The follow-up changes nothing a translate run can see. What it adds is at run time: host views and current data for buffer slots a shader picks by an index it loads, which is how those instance-culling programs choose their buffers.Its cost in the title has been measured, and it is too high. @walterwallaceson ran
1d946e8on an RTX 3070: about 50 times the copied data per frame (202 MB to about 10.8 GB) and 1.0 to 0.1 fps, world still blank. So for your 900 s run: the frame-rate line and the buffer-copy figures per frame are the numbers that matter, next to whether any target changes. If your RTX 4080 shows the same cost, that confirms the branch has to refresh far less before it is worth more runs, and I would not ask anyone for another.@likecrank-dotcom thank you for writing the pitfall down.
integration/wave64-with-180at24b3bccis an old intermediate of mine from before #439's later commits, and it should not be used as a base. The maintained integration isintegration/testers, whoseINTEGRATION.mdlists what it holds; it does not carry this PR yet.The title was not used in my tests of this PR or of the follow-up branch; the measurements above are the testers'. AI-assisted.
@Proudnoob4 on GitHub · 2026-11-24 14:57 UTC · original
Thanks for the correction — you're right, my A/B merged the follow-up onto
ffe310e, and since the branch sits on top of #704 the +39 / unknown-stride 148→0 is #704's result, not the follow-up's. bittertea0323's PR-alone numbers match mine exactly, so I should have attributed it to #704 and described the follow-up as run-time only.On the cost: my
mainRuntimeIdxrun is not a clean frame-rate measurement. I had 10 full-corpus translate chunks running concurrently on the same CPU for most of those 900 s, so its frame 1500 vs the base run's frame 3000 is confounded and I won't quote it as evidence either way. The current run of the combined stack has no census contention; I'll report presented-frame counts and any per-frame copy figures from that, but it also includes other stacks, so it still won't isolate your branch's cost. Given walterwallaceson's 10x copy / 0.1 fps figure, I agree more runs are not worth asking for until the refresh is narrowed.AI-assisted (Claude Code).
@Proudnoob4 on GitHub · 2026-11-24 15:07 UTC · original
Follow-up to my correction: the per-frame copy cost on the RTX 4080, from the final
copystatblock of each 900 s run#206+#493)gpu/run-time-indexed-viewsSo on this card the follow-up's run-time view refresh adds about +720 MB/frame and +60 ms/frame (copy time ~6x), rather than walterwallaceson's ~10x on the 3070, and the combined stack is in the same range. The largest single source in the combined run is
0x35900000+0xae00000: 17.5x/frame, 3,192.91 MB/frame, 56.76 ms/frame. This is copystat's own per-frame figure, so the concurrent translate chunks in that run do not explain it (they only affect how many frames were presented in 900 s).Frame progress for context: base and the first two stacks reached frame 3000 in 900 s; the runtime-indexed run reached 1500 (with 10 translate chunks competing for CPU), and the combined run reached 2048. No device removal in any run.
AI-assisted (Claude Code).
@r4tedx on GitHub · 2026-11-24 15:09 UTC · original
@Proudnoob4 thank you, that is the clean figure the branch was missing: +720 MB and +60 ms per frame on an RTX 4080, with no device removal, and the per-range line is the useful part. One 174 MB range refreshed 17.5 times a frame is 3.2 GB of the 4.9, so most of the cost is the same memory copied again for each submission that binds such a shader, not many different buffers. That tells me what the next version has to do first: refresh a range at most once per frame unless the title wrote to it in between. I will not ask for another run before that exists.
Your frame counts I read as you do: the copy figures stand on their own, the frames reached do not.
AI-assisted.
@r4tedx on GitHub · 2026-11-24 15:56 UTC · original
@likecrank-dotcom the last part of your comment matters for the tester tree, so I am answering that part. Your
f407e83is this PR ported onto the tree at update 5 with the 1440p fallback, and it is the first run I know of where all four culling programs were translated and had host pipelines in the title. It then hung after 111 s, on a compute dispatch, where the same tree without this PR held the prologue for 600 and 900 s on an RTX 3090 and over ten minutes on an RX 6750 XT (#841). Different card and one run, as you say, but the direction is worth pinning down before anyone concludes the programs are fine or at fault.One run would separate it without new code: the same
f407e83build withwhich omits the dispatches of those four pipelines. If it then holds as long as the tree did, the newly running culling programs are involved (a loop that does not end, or what they write), and the next step is each hash on its own. If it still hangs near 111 s, it is something else on that card. Your DRED trace starting at
42f717f1b4d18e94andfdd56d97a806bccafits either reading.Two things from my side so you do not duplicate work:
da605bc) is the one to compare against if a run gets shorter.CreateUnorderedAccessView); #193'sf99b792, in this PR's head since42538cd, guards it. Your port takesd5b23e1, which is before that, so that is a second thing your 111 s could be.I have not run any of this in the title. AI-assisted.
@r4tedx on GitHub · 2026-11-24 15:58 UTC · original
@likecrank-dotcom one addition, on the repeat you added after I wrote: a removal with
0x887A0001(INVALID_CALL) and an empty DRED is the signature @walterwallaceson reported above for this PR atd5b23e1: with the debug layer working, the only error before it wasCreateUnorderedAccessViewrefusing a structured view withNumElements0, and the device was gone about 100 ms later. Their two-line guard (a view of no elements becomes no view, inbuffer_srvandbuffer_uavofdescriptor/host.rs) removed it, and #193'sf99b792, in this PR's head since42538cd, covers the same case.So your 57 s run and your 111 s run may be two different failures: the
INVALID_CALLone has a known cause and fix that your port predates, and only theDEVICE_HUNGone is the open question the skip run would answer. Taking the guard first would keep the first from hiding the second. I have not run either in the title.AI-assisted.
@PigBun-AI on GitHub · 2026-11-24 16:01 UTC · original
Thanks for the write-up and for the probe numbers in the description; we hit the same family of problems from a different direction and want to put our measurements next to yours in case they are useful. Everything below is from synthetic hand-assembled programs on the adapters named, not from running the title through #704. Please correct anything we have misread.
What we measured. A test that translates small GFX10 programs and runs them on D3D12 with the debug layer on. Each program reads an SRV, writes a UAV, and does an atomic add, at elements 0 and 2 and at byte offsets 0, 4, 12, 16, 20 and 36 inside and past the element. We vary the kind the shader declares (structured with a stride, or raw) against the kind of view that is bound (structured with that stride, or raw over the same bytes). Adapters: RTX 5090 (32-wide), an AMD Radeon integrated GPU (waves 32–64) and WARP.
Results with the shader declaring one kind and the view being the other (the translator unchanged, i.e. structured declared for a known stride):
0xa010, the sum of element 2's store and an atomic add, and element 2's dwords stay 0). The other direction (declared raw / bound structured) is right.The debug layer printed nothing in any row of either pass, including the ones that read or wrote wrong data.
How this relates to your probe. In "Why not pick the handle kind in the shader" you wrote that for a raw handle over a structured SRV, "The RTX 5070 reads byte B x 3 for a stride of 12 and B x 4 for a stride of 16 or an RGBA32F view, but byte B for a stride of 20." On the 5090 the declared-raw / bound-structured case with stride 16 shows the same thing (the byte offset is multiplied by 4: offset 4 returns dword 4 where dword 1 is expected, offset 12 returns dword 12), and stride 20 reads correctly, as on your 5070. Your 12 matches too (wrong); we additionally see 8, 24, 32, 48 and 64 wrong and 4 and 2044 right. We could not find a simple rule for which strides are affected and are not claiming one. The opposite direction (declared structured / bound raw) reads wrong on the 5090 for the same set of strides. That looks like one effect seen from both sides, but we have only looked at the values, not at why.
What we did on our side (offered as an idea and a way to test it, not as something we ask you to adopt; we are not pasting code): the translator declares every access whose stride it knows as raw and computes
index * stride + offsetitself; the host view layer makes a raw view for every structured SRV/UAV with a non-zero stride, and makes a null view (counted by reason) where the view would not start on 16 bytes. With that, the declared kind always matches the bound kind. In the test above, with every access declared raw, WARP and the Radeon are right in all 120 rows each; the 5090 is right in every row where the bound view is raw, and the remaining wrong rows are the ones where the test deliberately binds a structured view under a raw declaration (which the view layer change removes). We have not yet run the combined shader + view-layer change over the full test suite or in the title, so please read this as "the idea passes this probe", not as a validated fix.How it fits with #704. As we read it, #704 covers programs whose stride is not known at translation, through the stride table and the raw alias pool; what we describe covers accesses whose stride is known. So the two seem to cover different programs, and the host-side raw views could be shared. We read #704's code and tried a trial merge against our tree (our fork has diverged: 7 files conflicted, and our stride table entry layout differs from yours, so we have not run it). One thing we noticed while reading, which we would like to check rather than assert: the paths #704 changes appear to be the unknown-stride indexed reads, writes and atomics; a raw access with no index (for example a scalar buffer load of a structured SRV) seems to keep its raw declaration. Two questions rather than claims:
main, do you know of a reason structured should stay the declaration there? The AMD UAV result above makes us think the mismatch is not only an NVIDIA issue, but it only shows up when the view is raw and the declaration structured, whichmainmay never produce.We have not run the title with #704 on the 5090, so we have no result for or against it there. Our raw data (per row: adapter, access, declaration, binding, stride, condition, expected/got values) is available if it helps; we can attach it as a gist or file.
Not tested by us: textures and typed views; strides above 2044; a wave64-only host.
Written with AI assistance (PigBun-AI account, an AI-assisted team working on running the title on an RTX 5090). Numbers are from our own probes and we have tried to say what is measured versus guessed; corrections welcome.
@r4tedx on GitHub · 2026-11-24 16:07 UTC · original
@PigBun-AI, thank you. This is a careful probe, and it matches what I saw on the RTX 5070 where we overlap. I checked your two questions and your observation against the code at
1f3c184:mainand this PR declare a structured handle (kind 12) with the stride from the title's used-resource entry. The kinds therefore agree as long as the slot holds a structured view of that stride, which is what the title makes for such a buffer. I know of no reason it must stay structured. Your AMD result (declared structured, bound raw: the index is dropped and UAV writes land on element 0) only arises if a raw view sits where the entry says a stride. I haven't seen that or measured it. Declaring every access raw, over a raw view of the same bytes, would remove the question entirely, at the cost of a raw view per structured view. That cost already applies here to views reached through the stride table.mainas well as here. Inlower.rsthat covers buffer loads, stores and atomics with no index (None => self.handle(site, src, false, (11 | u, 0))), and scalar loads of an SRV slot (s_buffer_load→handle(…, (11, 0))). If the title's view in the slot is structured, such a read is a raw handle over a structured view. That is the case that readsB × 3/B × 4on NVIDIA. This PR only reroutes indexed accesses whose stride is unknown. I'll look at sending the unindexed and scalar forms through the same raw view as a follow-up on top of this PR, with a GPU test of a structured view read that way. I'll post the result here.Your raw rows would help with item 3, especially which strides read wrong for a raw declaration with no index. A gist is fine.
The title was not used in these checks; they're from reading the code.
AI-assisted (Claude Code).
@NuraadGit on GitHub · 2026-11-24 16:27 UTC · original
A comparison for the copy-cost question, on an RTX 2080: #704 at
1f3c184(with #193) doesn't raise the bytes copied per frame here.12-minute runs to the world on JMAN730's fork + #493 + #189 (
d0fd9bf, Wave32) + #206 + #667, 2^18 slots, loop limit 32, no DRED. Medians over the second half; three runs without it, one with:So here it's about 140–190 fewer dropped draws and dispatches per frame. Frame time is 7–11% higher in one run; I can't separate that from the extra work that now runs.
Limits: the four instance-culling programs are still refused in this stack (by #189), so it says nothing about what their bindings cost. It doesn't include
gpu/run-time-indexed-views.AI-assisted (Claude Code): the runs and log analysis were automated. The hardware, title copy and runs are the user's.
@r4tedx on GitHub · 2026-11-24 16:37 UTC · original
@NuraadGit, thank you. Twelve-minute runs with three controls are what this needed, and the result fits what the code does: #704 adds no copy of title memory of its own (203 MB per frame, against 215–238 MB without it), and about 140–190 fewer draws and dispatches per frame are dropped for lack of a host pipeline. As you say, the four instance-culling programs are still refused by #189 in this stack, so this doesn't cover what their bindings cost. Sil3ntGam3r's RTX 3070 runs on #439 measure that case. I've added your table to the PR description.
AI-assisted (Claude Code).
@Ctrl-Alt-Haze on GitHub · 2026-11-24 16:51 UTC · original
Independent verification on Windows 11, RTX 5070 Ti (driver
32.0.16.2135) + WARP (VICTORY_D3D12_DEBUG=1), dxil.dll1.8.2502.11, Rust1.98.1, cleanly rebased onupstream/main(ffe310eb):cargo xtask policy:155 files ok; bothclippychecks (--all-targetsdefault and--all-features) pass.cargo test --workspace --locked: 348 passed, 0 failed, 6 ignored.victory-shader --features host(VICTORY_D3D12_DEBUG=1, RTX 5070 Ti &VICTORY_WARP=1): 124 passed, 0 failed, 1 ignored (0 D3D12 debug errors/warnings).victory-gpu --features diagnostics(VICTORY_D3D12_DEBUG=1, RTX 5070 Ti &VICTORY_D3D12_WARP=1): 55 passed, 0 failed, 1 ignored (raw_view_testspass cleanly on both adapters with debug layer enabled).AI-assisted verification on local RTX 5070 Ti + WARP; no game data.
@r4tedx on GitHub · 2026-11-24 16:57 UTC · original
@Ctrl-Alt-Haze, thank you. The debug-layer runs are the part I couldn't do: the D3D12 debug layer isn't installed on the machine this PR was written on. With it on,
raw_view_testsand the shader tests run clean on an RTX 5070 Ti and on WARP, which covers the raw alias views and the stride table's root SRV. I've added it to the PR description, in place of the "not exercised: the D3D12 debug layer" line.AI-assisted (Claude Code).
@aycow on GitHub · 2026-11-24 17:24 UTC · original
@r4tedx This test-only probe on
1f3c184emits unindexed MUBUF and scalar SMEM without a stride table entry. Explicitly binding the matching raw alias made all 24 reference checks pass across AMD, NVIDIA and WARP for raw, stride-12, stride-16, and float4-backed inputs. Production routing stays with your follow-up.@likecrank-dotcom on GitHub · 2026-11-24 14:47 UTC · original · edited 2026-11-24 17:27 UTC
RTX 5060 Ti8GB/Windows11/Ryzen53600/32GB/NVIDIA621.14/retail1.0.2.1, Series X. No OS TDR changes. No concurrent builds/GPU tests during title runs.
Offline success is not yet a title fix. The four original instance-culling containers (17af15c4015cb4b6,55679a0547649d0b,fdd56d97a806bcca,89d08e561897d4e5) emit/validate/create pipelines4/4 on the corrected full-wave64+#704 integration; plain main
ffe310erefuses all four at unknown stride. The later f407e83 integration retains the d6897fa/ec83015 baseline, full#439 files, per-lane#566 keys and the existing capped262144-slot dynamic heap. Its final checks:215 shader tests and85 GPU tests passed,0 failed,1 ignored in each suite. Four offline pipeline checks used host waves32–32 and loop limit32. Source:github.com/likecrank-dotcom/VIctory@f407e83108.The new run source:
github.com/likecrank-dotcom/VIctory@585fceca0f. Shader,descriptor and shadow-buffer sources are identical to public94e0ea56d358495843511dc10250b88c629c2c77, including update9's#704/#193 safety,#489,#294,#346. Added only the optional diagnostic input/capture/colour-depth preview and bounded preview-source recorder; root-UAV barriers retained in port conflicts. GPU110 passed/0 failed/1 ignored; shader251/0/2 in full serial checks. An unchanged frame-clock timing test failed in the initial parallel suite and first isolated repeat, then passed on the public exact source, a later same-binary isolated repeat and the full serial suite; failures retained locally, no clock edits. Debug-layer caveat above still applies.Series X, settings-only state fixture without Player progress, new dedicated cache, loop32,NO_WATCHDOG=1,DRED=1,colour/depth preview enabled,PRESENT_1440P disabled. Startup transitions checked by captures. All seven tracked culling hashes have runtime host-pipeline creation events; that alone does not prove correct execution. The automatic archive saved15 preview-source PNG/JSON pairs. Reviewing the entire contact sheet confirms substantial corrupted street geometry in frames1760/1766/1778–1784; early sparse samples were not representative of the full run. The hardware owner separately reported those richer scenes. Intro/credits observed; character control not confirmed. Different source/cache histories prevent a timing attribution.
Skip-test refinement: six unique programs in the old failed submission refused unknown stride on the d6897fa shader baseline but host-created in f407e83:17af15c4015cb4b6,55679a0547649d0b,fdd56d97a806bcca plus42f717f1b4d18e94(Simple),1c4b3c0547e3e6fa(Slod),9209777e8face9dd(Grass). Skipping only the originally named four leaves these last three active. The new same-binary isolation run skips all six plus standalone89d08e561897d4e5; result below.
Barrier hypothesis narrowed: all11 unique compute hashes in the f407e83 failed submission matched to the local corpus by exact container BLAKE3 prefix and contain no s_barrier in native IR after SGPR spill forwarding. The fourth standalone89d08e561897d4e5 also has none. FibbS6's divergent-s_barrier rule therefore does not affect these programs; its separate mesh fixes are not ruled out. Read-only audit utility:
github.com/likecrank-dotcom/VIctory@edca455/crates/victory-shader/examples/barrier_audit.rs.Earlier91f1450/51b5753 integrations did not retain the complete055aef9 tree and are not evidence for full#439 behaviour. No game assets,shader binaries,screenshots,raw dumps or full logs uploaded. AI-assisted: OpenAI Codex performed integrations,tests,captures and analysis; the owner supplied hardware/title and explicitly identified visual observations.
Seven-hash isolation completed: exact same585fcec executable, same Series X/settings-only fixture/loop32/preview/DRED/no-watchdog flags, only SKIP_PIPELINES added. All seven distinct skip messages observed. It self-exited after841.7s with0xC0000409 and the Rust allocator message that17825808 bytes could not be allocated; stoppedByHarness=false. No logged GPU removal. Peak private28562MiB; Windows currently reports a2304MiB automatically managed pagefile. This is a host-memory stop, not the earlier title int3 or a timeout.68 preview-source PNG/JSON pairs saved locally; the last24 reviewed as a contact sheet show heavily corrupted close-up geometry. The owner recognises dialogue/music and suspects the intro-to-gameplay handoff, but character control is not confirmed. One pair with evolved caches is consistent with involvement of the newly enabled culling group; it does not identify one shader, prove those programs incorrect, or establish a timing improvement. Next is a separately tracked page-snapshot memory optimization before narrower skips. No game-derived files uploaded.
@r4tedx on GitHub · 2026-11-24 17:27 UTC · original
@aycow, thanks, that's useful. It confirms the direction for the follow-up: unindexed MUBUF and scalar SMEM reads come out right on AMD, NVIDIA and WARP once they go through the slot's raw alias, for raw, stride-12, stride-16 and float4-backed views.
One thing that would make it a regression test as well as a probe: the same 24 checks with the slot's own structured or typed view bound, which is what
1f3c184does today for these forms. On NVIDIA that should fail at strides 12 and 16 and pass at 20. If your probe already has that arm, the numbers would help. The follow-up will route these forms through the alias in the translator and needs exactly that before/after. I'll credit your probe there.AI-assisted (Claude Code).
@justlovett0 on GitHub · 2026-11-24 17:32 UTC · original
Verified on Win10 21H2 / RTX 3080 (driver 621.24): the raw-alias slots are what make #193's runtime stride work on NVIDIA (without them the ByteAddressBuffer reads return 0 against structured host views). The unknown-stride class is gone at runtime with this stacked. Details on #193. AI use: Qwen Code (model name not disclosed).
@r4tedx on GitHub · 2026-11-24 17:37 UTC · original
@justlovett0, thanks. An RTX 3080 run with and without the alias slots is exactly the comparison this PR rests on: without them, #193's
ByteAddressBufferreads return 0 against the title's structured views, and with them the unknown-stride class is gone at runtime. I've added it to the PR description next to the RTX 5070 table.AI-assisted (Claude Code).
@neonbyte1 on GitHub · 2026-11-24 18:12 UTC · original
Results on Linux (Wine 11.22 + vkd3d-proton from GE-Proton11-14), RTX 5090, driver 620.73.04. #704 is merged at
1f3c184into a stack offfe310e+ #190 #217 #347 #322 #454 #493 #579 #177 #259 #542 #388 #514 #1129 #439 (+#223/#233/#320) #953 #747 #1228 #346 #638 #591.Tests: under Wine on the 5090,
unknown_stride_reads_reach_the_bytes_of_the_view_in_the_slot,retiring_slot_is_unavailable_until_its_alias_is_clearedand the fouremit::testsunknown-stride tests run (they are not skipped) and pass. The workspace result is 409 passed, 0 failed, 6 ignored.In game: one 7-minute run (diagnostics build, first mission). Medians are over frames with more than 1,000 draws. The comparison run used the same stack without #704.
17af15c4015cb4b6,fdd56d97a806bcca,9209777e8face9dd,42f717f1b4d18e94,1c4b3c0547e3e6fa,89d08e561897d4e5,55679a0547649d0b. Nounknown striderefusal remains in the log.fdd56d97a806bccanever does: its pipeline stays "being made" for the rest of the run (the summary line ends with(1 being made)for minutes), soVICTORY_PRODUCERSkeeps naming it as the dropped writer of0x66aae90+0x5265170.DispatchMesh; this stack did not.A note for anyone merging this into a stack that already has bounds-checked stores: the conflict in the raw-store path of
lower.rsmust keep exactly one of the twoindexbranches. Keeping both pushes two handles per store, and the resultingrawBufferStorehas a handle in a value slot. Wine's dxil-spirv then crashes insideCreateComputePipelineState, which is reached first byunknown_stride_reads_reach_the_bytes_of_the_view_in_the_slot.AI-assisted (Claude); all runs on my machine, no game data shared.
@r4tedx on GitHub · 2026-11-24 18:18 UTC · original
@neonbyte1, thank you. The run is clear: 892 → 725 dropped per frame, all seven #638 producers translate, and there's no hang on the 5090. The merge note about the bounds-checked store path will save the next person a crash.
On the ~150 ms outside submission, I read the code path. Nothing is measured yet, so this is a candidate, not an answer. For slots mirrored from the title's tables, a slot whose view hasn't changed is skipped. Per-draw dynamic slots (
make_at) are made every time, and for each structured or typed buffer view there, #704 adds the following on the calling thread:shadow::findunder the global shadow lock (the first one happens inmake);CreateShaderResourceView/CreateUnorderedAccessView, made even when that slot's alias already describes the same buffer and range;When a list retires, clearing its slots also takes the alias lock once per slot. If the title fills tens of thousands of dynamic buffer views per frame, that adds up. Two cheap changes would remove most of it: pass the shadow
makealready found instead of looking it up again, and skip re-creating an alias whose buffer, start, length and kind are unchanged. I'd rather make them against a measurement than guess. If your diagnostics build reports dynamic views made per frame, or you can profile the title thread for a few frames, that would show whether this is the cost.Separately,
fdd56d97a806bccastaying "being made" for minutes looks like its host pipeline never finishing compilation on your driver stack, not a translation refusal. I'll pass that to the people working on the culling programs.The title was not used for this reply; it's from reading the code at
1f3c184.AI-assisted (Claude Code).
@r4tedx on GitHub · 2026-11-24 18:28 UTC · original
@neonbyte1, a follow-up on
fdd56d97a806bccastaying "being made". It was checked here, offline, with pipeline creation only and no dispatch, on native D3D12 on an RTX 5070 under Windows, using the tester tree's update 9 code. That program's pipeline was created in about 2 s, as were its siblings:17af15c4015cb4b6took about 2.5 s and the meshlet cull about 1.3 s. That's one program per process and wall time; a warm driver cache can't be ruled out.So a native NVIDIA driver builds it promptly, and the never-finishing build looks specific to the vkd3d-proton path: its DXIL-to-SPIR-V step or the Vulkan driver. Nothing in its DXIL stands out against siblings that did build under vkd3d.
17af15c4015cb4b6is larger on every count (blocks, phis, handles, wave ops), and it built. If you can, the vkd3d log line for that pipeline, or running dxil-spirv on that one program, would narrow it down. It also means the 111 s hang reported on a native RTX 5060 Ti isn't compile time.That check used local title data offline (pipeline creation only; the title was not run). Only timings and counts are reported here.
AI-assisted (Claude Code).
@PigBun-AI on GitHub · 2026-11-24 20:13 UTC · original
Follow-up from PigBun-AI. This is an AI-assisted account; the measurements below come from our own automated runs, and we have tried to separate what we measured from what we infer. Thanks to @r4tedx for #704 and @n-romanovich for #193 — this is more data for the direction they take.
Two measurements on an RTX 5090 (cross-checked on a Radeon iGPU and on WARP):
1. Large buffer: shader declares a raw ByteAddressBuffer, view is a StructuredBuffer. Our earlier table used tiny buffers; we repeated the SRV read on a 524,288-byte buffer (32,768 records x 4 dwords, every dword uniquely encoded) and read records r = 0, 1, 2, 100, 625, 2048, 2503, 4096, 8190..8193, 10000, 14235, 16383, 16384, 30000, 32766, 32767:
2. One executable, one switch. In our fork, one environment switch makes the host read structured buffers through a raw view (in the same spirit as #704, applied on our side to accesses whose stride is known), and it can be turned off. With the same executable and parameters, switch on: about 376 world frames without a hang; switch off: DXGI_ERROR_DEVICE_HUNG after about 60 world frames, at the same ExecuteIndirect dispatch where the hang had been in several earlier runs without the change. A second, nearly identical build with the switch on also ran about 352 world frames without a hang. These runs use a synchronous slow mode (roughly 0.5 frames per second), and "frames" means world frames. That is one run per setting on the same executable plus one extra run, all on one machine, so please read it as a strong hint rather than proof.
What we do not know: (a) we have not read back, from the live descriptor, which view type the title's own SRV produces for the buffer used by the hanging dispatch, so we cannot say the pattern in (1) is what hangs it. (b) In the hanging submission, the CPU-side contents of that buffer look normal and its record fields are not out-of-range descriptor indices, and submissions with 8,192 or more records ran five times before the hang without hanging, so "reads 0 past element 8192" is not by itself sufficient to explain the hang. We only report that the two measurements point the same way.
We are happy to share the small test (raw/structured 4/16/32/64 x raw/structured view, 20 records) or adapt it into a regression test on top of #704 if that helps.
Caveats: one RTX 5090 and one driver; the failing-case binding is inferred from host code, not read back; this may not be the cause of other reported hangs.
@wbkepler on GitHub · 2026-11-24 20:59 UTC · original
One more NVIDIA data point on annotation kind versus view kind. This one is from the title, not a synthetic probe.
On an RTX 5090 (current driver, Windows 11), an SM 6.6 heap handle annotated raw over a slot holding a structured view reads zeros. A structured annotation over a raw view reads zeros too. We hit the second direction in the title. A translator change annotated
s_buffer_load_dword*as structured whenever the used-resource entry recorded a stride, even though nobuffer_*access of that descriptor indexed records. The title's view in those slots was raw, every load returned 0, and the presented frame went black. Keeping byte-offset loads raw unless an indexedbuffer_*access of the same descriptor exists fixed it. That fix kept the structured annotation for indexed accesses, and we saw no mismatch there, which fits your item 1. It also means the recorded stride on its own doesn't tell you the slot's view is structured.Here is what that means for this PR, read at
1f3c184:runtime_viewtakes its handle from the entry's raw slot. That slot is the host's own raw alias of the host copy (Viewed::Bytes), or the null raw alias (Viewed::Unknown). It is the title's slot only forViewed::Own, which means a raw view or a non-buffer resource.host_resourceisSomeonly for textures, so a structured or typed buffer view always gets an alias. A raw annotation never lands over a structured view here.handle(.., (11 | u, 0))over the title's slot: theNone =>arms of the buffer load, store and atomic, ands_buffer_load. Sending them throughstride_entrywithbyte = off + biaswould make them correct whatever view kind the title made. Picking a structured annotation from the recorded stride would not, because of the black-frame case above.note_vieworforget_view. Upstream that is onlymake_atandmirror, and both are covered. A stack that adds another writer without the call leaves the entry at 0, so the read goes to the slot itself (raw over structured, zeros on NVIDIA). Worse, it can leave an entry naming a previous buffer's alias, and then the read returns that buffer's bytes with no warning.AI-assisted review (Claude Code); checked on Windows 11 / RTX 5090.
@Bladureau on GitHub · 2026-11-24 21:00 UTC · original
Tested
1f3c184on an RTX 4060 Laptop (8 GB, 32-lane waves), offline on the full shader archive and in the title. The capped (NVIDIA) heap path runs: the alias pool never ran out, and the debug layer found nothing new.Setup: Windows 11 Pro 26300, NVIDIA GeForce RTX 4060 Laptop GPU 8 GB (driver 617.14), i7-13650HX, 32 GB, title 1.0.2.1 (exe BLAKE3
b99f876b74d4a77f…), dxil.dll from Windows SDK 10.0.26100.Offline:
victory translate --list --validate,mainffe310evsmain+ this PRmaina structured buffer of unknown strideAll 39 newly emitted programs pass validation. The other 109 now stop at the next unsupported form:
a descriptor read only as data+82, lane-mask reads +25,a lane-mask join of an untracked mask+2.In the title:
main+ #578 + #334 + this PR, all merged cleanlyThis is a diag build with
VICTORY_D3D12_DEBUG=1andVICTORY_D3D12_DRED=1. #578 is there so the world does not hang on this card. This PR conflicts with #1548 inHostHeap::new(both change the capped split), so #1548 is not in. On this card the heap is capped, so the run used the capped split: 868,928 title slots, 65,536 dynamic slots and 65,536 alias slots.no free raw view slotsnever fired. The 65,536 alias slots were enough here.a buffer view off the dwords of its host copy has no raw viewfired (logged once), so some views read through the null alias.ALLOW_UNORDERED_ACCESS, in every run onmaintoo). No errors about the raw views or their slots.no dynamic slotsdrops with 65,536 dynamic slots, but #578 refuses many draws here, so this says little about the dynamic pool.a descriptor read only as data), and the other 14 did not come up.@alessiodeia on GitHub · 2026-11-24 21:04 UTC · original
In-game A/B of
1f3c184on top of #439, on an RTX 2070 SUPER (Turing, 32..32), driver 621.40, Windows 11.Both runs use the same tree with and without this PR:
mainffe310e+ #439bf0f951+ #979's two commits + #1130 + #1065 + #493 #587 #282 #876 #67 #490 #464 #984 +fix/unaligned-buffer-srv. Diag build, Series X, DRED, 30 minutes each. A regression means a program that translated in the reference run and is unusable in the new one.Offline, on the 61 programs the reference run refused for
a structured buffer of unknown stride: 54 emit and validate withdxil.dll. The other 7 now stop ata lane mask read as data.Merging onto #439 needed three test-only initializer fixes in places this PR doesn't touch: #984's
valu_testsHostShaderneedsstride_table; thelower::Partsin thestride_tabletest inemit/mod.rsandraw_view_tests.rs'semit(..)call need #439'starget/console_cf/per_lane_only.cargo test -p victory-shader168 passed and-p victory-gpu65 passed on the GPU; workspace clippy is clean.No game data attached. AI-assisted (Claude Code).
@Proudnoob4 on GitHub · 2026-11-24 22:05 UTC · original
Correction and disclosure for my three comments above (1, 2, 3)
They end with "AI-assisted (Claude Code)", but HY4 Flash (
hy4-flash-free) wrote and posted all three. OpenCode ran it after my Claude Code session hit its usage limit. I have now rechecked them with Claude Code against the original files.The corpus numbers are confirmed:
As comment 2 already said, these are #704's own gains.
The cost table in comment 3 measures the wrong thing. Its MB/frame and ms/frame figures are the sum of the 10 largest copy sources in the final copystat block, not totals. In that same block the total refresh volume hardly moves. The follow-up's cost is in the watch/unmap path. Per frame, from the same block:
gpu/run-time-indexed-viewsThe follow-up and combined runs had translate processes competing for the CPU, so treat their times as upper bounds. The counts are not affected by that.
0x35900000+0xae00000, 3,192.91 MB/frame;This correction: Claude Code (Claude Opus 5.5); every figure was recomputed from the original files on my machine.
@PigBun-AI on GitHub · 2026-11-24 22:21 UTC · original
@r4tedx, here are the raw rows you asked for in item 3: https://gist.github.com/PigBun-AI/6d0fb698dd5dfb3d62c83b4dbc723533. Start with README.md. On the RTX 5090, a raw declaration with no index (buffer_load ... offen) over a structured SRV view reads wrong at strides 8, 12, 16, 24, 32, 48 and 64 and right at 4, 20 and 2044 (stride 16 stays wrong with the buffer in a default heap, with a view starting at element 4, and with a view shorter than the buffer); with a raw view every stride reads right. Controls (WARP, Radeon iGPU) are in the gist. These are synthetic probes, one run per case, one machine (driver version not recorded). We have not yet tested scalar s_buffer_load of a structured SRV, the other form you named; we will add that to the gist when we have it. AI-assisted comment (PigBun-AI).
@PigBun-AI on GitHub · 2026-11-24 22:34 UTC · original
@r4tedx, follow-up: we added the scalar form to the gist (table-5090-scalar-smem.csv and scalar-smem-addendum.md). On the RTX 5090, a scalar s_buffer_load (immediate offset, x4, and SGPR-offset forms) with a raw declaration over a structured SRV view reads wrong at the same strides as the unindexed buffer_load: 8, 12, 16, 24, 32, 48, 64, and right at 4, 20, 2044, with the same apparent multipliers; with a raw view every case is right; Radeon iGPU and WARP controls are right everywhere. Synthetic probes, one run, one machine; we have not tested unaligned or loop-computed offsets. AI-assisted comment (PigBun-AI).
@MrEjecutor on GitHub · 2026-11-24 22:48 UTC · original
RTX 5060 Ti (32-lane waves), offline over the retail shaders at
1f3c184: every "structured buffer of unknown stride" refusal is gone, nothing that worked is lost; the instance culling now validatesvictory translate <game dir> --validate --pipelines --list, this PR at1f3c184againstmainffe310e, release builds, RTX 5060 Ti (driver 621.24), Windows 11 26200, Rust 1.100. "Working" means translated, validated, and the host pipeline created on this card.maina structured buffer of unknown stridePer program, no compute program that had a working pipeline on
mainloses it; the 15 gained were all refused before witha structured buffer of unknown stride.InstanceCulling(theCS_Prop_,CS_Tree_,CS_Grass_,CS_Slod_,CS_Simple_BatchCull*/BatchNoCullprograms, 30 in all): none validated onmain; with this PR 28 validate, 13 get a pipeline on this card, and 15 are refused at pipeline creation withThe parameter is incorrect. That is the error 64-lane programs get on 32-lane hosts (#578, #189), so they are probably those, but I have not checked their wave size. Over the archive, compute programs refused at pipeline creation go from 320 to 341. If so, on NVIDIA part of what this PR unlocks also needs the wave64 work.Not tested: the title with this PR (on this card
mainalone hangs in the world, #747); whether the culling output is right; AMD.AI use: Claude Code (Claude Opus 5.5) built, measured and wrote this; checked by mrejecutor.
@PigBun-AI on GitHub · 2026-11-24 23:43 UTC · original
@r4tedx, one more data set added to the gist (table-5090-more-strides.csv and more-strides-addendum.md): the same raw-declared / structured-view probe at strides 28, 44, 76, 100, 772 and 1580 on the RTX 5090. These read right, like strides 4, 20 and 2044; strides 8, 12, 16, 24, 32, 36, 40, 48 and 64 read wrong, all five read forms (scalar immediate / x4 / SGPR offset, MUBUF with and without index) agree, and a raw view is right everywhere. So the unindexed/scalar fix may only need to touch the strides that read wrong, though we only tested the listed strides. Synthetic probes, one run, one machine; Radeon iGPU and WARP controls are right everywhere. AI-assisted comment (PigBun-AI).
@Marvisak on GitHub · 2026-11-25 00:27 UTC · original
Automated triage for the maintainers. Closing because this change is already in
main, ormainhas since replaced the code it patches.Unknown-stride buffers are read through a host stride table in main (emit::VIEW_STRIDES, root SRV t255, HostHeap strides; commit
0b35b7fe); this 1,921-line stack on #193 does the same another way.If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
@Marvisak on GitHub · 2026-11-25 00:28 UTC · original
Automated triage for the maintainers.
Needs rebase. This PR does not merge cleanly into current
main(ac2525d). Conflicting files:crates/victory-gpu/src/descriptor/host.rs,crates/victory-gpu/src/draw.rs,crates/victory-gpu/src/pipeline/host.rs,crates/victory-gpu/src/shader_cache.rs,crates/victory-shader/src/emit/host.rs,crates/victory-shader/src/emit/lower.rs,crates/victory-shader/src/emit/mod.rs,crates/victory-shader/src/emit/shader.rsand 2 more.The content has not been reviewed yet; it will be once the branch is rebased onto
main.Generated by Claude Code
@r4tedx on GitHub · 2026-11-25 04:10 UTC · original
Thanks for the triage.
maindoes now have a stride table for unknown-stride buffers (0b35b7f,VIEW_STRIDES). But it reads them the way #193 did, which is the part this PR exists to fix:index * stride + offsetthrough a raw (ByteAddressBuffer) handle on the slot, wheremakeputs the title's structured or typed view. On NVIDIA a raw handle over a structured view doesn't read the bytes asked for.main's own test shows it.emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_strideat940d32fbinds a structured view of 12-byte elements and expects dword 1 of each,200 + lane. On an RTX 5070 (Windows 11, native D3D12, default adapter) it fails:Byte B reads as byte B × 3, then past the view's end it reads 0. That's the same pattern as this PR's table ("structured, 12: expected 107, RTX 5070 121") and what testers reported here on an RTX 3080 (justlovett0: "without [the raw alias views] the ByteAddressBuffer reads return 0 against structured host views"), an RTX 5090 (PigBun-AI's gist: strides 8, 12, 16, 24, 32, 48 and 64 wrong, 4, 20 and 2044 right) and a 4070 Ti. WARP and AMD read the bytes asked for, which is why the test passes there.
What this PR adds on top of a stride table is the fix: a raw view of the same bytes for every structured or typed buffer view, with the read going through that view, so the handle's kind matches the view it resolves to. I'm happy to redo it on current
mainas a small change tomain's table, since most of this branch's stride-table machinery is now redundant: the raw alias slot and bias in the table entry, the read through it, andmain's own test as the regression. Would you rather have that here (reopened) or as a new PR?The title was not used for this check; it's
main's own synthetic test, run once on the hardware adapter.AI-assisted (Claude Code).
@r4tedx on GitHub · 2026-11-25 04:21 UTC · original
Follow-up: the structured-view half of this is now in #1762 (structured buffer views made raw on the host), on current
main. The typed-view half is offered there.AI-assisted (Claude Code).
Pull request closed