fix: lower what the Series S upscaler's passes use (int8 dots, v_pk_fmac_f16, src_scc, ...) #387

Manually merged
github merged 2 commits from github-bot/gh-387 into main 2026-11-26 18:03:27 +00:00 AGit
Owner

@⁠Skyfrye on GitHub · 2026-11-26 15:10 UTC · original
Skyfrye:nep/shader-fsr-passes → main · +352 −12 · 7 files · 2 commits · merged 2026-11-26 18:03 UTC

Summary

As a Series S, the title has the console's AMD FidelityFX upscaler library (amd_fidelityfx_upscaler_xbox.dll) build the 1920x1080 picture from the 1280x720 scene. The upscaler's 29 compute passes come in ACCC containers. With VICTORY_WAVE32_NVIDIA=1 the translator reads those containers (#377), but none of the 29 translated:

  • 28 stopped at "a descriptor changed after loading";
  • 1 stopped at "a packed 16-bit operation";
  • behind those were instructions and idioms that AMD's compiler emits and the console's own compiler does not.

Their dispatches were dropped, so in Series S mode the 3D picture stayed black under the UI (--console series-s).

This PR lowers what those passes use. With VICTORY_WAVE32_NVIDIA=1 (required: without it, ACCC containers are not read at all, as #377 decided), all 29 now translate, validate and get pipelines, and the Series S picture appears.

What is lowered

Case What it does now
A buffer descriptor made raw after loading AMD's compiler clears the stride, multiplies the record count by it and sets bounds by bytes. It is traced as the descriptor that was loaded: same memory, same bounds, and the host view is read by bytes too (resource.rs, made_raw).
v_dot4c_i32_i8 (VOP2) Accumulates into its destination. 25,813 of them carry the FSR 4 model's weights.
v_dot4_i32_i8, v_dot4_u32_u8 (VOP3P) Same as above, as DXIL dot4AddPacked (SM 6.4), wrapping as the hardware does. Each byte source is two 16-bit halves that op_sel picks, as packed integer operations already do here.
v_pk_fmac_f16 (VOP2) Each half of the destination accumulates the product of the same halves of the sources.
src_scc as an operand Reads SCC as a number, 0 or 1.
image_atomic_* with 16-bit coordinates (a16) Coordinates are read as image loads already read them.
image_store of the first 1 to 3 channels The other channels are written 0. This is right for a format with no more channels.
A wave64 reduction's total read from lane 63 Read by v_readlane_b32 right after the whole-wave section restores EXEC; the section's simulation now follows such constant-lane reads (wave.rs, Section::after). The three wave64 model passes then translate in the paired form on 32-lane hosts.
victory translate and victory shader-info Read ACCC parts as the runtime does (with the switch on), so the passes can be checked offline.

Known gaps (not in this PR)

  • The upscaler library calls two methods we do not implement: pipeline state slot 0x58 and command list slot 0x1a8 (probably ClearUnorderedAccessViewUint). They are logged once each. The picture looks right without them.
  • Another route exists: VICTORY_FSR_DLL pointed at AMD's PC upscaler DLL. fidelityfx.rs already redirects the title's upscaler to it. This PR is the route that needs no outside DLL: the console library's own passes run.

Verification

Machine: RTX 5080, Windows 11. Branch rebased on upstream 65c28e3. The checks below ran on 341e299; the merges since then do not touch victory-shader or the translate / shader-info commands.

Offline translation of the upscaler library. Command (CPU, plus --pipelines on the card):

VICTORY_WAVE32_NVIDIA=1 VICTORY_HOST_MAX_WAVE=32 victory translate --validate --pipelines --list amd_fidelityfx_upscaler_xbox.dll

Build Compute programs
Upstream 341e299 0 of 29 emitted (28 "a descriptor changed after loading", 1 "a packed 16-bit operation"). Upstream's translate does not read ACCC, so for this count it was patched locally the same way this PR does.
This PR 29 of 29 emitted, 29 validated (dxil.dll 10.0.26100), 29 pipelines created on the card

Without the switch, both builds report "no DXIL part", as before.

Whole archive. victory translate --validate --list shaders.rpf with VICTORY_HOST_MAX_WAVE=32, switch off:

  • the summaries are identical: 26,084 programs translated of 26,084; VS/PS 14,247 emitted and validated; CS 2,677 of 2,682; MS 8,765 emitted, 8,694 validated;
  • the 26,503 per-container outcome lines (offsets stripped, sorted) differ in 0 lines.

Tests. cargo test --locked -p victory-shader on the RTX 5080 (hardware and WARP legs): 257 passed, 0 failed, 2 ignored. Each new test fails on upstream without its change:

Test Without the change
dot4_of_bytes_wraps_into_the_accumulator fails at lower
packed_fmac_f16_accumulates_each_half_into_its_own fails at lower
src_scc_reads_scc_as_a_number fails at lower
a_buffer_descriptor_made_raw_is_the_descriptor_loaded the tracker refuses "a descriptor changed after loading"
paired_lanes_read_a_wave_or_from_lane_63_after_the_restore "a whole-wave section step the simulation does not follow"; with the change it runs on the card in the paired form and returns the OR of both halves

cargo test --locked -p victory-gpu --lib:

  • the 3 known failures on main (spans_say_the_next_start_and_the_lowest_level_viewed, warp_card_fetch_copies_flagged_pieces_to_their_slots, warp_card_patch_writes_the_masked_bytes_and_no_others);
  • a WARP test that failed once in the full run and passed alone.

cargo xtask policy: ok.

In game (Series S). Diagnostics builds with VICTORY_CAPTURE (presented frames saved from the GPU), --console series-s, VICTORY_INDIRECT_RAW=3.

  • Before (builds without this change: the earlier test builds 4bd62e7 and ec22880, main plus unrelated PRs; and offline, upstream with the switch on translates 0 of 29 passes):
    • every upscaler dispatch is listed as DROPPED in the frame op listings;
    • the 1920x1080 output target is black while the 1280x720 scene target holds the cell cutscene;
    • every presented frame is black.
  • After (this branch, VICTORY_WAVE32_NVIDIA=1, run sd-fsr2-after; an earlier form of the same lowering, run sd-fsr-fix, looked the same):
    • no "shader does not translate" line, no dropped upscaler dispatch, no device lost;
    • the presented frames show the opening prison-cell cutscene at full resolution: the character at the barred window, the yard and towers behind the glass, the posters and the bunk; later the cell block and a guard at door B35;
    • the first frames after world entry are over-bright while the exposure settles; from about 80 frames in they are sharp and correctly exposed;
    • textures stream in over the following frames, as in Series X mode.
  • Screenshots stay local, per the project rules.

Notes

AI assistance: Claude Opus 5.5 (subagent).

🤖 Generated with Claude Code

**@⁠Skyfrye** on GitHub · 2026-11-26 15:10 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/387) `Skyfrye:nep/shader-fsr-passes` → `main` · +352 −12 · 7 files · 2 commits · merged 2026-11-26 18:03 UTC ## Summary As a Series S, the title has the console's AMD FidelityFX upscaler library (`amd_fidelityfx_upscaler_xbox.dll`) build the 1920x1080 picture from the 1280x720 scene. The upscaler's 29 compute passes come in `ACCC` containers. With `VICTORY_WAVE32_NVIDIA=1` the translator reads those containers (#377), but **none of the 29 translated**: - 28 stopped at "a descriptor changed after loading"; - 1 stopped at "a packed 16-bit operation"; - behind those were instructions and idioms that AMD's compiler emits and the console's own compiler does not. Their dispatches were dropped, so in Series S mode the 3D picture stayed black under the UI (`--console series-s`). This PR lowers what those passes use. **With `VICTORY_WAVE32_NVIDIA=1` (required: without it, ACCC containers are not read at all, as #377 decided), all 29 now translate, validate and get pipelines, and the Series S picture appears.** ### What is lowered | Case | What it does now | |---|---| | A buffer descriptor made raw after loading | AMD's compiler clears the stride, multiplies the record count by it and sets bounds by bytes. It is traced as the descriptor that was loaded: same memory, same bounds, and the host view is read by bytes too (`resource.rs`, `made_raw`). | | `v_dot4c_i32_i8` (VOP2) | Accumulates into its destination. 25,813 of them carry the FSR 4 model's weights. | | `v_dot4_i32_i8`, `v_dot4_u32_u8` (VOP3P) | Same as above, as DXIL `dot4AddPacked` (SM 6.4), wrapping as the hardware does. Each byte source is two 16-bit halves that op_sel picks, as packed integer operations already do here. | | `v_pk_fmac_f16` (VOP2) | Each half of the destination accumulates the product of the same halves of the sources. | | `src_scc` as an operand | Reads SCC as a number, 0 or 1. | | `image_atomic_*` with 16-bit coordinates (a16) | Coordinates are read as image loads already read them. | | `image_store` of the first 1 to 3 channels | The other channels are written 0. This is right for a format with no more channels. | | A wave64 reduction's total read from lane 63 | Read by `v_readlane_b32` right after the whole-wave section restores EXEC; the section's simulation now follows such constant-lane reads (`wave.rs`, `Section::after`). The three wave64 model passes then translate in the paired form on 32-lane hosts. | | `victory translate` and `victory shader-info` | Read ACCC parts as the runtime does (with the switch on), so the passes can be checked offline. | ### Known gaps (not in this PR) - The upscaler library calls two methods we do not implement: pipeline state slot `0x58` and command list slot `0x1a8` (probably `ClearUnorderedAccessViewUint`). They are logged once each. The picture looks right without them. - **Another route exists:** `VICTORY_FSR_DLL` pointed at AMD's PC upscaler DLL. `fidelityfx.rs` already redirects the title's upscaler to it. This PR is the route that needs no outside DLL: the console library's own passes run. ## Verification Machine: RTX 5080, Windows 11. Branch rebased on upstream `65c28e3`. The checks below ran on `341e299`; the merges since then do not touch `victory-shader` or the `translate` / `shader-info` commands. **Offline translation of the upscaler library.** Command (CPU, plus `--pipelines` on the card): `VICTORY_WAVE32_NVIDIA=1 VICTORY_HOST_MAX_WAVE=32 victory translate --validate --pipelines --list amd_fidelityfx_upscaler_xbox.dll` | Build | Compute programs | |---|---| | Upstream `341e299` | 0 of 29 emitted (28 "a descriptor changed after loading", 1 "a packed 16-bit operation"). Upstream's `translate` does not read ACCC, so for this count it was patched locally the same way this PR does. | | This PR | 29 of 29 emitted, 29 validated (`dxil.dll` 10.0.26100), 29 pipelines created on the card | Without the switch, both builds report "no DXIL part", as before. **Whole archive.** `victory translate --validate --list shaders.rpf` with `VICTORY_HOST_MAX_WAVE=32`, switch off: - the summaries are identical: 26,084 programs translated of 26,084; VS/PS 14,247 emitted and validated; CS 2,677 of 2,682; MS 8,765 emitted, 8,694 validated; - the 26,503 per-container outcome lines (offsets stripped, sorted) differ in **0** lines. **Tests.** `cargo test --locked -p victory-shader` on the RTX 5080 (hardware and WARP legs): 257 passed, 0 failed, 2 ignored. Each new test fails on upstream without its change: | Test | Without the change | |---|---| | `dot4_of_bytes_wraps_into_the_accumulator` | fails at `lower` | | `packed_fmac_f16_accumulates_each_half_into_its_own` | fails at `lower` | | `src_scc_reads_scc_as_a_number` | fails at `lower` | | `a_buffer_descriptor_made_raw_is_the_descriptor_loaded` | the tracker refuses "a descriptor changed after loading" | | `paired_lanes_read_a_wave_or_from_lane_63_after_the_restore` | "a whole-wave section step the simulation does not follow"; with the change it runs on the card in the paired form and returns the OR of both halves | `cargo test --locked -p victory-gpu --lib`: - the 3 known failures on main (`spans_say_the_next_start_and_the_lowest_level_viewed`, `warp_card_fetch_copies_flagged_pieces_to_their_slots`, `warp_card_patch_writes_the_masked_bytes_and_no_others`); - a WARP test that failed once in the full run and passed alone. `cargo xtask policy`: ok. **In game (Series S).** Diagnostics builds with `VICTORY_CAPTURE` (presented frames saved from the GPU), `--console series-s`, `VICTORY_INDIRECT_RAW=3`. - **Before** (builds without this change: the earlier test builds 4bd62e7 and ec22880, main plus unrelated PRs; and offline, upstream with the switch on translates 0 of 29 passes): - every upscaler dispatch is listed as DROPPED in the frame op listings; - the 1920x1080 output target is black while the 1280x720 scene target holds the cell cutscene; - every presented frame is black. - **After** (this branch, `VICTORY_WAVE32_NVIDIA=1`, run `sd-fsr2-after`; an earlier form of the same lowering, run `sd-fsr-fix`, looked the same): - no "shader does not translate" line, no dropped upscaler dispatch, no device lost; - the presented frames show the opening prison-cell cutscene at full resolution: the character at the barred window, the yard and towers behind the glass, the posters and the bunk; later the cell block and a guard at door B35; - the first frames after world entry are over-bright while the exposure settles; from about 80 frames in they are sharp and correctly exposed; - textures stream in over the following frames, as in Series X mode. - Screenshots stay local, per the project rules. ## Notes AI assistance: Claude Opus 5.5 (subagent). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
As a Series S the title has the console's AMD FidelityFX upscaler
library (amd_fidelityfx_upscaler_xbox.dll) make the 1920x1080 picture
from the 1280x720 scene. Its 29 compute passes come in ACCC containers,
which the translator reads with VICTORY_WAVE32_NVIDIA=1 (#377), but none
of them translated even so: 28 stopped at "a descriptor changed after
loading", one at "a packed 16-bit operation", and behind those at
instructions and idioms AMD's compiler emits and the console's own
compiler did not. Their dispatches were dropped and the picture stayed
black under the UI.

- A buffer descriptor made raw after loading (stride cleared, record
  count times the stride, out-of-bounds by bytes): the descriptor
  loaded, whose host view is read by bytes too.
- v_dot4c_i32_i8 (VOP2, accumulating into its destination; 25,813 of
  them carry the FSR 4 model's weights), v_dot4_i32_i8 and
  v_dot4_u32_u8 (VOP3P): DXIL dot4AddPacked (SM 6.4), wrapping as the
  hardware does. The VOP3P forms take each byte source as two 16-bit
  halves op_sel picks, as packed integer operations do here.
- v_pk_fmac_f16 (VOP2): each half of the destination accumulates the
  product of the same halves of the sources.
- src_scc as an operand: SCC as a number, 0 or 1.
- image_atomic_* with 16-bit coordinates (a16), read as image loads
  read them; image_store of the first 1 to 3 channels, the others
  written 0 (right for a format with no more channels).
- In wave64 passes, a reduction's total read from lane 63 by
  v_readlane_b32 right after the whole-wave section restores EXEC: the
  section's simulation follows such constant-lane reads.
- `victory translate` and `shader-info` read ACCC parts as the runtime
  does (with VICTORY_WAVE32_NVIDIA=1), to check them offline.

With VICTORY_WAVE32_NVIDIA=1 all 29 now translate, validate (dxil.dll)
and make pipelines on an RTX 5080 (VICTORY_HOST_MAX_WAVE=32; the three
wave64 model passes in the paired form), against 0 before. The title's
own 26,084 programs translate with the same outcome, line for line, as
before.

Tests (each fails without its change): dot4 of signed and unsigned
bytes with wrap-around, v_pk_fmac_f16 and src_scc on the card and WARP;
the raw-made descriptor traced as the load; AMD's wave64 OR read from
lane 63 after the restore, run in the paired form on the card.

AI assistance: Claude Opus 5.5 (subagent).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 15:15:07 +00:00
github manually merged commit 58d2f5353c into main 2026-11-26 18:03:27 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.