Shaders: LDS byte and half accesses #571

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

@⁠SAitken91 on GitHub · 2026-11-24 05:08 UTC · original
SAitken91:shader/lds-bytes-halves → main · +304 −4 · 2 files · 5 commits · closed without merging

ds_read_{u8,i8,u16,i16} and ds_write_{b8,b16}, with their _d16/_d16_hi forms, were refused ("an LDS read/write of bytes or halves"). That blocked 16 compute programs in shaders.rpf, mostly compute_graph_ops reductions and transposes.

Change

LDS is an array of dwords in the translation, so these accesses now work on the dword holding them, at bit 8 * (address & 3). They are naturally aligned, so they never straddle two dwords.

  • Reads shift and mask, or sign-extend for i8/i16. _d16 fills the register's low half and _d16_hi its high half, keeping the other half.
  • Writes clear the bits with an atomic and, then set them with an atomic or. Lanes writing other bytes of the same dword therefore keep their values, and as on the console, two lanes writing the same byte race. _d16_hi takes the data's high half.

Results

victory translate --validate shaders.rpf: compute validated 1670 → 1686 (all 16). Both errors are gone from the list.

Testing

  • cargo test -p victory-shader: 69 passed. Clippy and rustfmt are clean.
  • Not exercised at runtime.

This is independent of #539, #554, #563, #565 and #569.

Written with the help of Claude (AI).

🤖 Generated with Claude Code

**@⁠SAitken91** on GitHub · 2026-11-24 05:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/571) `SAitken91:shader/lds-bytes-halves` → `main` · +304 −4 · 2 files · 5 commits · closed without merging `ds_read_{u8,i8,u16,i16}` and `ds_write_{b8,b16}`, with their `_d16`/`_d16_hi` forms, were refused ("an LDS read/write of bytes or halves"). That blocked 16 compute programs in shaders.rpf, mostly `compute_graph_ops` reductions and transposes. ## Change LDS is an array of dwords in the translation, so these accesses now work on the dword holding them, at bit `8 * (address & 3)`. They are naturally aligned, so they never straddle two dwords. - **Reads** shift and mask, or sign-extend for i8/i16. `_d16` fills the register's low half and `_d16_hi` its high half, keeping the other half. - **Writes** clear the bits with an atomic and, then set them with an atomic or. Lanes writing other bytes of the same dword therefore keep their values, and as on the console, two lanes writing the same byte race. `_d16_hi` takes the data's high half. ## Results `victory translate --validate shaders.rpf`: compute validated 1670 → 1686 (all 16). Both errors are gone from the list. ## Testing - `cargo test -p victory-shader`: 69 passed. Clippy and rustfmt are clean. - Not exercised at runtime. This is independent of #539, #554, #563, #565 and #569. Written with the help of Claude (AI). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ds_read_{u8,i8,u16,i16} and ds_write_{b8,b16} were refused ("an LDS
read/write of bytes or halves"), with their _d16/_d16_hi forms. LDS is
an array of dwords here; such an access now works on the dword holding
it, at bit 8 * (address & 3):

- reads shift and mask, or sign-extend the i8/i16 forms; _d16 fills the
  register's low half (_d16_hi its high half) and keeps the other;
- writes clear the bits with an atomic and, then set them with an
  atomic or, so lanes writing other bytes of the same dword keep
  theirs; _d16_hi takes the data's high half.

translate --validate on shaders.rpf: compute 1670 -> 1686 validated;
both errors are gone from the list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A 16-bit LDS access at byte 3 of a dword was taken as aligned: a read
returned only the dword's last byte (Dathinel's readback on #571:
0x0082 for the reference 0x9882) and a write would have lost its high
byte. The next dword now joins in, as native RDNA2 reads an odd-address
ds_read_u16: reads shift the two dwords as one 64-bit value, writes
clear and set bits in both (no-ops on the next dword when nothing
straddles). The next index is clamped to the last LDS dword.

translate --validate on shaders.rpf unchanged (compute 1686 validated
with this PR).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexander-src's #571 review: when a 16-bit access sits at byte 3 of the
final LDS dword, the clamped "next dword" is that same dword, so a read
took byte 0 as its high byte and a write overwrote byte 0. The next
dword's part is now dropped there: a read sees 0 in its high byte, and
the write's mask and data for the next dword are 0, as out-of-bounds
LDS accesses read 0 and drop writes.

