fix(shader): skip unused image atomic descriptor reconstruction #589
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!589
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-589"
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?
@jeremygold02 on GitHub · 2026-11-24 05:14 UTC · original
jeremygold02:codex/skip-unused-image-descriptor-data→main· +125 −0 · 2 files · 1 commits · openA scalar load of eight image-descriptor words currently reconstructs descriptor fields with a float-annotated
GetDimensions. When those SGPRs feed only an image atomic, the atomic builds its heap index directly from the load address. The extra query also lets the cached float4 annotation reach an unsigned atomic on current main.Track this single-consumer case during lowering and omit the field reconstruction. The check requires the same eight SGPR definitions to reach the image resource operand directly. A scalar data use, a PHI edge or another instruction reading any of those values keeps the existing path.
Verification
atomicBinOp.i32UMax on aRWTexture2D<U32>handle and zero dimension queries. The scalar and PHI controls still feed the queried dimension into the atomic.d2a4baeand this change. All 21,971 previously SDK-valid inputs passed. 21,931 outputs were byte-identical. The 40 changed shaders (27 pixel and 13 compute) retained all 167 atomic sites and dropped 83 redundant dimension queries. Exactly 78 atomic handle annotations changed from float4 to U32. All 3,538 translator refusals and 185 SDK rejections retained their previous diagnostic.R32_UINTUAV returned the expected unsigned maxima across the sign bit and within the high unsigned range. All three fences completed, and the adjacent texel and control descriptor retained their initial values. This check used the standalone change on main.Related work includes #177 distinguishes cached handle annotations, #259 checks use of the reconstructed mip-count field, and #48 adds 64-bit image atomics. In a separate comparison stacked on #48, all 14 unsigned 64-bit maximum sites in seven SDK-valid pixel shaders lost their redundant float query. Five bounded synthetic comparisons on a physical RTX 5070 produced the expected unsigned 64-bit maxima with fence-complete readbacks.
@slint6614-dev on GitHub · 2026-11-24 08:43 UTC · original
Measured on the full retail shader pack (26,503 containers) with
victory translate --validate --pipelines(pipelines created on an AMD RX 9070, Adrenalin, Windows 11; dxil.dll from SDK 10.0.26100), against main1f858b0. Counts are emitted / validated / pipelines.@Marvisak on GitHub · 2026-11-25 01:23 UTC · original · edited 2026-11-26 00:21 UTC
Automated triage for the maintainers.
Proposed close (unchanged): a narrower duplicate of #1756, which is still open. The head has not changed since the previous verdict. Your follow-up confirms #1756 fixes every correctness case you could find for the float4-annotated handle reaching an unsigned image atomic (
Lower::handleincrates/victory-shader/src/emit/lower.rs). What this PR adds on top is a smaller synthetic fixture (1,968 vs 2,160 bytes). On the retail pack it gives no extra validated shaders or created pipelines, so it does not justify a second code path. Thank you for checking this carefully and for saying so plainly.CI: not run on this head.
This pull request will be closed in 48 hours unless the author pushes a change or a maintainer removes the
triage: proposed closelabel.Generated by Claude Code
@jeremygold02 on GitHub · 2026-11-25 02:58 UTC · original
@Marvisak I checked the overlap with #1756 on
mainat940d32f6. With #1756 applied, I ran this PR’s synthetic fixture with Windows SDK DXIL validation required and the code-size assertion replaced by a measurement. The atomic-only x8 and x16 cases both validated at 2,224 bytes, and the descriptor-word and control-flow checks passed. I found no additional correctness case that #1756 misses.This PR does have a separate code-size effect. With #589 alone on the same base, the original regression passed and the atomic-only x8 case produced 1,968 bytes versus 2,160 for x16. That measures the optimization in the fixture; the retail-pack comparison above found no increase in validated shaders or created pipelines. I agree with using #1756 for the correctness fix. I’ve left this branch as-is for the proposed-close decision.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.