Skip to content

Shaders: follow paired dword mask copies - #702

Open
Flyander wants to merge 1 commit into
fxceless:mainfrom
Flyander:fix/paired-dword-mask-provenance
Open

Flyander wants to merge 1 commit into
fxceless:mainfrom
Flyander:fix/paired-dword-mask-provenance

Conversation

@Flyander

@Flyander Flyander commented Nov 25, 2026 •

Copy link
Copy Markdown

Summary

Track lane-mask provenance when two adjacent s_mov_b32 instructions copy the low and high dwords into an adjacent SGPR pair in the same block. The source pair is reused only when its symbolic mask contains no opaque atoms, so unknown values remain conservative.

Adds a positive regression test and a negative test for unknown source values.

Retail shader pack results

Windows 11, RTX 5070 Ti, VICTORY_HOST_WAVE=32, victory translate --validate --pipelines --list --jobs 8:

  • “lane mask holding lanes elsewhere read as data”: 2 failures → 0
  • “opaque lane mask”: 1 failure → 0
  • validated programs: 25,383 → 25,386
  • pipelines created: 25,571 → 25,572

The previously failing PS_VoxelizeVisiblity variant now emits, validates, and creates a host pipeline. Two volumetric water shaders now emit and validate too. Their default D3D12 pipeline creation is still refused on this 32-lane host.

Targeted integration with #695

I stacked this commit locally on #695's e5b43c4 head. With global VICTORY_WAVE_WIDE unset and VICTORY_WAVE_WIDE_ONLY=6871d6e4b3ac9a10,926c46bab3b86bd6, both newly unblocked water shaders create pipelines and validate.

Negative control: the unlisted CS_TransmissionVolumetrics_Tiled shader (5dc3b25986622949) validates but its pipeline remains refused. This confirms the per-hash setting does not enable the wide form for unlisted programs. These are targeted offline checks; no in-game visual comparison was made.

Checks

(cherry picked from commit d1c54f25c6ef75285450bffb4a7f8215754697c7)
@JRamos1993

Copy link
Copy Markdown

Offline check on the retail shader pack: your result reproduces.

victory translate --validate --list over the title's full shader pack on an RTX 5090, main 310c6eb against this head merged onto it, default settings:

  • 25,382 → 25,385 validated (the 2 "lane mask holding lanes elsewhere read as data" programs and the 1 "opaque lane mask"). None lost.
  • With a local DXIL hash on each validated line, 2 other programs' DXIL changes; both still validate.

AI use: Claude Code with Claude Opus 5.5 ran the pack and wrote this. Nothing from the title is in it.

@Dathinel

Copy link
Copy Markdown
Contributor

Synthetic numerical A/B on RTX 3050 Laptop, native wave32. On the local Series S base with the allocator from #561 and the backward permute path from #1166 held fixed, adding only this PR's structure.rs change fixes 18 wrong output words in a wave64 group of 64 threads. Both variants emitted DXIL.

Reproducer: initialize v1 to 42, save EXEC, narrow EXEC to thread IDs below 47, save that mask in s[20:21], restore full EXEC, copy s20 and s21 into s22 and s23 with separate s_mov_b32 instructions, then restore EXEC from s[22:23]. Run ds_bpermute_b32 with address 4*(tid+33) and source tid, restore full EXEC, and store v1 by thread ID. Before: lane 46 reads 47 from an inactive source instead of 0, and lanes 47–63 overwrite the sentinel. After: all 160 words across 16/33/47/64-thread groups match the expected values. The smaller groups also pass before the change.

Run 278 in the public diagnostics records hash 926c46bab3b86bd6 failing mask translation; this test exercises the paired-copy behavior independently. No visual or performance measurement. AI-assisted.

Luigilt20 commented Nov 26, 2026 •

Copy link
Copy Markdown

I also tested this change in the Neptune tree at LooperSalty/AnyXboxX@c4c93bd. The structure.rs change applies cleanly. I built the original and patched translation tools and ran the same compute programs through both on Windows 11 using the Windows SDK DXIL validator (dxil.dll 1.9.2602.17).

