Shader tests: cover the merged geometry user-data layout #2284

Open
github-bot wants to merge 1 commit from github-bot/gh-2284 into main AGit
Owner

@⁠Halfect on GitHub · 2026-11-25 09:42 UTC · original
Halfect:fix/geometry-user-data-placement → main · +93 −0 · 1 files · 1 commits · open

Test coverage only; no production code changes. (Earlier revisions changed the placement rule; review showed main already places GS user data after the eight system SGPRs, so what remains useful is pinning that behavior, which had no geometry-stage coverage.)

A geometry shader on gfx9+ always runs merged — the second half of ES+GS — with eight system SGPRs before its user data (AMD's RDNA 2 ISA "Geometry Shader (ES+GS)" initial-SGPR table; LLVM's SIMachineFunctionInfo::getGITPtrLoReg: the first user-data SGPR "is passed in s8 rather than s0 for an LS+HS or ES+GS merged shader on gfx9+"). HwStage::user_sgpr already returns index + 8 for HwStage::Gs, and resource tracking resolves through it.

Four tests pin that placement:

  • geometry_user_data_is_found_in_the_merged_layout: a merged GS's table load resolves to its root parameter.
  • a_standalone_geometry_layout_is_not_recognized: a standalone-shaped program (load base traced to s0) is refused with the root-parameter error, rather than reading the s0-s1 GS user-data address as user data.
  • geometry_root_descriptors_use_the_merged_layout: a root descriptor in user data resolves through the merged layout.
  • a_merged_geometry_shader_keeps_its_system_sgprs_out_of_the_root_parameters: a read of a system SGPR (s4) stays a system value and is not attributed to user data.

Validation on bf5d8a7 (Windows, CPU-only; no GPU, no game data):

  • cargo test --locked -p victory-shader --lib resource::: 37 passed, 0 failed, including the four new tests.
  • cargo clippy --locked -p victory-shader --lib --tests -- -D warnings: clean.

AI-assisted: Kimi.

