Repository navigation
Conversation
|
A branch can reach Could we add that control-flow case and leave the jump indirect when a branch can enter after Static review only. AI-assisted with Codex. |
|
The recognizer is now honest: requiring the matching carry op (addc for add, subb for sub), checking both registers of the pair, and whitelisting only nop/waitcnt as separators closes both holes - a stale getpc+literal pairing and the +/-4GiB-vs-+20 high-word ambiguity. Combining the halves before negating (i128) also fixes the i64::MIN subtraction edge. Test matrix covers every failure mode I can think of, including SCC clobbers and register clobbers at each position in the chain. |
|
Independent Windows 11 verification and code review of Verification (
|
|
Addressed the CFG-entry and traversal-order findings in 6dbac14. Thanks @DrDarkDK and @fuzeofficlal for the concrete cases and the Windows verification of the first revision. The decoder now records branch/jump destinations and rejects a setup with an entry in IR uses the final decoded flow decisions instead of repeating the physical lookback on the final sorted instruction list. This covers the Six additional synthetic tests cover low/high/setpc entries, both visitation orders, late direct/far entries, valid/invalid/out-of-range speculative targets, and retained indirect decisions. A positive control still resolves a branch to getpc and ignores an unreachable data word resembling a branch. The CFG negative cases also check indirect IR exits for wave32 and wave64. With these tests, the previous PR revision had 31 pass / 5 fail; the updated code has 36 pass / 0 fail. Strict harness Clippy, all-features shader library check, repository/staged asset policy and diff checks pass locally. Fixtures are handwritten public-ISA instructions; no game data or game execution was used. Windows CI on this exact head: passed both workspace Clippy configurations and the workspace tests (run). AI-assisted with OpenAI Codex. |
|
AMD/RADV offline check of the head commit (no game run).
None of these programs takes a far jump, so the validation this PR adds is not reached by the dump: the new tests are the evidence, and Not tested in a game run; not tested on NVIDIA. |
|
Re-verified Verification
Review Confirmation
|
|
Automated triage for the maintainers. Merge candidate (recommend a look). Heads-up: it conflicts with #2012 (decode by dword table) in CI: Generated by Claude Code |
gfx10::far_jumpfollowed a target derived from the low-word literal even when the high-word carry was missing, mismatched, or clobbered. A physical getpc / arithmetic / setpc sequence also does not prove a constant target when another branch enters after getpc: the bypassing path can carry a different register pair. Decode and IR previously recomputed this decision from different predecessor sets, which could produce an IR jump to code that was never decoded.Validate the complete local getpc / low arithmetic / matching high carry / setpc chain, including both registers and both halves of the signed offset. Wide host arithmetic handles subtraction of i64::MIN. Within the existing four-instruction lookback, only NOPs, s_waitcnt and s_waitcnt_depctr may separate the operations.
Track discovered branch and jump destinations and leave the setpc indirect if any entry bypasses part of its setup. A later path can invalidate a chain already followed: in that case decode restarts with the additional entries retained, removing speculative code and its errors. Errors are deferred until pending paths have been explored, so an invalid speculative target cannot hide the path that invalidates it. The entry set only grows, and every retry blocks at least one newly invalidated chain. IR consumes the final decoded flow decisions rather than resolving the jump a second time. Entering at getpc remains valid; unreachable data is not scanned for apparent branches. This is conservative local recognition, not general constant propagation.
Eleven new synthetic tests cover arithmetic/carry validation, register and SCC clobbers, signed 64-bit offsets, scheduling controls, entries at low/high/setpc, both traversal orders, late ordinary and resolved-far entries, valid/invalid/out-of-range speculative targets, and flow decisions whose invalidating branch disappears on retry. The CFG negative cases check the indirect IR exit in both wave sizes. The original arithmetic regressions failed 3 tests against main; the CFG regressions failed 5 tests against the first PR revision. All 36 decoder/SP3/IR tests now pass.
Validation on Linux x86-64 / Rust 1.100.0:
cargo check -p victory-shader --all-features --locked --offlinepasses. Changed code is formatted; repository asset policy (184 files), staged policy (2 files), and diff checks pass.Semantics checked against AMD RDNA2 ISA, sections 12.1/12.3 and the LLVM 21.1 far-branch sequence. The decoder/control API changes here overlap #2012's lookup work and will need integration if both land. No GPU or game files used; all instruction fixtures are handwritten from the public ISA. No measured in-game impact claimed. AI-assisted: OpenAI Codex.
Coordination claim.