Shaders: seed uninitialized mesh SGPRs above user_sgprs as zero #2049
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2049
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2049/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@fuzeofficlal on GitHub · 2026-11-25 04:06 UTC · original
fuzeofficlal:fix/shader-ms-uninitialized-sgprs-815→main· +528 −13 · 4 files · 1 commits · closed without mergingSummary
user_sgprsfromMS_INFO[6]intoMeshIo::user_sgprsand exposeMeshIo::initialized_sgprs()(8 + user_sgprs, covering the 8 merged-stage system SGPRss0..=s7plus the user SGPR ranges8..).StageIo::Ms(ms) => Some(ms.initialized_sgprs())inio::raisealongside compute and pixel stages so reads of uninitialized SGPRs above8 + user_sgprslower to0instead of failing with"a hardware SGPR input", while keeping unimplemented hardware SGPRs (s0..=s7other thans3MergedWaveInfo) and unmapped user SGPRs (s8..s[8 + user_sgprs - 1]) strictly refused.Addresses #815
Testing
cargo test -p victory-shader --locked -- mesh_uninitialized_sgprs(verified withdxil.dlland executed on NVIDIA RTX 5090, AMD Radeon Graphics, and D3D12 WARP)cargo clippy --workspace --all-targets --all-features --locked -- -D warningscargo xtask policy@jeremygold02 on GitHub · 2026-11-25 04:17 UTC · original
Triage verdict — Keep the mesh ABI support, align the live-in rule with #1261 (
4f3c6a1)Evidence
Checks and limits
Next step
This verification was AI-assisted.
@fuzeofficlal on GitHub · 2026-11-25 05:23 UTC · original
Thanks @jeremygold02 — pushed
71e4bd2aaddressing both points:Lower::inputswith#1261+ added unwritten control cases: an unmapped SGPR at or aboveinitialized_sgprsnow lowers to0only when at least one instruction in the program writes that register, refusing registers no instruction writes with"an SGPR no instruction writes, above the initialized ones".mesh_uninitialized_sgprs_read_as_zero_while_hardware_ones_stay_refusednow tests unwrittens10ands25controls alongside the branch-around-writes10fixture.mesh_uninitialized_sgprs_execute_on_host_gpusno longer skips UMA/software adapters onDedicatedVideoMemory == 0before checkingD3D_SHADER_MODEL_6_6+D3D12_MESH_SHADER_TIER_1, and assertsexecuted > 0(verified on RTX 5090, AMD Radeon Graphics, and WARP).@Marvisak on GitHub · 2026-11-25 09:19 UTC · original
Automated triage for the maintainers.
Needs work.
This PR extends the compute "uninitialized SGPRs read zero" rule to mesh programs:
native.rsms_ionow readsMeshIo::user_sgprsfromMS_INFO[6], andMeshIo::initialized_sgprsreturns8 + user_sgprs. That changes shader semantics on two assumptions the PR does not back up:crates/victory-shader/src/native.rsms_io:maindoes not decode byte 6 of the mesh info. The existing fixture has 13 there, and nothing shows that it is a user-SGPR count. Please give the evidence, e.g. the title's mesh programs whose highest root-layout SGPR matches8 + info[6], or a corpus count like the one in #1261.MeshIo::initialized_sgprsassumes exactly 8 system SGPRs (s0..=s7) before the user ones, for every mesh program. The compute rule derives the count from the program's own settings (ComputeIo::initialized_sgprs); a fixed 8 needs the same kind of support.crates/victory-shader/src/emit/lower.rsLower::inputs: the "zero only if some instruction writes it" change is the same change as open #1261 (which has corpus numbers but needs a rebase), and here it also applies to compute and pixel programs. Please leave it to #1261, or coordinate with its author, so the rule lands once.What would change the verdict: evidence for the
MS_INFO[6]meaning and the 8-SGPR prefix, and thelower.rsoverlap with #1261 settled.CI: passing (
check).Generated by Claude Code
@sinan-cmyk on GitHub · 2026-11-25 09:29 UTC · original
Offline measurement on a retail dump
Result: no count change against
main.I merged head
71e4bd2aontomain940d32f(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 23,918 onmain, 23,918 with this PR.No program changes its 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).
@fuzeofficlal on GitHub · 2026-11-25 17:20 UTC · original
Closing this PR: deferring
Lower::inputshandling to #1261 and closing since validating the meshMS_INFO[6]ABI requires title shader evidence I do not have locally.Pull request closed