**@⁠Halfect** on GitHub · 2026-11-25 09:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/2284) `Halfect:fix/geometry-user-data-placement` → `main` · +93 −0 · 1 files · 1 commits · open Test coverage only; no production code changes. (Earlier revisions changed the placement rule; review showed main already places GS user data after the eight system SGPRs, so what remains useful is pinning that behavior, which had no geometry-stage coverage.) A geometry shader on gfx9+ always runs merged — the second half of ES+GS — with eight system SGPRs before its user data (AMD's RDNA 2 ISA "Geometry Shader (ES+GS)" initial-SGPR table; LLVM's `SIMachineFunctionInfo::getGITPtrLoReg`: the first user-data SGPR "is passed in s8 rather than s0 for an LS+HS or ES+GS merged shader on gfx9+"). `HwStage::user_sgpr` already returns `index + 8` for `HwStage::Gs`, and resource tracking resolves through it. Four tests pin that placement: - `geometry_user_data_is_found_in_the_merged_layout`: a merged GS's table load resolves to its root parameter. - `a_standalone_geometry_layout_is_not_recognized`: a standalone-shaped program (load base traced to `s0`) is refused with the root-parameter error, rather than reading the `s0`-`s1` GS user-data *address* as user data. - `geometry_root_descriptors_use_the_merged_layout`: a root descriptor in user data resolves through the merged layout. - `a_merged_geometry_shader_keeps_its_system_sgprs_out_of_the_root_parameters`: a read of a system SGPR (`s4`) stays a system value and is not attributed to user data. Validation on `bf5d8a7` (Windows, CPU-only; no GPU, no game data): - `cargo test --locked -p victory-shader --lib resource::`: **37 passed, 0 failed**, including the four new tests. - `cargo clippy --locked -p victory-shader --lib --tests -- -D warnings`: clean. AI-assisted: Kimi.
A geometry shader on gfx9+ always runs merged — the second half of ES+GS —
with eight system SGPRs before its user data (AMD's RDNA 2 ISA "Geometry
Shader (ES+GS)" initial-SGPR table; LLVM's SIMachineFunctionInfo::
getGITPtrLoReg: the first user-data SGPR "is passed in s8 rather than s0
for an LS+HS or ES+GS merged shader on gfx9+"). HwStage::user_sgpr already
returns index + 8 for HwStage::Gs; these tests pin that placement, which
previously had no geometry-stage coverage:

- a merged GS's table load resolves to its root parameter;
- a standalone-shaped program is refused with the root-parameter error
  rather than read through the s0-s1 GS user-data *address*;
- a root descriptor in user data resolves through the merged layout;
- a read of a system SGPR stays a system value and is not attributed to
  user data.

No production code changes.

AI-assisted: Kimi.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:00:54 +00:00
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-25 10:17 UTC · original

Offline measurement on a retail dump

Result: no count change against main.

I merged head 96d92ab5 onto main 940d32f (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: 23,918 on main, 23,918 with this PR.

195 programs that fail on both change their failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.

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

**@⁠sinan-cmyk** on GitHub · 2026-11-25 10:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/2284#issuecomment-7159493381) ### Offline measurement on a retail dump **Result: no count change against `main`.** I merged head 96d92ab5 onto `main` 940d32f (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: 23,918 on `main`, 23,918 with this PR. 195 programs that fail on both change their failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Author
Owner

@⁠Halfect on GitHub · 2026-11-25 10:43 UTC · original

Thanks @⁠sinan-cmyk for the archive A/B.

The 195 reason changes with an unchanged validated count are the expected signature of this fix: programs that stopped at GS user-data recognition now get past it and stop at their real next limitation (or emit differently), so failure reasons move without any program gaining or losing validation. That is also the most this placement-only slice can show on its own — the correctness of what those programs then do depends on the rest of #2268 (the table-base high-half and mask work deliberately left out here), so "rejects nothing, changes no outcome" is exactly the safe shape for this step. Nothing further from my side; ready for review.

**@⁠Halfect** on GitHub · 2026-11-25 10:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/2284#issuecomment-7160089268) Thanks @⁠sinan-cmyk for the archive A/B. The 195 reason changes with an unchanged validated count are the expected signature of this fix: programs that stopped at GS user-data recognition now get past it and stop at their real next limitation (or emit differently), so failure reasons move without any program gaining or losing validation. That is also the most this placement-only slice can show on its own — the correctness of what those programs then do depends on the rest of #2268 (the table-base high-half and mask work deliberately left out here), so "rejects nothing, changes no outcome" is exactly the safe shape for this step. Nothing further from my side; ready for review.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 13:33 UTC · original · edited 2026-11-26 00:23 UTC

Automated triage for the maintainers.

Merge candidate (test-only). The head 0a6b163 makes the change the last triage asked for. a_merged_geometry_shader_keeps_its_system_sgprs_out_of_the_root_parameters (crates/victory-shader/src/resource.rs) now starts with s_mov_b32 s20, s4 (0xBE94_0304, checked), so system SGPR s4 is read before s_load_dwordx8 s[0:7] overwrites it. The r.params == [(0, 0)] assertion therefore shows that s4 is not taken as user-data dword 4. The other three HwStage::Gs tests are unchanged and pin main's merged layout; production code is untouched. CI check passes and it merges cleanly.

On your reply: confirmed, the fixture now tests what its name says.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 13:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/2284#issuecomment-7163947905) · edited 2026-11-26 00:23 UTC <!-- victory-triage v1 head=0a6b163e95e44d88789efbbaf53f0f7f89002b27 verdict=merge-candidate at=2026-11-26T00:23:17Z --> Automated triage for the maintainers. **Merge candidate (test-only).** The head `0a6b163` makes the change the last triage asked for. `a_merged_geometry_shader_keeps_its_system_sgprs_out_of_the_root_parameters` (`crates/victory-shader/src/resource.rs`) now starts with `s_mov_b32 s20, s4` (`0xBE94_0304`, checked), so system SGPR `s4` is read before `s_load_dwordx8 s[0:7]` overwrites it. The `r.params == [(0, 0)]` assertion therefore shows that `s4` is not taken as user-data dword 4. The other three `HwStage::Gs` tests are unchanged and pin `main`'s merged layout; production code is untouched. CI `check` passes and it merges cleanly. On your reply: confirmed, the fixture now tests what its name says. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

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

Thanks — both points addressed in 29aebd5.

Ambiguity (per-register try-both). Replaced by a per-program choice: nothing in a GS's metadata says standalone vs merged, so the program's own reads decide — the placement resolving more of its SGPR inputs to root parameters wins, and ties go to merged, the only placement the hardware runs. param_of/param_word now use only the chosen placement, so a merged program's read of a system SGPR such as s2/s3 can no longer be taken for user-data dword 2/3. A new synthetic test (a_merged_geometry_shader_keeps_its_system_sgprs_out_of_the_root_parameters) covers exactly that case: a merged GS reading s8 (user data) and s4 (system) attributes only the s8 read to the root parameter.

Evidence for a standalone layout. The title's own programs: #2268 measured, against 940d32f, 195 GS programs failing an address in an SGPR that is no root parameter under the s8-only layout; 28 of them resolve only with user data at s0, the remaining 167 only at s8 — both layouts occur in the title's binaries. The console compiler emits these GS programs as standalone binaries in their own FSSM slots following the standalone-stage convention (user data from s0), while the 8-register prefix is the GFX9+ merged ES/GS layout — which is also why the per-program tie-break favors merged.

On what this changes in the output: agreed that is not yet known — translate never emits GS, and the published corpus A/B (no validation-count change, 195 failure-reason moves) was run on the previous head. The per-program rule keeps the resolutions that run relied on for the two resolved classes (for a program whose reads all sit in s0–s7 the merged placement resolves nothing, and vice versa); I cannot re-run the corpus here (no title data), so a fresh A/B on 29aebd5 would be welcome.

Validation on the new head: cargo test --locked -p victory-shader --lib 243 passed / 0 failed (3 ignored) — the only failures anywhere are three D3D12-device dispatch tests that fail identically on the base revision on this machine; clippy -D warnings, cargo xtask policy (182 files ok), git diff --check all clean.

**@⁠Halfect** on GitHub · 2026-11-25 14:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/2284#issuecomment-7165266901) Thanks — both points addressed in `29aebd5`. **Ambiguity (per-register try-both).** Replaced by a per-program choice: nothing in a GS's metadata says standalone vs merged, so the program's own reads decide — the placement resolving more of its SGPR inputs to root parameters wins, and ties go to merged, the only placement the hardware runs. `param_of`/`param_word` now use only the chosen placement, so a merged program's read of a system SGPR such as `s2`/`s3` can no longer be taken for user-data dword 2/3. A new synthetic test (`a_merged_geometry_shader_keeps_its_system_sgprs_out_of_the_root_parameters`) covers exactly that case: a merged GS reading `s8` (user data) and `s4` (system) attributes only the `s8` read to the root parameter. **Evidence for a standalone layout.** The title's own programs: #2268 measured, against `940d32f`, 195 GS programs failing `an address in an SGPR that is no root parameter` under the s8-only layout; 28 of them resolve only with user data at `s0`, the remaining 167 only at `s8` — both layouts occur in the title's binaries. The console compiler emits these GS programs as standalone binaries in their own FSSM slots following the standalone-stage convention (user data from `s0`), while the 8-register prefix is the GFX9+ merged ES/GS layout — which is also why the per-program tie-break favors merged. On what this changes in the output: agreed that is not yet known — `translate` never emits GS, and the published corpus A/B (no validation-count change, 195 failure-reason moves) was run on the previous head. The per-program rule keeps the resolutions that run relied on for the two resolved classes (for a program whose reads all sit in `s0`–`s7` the merged placement resolves nothing, and vice versa); I cannot re-run the corpus here (no title data), so a fresh A/B on `29aebd5` would be welcome. Validation on the new head: `cargo test --locked -p victory-shader --lib` 243 passed / 0 failed (3 ignored) — the only failures anywhere are three D3D12-device dispatch tests that fail identically on the base revision on this machine; clippy `-D warnings`, `cargo xtask policy` (182 files ok), `git diff --check` all clean.
Author
Owner

@⁠tyr0nsur on GitHub · 2026-11-25 15:05 UTC · original

Fresh A/B of the requested 195 geometry programs. I built the official unmodified 940d32f69b22 and PR 29aebd50ebc1 release CLIs and ran translate --list --validate --jobs 4 on exactly the same 195 containers.

Resource tracking outcome main PR head
Address SGPR does not map to a root parameter 195 167
Descriptor-heap address has an untracked high half 0 28
Resource tracking completes 0 0

I also reproduced the ambiguous-placement case on the PR head. In a_merged_geometry_shader_keeps_its_system_sgprs_out_of_the_root_parameters, the original fixture’s actual IR scalar inputs are [8]. Its s_load_dwordx8 s[0:7] overwrites s4 before s_mov_b32 s6, s4, so the latter reads the load result. The tracer selects shift 8 and tracks the table.

Prepending these three source-authored instructions to the same fixture keeps all three system reads live as IR inputs while leaving the same s8 table load in place:

s_mov_b32 s20, s2
s_mov_b32 s21, s3
s_mov_b32 s22, s4

The IR now reports [2,3,4,8], geometry_user_shift selects 0, and track refuses that table load with the root-parameter error. This provides a small CPU regression for the placement heuristic. The archive comparison counts diagnostic changes only and does not establish which layout the console configured. AI assistance: OpenAI Codex (GPT-6) prepared and ran the checks.

**@⁠tyr0nsur** on GitHub · 2026-11-25 15:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/2284#issuecomment-7166282444) Fresh A/B of the requested 195 geometry programs. I built the official unmodified `940d32f69b22` and PR `29aebd50ebc1` release CLIs and ran `translate --list --validate --jobs 4` on exactly the same 195 containers. | Resource tracking outcome | main | PR head | | --- | ---: | ---: | | Address SGPR does not map to a root parameter | 195 | 167 | | Descriptor-heap address has an untracked high half | 0 | 28 | | Resource tracking completes | 0 | 0 | I also reproduced the ambiguous-placement case on the PR head. In `a_merged_geometry_shader_keeps_its_system_sgprs_out_of_the_root_parameters`, the original fixture’s actual IR scalar inputs are **[8]**. Its `s_load_dwordx8 s[0:7]` overwrites `s4` before `s_mov_b32 s6, s4`, so the latter reads the load result. The tracer selects shift 8 and tracks the table. Prepending these three source-authored instructions to the same fixture keeps all three system reads live as IR inputs while leaving the same `s8` table load in place: ```asm s_mov_b32 s20, s2 s_mov_b32 s21, s3 s_mov_b32 s22, s4 ``` The IR now reports **[2,3,4,8]**, `geometry_user_shift` selects **0**, and `track` refuses that table load with the root-parameter error. This provides a small CPU regression for the placement heuristic. The archive comparison counts diagnostic changes only and does not establish which layout the console configured. AI assistance: OpenAI Codex (GPT-6) prepared and ran the checks.
Author
Owner

@⁠Halfect on GitHub · 2026-11-25 15:19 UTC · original

Thanks — the read-count failure mode was real, and it is fixed in 31493a0 by switching the decision to a setup signal rather than a count of reads.

The signal. Only user data can form the base address of a scalar load: a system SGPR (wave info, offsets) is moved and compared but never addresses one. The choice now counts, per placement, just the inputs that a scalar access's sbase traces back to through copies — using the same copy propagation the tracer already runs, so s_mov_b32 s2, s8 followed by a load from s[2:3] counts as an s8 address read. A merged GS that reads s2/s3/s4 (wave info, offsets) plus one s8 table now scores 1 for merged, 0 for standalone, however many system SGPRs it reads. Your suggested test is added verbatim in spirit: system_reads_do_not_tip_a_merged_geometry_shader_to_the_standalone_layout reads s2, s3, s4 plus one s8-based table; on the previous head the count picked standalone (3 resolved system reads against 1) and attributed s2-s4 to the table, while the new head keeps them as system values and resolves only the table base. The earlier merged-GS test and the standalone/merged pair still pass unchanged.

Evidence for the standalone layout. Two public sources, matching your "Mesa/LLVM register setup" option:

  • LLVM's AMDGPU backend, SIMachineFunctionInfo::getGITPtrLoReg: the global internal table pointer — the first user-data SGPR — "is passed in s8 rather than s0 for an LS+HS or ES+GS merged shader on gfx9+", i.e. s0 is the non-merged placement and the 8-register prefix is exactly the merged-stage convention. https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
  • AMD's own RDNA 2 ISA reference, the "Geometry Shader (ES+GS)" initial-SGPR table: SGPRs 0-7 are system values (GS user-data address, ring offset, wave info, LDS base, scratch, shader address), with "0..32 user data registers of GS shader" only after them — the merged layout's 8-register prefix, from the hardware vendor's documentation. https://www.techpowerup.com/gpu-specs/docs/amd-rdna2-isa.pdf

That the title's binaries contain both placements remains the corpus measurement from #2268: against 940d32f, 195 GS programs failed an address in an SGPR that is no root parameter under an s8-only layout; 28 resolve only with user data at s0, 167 only at s8. A program whose s0-s7 reads merely land inside a root parameter produces no signal under the new rule at all — reads that are never a load's base are not counted — so the 28 cannot be an artifact of incidental overlap: each of them has a load whose base traces to s0-s7.

Corpus A/B. I cannot re-run it here (no title data), so a fresh A/B on 31493a0 would be welcome. The resolutions the previous run relied on are preserved: for a program whose load bases all sit in s0-s7 (or all in s8 up), the address-based rule resolves exactly the set the read-count rule resolved, so the two resolved classes are unchanged by construction.

Validation on this head (Windows): cargo test --locked -p victory-shader --lib resource:: 37 passed / 0 failed including the new test; the full library suite is 248 passed with the only failures being the three D3D12-device dispatch tests that fail identically on the unmodified base revision on this machine (re-verified just now); clippy -D warnings clean; cargo xtask policy 182 files ok; git diff --check clean. CPU-only checks; no GPU, no game data.

**@⁠Halfect** on GitHub · 2026-11-25 15:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2284#issuecomment-7166671182) Thanks — the read-count failure mode was real, and it is fixed in `31493a0` by switching the decision to a setup signal rather than a count of reads. **The signal.** Only user data can form the base address of a scalar load: a system SGPR (wave info, offsets) is moved and compared but never addresses one. The choice now counts, per placement, just the inputs that a scalar access's `sbase` traces back to through copies — using the same copy propagation the tracer already runs, so `s_mov_b32 s2, s8` followed by a load from `s[2:3]` counts as an `s8` address read. A merged GS that reads `s2`/`s3`/`s4` (wave info, offsets) plus one `s8` table now scores 1 for merged, 0 for standalone, however many system SGPRs it reads. Your suggested test is added verbatim in spirit: `system_reads_do_not_tip_a_merged_geometry_shader_to_the_standalone_layout` reads `s2`, `s3`, `s4` plus one `s8`-based table; on the previous head the count picked standalone (3 resolved system reads against 1) and attributed `s2`-`s4` to the table, while the new head keeps them as system values and resolves only the table base. The earlier merged-GS test and the standalone/merged pair still pass unchanged. **Evidence for the standalone layout.** Two public sources, matching your "Mesa/LLVM register setup" option: - LLVM's AMDGPU backend, `SIMachineFunctionInfo::getGITPtrLoReg`: the global internal table pointer — the first user-data SGPR — "is passed in s8 rather than s0 for an LS+HS or ES+GS merged shader on gfx9+", i.e. s0 is the non-merged placement and the 8-register prefix is exactly the merged-stage convention. https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp - AMD's own RDNA 2 ISA reference, the "Geometry Shader (ES+GS)" initial-SGPR table: SGPRs 0-7 are system values (GS user-data address, ring offset, wave info, LDS base, scratch, shader address), with "0..32 user data registers of GS shader" only after them — the merged layout's 8-register prefix, from the hardware vendor's documentation. https://www.techpowerup.com/gpu-specs/docs/amd-rdna2-isa.pdf That the title's binaries contain *both* placements remains the corpus measurement from #2268: against `940d32f`, 195 GS programs failed `an address in an SGPR that is no root parameter` under an s8-only layout; 28 resolve only with user data at s0, 167 only at s8. A program whose `s0`-`s7` reads merely land inside a root parameter produces no signal under the new rule at all — reads that are never a load's base are not counted — so the 28 cannot be an artifact of incidental overlap: each of them has a load whose base traces to `s0`-`s7`. **Corpus A/B.** I cannot re-run it here (no title data), so a fresh A/B on `31493a0` would be welcome. The resolutions the previous run relied on are preserved: for a program whose load bases all sit in `s0`-`s7` (or all in `s8` up), the address-based rule resolves exactly the set the read-count rule resolved, so the two resolved classes are unchanged by construction. Validation on this head (Windows): `cargo test --locked -p victory-shader --lib resource::` 37 passed / 0 failed including the new test; the full library suite is 248 passed with the only failures being the three D3D12-device dispatch tests that fail identically on the unmodified base revision on this machine (re-verified just now); clippy `-D warnings` clean; `cargo xtask policy` 182 files ok; `git diff --check` clean. CPU-only checks; no GPU, no game data.
Author
Owner

@⁠Halfect on GitHub · 2026-11-25 18:14 UTC · original

Both points accepted — the standalone branch is removed in 1ecc1dc.

The rule's premise. Agreed, the hole is real: the AMD ES+GS table itself puts a GS user-data address in s0-s1, so a merged program that loads through that pointer and has no s8-based load would score for standalone and have its system pointer read as a root parameter. Any per-program rule built on "which inputs address a load" inherits that confusion, because the dereference of the s0-s1 pointer is exactly the case it cannot see. Rather than patch the heuristic, the placement is no longer chosen: a GS on gfx9+ always runs merged, so the eight-register prefix applies unconditionally and s0-s7 are never root parameters.

Evidence for a standalone GS. There is none I can find, and I stop claiming one. LLVM's getGITPtrLoReg shows a gfx9+ GS is always merged, and no public source documents a standalone GS register layout on GFX10. The 28 programs are consistent with that: their s0-based loads stop at an untracked high half next — the signature of a merged program dereferencing the s0-s1 GS user-data address, s1 being the pointer's high half — not of user data living at s0. Recognizing that dereference (follow the pointer, then read the table) is left to future work; the comment on Tracer::user_shift says as much.

What changes. Against the published A/B classes: the 28 return to main's failure state (an address in an SGPR that is no root parameter — they were never validated, so nothing is lost), and the 167 merged-layout resolutions are retained. The branch is rebased onto 13f91ca and squashed to a single commit; title and body are updated to match.

Validation on 1ecc1dc (Windows, CPU-only): cargo test --locked -p victory-shader --lib resource:: 37 passed / 0 failed, including a new negative test (a_standalone_geometry_layout_is_not_recognized) proving a standalone-shaped program is refused with the root-parameter error instead of reading s0; the full library suite is 270 passed with the only failures being the three D3D12-device dispatch tests that fail identically on the unmodified base revision on this machine; clippy -D warnings clean; cargo xtask policy 184 files ok; git diff --check clean. A fresh corpus A/B on this head would be welcome.

AI-assisted: Kimi.

**@⁠Halfect** on GitHub · 2026-11-25 18:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/2284#issuecomment-7170634338) Both points accepted — the standalone branch is removed in `1ecc1dc`. **The rule's premise.** Agreed, the hole is real: the AMD ES+GS table itself puts a GS user-data *address* in `s0`-`s1`, so a merged program that loads through that pointer and has no `s8`-based load would score for standalone and have its system pointer read as a root parameter. Any per-program rule built on "which inputs address a load" inherits that confusion, because the dereference of the `s0`-`s1` pointer is exactly the case it cannot see. Rather than patch the heuristic, the placement is no longer chosen: a GS on gfx9+ always runs merged, so the eight-register prefix applies unconditionally and `s0`-`s7` are never root parameters. **Evidence for a standalone GS.** There is none I can find, and I stop claiming one. LLVM's `getGITPtrLoReg` shows a gfx9+ GS is *always* merged, and no public source documents a standalone GS register layout on GFX10. The 28 programs are consistent with that: their `s0`-based loads stop at an untracked high half next — the signature of a merged program dereferencing the `s0`-`s1` GS user-data address, `s1` being the pointer's high half — not of user data living at `s0`. Recognizing that dereference (follow the pointer, then read the table) is left to future work; the comment on `Tracer::user_shift` says as much. **What changes.** Against the published A/B classes: the 28 return to main's failure state (`an address in an SGPR that is no root parameter` — they were never validated, so nothing is lost), and the 167 merged-layout resolutions are retained. The branch is rebased onto `13f91ca` and squashed to a single commit; title and body are updated to match. Validation on `1ecc1dc` (Windows, CPU-only): `cargo test --locked -p victory-shader --lib resource::` 37 passed / 0 failed, including a new negative test (`a_standalone_geometry_layout_is_not_recognized`) proving a standalone-shaped program is refused with the root-parameter error instead of reading `s0`; the full library suite is 270 passed with the only failures being the three D3D12-device dispatch tests that fail identically on the unmodified base revision on this machine; clippy `-D warnings` clean; `cargo xtask policy` 184 files ok; `git diff --check` clean. A fresh corpus A/B on this head would be welcome. AI-assisted: Kimi.
Author
Owner

@⁠Halfect on GitHub · 2026-11-25 19:05 UTC · original

Done — pushed bf5d8a7, the tests-only version you outlined.

  • native.rs and Tracer are now byte-identical to main: HwStage::user_sgpr keeps returning index + 8 for HwStage::Gs, and there is no user_shift. The public function no longer contradicts its doc comment.
  • What remains is the four GS tests, which pass unchanged against main's production code (they pin the placement that was already there): the merged-layout table resolution, the standalone-layout refusal, the merged root-descriptor resolution, and the system-SGPR exclusion.

Validation on bf5d8a7 (Windows, CPU-only): cargo test --locked -p victory-shader --lib resource:: 37 passed / 0 failed, including the four new tests; clippy -D warnings clean. Title and body updated to match.

AI-assisted: Kimi.

**@⁠Halfect** on GitHub · 2026-11-25 19:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/2284#issuecomment-7171804085) Done — pushed `bf5d8a7`, the tests-only version you outlined. - `native.rs` and `Tracer` are now byte-identical to main: `HwStage::user_sgpr` keeps returning `index + 8` for `HwStage::Gs`, and there is no `user_shift`. The public function no longer contradicts its doc comment. - What remains is the four GS tests, which pass unchanged against main's production code (they pin the placement that was already there): the merged-layout table resolution, the standalone-layout refusal, the merged root-descriptor resolution, and the system-SGPR exclusion. Validation on `bf5d8a7` (Windows, CPU-only): `cargo test --locked -p victory-shader --lib resource::` 37 passed / 0 failed, including the four new tests; clippy `-D warnings` clean. Title and body updated to match. AI-assisted: Kimi.
Author
Owner

@⁠Halfect on GitHub · 2026-11-25 20:36 UTC · original

Fixed in 0a6b163 — the system read now runs before the load.

  • a_merged_geometry_shader_keeps_its_system_sgprs_out_of_the_root_parameters now starts with s_mov_b32 s20, s4 (0xBE94_0304), so the program's read of system SGPR s4 is live before s_load_dwordx8 s[0:7] overwrites it; the trailing s_mov_b32 s6, s4, which read the load's result, is removed. The r.params == [(0, 0)] assertion now pins what the name says: with the eight-register prefix s4 is a system value and not user-data dword 4 — a standalone placement would attribute it to the parameter and fail the assertion. The load's site moves to (0, 3) with the extra instruction; the other three GS tests are unchanged.

Validation on 0a6b163 (Windows, CPU-only): cargo test --locked -p victory-shader --lib resource:: 37 passed, 0 failed, including the fixed test; cargo clippy --locked -p victory-shader --lib --tests -- -D warnings clean; cargo xtask policy 184 files ok; git diff --check clean.

AI-assisted: Kimi.

**@⁠Halfect** on GitHub · 2026-11-25 20:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/2284#issuecomment-7173915847) Fixed in `0a6b163` — the system read now runs before the load. - `a_merged_geometry_shader_keeps_its_system_sgprs_out_of_the_root_parameters` now starts with `s_mov_b32 s20, s4` (`0xBE94_0304`), so the program's read of system SGPR `s4` is live before `s_load_dwordx8 s[0:7]` overwrites it; the trailing `s_mov_b32 s6, s4`, which read the load's result, is removed. The `r.params == [(0, 0)]` assertion now pins what the name says: with the eight-register prefix `s4` is a system value and not user-data dword 4 — a standalone placement would attribute it to the parameter and fail the assertion. The load's site moves to `(0, 3)` with the extra instruction; the other three GS tests are unchanged. Validation on `0a6b163` (Windows, CPU-only): `cargo test --locked -p victory-shader --lib resource::` **37 passed, 0 failed**, including the fixed test; `cargo clippy --locked -p victory-shader --lib --tests -- -D warnings` clean; `cargo xtask policy` **184 files ok**; `git diff --check` clean. AI-assisted: Kimi.
Author
Owner

@⁠DenRakEiw on GitHub · 2026-11-25 10:04 UTC · original · approved these changes

Verified against origin/main (940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:

  • Updating HwStage::Gs to default to standalone SGPR 0 while Tracer::user_sgprs checks both standalone (index) and merged (index + 8) placements cleanly handles both GS layouts in param_word and param_of.
  • cargo test -p victory-shader resource::tests: 35/35 passed on RTX 5090, 35/35 passed on WARP (including geometry_user_data_is_found_in_standalone_and_merged_layouts and geometry_root_descriptors_use_the_matching_layout).
  • cargo clippy -p victory-shader --all-targets -- -D warnings: 0 warnings.
  • cargo xtask policy: 183 files ok.

AI-assisted (Gemini 4 Neon).

**@⁠DenRakEiw** on GitHub · 2026-11-25 10:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/2284#pullrequestreview-6055496123) · **approved these changes** Verified against `origin/main` (`940d32f`) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP: - Updating `HwStage::Gs` to default to standalone SGPR 0 while `Tracer::user_sgprs` checks both standalone (`index`) and merged (`index + 8`) placements cleanly handles both GS layouts in `param_word` and `param_of`. - `cargo test -p victory-shader resource::tests`: 35/35 passed on RTX 5090, 35/35 passed on WARP (including `geometry_user_data_is_found_in_standalone_and_merged_layouts` and `geometry_root_descriptors_use_the_matching_layout`). - `cargo clippy -p victory-shader --all-targets -- -D warnings`: 0 warnings. - `cargo xtask policy`: 183 files ok. AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 10:19 UTC · original · approved these changes

Tested locally: merged into main 940d32f69b, cargo test -p victory-shader --locked on macOS arm64 — 146 passed, 0 failed, 2 ignored (Windows-gated hardware execution tests not run here). Approving — standalone and merged geometry user-data recognition (+1 test).

**@⁠catminou4** on GitHub · 2026-11-25 10:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2284#pullrequestreview-6055710515) · **approved these changes** Tested locally: merged into main 940d32f69b, `cargo test -p victory-shader --locked` on macOS arm64 — 146 passed, 0 failed, 2 ignored (Windows-gated hardware execution tests not run here). Approving — standalone and merged geometry user-data recognition (+1 test).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 19:13 UTC · original · approved these changes

Verified locally merged onto origin/main (63bcca43, Windows 11 x64, Rust 1.98.1 MSVC):

  • cargo test --locked -p victory-shader --lib resource:: — 39 passed, 0 failed (including all 4 new HwStage::Gs tests)
  • cargo clippy --locked -p victory-shader --all-targets -- -D warnings (default and --all-features) — 0 warnings
  • cargo xtask policy — ok (191 files ok)

Review notes

  • Verified all machine-word encodings across the four new GS tests (s8 table base, s[8:11] built root descriptor, s0 standalone refusal at offset 8).
  • In a_merged_geometry_shader_keeps_its_system_sgprs_out_of_the_root_parameters, placing s_mov_b32 s20, s4 before s_load_dwordx8 s[0:7], s[2:3], null ensures s4 is a live IR input before s4 is overwritten, so the r.params == [(0, 0)] check genuinely verifies system SGPRs s0..s7 stay out of root parameters.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 19:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/2284#pullrequestreview-6079375437) · **approved these changes** Verified locally merged onto `origin/main` (`63bcca43`, Windows 11 x64, Rust 1.98.1 MSVC): - `cargo test --locked -p victory-shader --lib resource::` — **39 passed, 0 failed** (including all 4 new `HwStage::Gs` tests) - `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` (default and `--all-features`) — 0 warnings - `cargo xtask policy` — ok (`191 files ok`) ### Review notes - Verified all machine-word encodings across the four new GS tests (`s8` table base, `s[8:11]` built root descriptor, `s0` standalone refusal at offset 8). - In `a_merged_geometry_shader_keeps_its_system_sgprs_out_of_the_root_parameters`, placing `s_mov_b32 s20, s4` before `s_load_dwordx8 s[0:7], s[2:3], null` ensures `s4` is a live IR input before `s4` is overwritten, so the `r.params == [(0, 0)]` check genuinely verifies system SGPRs `s0..s7` stay out of root parameters.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2284/head:github-bot/gh-2284'
git switch 'github-bot/gh-2284'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2284'
git switch 'github-bot/gh-2284'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2284'
git switch 'github-bot/gh-2284'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2284'
git switch 'main'
git merge --squash 'github-bot/gh-2284'
git switch 'main'
git merge --ff-only 'github-bot/gh-2284'
git switch 'main'
git merge 'github-bot/gh-2284'
git push origin 'main'
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!2284
No description provided.