Shaders: assemble dword-straddling global_load_ushort and global_load_sshort #1536

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

@⁠oni-swr on GitHub · 2026-11-24 18:53 UTC · original
oni-swr:fix/global-load-short-straddle → main · +369 −12 · 3 files · 3 commits · closed without merging

Problem

In Lower::flat (crates/victory-shader/src/emit/lower.rs), sub-dword global loads (global_load_ushort and global_load_sshort) assumed the 16-bit value never crosses a 4-byte dword boundary:

// shortcut: the field is taken not to cross a dword.
let at = self.s.m.bin(c, Bin::And, off, not3);
let w = dword(self, at)?;
let byte = self.s.m.bin(c, Bin::And, off, three);
let sh = self.s.m.bin(c, Bin::Shl, byte, three);
let x = self.s.m.bin(c, Bin::LShr, w, sh);

When off & 3 == 3, w >> 24 reads only the low byte from dword at and zeros the high byte from dword at + 4. For example, reading 0xFFFE (-2) at byte offset 3 returned 0x0000_00FE (+254) for both global_load_ushort and global_load_sshort instead of 0x0000_FFFE / 0xFFFF_FFFE. This affects both root-SRV (rawBufferLoad) and CODE constant-table (code_dword) loads.

Fix

  • In Lower::flat, when width == 16 and the offset can straddle a dword boundary (a.dynamic.is_some() || a.offset & 3 == 3), load the next aligned dword at + 4 and combine (w >> 24) | (w_next << 8) before the existing sign/zero-extension shift.
  • For static offsets with a.offset & 3 != 3, emit no second load; for static offsets with a.offset & 3 == 3, emit the second load unconditionally without a branch.
  • For dynamic offsets, guard the at + 4 load with begin_guarded on byte == 3 (and the lane guard when present) so non-straddling loads near the end of a root SRV never read past the buffer's end.
  • Added synthetic end-to-end regression test emit::valu_tests::global_load_short_straddling_dword_boundary covering global_load_ushort and global_load_sshort across dynamic byte offsets 0..=10 (including straddling offsets 3 and 7, and end-of-buffer offset 10) and static straddling offset +3, for both a root SRV and a s_getpc_b64 CODE constant table.

Verification

  • Before fix (unmodified origin/main ffe310e): cargo test -p victory-shader --locked global_load_short_straddling_dword_boundary failed on RX 7800 XT hardware with srv global_load_ushort (dyn) at byte offset 3 = 0x000000fe, want 0x0000fffe.
  • After fix:
    • cargo clippy --workspace --all-targets --locked -- -D warnings: passed (0 warnings)
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed (0 warnings)
    • cargo test --workspace --locked: 343 passed, 0 failed, 6 ignored
      • victory: 1 passed, 0 failed, 0 ignored
      • victory_core: 11 passed, 0 failed, 0 ignored
      • victory_formats: 23 passed, 0 failed, 4 ignored
      • victory_game: 2 passed, 0 failed, 0 ignored
      • victory_gpu: 50 passed, 0 failed, 1 ignored
      • victory_hle: 95 passed (94 + 1), 0 failed, 0 ignored
      • victory_loader: 25 passed (22 + 2 + 1), 0 failed, 0 ignored
      • victory_pe: 7 passed, 0 failed, 0 ignored
      • victory_pipeline: 4 passed, 0 failed, 0 ignored
      • victory_shader: 121 passed, 0 failed, 1 ignored (global_load_short_straddling_dword_boundary validated by dxil.dll and passed on both RX 7800 XT hardware and WARP)
      • xtask: 4 passed, 0 failed, 0 ignored (including repository_passes_policy)
  • Environment: AMD Radeon RX 7800 XT, Windows 11, rustc 1.98.1 (48a229cea 2026-09-01) / cargo 1.98.1 (797e8a9bc 2026-08-05).

Not tested

  • No live title run was executed (verified via synthetic GFX10 compute shaders, dxil.dll validation, hardware RX 7800 XT + WARP dispatch, and the workspace test/clippy suite only).

AI use