Selected programs Original, emitted and validated Patched, emitted and validated
Two transmission-volumetrics compute variants 0/2 2/2
Vertex control 1/1 1/1
Five shadow compute variants with a separate descriptor diagnostic 0/5 0/5

Both focused Rust tests for paired DWORD mask provenance also passed on the isolated Neptune test build. This is an offline compiler result. GPU pipeline creation, water appearance and frame rate were outside this measurement. AI-assisted testing and reporting with Codex.

Full-pack follow-up on the same Neptune build and validator, six CPU threads. Of 26,084 programs, 25,687 → 25,689 emitted and 25,616 → 25,618 validated. The two water compute variants were the only gains. Across the 25,889 individually listed programs, none lost either emission or validation. Another 195 export-stage programs had no individual result in either run. No GPU pipelines were created.

fxceless added a commit that referenced this pull request Nov 26, 2026
…e), 4 KiB dirty tracking, gather segments, the black-face texture fixes, shadow and translator fixes from pull requests

Measured in in-run on/off splits on an RTX 4070 (diagnostics builds, the
same switches for every run):
- VICTORY_CARD_HASH_WIDE=1|alt: the card's hashes of copies' pieces by a group
  of 64 threads a piece, alternating per submission: card -10 ms a frame
  (86.5 vs 96.5), world frames -5 ms.
- VICTORY_GATHER_SEGMENTS=1|alt (after flipflop877 c69bff1): one clamp pass
  per segment once a list stops gathering: ~30 records a pass, neutral to
  slightly faster at equal draws.
- VICTORY_DIRTY_4K=1|alt: refreshes copy only the written 4 KiB pages of a
  stale write-watched page: -45 % of those bytes; faster in loading, no world
  gain.
Fixes:
- Textures under a DirectStorage write or a landed plain read are made due
  again (VICTORY_PAGE_WRITES default 1|2|8): textures uploaded before their
  data landed kept zeros (black faces); VICTORY_HEAP_RECHECK_EVERY=<frames>
  keeps looking at uploaded textures after the schedule (after RyanCase94).
- Pull requests #646 (builder dispatches count threads), #1002 (alpha-tested
  geometry casts cascade shadows), #1314, #1324, #589, #702, #1112 (mesh
  triangle corners masked 9 bits, cube-map levels, two-sampler branches,
  split 64-lane masks); upstream #3198 (textures without card room retried).
- VICTORY_WAVE_WIDE_ONLY=<hashes>: listed refused programs may take the
  wave-wide form (after #823's a416e39; the water's colour, with dark patches
  still under investigation).
- VICTORY_MERGE_RUNS_ALT, VICTORY_CLAMP_LEAN, VICTORY_CLAMP_WINDOW,
  VICTORY_OCCLUSION: measured, no gain; off.
The shader translator changed: delete both shader caches before the first run.
KomanderDG88 added a commit to KomanderDG88/VIniVIdiVIci that referenced this pull request Nov 26, 2026
… part 2)

