[BUNDLE] NVIDIA stack: Impre-visible's tree (wave64 #189 + the world-run list, 12 PRs) checked together, stacked on #1589 #1638

Closed
github-bot wants to merge 140 commits from gh-pr/1638/head into gh-pr/1638/base
Owner

@⁠MamaLeVrai on GitHub · 2026-11-24 20:16 UTC · original
MamaLeVrai:bundle/nvidia-stack → main · +12472 −850 · 42 files · 140 commits · closed without merging

One PR in place of 12. The tree Impre-visible ran on a GTX 1660 under Linux (their report on #1589) as one branch, checked: wave64 compute on 32-lane hosts (#189, as merged in #1589) plus the list of the world-run stack of #1632 and #1523 (NVIDIA hosts: widen unsupported 16-bit targets, size the view heap to the host's limit). In their run on #1589 the compute pipelines refused by the host went from 111 to 0, with no device removal. Every head is merged unchanged onto main plus #1589, and the result is built and tested together.

For reviewers and for anyone verifying with an agent (Claude, Codex, a person): this is a [BUNDLE] PR. The re-verification commands are below, so one run covers all of it.

What is inside

PR Author Head Title
#1077 DuarttBR 873548f2d Shaders, GPU: root UAVs (stacked on #489)
#1175 Castyan bfe5d2dab Shaders: verify compute writes through a spilled root UAV
#523 spidercraft 001226617 Build: compile and test the workspace on Linux again
#530 AKA0GHOST 951ceb1eb GPU diagnostics: show one of the title's render targets in the window
#1040 gabrielcruzg3 08e4c8975 GPU: drop unsupported UAV/RT flags on typed host textures and guard RTV creation
#1406 ESAT586 87b42ecd1 GPU: fix NULL/UNKNOWN SRV/UAVs on promoted-typeless textures and MSAA/array/3D NULL RTV/DSVs
#1392 kunalkhude99 9687a1958 gpu: emit UAV barrier after a dropped compute dispatch
#1516 venglov 63be4e048 Shaders: zero missing typed-buffer components
#1388 wbkepler 9d84135fa GPU: honor command-list 64-bit memory waits without blocking submissions (#700)
#1189 geiyiliyabumo 370c61bff GPU: make fence signaling monotonic, clamp sampler enums, and add unit tests
#1523 cyudev 946edfe71 GPU: size a capped view heap to the host's limit (closed by its author)
#542 gingertonik 31a4692a1 Shaders: keep buffer offsets below 2 GiB (NVIDIA + vkd3d-proton world device loss)

Changes made while bundling

No PR was edited. Everything below is a separate commit or the body of a merge commit. The list is the one of #1632 (see there for #1077, #1175, #1516 and #542) and the same kinds of overlap came up again, plus the new ones of #189 and #1523:

  1. root_uavs: #1077 adds the field to HostShader; the literals in three tests that other PRs of the stack add (cs_with_wave_size in emit/host.rs from #189, validate_and_create_cs_pso in emit/shader.rs, the root view test) get it.
  2. #1388: it moves the dynamic slots of a list to the list (keep_dynamic), so #1077's self.dynamic.push(..) for a root UAV becomes list.keep_dynamic(heap, index, 1).
  3. #1523 and #1040: both declare const RENDER_TARGET in host_texture; the second one is dropped. #1040's test host_texture_drops_unsupported_uav_flag_for_b5g5r5a1 assumed that every adapter refuses a typed UAV on B5G5R5A1_UNORM, where host_texture only drops what the adapter refuses (an RX 6950 XT accepts it, so it failed on main plus #1040 alone); it now asks the adapter with CheckFeatureSupport.
  4. #1516: it and #1175 add a test at the end of valu_tests.rs, both kept; a test of #1516 builds Parts without #189's options field and now has it.
  5. #542: its bound on a raw scalar load (bound_raw_offset) is applied to the stack's one raw-view branch (SRV range, UAV range or heap buffer, #1015 and #1055); the test helper it adds needed the structured program as the fourth argument of resource::track (#801), options on Parts (#189) and root_uavs on HostShader (#1077).

#302 and #489 are inside #1077's own commits and are not marked as merged by this bundle.

Left out, and why

  • #1523 was closed by its author (cyudev) at 21:33 UTC on Nov 24, after the tree of this bundle was built and after Impre-visible and ryotdev ran it. Its last head before the closing (385dad2) leaves the 16-bit part to #89 and keeps only the view-heap sizing; the author found that the host's cap on NVIDIA (1,000,000 slots, debug layer ID 645) leaves the search nothing to find. This branch keeps the head that was run (946edfe, with the 16-bit widening), because that is the tree the reports measured; a tree without #1523 would not be the one they tested.
  • #1407 (lane masks holding lanes elsewhere read as numbers) conflicts with #189 in the lane-mask ballot function (mask_dword in emit/lower.rs): two different rewrites of the same code. Impre-visible left it out of their tree for the same reason, and it is in #1632, which does not contain #189. Which of the two to keep, or how to join them, is for the authors and the maintainer.
  • What this does not show: the numbers above are Impre-visible's, for their tree on Linux with Wine, not for this branch, which was only checked by clippy and the tests here (RX 6950 XT, WARP). Their remaining walls on that tree: a lane mask holding lanes elsewhere read as data (67 compute shaders), v_readfirstlane in divergent control flow (64), a structured buffer of unknown stride (56), LDS accesses without a uniform fence in split wave64 (40), a 64-lane ballot in divergent control flow (35), an address not from a root parameter (29); the final image was still dark.

Verification

Windows 11, RX 6950 XT, Rust 1.98.1 (the pinned toolchain):

Check Result
cargo clippy --workspace --all-targets --locked -- -D warnings clean
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings clean
cargo test --workspace --locked 461 passed, 0 failed, 6 ignored (two runs; main: 342 passed, 6 ignored)

The title was not run, so this says nothing about in-game effect. No game data is used or committed.

Re-verify in one go

git fetch https://github.com/MamaLeVrai/VIctory.git bundle/nvidia-stack
git checkout FETCH_HEAD
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
cargo test --workspace --locked

To confirm that no component PR moved since this was built, compare each Head above with gh pr view <n> --repo Marvisak/VIctory --json headRefOid. If one differs, the branch needs a rebuild: merge the new head in the same order.

If this lands

The component heads are in the history unchanged, so each PR's commits and authorship are kept and GitHub should mark them merged. Merging them one by one instead works too, with the exceptions noted above.

AI-assisted (Claude Code); no game data.

🤖 Generated with Claude Code

**@⁠MamaLeVrai** on GitHub · 2026-11-24 20:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/1638) `MamaLeVrai:bundle/nvidia-stack` → `main` · +12472 −850 · 42 files · 140 commits · closed without merging **One PR in place of 12.** The tree Impre-visible ran on a GTX 1660 under Linux (their report on #1589) as one branch, checked: wave64 compute on 32-lane hosts (#189, as merged in #1589) plus the list of the world-run stack of #1632 and #1523 (NVIDIA hosts: widen unsupported 16-bit targets, size the view heap to the host's limit). In their run on #1589 the compute pipelines refused by the host went from 111 to 0, with no device removal. Every head is merged unchanged onto `main` plus #1589, and the result is built and tested together. > For reviewers and for anyone verifying with an agent (Claude, Codex, a person): this is a `[BUNDLE]` PR. The re-verification commands are below, so one run covers all of it. ## What is inside | PR | Author | Head | Title | |---|---|---|---| | #1077 | DuarttBR | `873548f2d` | Shaders, GPU: root UAVs (stacked on #489) | | #1175 | Castyan | `bfe5d2dab` | Shaders: verify compute writes through a spilled root UAV | | #523 | spidercraft | `001226617` | Build: compile and test the workspace on Linux again | | #530 | AKA0GHOST | `951ceb1eb` | GPU diagnostics: show one of the title's render targets in the window | | #1040 | gabrielcruzg3 | `08e4c8975` | GPU: drop unsupported UAV/RT flags on typed host textures and guard RTV creation | | #1406 | ESAT586 | `87b42ecd1` | GPU: fix NULL/UNKNOWN SRV/UAVs on promoted-typeless textures and MSAA/array/3D NULL RTV/DSVs | | #1392 | kunalkhude99 | `9687a1958` | gpu: emit UAV barrier after a dropped compute dispatch | | #1516 | venglov | `63be4e048` | Shaders: zero missing typed-buffer components | | #1388 | wbkepler | `9d84135fa` | GPU: honor command-list 64-bit memory waits without blocking submissions (#700) | | #1189 | geiyiliyabumo | `370c61bff` | GPU: make fence signaling monotonic, clamp sampler enums, and add unit tests | | #1523 | cyudev | `946edfe71` | GPU: size a capped view heap to the host's limit (closed by its author) | | #542 | gingertonik | `31a4692a1` | Shaders: keep buffer offsets below 2 GiB (NVIDIA + vkd3d-proton world device loss) | ## Changes made while bundling No PR was edited. Everything below is a separate commit or the body of a merge commit. The list is the one of #1632 (see there for #1077, #1175, #1516 and #542) and the same kinds of overlap came up again, plus the new ones of #189 and #1523: 1. **`root_uavs`**: #1077 adds the field to `HostShader`; the literals in three tests that other PRs of the stack add (`cs_with_wave_size` in `emit/host.rs` from #189, `validate_and_create_cs_pso` in `emit/shader.rs`, the root view test) get it. 2. **#1388**: it moves the dynamic slots of a list to the list (`keep_dynamic`), so #1077's `self.dynamic.push(..)` for a root UAV becomes `list.keep_dynamic(heap, index, 1)`. 3. **#1523 and #1040**: both declare `const RENDER_TARGET` in `host_texture`; the second one is dropped. #1040's test `host_texture_drops_unsupported_uav_flag_for_b5g5r5a1` assumed that every adapter refuses a typed UAV on B5G5R5A1_UNORM, where `host_texture` only drops what the adapter refuses (an RX 6950 XT accepts it, so it failed on `main` plus #1040 alone); it now asks the adapter with `CheckFeatureSupport`. 4. **#1516**: it and #1175 add a test at the end of `valu_tests.rs`, both kept; a test of #1516 builds `Parts` without #189's `options` field and now has it. 5. **#542**: its bound on a raw scalar load (`bound_raw_offset`) is applied to the stack's one raw-view branch (SRV range, UAV range or heap buffer, #1015 and #1055); the test helper it adds needed the structured program as the fourth argument of `resource::track` (#801), `options` on `Parts` (#189) and `root_uavs` on `HostShader` (#1077). **#302 and #489** are inside #1077's own commits and are not marked as merged by this bundle. ## Left out, and why - **#1523 was closed by its author (cyudev) at 21:33 UTC on Nov 24**, after the tree of this bundle was built and after Impre-visible and ryotdev ran it. Its last head before the closing (`385dad2`) leaves the 16-bit part to #89 and keeps only the view-heap sizing; the author found that the host's cap on NVIDIA (1,000,000 slots, debug layer ID 645) leaves the search nothing to find. This branch keeps the head that was run (`946edfe`, with the 16-bit widening), because that is the tree the reports measured; a tree without #1523 would not be the one they tested. - **#1407** (lane masks holding lanes elsewhere read as numbers) conflicts with #189 in the lane-mask ballot function (`mask_dword` in `emit/lower.rs`): two different rewrites of the same code. Impre-visible left it out of their tree for the same reason, and it is in #1632, which does not contain #189. Which of the two to keep, or how to join them, is for the authors and the maintainer. - **What this does not show**: the numbers above are Impre-visible's, for their tree on Linux with Wine, not for this branch, which was only checked by clippy and the tests here (RX 6950 XT, WARP). Their remaining walls on that tree: a lane mask holding lanes elsewhere read as data (67 compute shaders), `v_readfirstlane` in divergent control flow (64), a structured buffer of unknown stride (56), LDS accesses without a uniform fence in split wave64 (40), a 64-lane ballot in divergent control flow (35), an address not from a root parameter (29); the final image was still dark. ## Verification Windows 11, RX 6950 XT, Rust 1.98.1 (the pinned toolchain): | Check | Result | |---|---| | `cargo clippy --workspace --all-targets --locked -- -D warnings` | clean | | `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` | clean | | `cargo test --workspace --locked` | 461 passed, 0 failed, 6 ignored (two runs; `main`: 342 passed, 6 ignored) | The title was not run, so this says nothing about in-game effect. No game data is used or committed. ## Re-verify in one go ```powershell git fetch https://github.com/MamaLeVrai/VIctory.git bundle/nvidia-stack git checkout FETCH_HEAD cargo clippy --workspace --all-targets --locked -- -D warnings cargo clippy --workspace --all-targets --all-features --locked -- -D warnings cargo test --workspace --locked ``` To confirm that no component PR moved since this was built, compare each `Head` above with `gh pr view <n> --repo Marvisak/VIctory --json headRefOid`. If one differs, the branch needs a rebuild: merge the new head in the same order. ## If this lands The component heads are in the history unchanged, so each PR's commits and authorship are kept and GitHub should mark them merged. Merging them one by one instead works too, with the exceptions noted above. AI-assisted (Claude Code); no game data. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Since the world bring-up, main no longer builds on Linux: victory-gpu
names host_resource outside its cfg(windows), and victory-hle reaches
Windows-only modules (xmem, files, lifecycle, the text entry dialog).
This gates those uses only, as the smallest base for a native Linux
runtime:

- view_format and the D3D12 allocator hookup are Windows-only, like
  what they call.
- XLaunchNewGame ends the title only on Windows; the text entry dialog
  answers "dismissed" elsewhere.
- translate --validate / --pipelines refuse to start off Windows (no
  host DXIL validator or D3D12 there); translation itself runs.
- Tests that parse the test binary as a PE image, or use Windows title
  paths, are ignored off Windows with the reason.

Tested: Linux (CachyOS, rustc 1.98.1): cargo test --workspace passes
(162 passed, 13 ignored). cargo check --target x86_64-pc-windows-msvc
--all-targets gives the same diagnostics as before (none).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Pixel programs that use the I/J VGPRs as plain values (custom
interpolation, math on the weights) failed with "barycentrics read
directly". They are now channels y and z of an SV_Barycentrics input
(SM 6.1+, the emitter targets 6.6) declared with the interpolation mode
of their kind (perspective/linear, center/centroid/sample), one element
per mode (semantic index 0 and 1), with the Barycentrics shader flag and
SFI0 feature. GFX10 interpolates P0 + i (P1 - P0) + j (P2 - P0) with P0
the provoking vertex, which the host's barycentrics weight as vertex 0,
so i = y and j = z.

The VGPRs are loaded on first use as a value, so programs that only feed
them to v_interp_* declare nothing new. A console signature's own
SV_Barycentrics row (D3D name 23) is parsed and reused. Pull-model
barycentrics stay unsupported.

SV_Barycentrics is left unpacked (no row, packing location -1), like
other non-packed system values: the DXIL validator refuses it in a row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
v_interp_p1/p2 (and the f16 forms) fed with an i or j that is not the
loaded input VGPR now evaluate each half as the hardware does: P0 + i
(P1 - P0) for the first, the old dst + j (P2 - P0) for the second, with
the vertex values read by attributeAtVertex. That needs the element
declared constant, so every other interpolation of the same attribute
row is weighed from its vertices with SV_Barycentrics of its mode, and
flat reads stay loadInput of the provoking vertex. v_interp_mov of P10
and P20 reads P1 - P0 and P2 - P0 the same way when the program also
interpolates the attribute (so the hardware holds the deltas); alone it
is still refused.

The translate command's tally counts Interp::Weighted as interpolated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
`VICTORY_SHOW_TARGET=<w>x<h>-f<format>` (e.g. `2560x1440-f28`) shows the
last render target of that size and DXGI format each frame instead of the
title's frame: it is copied 1:1 to the top left of the back buffer, and
only when its format is the window's. Draws and dispatches still run as
before; only what reaches the window changes.

With the world's lit image black, this shows what its earlier passes did
draw: on Grand Theft Auto VI, a 2560x1440 RGBA8 target of the geometry
pass shows the scene's objects (packed surface data, so false colours).

The target is the one `capture::note_target` last saw bound, so it needs a
diagnostics build; without the variable nothing changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
image_sample_d_cl was refused by name, and behind it every program hit
a cube sample with explicit gradients, refused as "a cube sample with
... gradients". Both now translate to sampleGrad:

- A cube's gradients on GFX10 are of the face coordinates (s, t), four
  addresses rather than six, so the coordinates follow at 4. They become
  the direction's gradients through the face's linear part of
  cube_direction (u = 2s - 3, v = 2t - 3; the major axis does not move),
  in the new cube_gradient.
- `_cl`: the level-of-detail clamp follows the coordinates and is passed
  as sampleGrad's clamp.

translate --validate on shaders.rpf: vertex/pixel 12172 -> 12197
validated; both errors are gone from the list. Not yet compared against
the console's sampling at runtime.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
lower.rs: keep the PR's lazy barycentric VGPR inputs next to main's
`Reg::S(n)` arm for uninitialized SGPRs. mod.rs: the barycentric test
helper passes the structure to resource::track, which now takes it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
DXIL allows at most two SV_Barycentrics input elements, one perspective
and one linear. A program reading both perspective center and centroid
I/J as values declared two perspective elements, which the validator
refuses ("There can only be up to two input attributes of
SV_Barycentrics with different perspective interpolation mode").

The second mode of the same kind is now an Unsupported reason rather
than a second element. Reusing the first element would hand centroid
reads center weights (or the reverse), which differ on edge pixels: a
silent wrong value. Before this PR such reads were refused anyway.

Test: center + centroid values are refused; centroid alone still
translates with one element.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
The ISA's special cases in its order: a NaN numerator or denominator comes
back quieted, 0/0 and inf/inf give NaN, x/0 and inf/x a signed infinity,
0/x and x/inf a signed zero, otherwise |S0| with the quotient's sign.
Worked on the f32 values of the f16 operands, which are exact.
The ISA's "exponent of S0 all ones -> overflow" check runs before the
final |S0| case, so a NaN quotient with a finite, non-zero numerator and
denominator gives sign | infinity, as measured on gfx1036 hardware. The
zero, infinity and invalid checks still come first.
These write SCC, but their lowering gave no SCC value, so the generic
"result is not zero" stood in. The ISA sets it otherwise:

- s_min_i32/u32, s_max_i32/u32: SCC = 1 when src0 is the value chosen
  (src0 < src1 for min, src0 > src1 for max).
- s_lshl1..4_add_u32: SCC = 1 when (src0 << n) + src1 overflows 32
  bits, through bits shifted out of src0 or the add's carry.

So s_min_u32(5, 3) left SCC = 1 (3 is not zero) where the hardware
leaves 0, and s_lshl1_add_u32(1, 0xFFFFFFFE) left 0 where it leaves 1;
an s_cselect or s_cbranch_scc after them took the wrong side.
The d16 forms of the typed buffer loads return each channel as 16 bits,
two per VGPR, low half first; the decoder already sizes their data that
way. The lowering only treated `buffer_` names as d16, so a
tbuffer_load_format_d16_* went through the 32-bit path: the first VGPR
got channel x as a 32-bit value (the f32 bits of 1.0 instead of the f16
pair (1.0, 2.0)) and the other channels were dropped.

The format path now packs its channels for d16: integer formats keep
their low 16 bits, the other formats become f16 (as the MUBUF d16 path
converts them).
Add Wave64Mode (Native, Wave32, Emulate) and TranslateOptions so Wave64 compute shaders lower and run on 32-lane GPUs (NVIDIA/Intel) and narrower hosts such as WARP instead of failing CreateComputePipelineState with E_INVALIDARG on WaveSize(64).

- Add Wave64Mode, TranslateOptions, translate_with, and emit_with while keeping translate/emit defaulting to Wave64Mode::Native.
- Resolve constant-lane SGPR spills across v_writelane_b32/v_readlane_b32 via resource::spilled_sgprs.
- Implement virtual 64-lane mapping for Wave32 (two aligned 32-lane waves) and portable LDS emulation without WAVE_OPS for narrower hosts, with post-dominator uniformity checks to reject cross-half barriers in divergent control flow rather than hanging.
- Auto-detect host wave capabilities in victory-gpu::Host (with VICTORY_WAVE64_EMULATE override and mode byte in shader_cache keys) and in victory translate --pipelines.
- Add synthetic RDNA2 compute tests (PSO validation + execution on hardware GPU and WARP).
SDATA on s_atc_probe and s_atc_probe_buffer is a 7-bit immediate, the buffer resource is four dwords, and GLC/DLC are not operands of either.
Incorporate verified follow-up fixes from PR #189 reviewers and contributors:

- Fence single-console-wave LDS accesses at group-uniform joins/exits and reject unfenceable divergent regions (fixes marquezinii's split-block stale LDS readback; from alfycs/VIctory#1 by @erickbobd).
- Allow Wave32 divergent v_readfirstlane per half without LDS barriers (fixes waterfall loops / common divergent refusals reported by @AKA0GHOST and @NuraadGit), preserve ValUniform propagation across unguarded v_mov_b32 copies for uniform v_readfirstlane in divergent branches (@marquezinii), and return lane 0 when EXEC == 0 in emulated_readfirstlane.
- Clamp DPP row_shr/row_shl lane indices using inside before read_lane/exchange_64 to avoid out-of-range waveReadLaneAt on WARP 1.0.22 (@ifBars).
- Verify DXGI_ADAPTER_FLAG_SOFTWARE in shader::emit::host::Host::new(true) for Wine/DXVK (@dpalacios69, @tanishq-dubey), base recommended_wave64_mode_matches_device_capabilities on queried capabilities (@ifBars), and serialize wave64 GPU tests under valu_tests::ONE_AT_A_TIME (@r4tedx).

Co-authored-by: erickbobd <[email protected]>
Avoid false positives in plan_lds_fences on Wave32:

- Skip need_lds_barriers in Wave32 when total_threads <= 32 (single native host wave).
- Track reads vs writes/atomics separately in plan_lds_fences so multiple pure ds_read* instructions inside a divergent region or loop are allowed while RAW/WAW/WAR hazards remain rejected.
buffer_gl0_inv and buffer_gl1_inv name a buffer but read no descriptor, so resource tracking refused them before lowering. Skip descriptor tracking for _inv buffer instructions and lower the pair to nothing, as the existing scalar cache instructions already are. Add a synthetic full-pipeline test.
A descriptor fetched from the resource heap by index has no used-resource
entry, so a scalar buffer load (s_buffer_load_dword*) through it was
lowered through a 64 KiB constant buffer handle. When vector buffer loads
read the same descriptor, the slot holds a buffer SRV (the title made it
one), and reading it through a CBV handle is a descriptor of the wrong
type, which D3D12 leaves undefined. Such loads now read the slot as a raw
buffer, as table SRVs already do. A descriptor also written through
(a UAV) and one only scalar loads read are unchanged.

In the title's shaders.rpf this changes 38,829 scalar loads in about 1,900
of 26,084 programs; emit and validation counts are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
s_buffer_load_dword* through a table's UAV took the constant buffer
path: a CBV handle at the heap index of a UAV. Reading through it
removes the device (WARP: "The GPU device instance has been
suspended"). Such a load now reads the UAV raw, as a raw SRV is read
and as vector buffer accesses read a UAV.

The test writes a value to the VALU tests' raw UAV, reads it back with
a scalar buffer load and stores that; it removed the WARP device before
this change and passes on the hardware GPU and WARP after.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An s_load_dword* whose address is a root descriptor's, and whose
result the program never uses as a descriptor, reads that buffer's
data. It stopped with "a descriptor read only as data". It is now read
as global loads from a root view already are: a root SRV raw, a root
CBV (or a root view the used-resource list does not name) as a
constant buffer. A root UAV still stops, with its own reason.

Test: dwords 2 and 3 of a root SRV and of a root CBV read with one
s_load_dwordx2 and stored, exact on the hardware GPU and WARP; main
refuses the program.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An s_load_dword* of a descriptor whose dwords the code reads as numbers
(an image's width and levels) but never samples was refused with "a
descriptor read only as data": the view's kind came only from a use. Now
the table's range names it, and an entry in the resource heap that no
range names (a run-time index reaches it) is an image if it is eight
dwords, taken for 2D (shortcut noted in the code).

Offline over the whole corpus, programs refused: 4123 -> 3749; "a
descriptor read only as data" 395 -> 18; compute programs emitted
1441 -> 1743 (validated 1417 -> 1647). Tested with a hand-assembled
waterfall program that reads two textures' sizes, on the host GPU and
WARP; it fails with the old refusal without the change.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
A compute program whose root signature does not fit the 16 user SGPRs
finds its arguments through a spill table: s[0:1] holds a pointer (high
dword masked to 40 bits, usually copied to s2/s3 first) to a table of
the user data, and the program s_loads descriptors and constants from
it. Table dword k is user SGPR 16 + k. The translator only knew
addresses that come from the declared root layout, so every such
program failed with "an address in an SGPR that is no root parameter".

For compute programs whose root layout lies entirely at user SGPR 16 and
above, loads from that pointer with a constant offset become s_mov_b32
copies of the user SGPRs the dwords stand for, before the SSA is built,
so resource tracking and lowering see what they see for ordinary root
arguments. Only straight-line code from the pointer's set-up is
rewritten (tags are dropped at branch targets and on any overwrite of
the pointer registers); other loads stay loads.

On the title's world shaders this took the "SGPR that is no root
parameter" failures from 34 programs to 4 in one run. Other failures
that were hidden behind it now show (address not from a root parameter,
root UAV or typed root view, an address from a phi...). Whether the
translated programs render correctly has not been checked beyond that.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The spill-table rewrite turned each load into `s_mov_b32 sK, s(16+k)`,
which reads what the register holds at that point. A program that has
already written SGPRs 16 and up (the destination of an earlier table
load, say) then reads the wrong root argument, with no refusal.

The program now first copies the user SGPRs its table loads stand for
into a block of SGPRs it never reads or writes, and the loads read that
block. Without such a block below VCC, or when a branch can return to
the program's entry, nothing is rewritten.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With 16 user SGPRs the hardware puts the thread-group ids in s16 and up,
where the spill rule reads root arguments, so a program reading both got
the root argument for the group id (reported on #489). Such programs are
now left to fail as they do without the rule.

victory translate now builds with the same rule, so its counts match the
runtime.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
s_and_b32 on the table pointer's high dword kept its provenance for any
literal mask up to 0xFFFF and any inline constant, so a mask such as 0x7f
or 1, which can point to another table, still had its loads rewritten to
the root arguments. Only a mask keeping the high dword's eight low bits
(40-bit addresses) keeps it now.

Co-authored-by: NexForever <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A register can hold a compare result's high dword on one path and a loaded
number on another; the compiler only reads it where the number is live. The
join's mask side was "a lane mask read as data", which refused the program.
A pixel or vertex program now takes the mask's ballot as that incoming value
(counts and zero tests mean the same on any wave size). shortcut: the ballot
is the host wave's, so a join read some other way would differ from the console.

Offline corpus: "a lane mask read as data" 250 -> 212, vertex/pixel programs
emitted 12243 -> 12250; the other 31 move on to descriptor/scalar-memory
refusals. Synthetic wave64 pixel program fails before, lowers after.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The console compiler spills scalars, lane-mask pairs among them, with
v_writelane_b32 into constant lanes of a VGPR and restores them with
v_readlane_b32 of the same lane. The restored pair was an opaque mask, so
the selects, EXEC writes and joins that used it refused ("a select on an
untracked mask", "an opaque lane mask", "a lane-mask join of an untracked
mask"). structure now follows a constant-lane readlane back through a plain
chain of writelanes to the scalar written to that lane, and gives the
restored pair that scalar pair's mask. A chain with a phi or another write
of the VGPR stays opaque (shortcut noted in code).

Offline corpus, against fix/mask-phi-ballot (neither branch carries #585):
vertex/pixel programs emitted 12250 -> 12269, compute 1443 -> 1452,
"a lane-mask join of an untracked mask" 20 -> 0, "an opaque lane mask"
29 -> 8, "a conditional export" 8 -> 0. Synthetic pixel program fails
before, lowers after. Stacked on fix/mask-phi-ballot (shares its test helper).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
v_cndmask_b32 and v_*_co_ci_u32 refused when their scalar mask was not one
structure followed (a plain SGPR number). In compute with console lanes the
lane now tests its own bit of the register (pair in wave64); inline 0 and -1
masks are constants. Taken from upstream PR #585 (mask part only; its
descriptor-dimension hunk is left to the resource work).

Offline corpus (26148 programs): "a select on an untracked mask" 288 -> 0, no
new refusal text; those programs now stop at later refusals (descriptor read
as data +205, unknown stride +32, descriptor address/format +33), so compute
programs emitted only 1441 -> 1443. Synthetic test on hardware: fails before,
passes after. WARP cannot pin a wave size, so the test skips it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
A descriptor built around a root descriptor's address with unordered access was refused in emit ("a root UAV or typed root view"). With the spill table read (#302, #489), 11 of the 34 compute programs with spilled root arguments that Grand Theft Auto VI's world dispatches stopped there, among them the one dropping the most dispatches per frame in our runs.

The translated shader now declares u<slot> in the root-view space (RWByteAddressBuffer, PSV0 kind 7). The host binds it as a one-view table: a raw view with unordered access of the title buffer's host copy from the root address, at most 1 MiB, refreshed before the submission and copied back after it like a table's buffer view. Without a host copy, or off 16 bytes, the view is null. The shader cache stores the new list.

Offline over those 34 programs (victory translate --validate --pipelines, RTX 3080, dxil.dll 1.9.2609): 0 emitted before, 7 emitted and validated after, 6 of them with a host pipeline (the seventh is a wave64 program this card refuses).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
AI-generated & verified with Gemini 4 Neon (not written by a human engineer).

s_add_i32, s_addk_i32, and s_sub_i32 previously left SCC as
Val::Missing("the carry of a scalar operation"), causing any shader that
reads SCC after these instructions (e.g. via s_cselect_b32 or s_cbranch_scc*)
to fail lowering.

Compute 32-bit two's-complement signed overflow directly in i32 (no i64
capability required), matching the AMD RDNA2 ISA:
- s_add_i32 / s_addk_i32: ((a ^ r) & (b ^ r)) <s 0
- s_sub_i32:              ((a ^ b) & (a ^ r)) <s 0

Verified with synthetic GPU + WARP + dxil.dll tests in valu_tests.rs on
NVIDIA GeForce RTX 3060 Ti (Windows 11, Rust 1.98.1). No game data used.

Co-Authored-By: Gemini 4 Neon <[email protected]>
AI-generated & verified with Gemini 4 Neon (High Mode) — not written by a human engineer.

`packed16` in `lower.rs` previously rejected `v.clamp` on all packed 16-bit
integer instructions with `Err("modifiers on a packed integer operation")`.

Under the AMD RDNA2 ISA (VOP3P), `clamp` on `v_pk_add_u16`, `v_pk_sub_u16`,
`v_pk_mad_u16`, `v_pk_add_i16`, `v_pk_sub_i16`, and `v_pk_mad_i16` saturates
each 16-bit lane to `[0, 65535]` (unsigned) or `[-32768, 32767]` (signed).
Because `packed16` computes each lane in 32 bits (`u16*u16+u16 <= u32::MAX`,
`i16*i16+i16` fits in `i32`), saturation is exact in 32-bit integer compares
before masking to 16 bits. Non-saturating packed integer ops keep rejecting
`clamp`.

Verified with synthetic GPU + WARP + dxil.dll tests in `valu_tests.rs` on
NVIDIA GeForce RTX 3060 Ti (Windows 11, Rust 1.98.1). No game data used.

Co-Authored-By: Gemini 4 Neon (High Mode) <[email protected]>
The high dword of the 48-bit product whose low dword v_mul_u32_u24 and v_mul_i32_i24 already give: the low
24 bits of each operand, zero- or sign-extended, through the existing mul_hi.

The test module gets lowers_valu, a one-thread compute program with root constants in v1..v4 and a buffer
store of v0 (built with lower_with), so a vector instruction can be checked for lowering without a GPU.

AI-assisted (Claude Code).
Fixes 5 shader emission and DXIL container/validator issues in `victory-shader`,
raising validated shaders across the test corpus from 21,983 to 22,159 (+176;
100% of emitted VS/PS/CS shaders now validate cleanly):

1. Biased 16-bit image samples (`emit/lower.rs`):
   - Remove the `a16` rejection on `image_sample_b` and separate 32-bit prefix
     operands (offsets, bias, comparison reference) from `a16`-packed tail
     operands (gradients, coordinates, explicit LOD) starting at `regs[first]`,
     matching GFX10 MIMG hardware operand layout.

2. Conservative depth `SV_Position` interpolation (`emit/mod.rs`):
   - Declare `SV_Position` with `linear_noperspective_centroid` (5) instead of
     `linear_noperspective` (4) in pixel shaders outputting `SV_DepthLessEqual`
     or `SV_DepthGreaterEqual` (kinds 18/19).

3. Per-row interpolation mode consistency (`emit/mod.rs`, `emit/lower.rs`):
   - Add `harmonize_row_interp()` so elements sharing a signature row always
     declare the same interpolation mode: rows containing integer attributes or
     `SV_IsFrontFace` propagate `nointerpolation` (1) to sibling elements, and
     after pixel-shader lowering unread siblings inherit the actual read mode
     of sibling elements in the same row.

4. Container signature row ordering (`emit/container.rs`):
   - Sort `ISG1`/`OSG1` rows stably by register only (`row`) rather than
     `(row, col)`, preserving DXIL element-ID order within a row so the
     container signature matches DXIL validator expectations byte for byte.

5. SM 6.6 compute-shader implicit derivatives (`emit/shader.rs`, `emit/container.rs`, `emit/lower.rs`):
   - Track compute shaders emitting implicit-derivative sampling ops and emit
     `dx.valver = 1.8` with `PSVRuntimeInfo3` (52 bytes, carrying
     `EntryFunctionName`), enabling validation and D3D12 compute PSO creation.

Adds 5 unit + `dxil.dll` validation (+ D3D12 compute PSO) tests in `emit::tests`.
With a16 the bias of `image_sample_b` keeps its own address dword but
holds an f16 in the low half (as LLVM's AMDGPU lowering builds it), so
reading the dword as f32 silently dropped the bias. Unpack the low half
and convert it like the other 16-bit addresses.

Derivatives are only 16-bit in the `_g16` opcodes; under a16 alone they
stay one 32-bit dword each and only the coordinates and LOD are packed.
Fix the decoder's address dword count (2D `image_sample_d ... a16` is
five dwords) and read the gradients as full dwords, starting the packed
coordinates after them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
src2 plus the sum of the unsigned differences |a - b| of the operands' bytes (v_sad_u8), halves (v_sad_u16)
or whole dwords (v_sad_u32), wrapping at 32 bits. v_sad_hi_u8 adds the byte sum shifted to the high half;
v_msad_u8 leaves out a byte whose mask byte (src1) is 0.

AI-assisted (Claude Code).
AI-generated & verified with Gemini 4 Neon (High Mode) — not written by a human engineer.

Lower the four RDNA2 `frexp` instructions (`v_frexp_mant_f32`,
`v_frexp_exp_i32_f32`, `v_frexp_mant_f16`, `v_frexp_exp_i16_f16`) via a shared
32-bit bitwise `frexp_f32` helper:
- finite non-zero (normal and subnormal via DXIL `FirstbitHi` op 33):
  mantissa in `(-1, -0.5] U [0.5, 1)` and unbiased exponent `exp` where
  `a == mantissa * 2^exp`;
- `±0`, `±inf`, `NaN`: mantissa preserves the input (sign/special value),
  exponent is `0`.
- f16 variants widen through `half_fsrc` (exact even for all f16 subnormals),
  apply `frexp_f32`, and preserve the destination's untouched half via
  `write_half`.

Verified with synthetic GPU + WARP + dxil.dll tests in `valu_tests.rs` on
NVIDIA GeForce RTX 3060 Ti (Windows 11, Rust 1.98.1). No game data used.

Co-Authored-By: Gemini 4 Neon (High Mode) <[email protected]>
AI-generated & verified with Gemini 4 Neon (High Mode) — not written by a human engineer.

- Add `v_mad_u16` (VOP3 0x340) and `v_mad_i16` (VOP3 0x35e) to `valu16` / `valu16_op`
  in `crates/victory-shader/src/emit/lower.rs`, preserving the untouched half
  of the destination VGPR via `write_half`.
- Allow saturating `v.clamp` on `v_add_nc_u16`, `v_sub_nc_u16`, `v_subrev_nc_u16`,
  `v_mad_u16`, and `v_mad_i16` (clamping to `[0, 65535]` for unsigned and
  `[-32768, 32767]` for signed in 32-bit intermediate precision). Non-saturating
  16-bit integer ops continue to reject `v.clamp`.

Verified with synthetic GPU + WARP + dxil.dll tests in `valu_tests.rs` on
NVIDIA GeForce RTX 3060 Ti (Windows 11, Rust 1.98.1). No game data used.

Co-Authored-By: Gemini 4 Neon (High Mode) <[email protected]>
AI-generated & verified with Gemini 4 Neon (High Mode) — not written by a human engineer.

Lower `v_ldexp_f16` (`D.f16 = S0.f16 * 2^(S1.i16)`) in `valu16` / `valu16_op`:
- Widens `S0` via `half_fsrc` (exact for all f16 normals and subnormals, honoring
  `opsel[0]`, `abs[0]`, `neg[0]`) and sign-extends `S1` from 16 bits via `half_src`.
- Clamps the exponent to `[-64, 64]` and constructs `2^e` directly as a normal
  finite f32 (`(e + 127) << 23`), so `±0 * finite = ±0` (never `0 * inf = NaN`),
  `±inf * finite = ±inf` (never `inf * 0 = NaN`), and extreme exponents
  (`i16::MIN` / `i16::MAX`) overflow/underflow f16 cleanly without intermediate
  f32 faults.
- Writes back via `float_result` (honoring `clamp`, `opsel[3]`, and preserving
  the untouched half of the destination VGPR).

Verified with synthetic GPU + WARP + dxil.dll tests in `valu_tests.rs` on
NVIDIA GeForce RTX 3060 Ti (Windows 11, Rust 1.98.1). No game data used.

Co-Authored-By: Gemini 4 Neon (High Mode) <[email protected]>
The ISA defines v_med3_f32/v_med3_f16 over v_min_f32/v_max_f32, which order
-0 below +0 (#448 settled those), so of three zeros the median is the sign
two of them share; DXIL's plain FMin/FMax chain gives either zero. The zero
the chain leaves now takes that majority's sign (11 instructions). A NaN
still gives the minimum of the three.

Noticed while porting the idea of ivall/xcl#1348 (DavidM1911).

Tests: hardware execution tests in valu_tests for both operand orders and
the halves.

Written with an AI assistant.
The first commit left a heap descriptor of no listed kind that a vector
buffer store or atomic also uses on the constant buffer path, which is a
CBV handle on the UAV the title made. Scalar loads through it now read a
raw UAV (11 | 0x1000), as #1055 does for a table's UAV; read-only use
stays a raw SRV. The test's store case now expects no CBV handle.

In the title's shaders.rpf no program has this case (all 38,829 changed
loads are the read-only one); emit and validation counts are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	crates/victory-shader/src/emit/lower.rs
#	crates/victory-shader/src/emit/valu_tests.rs
# Conflicts:
#	crates/victory-shader/src/emit/lower.rs
Merges #1057 #1073 #1074 #1084 #953 #1056 #1015 #1055 #563 #1004 onto main
(ffe310e), each head unchanged. Two merges needed a hand resolution:

- #1015 + #1055 (emit/lower.rs, the raw-view choice for a scalar buffer
  load of a descriptor): an SRV range reads a raw SRV view, a UAV range a
  raw UAV view, a descriptor of no listed kind the heap buffer view of #1015.
  Both of their tests (emit/valu_tests.rs) are kept.
- #563 + #1004 (emit/lower.rs, cube sample refusal): #563 lowers gradients
  and #1004 the level query, so only texel coordinates are still refused.

cargo clippy --workspace --all-targets --locked -- -D warnings, with and
without --all-features, is clean and cargo test --workspace --locked passes
(350 passed, 6 ignored; main has 342 passed, 6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Buffer format loads divide a UNORM or SNORM field by its largest value.
A host may divide through a reciprocal and land just below 1.0: on an
RX 9070 (RDNA 4), 16_16_UNORM's 65535 loaded through the d16 path as the
half 0x3BFF instead of 0x3C00. The largest value now selects 1.0, and an
SNORM field's two lowest values select -1.0, as the formats define them.
When a compute shader does not translate (e.g. unsupported GFX10 lane
mask ops), its dispatch is dropped before bind() runs. This means
ensure_state is never called for the UAVs it would have written, leaving
those resources in a stale hazard state on the host list.

The next dispatch that does run and reads those UAVs triggers
DXGI_ERROR_DEVICE_REMOVED (0x887A0006) because D3D12 sees a UAV hazard
with no preceding barrier to resolve it.

Fix: emit a global null-resource UAV barrier immediately after any
dropped compute dispatch. This matches the existing pattern in
indirect.rs and flushes the hazard slate so the following dispatch
starts clean.

Fixes #1347
# Conflicts:
#	crates/victory-shader/src/emit/lower.rs
# Conflicts:
#	crates/victory-shader/src/emit/lower.rs
# Conflicts:
#	crates/victory-shader/src/emit/lower.rs
# Conflicts:
#	crates/victory-shader/src/emit/lower.rs
Merges #1067 #305 #306 #176 on top of the bundle of #1319 (itself on main,
ffe310e), each head unchanged. In #1247's offline benchmark on a retail dump
they gain 295, 520, 153 and 117 programs. Each needed a hand resolution
against the PRs of #1319 (see the pull request text); the combined
semantics are the ones of both sides.

cargo clippy --workspace --all-targets --locked -- -D warnings, with and
without --all-features, is clean and cargo test --workspace --locked passes
(359 passed, 6 ignored; main has 342 passed, 6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
AI-authored and verified by Gemini 4 Neon (High Mode) — zero game data used.

Fixes VIC-BT-004 (P0) and VIC-BT-012 (P1) from #1242:
- `crates/victory-gpu/src/descriptor/host.rs`: when a typed console texture was
  promoted to a typeless host copy (`host_texture` for sRGB+UAV or
  shader-readable depth targets), `fits()` previously rejected NULL-desc and
  `DXGI_FORMAT_UNKNOWN` SRV/UAVs, replacing them with null views. Now resolves
  the promoted view format (shader-readable depth plane 0 format for depth SRVs,
  linear twin for sRGB UAVs, title format for sRGB SRVs) and synthesizes a
  dimension-matched default SRV/UAV description when `desc` is `None`.
- `crates/victory-gpu/src/descriptor.rs`: `RtvRecord::desc()` and
  `RtvRecord::depth_desc()` previously hardcoded `TEXTURE_2D` for NULL-desc
  RTV/DSVs on promoted-typeless targets; now inspect the host texture's
  `Dimension`, `DepthOrArraySize`, and `SampleDesc.Count` to emit the exact
  `1D`, `1DArray`, `2D`, `2DArray`, `2DMS`, `2DMSArray`, or `3D` view desc.
- Adds unit tests plus a real D3D12 hardware test verifying NULL/UNKNOWN views
  on promoted sRGB+UAV and 2D-array depth textures on the host GPU.
Fix the invalid u8 dereference in the f16 pairing path. Restrict copy tracing and both interpolation halves to the entry EXEC mask, checking both halves for wave64. Unknown masks remain unsupported rather than treating partially written VGPRs as full copies.

Add f16/f32, wave32/wave64 regressions for i, j, accumulator, p1 and p2 mask changes. The regression fails without the EXEC guard. All-feature shader suite: 123 passed, 1 benchmark ignored. Workspace all-target/all-feature Clippy and asset policy passed.
NVIDIA (RTX 3060 Ti) refuses B4G4R4A4 render targets and B5G5R5A1/B5G6R5
typed UAV stores, which the console and AMD allow: Grand Theft Auto VI's
two 2560x1440 targets of those formats had no host texture. Render-target
and unordered-access textures of such formats now get a B8G8R8A8 host
copy, which their views, target views, clear values and pipelines name;
sampled-only textures keep their format. Copies between a widened and a
native texture are skipped (the host refuses them).

A view heap larger than the host takes now finds the host's limit by
binary search instead of assuming the portable 1,000,000 (which is
exactly the RTX 3060 Ti's limit).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
compute_shader_implicit_sample_uses_valver_1_8_and_validates and
row_interp_harmonizes_packed_elements_and_validates (both #306) fail with
the stock Windows SDK's dxil.dll (validator 1.7): the first because the
module declares validator 1.8 ("Validator version in metadata (1.8) is not
supported; maximum: (1.7)"), the second with "Container part 'Pipeline
State Validation' does not match expected for module" (reported by
alexdeliu on #1495, RX 9070). A runner with the stock SDK would fail them.

Validator::version() asks the validator for its IDxcVersionInfo, and the
two tests validate through validate_if_1_8_available, which skips with a
message when the version is below 1.8 and validates as before otherwise.
Checked here with validator 1.9 (they run) and with an old SDK's 1.5 (they
skip).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Merges #156 #162 #168 #169 #368 #379 #456 #587 #990 #1021 #1048 #1052 #1053
#1095 #1142 #1190 #1211 #1223 #1259 #1293 on top of the bundle of #1402
(which is on #1319, on main ffe310e), each head unchanged. Hunks that
conflicted in emit/lower.rs, emit/valu_tests.rs and emit/diff_tests.rs were
merged by keeping both sides (additions next to each other); a PR was kept
only if cargo clippy -p victory-shader --all-targets -- -D warnings still
passed with it. No instruction name is handled in two places.

#98 is not in this version: an offline measurement on a retail dump showed
it loses 31 programs that validate on #1402.

cargo clippy --workspace --all-targets --locked -- -D warnings, with and
without --all-features, is clean and cargo test --workspace --locked passes
(381 passed, 6 ignored; main has 342 passed, 6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
#453 evaluates the halves of an interpolation on their own when i or j is
computed (SV_Barycentrics, Interp::Weighted). #1293 (in the stack) follows
plain v_mov_b32 copies to find the barycentric of a pair, and #176 (in the
stack) pairs packed 16-bit pixel inputs through half_inputs. The conflicts
were in io.rs (the pairing), emit/lower.rs (the interpolation lowering and
two spots of the phi and helper code) and emit/shader.rs (the feature
bits). See the pull request text for how each was resolved.

#1293's test interpolation_follows_agreeing_phis_and_rejects_mismatched_or_modified_copies
asserted that a computed i (a phi of i and j, a negated copy) is refused;
with #453 it is supported as a Weighted pair, so those two assertions now
expect Weighted halves.

cargo clippy --workspace --all-targets --locked -- -D warnings, with and
without --all-features, is clean and cargo test --workspace --locked passes
(391 passed, 6 ignored; main has 342 passed, 6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Merges #1145 #343 #1042 #1303 #477 on top of the stack of #1504 (#1319,
#1402, #1492, #1504, on main ffe310e), each head unchanged, no conflicts
and no changes of mine. cargo clippy --workspace --all-targets --locked
-- -D warnings, with and without --all-features, is clean and cargo test
--workspace --locked passes (406 passed, 6 ignored; main has 342 passed,
6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
#189 adds an `options` field to lower::Parts. On the stack, one test helper
of #189's own diff conflicted with the same lines reformatted by another PR
(kept #189's field, rustfmt's layout), and three struct literals of tests
that other PRs of the stack add (two in emit/lower.rs, one in
emit/root_view_tests.rs) lacked the new field; each now has
`options: TranslateOptions::default()`.

cargo clippy --workspace --all-targets --locked -- -D warnings, with and
without --all-features, is clean and cargo test --workspace --locked passes
(430 passed, 6 ignored; main has 342 passed, 6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
#1077 adds `root_uavs` to HostShader. Three literals in tests that other
PRs of the stack add (cs_with_wave_size in emit/host.rs, #189;
validate_and_create_cs_pso in emit/shader.rs; the root view test in
emit/root_view_tests.rs, #1056) lack the field; each now has it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
- draw.rs: #1077 pushes a root UAV's dynamic slot on `self.dynamic`; #1388
  moves those slots to the list (list.keep_dynamic), so the push is
  list.keep_dynamic(heap, index, 1).
- resource.rs: #1523 and #1040 both declare `const RENDER_TARGET` in
  host_texture; the second is dropped.
- resource.rs, the test of #1040: it assumed every adapter refuses a typed
  UAV on B5G5R5A1_UNORM, which host_texture only drops where the adapter
  refuses it (an RX 6950 XT accepts it); the test asks the adapter the same
  way.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
#1516 and #1175 both add a test at the end of emit/valu_tests.rs; both are
kept. A test #1516 adds in emit/lower.rs builds `Parts` without #189's
`options` field; it now passes TranslateOptions::default().

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
#542 bounds a raw scalar load's offset (bound_raw_offset) for the SRV raw
view it handles. The stack has one raw-view branch for an SRV range, a UAV
range or a heap buffer, so the bound applies to all of them. The test helper
#542 adds needed the structured program as resource::track's fourth
argument, #189's `options` field on Parts and #1077's `root_uavs` on
HostShader.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Merges #1077 #1175 #523 #530 #1040 #1406 #1392 #1516 #1388 #1189 #1523 #542
on top of #1589 (#189 on the shader stack of #1511), each head unchanged;
#1407 is left out, as it conflicts with #189. Hand changes, in their own
commits or merge commits: the HostShader literals of #1077, the slot of
#1388, the duplicate constant of #1523, #1040's test asking the adapter,
#1516's test join and #542's bound on the stack's raw-view branch. See the
pull request text.

cargo clippy --workspace --all-targets --locked -- -D warnings, with and
without --all-features, is clean and cargo test --workspace --locked passes
(461 passed, 6 ignored, two runs; main has 342 passed, 6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
PSV0 shared one string-table copy of a repeated semantic name (TEXCOORD0
and TEXCOORD1 pointing at the same "TEXCOORD"). DXC's PSV writer writes
one copy per element, and validators before 1.8 compare PSV0 byte for
byte, so any signature repeating a name was rejected there ("Pipeline
State Validation does not match"); 1.8 compares the strings and accepted
both. Checked against dxil.dll 1.7, 1.8 and 1.9.

Validator::version() reads IDxcVersionInfo; the compute-derivative test
skips dxil.dll validation when the validator predates 1.8, which rejects
dx.valver 1.8 outright. Translated shaders never go through dxil.dll.

Reported by @alexdeliu.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This reverts commit 119b7630d7.
The author's head now does what the bundle's own commit did (a validator version query and the
skip below 1.8), and fixes the second failing test at its cause; the bundle's commit is
reverted just before this merge.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The shader chain moved: #306 is at its author's new head (e3067ae), and the bundle's own
validator commit is reverted.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The shader chain moved: #306 is at its author's new head (e3067ae), and the bundle's own
validator commit is reverted.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The shader chain moved: #306 is at its author's new head (e3067ae), and the bundle's own
validator commit is reverted.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The shader chain moved: #306 is at its author's new head (e3067ae), and the bundle's own
validator commit is reverted.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The shader chain moved: #306 is at its author's new head (e3067ae), and the bundle's own
validator commit is reverted.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:39:21 +00:00
github-bot closed this pull request 2026-11-26 04:39:21 +00:00
Author
Owner

@⁠ryotdev on GitHub · 2026-11-24 20:27 UTC · original

Tested 0be02a18 through the first story title card on Windows, RTX 5070, driver 610.88, Series X 1.0.2.1. Built from source with diagnostics, a fresh shader cache and automatic wave-mode selection. The runtime selected Emulate. I saw zero compute PSOs rejected by D3D12 with E_INVALIDARG.

For context, an earlier clean upstream revision (d2a4bae) on this machine had 117 distinct compute PSOs rejected with E_INVALIDARG. I matched all 117 to their translated DXIL. Each required exactly 64 lanes. CheckFeatureSupport reports a minimum and maximum of 32 on this adapter. Of those same shaders, this run showed 20 with working host pipelines and 45 explicitly refused during translation. I couldn't establish an outcome for the other 52. This wasn't a comparison against the immediate base of the bundle.

Still blocked at the first 3D scene. DRED showed one list stopped at command 795 of 2283, in a series of DispatchMesh calls, followed by two lists that hadn't started. Removal reason was DXGI_ERROR_DEVICE_HUNG. No per-mesh marker identified the shader. The last captured normal frame showed the opening story card. No pipeline skips or forced render target.

AI-assisted test and analysis. Happy to compare the same setup against a specific follow-up fix.

**@⁠ryotdev** on GitHub · 2026-11-24 20:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/1638#issuecomment-7143577859) Tested `0be02a18` through the first story title card on Windows, RTX 5070, driver 610.88, Series X 1.0.2.1. Built from source with diagnostics, a fresh shader cache and automatic wave-mode selection. The runtime selected `Emulate`. I saw **zero compute PSOs rejected by D3D12 with E_INVALIDARG**. For context, an earlier clean upstream revision (`d2a4bae`) on this machine had 117 distinct compute PSOs rejected with E_INVALIDARG. I matched all 117 to their translated DXIL. Each required exactly 64 lanes. CheckFeatureSupport reports a minimum and maximum of 32 on this adapter. Of those same shaders, this run showed 20 with working host pipelines and 45 explicitly refused during translation. I couldn't establish an outcome for the other 52. This wasn't a comparison against the immediate base of the bundle. Still blocked at the first 3D scene. DRED showed one list stopped at command 795 of 2283, in a series of DispatchMesh calls, followed by two lists that hadn't started. Removal reason was DXGI_ERROR_DEVICE_HUNG. No per-mesh marker identified the shader. The last captured normal frame showed the opening story card. No pipeline skips or forced render target. AI-assisted test and analysis. Happy to compare the same setup against a specific follow-up fix.
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-24 20:39 UTC · original

ryotdev: thank you. 117 compute PSOs rejected for 64 lanes at d2a4bae down to none on a 32-lane card is what #1589 is for, and matching all 117 to their translated DXIL is a solid confirmation of the cause.

For the hang in the DispatchMesh run (command 795 of 2283) two diagnostics PRs that this tree does not have are the next step, so I built the same tree with them: branch bundle/nvidia-crumbs on MamaLeVrai/VIctory, which is #1638 at 0be02a1 plus #1081 and #279. Clippy (both runs) and cargo test --workspace pass here (466 tests, two runs). It is a test tree; no PR is open for it.

  • #279: the removal report names up to 40 commands, starting a few before the stopped one, where the code now shows the first 12 after the previous barrier (in_flight in victory-gpu/src/host.rs). In a long run of DispatchMesh calls between two barriers those first 12 can be commands that had finished, which may be why no marker named a shader in your report. VICTORY_SHADER_DUMP=<dir> writes each shader's container and DXIL under its hash, so a hash the report names can be read with dxc -dumpbin.
  • #1081: with VICTORY_SHADER_BREADCRUMBS=1 (diagnostics build) each loop keeps its iteration count in host memory; after a removal the report lists the five loops that counted most, with the pipelines that use them. Its author's note says the per-frame cost is not measured.

To run it: a diagnostics build with VICTORY_D3D12_DRED=1 and VICTORY_SHADER_BREADCRUMBS=1, then post the removal report (the a list stopped at command ... text and any shader breadcrumbs: line). #1081 meets #1638 in seven small hunks (both add a field to Parts and to its test literals); all are kept. I have not run the title.

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-24 20:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/1638#issuecomment-7143877618) ryotdev: thank you. 117 compute PSOs rejected for 64 lanes at `d2a4bae` down to none on a 32-lane card is what #1589 is for, and matching all 117 to their translated DXIL is a solid confirmation of the cause. For the hang in the DispatchMesh run (command 795 of 2283) two diagnostics PRs that this tree does not have are the next step, so I built the same tree with them: branch `bundle/nvidia-crumbs` on `MamaLeVrai/VIctory`, which is #1638 at `0be02a1` plus #1081 and #279. Clippy (both runs) and `cargo test --workspace` pass here (466 tests, two runs). It is a test tree; no PR is open for it. - **#279**: the removal report names up to 40 commands, starting a few before the stopped one, where the code now shows the first 12 after the previous barrier (`in_flight` in `victory-gpu/src/host.rs`). In a long run of DispatchMesh calls between two barriers those first 12 can be commands that had finished, which may be why no marker named a shader in your report. `VICTORY_SHADER_DUMP=<dir>` writes each shader's container and DXIL under its hash, so a hash the report names can be read with `dxc -dumpbin`. - **#1081**: with `VICTORY_SHADER_BREADCRUMBS=1` (diagnostics build) each loop keeps its iteration count in host memory; after a removal the report lists the five loops that counted most, with the pipelines that use them. Its author's note says the per-frame cost is not measured. To run it: a diagnostics build with `VICTORY_D3D12_DRED=1` and `VICTORY_SHADER_BREADCRUMBS=1`, then post the removal report (the `a list stopped at command ...` text and any `shader breadcrumbs:` line). #1081 meets #1638 in seven small hunks (both add a field to `Parts` and to its test literals); all are kept. I have not run the title. AI-assisted (Claude Code); no game data.
Author
Owner

@⁠Bullet18x on GitHub · 2026-11-24 20:56 UTC · original

First NVIDIA run of this bundle: RTX 5090 (32-lane waves), driver 621.40, Windows 11 Pro 10.0.28000, Rust 1.98.1, head 0be02a18e, clean worktree, game-data tests skipped.

  • cargo clippy --workspace --all-targets --locked -- -D warnings: clean
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: clean
  • cargo test --workspace --locked --no-fail-fast: 459 passed, 2 failed, 6 ignored (plain cargo test stops at the first failing crate: 103 passed, 1 failed)

1. resource::tests::host_texture_drops_unsupported_uav_flag_for_b5g5r5a1 (resource.rs:2022: left: true, right: false). NVIDIA-only, from #1040's test meeting #1523 in this tree:

  • #1523's widened() asks the adapter about format 86 (B5G5R5A1_UNORM); on this NVIDIA driver it has no typed UAV store, so host_texture turns the format into WIDE (87, B8G8R8A8_UNORM) before #1040's flag check (resource.rs:919).
  • 87 supports typed UAVs, so the UAV flag is (correctly) kept on the created texture.
  • The test still asks supports(86, TYPED_UNORDERED_ACCESS_VIEW) → false, and expects the flag dropped.

On AMD 86 is not widened, which is why the RX 6950 XT run is green. Suggested fix: compare against the format the texture was created with, i.e. supports(d.Format.0 as u32, ...) instead of the literal 86 (or skip the check when widened(86)).

2. emit::wave64_tests::gpu::gpu_128_threads_ds_swizzle_and_dpp_row_mask (from #189): only its WARP pass fails (Wave32, warp=true ... output mismatch); the hardware pass on the 5090 passes. Also fails on wave64-189 and all; likely this Windows Insider build's WARP (a GTX 1060 / Windows 10 run passes it). Details on #189.

The title itself was not run on this exact bundle. (Runs of #189 and #1523 alone on this machine: #1586.)

AI use: Claude Code (Claude Opus 5.5) ran the commands, traced the failure and wrote this; I checked it.

**@⁠Bullet18x** on GitHub · 2026-11-24 20:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/1638#issuecomment-7144252817) First NVIDIA run of this bundle: RTX 5090 (32-lane waves), driver 621.40, Windows 11 Pro 10.0.28000, Rust 1.98.1, head `0be02a18e`, clean worktree, game-data tests skipped. - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: clean - `cargo test --workspace --locked --no-fail-fast`: **459 passed, 2 failed, 6 ignored** (plain `cargo test` stops at the first failing crate: 103 passed, 1 failed) **1. `resource::tests::host_texture_drops_unsupported_uav_flag_for_b5g5r5a1`** (resource.rs:2022: `left: true, right: false`). NVIDIA-only, from #1040's test meeting #1523 in this tree: - #1523's `widened()` asks the adapter about format 86 (B5G5R5A1_UNORM); on this NVIDIA driver it has no typed UAV store, so `host_texture` turns the format into `WIDE` (87, B8G8R8A8_UNORM) *before* #1040's flag check (resource.rs:919). - 87 supports typed UAVs, so the UAV flag is (correctly) kept on the created texture. - The test still asks `supports(86, TYPED_UNORDERED_ACCESS_VIEW)` → false, and expects the flag dropped. On AMD 86 is not widened, which is why the RX 6950 XT run is green. Suggested fix: compare against the format the texture was created with, i.e. `supports(d.Format.0 as u32, ...)` instead of the literal 86 (or skip the check when `widened(86)`). **2. `emit::wave64_tests::gpu::gpu_128_threads_ds_swizzle_and_dpp_row_mask`** (from #189): only its WARP pass fails (`Wave32, warp=true ... output mismatch`); the hardware pass on the 5090 passes. Also fails on `wave64-189` and `all`; likely this Windows Insider build's WARP (a GTX 1060 / Windows 10 run passes it). Details on #189. The title itself was not run on this exact bundle. (Runs of #189 and #1523 alone on this machine: #1586.) AI use: Claude Code (Claude Opus 5.5) ran the commands, traced the failure and wrote this; I checked it.
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-24 21:19 UTC · original

Offline shader counts on a retail dump

Result: +226 programs over #1402 (head 119b763), 0 lost. Head 0be02a1, compared with #1402 at 119b763: 23,412 → 23,638 validated.

Failure on #1402 Gained
an interpolation with computed barycentrics 194
barycentrics read directly 32

These are exactly the 226 programs that #1504 gains on top of #1492 (measured there). #1504 is in this bundle's history. So the bundle's other changes, wave64 compute and the world-run list, change no offline count. That fits: their effect is on the runtime side (pipelines the host refuses, device removal), which an offline translate --validate does not show.

Method: victory translate --validate --list on shaders.rpf (1.0.2.1), dxil.dll 1.8.2502.11, compared program by program (25,889 programs). AI-assisted (Claude Code). No shader names or data are included, per the asset policy.

**@⁠sinan-cmyk** on GitHub · 2026-11-24 21:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/1638#issuecomment-7144789060) ### Offline shader counts on a retail dump **Result: +226 programs over #1402 (head 119b763), 0 lost.** Head 0be02a1, compared with #1402 at 119b763: 23,412 → 23,638 validated. | Failure on #1402 | Gained | |---|---| | an interpolation with computed barycentrics | 194 | | barycentrics read directly | 32 | These are exactly the 226 programs that #1504 gains on top of #1492 ([measured there](https://git.gtahub.st/github/Marvisak--VIctory/pulls/1504)). #1504 is in this bundle's history. So the bundle's other changes, wave64 compute and the world-run list, change no offline count. That fits: their effect is on the runtime side (pipelines the host refuses, device removal), which an offline `translate --validate` does not show. Method: `victory translate --validate --list` on `shaders.rpf` (1.0.2.1), dxil.dll 1.8.2502.11, compared program by program (25,889 programs). AI-assisted (Claude Code). No shader names or data are included, per the asset policy.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:22 UTC · original

Automated triage for the maintainers. Closing because this pull request re-packages other open pull requests. Each of those is reviewed on its own, so a bundle cannot be merged.

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 01:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/1638#issuecomment-7149477419) Automated triage for the maintainers. Closing because this pull request re-packages other open pull requests. Each of those is reviewed on its own, so a bundle cannot be merged. 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.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:32 UTC · original

Automated triage for the maintainers.

Needs rebase. This pull request conflicts with main (conflicting: README.md, apps/victory/src/translate.rs, crates/victory-gpu/src/capture.rs, crates/victory-gpu/src/descriptor/host.rs, crates/victory-gpu/src/draw.rs). It will be reviewed once it is rebased onto the current main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/1638#issuecomment-7149671653) <!-- victory-triage v1 head=ab4a6e645b1e5ec11cfcd75d2660c1280876c760 verdict=needs-rebase at=2026-11-25T01:32:50Z --> Automated triage for the maintainers. **Needs rebase.** This pull request conflicts with `main` (conflicting: `README.md`, `apps/victory/src/translate.rs`, `crates/victory-gpu/src/capture.rs`, `crates/victory-gpu/src/descriptor/host.rs`, `crates/victory-gpu/src/draw.rs`). It will be reviewed once it is rebased onto the current `main`. --- _Generated by [Claude Code](https://claude.ai/code)_

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1638
No description provided.