T3 Code through Antigravity, Gemini 4 Neon.

Update 4b638ff: title-memory coverage and the alignment assumption

  • memory_tests.rs: title_memory_is_read_and_written_at_computed_addresses reads title memory with global_load_dword again, as on main. The straddling global_load_ushort (offset 3, bytes 3 and 4 across two dwords, 0xAB11) is a separate read beside it and a seventh result, so both are checked. The title-memory access count is now 12.
  • Odd-address behavior is an assumption, not settled. RDNA 2 guide §8.1.7 "Alignment" (p. 64, Vector Memory Buffer Instructions) says non-formatted ops are governed by SH_MEM_CONFIG.alignment_mode and lists DWORD ("automatic alignment to multiple of the smaller of element size or a dword"), DWORD_STRICT, STRICT and UNALIGNED ("no alignment requirements"). It sits in the buffer chapter. §12.18.3 (Global) says nothing about alignment. So unaligned mode reads bytes 3 and 4, which this PR emits, and DWORD mode would align a halfword down to bytes 2 and 3. Which mode the console's driver sets is not in the guide, and nothing in this repo or its tests shows it. I found no passage or site to cite for that, so I am not claiming it. The assumption is now a comment next to the straddle in Lower::flat.

Verification for 4b638ff (WARP only, VICTORY_D3D12_WARP=1, dxil.dll validation on):

Command Result
cargo test -p victory-shader --lib 248 passed, 0 failed, 3 ignored
cargo clippy -p victory-shader --all-targets 0 warnings
cargo xtask policy 182 files ok

AI use

T3 Code through Antigravity, Gemini 4 Neon. Follow-up commit 4b638ff: Claude Code (Claude Sonnet 5.5).

