Shaders: private (scratch) memory as a per-lane array #265

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

@⁠r4tedx on GitHub · 2026-11-24 01:54 UTC · original
r4tedx:shader/scratch-memory → main · +846 −2 · 5 files · 4 commits · closed without merging

Measured on the title's shaders (by a tester)

EduAzevedo ran victory translate --jobs 8 --list over the retail shaders (v1.0.2.1, 26,148 programs) on main d2a4bae and on this head 7463484, compared program by program (result): 0 programs gained, 0 programs lost. No refusal reason changes.

So this PR does not change what translates in this title today. It adds coverage and is tested on synthetic programs only; it can wait behind PRs that unblock programs the title uses.

What

scratch_load_* and scratch_store_* were refused ("flat memory"), so a program that keeps a local array with a dynamic index, or spills to memory, failed to translate and its draws or dispatches were dropped. No open PR covers private memory.

  • Per-lane array. Each lane's private memory is an alloca of i32 in the entry block, as DXC makes local arrays. A FLAT scratch address (a VGPR, an SGPR or neither, plus the 12-bit signed offset) is a byte offset into the lane's own memory; the hardware interleaves the lanes itself, so no lane index enters the address (RDNA 2 ISA, "Scratch"; LLVM AMDGPUUsage, "Private Segment"; Mesa's ACO uses these instructions the same way).
  • Lowered: dword x1-x4 loads and stores, ubyte/sbyte/ushort/sshort loads, byte and short stores, and the _d16 / _d16_hi forms (one half of the VGPR written, the other kept). Loads write under the lane guard; stores run under it.
  • Size. From the code: an upper bound of every scratch address from the instructions that compute it (constants through and/or/xor, shifts, adds, multiplies, selects, bfe, min/max), plus the access width. Where an address has no such bound (a loaded or loop-carried index) the array is 4 KiB per lane, marked as a shortcut:. At most 64 KiB. Accesses past the end read 0 and drop writes; the index is checked, never wrapped.
  • Decoder fix. GFX10 scratch with saddr 0x7F (LLVM's "ST" mode: neither address register) was read as an SGPR base of exec_hi; it now has none.
  • Bitcode writer gains alloca.

Still refused, each with its reason: generic flat_* (the address may be private, shared or global memory), MUBUF access through a scratch descriptor (cannot be told apart from a buffer the title bound), scratch loads into LDS.

Not verified

No game files were used, and this matters more here than usual:

  • Which form the console compiler emits is unknown. If it reaches private memory through MUBUF and a scratch descriptor rather than scratch_*, this PR does not help those shaders.
  • The setup prologue. An LLVM-PAL-style setup (s_getpc_b64, a load from the global information table, s_setreg FLAT_SCR) run through resource::track fails with "an address from a root parameter that is no address", so programs with that prologue are still refused before they reach this code. Someone with the title's shaders can tell from victory translate --list what scratch shaders now stop at; a follow-up could skip tracking for loads whose results only feed FLAT_SCR.
  • The size. Nothing in the program metadata read so far holds a scratch size, hence the bound from the code and the 4 KiB fallback.
  • Dword accesses are taken as aligned, byte and short ones as not crossing a dword.

Tested

Windows 11, NVIDIA RTX 5070 and WARP, synthetic only. Hand-assembled 64-lane compute programs, every lane compared with values computed on the CPU, each also through dxil.dll:

  • a per-lane array written with lane-dependent values and read back with another lane's index (each lane sees its own memory);
  • x2/x3/x4 accesses through an SGPR base: in range, partly past the end, at an offset that would land on dword 0 if the index wrapped, and with a negative offset;
  • byte and short loads with sign extension and preserved D16 halves, sub-dword stores;
  • a store under a lane guard that is false for some or all lanes.

With main's lower.rs, fields.rs and bitcode.rs all four fail with Unsupported { what: "flat memory" }. Unit tests cover the size bound (exact, fallback, maximum) and generic flat staying refused.

cargo test -p victory-shader: 75 passed. Rebased onto main 8d23f07 (head e543a41): #104 moved the writer's liveness pass into Module::live, so alloca is now one arm of its operand visitor; #117's and #612's tests sit beside this PR's in emit/lower.rs. 94 passed, 1 ignored, on the RTX 5070.

The second commit (e543a41) is not part of this change. On main 8d23f07 the test target of victory-shader does not compile (issue #719): #612 gave the test helper lowers a second argument and #117's scalar_bit_tests_lower still calls it with one. The commit passes 0 there so this branch's tests can run; it goes away when main has the fix. cargo clippy -p victory-shader --all-targets: nothing new. cargo xtask policy: ok.

Does not touch fn image, fn ds, fn buffer or wave/lane code; a trial merge with #54, #160, #164, #189 and #192 is clean.

The title was not used in these tests. AI-assisted.

🤖 Generated with Claude Code

**@⁠r4tedx** on GitHub · 2026-11-24 01:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/265) `r4tedx:shader/scratch-memory` → `main` · +846 −2 · 5 files · 4 commits · closed without merging ## Measured on the title's shaders (by a tester) EduAzevedo ran `victory translate --jobs 8 --list` over the retail shaders (v1.0.2.1, 26,148 programs) on `main` `d2a4bae` and on this head `7463484`, compared program by program ([result](https://git.gtahub.st/github/Marvisak--VIctory/issues/293)): **0 programs gained, 0 programs lost.** No refusal reason changes. So this PR does not change what translates in this title today. It adds coverage and is tested on synthetic programs only; it can wait behind PRs that unblock programs the title uses. ## What `scratch_load_*` and `scratch_store_*` were refused ("flat memory"), so a program that keeps a local array with a dynamic index, or spills to memory, failed to translate and its draws or dispatches were dropped. No open PR covers private memory. - **Per-lane array.** Each lane's private memory is an `alloca` of `i32` in the entry block, as DXC makes local arrays. A FLAT scratch address (a VGPR, an SGPR or neither, plus the 12-bit signed offset) is a byte offset into the lane's own memory; the hardware interleaves the lanes itself, so no lane index enters the address (RDNA 2 ISA, "Scratch"; LLVM AMDGPUUsage, "Private Segment"; Mesa's ACO uses these instructions the same way). - **Lowered:** dword x1-x4 loads and stores, ubyte/sbyte/ushort/sshort loads, byte and short stores, and the `_d16` / `_d16_hi` forms (one half of the VGPR written, the other kept). Loads write under the lane guard; stores run under it. - **Size.** From the code: an upper bound of every scratch address from the instructions that compute it (constants through and/or/xor, shifts, adds, multiplies, selects, `bfe`, min/max), plus the access width. Where an address has no such bound (a loaded or loop-carried index) the array is 4 KiB per lane, marked as a `shortcut:`. At most 64 KiB. Accesses past the end read 0 and drop writes; the index is checked, never wrapped. - **Decoder fix.** GFX10 scratch with `saddr` 0x7F (LLVM's "ST" mode: neither address register) was read as an SGPR base of `exec_hi`; it now has none. - **Bitcode writer** gains `alloca`. Still refused, each with its reason: generic `flat_*` (the address may be private, shared or global memory), MUBUF access through a scratch descriptor (cannot be told apart from a buffer the title bound), scratch loads into LDS. ## Not verified No game files were used, and this matters more here than usual: - **Which form the console compiler emits is unknown.** If it reaches private memory through MUBUF and a scratch descriptor rather than `scratch_*`, this PR does not help those shaders. - **The setup prologue.** An LLVM-PAL-style setup (`s_getpc_b64`, a load from the global information table, `s_setreg FLAT_SCR`) run through `resource::track` fails with "an address from a root parameter that is no address", so programs with that prologue are still refused before they reach this code. Someone with the title's shaders can tell from `victory translate --list` what scratch shaders now stop at; a follow-up could skip tracking for loads whose results only feed `FLAT_SCR`. - **The size.** Nothing in the program metadata read so far holds a scratch size, hence the bound from the code and the 4 KiB fallback. - Dword accesses are taken as aligned, byte and short ones as not crossing a dword. ## Tested Windows 11, NVIDIA RTX 5070 and WARP, synthetic only. Hand-assembled 64-lane compute programs, every lane compared with values computed on the CPU, each also through `dxil.dll`: - a per-lane array written with lane-dependent values and read back with another lane's index (each lane sees its own memory); - x2/x3/x4 accesses through an SGPR base: in range, partly past the end, at an offset that would land on dword 0 if the index wrapped, and with a negative offset; - byte and short loads with sign extension and preserved D16 halves, sub-dword stores; - a store under a lane guard that is false for some or all lanes. With `main`'s `lower.rs`, `fields.rs` and `bitcode.rs` all four fail with `Unsupported { what: "flat memory" }`. Unit tests cover the size bound (exact, fallback, maximum) and generic flat staying refused. `cargo test -p victory-shader`: 75 passed. Rebased onto `main` `8d23f07` (head `e543a41`): #104 moved the writer's liveness pass into `Module::live`, so `alloca` is now one arm of its operand visitor; #117's and #612's tests sit beside this PR's in `emit/lower.rs`. 94 passed, 1 ignored, on the RTX 5070. **The second commit (`e543a41`) is not part of this change.** On `main` `8d23f07` the test target of `victory-shader` does not compile (issue #719): #612 gave the test helper `lowers` a second argument and #117's `scalar_bit_tests_lower` still calls it with one. The commit passes 0 there so this branch's tests can run; it goes away when `main` has the fix. `cargo clippy -p victory-shader --all-targets`: nothing new. `cargo xtask policy`: ok. Does not touch `fn image`, `fn ds`, `fn buffer` or wave/lane code; a trial merge with #54, #160, #164, #189 and #192 is clean. The title was not used in these tests. AI-assisted. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
scratch_load_* and scratch_store_* were refused ("flat memory"), so any
program that keeps a local array with a dynamic index, or spills to
memory, failed to translate and its draws or dispatches were dropped.

Each lane's private memory is now an alloca of i32 in the entry block, as
DXC makes local arrays. A FLAT scratch address (a VGPR, an SGPR or
neither, plus the 12-bit signed offset) is a byte offset into the lane's
own memory: the hardware interleaves the lanes' dwords itself (RDNA 2 ISA,
"Scratch"; LLVM AMDGPUUsage, "Private Segment"; Mesa ACO uses these
instructions on GFX9+ the same way), so no lane index enters the address.
Lowered: dword x1-x4 loads and stores, ubyte/sbyte/ushort/sshort loads,
byte/short stores, and the _d16 / _d16_hi forms (one half of the VGPR
written, the other kept; stores of the high half). Loads write under the
lane guard; stores run under it.

The size comes from the code: an upper bound of every scratch address
from the instructions computing it (constants through and, shifts, adds,
multiplies, selects, bfe), plus the access width. Where an address has no
such bound (a loaded or loop-carried index) the array is 4 KiB per lane,
marked as a shortcut: the program metadata read so far holds no scratch
size. At most 64 KiB, the D3D11 limit of indexable temporaries. Accesses
past the end read 0 and drop writes; the index is checked, never wrapped.

The decoder read GFX10 scratch with saddr 0x7F (EXEC_HI, LLVM's "ST" mode:
neither address register) as an SGPR base of exec_hi; it now has none.
The bitcode writer gains alloca (INST_ALLOCA, explicit type).

Still refused: generic flat_* (an aperture address that may be private,
shared or global memory), MUBUF access through a scratch descriptor (not
told apart from a buffer the title bound), and scratch loads into LDS.

Tests (emit/scratch_tests.rs) run hand-assembled 64-lane compute programs
on the hardware GPU and WARP and compare every lane with values computed
on the CPU: a per-lane array indexed by another lane's index, x2/x3/x4
accesses through an SGPR base partly and wholly out of range and with a
wrapping offset, byte and short loads with sign extension and D16 halves,
sub-dword stores, and a store under a lane guard false for some or all
lanes. Each program also passes dxil.dll validation. Unit tests cover the
size bound and generic flat memory staying refused. On main every GPU test
fails in lower with "flat memory".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On main at 8d23f07 the test target of victory-shader does not compile:
#612 gave the test helper `lowers` a second argument (rsrc2) and #117's
`scalar_bit_tests_lower`, merged beside it, still calls it with one. The
call passes 0, as the helper's other callers without group ids do.

Not part of the scratch-memory change; it is here so this branch's tests
can run. Drop it when main has the same fix.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:57:11 +00:00
github-bot closed this pull request 2026-11-26 03:57:11 +00:00
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 03:15 UTC · original

A limit of this PR, confirmed by a probe while reviewing the open shader PRs with the same scrutiny (RTX 5070): when a scratch address cannot be bounded from the code, the per-lane array is 4 KiB, and accesses past it read 0 and drop writes. A store and load of 37 through a run-time address of 8192 returns 0, although a program with a larger scratch allocation would be within its bounds there (the RDNA 2 ISA bounds scratch by the allocation's size). The description says the size is a shortcut:; this is what it looks like when it is hit. Nothing in the program metadata read so far gives the real size. If a tester sees shaders with large or unbounded scratch indices (victory shader-info on a shader that uses scratch_* with a loaded or loop-carried index), raising the fallback or finding the size in the metadata is the follow-up.

From synthetic probes only; I have no copy of the title.

**@⁠r4tedx** on GitHub · 2026-11-24 03:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/265#issuecomment-7120914314) A limit of this PR, confirmed by a probe while reviewing the open shader PRs with the same scrutiny (RTX 5070): when a scratch address cannot be bounded from the code, the per-lane array is 4 KiB, and accesses past it read 0 and drop writes. A store and load of 37 through a run-time address of 8192 returns 0, although a program with a larger scratch allocation would be within its bounds there (the RDNA 2 ISA bounds scratch by the allocation's size). The description says the size is a `shortcut:`; this is what it looks like when it is hit. Nothing in the program metadata read so far gives the real size. If a tester sees shaders with large or unbounded scratch indices (`victory shader-info` on a shader that uses `scratch_*` with a loaded or loop-carried index), raising the fallback or finding the size in the metadata is the follow-up. From synthetic probes only; I have no copy of the title.
Author
Owner

@⁠DeerSilver on GitHub · 2026-11-24 11:01 UTC · original

Tested head e543a41 merged onto main ffe310e on NVIDIA GeForce RTX 5060 Laptop GPU (Blackwell), driver 621.24, Windows 11 26300, Rust 1.98.1. No game files: the test suite only.

Merged onto current main, the test build fails. 6638098 ("per-lane descriptors chosen by control flow", merged with #566 at 09:53) added a fourth argument to resource::track:

error[E0061]: this function takes 4 arguments but 3 arguments were supplied
  --> crates/victory-shader/src/emit/scratch_tests.rs (new in this PR)
   |     resource::track(&p, &native.layout, native.stage)
   |     argument #4 of type `Option<&structure::Structured>` is missing

There's no text conflict, so GitHub still shows the PR as mergeable, but merging it as it is would break cargo test on main. The call this PR adds needs the fourth argument. main's own tests pass Some(&st); None keeps the old three-argument behaviour.

With , None added locally to that call, everything passes:

  • The PR's new tests pass. The ones that use the host GPU ran on the RTX 5060 (DXGI adapter 0 on this laptop, so the host-device helpers return a device and the tests don't take their early return), and the log has no no SM 6.6 device skip:
    • private_memory_is_as_large_as_its_addresses_reach
    • generic_flat_memory_is_refused
    • a_private_array_is_per_lane_and_dynamically_indexed
    • wide_accesses_through_an_sgpr_base_and_out_of_range
    • bytes_and_shorts_extend_and_keep_the_other_half
    • a_store_in_lanes_off_does_not_happen
  • cargo test --workspace --locked: 348 passed, 0 failed, 6 ignored, against 342 passed / 6 ignored on main.
  • cargo clippy --workspace --all-targets --locked -- -D warnings: clean.

AI-assisted (Claude Code).

**@⁠DeerSilver** on GitHub · 2026-11-24 11:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/265#issuecomment-7129558698) Tested head `e543a41` merged onto `main` `ffe310e` on **NVIDIA GeForce RTX 5060 Laptop GPU** (Blackwell), driver 621.24, Windows 11 26300, Rust 1.98.1. No game files: the test suite only. **Merged onto current `main`, the test build fails.** `6638098` ("per-lane descriptors chosen by control flow", merged with #566 at 09:53) added a fourth argument to `resource::track`: ``` error[E0061]: this function takes 4 arguments but 3 arguments were supplied --> crates/victory-shader/src/emit/scratch_tests.rs (new in this PR) | resource::track(&p, &native.layout, native.stage) | argument #4 of type `Option<&structure::Structured>` is missing ``` There's no text conflict, so GitHub still shows the PR as mergeable, but merging it as it is would break `cargo test` on `main`. The call this PR adds needs the fourth argument. `main`'s own tests pass `Some(&st)`; `None` keeps the old three-argument behaviour. **With `, None` added locally to that call**, everything passes: - The PR's new tests pass. The ones that use the host GPU ran on the RTX 5060 (DXGI adapter 0 on this laptop, so the host-device helpers return a device and the tests don't take their early return), and the log has no `no SM 6.6 device` skip: - `private_memory_is_as_large_as_its_addresses_reach` - `generic_flat_memory_is_refused` - `a_private_array_is_per_lane_and_dynamically_indexed` - `wide_accesses_through_an_sgpr_base_and_out_of_range` - `bytes_and_shorts_extend_and_keep_the_other_half` - `a_store_in_lanes_off_does_not_happen` - `cargo test --workspace --locked`: **348 passed, 0 failed, 6 ignored**, against 342 passed / 6 ignored on `main`. - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean. AI-assisted (Claude Code).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 11:11 UTC · original

The test-build issue reported on #164 also affected this branch. Fixed at 1e923c9 against main at ffe310e. The scratch test helper now passes its structured program to descriptor tracking. Local Windows checks passed: 348 workspace tests, 6 ignored, and all-target, all-feature Clippy with warnings denied. The 4 KiB fallback for unbounded scratch indices is still in effect.

AI-assisted (Codex).

**@⁠r4tedx** on GitHub · 2026-11-24 11:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/265#issuecomment-7129778339) The test-build issue reported on #164 also affected this branch. Fixed at `1e923c9` against `main` at `ffe310e`. The scratch test helper now passes its structured program to descriptor tracking. Local Windows checks passed: 348 workspace tests, 6 ignored, and all-target, all-feature Clippy with warnings denied. The 4 KiB fallback for unbounded scratch indices is still in effect. AI-assisted (Codex).
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 11:17 UTC · original

CI exited with 0xc0000005 in the shader test process on 1e923c9. The scratch tests could dispatch on WARP concurrently with the VALU and waterfall suites. At d9c04c6 they acquire the same device lock as both suites. The change is confined to the test harness.

Local verification: three consecutive runs of the full shader library suite with VICTORY_WARP=1 (126 passed, 1 ignored each). The full workspace passed with the default adapter selection, and both CI Clippy configurations passed. The hosted check on the new head is pending.

AI-assisted (Codex).

**@⁠r4tedx** on GitHub · 2026-11-24 11:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/265#issuecomment-7129908120) CI exited with `0xc0000005` in the shader test process on `1e923c9`. The scratch tests could dispatch on WARP concurrently with the VALU and waterfall suites. At `d9c04c6` they acquire the same device lock as both suites. The change is confined to the test harness. Local verification: three consecutive runs of the full shader library suite with `VICTORY_WARP=1` (126 passed, 1 ignored each). The full workspace passed with the default adapter selection, and both CI Clippy configurations passed. The hosted check on the new head is pending. AI-assisted (Codex).
Author
Owner

@⁠DeerSilver on GitHub · 2026-11-24 14:04 UTC · original

Re-tested the new head 964e3ad merged onto main ffe310e (clean merge) on NVIDIA GeForce RTX 5060 Laptop GPU (Blackwell), driver 621.24, Windows 11 26300, Rust 1.98.1. No game files: the test suite only. Pass, with no local change: scratch_tests.rs now passes the fourth resource::track argument, so the build break I reported earlier is gone.

  • The six new tests ran on the RTX 5060 (DXGI adapter 0 on this laptop), and the log has no no SM 6.6 device skip:
    • private_memory_is_as_large_as_its_addresses_reach
    • generic_flat_memory_is_refused
    • a_private_array_is_per_lane_and_dynamically_indexed
    • wide_accesses_through_an_sgpr_base_and_out_of_range
    • bytes_and_shorts_extend_and_keep_the_other_half
    • a_store_in_lanes_off_does_not_happen
  • cargo test --workspace --locked: 348 passed, 0 failed, 6 ignored, against 342 / 6 on main.
  • cargo clippy --workspace --all-targets --locked -- -D warnings: clean.

AI-assisted (Claude Code).

**@⁠DeerSilver** on GitHub · 2026-11-24 14:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/265#issuecomment-7133796623) Re-tested the new head `964e3ad` merged onto `main` `ffe310e` (clean merge) on **NVIDIA GeForce RTX 5060 Laptop GPU** (Blackwell), driver 621.24, Windows 11 26300, Rust 1.98.1. No game files: the test suite only. **Pass**, with no local change: `scratch_tests.rs` now passes the fourth `resource::track` argument, so the build break I reported earlier is gone. - The six new tests ran on the RTX 5060 (DXGI adapter 0 on this laptop), and the log has no `no SM 6.6 device` skip: - `private_memory_is_as_large_as_its_addresses_reach` - `generic_flat_memory_is_refused` - `a_private_array_is_per_lane_and_dynamically_indexed` - `wide_accesses_through_an_sgpr_base_and_out_of_range` - `bytes_and_shorts_extend_and_keep_the_other_half` - `a_store_in_lanes_off_does_not_happen` - `cargo test --workspace --locked`: **348 passed, 0 failed, 6 ignored**, against 342 / 6 on `main`. - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean. AI-assisted (Claude Code).
Author
Owner

@⁠Yaekai on GitHub · 2026-11-24 16:21 UTC · original

Independent verification on Windows 11 + NVIDIA RTX 3070 (Ampere, Wave32, Rust 1.98.1) at head 964e3ad:

  • cargo test -p victory-shader --lib -- --skip valu_tests --skip waterfall_tests --skip scratch_tests: 104 passed, 0 failed.
  • cargo test -p victory-shader --lib scratch_tests: 4 passed, 0 failed on live D3D12/WARP (bytes_and_shorts_extend_and_keep_the_other_half, a_private_array_is_per_lane_and_dynamically_indexed, wide_accesses_through_an_sgpr_base_and_out_of_range, a_store_in_lanes_off_does_not_happen).
  • cargo clippy -p victory-shader -- -D warnings: 0 warnings.
  • Live GTA VI (1.0.2.1, --console series-s, 19-min world run): no regressions. Ready to merge!
**@⁠Yaekai** on GitHub · 2026-11-24 16:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/265#issuecomment-7137536108) Independent verification on Windows 11 + NVIDIA RTX 3070 (Ampere, Wave32, Rust 1.98.1) at head `964e3ad`: - `cargo test -p victory-shader --lib -- --skip valu_tests --skip waterfall_tests --skip scratch_tests`: 104 passed, 0 failed. - `cargo test -p victory-shader --lib scratch_tests`: **4 passed, 0 failed** on live D3D12/WARP (`bytes_and_shorts_extend_and_keep_the_other_half`, `a_private_array_is_per_lane_and_dynamically_indexed`, `wide_accesses_through_an_sgpr_base_and_out_of_range`, `a_store_in_lanes_off_does_not_happen`). - `cargo clippy -p victory-shader -- -D warnings`: 0 warnings. - Live GTA VI (`1.0.2.1`, `--console series-s`, 19-min world run): no regressions. Ready to merge!
Author
Owner

@⁠465d6a0eac on GitHub · 2026-11-24 17:02 UTC · original · edited 2026-11-24 17:20 UTC

Thank you for this, @⁠r4tedx! Many pull requests here are still waiting to be merged, so I've ported this one to 465d6a0eac/AgentRecompVI, a VIctory fork where AI agents review and merge each other's work: https://github.com/465d6a0eac/AgentRecompVI/pull/34. You're credited as the author there. This pull request stays the original.

Test results

  • Windows 11, NVIDIA GeForce RTX 3070 Ti (driver 32.0.16.1088, 32-lane waves): together with #320/#439, #492 and #1019, cargo clippy (both variants) and cargo test --workspace pass (407 passed, 0 failed), including the five scratch tests. One fix was needed to build it on top of #233/#439: its test now fills the target, console_cf and per_lane_only fields of lower::Parts.
  • With it in, the title boots and runs its menus at 30 fps on that machine, through the intro video, first-boot settings and legal screens up to the terms screen. I haven't reached the world yet.
**@⁠465d6a0eac** on GitHub · 2026-11-24 17:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/265#issuecomment-7138598168) · edited 2026-11-24 17:20 UTC Thank you for this, @⁠r4tedx! Many pull requests here are still waiting to be merged, so I've ported this one to [465d6a0eac/AgentRecompVI](https://github.com/465d6a0eac/AgentRecompVI), a VIctory fork where AI agents review and merge each other's work: https://github.com/465d6a0eac/AgentRecompVI/pull/34. You're credited as the author there. This pull request stays the original. **Test results** - Windows 11, NVIDIA GeForce RTX 3070 Ti (driver 32.0.16.1088, 32-lane waves): together with #320/#439, #492 and #1019, `cargo clippy` (both variants) and `cargo test --workspace` pass (407 passed, 0 failed), including the five scratch tests. One fix was needed to build it on top of #233/#439: its test now fills the `target`, `console_cf` and `per_lane_only` fields of `lower::Parts`. - With it in, the title boots and runs its menus at 30 fps on that machine, through the intro video, first-boot settings and legal screens up to the terms screen. I haven't reached the world yet.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:24 UTC · original

Automated triage for the maintainers.

Needs rebase. This PR does not merge cleanly into current main (ac2525d). Conflicting files: crates/victory-shader/src/emit/lower.rs, crates/victory-shader/src/emit/mod.rs.

The content has not been reviewed yet; it will be once the branch is rebased onto main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/265#issuecomment-7148480860) <!-- victory-triage v1 head=964e3adc6a62920e435b63508fbb735f1fac7abf verdict=needs-rebase at=2026-11-25T00:13:20Z --> Automated triage for the maintainers. **Needs rebase.** This PR does not merge cleanly into current `main` (ac2525d). Conflicting files: `crates/victory-shader/src/emit/lower.rs`, `crates/victory-shader/src/emit/mod.rs`. The content has not been reviewed yet; it will be once the branch is rebased onto `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠r4tedx on GitHub · 2026-11-25 04:38 UTC · original

Closing this. The change is not wrong; this title does not use it, and bringing it up to main (319 commits on, conflicting in emit/lower.rs and emit/mod.rs) would clear no program.

The numbers. Local title data (v1.0.2.1, the main shader archive), offline, CPU only; counts and reasons only.

  • One disassembly pass by main's own binary at 940d32f (shader-info --disasm) over the archive's 26,503 shader containers: none holds a scratch_load_* or scratch_store_* instruction. All 26,084 programs in it decode, so the pass sees every instruction.
  • The offline count on main 940d32f (translate --validate --list, 25,889 programs counted): 23,918 validate; the translator refuses 298, under 10 reasons. None is "flat memory" and none names private memory.
  • That agrees with EduAzevedo's measurement on an older main: 0 gained, 0 lost.

Limits. The pass covers that one archive, not shaders anywhere else in the title, and it looked for the FLAT scratch_* forms this PR lowers (not the scalar s_scratch_* ones, which this PR does not lower either).

main still refuses these instructions (Fields::Flat => Err("flat memory") in emit/lower.rs), so the code is coverage for a program that keeps a local array or spills to memory. The branch shader/scratch-memory stays on the fork at 964e3ad; if such a program turns up, in this title or another, I will reopen this on current main.

Thank you @⁠DeerSilver and @⁠Yaekai for the runs on 964e3ad (RTX 5060 Laptop, RTX 3070), and @⁠EduAzevedo for the count that first showed it gains nothing here.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-25 04:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/265#issuecomment-7153027904) Closing this. The change is not wrong; this title does not use it, and bringing it up to `main` (319 commits on, conflicting in `emit/lower.rs` and `emit/mod.rs`) would clear no program. **The numbers.** Local title data (v1.0.2.1, the main shader archive), offline, CPU only; counts and reasons only. - One disassembly pass by `main`'s own binary at `940d32f` (`shader-info --disasm`) over the archive's 26,503 shader containers: **none holds a `scratch_load_*` or `scratch_store_*` instruction.** All 26,084 programs in it decode, so the pass sees every instruction. - The offline count on `main` `940d32f` (`translate --validate --list`, 25,889 programs counted): 23,918 validate; the translator refuses 298, under 10 reasons. None is "flat memory" and none names private memory. - That agrees with EduAzevedo's measurement on an older `main`: 0 gained, 0 lost. **Limits.** The pass covers that one archive, not shaders anywhere else in the title, and it looked for the FLAT `scratch_*` forms this PR lowers (not the scalar `s_scratch_*` ones, which this PR does not lower either). `main` still refuses these instructions (`Fields::Flat => Err("flat memory")` in `emit/lower.rs`), so the code is coverage for a program that keeps a local array or spills to memory. The branch `shader/scratch-memory` stays on the fork at `964e3ad`; if such a program turns up, in this title or another, I will reopen this on current `main`. Thank you @⁠DeerSilver and @⁠Yaekai for the runs on `964e3ad` (RTX 5060 Laptop, RTX 3070), and @⁠EduAzevedo for the count that first showed it gains nothing here. AI-assisted

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!265
No description provided.