Skip to content

Run wave64 compute programs in a paired form on 32-lane hosts (port of fxceless#854, stacked on #61) - #64

Draft
Castyan wants to merge 24 commits into
DexNom:mainfrom
Castyan:wave64-paired-form
Draft

Castyan wants to merge 24 commits into
DexNom:mainfrom
Castyan:wave64-paired-form

Conversation

@Castyan

@Castyan Castyan commented Nov 26, 2026 •

Copy link
Copy Markdown

Stacked on #61. This branch holds #61's commits (up to 2287c4b). The changes to review are the last two commits, 082e528 and 53f1f19 (the former 40c2f29 and a65db62, rebased onto #61's head). I'll rebase once #61 is merged.

Split (2026-11-26). This PR had grown to 65 commits. It now holds only the paired form again. The rest moved to their own PRs, with nothing dropped (the union of the new branches gives back the old head's tree):

The two test fixes that were here (a971716, dddb8e3) are already in #61 as 8cdfc63 and 2287c4b. The old head is kept on Castyan:wave64-paired-form-full.

At 53f1f19 on the RTX 5060: cargo clippy with and without --all-features (-D warnings) is clean, and cargo test --workspace --locked gives 719 passed, 0 failed, 11 ignored.

What

This ports 26600c6 from fxceless/victory-fork#854 by @PiloteCode: wave64 compute programs run in a paired form on hosts with 32-lane waves only. Each console wave runs as one host wave of 32 lanes, and each thread does the work of two console lanes (n and n + 32). The whole wave takes every per-lane branch, with EXEC as each lane's guard. Lane reads, permutes, lane masks and reductions cover both halves through the host wave's own operations. The paired form is tried after every other form, for a wave64 program the host still refuses. VICTORY_WAVE_PAIRS=0 turns it off. All credit for the technique goes to PiloteCode. Any mistakes in the port are mine.

#61 got 22 of 31 wave64-only compute pipelines working on the RTX 5060. All 9 left need this form. 7 of them have groups of 128 to 1024 threads and read and write LDS inside lane branches. The other 2 are the BVH builder programs.

The commit is the whole of 26600c6, so it also brings in that commit's other parts: mesh programs over 32 KiB linked with their pixel program (emit/link.rs, pipeline/host.rs, VICTORY_MESH_LINK=0), signature row order, 64-bit floats (float64.rs), descriptors read only for their size (descriptor_data.rs), whole-wave sections that a jump splits, and the other changes listed in its message.

Adapted to this branch

Results (RTX 5060, 32-lane waves)

victory translate --validate --pipelines --list over the 31 wave64 compute containers from the RTX 5060 preload. VICTORY_DATA_DIR and VICTORY_CACHE_DIR pointed to empty scratch folders. All 31 validate in both builds.

Program #61 (6684db0) This PR
02384a60fda6f2d0 refused (requires wave64) created (paired)
1d434307d981352a refused (requires wave64) created (paired)
22338086ea4c5364 refused (requires wave64) created (paired)
2da4beb386509b77 refused (requires wave64) created (paired)
3b02415f67c6b0d8 refused (requires wave64) created (paired)
6832a9da15c2e584 refused (requires wave64) created (paired)
6b82bc7d22016cb5 refused (requires wave64) created (paired)
28918b7150a7aad5 (BVH builder) refused (requires wave64) created (paired)
caa78b8ca62bc3d6 (BVH builder) refused (requires wave64) created (paired)
the other 22 created created (no change)

Total: 31 of 31 created (was 22). With VICTORY_WAVE_WHY=1, exactly the 9 programs above report WAVE64-RETRY paired lanes: wave Some(32).

Checks (local, Windows, since CI here waits for approval)

Not verified

  • The BVH builder with VICTORY_BVH_BUILDER=1. Its programs now get pipelines, but the builder has not run in game on this card. That run is where the Shaders, GPU: on 32-lane hosts, wave64 halves act as waves; the BVH builder waits (stacked on #2176, #2118) Marvisak/VIctory#2711 hang would show up.

  • Gameplay. No run of the title with these pipelines yet. A pipeline that gets created is not proof that the program computes what it should in the game. This needs a play test on the RTX 5060.

  • The rest of 26600c6 (mesh linking, interpolation and signature changes, 64-bit floats) was checked only by the test suite and this compute set. I did not run the full shader pack through it.

  • AMD (64-lane) hosts should be unaffected, because the paired form is only tried when the host's largest wave is 32. I have not checked this on an AMD card.

🤖 Generated with Claude Code

Castyan and others added 20 commits November 25, 2026 19:29
…to combined-preload-pops

# Conflicts:
#	Setup-DexNomRuntime.ps1
#	apps/victory/src/play_launcher.rs
#	apps/victory/src/translate.rs
#	crates/victory-gpu/src/descriptor/host.rs
#	crates/victory-gpu/src/host.rs
#	crates/victory-gpu/src/pipeline/make.rs
#	crates/victory-hle/src/modules/d3d12x.rs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…wn lanes

Three wave64 compute shaders (a 512-thread prefix over per-wave totals) were
refused on 32-lane hosts: inside a loop only one console wave's lanes run,
v_readfirstlane copies a running sum built from scalars and LDS alone. Two
host waves cannot exchange there (no group barrier inside the loop), but every
lane holds the same sum, so each host wave's own first lane is exact.

scalar_built() finds such VGPR values (VALU results and LDS reads of them,
phis at loop headers or where every predecessor runs on all lanes; guards
allowed), and remembers which a guarded write made: those are only taken by a
read that is itself inside a branch.

Fixes 9fc111d3be79364f, 77360df21e12ea43 and 39321a95223001ed on the
RTX 5060; their pipelines are now created.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…change loop

Compute 7f61193d2c0e5f22 was refused by CreateComputePipelineState with
E_OUTOFMEMORY on the RTX 5060 and on WARP alike, although its DXIL validates.
Bisecting the console code down to one instruction: ds_add_rtn_u32 of
(0 - x) on group-shared memory. Host compilers turn atomicrmw add of a
negation into atomicrmw sub, which DXIL has no group-shared form of, and
refuse the pipeline; ds_sub_u32 (atomicrmw sub) fails the same way.

Both are now a load and a cmpxchg loop on old - x (lds_subtract); other
atomics keep their atomicrmw. A test runs ds_add of 0 - 1 and ds_sub of
0 - 1 over 32 threads and checks LDS on the card (32 and 96).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port of DexNom#40 (notquiteog), unchanged. A console wave64 compute
program that no other form takes off 64-lane waves is refused by a 32-lane
host and every dispatch of it is dropped; the exact wave-wide form is tried
last, only for those. VICTORY_WAVE_WIDE=0 keeps the old refusal.

On the RTX 5060 this creates 22 of the 31 compute pipelines the title's
preload left refused for requiring WaveSize(64). The 9 left: 7 run groups of
several console waves (128 to 1024 threads), which the wave-wide form does
not take, and 2 are ray-tracing BVH builder programs (28918b7150a7aad5,
caa78b8ca62bc3d6) whose waves exchange across halves.

Co-Authored-By: notquiteog <notquiteog@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Castyan

Castyan commented Nov 26, 2026

Copy link
Copy Markdown
Author

In-game test on the RTX 5060 (build 40c2f29)

Two runs with the preload launcher from #47, using a fresh test folder.

Run 1 (cold cache) Run 2 (warm cache)
Preload 25,758 shaders translated, 0 refused. 2,732 compute pipelines, 2 refused (the two BVH builder programs). 709 s Same counts, 85 s
New paired pipelines used in game 02384a60fda6f2d0, 2da4beb386509b77 02384a60fda6f2d0, 2da4beb386509b77, 6b82bc7d22016cb5
D3D12 device removal / GPU hang none none
End frame 1716: title null write 0xc0000005 at +0x23cf683 frame 1706, 8 min 30 s, intro Prestream: title breakpoint 0x80000003 at +0x5149aec, crash report INSTANCE_LIST: 44997/45000

Both endings are crashes that docs/nvidia-rtx5060.md already records on builds without this PR:

Neither ending points at the paired form. Both runs show no device removal and no shader error before the crash.

Not seen yet: the other 4 paired programs never ran before the intro ended. The game ran at about 0.5 fps during Prestream. I have not checked rendering on screen.

@Castyan

Castyan commented Nov 26, 2026

Copy link
Copy Markdown
Author

Status: device method 0x218 (native compute pipelines)

A follow-up commit is ready locally on wave64-paired-form but not pushed yet. The PR head is still a65db62.

3a9874c Make compute pipelines from programs the title compiled itself (device method 0x218)

  • At start the title calls 0x218 for every variant of its mip-generation compute programs. The program is now read from the 0x60-byte description (registers, console resource table, code), wrapped in a container of its own, and then translated and cached like the title's containers. A description that cannot be read still returns E_NOTIMPL with a null output.
  • The descriptor tracer now folds s_bfm_b32 and a 64-bit s_mov of a literal (zero-extended). These two instructions build the programs' fixed sampler; without them the tracer lost the sampler's origin and the pipeline was refused.
  • 0x1c8 (native graphics pipelines) is still refused, because it needs the draw's render-target formats.

Checks (RTX 5060)

Check Result
cargo clippy --workspace --all-targets --locked -- -D warnings (with and without --all-features) pass
cargo test --workspace --locked pass
Replay of the five captured 0x218 descriptions 5/5: hardware PSO and runtime creation

Open points

  • No in-game run with this commit yet.
  • One full test run stopped in victory-gpu --lib without a result. It passed on both reruns, alone and as part of the full suite, so it may be a flaky test.

🤖 Generated with Claude Code

@Castyan

Castyan commented Nov 26, 2026

Copy link
Copy Markdown
Author

Report: three commits pushed (a65db62..a971716)

3a9874c Make compute pipelines from programs the title compiled itself (device method 0x218)

  • At start, the title passes 0x218 a 0x60-byte description for each of its mip-generation compute programs. The program is now read from that description (registers, console resource table, code), wrapped in a container of its own, and then translated and cached like the title's own containers. A description that cannot be read still gets E_NOTIMPL with a null output.
  • The descriptor tracer now folds s_bfm_b32 and a 64-bit s_mov of a literal. These two instructions build the programs' fixed sampler; without them the tracer lost the sampler's origin and the pipeline was refused. The literal is zero-extended, which is what the hardware does for a binary 64-bit operand (LLVM PR #70274).

17b34d2 Restore the shortcut note on 0x1c8 and classify native_build.rs in order

  • 0x1c8 (native graphics pipelines) is still refused, because it needs the draw's render-target formats. This commit restores its shortcut: note, which 3a9874c had dropped.
  • It also moves native_build.rs to its sorted place in the list of sources outside translation, with the reason it is there: it only writes containers, which are hashed like any other.

a971716 Wait for the heap to go before the in-place test gives its pages back

  • cargo test -p victory-gpu --lib failed about 2 runs in 15 with an access violation or a failed assertion in inplace::tests. It already did so on a65db62.
  • Cause: the test decommitted pages right after dropping the heap opened on them. WARP unlocks those pages only a moment later, so under load VirtualFree returned ERROR_INVALID_PARAMETER. The test now retries for 2 s at most and checks that the final release succeeds. The library then passed 40 runs out of 40.
  • Possible runtime consequence: a title VirtualFree that lands right after an in-place heap is dropped (title_memory_freeing) could be refused the same way. Not addressed here.

Checks (RTX 5060)

Check Result
cargo clippy --workspace --all-targets --locked -- -D warnings (with and without --all-features) pass
cargo test --workspace --locked pass
cargo test -p victory-gpu --lib, 40 runs in a row 40/40
Replay of the five captured 0x218 descriptions 5/5: hardware PSO and runtime creation

These commits have not been run in game yet.

🤖 Generated with Claude Code

@Artking175

Artking175 commented Nov 26, 2026 •

Copy link
Copy Markdown

Independent RTX 2060 check on pinned a97171618112102dbf1ec950ec6256e78788254e, using one binary and toggling only VICTORY_WAVE_PAIRS. Windows 10, driver 531.41, Agility 1.614.1 through the #12 loader overlay, native wave32. Both modes ran translate --jobs 1 --validate --pipelines --list.

Input DXIL validated in both modes D3D12 PSOs, pairs off → on
XboxBvhBuilder.dll 52/52 50/52 → 52/52
The seven listed non-builder compute shaders 7/7 0/7 → 7/7

The two recovered builder container hashes are 3297538b1176c897 and 138a77fa89f35ae4. No pipeline that worked with pairs off was lost in this set. All six emit::wave64_tests cases matched by the paired filter passed, with no hardware skip messages. This test covered offline pipeline creation and synthetic GPU readback.

An earlier DexNom prologue capture on 2e01ab4 recorded refusals for two of the seven restored compute programs, 02384a60fda6f2d0 and 2da4beb386509b77. This identifies two concrete dispatches to check in the next RayTime capture.

@Castyan

Castyan commented Nov 26, 2026

Copy link
Copy Markdown
Author

Ty @Artking175 for your independent test, i'm still working on it

@Castyan
Castyan marked this pull request as draft November 26, 2026 05:56
@Castyan

Castyan commented Nov 26, 2026

Copy link
Copy Markdown
Author

Report: in-game runs, decoder fixes pushed (a971716..88f8f9a)

The 0x218 path was run in game (RTX 5060, BVH builder off, fresh cache and saves).

First run with 3a9874c: about 512 pipelines were made and over 1024 descriptions were turned down. Nothing said why, so 88f8f9a adds the reason to the log, plus VICTORY_DUMP_NATIVE=<folder> to save turned-down descriptions in the format the replay tool reads. Real descriptions captured that way showed four misreadings in the decoder:

9eac44a Read 0x218 resource tables as the title writes them

  • User-data dword and stride were swapped. The byte in the packed word is the user-data dword: every entry of root slot k names dword 4 + k, which fits the program's COMPUTE_PGM_RSRC2 user-SGPR count. The u32 before it is the stride: 0x10 or 0x20 for structured buffer SRVs, 4 for images, as in the title's own containers. With the swap, the CBV of every accepted mip-generation program, including the five original captures, named user-data dword 0 instead of the table in dword 4. That wrong pipeline was built without any error. A root parameter that names user data the program does not have is now refused.
  • The header count is not reliable: it said 11 for 12 entries in one table. Entries are now told apart by their tag.
  • Root type 0 is root constants, read as values straight from the user SGPRs (v_mul_f32 v7, s5, v7). Each now becomes a root parameter of size/4 SGPRs, with no used resource.
  • The thread-group depth is the low half of its word. The high half holds something else (0x10 seen with 32 × 1 × 1 groups).

Result in game: over 2048 pipelines made, 32 to 63 descriptions turned down. Of the eight descriptions captured in game, all now decode and four reach a hardware pipeline. The other four stop at translator limits (a descriptor changed after loading, an address with two computed terms). The five earlier captures still pass.

Still open

  • One more root type not read yet, behind the 32 to 63 descriptions still turned down.
  • Translator limits on accepted 0x218 programs: 221 compute shaders did not translate in the last counted run, mostly a descriptor outside the heaps, a descriptor changed after loading and partial image or typed-buffer stores.
  • Frame times in game are similar to earlier runs (about 0.5 to 2.5 s per frame in heavy scenes once the pipeline cache is warm).
  • Correction to my previous report: a971716 fixed the failed assertion in the in-place test but not the access violation in cargo test -p victory-gpu --lib. The 40 clean runs were a lucky streak. The crash is still there, about 1 run in 50 when the GPU is idle and 2 to 4 in 40 under load, and it already occurs on a65db62. Comparing four crashes narrows it to about 100 candidate tests; skipping the in-place probe does not remove it. Finding it needs a crash dump (cdb or WinDbg).

Checks: cargo clippy (with and without --all-features) and cargo test --workspace --locked pass.

🤖 Generated with Claude Code

@Artking175

Copy link
Copy Markdown

I ran the prologue game A/B on RTX 2060 with one release binary at the pinned a971716 revision from my earlier offline report and only VICTORY_WAVE_PAIRS switched. Windows 10, driver 531.41, Agility 1.614.1, Series X with RT off. Both modes reached the heavy scene. The paired run logged a host PSO for 2da4beb386509b77. I found a first-bind line for it in the control, but no corresponding host PSO creation line. None of the seven target compute hashes appeared as a dispatch in the six sampled frame command lists per run. Both sets of captures stayed nearly black. The paired run also got a second Enter before the heavy scene, so the visual timing is limited.

Your 88f8f9a update is newer than this A/B. For a follow-up against that head, I'd count actual recording of the target dispatches by hash alongside the new 0x218 refusal and replay diagnostics. A PSO-creation line and a dispatch counter would tell us whether the paired wave path is reached during the prologue independently of the decoder changes. A fixed capture point and one verified profile confirmation per run would make the pictures easier to compare.

The reported intermittent GPU-suite access violation predates this PR on a65db62. I'd keep its dump-based isolation separate from the paired shader acceptance result.

warp_a_title_buffer_in_place_shows_its_bytes_at_its_offset decommitted
half of its allocation right after dropping the buffer placed over it.
The pages of a heap opened on private memory stay locked until the
runtime has destroyed the heap, and WARP may do that a moment after the
last reference goes: under the load of the whole victory-gpu suite the
decommit was sometimes refused (ERROR_INVALID_PARAMETER) and the test
failed, or the run ended in an access violation. About 2 runs in 15
failed this way, already on a65db62.

The test now retries the decommit for two seconds at most, drops its
command queue before releasing the allocation, and checks that the
release succeeds. 40 runs of the library in a row now pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Castyan

Castyan commented Nov 26, 2026

Copy link
Copy Markdown
Author

Progress since 88f8f9a (work in progress, nothing pushed yet)

Three follow-ups are running in parallel, each on its own local branch based on 88f8f9a. They will be merged and validated together before anything is pushed here.

Root descriptors in 0x218 tables (d01a06a, branch type-racine)

  • Root type 1 in a console resource table is a root descriptor: a 64-bit buffer address held in two user SGPRs.
  • The code shows it: the program builds a buffer descriptor around s7:s8 (s_mov_b32 s20, s7, s_mov_b32 s21, s8, then s_buffer_load_dword … s[20:23]).
  • It now decodes as a root parameter of two SGPRs plus a used resource, the same shape the title's own containers give.
  • The four captured programs that used it now decode, but the translator turns them down further on.

Translator, on 0x218 programs (cffdc06, 93da0c6, branch traducteur-218)

  • 32-lane detection: a 0x218 program whose depth word carries 0x10 in its high half is a 32-lane program, even though bit 5 of its flags is clear. Evidence: it moves exec_lo alone, keeps scalars in vcc_hi, and uses VGPRs exactly up to the 32-lane count of COMPUTE_PGM_RSRC1. Read as 64 lanes, a v_cmp writing s[15:16] overwrote a descriptor in s[16:19], which caused "a descriptor changed after loading".
  • Structured buffers made raw: these programs rewrite a structured buffer's descriptor into a raw one right after loading it. They clear the stride, scale the record count by the stride, and set OOB_SELECT to raw. The tracker now takes the rewritten descriptor as the load's. An access by index or format through it is still refused.
  • Three captured programs get past these descriptors. Together with a fourth, they now stop at user SGPRs that the resource table names no root parameter for (a heap and its index, as far as the code shows), which will need the root signature.

The intermittent victory-gpu --lib access violation (branch violation-acces)

  • It is being isolated with cdb.
  • A strong lead comes from avatarmanz/VIctory-7900XTX@160d222. That commit traces the crashes to d3d10warp.dll itself when two tests use the software adapter at once, and makes WARP tests take turns. It also fixes a race in watch.rs, where a view guarded by a concurrent refresh stayed read-only.
  • The fix is being checked against our crash dumps and measured over 240 runs. Not confirmed yet.

#61 on its own

  • 6684db0 was checked alone: both CI Clippy passes are clean. cargo test --workspace failed only on the known in-place decommit race at inplace.rs:1402.
  • With a971716 cherry-picked on top (local 8cdfc63 on combined-preload-pops, not pushed), the whole workspace suite passes.

🤖 Generated with Claude Code

@Castyan

Castyan commented Nov 26, 2026

Copy link
Copy Markdown
Author

@Artking175 thanks for the RTX 2060 A/B and the careful write-up (re: #64 (comment)).

I agree with the split. The runs on our side don't answer whether the paired wave path is reached in the prologue either. They were about device method 0x218, and we didn't count dispatches of the seven target hashes or keep frame captures. So your result stands as is: the paired run creates a host PSO for 2da4beb386509b77, the control doesn't, and the sampled command lists show no dispatch of the seven targets.

For the follow-up against the newer head, your proposal is the right measure:

  • A dispatch counter by hash for the seven targets, per run, alongside the PSO-creation lines. That alone says whether the paired path is used, regardless of the decoder.
  • The 0x218 diagnostics, kept separate: the refusal reason in the log, and VICTORY_DUMP_NATIVE=<folder> to save turned-down descriptions for offline replay. They tell us about the decoder, not about the paired path.
  • A fixed capture point and one confirmed profile per run, so the pictures compare. A single Enter press before the heavy scene would also remove the timing difference you saw.

On the access violation, agreed as well: it predates this PR (a65db62) and is being isolated with dumps on its own branch, apart from the paired-shader result. A likely cause is two tests driving d3d10warp.dll at once (avatarmanz/VIctory-7900XTX@160d222). If that is confirmed, it would go to #61 too, since the same tests are there.

One note for reading the 88f8f9a head: 9eac44a changes which user data 0x218 programs read their descriptors from (the CBV used dword 0 instead of the table in dword 4). It can change what those passes draw, but it doesn't touch the paired form, so it shouldn't affect the A/B on the seven targets.

🤖 Generated with Claude Code

The test binary's random access violations were d3d10warp.dll's own. Every
test that asks for the software adapter gets the same device (one per
adapter in a process), and two of them compiling and running compute
shaders at once crash its shader compiler: in JITBaseVariable::OptimizeCopy
as a ComputePipelineShaderJIT is torn down, under ExecuteCommandLists of
the indirect tests' harness, or in Task_CompileShader on its own worker
threads. Every stack caught under cdb had two or more indirect::tests::warp_*
tests inside it at once. They take turns now, with the in-place tests that
open the same adapter: under cdb, 50 of 588 runs of all tests crashed
before, none of 240 after; 150 plain runs passed.

frame's tick test tries again when a busy PC wakes a wait late.

Ported from avatarmanz/VIctory-7900XTX 160d222 (its WARP turn and frame
parts; its write watch change is left out here).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Artking175

Copy link
Copy Markdown

I opened the dispatch-count follow-up against your wave64-paired-form branch: Castyan#3

On RTX 2060, the same release executable reached the prologue in both modes and both lost the D3D12 device with 0x887a0005. The fatal snapshots had zero attempts and recordings for the seven selected target hashes. A separate hash, 7d460e9b7accbe81, showed 18 indirect attempts and zero recordings with pairs on.

Offline on that executable, both modes still validated all seven target shaders. With pairs off, 0/7 hardware PSOs were made. With pairs on, 7/7 were made. This isolates the earlier pipeline creation result from the game session, which ended before those commands were recorded.

@Castyan

Castyan commented Nov 26, 2026

Copy link
Copy Markdown
Author

Report: 88f8f9a..ed45fe9 pushed (0x218 decoder and translator, WARP test crash)

Three follow-ups were developed in parallel, each on its own branch from 88f8f9a. They were merged together on an integration branch, validated there as one tree, and then fast-forwarded here.

1. Root descriptors in 0x218 tables: d01a06a

  • Root type 1 in a console resource table is a root descriptor: a 64-bit buffer address in two user SGPRs.
  • The code shows it: the title's program builds a buffer descriptor around s7:s8, then loads through it:
    s_mov_b32 s20, s7
    s_mov_b32 s21, s8
    s_mov_b32 s22, -1
    s_mov_b32 s23, 0x31016fac
    s_buffer_load_dword s27, s[20:23], null
    
  • It now decodes as a root parameter of two SGPRs plus a used resource, the shape the title's own containers give.
  • The root slots take user-data dwords from 4 on, in order: one dword for a table, two for a root descriptor, then the root constants' count. Every capture agrees with this.

2. Translator, on 0x218 programs: cffdc06, 93da0c6, 722655c, 73d8513

  • cffdc06 32 lanes. Bit 5 of the flags (32 lanes in the title's containers) is clear in every 0x218 description. The programs whose depth word carries 0x10 in its high half are nonetheless 32-lane programs:
    • they move exec_lo alone and keep scalars in vcc_hi;
    • they use VGPRs exactly up to the 32-lane count of COMPUTE_PGM_RSRC1 (v143 of 18 granules, v127 of 16, v40 of 6).
    • Read as 64 lanes, a v_cmp writing s[15:16] overwrote a descriptor in s[16:19], which was the "a descriptor changed after loading" refusal. The VGPR count was also half the program's.
  • 93da0c6 Structured buffers made raw. These programs rewrite a structured buffer's descriptor right after loading it: the stride is cleared in dword 1, the record count multiplied by the stride, and OOB_SELECT set to raw. The tracker now takes the rewritten descriptor as the load's, since the host's views are raw already. An access by index or format through it is still refused (with stride 0, the index would add nothing).
  • 722655c More capture. VICTORY_DUMP_NATIVE now also saves descriptions whose program does not translate, and every saved description gets its root signature beside it (slot218-<n>-root.bin).
  • 73d8513 Root signature. The table names only some of the user SGPRs a program reads. The decoder now reads the root signature the description names (an RTS0 part) and adds the parameters the table leaves out, placed by the rule above. Nothing is guessed. The program is refused, with its reason, when:
    • the table places a parameter elsewhere;
    • a parameter is cut by the end of the user SGPRs;
    • user SGPRs are left past the parameters (where a directly indexed heap would be: no capture places one);
    • the signature cannot be read.
      An earlier version that placed the heaps by assumption was dropped before merging.
  • ed45fe9 Reconciliation. The two branches disagreed on root SRVs: the table decoder reads one, while the signature reader refused all of them. A root SRV in the signature is now taken where the table places it itself. One that only the signature names is still refused, as is every root UAV.

3. The intermittent victory-gpu --lib access violation: dddb8e3

  • Cause, from stacks caught under cdb: two tests compiling and running compute shaders at once on the software adapter crash d3d10warp.dll's shader compiler:

    • JITBaseVariable::OptimizeCopy, while a ComputePipelineShaderJIT is torn down;
    • ExecuteCommandLists of the indirect tests' harness;
    • Task_CompileShader on WARP's own worker threads.

    Every stack had two or more indirect::tests::warp_* tests inside it.

  • Fix: tests that use the software adapter now take turns, the in-place tests included. Ported from avatarmanz/VIctory-7900XTX@160d222 (its WARP-turn and frame parts). frame's tick test also retries when a busy PC wakes a wait late.

  • Under cdb: 50 crashes in 588 runs before, 0 in 240 after.

Validation of ed45fe9

Check Result
cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --all-features pass
cargo test --workspace --locked pass
victory-gpu --lib, plain runs 199/200; one failure left no output
victory-gpu --lib, 100 pairs run at once (heavy load) 2 failures, both in watch::tests, no access violation
Replay, the five original captures 5/5
Replay, the eight descriptions captured in game all decode; 4 reach a hardware pipeline
  • The watch::tests failures already exist on Respect D3D12 limits, Preload and Play, POPS diagnostics, and RTX 5060 shader/pipeline fixes #61 alone. Same load, same failures: a_view_mapped_beside_a_guarded_one_makes_it_check_again at watch.rs:1484, twice in 200. No commit here touches watch.rs.
  • The watch part of 160d222 (tests forget their guards before freeing their memory, plus a runtime race where a view guarded by a concurrent refresh stayed read-only) does not port mechanically: our watch.rs has diverged (aliased blocks, clean sets). It is left for its own change.
  • The four captured programs that do not translate yet now stop further along, at translator limits: "an address with two computed terms" (m005 to m008) and "a hardware SGPR input" (the four root-descriptor programs).

In game (RTX 5060, BVH builder off), before this push, with 9eac44a

  • 0x218 made over 2048 pipelines and turned down 32 to 63 descriptions. The first run with 3a9874c had made about 512 and turned down over 1024.
  • No error, crash or device loss. In heavy scenes, about 0.5 to 2.5 s per frame once the pipeline cache is warm, as in earlier runs.
  • ed45fe9 has not been run in game yet.

#61

#61's branch now carries the two test fixes as well (6684db0..2287c4b): 8cdfc63, the in-place decommit race, and 2287c4b, WARP tests taking turns. Checked alone: Clippy ×2 and cargo test --workspace pass, and victory-gpu --lib passed 100 plain runs out of 100.

Next

  • Translator: "an address with two computed terms" and "a hardware SGPR input" on 0x218 programs.
  • A game run with ed45fe9 and VICTORY_DUMP_NATIVE, to capture real root signatures. This would confirm or extend the placement rule.
  • The watch race, as its own change.
  • 0x1c8 (native graphics pipelines), still refused: it needs the draw's render-target formats.

🤖 Generated with Claude Code

@Castyan

Castyan commented Nov 26, 2026

Copy link
Copy Markdown
Author

Report: ed45fe9..77845b8 pushed (0x218 programs: decoder and translator)

A game run with ed45fe9 captured 200 descriptions passed to device method 0x218, with their root signatures. A second run with the intermediate fixes captured 200 more, including programs that decode but do not translate. Every change below rests on those captures, and each one comes with a test.

Decoder (native_build.rs)

  • f592276 User SGPRs past the root parameters are no longer a refusal. That refusal (from 73d8513) had turned down over 1024 descriptions in game. Of the first 200 captures, 196 end their parameters exactly at their user-SGPR count. The 4 with one more SGPR never read it.
  • 7b317c5 Root constants take their count from the signature. The table's byte for root constants is 4 whatever the count: the signatures show 1, 2, 3 or 4 constants, always with byte 4. Reading that byte as a size in bytes (9eac44a) gave only the first constant, and 35 captures were refused as "a hardware SGPR input".
  • 851713d Directly indexed heaps. In the second capture set, every program with CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED has exactly one user SGPR past its parameters (61 programs), every one with both heap flags has two (43), and no other program has any. The first is the view heap: the code adds an offset to it, loads a buffer descriptor there with s_load_dwordx4, and reads its stride. These SGPRs are now ResourceHeap, then SamplerHeap parameters, but only when the count matches exactly. Otherwise they stay unnamed, and the translator refuses any program that reads one.

Translator

  • 6a4cacb src_scc. Operand 253 reads SCC as 0 or 1 (s_mov_b32 sN, src_scc, s_add_u32 …, src_scc, v_mov_b32 v0, src_scc). It was refused as "a special operand" in 37 captures. An execution test covers it on the card and on WARP.
  • eda8fa7 Scalar operations: s_pack_ll/lh/hh_b32_b16, s_bfm_b64 and s_bitreplicate_b64_b32, with an execution test reading both halves of the 64-bit results.
  • 90580ec image_store with any channel mask, ported from Shaders: lower image_store with any non-zero channel mask (including sparse) fxceless/victory-fork#146 (67f7ff0) by Davi713. The enabled channels come from consecutive VGPRs and the disabled ones are written as 0. This was 60 captures. The PR's 10-case execution test is included.
  • daf426a Typed buffer stores of fewer than four channels (buffer_store_format_x/xy/xyz/d16_x), with the other channels written as 0 by the same rule. This was 19 captures. An execution test reads a typed RGBA16F buffer back. A store at an offset is still refused.
  • 7331754 v_ldexp_f32 as three multiplies by powers of two, so the result is rounded once. An execution test checks it against f64 references, past both ends of the float range.
  • 77845b8 Heap addresses whose high half is the carry through src_scc (s_add_u32 s41, 0, src_scc) are now taken as s_addc_u32 x, 0 already was. This was the "untracked high half" refusal, 44 captures.

Results

Before (ed45fe9) 77845b8
First 200 captures reaching a hardware pipeline (replay) 2 88
Second 200 captures (programs that decode but don't translate) 5 23
In game: 0x218 descriptions turned down at decode over 1024 0
In game: 0x218 pipelines made over 1024 over 2048
In game: errors, crashes, device losses 0 0

The refusals fixed here are gone from the game log (measured at 7331754). The most common ones left in game are "an address not from a root parameter" and lane-mask emulation of wave64 programs on 32-lane hosts.

Checks at 77845b8: Clippy with and without --all-features and cargo test --workspace --locked pass. Replay: the five original captures 5/5, the two capture sets 88/200 and 23/200 (the rest stop at translator limits). One known flake remains: the watch::tests failures under heavy load also happen on #61 alone, about 1 run in 100.

In progress, on separate branches

  • Lane masks of wave64 programs on 32-lane hosts.
  • Addresses and descriptors read as data.
  • The thread-group info SGPR, LDS addresses and missing instructions (v_mad_u32_u16, s_sext_i32_i16, …).
  • The watch part of avatarmanz/VIctory-7900XTX@160d222: a runtime race where a view guarded during its mapping stays read-only, plus the watch tests' guards outliving their memory.

🤖 Generated with Claude Code

@Castyan

Castyan commented Nov 26, 2026

Copy link
Copy Markdown
Author

I'm back babe

@Castyan

Castyan commented Nov 26, 2026

Copy link
Copy Markdown
Author

Report: 77845b8..f87ea51 pushed (lane masks, addresses, missing ops, watch race)

Four branches, each developed and validated on its own and then merged together. Every change rests on the same two sets of 200 captured 0x218 descriptions as the previous report, and each one comes with a test. As before, nothing guesses: a program whose semantics are not reproduced exactly is still refused.

Lane masks (masques-lanes)

  • 9d793f0 EXEC set to constant lanes (s_bfm_b64 exec, 32, 0, halves moved apart with s_mov_b32 exec_lo/exec_hi, s_bitreplicate_b64_b32, the low half alone after s_mov_b64 exec, -1) is taken as that constant mask.
  • 669079e The same for s_pack_ll/lh/hh_b32_b16, s_movk_i32 and s_brev_b32. An execution test runs 8 constant-mask cases on the card and on WARP against the console's 64-lane result. "A lane mask whose lanes depend on its own value" is now 0 in both capture sets.

Addresses and descriptors (adresses-descr)

  • cafae69 A program whose lowering reads a value its block is not dominated by is refused instead of panicking (m083). The check uses dominance; a unit test covers a phi input that is not dominated.
  • 9a2e7ce s_bfm_b64 of constants is folded into the words it writes. An execution test covers an immediate sampler built that way. "An address not from a root parameter" is now 0.

Missing operations (ops-diverses)

  • 08a73da s_sext_i32_i8 / s_sext_i32_i16, 7b3774f v_mad_u32_u16, 3fd809c v_pk_fmac_f16 (rounded once; the test fails without round-to-odd: 0x3e02 instead of 0x3e01), c856ab9 v_add_nc_u32 / v_sub(rev)_nc_u32 with clamp, 941b097 buffer_atomic_sub. Each one has an execution test against an exact reference, with edge cases.
  • 9d3d205 The thread-group info SGPR (COMPUTE_PGM_RSRC2.TG_SIZE_EN). The programs read the wave count and the wave index times 64 (s_and_b32 sN, s6, 0xfc0, then v_mbcnt). These values are reproduced exactly for the waves the host runs. A read that keeps the unknown bits above 11 is refused.
  • ds_append is still refused.

watch race (watch-course)

  • 5725c79 Views guarded while they are mapped stay writable. Ported from avatarmanz/VIctory-7900XTX 160d222 (its watch part, adapted to our aliased blocks and clean sets). The race: a refresh on another thread could guard a view's new blocks between the mapping and its notification. The notification then forgot them while leaving them read-only, so the title's next write was an access violation nobody caught. It was reproduced in a test and shown as a STATUS_ACCESS_VIOLATION before the fix. The watch tests now forget their guards before freeing their memory.
  • 786294a frame's next-tick wait is checked by its time-out, not the wall clock.
  • After the fix: 0 failures in 100 pairs of the victory-gpu test binary run two at a time, plus 100 ordinary runs.

Results

Replay (hardware pipeline reached) 77845b8 f87ea51
First 200 captures 88 162
Second 200 captures 23 101

No program that passed on any of the four branches is lost after the merge (checked program by program). Clippy (-D warnings, with and without --all-features) and cargo test --workspace --locked pass on f87ea51.

Repositories used

Repository Owner Used for
DexNom/VIctory DexNom Upstream project; this PR's target
Castyan/VIctory Castyan The fork carrying wave64-paired-form
avatarmanz/VIctory-7900XTX avatarmanz 160d222: the watch race fix (ported here) and the WARP test serialization (ported earlier in dddb8e3)
fxceless/victory-fork fxceless image_store with any channel mask (Marvisak#146, 67f7ff0 by Davi713), ported in 90580ec

Next

A test will be run in game with f87ea51 to measure how many 0x218 pipelines are now made and which refusals remain. Its results will follow in this PR.

🤖 Generated with Claude Code

@Castyan

Castyan commented Nov 26, 2026

Copy link
Copy Markdown
Author

In-game test: 6dbdf24 (f87ea51 + two lane-mask commits)

Before the test, two commits that masques-lanes finished after f87ea51 were merged, so the game would not run a known wrong result:

  • 9335ddf A lane read inside a whole-wave section is no longer taken as each lane's own value. v_readlane_b32 s14, v1, 3 with v1 = t + 1 gave each thread t + 1 where the console gives 4. This bug predates this PR. Such a read is now unknown to the simulation, and the program is refused instead of computing a wrong value. The execution test stored 1, 2, …, 64 on the RTX 5060 without the fix.
  • 126ec99 A lane of a reduction read after EXEC is restored is now taken.

Validation at 6dbdf24: Clippy (-D warnings, with and without --all-features) and cargo test --workspace --locked pass. Replay: first 200 captures 162 → 165, second 200 captures 101 → 103, none lost.

Run

A release build with the 0x218 capture on. The shader preload finished in 222 s: 25,758 shaders translated with 0 refused, and 2,734 compute pipelines with 0 refused. Then about 5 minutes in game, ending with a clean exit (code 0).

In game 6dbdf24
0x218 descriptions turned down at decode 0
0x218 pipelines made over 2,048 (the log counts in powers of two)
Compute shaders that do not translate (each distinct) 553

The refusal count depends on how far the run goes in the game, so it cannot be compared directly with earlier runs of a different length.

Refusals that remain

Reason Shaders
a structured buffer made raw, read by index or format 313
a lane mask read as data 72
a descriptor's address or format read as data 50
a descriptor built around a table in the code 24
a whole-wave section step the simulation does not follow 14
a descriptor changed after loading 12
a lane mask exchanged where not every lane runs 10
a first-lane read where not every lane runs 9
s_absdiff_i32 7
a constant buffer's descriptor read as data 7
a hardware SGPR input 5
16 other reasons, 1 to 4 shaders each 30

"An address not from a root parameter", which was the first refusal in game, and "a lane mask whose lanes depend on its own value" no longer appear. The largest remaining refusal, "a structured buffer made raw", is deliberate: it stays until raw access to a structured buffer is reproduced exactly. The 200 refused descriptions captured in this run, with their root signatures and reasons, are kept for the next round.

🤖 Generated with Claude Code

Castyan and others added 2 commits November 26, 2026 20:28
…f fxceless#854)

Port of 26600c6 from fxceless/victory-fork#854 by PiloteCode ("wave64
programs in a paired form on 32-lane hosts, mesh programs over 32 KiB
linked with their pixel program, and more"). Each console wave runs as
one host wave of 32 lanes, each thread two console lanes (n and n + 32),
with every per-lane branch taken by the whole wave and EXEC as each
lane's guard. It is tried after every other form for a wave64 compute
program the host refuses (VICTORY_WAVE_PAIRS=0 turns it off).

On the 31 wave64 compute containers from the RTX 5060 preload, 29 get a
pipeline (22 before): 02384a60fda6f2d0, 1d434307d981352a,
22338086ea4c5364, 2da4beb386509b77, 3b02415f67c6b0d8, 6832a9da15c2e584
and 6b82bc7d22016cb5 now take the paired form; the other 22 are
unchanged.

Adapted to this branch:
- Kept from this branch: scalar_built() and the v_readfirstlane own-lane
  read, lds_subtract() with Module::negated() (the PR's own LDS
  subtraction loop is left out), the wave-wide last resort from
  DexNom#40 (now inside emit_forms), the POPS translation from pops.rs,
  the structured view record count / picked address / puddle texture
  size paths and scalar UINT views (moved into descriptor_data.rs next
  to the PR's unused-descriptor path, which now only runs where this
  branch refused).
- Left out: the PR's second POPS implementation (ir::without_pops_wait,
  Shader::ordered and its test), which would have run beside pops.rs.
- The ray-tracing structure builder's programs (a spilled user-data
  table, as victory-gpu classifies them) are refused by the paired form:
  forcing them onto 32-lane hosts hung NVIDIA GPUs in Marvisak#2711.
  28918b7150a7aad5 and caa78b8ca62bc3d6 stay refused.
- The new modules are classified in lib.rs; a test that expected the
  parked mask to be opaque when built alone checks only the shared build;
  the descriptor size test fills the record-count root word the runtime
  fills.

Co-Authored-By: Pilote Production <75377040+PiloteCode@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The two BVH builder programs (28918b7150a7aad5, caa78b8ca62bc3d6) were
the last wave64 compute programs refused on 32-lane hosts. They exchange
across the console wave's halves, which the per-half form got wrong and
which hung NVIDIA cards (Marvisak#2711). The paired form keeps
both halves in one host wave, so the refusal is dropped: all 31 wave64
compute containers from the RTX 5060 preload now get a pipeline.

The builder still runs only when victory-gpu allows it
(VICTORY_BVH_BUILDER=1 or VICTORY_RAY_TRACING=1) and every one of its
pipelines has a host pipeline; by default its dispatches stay dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants