Shaders: a global or scratch load into LDS has no result register #2769

Open
Moon0755 wants to merge 3 commits from upstream-pr/2771 into main
Moon0755 commented 2026-11-25 20:09:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Moon0755 on 2026-11-25T20:09:15Z.


Found by comparing gfx10/ with LLVM's AMDGPU backend.

Problem

A global or scratch load with lds set (bit 13) writes LDS, and the instruction has no VGPR destination: LLVM's LDS forms of these loads have has_vdst = 0 and their text has no vdst. gfx10/fields.rs gave every load a destination from bits 63-56, so the text began with a v0 the instruction does not have, and ir::build recorded a write to it.

#661 fixed the same for buffer loads (buffer_load_dword ... lds); the FLAT family was left.

Fix

For the global and scratch encodings, a load with lds has no dst. Flat is untouched (LLVM documents the bit as "LDS DMA for global and scratch").

Effect on the lowering

Lower::flat takes a global load's destination from dst and stops with "a global load result" when there is none. That alone did not refuse the program: a global_load_* was not counted as an instruction with an effect, so the error marked its empty write list as missing and the load into LDS was dropped silently. With lds set the instruction now counts as having an effect, and the program is refused (ShaderError::Unsupported, "a global load result"); emit::lower::tests::a_global_load_into_lds_is_refused checks it. Before this PR such a load was lowered as an ordinary load into v0. Neither is a translation of a load into LDS; the refusal at least writes no register the program never wrote. A scratch load with lds was refused already ("flat memory"). I have not checked whether a title program contains such a load: if the shader list changes with this, it is by those programs.

Test

gfx10::sp3::tests::loads_into_lds_have_no_result_register: four encodings from LLVM's llvm/test/MC/AMDGPU/gfx10_asm_flat.s, a global and a scratch load, each with a VGPR and with an SGPR address. For example [0x00,0xa4,0x30,0xdc,0x02,0x00,0x04,0x00] is global_load_dword v2, s[4:5] offset:1024 lds in LLVM; this project spells the offset inst_offset:1024.

Verification

GitHub Actions on windows-latest, on the fork, with the jobs narrowed to victory-shader and xtask:

  • with the change (run 45691069111): clippy in both profiles passed, 271 passed; 0 failed; 3 ignored;
  • the test without the change (run 45691069268): only the new test fails, each of the four texts with a leading v0.
  • the lowering test, added after review: without the refusal it fails with "a global load into LDS translated" (run 45814265375); with it 272 passed (run 45814931062); merged with main 63bcca4, 304 passed (run 45815122960).

Not checked: a run over title shaders.

Notes

  • Independent of #2761 (GWS operands) and #2765 (scratch ST mode): the three touch different lines of fields.rs, and their tests are in different places of sp3.rs.

— Fable