**@⁠oni-swr** on GitHub · 2026-11-24 18:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/1536) `oni-swr:fix/global-load-short-straddle` → `main` · +369 −12 · 3 files · 3 commits · closed without merging ### Problem In `Lower::flat` (`crates/victory-shader/src/emit/lower.rs`), sub-dword global loads (`global_load_ushort` and `global_load_sshort`) assumed the 16-bit value never crosses a 4-byte dword boundary: ```rust // shortcut: the field is taken not to cross a dword. let at = self.s.m.bin(c, Bin::And, off, not3); let w = dword(self, at)?; let byte = self.s.m.bin(c, Bin::And, off, three); let sh = self.s.m.bin(c, Bin::Shl, byte, three); let x = self.s.m.bin(c, Bin::LShr, w, sh); ``` When `off & 3 == 3`, `w >> 24` reads only the low byte from dword `at` and zeros the high byte from dword `at + 4`. For example, reading `0xFFFE` (`-2`) at byte offset `3` returned `0x0000_00FE` (`+254`) for both `global_load_ushort` and `global_load_sshort` instead of `0x0000_FFFE` / `0xFFFF_FFFE`. This affects both root-SRV (`rawBufferLoad`) and `CODE` constant-table (`code_dword`) loads. ### Fix - In `Lower::flat`, when `width == 16` and the offset can straddle a dword boundary (`a.dynamic.is_some() || a.offset & 3 == 3`), load the next aligned dword `at + 4` and combine `(w >> 24) | (w_next << 8)` before the existing sign/zero-extension shift. - For static offsets with `a.offset & 3 != 3`, emit no second load; for static offsets with `a.offset & 3 == 3`, emit the second load unconditionally without a branch. - For dynamic offsets, guard the `at + 4` load with `begin_guarded` on `byte == 3` (and the lane `guard` when present) so non-straddling loads near the end of a root SRV never read past the buffer's end. - Added synthetic end-to-end regression test `emit::valu_tests::global_load_short_straddling_dword_boundary` covering `global_load_ushort` and `global_load_sshort` across dynamic byte offsets `0..=10` (including straddling offsets `3` and `7`, and end-of-buffer offset `10`) and static straddling offset `+3`, for both a root SRV and a `s_getpc_b64` `CODE` constant table. ### Verification - **Before fix (unmodified `origin/main` `ffe310e`)**: `cargo test -p victory-shader --locked global_load_short_straddling_dword_boundary` failed on RX 7800 XT hardware with `srv global_load_ushort (dyn) at byte offset 3 = 0x000000fe, want 0x0000fffe`. - **After fix**: - `cargo clippy --workspace --all-targets --locked -- -D warnings`: passed (0 warnings) - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: passed (0 warnings) - `cargo test --workspace --locked`: **343 passed, 0 failed, 6 ignored** - `victory`: 1 passed, 0 failed, 0 ignored - `victory_core`: 11 passed, 0 failed, 0 ignored - `victory_formats`: 23 passed, 0 failed, 4 ignored - `victory_game`: 2 passed, 0 failed, 0 ignored - `victory_gpu`: 50 passed, 0 failed, 1 ignored - `victory_hle`: 95 passed (94 + 1), 0 failed, 0 ignored - `victory_loader`: 25 passed (22 + 2 + 1), 0 failed, 0 ignored - `victory_pe`: 7 passed, 0 failed, 0 ignored - `victory_pipeline`: 4 passed, 0 failed, 0 ignored - `victory_shader`: 121 passed, 0 failed, 1 ignored (`global_load_short_straddling_dword_boundary` validated by `dxil.dll` and passed on both RX 7800 XT hardware and WARP) - `xtask`: 4 passed, 0 failed, 0 ignored (including `repository_passes_policy`) - **Environment**: AMD Radeon RX 7800 XT, Windows 11, `rustc 1.98.1 (48a229cea 2026-09-01)` / `cargo 1.98.1 (797e8a9bc 2026-08-05)`. ### Not tested - No live title run was executed (verified via synthetic GFX10 compute shaders, `dxil.dll` validation, hardware RX 7800 XT + WARP dispatch, and the workspace test/clippy suite only). ### AI use T3 Code through Antigravity, Gemini 4 Neon. ### Update `4b638ff`: title-memory coverage and the alignment assumption - `memory_tests.rs`: `title_memory_is_read_and_written_at_computed_addresses` reads title memory with `global_load_dword` again, as on `main`. The straddling `global_load_ushort` (offset 3, bytes 3 and 4 across two dwords, `0xAB11`) is a separate read beside it and a seventh result, so both are checked. The title-memory access count is now 12. - **Odd-address behavior is an assumption, not settled.** RDNA 2 guide §8.1.7 "Alignment" (p. 64, Vector Memory Buffer Instructions) says non-formatted ops are governed by `SH_MEM_CONFIG.alignment_mode` and lists `DWORD` ("automatic alignment to multiple of the smaller of element size or a dword"), `DWORD_STRICT`, `STRICT` and `UNALIGNED` ("no alignment requirements"). It sits in the buffer chapter. §12.18.3 (Global) says nothing about alignment. So unaligned mode reads bytes 3 and 4, which this PR emits, and `DWORD` mode would align a halfword down to bytes 2 and 3. Which mode the console's driver sets is not in the guide, and nothing in this repo or its tests shows it. I found no passage or site to cite for that, so I am not claiming it. The assumption is now a comment next to the straddle in `Lower::flat`. Verification for `4b638ff` (WARP only, `VICTORY_D3D12_WARP=1`, `dxil.dll` validation on): | Command | Result | |---|---| | `cargo test -p victory-shader --lib` | 248 passed, 0 failed, 3 ignored | | `cargo clippy -p victory-shader --all-targets` | 0 warnings | | `cargo xtask policy` | 182 files ok | ### AI use T3 Code through Antigravity, Gemini 4 Neon. Follow-up commit `4b638ff`: Claude Code (Claude Sonnet 5.5).
The title-memory program's global_load_ushort replaced its global_load_dword
read. Restore the dword read and add the halfword read at offset 3 as a
seventh result. Note beside the straddle that it assumes
SH_MEM_CONFIG.alignment_mode UNALIGNED.

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

@⁠marquezinii on GitHub · 2026-11-24 19:12 UTC · original