translate --validate on shaders.rpf unchanged (CS 1686 on d2a4bae).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewers asked for tests that run the new LDS lowering (#571). Three
host-execution tests in valu_tests, on a 1-thread compute program with
512 bytes of LDS, compared with the RDNA2 results:

- byte, half and dword writes to one dword keep each other's bytes;
- a half read and a half write at byte 3 straddle into the next dword
  (the read fails on 6e981fb, the head before d27cb78: 0x44 for 0x5544);
- ds_read_i8 sign-extends, ds_read_u16_d16_hi fills the high half and
  keeps the low half.

build_cs takes the program's RSRC2 (for the LDS size); build_valu_cs
keeps its programs. WARP refuses to create pipelines for this harness's
programs that declare group shared memory (even plain dword accesses),
so these tests skip WARP when it does; they ran on an RX 6950 XT.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
adamdotpy asked (#571) for a case where the destination of a
ds_read_u16_d16_hi is neither the data nor the address register. v6 is
loaded from v4 first; the read fills v6's high half from LDS and keeps
its own low half (ir.rs makes every VGPR write also read the old value).
Passes on an RX 6950 XT; WARP refuses group-shared programs here.

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

@⁠KoLolX3 on GitHub · 2026-11-24 05:31 UTC · original

Check on Linux, not Windows: pass. Head 6e981fb26 merged onto main d2a4bae1f (clean merge).

  • Native tests of the seven crates that build on Linux (core, formats, game, loader, pe, pipeline, shader): PR 92 passed, 7 failed, main 92 passed, 7 failed.
  • Windows cross type-check of the whole workspace (cargo xwin check --workspace --target x86_64-pc-windows-msvc, covers victory-gpu, victory-hle and the app): PR ok, main ok.
  • Tests this PR adds: 0 (so the native result only shows the existing tests still pass; the change itself is not covered by a test here).
  • rustfmt: unformatted hunks, PR 168, main 168.
  • Failing on main here as well (not this PR): 7 tests in victory-loader and victory-pe that parse their own test binary as a PE image, which is an ELF file on Linux.
  • Not run: victory-gpu / victory-hle tests and the game itself.

On: AMD Ryzen 7 5700, 62 GB RAM, Artix Linux 7.3.4-artix1-2, rustc 1.98.1 (the repo's pinned toolchain), cargo-xwin 0.24.1. No game data. Automated check only: the code itself was not reviewed.

**@⁠KoLolX3** on GitHub · 2026-11-24 05:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/571#issuecomment-7123027574) Check on Linux, not Windows: **pass**. Head `6e981fb26` merged onto `main` `d2a4bae1f` (clean merge). - Native tests of the seven crates that build on Linux (`core`, `formats`, `game`, `loader`, `pe`, `pipeline`, `shader`): PR `92 passed, 7 failed`, `main` `92 passed, 7 failed`. - Windows cross type-check of the whole workspace (`cargo xwin check --workspace --target x86_64-pc-windows-msvc`, covers `victory-gpu`, `victory-hle` and the app): PR ok, `main` ok. - Tests this PR adds: 0 (so the native result only shows the existing tests still pass; the change itself is not covered by a test here). - rustfmt: unformatted hunks, PR 168, `main` 168. - Failing on `main` here as well (not this PR): 7 tests in `victory-loader` and `victory-pe` that parse their own test binary as a PE image, which is an ELF file on Linux. - Not run: `victory-gpu` / `victory-hle` tests and the game itself. On: AMD Ryzen 7 5700, 62 GB RAM, Artix Linux 7.3.4-artix1-2, rustc 1.98.1 (the repo's pinned toolchain), cargo-xwin 0.24.1. No game data. Automated check only: the code itself was not reviewed.
Author
Owner

@⁠ghost on GitHub · 2026-11-24 05:50 UTC · original

Review note on head 6e981fb: for ds_read_*_d16 / _d16_hi, crates/victory-shader/src/emit/lower.rs:2135 keeps the destination's other half by reading its old value with inst.read(Reg::V(reg)), and falls back to 0 when that is None.

On main, ir.rs effects() (the Fields::Ds arm, around line 842) adds a ds_read destination only to the written registers, and Inst::read only searches the read list. So for these reads inst.read is always None and the kept half is always zeroed: a _d16 read clears the high 16 bits, a _d16_hi read clears the low 16.

#116 fixes this in effects():

if name.starts_with("ds_read") && name.contains("_d16") {
    regs(d, &mut r)?;
}

This PR would need the same, plus a test that writes a known value to the destination first and checks the other half survives.

Read-only review, nothing built. AI-assisted (Claude Code); the claim above was checked against this head and main at d2a4bae. Context: the triage in #366.

**@⁠ghost** on GitHub · 2026-11-24 05:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/571#issuecomment-7123332016) Review note on head `6e981fb`: for `ds_read_*_d16` / `_d16_hi`, `crates/victory-shader/src/emit/lower.rs:2135` keeps the destination's other half by reading its old value with `inst.read(Reg::V(reg))`, and falls back to 0 when that is `None`. On `main`, `ir.rs` `effects()` (the `Fields::Ds` arm, around line 842) adds a `ds_read` destination only to the written registers, and `Inst::read` only searches the read list. So for these reads `inst.read` is always `None` and the kept half is always zeroed: a `_d16` read clears the high 16 bits, a `_d16_hi` read clears the low 16. #116 fixes this in `effects()`: ```rust if name.starts_with("ds_read") && name.contains("_d16") { regs(d, &mut r)?; } ``` This PR would need the same, plus a test that writes a known value to the destination first and checks the other half survives. _Read-only review, nothing built. AI-assisted (Claude Code); the claim above was checked against this head and `main` at `d2a4bae`. Context: the triage in #366._
Author
Owner

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

Tested offline against main d2a4bae with victory translate --list --validate over the title's shaders.rpf + executable (26,096 programs), dxil.dll 1.9.2602.17:

  • Translation failures: 3,733 on main -> 3,717 with this PR (-16, all compute). "an LDS write of bytes or halves" (9) and "an LDS read of bytes or halves" (7) disappear; compute validated 1,670 -> 1,686, matching your numbers.
  • Validation: 185 modules rejected on both; no program that validated on main fails now.

AI-assisted.

**@⁠iurysf** on GitHub · 2026-11-24 06:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/571#issuecomment-7123774639) Tested offline against main `d2a4bae` with `victory translate --list --validate` over the title's `shaders.rpf` + executable (26,096 programs), dxil.dll 1.9.2602.17: - Translation failures: 3,733 on main -> 3,717 with this PR (-16, all compute). "an LDS write of bytes or halves" (9) and "an LDS read of bytes or halves" (7) disappear; compute validated 1,670 -> 1,686, matching your numbers. - Validation: 185 modules rejected on both; no program that validated on main fails now. AI-assisted.
Author
Owner

@⁠Dathinel on GitHub · 2026-11-24 06:54 UTC · original · edited 2026-11-24 07:09 UTC

Follow-up: the translated readback is now available. Claude Code ran the test on our Windows 11 machine using #571 at 6e981fb2 on base d2a4bae1 (test merge 16b4d6a). On both RTX 3050 Laptop and WARP, all 64 lanes agreed. With the first fixture the aligned value was 0x8281, but the crossing read returned 0x0082 (little-endian two-byte reference 0x9882). With complemented inputs, the aligned value was 0x7d7e and the crossing read was 0x007d (reference 0x677d). Both crossing results retained just the last byte of the first dword. This supplies the requested host measurement; the console alignment mode remains unknown.

One remaining distinction is a halfword read across a dword boundary. In the native RDNA2 experiment on #116, an odd-address ds_read_u16 read the two bytes at that address in the tested desktop HIP mode. Our translated readbacks used aligned halfwords.

If anyone already has this PR built on Windows with D3D12, could you report the translated result for one aligned control and one crossing read? In the synthetic test module, inside byte_and_halfword_reads, keep only the ds_read_u16 entry and replace for at in addresses(name) with for at in [0u32, 1]. The instruction adds 2. For the first fixture the effective byte addresses are 2 and 3, both inside the eight initialized bytes. The little-endian reference values are 0x8281 and 0x9882.

The setup and Cargo command are here. Filter on emit::vic13_lds::byte_and_halfword_reads to run just this test. The PR SHA, adapter, and result (or first assertion showing actual/expected) are enough. This would tell us how the translation compares with that measured desktop mode. The console's alignment mode remains an open question. AI-assisted.

**@⁠Dathinel** on GitHub · 2026-11-24 06:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/571#issuecomment-7124415281) · edited 2026-11-24 07:09 UTC **Follow-up: the translated readback is now available.** Claude Code ran the test on our Windows 11 machine using #571 at `6e981fb2` on base `d2a4bae1` (test merge `16b4d6a`). On both RTX 3050 Laptop and WARP, all 64 lanes agreed. With the first fixture the aligned value was `0x8281`, but the crossing read returned `0x0082` (little-endian two-byte reference `0x9882`). With complemented inputs, the aligned value was `0x7d7e` and the crossing read was `0x007d` (reference `0x677d`). Both crossing results retained just the last byte of the first dword. This supplies the requested host measurement; the console alignment mode remains unknown. One remaining distinction is a halfword read across a dword boundary. In the [native RDNA2 experiment on #116](https://git.gtahub.st/github/Marvisak--VIctory/pulls/116), an odd-address `ds_read_u16` read the two bytes at that address in the tested desktop HIP mode. Our translated readbacks used aligned halfwords. If anyone already has this PR built on Windows with D3D12, could you report the translated result for one aligned control and one crossing read? In the [synthetic test module](https://github.com/Dathinel/VIctory/blob/208982b90db37a7ff885d0c432e1172ca8669906/crates/victory-shader/src/emit/vic13_lds.rs), inside `byte_and_halfword_reads`, keep only the `ds_read_u16` entry and replace `for at in addresses(name)` with `for at in [0u32, 1]`. The instruction adds 2. For the first fixture the effective byte addresses are 2 and 3, both inside the eight initialized bytes. The little-endian reference values are `0x8281` and `0x9882`. The [setup and Cargo command are here](https://git.gtahub.st/github/Marvisak--VIctory/issues/366). Filter on `emit::vic13_lds::byte_and_halfword_reads` to run just this test. The PR SHA, adapter, and result (or first assertion showing actual/expected) are enough. This would tell us how the translation compares with that measured desktop mode. The console's alignment mode remains an open question. AI-assisted.
Author
Owner

@⁠SAitken91 on GitHub · 2026-11-24 07:40 UTC · original

@⁠TrashTalker3460 thanks for the careful read. I checked it on this head: ir.rs already makes every VGPR write also read the register's old value (effects(), the if vector block: "Lanes disabled in EXEC keep the old value"), and DS instructions take that path, so inst.read(Reg::V(reg)) is Some for ds_read_u16_d16 / _d16_hi. A quick IR test (ds_read_u16_d16 v2 / _d16_hi v3) passes without the effects() change, so the kept half isn't zeroed here. Happy to add that test if it's useful.

@⁠Dathinel thanks for the readback — that one was a real gap: I had assumed halves never straddle. Pushed d27cb78: a 16-bit access at byte 3 now uses the next dword too (reads shift the two dwords as one 64-bit value; writes clear and set bits in both, no-ops on the next dword when nothing straddles; the next index is clamped to the last LDS dword). It matches the odd-address ds_read_u16 behaviour measured on native RDNA2; the console's alignment mode is still an open question. Validation is unchanged (compute 1686). If you can rerun your crossing fixture on d27cb78, the expected values would be 0x9882 / 0x677d.

**@⁠SAitken91** on GitHub · 2026-11-24 07:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/571#issuecomment-7125241279) @⁠TrashTalker3460 thanks for the careful read. I checked it on this head: `ir.rs` already makes every VGPR write also read the register's old value (`effects()`, the `if vector` block: "Lanes disabled in EXEC keep the old value"), and DS instructions take that path, so `inst.read(Reg::V(reg))` is `Some` for `ds_read_u16_d16` / `_d16_hi`. A quick IR test (`ds_read_u16_d16 v2` / `_d16_hi v3`) passes without the `effects()` change, so the kept half isn't zeroed here. Happy to add that test if it's useful. @⁠Dathinel thanks for the readback — that one was a real gap: I had assumed halves never straddle. Pushed d27cb78: a 16-bit access at byte 3 now uses the next dword too (reads shift the two dwords as one 64-bit value; writes clear and set bits in both, no-ops on the next dword when nothing straddles; the next index is clamped to the last LDS dword). It matches the odd-address `ds_read_u16` behaviour measured on native RDNA2; the console's alignment mode is still an open question. Validation is unchanged (compute 1686). If you can rerun your crossing fixture on d27cb78, the expected values would be `0x9882` / `0x677d`.
Author
Owner

@⁠Dathinel on GitHub · 2026-11-24 07:47 UTC · original

Confirmed on your exact head d27cb78960ed. The same ds_read_u16 fixture now returns 0x9882 and 0x677d at byte 3, on both the RTX 3050 Laptop and WARP. On 6e981fb2 the corresponding results were 0x0082 and 0x007d. The aligned control at byte 2 still returns 0x8281 and 0x7d7e. All 64 lanes agreed in every dispatch.

I reran cargo test --frozen -p victory-shader --features host --lib emit::vic13_lds::byte_and_halfword_reads -- --exact --nocapture with the same synthetic module on Windows 11. This verifies the crossing read against the measured desktop RDNA2 behavior. Thanks for fixing it. AI-assisted.

**@⁠Dathinel** on GitHub · 2026-11-24 07:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/571#issuecomment-7125376868) Confirmed on your exact head `d27cb78960ed`. The same `ds_read_u16` fixture now returns **`0x9882` and `0x677d`** at byte 3, on both the RTX 3050 Laptop and WARP. On `6e981fb2` the corresponding results were `0x0082` and `0x007d`. The aligned control at byte 2 still returns `0x8281` and `0x7d7e`. All 64 lanes agreed in every dispatch. I reran `cargo test --frozen -p victory-shader --features host --lib emit::vic13_lds::byte_and_halfword_reads -- --exact --nocapture` with the same synthetic module on Windows 11. This verifies the crossing **read** against the measured desktop RDNA2 behavior. Thanks for fixing it. AI-assisted.
Author
Owner

@⁠slint6614-dev on GitHub · 2026-11-24 09:24 UTC · original

Measured on the full retail shader pack (26,503 containers) with victory translate --validate --pipelines (pipelines created on an AMD RX 9070, Windows 11, dxil.dll from SDK 10.0.26100). Counts are emitted / validated / pipelines. This PR was merged locally with current main c7a5f49 first (main: VS/PS 12224 / 12148, CS 1440 / 1417, MS 8163 / 8101; it includes #612).

CS 1456 / 1433 (+16 validated): all 7 "LDS read of bytes or halves" and 9 "LDS write of bytes or halves" refusals are gone, and the 16 programs validate. VS/PS and MS unchanged. Same result as #101 on the same pack.

**@⁠slint6614-dev** on GitHub · 2026-11-24 09:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/571#issuecomment-7127368881) Measured on the full retail shader pack (26,503 containers) with `victory translate --validate --pipelines` (pipelines created on an AMD RX 9070, Windows 11, dxil.dll from SDK 10.0.26100). Counts are emitted / validated / pipelines. This PR was merged locally with current main c7a5f49 first (main: VS/PS 12224 / 12148, CS 1440 / 1417, MS 8163 / 8101; it includes #612). CS 1456 / **1433** (+16 validated): all 7 "LDS read of bytes or halves" and 9 "LDS write of bytes or halves" refusals are gone, and the 16 programs validate. VS/PS and MS unchanged. Same result as #101 on the same pack.
Author
Owner

@⁠akimfomin on GitHub · 2026-11-24 10:01 UTC · original · edited 2026-11-24 10:02 UTC

I reran two focused LDS regressions on d27cb78960ed using synthetic D3D12 compute shaders. Both passed on an RTX 4070 Ti SUPER and WARP. Both failed with the previous emitter.

  • Signed and unsigned D16_HI byte loads at offsets 0–3 extend into the high half while retaining the destination’s low half.
  • The halfword crossing case complements Dathinel’s ds_read_u16 check: ds_read_u16_d16_hi at byte 3, with LDS words 0xAB123456 and 0xDEADCDBE and initial destination 0xCAFE1357, returned 0xBEAB1357.

PortBridge surfaced XCL #544 for the partial-destination cases and Continued #507 for the single-writer fixture correction. Would these be useful in your valu_tests.rs harness?

Test-only patch for d27cb78960ed
--- a/crates/victory-shader/src/emit/valu_tests.rs
+++ b/crates/victory-shader/src/emit/valu_tests.rs
@@ -13,6 +13,7 @@
 use crate::{io, ir, resource, structure};
 
 const S_ENDPGM: u32 = 0xBF81_0000;
+const S_WAITCNT_ALL: u32 = 0xBF8C_0000;
 
 /// SOP1 `s_mov_b32 sdst, src0`.
 const fn s_mov_b32(sdst: u8, src0: u8) -> u32 {
@@ -49,6 +50,14 @@
     ]
 }
 
+/// GFX10 LDS instruction with a single byte offset.
+const fn ds(op: u8, offset: u16, addr: u8, data: u8, dst: u8) -> [u32; 2] {
+    [
+        0xD800_0000 | (op as u32) << 18 | offset as u32,
+        addr as u32 | (data as u32) << 8 | (dst as u32) << 24,
+    ]
+}
+
 /// MUBUF `buffer_store_dword vdata, off, s[srsrc:srsrc+3], 0 offset:byte_off`.
 const fn buffer_store_dword(vdata: u8, srsrc: u8, byte_off: u16) -> [u32; 2] {
     [
@@ -69,6 +78,10 @@
 /// 4 dwords of root constants in `s0..s3`, runs `body` (leaving its result in
 /// `v0`), and stores `v0` to dword 0 of the raw UAV at heap index 0.
 fn build_valu_cs(body: &[u32]) -> HostShader {
+    build_test_cs(body, 0)
+}
+
+fn build_test_cs(body: &[u32], lds_blocks: u32) -> HostShader {
     let mut words = Vec::new();
     // s[4:5] = descriptor table address (heap index 0 -> byte offset 0).
     words.push(s_mov_b32(5, 0x80)); // inline constant 0
@@ -116,7 +129,7 @@
             slot: 1,
         }],
         io: StageIo::Cs(ComputeIo {
-            rsrc2: 5 << 1, // 5 user SGPRs: s0..s4
+            rsrc2: (lds_blocks << 15) | (5 << 1), // 512 bytes of LDS per block, user SGPRs s0..s4
             threads: [1, 1, 1],
         }),
         code,
@@ -203,6 +216,46 @@
     assert!(ran > 0, "neither hardware nor WARP SM 6.6 device available");
 }
 
+#[test]
+fn lds_d16_hi_reads_keep_the_low_half() {
+    // The same LDS byte must zero- or sign-extend depending on the opcode.
+    let cases = [
+        [0x817F_80FE, 0xCAFE_1357, 0, 0],
+        [0x817F_80FE, 0xCAFE_1357, 1, 0],
+        [0x817F_80FE, 0xCAFE_1357, 2, 0],
+        [0x817F_80FE, 0xCAFE_1357, 3, 0],
+    ];
+    // Exactly one thread writes LDS, as in the Continued #507 fixture correction.
+    for (op, expected) in [
+        (0xA3, [0x00FE_1357, 0x0080_1357, 0x007F_1357, 0x0081_1357]),
+        (0xA5, [0xFFFE_1357, 0xFF80_1357, 0x007F_1357, 0xFF81_1357]),
+    ] {
+        let mut body = vec![vop1(1, 5, 0x80), vop1(1, 0, vgpr(2))];
+        body.extend(ds(0x0D, 0, 5, 1, 0)); // ds_write_b32
+        body.push(S_WAITCNT_ALL);
+        body.extend(ds(op, 0, 3, 0, 0)); // byte offset in v3
+        body.push(S_WAITCNT_ALL);
+        let shader = build_test_cs(&body, 1);
+        run_cases(&shader, &cases, |backend, i, _, got| {
+            assert_eq!(got, expected[i], "{backend}: opcode {op:#x}, byte {i}");
+        });
+    }
+}
+
+#[test]
+fn lds_read_u16_d16_hi_spans_adjacent_dwords() {
+    let mut body = vec![vop1(1, 5, 0x80), vop1(1, 0, vgpr(3))];
+    body.extend(ds(0x0D, 0, 5, 1, 0));
+    body.extend(ds(0x0D, 4, 5, 2, 0));
+    body.push(S_WAITCNT_ALL);
+    body.extend(ds(0xA7, 3, 5, 0, 0)); // ds_read_u16_d16_hi, byte offset 3
+    body.push(S_WAITCNT_ALL);
+    let shader = build_test_cs(&body, 1);
+    run_cases(&shader, &[[0xAB12_3456, 0xDEAD_CDBE, 0xCAFE_1357, 0]], |backend, _, _, got| {
+        assert_eq!(got, 0xBEAB_1357, "{backend}: misaligned halfword read");
+    });
+}
+
 fn is_f16_nan(bits: u16) -> bool {
     (bits & 0x7FFF) > 0x7C00
 }

AI-assisted with Codex.

**@⁠akimfomin** on GitHub · 2026-11-24 10:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/571#issuecomment-7128201680) · edited 2026-11-24 10:02 UTC I reran two focused LDS regressions on `d27cb78960ed` using synthetic D3D12 compute shaders. Both passed on an RTX 4070 Ti SUPER and WARP. Both failed with the previous emitter. - Signed and unsigned D16_HI byte loads at offsets 0–3 extend into the high half while retaining the destination’s low half. - The halfword crossing case complements [Dathinel’s `ds_read_u16` check](https://git.gtahub.st/github/Marvisak--VIctory/pulls/571): `ds_read_u16_d16_hi` at byte 3, with LDS words `0xAB123456` and `0xDEADCDBE` and initial destination `0xCAFE1357`, returned `0xBEAB1357`. [PortBridge](https://github.com/akimfomin/PortBridge) surfaced [XCL #544](https://github.com/ivall/xcl/pull/544) for the partial-destination cases and [Continued #507](https://github.com/ubiquitarianism/leonida/pull/507) for the single-writer fixture correction. Would these be useful in your `valu_tests.rs` harness? <details> <summary>Test-only patch for d27cb78960ed</summary> ```diff --- a/crates/victory-shader/src/emit/valu_tests.rs +++ b/crates/victory-shader/src/emit/valu_tests.rs @@ -13,6 +13,7 @@ use crate::{io, ir, resource, structure}; const S_ENDPGM: u32 = 0xBF81_0000; +const S_WAITCNT_ALL: u32 = 0xBF8C_0000; /// SOP1 `s_mov_b32 sdst, src0`. const fn s_mov_b32(sdst: u8, src0: u8) -> u32 { @@ -49,6 +50,14 @@ ] } +/// GFX10 LDS instruction with a single byte offset. +const fn ds(op: u8, offset: u16, addr: u8, data: u8, dst: u8) -> [u32; 2] { + [ + 0xD800_0000 | (op as u32) << 18 | offset as u32, + addr as u32 | (data as u32) << 8 | (dst as u32) << 24, + ] +} + /// MUBUF `buffer_store_dword vdata, off, s[srsrc:srsrc+3], 0 offset:byte_off`. const fn buffer_store_dword(vdata: u8, srsrc: u8, byte_off: u16) -> [u32; 2] { [ @@ -69,6 +78,10 @@ /// 4 dwords of root constants in `s0..s3`, runs `body` (leaving its result in /// `v0`), and stores `v0` to dword 0 of the raw UAV at heap index 0. fn build_valu_cs(body: &[u32]) -> HostShader { + build_test_cs(body, 0) +} + +fn build_test_cs(body: &[u32], lds_blocks: u32) -> HostShader { let mut words = Vec::new(); // s[4:5] = descriptor table address (heap index 0 -> byte offset 0). words.push(s_mov_b32(5, 0x80)); // inline constant 0 @@ -116,7 +129,7 @@ slot: 1, }], io: StageIo::Cs(ComputeIo { - rsrc2: 5 << 1, // 5 user SGPRs: s0..s4 + rsrc2: (lds_blocks << 15) | (5 << 1), // 512 bytes of LDS per block, user SGPRs s0..s4 threads: [1, 1, 1], }), code, @@ -203,6 +216,46 @@ assert!(ran > 0, "neither hardware nor WARP SM 6.6 device available"); } +#[test] +fn lds_d16_hi_reads_keep_the_low_half() { + // The same LDS byte must zero- or sign-extend depending on the opcode. + let cases = [ + [0x817F_80FE, 0xCAFE_1357, 0, 0], + [0x817F_80FE, 0xCAFE_1357, 1, 0], + [0x817F_80FE, 0xCAFE_1357, 2, 0], + [0x817F_80FE, 0xCAFE_1357, 3, 0], + ]; + // Exactly one thread writes LDS, as in the Continued #507 fixture correction. + for (op, expected) in [ + (0xA3, [0x00FE_1357, 0x0080_1357, 0x007F_1357, 0x0081_1357]), + (0xA5, [0xFFFE_1357, 0xFF80_1357, 0x007F_1357, 0xFF81_1357]), + ] { + let mut body = vec![vop1(1, 5, 0x80), vop1(1, 0, vgpr(2))]; + body.extend(ds(0x0D, 0, 5, 1, 0)); // ds_write_b32 + body.push(S_WAITCNT_ALL); + body.extend(ds(op, 0, 3, 0, 0)); // byte offset in v3 + body.push(S_WAITCNT_ALL); + let shader = build_test_cs(&body, 1); + run_cases(&shader, &cases, |backend, i, _, got| { + assert_eq!(got, expected[i], "{backend}: opcode {op:#x}, byte {i}"); + }); + } +} + +#[test] +fn lds_read_u16_d16_hi_spans_adjacent_dwords() { + let mut body = vec![vop1(1, 5, 0x80), vop1(1, 0, vgpr(3))]; + body.extend(ds(0x0D, 0, 5, 1, 0)); + body.extend(ds(0x0D, 4, 5, 2, 0)); + body.push(S_WAITCNT_ALL); + body.extend(ds(0xA7, 3, 5, 0, 0)); // ds_read_u16_d16_hi, byte offset 3 + body.push(S_WAITCNT_ALL); + let shader = build_test_cs(&body, 1); + run_cases(&shader, &[[0xAB12_3456, 0xDEAD_CDBE, 0xCAFE_1357, 0]], |backend, _, _, got| { + assert_eq!(got, 0xBEAB_1357, "{backend}: misaligned halfword read"); + }); +} + fn is_f16_nan(bits: u16) -> bool { (bits & 0x7FFF) > 0x7C00 } ``` </details> AI-assisted with Codex.
Author
Owner

@⁠SAitken91 on GitHub · 2026-11-24 10:46 UTC · original

@⁠alexander-src confirmed and fixed in ce45c67: at byte 3 of the last LDS dword the clamped next dword is the same dword, so the read now zeroes its high byte (select(past, 0, hi)) and the write's mask and data for the next dword are 0 when past, matching out-of-bounds LDS behaviour. Validation unchanged (CS 1686 on d2a4bae). @⁠akimfomin thanks for the extra D16_HI / crossing regressions.

**@⁠SAitken91** on GitHub · 2026-11-24 10:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/571#issuecomment-7129225842) @⁠alexander-src confirmed and fixed in ce45c67: at byte 3 of the last LDS dword the clamped next dword is the same dword, so the read now zeroes its high byte (`select(past, 0, hi)`) and the write's mask and data for the next dword are 0 when `past`, matching out-of-bounds LDS behaviour. Validation unchanged (CS 1686 on `d2a4bae`). @⁠akimfomin thanks for the extra D16_HI / crossing regressions.
Author
Owner

@⁠MrCloudy2 on GitHub · 2026-11-24 10:59 UTC · original

Tester result: +2 of 339 previously failing world programs now emit (compute 32 → 34 of 272; the two that logged an LDS write of bytes or halves is not supported). Merged together with #160 and #539 the gains add up exactly: vertex/pixel 11, compute 41.

How measured: 339 shader containers from my own 1.0.2.1 copy, the distinct programs that logged shader does not translate in two world runs, each matched to its container by the BLAKE3 VIctory logs. Each PR was merged on its own onto one base: main 8e79c80 + #151 #190 #454 #493 #579 + #177's key fix + the wave64 stack via #439. I then ran victory translate <folder> (diag build, CPU only) and compared DXIL emitted per stage against the base (vertex/pixel 0 of 25, compute 32 of 272, mesh 0 of 13). Linux, Proton-CachyOS wine, cross-built with xwin, RTX 3060 host (only matters for the wave64 part of the base). Translation counts only, not image correctness. AI-assisted (Claude Code).

**@⁠MrCloudy2** on GitHub · 2026-11-24 10:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/571#issuecomment-7129520501) Tester result: **+2 of 339** previously failing world programs now emit (compute 32 → 34 of 272; the two that logged `an LDS write of bytes or halves is not supported`). Merged together with #160 and #539 the gains add up exactly: vertex/pixel 11, compute 41. **How measured:** 339 shader containers from my own 1.0.2.1 copy, the distinct programs that logged `shader does not translate` in two world runs, each matched to its container by the BLAKE3 VIctory logs. Each PR was merged on its own onto one base: `main` `8e79c80` + #151 #190 #454 #493 #579 + #177's key fix + the wave64 stack via #439. I then ran `victory translate <folder>` (diag build, CPU only) and compared DXIL emitted per stage against the base (vertex/pixel 0 of 25, compute 32 of 272, mesh 0 of 13). Linux, Proton-CachyOS wine, cross-built with xwin, RTX 3060 host (only matters for the wave64 part of the base). Translation counts only, not image correctness. AI-assisted (Claude Code).
Author
Owner

@⁠SAitken91 on GitHub · 2026-11-24 13:42 UTC · original

@⁠catminou4 good question. LDS is private to one thread group, so a write from a different workgroup can't land in the window. Within a group the window is real but narrow: an unsynchronized full-dword ds_write from another wave between the And and the Or would leave the OR of both values in that byte, where hardware would keep one or the other. That's already an unordered race on the console (no barrier between the waves), but the result can differ, so a single CAS loop (cmpxchg until the old value matches) would close it if the maintainer prefers exact behaviour over two atomics. On tests: agreed — the coverage so far is hardware readbacks on other machines (Dathinel, akimfomin, for the straddle and D16_HI cases); a host-execution valu_tests case with mixed byte/half/dword writes to one dword would be the right regression.

**@⁠SAitken91** on GitHub · 2026-11-24 13:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/571#issuecomment-7133220126) @⁠catminou4 good question. LDS is private to one thread group, so a write from a *different* workgroup can't land in the window. Within a group the window is real but narrow: an unsynchronized full-dword `ds_write` from another wave between the And and the Or would leave the OR of both values in that byte, where hardware would keep one or the other. That's already an unordered race on the console (no barrier between the waves), but the result can differ, so a single CAS loop (`cmpxchg` until the old value matches) would close it if the maintainer prefers exact behaviour over two atomics. On tests: agreed — the coverage so far is hardware readbacks on other machines (Dathinel, akimfomin, for the straddle and D16_HI cases); a host-execution `valu_tests` case with mixed byte/half/dword writes to one dword would be the right regression.
Author
Owner

@⁠adamdotpy on GitHub · 2026-11-24 15:58 UTC · original

Reviewing this against #383, which covers some of the same LDS ground, since the two will have to be squared with each other before either lands.

Where this is better than #383. #383 documents the halfword at byte 3 as a known shortcut: it keeps the write inside one dword and loses the byte that spills into the next. This PR implements the straddle properly — a 64-bit shift of the two dwords for the read (flags::INT64), a 64-bit mask/data pair for the write, and the past-the-end case clamped to the last dword with reads seeing 0 and the dropped byte not written. lds_halves_straddle_two_dwords covers it, and @⁠akimfomin's 0xBEAB1357 regression exercises the same path end to end. For LDS alone this is the PR I would land, and #383 would go back for a rebase keeping only its image_sample_o and descriptor-data work.

Verified here (Windows, d24c6e4): cargo test -p victory-shader — 123 passed, 1 ignored, including the four new LDS tests; clippy --all-targets --all-features --locked -D warnings clean; release build of victory fine; the file is rustfmt --edition 2024 --check clean. I did not run the retail shader pack, so I am relying on @⁠slint6614-dev's +16 validated CS containers and @⁠MrCloudy2's +2 of 339 for the translation-rate evidence.

One thing worth a test: the kept half comes from inst.read(Reg::V(dst)). In lower.rs the _d16/_d16_hi read path does

let old = match inst.read(Reg::V(reg)) {   // reg is dst_reg

and ir.rs::effects() for the DS form feeds addr and data into the read set while dst only goes into the write set, so the destination register is not declared as read at all. It works in the tests because vdst and the register holding the value coincide. Two experiments on the branch:

  • Changing the encoding's data0 field from v0 to v1 in lds_sub_dword_reads_extend_and_keep_halves leaves the test green, which confirms the value is not taken from the data field — it really is Reg::V(dst).
  • Setting the destination to v2 with v0 as the data field and v2 preloaded from v3 gave 0x2211aa99 where console semantics want 0x6655d0c0 (kept half 0xd0c0 from the destination's previous value, read half 0x6655 from LDS). I encoded the preload by hand with vop1, so the preload itself may be what is wrong rather than the emitter — but either way the case vdst ≠ the value the emitter resolves for it is untested, and a test with the destination's previous value distinct from the data field would pin it down. If #116 changes this, a // fixed by #116 note here saves the next reader a day.

Smaller points.

  • Two atomics (clear then set) for sub-dword writes: agreed that it is a narrow unordered race on the console anyway, and that a CAS loop would close it. Two atomics are the cheaper default; the comment explaining the window is what makes it reviewable.
  • self.s.lds_dwords - 1 assumes LDS is non-empty; that is true for every legal allocation, but a saturating_sub or a debug assert would make the assumption explicit if lds_dwords ever becomes configuration-driven.
  • base == name is the full-dword case and the else branch is what everything else falls back to; naming the condition (is_full_dword) would help a reader who lands on the let x = if base == name { x } line cold.

Nothing here is a request for a change to the straddle logic — it looks right, and the outside-in validation is unusually strong. The asked-for item is only the destination-register test.

**@⁠adamdotpy** on GitHub · 2026-11-24 15:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/571#issuecomment-7136906574) Reviewing this against #383, which covers some of the same LDS ground, since the two will have to be squared with each other before either lands. **Where this is better than #383.** #383 documents the halfword at byte 3 as a known shortcut: it keeps the write inside one dword and loses the byte that spills into the next. This PR implements the straddle properly — a 64-bit shift of the two dwords for the read (`flags::INT64`), a 64-bit mask/data pair for the write, and the past-the-end case clamped to the last dword with reads seeing 0 and the dropped byte not written. `lds_halves_straddle_two_dwords` covers it, and @⁠akimfomin's `0xBEAB1357` regression exercises the same path end to end. For LDS alone this is the PR I would land, and #383 would go back for a rebase keeping only its `image_sample_o` and descriptor-data work. **Verified here** (Windows, `d24c6e4`): `cargo test -p victory-shader` — 123 passed, 1 ignored, including the four new LDS tests; clippy `--all-targets --all-features --locked -D warnings` clean; release build of `victory` fine; the file is `rustfmt --edition 2024 --check` clean. I did not run the retail shader pack, so I am relying on @⁠slint6614-dev's +16 validated CS containers and @⁠MrCloudy2's +2 of 339 for the translation-rate evidence. **One thing worth a test: the kept half comes from `inst.read(Reg::V(dst))`.** In `lower.rs` the `_d16`/`_d16_hi` read path does ```rust let old = match inst.read(Reg::V(reg)) { // reg is dst_reg ``` and `ir.rs::effects()` for the DS form feeds `addr` and `data` into the read set while `dst` only goes into the write set, so the destination register is not declared as read at all. It works in the tests because `vdst` and the register holding the value coincide. Two experiments on the branch: - Changing the encoding's `data0` field from `v0` to `v1` in `lds_sub_dword_reads_extend_and_keep_halves` leaves the test green, which confirms the value is not taken from the data field — it really is `Reg::V(dst)`. - Setting the destination to `v2` with `v0` as the data field and `v2` preloaded from `v3` gave `0x2211aa99` where console semantics want `0x6655d0c0` (kept half `0xd0c0` from the destination's previous value, read half `0x6655` from LDS). I encoded the preload by hand with `vop1`, so the preload itself may be what is wrong rather than the emitter — but either way the case `vdst` ≠ the value the emitter resolves for it is untested, and a test with the destination's previous value distinct from the data field would pin it down. If #116 changes this, a `// fixed by #116` note here saves the next reader a day. **Smaller points.** - Two atomics (clear then set) for sub-dword writes: agreed that it is a narrow unordered race on the console anyway, and that a CAS loop would close it. Two atomics are the cheaper default; the comment explaining the window is what makes it reviewable. - `self.s.lds_dwords - 1` assumes LDS is non-empty; that is true for every legal allocation, but a `saturating_sub` or a debug assert would make the assumption explicit if `lds_dwords` ever becomes configuration-driven. - `base == name` is the full-dword case and the `else` branch is what everything else falls back to; naming the condition (`is_full_dword`) would help a reader who lands on the `let x = if base == name { x }` line cold. Nothing here is a request for a change to the straddle logic — it looks right, and the outside-in validation is unusually strong. The asked-for item is only the destination-register test.
Author
Owner

@⁠SAitken91 on GitHub · 2026-11-24 16:42 UTC · original

@⁠adamdotpy thanks for the careful pass. Added the case you asked for in 8ad9d9f: lds_d16_hi_keeps_the_destinations_own_low_half reads ds_read_u16_d16_hi into v6 (loaded from v4 first), with v2 in the data field and v5 as the address; v6 ends up v4.lo | lds.lo << 16, passing on an RX 6950 XT. The kept half does come from the destination: ir.rs effects() ends with "lanes disabled in EXEC keep the old value", which adds every VGPR write to the read set, DS included — so inst.read(Reg::V(dst)) is Some (TrashTalker3460 raised the same point earlier; an IR test confirmed it). On your second experiment: with v3 = 0xCCBBAA99 as the preload and 0x44332211 in the LDS dword, 0x2211aa99 is the expected result (kept 0xaa99, read 0x2211), so I think the preload/expectation was what differed rather than the emitter. The lds_dwords - 1 is guarded: an LDS access in a program that allocates none is refused earlier ("LDS the program does not allocate").

**@⁠SAitken91** on GitHub · 2026-11-24 16:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/571#issuecomment-7138094841) @⁠adamdotpy thanks for the careful pass. Added the case you asked for in 8ad9d9f: `lds_d16_hi_keeps_the_destinations_own_low_half` reads `ds_read_u16_d16_hi` into v6 (loaded from v4 first), with v2 in the data field and v5 as the address; v6 ends up `v4.lo | lds.lo << 16`, passing on an RX 6950 XT. The kept half does come from the destination: `ir.rs` `effects()` ends with "lanes disabled in EXEC keep the old value", which adds every VGPR write to the read set, DS included — so `inst.read(Reg::V(dst))` is `Some` (TrashTalker3460 raised the same point earlier; an IR test confirmed it). On your second experiment: with v3 = `0xCCBBAA99` as the preload and `0x44332211` in the LDS dword, `0x2211aa99` is the expected result (kept `0xaa99`, read `0x2211`), so I think the preload/expectation was what differed rather than the emitter. The `lds_dwords - 1` is guarded: an LDS access in a program that allocates none is refused earlier ("LDS the program does not allocate").
Author
Owner

@⁠adamdotpy on GitHub · 2026-11-24 16:45 UTC · original

Verified 8ad9d9f here (Windows 11 / Rust 1.98.1, isolated target dir): cargo test -p victory-shader --lib 124 passed / 1 ignored, with lds_d16_hi_keeps_the_destinations_own_low_half running on the hardware GPU and passing; clippy --all-targets --all-features --locked -D warnings clean.

Point by point:

The destination-register question — you were right and my review was wrong, and here is the evidence. I re-read ir.rs::effects() and missed its tail: after the per-fields match, for every vector instruction it does r.extend(w.iter().filter(|w| matches!(w, Reg::V(_)))) under the comment "Lanes disabled in EXEC keep the old value". So every VGPR write, DS destinations included, is also in the read set, and inst.read(Reg::V(dst)) is Some — the kept half does come from the destination's own previous value by construction, not by the tests' coincidence. My "effects() declares dst only as written" claim was based on the DS arm alone and is corrected here; the new test pins it empirically anyway (destination v6 preloaded from v4, data field v2, expected v4.lo | lds.lo << 16, which differs from v2's half in every case row, so a data-field read would fail).

My 0x2211aa99 experiment — agreed, that was my expectation being wrong, not the emitter: with the LDS dword 0x44332211 and the kept half 0xaa99 (v3's low half, i.e. the destination's preload did land), 0x2211aa99 is exactly kept-from-destination plus read-from-LDS. I had the read half backwards in my expected value. With the tail of effects() in view, that run was consistent with correct behaviour all along.

lds_dwords - 1 — noted, guarded by the earlier "LDS the program does not allocate" refusal. My saturating_sub suggestion was belt-and-braces for a case that cannot be reached; no change needed.

The straddle and two-atomics points stand as reviewed. With this test added, the LDS half of the branch has both the hardware readbacks from other machines and a host-execution case where the destination is distinct from the data field — nothing left open from my side on #571.

**@⁠adamdotpy** on GitHub · 2026-11-24 16:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/571#issuecomment-7138159554) Verified `8ad9d9f` here (Windows 11 / Rust 1.98.1, isolated target dir): `cargo test -p victory-shader --lib` 124 passed / 1 ignored, with `lds_d16_hi_keeps_the_destinations_own_low_half` running on the hardware GPU and passing; clippy `--all-targets --all-features --locked -D warnings` clean. Point by point: **The destination-register question — you were right and my review was wrong, and here is the evidence.** I re-read `ir.rs::effects()` and missed its tail: after the per-fields match, for every vector instruction it does `r.extend(w.iter().filter(|w| matches!(w, Reg::V(_))))` under the comment "Lanes disabled in EXEC keep the old value". So every VGPR write, DS destinations included, is also in the read set, and `inst.read(Reg::V(dst))` is `Some` — the kept half does come from the destination's own previous value by construction, not by the tests' coincidence. My "`effects()` declares `dst` only as written" claim was based on the DS arm alone and is corrected here; the new test pins it empirically anyway (destination v6 preloaded from v4, data field v2, expected `v4.lo | lds.lo << 16`, which differs from v2's half in every case row, so a data-field read would fail). **My `0x2211aa99` experiment** — agreed, that was my expectation being wrong, not the emitter: with the LDS dword `0x44332211` and the kept half `0xaa99` (v3's low half, i.e. the destination's preload did land), `0x2211aa99` is exactly kept-from-destination plus read-from-LDS. I had the read half backwards in my expected value. With the tail of `effects()` in view, that run was consistent with correct behaviour all along. **`lds_dwords - 1`** — noted, guarded by the earlier "LDS the program does not allocate" refusal. My `saturating_sub` suggestion was belt-and-braces for a case that cannot be reached; no change needed. **The straddle and two-atomics points** stand as reviewed. With this test added, the LDS half of the branch has both the hardware readbacks from other machines and a host-execution case where the destination is distinct from the data field — nothing left open from my side on #571.
Author
Owner

@⁠Daniel333313131 on GitHub · 2026-11-24 22:18 UTC · original

Translation census for this PR and the two others that lower byte and half LDS accesses (#116, #101). Each was merged alone onto main ffe310e.

Setup: release build, victory translate <dump>/shaders.rpf --list (26,084 programs, no --validate, no --pipelines), Windows 11, RX 7900 XTX.

head vertex/pixel compute mesh
main ffe310e 12,231 1,441 of 2,582 8,214
#571 8ad9d9f 12,231 1,457 (+16) 8,214
#116 c853a6a 12,231 1,457 (+16) 8,214
#101 9fbd7e9 12,231 1,457 (+16) 8,214
  • All three give the same census numbers: "an LDS write of bytes or halves" (9) and "an LDS read of bytes or halves" (7) are gone as first refusals, and 16 more compute programs are emitted.
  • So one of the three is probably enough. Which one is right is a question for hardware tests, not this census. None of the three was run in game.

AI use: Claude Code (Claude Opus 5.5) merged and built the commits, ran the census, compared the outputs and wrote this comment. The numbers come from the runs above.

**@⁠Daniel333313131** on GitHub · 2026-11-24 22:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/571#issuecomment-7146070669) Translation census for this PR and the two others that lower byte and half LDS accesses (#116, #101). Each was merged alone onto `main` `ffe310e`. **Setup:** release build, `victory translate <dump>/shaders.rpf --list` (26,084 programs, no `--validate`, no `--pipelines`), Windows 11, RX 7900 XTX. | | head | vertex/pixel | compute | mesh | |---|---|---|---|---| | `main` | `ffe310e` | 12,231 | 1,441 of 2,582 | 8,214 | | **#571** | `8ad9d9f` | 12,231 | **1,457** (+16) | 8,214 | | #116 | `c853a6a` | 12,231 | 1,457 (+16) | 8,214 | | #101 | `9fbd7e9` | 12,231 | 1,457 (+16) | 8,214 | - All three give the same census numbers: "an LDS write of bytes or halves" (9) and "an LDS read of bytes or halves" (7) are gone as first refusals, and 16 more compute programs are emitted. - So one of the three is probably enough. Which one is right is a question for hardware tests, not this census. None of the three was run in game. **AI use:** Claude Code (Claude Opus 5.5) merged and built the commits, ran the census, compared the outputs and wrote this comment. The numbers come from the runs above.
Author
Owner

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

Automated triage for the maintainers. Closing because this change is already in main, or main has since replaced the code it patches.

LDS byte and half accesses. In main since today (lower.rs:3044-3141). Same as #116.

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 00:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/571#issuecomment-7148491661) Automated triage for the maintainers. Closing because this change is already in `main`, or `main` has since replaced the code it patches. LDS byte and half accesses. In main since today (lower.rs:3044-3141). Same as #116. 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.

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