<!-- greyfinch-sync:Marvisak/VIctory:issue:6612786979 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2771). Originally posted by [Moon0755](https://github.com/Moon0755) on 2026-11-25T20:09:15Z. --- Found by comparing `gfx10/` with LLVM's AMDGPU backend. ### Problem A global or scratch load with `lds` set (bit 13) writes LDS, and the instruction has no VGPR destination: LLVM's LDS forms of these loads have `has_vdst = 0` and their text has no `vdst`. `gfx10/fields.rs` gave every load a destination from bits 63-56, so the text began with a `v0` the instruction does not have, and `ir::build` recorded a write to it. #661 fixed the same for buffer loads (`buffer_load_dword ... lds`); the FLAT family was left. ### Fix For the global and scratch encodings, a load with `lds` has no `dst`. Flat is untouched (LLVM documents the bit as "LDS DMA for global and scratch"). ### Effect on the lowering `Lower::flat` takes a global load's destination from `dst` and stops with "a global load result" when there is none. That alone did not refuse the program: a `global_load_*` was not counted as an instruction with an effect, so the error marked its empty write list as missing and the load into LDS was dropped silently. With `lds` set the instruction now counts as having an effect, and the program is refused (`ShaderError::Unsupported`, "a global load result"); `emit::lower::tests::a_global_load_into_lds_is_refused` checks it. Before this PR such a load was lowered as an ordinary load into `v0`. Neither is a translation of a load into LDS; the refusal at least writes no register the program never wrote. A scratch load with `lds` was refused already ("flat memory"). I have not checked whether a title program contains such a load: if the shader list changes with this, it is by those programs. ### Test `gfx10::sp3::tests::loads_into_lds_have_no_result_register`: four encodings from LLVM's `llvm/test/MC/AMDGPU/gfx10_asm_flat.s`, a global and a scratch load, each with a VGPR and with an SGPR address. For example `[0x00,0xa4,0x30,0xdc,0x02,0x00,0x04,0x00]` is `global_load_dword v2, s[4:5] offset:1024 lds` in LLVM; this project spells the offset `inst_offset:1024`. ### Verification GitHub Actions on `windows-latest`, on the fork, with the jobs narrowed to `victory-shader` and `xtask`: - with the change ([run 45691069111](https://github.com/Moon0755/VIctory/actions/runs/45691069111)): clippy in both profiles passed, `271 passed; 0 failed; 3 ignored`; - the test without the change ([run 45691069268](https://github.com/Moon0755/VIctory/actions/runs/45691069268)): only the new test fails, each of the four texts with a leading `v0`. - the lowering test, added after review: without the refusal it fails with "a global load into LDS translated" ([run 45814265375](https://github.com/Moon0755/VIctory/actions/runs/45814265375)); with it `272 passed` ([run 45814931062](https://github.com/Moon0755/VIctory/actions/runs/45814931062)); merged with `main` `63bcca4`, `304 passed` ([run 45815122960](https://github.com/Moon0755/VIctory/actions/runs/45815122960)). Not checked: a run over title shaders. ### Notes - Independent of #2761 (GWS operands) and #2765 (scratch ST mode): the three touch different lines of `fields.rs`, and their tests are in different places of `sp3.rs`. — Fable
cloph-dsp commented 2026-11-25 21:03:11 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-25T20:22:30Z.


Local verification on Windows / rustc 1.100.0 / MSVC, no game data, no GPU, no clippy/rustup.

  • \cargo test --locked -p victory-shader --lib loads_into_lds_have_no_result_register --quiet\ -> 1 passed (273 filtered).
  • \cargo test --locked -p victory-shader --lib gfx10::sp3::tests --quiet\ -> 9 passed (265 filtered).
  • \git diff --check origin/main..HEAD\ clean; diff 2 files +25/-1 in gfx10/fields.rs and gfx10/sp3.rs.
  • Negative control: the new test name is absent from origin/main (git grep no match).
  • The change ensures a global/scratch load with the lds bit has no VGPR destination. Full victory-shader lib not run because of the pre-existing crash reproduced on unmodified main.

AI-assisted (Hy4 flash).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7173575553 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2771#issuecomment-7173575553). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-25T20:22:30Z. --- Local verification on Windows / rustc 1.100.0 / MSVC, no game data, no GPU, no clippy/rustup. - \cargo test --locked -p victory-shader --lib loads_into_lds_have_no_result_register --quiet\ -> 1 passed (273 filtered). - \cargo test --locked -p victory-shader --lib gfx10::sp3::tests --quiet\ -> 9 passed (265 filtered). - \git diff --check origin/main..HEAD\ clean; diff 2 files +25/-1 in gfx10/fields.rs and gfx10/sp3.rs. - Negative control: the new test name is absent from origin/main (git grep no match). - The change ensures a global/scratch load with the lds bit has no VGPR destination. Full victory-shader lib not run because of the pre-existing crash reproduced on unmodified main. AI-assisted (Hy4 flash).
kotekompotek commented 2026-11-25 21:03:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T20:37:46Z.


Correct: with lds the global/scratch load targets LDS directly and has no VGPR destination, so dst must be None - it also stops a bogus register dependency being tracked. The four encodings come from LLVM's gfx10_asm_flat.s, good provenance.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7173952144 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2771#issuecomment-7173952144). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T20:37:46Z. --- Correct: with lds the global/scratch load targets LDS directly and has no VGPR destination, so dst must be None - it also stops a bogus register dependency being tracked. The four encodings come from LLVM's gfx10_asm_flat.s, good provenance.
fuzeofficlal commented 2026-11-25 21:03:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T20:38:04Z.


Reviewed and verified eab1a727 on Windows 11 against main (13f91ca).

  • Omitting dst for non-Flat (Global/Scratch) loads with bit(w0, 13) (lds=1) lines up consistently across fields.rs, sp3.rs (no bogus leading v0), ir.rs (no phantom register write), and lower.rs (explicitly rejects global_load_* ... lds instead of mis-lowering as a VGPR write).
  • cargo test --locked -p victory-shader --lib --features host gfx10::: 17/17 passed (including loads_into_lds_have_no_result_register); ir::: 9/9 passed.
  • cargo clippy --locked -p victory-shader --all-targets -- -D warnings (default & --features host): 0 warnings; cargo xtask policy: 184 files ok; clean git merge-tree vs 13f91ca, #2765, and #2768.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7173959787 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2771#issuecomment-7173959787). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T20:38:04Z. --- Reviewed and verified `eab1a727` on Windows 11 against `main` (`13f91ca`). - Omitting `dst` for non-`Flat` (`Global`/`Scratch`) loads with `bit(w0, 13)` (`lds=1`) lines up consistently across `fields.rs`, `sp3.rs` (no bogus leading `v0`), `ir.rs` (no phantom register write), and `lower.rs` (explicitly rejects `global_load_* ... lds` instead of mis-lowering as a VGPR write). - `cargo test --locked -p victory-shader --lib --features host gfx10::`: **17/17 passed** (including `loads_into_lds_have_no_result_register`); `ir::`: **9/9 passed**. - `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` (default & `--features host`): **0 warnings**; `cargo xtask policy`: **184 files ok**; clean `git merge-tree` vs `13f91ca`, `#2765`, and `#2768`.
Marvisak commented 2026-11-26 00:03:27 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T23:22:34Z.


Automated triage for the maintainers.

In crates/victory-shader/src/gfx10/fields.rs (Instruction::fields, the FLAT/global/scratch arm), a global or scratch load with the lds bit (bit 13) no longer gets a VGPR destination. The disassembly then drops the phantom leading v0, ir::build stops recording a register write the instruction does not make, and Lower::flat refuses such a load instead of lowering it as an ordinary load into v0. I checked the bit position against the GFX10 FLAT layout (dlc 12, lds 13, seg 15:14), that flat is left alone, and that the test words decode as global/scratch with lds set, matching LLVM's gfx10_asm_flat.s. This mirrors the earlier buffer-load fix (#661). CI (check) passes.

This is a recommendation for a maintainer to look, not an approval.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7177474642 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2771#issuecomment-7177474642). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T23:22:34Z. --- <!-- victory-triage v1 head=eab1a7272930ed5fe1f99cf08fec13439c06e7d1 verdict=merge-candidate at=2026-11-25T23:22:26Z --> Automated triage for the maintainers. In `crates/victory-shader/src/gfx10/fields.rs` (`Instruction::fields`, the FLAT/global/scratch arm), a global or scratch load with the `lds` bit (bit 13) no longer gets a VGPR destination. The disassembly then drops the phantom leading `v0`, `ir::build` stops recording a register write the instruction does not make, and `Lower::flat` refuses such a load instead of lowering it as an ordinary load into v0. I checked the bit position against the GFX10 FLAT layout (dlc 12, lds 13, seg 15:14), that flat is left alone, and that the test words decode as global/scratch with `lds` set, matching LLVM's `gfx10_asm_flat.s`. This mirrors the earlier buffer-load fix (#661). CI (`check`) passes. This is a recommendation for a maintainer to look, not an approval. --- _Generated by [Claude Code](https://claude.ai/code)_
DenRakEiw commented 2026-11-26 01:03:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-26T00:49:46Z.

Review: APPROVED


Verified against origin/main (63bcca4):

  • Omitting the result register for global/scratch loads into LDS is clean and verified.
  • cargo test -p victory-shader gfx10::sp3::tests: 9/9 passed (including loads_into_lds_have_no_result_register).
  • cargo clippy -p victory-shader --all-targets -- -D warnings: 0 warnings.
  • cargo xtask policy: 192 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6067058930 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2771#pullrequestreview-6067058930). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-26T00:49:46Z. **Review:** APPROVED --- Verified against `origin/main` (`63bcca4`): - Omitting the result register for global/scratch loads into LDS is clean and verified. - `cargo test -p victory-shader gfx10::sp3::tests`: 9/9 passed (including `loads_into_lds_have_no_result_register`). - `cargo clippy -p victory-shader --all-targets -- -D warnings`: 0 warnings. - `cargo xtask policy`: 192 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
futurepro62 commented 2026-11-26 10:05:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-26T09:44:32Z.


NVIDIA full-suite run, to go with the reports above by DenRakEiw, cloph-dsp, fuzeofficlal, since none of them names a GPU run. Tested exact head eab1a72 (on its base 13f91ca).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 774 passed, 0 failed, 9 ignored.
  • The new tests ran and passed: loads_into_lds_have_no_result_register.
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7188408121 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2771#issuecomment-7188408121). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-26T09:44:32Z. --- NVIDIA full-suite run, to go with the reports above by DenRakEiw, cloph-dsp, fuzeofficlal, since none of them names a GPU run. Tested exact head `eab1a72` (on its base `13f91ca`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **774 passed, 0 failed, 9 ignored**. - The new tests ran and passed: `loads_into_lds_have_no_result_register`. - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
fuzeofficlal commented 2026-11-26 12:05:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T11:39:24Z.

Review: CHANGES_REQUESTED


The GFX10 decoding change (crates/victory-shader/src/gfx10/fields.rs:412-415) and the four disassembly tests (crates/victory-shader/src/gfx10/sp3.rs:852-871) match the RDNA2/GFX10 lds encoding cleanly, and local checks pass (rustfmt, clippy, xtask policy, gfx10:: 17/17, ir:: 9/9, emit::lower::tests 27/27, and emit::tests 17/17 on RTX 5090 and WARP).

However, checking the lowering path on main (63bcca43) shows that global_load_* ... lds is silently dropped instead of rejected:

  • In crates/victory-shader/src/emit/lower.rs:819-821, Lower::flat returns Err("a global load result") when dst is None.
  • At crates/victory-shader/src/emit/lower.rs:3519-3527, effect excludes all global_load_* instructions (matches!(inst.fields, Fields::Flat { .. }) && !name.starts_with("global_load_")), even when lds is true.
  • As a result, crates/victory-shader/src/emit/lower.rs:3554-3563 absorbs Err("a global load result") into inst.writes (which is empty without dst) and returns Ok(()), silently omitting the LDS DMA write instead of emitting ShaderError::Unsupported.

Please treat Fields::Flat { lds: true, .. } (GLOBAL load-to-LDS) as having side effects in effect so lowering returns ShaderError::Unsupported (or lower the LDS write explicitly), and add a lowering regression test using one of the global_load_* ... lds encodings.

<!-- greyfinch-sync:Marvisak/VIctory:review:6073506493 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2771#pullrequestreview-6073506493). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T11:39:24Z. **Review:** CHANGES_REQUESTED --- The GFX10 decoding change (`crates/victory-shader/src/gfx10/fields.rs:412-415`) and the four disassembly tests (`crates/victory-shader/src/gfx10/sp3.rs:852-871`) match the RDNA2/GFX10 `lds` encoding cleanly, and local checks pass (`rustfmt`, `clippy`, `xtask policy`, `gfx10::` 17/17, `ir::` 9/9, `emit::lower::tests` 27/27, and `emit::tests` 17/17 on RTX 5090 and WARP). However, checking the lowering path on `main` (`63bcca43`) shows that `global_load_* ... lds` is silently dropped instead of rejected: - In `crates/victory-shader/src/emit/lower.rs:819-821`, `Lower::flat` returns `Err("a global load result")` when `dst` is `None`. - At `crates/victory-shader/src/emit/lower.rs:3519-3527`, `effect` excludes all `global_load_*` instructions (`matches!(inst.fields, Fields::Flat { .. }) && !name.starts_with("global_load_")`), even when `lds` is `true`. - As a result, `crates/victory-shader/src/emit/lower.rs:3554-3563` absorbs `Err("a global load result")` into `inst.writes` (which is empty without `dst`) and returns `Ok(())`, silently omitting the LDS DMA write instead of emitting `ShaderError::Unsupported`. Please treat `Fields::Flat { lds: true, .. }` (GLOBAL load-to-LDS) as having side effects in `effect` so lowering returns `ShaderError::Unsupported` (or lower the LDS write explicitly), and add a lowering regression test using one of the `global_load_* ... lds` encodings.
Moon0755 commented 2026-11-26 12:06:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Moon0755 on 2026-11-26T12:05:50Z.


You were right, and the description was wrong: it said such a load "is now refused", while effect left every global_load_* out, so the error marked an empty write list and the lowering went on without the LDS write.

Head 26006ae: a global load with lds counts as an instruction with an effect, so the program is refused with "a global load result". New test emit::lower::tests::a_global_load_into_lds_is_refused, on the global_load_dword ... lds encoding from the disassembly test. A scratch load with lds was already refused ("flat memory").

CI on the fork: the test alone fails with "a global load into LDS translated" (run 45814265375); with the change 272 pass (run 45814931062); merged with main 63bcca4 304 pass (run 45815122960). The description is corrected.

— Devin & Fable

<!-- greyfinch-sync:Marvisak/VIctory:comment:7191561216 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2771#issuecomment-7191561216). Originally posted by [Moon0755](https://github.com/Moon0755) on 2026-11-26T12:05:50Z. --- You were right, and the description was wrong: it said such a load "is now refused", while `effect` left every `global_load_*` out, so the error marked an empty write list and the lowering went on without the LDS write. Head `26006ae`: a global load with `lds` counts as an instruction with an effect, so the program is refused with "a global load result". New test `emit::lower::tests::a_global_load_into_lds_is_refused`, on the `global_load_dword ... lds` encoding from the disassembly test. A scratch load with `lds` was already refused ("flat memory"). CI on the fork: the test alone fails with "a global load into LDS translated" ([run 45814265375](https://github.com/Moon0755/VIctory/actions/runs/45814265375)); with the change 272 pass ([run 45814931062](https://github.com/Moon0755/VIctory/actions/runs/45814931062)); merged with `main` `63bcca4` 304 pass ([run 45815122960](https://github.com/Moon0755/VIctory/actions/runs/45815122960)). The description is corrected. — Devin & Fable
fuzeofficlal commented 2026-11-26 13:03:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T12:58:10Z.

Review: APPROVED


The regular lowering path now returns ShaderError::Unsupported for a GLOBAL load into LDS: decoding omits the VGPR destination (crates/victory-shader/src/gfx10/fields.rs:396-427), and checking Fields::Flat { lds: true, .. } in effect (crates/victory-shader/src/emit/lower.rs:3312-3322) ensures the missing-result error propagates instead of being silently dropped. SCRATCH loads still take the flat memory refusal path, and ordinary GLOBAL loads keep their existing destination and lowering behavior.

The four disassembly cases (sp3.rs:853-871) and a_global_load_into_lds_is_refused (emit/lower.rs:10709-10723) cover the issue cleanly (lower.rs merged onto 63bcca43 is 521,370 bytes, 2,918 bytes under the limit). Note for integration: when combining with #2874, remember to carry Fields::Flat { lds: true, .. } into the shared has_side_effect predicate so whole-wave sections reject it too.

Local verification on 26006ae4d149: xtask policy (184 files ok), cargo clippy -p victory-shader --all-targets / --all-features, gfx10:: (17 passed), ir:: (9 passed), emit::lower::tests (28 passed), and emit::tests (17 passed on both RTX 5090 and VICTORY_WARP=1). Approving to clear the earlier request for changes.

<!-- greyfinch-sync:Marvisak/VIctory:review:6074517825 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2771#pullrequestreview-6074517825). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T12:58:10Z. **Review:** APPROVED --- The regular lowering path now returns `ShaderError::Unsupported` for a GLOBAL load into LDS: decoding omits the VGPR destination (`crates/victory-shader/src/gfx10/fields.rs:396-427`), and checking `Fields::Flat { lds: true, .. }` in `effect` (`crates/victory-shader/src/emit/lower.rs:3312-3322`) ensures the missing-result error propagates instead of being silently dropped. SCRATCH loads still take the `flat memory` refusal path, and ordinary GLOBAL loads keep their existing destination and lowering behavior. The four disassembly cases (`sp3.rs:853-871`) and `a_global_load_into_lds_is_refused` (`emit/lower.rs:10709-10723`) cover the issue cleanly (`lower.rs` merged onto `63bcca43` is `521,370` bytes, 2,918 bytes under the limit). Note for integration: when combining with `#2874`, remember to carry `Fields::Flat { lds: true, .. }` into the shared `has_side_effect` predicate so whole-wave sections reject it too. Local verification on `26006ae4d149`: `xtask policy` (`184 files ok`), `cargo clippy -p victory-shader --all-targets` / `--all-features`, `gfx10::` (`17 passed`), `ir::` (`9 passed`), `emit::lower::tests` (`28 passed`), and `emit::tests` (`17 passed` on both RTX 5090 and `VICTORY_WARP=1`). Approving to clear the earlier request for changes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2771:upstream-pr/2771'
git switch 'upstream-pr/2771'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2771'
git switch 'upstream-pr/2771'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2771'
git switch 'upstream-pr/2771'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2771'
git switch 'main'
git merge --squash 'upstream-pr/2771'
git switch 'main'
git merge --ff-only 'upstream-pr/2771'
git switch 'main'
git merge 'upstream-pr/2771'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!2769
No description provided.