Ran on an RTX 5070 (desktop, driver 621.40, the only adapter), Windows 11 26300, Rust 1.98.1 at 50cbdd0. cargo test -p victory-shader --lib -- --test-threads=1 --nocapture gives 121 passed, 0 failed, 1 ignored. global_load_short_straddling_dword_boundary passes on the hardware adapter and WARP.

The second load is guarded by byte == 3 only when the offset is dynamic. For a static offset it is emitted only when offset & 3 == 3. So aligned loads keep a single rawBufferLoad, and the extra read can't go past the view for offsets that don't straddle.

**@⁠marquezinii** on GitHub · 2026-11-24 19:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/1536#issuecomment-7141768849) Ran on an RTX 5070 (desktop, driver 621.40, the only adapter), Windows 11 26300, Rust 1.98.1 at `50cbdd0`. `cargo test -p victory-shader --lib -- --test-threads=1 --nocapture` gives 121 passed, 0 failed, 1 ignored. `global_load_short_straddling_dword_boundary` passes on the hardware adapter and WARP. The second load is guarded by `byte == 3` only when the offset is dynamic. For a static offset it is emitted only when `offset & 3 == 3`. So aligned loads keep a single `rawBufferLoad`, and the extra read can't go past the view for offsets that don't straddle.
Author
Owner

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

Offline measurement on a retail dump, and the shader tests on Ada

Result: no count changes against main, and the tests pass on Ada.

