Shaders: follow EXEC set from a scalar the section made constant #2382
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!2382
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2382"
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?
@Calvix2k on GitHub · 2026-11-25 12:21 UTC · original
Calvix2k:codex/shader-wave-constant-exec→main· +130 −6 · 1 files · 2 commits · openA whole-wave section (
s_or_saveexec -1 … s_and_saveexec) is simulated lane by lane to know what its wave operations mean once the host runs them. The simulation followedEXEConly whens_mov_b*wrote it an inline constant or a literal. A section that first puts the constant in a scalar and copies it —— ended the simulation at the copy, and every value read after it was refused as "a whole-wave section step the simulation does not follow", although the lane set is a constant that could have been carried.
What this does
Track the scalars the section itself sets to a constant (
s_mov_b*from an inline constant, a literal, or another such scalar; any other write to them drops them), and resolveEXECthrough that map as well.Nothing else changes:
EXECderived from a mask (s_and_b*withEXEC, or a value computed at runtime) still ends the simulation — that is a different step, and #2365 now names the instruction when it happens.Verification
a_section_follows_exec_set_from_a_scalar_constant: the sequence above, with a value after it — it has a shape (K(7)) where before the section ended at the copy.constant_decodes_width_and_inline_kindsstill passes (the table is now a parameter).cargo test -p victory-shader --lib: 248 passed, 0 failed, 3 ignored; clippy-D warningsclean.@Marvisak on GitHub · 2026-11-25 14:56 UTC · original · edited 2026-11-25 22:17 UTC
Automated triage for the maintainers.
Needs rebase. This PR no longer merges cleanly into
main:mainhas moved since the last triage, and the branch now conflicts incrates/victory-shader/src/emit/wave.rs. It will be reviewed again once it is rebased onto currentmain.Previous verdict for this head: merge candidate.
Generated by Claude Code
@Calvix2k on GitHub · 2026-11-25 16:19 UTC · original
Both points are fixed in
b9b1f8a(rebased ontomain 67e8ae1):sconstholds 32 bits per scalar.scalar_partgives a 64-bit move's two scalars their own halves, sos_mov_b32 exec_hi, s5afters_mov_b64 s[4:5], kgets k's high half.constantassembles both halves for a 64-bit read and refuses if either is unknown, sos_mov_b32 s4, -1; s_mov_b32 s5, -1; s_mov_b64 exec, s[4:5]is all ones in wave64 instead of 32 bits.Tests:
a_64_bit_scalar_keeps_its_halves_apart(store halves, a 32-bit read of the high half, and a 64-bit read refusing half a value) anda_64_bit_exec_move_takes_both_scalar_halves(two 32-bit moves + a 64-bit EXEC move; work after it keeps a shape instead of ending unknown — this one fails on the old code, where EXEC became 0x00000000FFFFFFFF).On "which program needs it": honest answer, none in the pack. The candidates are the three post-processing compute shaders that are built at runtime and absent from all packs — they still fail a section step, and this removes the copied-constant way that can happen. If it turns out none of them is this case, the change is still a correctness fix for the simulation, but it can wait; your call whether to keep it.
@DenRakEiw on GitHub · 2026-11-25 12:29 UTC · original · approved these changes
Verified against
origin/main(940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:EXECset from a scalar constant within a whole-wave section is clean and well-tested.cargo test -p victory-shader emit::wave: 7/7 passed on RTX 5090, 7/7 passed on WARP (includinga_section_follows_exec_set_from_a_scalar_constant).cargo clippy -p victory-shader --all-targets -- -D warnings: 0 warnings.cargo xtask policy: 183 files ok.AI-assisted (Gemini 4 Neon).
@catminou4 on GitHub · 2026-11-25 12:41 UTC · original · approved these changes
Tested locally: merged into main
940d32f69b,cargo test -p victory-shader --lockedon macOS arm64 — 145 passed, 0 failed, 2 ignored (Windows-gated hardware execution tests not run here). Approving — EXEC set from a scalar the section made constant is followed.@AndyLatimer on GitHub · 2026-11-25 12:43 UTC · original · requested changes
Please track the two halves of
s_mov_b64separately before merging. Each IRValuerepresents one 32-bit register. Insimulate, the loop overinst.writesassigns the complete constant to both destination values. On a later 64-bit scalar read,constantalso looks up just the low register.This wave32 section demonstrates the effect on
a3f2ed4.The wide move sets
s4 = 1ands5 = 0. Loadingexec_lofroms5disables every lane, so every lane keeps its incomingv2. The PR simulates lane 0 as active. On the PR head, the regression below expectedSome(Shape::Value(v2_in))and gotNone.The tested patch stores one
u32per SSA value and combines both known source words for a 64-bit scalar read. With it, all eightemit::wavetests passed locally and shader Clippy passed with-D warnings.Patch and regression test against a3f2ed4
AI-assisted review using a synthetic shader.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.