9613092 alone does not build (its second deep-skips form call lacks the
label 93db653 adds), so the fifth merge goes on to e4245f3, the commit
it was meant to bring; nothing after it (fxceless#1320, fxceless#1321, fxceless#1353, fxceless#1336,
fxceless#1324 of 13:05 are left for later).

- 93db653: build fix for 9613092 (VICTORY_WAVE_WHY form label).
- e4245f3: VICTORY_CARD_HASH_WIDE=alt (1 was already there; default
  still a thread a piece), VICTORY_GATHER_SEGMENTS and
  VICTORY_GATHER_DISPATCHES (off), VICTORY_DIRTY_4K (off),
  VICTORY_MERGE_RUNS_ALT (unset), VICTORY_HEAP_RECHECK_EVERY (0),
  VICTORY_WAVE_WIDE_ONLY (empty); VICTORY_PAGE_WRITES default now
  guards+slots+plain reads' textures (1|2|8; "guards" is the old one);
  host callbacks check due textures first; textures without card room
  asked again (upstream VIctory #3198); a released view heap forgets its
  title-memory run (fxceless#589); shader fixes: mesh corners masked 9 bits,
  two immediate samplers behind a uniform branch, sampleLevel log2 and
  _cl clamp, split wave64 mask moves (fxceless#1112, fxceless#702).

Conflicts, our structure kept: HostList hunks moved to host/host_list.rs;
image hunks to emit/image_buffer.rs; copy_stale takes both COLD_SKIP
marks and DIRTY_4K pieces; Journal keeps cold_skip::Written plus the 4K
map; translate_listed wraps translate_counted; MERGE_RUNS_ALT before our
card_steps split. Duplicates kept once (ours): fxceless#1324 (HEAP_IDENTITY),
fxceless#1002 (SHADER_CASCADE_EXACT), and fxceless#646: upstream's DispatchX thread
counts (USER_DISPATCH_THREADS, same code 0x106) dropped for our port of
fxceless#1292 (USER_THREAD_LIMIT, which also covers the paired 64-lane form).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KomanderDG88 added a commit to KomanderDG88/VIniVIdiVIci that referenced this pull request Nov 26, 2026
…ure fixes), cascade shadows, render-target snapshots, and switches for rays, memory and input

Twenty-two commits, tested as fe2ede8 (cargo check of the workspace with
diagnostics clean; victory-gpu --lib 356 passed, 0 failed) and built by
Codex as fe2ede8-diagnostics.

On by default, each with a way back:
- the original's fifth merge up to e4245f3 with 93db653: VICTORY_PAGE_WRITES
  now also sends back to pending the textures written by slots and by
  plain reads (1|2|8; =guards is the default of before), textures without
  room on the card are asked for again (VIctory #3198), a released view
  heap forgets its run of title memory (fxceless#589), shader fixes (fxceless#1112, fxceless#702,
  mesh corners, samplers behind a uniform branch, sampleLevel);
- fxceless#1002: exact cascade shadows on cards of 32 lanes
  (VICTORY_SHADER_CASCADE_EXACT=0 goes back);
- fxceless#1371: render targets replayed from a copy taken at SetRenderTargets
  (VICTORY_RT_SNAPSHOT=0 goes back).

Off by default: VICTORY_RT_SKIN_SKIP, VICTORY_RT_RESOLVE_SKIP,
VICTORY_ACTIVATE_RAYS_SKIP, VICTORY_HAIR_VB_SKIP (with a census of such
programs), VICTORY_ALT_FLIP (fxceless#1341), VICTORY_RAM_TRIM, VICTORY_WINDOW_REUSE
(fxceless#1362), VICTORY_COLD_SKIP (fxceless#1358), the worker chain of fxceless#1290,
VICTORY_KEYS_FILE, VICTORY_NULL_SAMPLES, and the merge's CARD_HASH_WIDE=alt,
GATHER_SEGMENTS, GATHER_DISPATCHES, DIRTY_4K, MERGE_RUNS_ALT,
HEAP_RECHECK_EVERY and WAVE_WIDE_ONLY. The profiler test walks only modules
that never unload.

Left out: diagnostics/translate-water-5dc3-6f22-2026-11-26.txt, a
translation diagnostic of the original's run that lists offsets and
instructions of two of the title's shaders.

Measured by Codex on fe2ede8, the ten switches of Status, screenshots
every second, one pair of sessions of 480 s, the same binary: in the
opening's cafeteria two faces were drawn with their features with the new
default, and one of them came out without features and the background
washed out with VICTORY_PAGE_WRITES=guards, at different moments and
poses; in the reverse pair a face came out almost all black with the new
default (the guards session was stopped by the memory guard at 391 s), so
these fixes are not the whole answer to black faces. Not measured for
frame rate yet. Neither session crashed; frames of a second
or more between 150 and 450 s: 49 (longest 5.7 s) with guards, 52 (6.8 s)
with the default. A first session with a cold shader cache was ended at
388 s by the title itself after a frame of 21.5 s spent waiting for the
runtime's remapping.

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.

4 participants