Offline. I merged head 50cbdd0 onto main ffe310e (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 21,724 on both, 0 gained, 0 lost. No program changes its failure reason either.

This is the expected result for a correctness fix whose instructions sit behind the earlier failures on main. The count shows that the change rejects nothing. It does not show whether the output is right.

Tests. With the same merge, cargo test --locked -p victory-shader --lib passed 121, failed 0. The bitcode benchmark is ignored, as on main, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, with VICTORY_WARP unset.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

**@⁠sinan-cmyk** on GitHub · 2026-11-24 19:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/1536#issuecomment-7142275303) ### Offline measurement on a retail dump, and the shader tests on Ada **Result: no count changes against `main`, and the tests pass on Ada.** **Offline.** I merged head 50cbdd0 onto `main` ffe310e (clean merge) and ran `victory translate --validate --list` on `shaders.rpf` (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with `main` program by program (25,889 programs). Validated: 21,724 on both, 0 gained, 0 lost. No program changes its failure reason either. This is the expected result for a correctness fix whose instructions sit behind the earlier failures on `main`. The count shows that the change rejects nothing. It does not show whether the output is right. **Tests.** With the same merge, `cargo test --locked -p victory-shader --lib` passed 121, failed 0. The bitcode benchmark is ignored, as on `main`, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, with `VICTORY_WARP` unset. No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Author
Owner

@⁠geiyiliyabumo on GitHub · 2026-11-24 19:40 UTC · original

Verified commit 50cbdd0 on Windows 11 / AMD Radeon RX 9060 XT (RDNA4, gfx1200, SM 6.6) + WARP:

  • cargo test -p victory-shader --lib: 121 passed, 0 failed, 1 ignored (including the new dword-straddling global_load_ushort/global_load_sshort GPU tests).

AI-assisted; synthetic tests only, no game files.

**@⁠geiyiliyabumo** on GitHub · 2026-11-24 19:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/1536#issuecomment-7142439109) Verified commit `50cbdd0` on **Windows 11 / AMD Radeon RX 9060 XT (RDNA4, `gfx1200`, SM 6.6)** + **WARP**: - `cargo test -p victory-shader --lib`: **121 passed, 0 failed, 1 ignored** (including the new dword-straddling `global_load_ushort`/`global_load_sshort` GPU tests). *AI-assisted; synthetic tests only, no game files.*
Author
Owner

@⁠oni-swr on GitHub · 2026-11-24 23:08 UTC · original

Rebased onto main 70564ae as 4efcbed. The force-push dismissed the approval, so @⁠DenRakEiw, it needs another look.

  • lower.rs: the fix applied unchanged.
  • valu_tests.rs: the only conflict; upstream also appended tests at the end. I kept both, upstream's first, and updated the regression test to upstream's changes:
    • the six new HostShader fields, filled from lowered as upstream's own test builders do
    • range::build for the IR, as production translation now does
    • since d71c388, the global table is a raw view in the resource heap (index 1, with heap index and byte offset in user data); the old root-SRV binding is kept for shaders that report one

Tested on an AMD Radeon RX 7800 XT (RDNA3) and WARP, Windows 11, Rust 1.98.1:

Check Result
Regression test without the fix (lower.rs at 70564ae) fails on the RX 7800 XT: byte offset 3 gives 0x000000fe, want 0x0000fffe
Regression test with the fix passes on the RX 7800 XT and WARP
cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings clean
cargo test --workspace --locked 477 passed, 0 failed, 7 ignored (incl. repository_passes_policy)

AI use: Claude Code (Claude Opus 5.5) did the rebase, ran the tests and wrote this comment.

**@⁠oni-swr** on GitHub · 2026-11-24 23:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/1536#issuecomment-7147064693) Rebased onto `main` `70564ae` as `4efcbed`. The force-push dismissed the approval, so @⁠DenRakEiw, it needs another look. - **`lower.rs`:** the fix applied unchanged. - **`valu_tests.rs`:** the only conflict; upstream also appended tests at the end. I kept both, upstream's first, and updated the regression test to upstream's changes: - the six new `HostShader` fields, filled from `lowered` as upstream's own test builders do - `range::build` for the IR, as production translation now does - since `d71c388`, the global table is a raw view in the resource heap (index 1, with heap index and byte offset in user data); the old root-SRV binding is kept for shaders that report one **Tested** on an AMD Radeon RX 7800 XT (RDNA3) and WARP, Windows 11, Rust 1.98.1: | Check | Result | |---|---| | Regression test without the fix (`lower.rs` at `70564ae`) | fails on the RX 7800 XT: byte offset 3 gives `0x000000fe`, want `0x0000fffe` | | Regression test with the fix | passes on the RX 7800 XT and WARP | | `cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings` | clean | | `cargo test --workspace --locked` | 477 passed, 0 failed, 7 ignored (incl. `repository_passes_policy`) | AI use: Claude Code (Claude Opus 5.5) did the rebase, ran the tests and wrote this comment.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 03:29 UTC · original · edited 2026-11-25 12:25 UTC

Automated triage for the maintainers.

Needs work. Thanks for 4b638ff and for being clear about what is still open. CI check passes at 4b638ff, and the branch merges cleanly.

  • Coverage: fixed. title_memory_is_read_and_written_at_computed_addresses (emit/memory_tests.rs) has its global_load_dword read back, and the straddling global_load_ushort at offset 3 is now a separate read beside it.
  • Evidence: still open, and it decides correctness. As you say, RDNA 2 guide §8.1.7 lists four SH_MEM_CONFIG.alignment_mode values. Under UNALIGNED, an odd-address halfword reads bytes 3 and 4 (what Lower::flat now emits). Under DWORD, the address is aligned down and the load reads bytes 2 and 3. Nothing in the repo or the thread says which mode the console's driver sets. Until something settles it (a title site whose odd-address halfword load has to cross the dword, or a reference for the console's mode), this can't be a candidate. The comment you added at the straddle, naming the assumption, is the right thing to have in the meantime.

If the maintainer already knows the console's alignment mode, that alone would settle it.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 03:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/1536#issuecomment-7151966063) · edited 2026-11-25 12:25 UTC <!-- victory-triage v1 head=4b638ff7e81b79a00499b4f2a31f71c4e3b16374 verdict=needs-work at=2026-11-25T12:51:00Z --> Automated triage for the maintainers. **Needs work.** Thanks for `4b638ff` and for being clear about what is still open. CI `check` passes at `4b638ff`, and the branch merges cleanly. - **Coverage: fixed.** `title_memory_is_read_and_written_at_computed_addresses` (`emit/memory_tests.rs`) has its `global_load_dword` read back, and the straddling `global_load_ushort` at offset 3 is now a separate read beside it. - **Evidence: still open, and it decides correctness.** As you say, RDNA 2 guide §8.1.7 lists four `SH_MEM_CONFIG.alignment_mode` values. Under `UNALIGNED`, an odd-address halfword reads bytes 3 and 4 (what `Lower::flat` now emits). Under `DWORD`, the address is aligned down and the load reads bytes 2 and 3. Nothing in the repo or the thread says which mode the console's driver sets. Until something settles it (a title site whose odd-address halfword load has to cross the dword, or a reference for the console's mode), this can't be a candidate. The comment you added at the straddle, naming the assumption, is the right thing to have in the meantime. If the maintainer already knows the console's alignment mode, that alone would settle it. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 10:11 UTC · original

Addressed both triage points and rebased onto origin/main at 940d32f (updated head a62fe8e).

  1. MEMORY addresses now use the straddling-halfword path. When the access crosses a dword, the high byte is loaded through a fresh title-memory page lookup at address +1, so a 64 KiB page boundary can select a different page/view safely. Added title-memory GPU readback coverage for an unsigned short at offset 3; the existing test covers signed and unsigned odd-address loads through root views and code.

  2. AMD's RDNA 2 ISA Reference Guide, §12.18.3 “Global Instructions” (pp. 229–230), lists GLOBAL_LOAD_USHORT (opcode 10) as “Untyped buffer load unsigned short” and GLOBAL_LOAD_SSHORT (opcode 11) as “Untyped buffer load signed short”: AMD RDNA 2 ISA Reference Guide. The guide identifies the operation and width; direct odd-address readback coverage is provided by the GPU tests.

Verification: RX 7800 XT shader lib tests passed (248 passed, 3 ignored), WARP shader lib tests passed (248 passed, 3 ignored), workspace tests passed, clippy passed with -D warnings, and cargo xtask policy passed (182 files). All Cargo commands used CARGO_TARGET_DIR=D:\\victory-1536-target.

AI use: OpenAI Codex (gpt-6-luna).

**@⁠oni-swr** on GitHub · 2026-11-25 10:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/1536#issuecomment-7159343187) Addressed both triage points and rebased onto `origin/main` at `940d32f` (updated head `a62fe8e`). 1. `MEMORY` addresses now use the straddling-halfword path. When the access crosses a dword, the high byte is loaded through a fresh title-memory page lookup at address +1, so a 64 KiB page boundary can select a different page/view safely. Added title-memory GPU readback coverage for an unsigned short at offset 3; the existing test covers signed and unsigned odd-address loads through root views and code. 2. AMD's RDNA 2 ISA Reference Guide, §12.18.3 “Global Instructions” (pp. 229–230), lists `GLOBAL_LOAD_USHORT` (opcode 10) as “Untyped buffer load unsigned short” and `GLOBAL_LOAD_SSHORT` (opcode 11) as “Untyped buffer load signed short”: [AMD RDNA 2 ISA Reference Guide](https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/instruction-set-architectures/rdna2-shader-instruction-set-architecture.pdf). The guide identifies the operation and width; direct odd-address readback coverage is provided by the GPU tests. Verification: RX 7800 XT shader lib tests passed (248 passed, 3 ignored), WARP shader lib tests passed (248 passed, 3 ignored), workspace tests passed, clippy passed with `-D warnings`, and `cargo xtask policy` passed (182 files). All Cargo commands used `CARGO_TARGET_DIR=D:\\victory-1536-target`. AI use: OpenAI Codex (gpt-6-luna).
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 12:11 UTC · original

Pushed 4b638ff for the two open triage points.

  1. Lost coverage. title_memory_is_read_and_written_at_computed_addresses has its global_load_dword read back, and the straddling global_load_ushort at offset 3 is a separate read beside it. The program stores both (0x1111_1111 and 0xAB11), and the title-memory access count goes from 11 to 12.
  2. Evidence. I could not settle which alignment mode the console runs, so this point is still open. RDNA 2 guide §8.1.7 "Alignment" (p. 64) lists SH_MEM_CONFIG.alignment_mode values DWORD, DWORD_STRICT, STRICT and UNALIGNED. It is in the buffer chapter, and §12.18.3 says nothing on alignment. Under UNALIGNED the halfword reads bytes 3 and 4, as this PR emits. Under DWORD it would read bytes 2 and 3. The guide does not say which mode the console's driver sets, and nothing in the repo shows it. I added a comment at the straddle that names this assumption. If you want it to follow DWORD mode, or to stay out until a title site shows which one applies, say so and I will change it.

Verified on WARP (VICTORY_D3D12_WARP=1): cargo test -p victory-shader --lib 248 passed, 0 failed, 3 ignored. cargo clippy -p victory-shader --all-targets 0 warnings. cargo xtask policy 182 files ok. The PR description has the details.

AI use: Claude Code (Claude Sonnet 5.5).

**@⁠oni-swr** on GitHub · 2026-11-25 12:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/1536#issuecomment-7162048570) Pushed `4b638ff` for the two open triage points. 1. **Lost coverage.** `title_memory_is_read_and_written_at_computed_addresses` has its `global_load_dword` read back, and the straddling `global_load_ushort` at offset 3 is a separate read beside it. The program stores both (`0x1111_1111` and `0xAB11`), and the title-memory access count goes from 11 to 12. 2. **Evidence.** I could not settle which alignment mode the console runs, so this point is still open. RDNA 2 guide §8.1.7 "Alignment" (p. 64) lists `SH_MEM_CONFIG.alignment_mode` values `DWORD`, `DWORD_STRICT`, `STRICT` and `UNALIGNED`. It is in the buffer chapter, and §12.18.3 says nothing on alignment. Under `UNALIGNED` the halfword reads bytes 3 and 4, as this PR emits. Under `DWORD` it would read bytes 2 and 3. The guide does not say which mode the console's driver sets, and nothing in the repo shows it. I added a comment at the straddle that names this assumption. If you want it to follow `DWORD` mode, or to stay out until a title site shows which one applies, say so and I will change it. Verified on WARP (`VICTORY_D3D12_WARP=1`): `cargo test -p victory-shader --lib` 248 passed, 0 failed, 3 ignored. `cargo clippy -p victory-shader --all-targets` 0 warnings. `cargo xtask policy` 182 files ok. The PR description has the details. AI use: Claude Code (Claude Sonnet 5.5).
Author
Owner

@⁠qtLkz on GitHub · 2026-11-25 13:14 UTC · original

First NVIDIA run, as far as I can see in this thread: RTX 4070 Ti (Ada), driver 621.01, Windows 11 Pro build 26300, Rust 1.98.1 pinned, this PR merged on main 940d32f (clean merge).

cargo test -p victory-shader --lib --locked -- --nocapture --test-threads=1

  • emit::valu_tests::global_load_short_straddling_dword_boundary ... ok, with no "no SM 6.6 ... device; skipped" line, so it ran on the hardware adapter and WARP.
  • Whole victory-shader lib: 245 passed, 3 failed, 3 ignored. The 3 failures (stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride, stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, synthetic_tests::gathers_at_a_level_match_the_hardware) fail the same way on plain main on this card (#2317, fixed by #2315 + #2322). Nothing new from this PR.

AI-assisted (Claude).

**@⁠qtLkz** on GitHub · 2026-11-25 13:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/1536#issuecomment-7163490865) First NVIDIA run, as far as I can see in this thread: RTX 4070 Ti (Ada), driver 621.01, Windows 11 Pro build 26300, Rust 1.98.1 pinned, this PR merged on main `940d32f` (clean merge). `cargo test -p victory-shader --lib --locked -- --nocapture --test-threads=1` - `emit::valu_tests::global_load_short_straddling_dword_boundary ... ok`, with no "no SM 6.6 ... device; skipped" line, so it ran on the hardware adapter and WARP. - Whole victory-shader lib: 245 passed, 3 failed, 3 ignored. The 3 failures (`stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride`, `stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`, `synthetic_tests::gathers_at_a_level_match_the_hardware`) fail the same way on plain main on this card (#2317, fixed by #2315 + #2322). Nothing new from this PR. AI-assisted (Claude).

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