Recompiler: VOP3 abs / neg on the shift-add and align ops act on the sign bit #2058
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2058
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2058"
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?
@upipibi on GitHub · 2026-11-25 02:17 UTC · original
upipibi:fix/shift-add-sign-mods→main· +126 −16 · 3 files · 2 commits · openBoth paths dropped the VOP3
ABS/NEGsource modifiers of the shift-add ops (v_lshl_add_u32,v_add_lshl_u32) and the align ops (v_alignbit_b32,v_alignbyte_b32). RDNA2 applies them to the source's sign bit, as for a float:absisx & 0x7fffffffandnegisx ^ 0x80000000. Withnegon the addend,v_lshl_add_u32 5, 2, 1gave 21, where the hardware gives0x80000015.Sources for the rule: boykopovar/AnyPS5#25964 measured both opcodes with every
abs/negcombination on gfx1036 (RDNA2) and gfx1201 (RDNA4) with their hardware oracle: 196/196 words match the sign-bit operations on each. boykopovar/AnyPS5#25799 measured the align ops on gfx1036: on src1,absclears andnegflips bit 31, which a shift brings into the result. On src0 and the shift amount they can't change the result, so applying them there is harmless. Withnegon src1,v_alignbit_b32 0, 1, 31gave 0 where the hardware gives 1.What is in it
recomp/emit.rsanddxil/lower_valu.rs: the shift-adds and the align ops applyabsthennegto each source as bit operations. Other integer VOP3 ops are unchanged, since only these four are measured.recomp/tests.rs:gpu_shift_add_abs_neg_act_on_the_sign_bitcoversnegon src2 ofv_lshl_add_u32andabson src0 ofv_add_lshl_u32with a zero shift, chosen so the modifier can't be shifted out.gpu_align_abs_neg_act_on_the_sign_bitcoversnegandabson src1 of both align ops.Tested
30457b2, as-is: Radeon RX 7800 XT (RDNA3, driver 32.0.31035.1003), Windows 11, debug, DXC 1.9.0.5512.gpu_shift_add_abs_neg_act_on_the_sign_bitandgpu_align_abs_neg_act_on_the_sign_bitpass;cargo test --workspace --no-fail-fast -- --test-threads=4: 1243 passed, 2 failed, 46 ignored. The 2 failures are not this PR's:fuzz_validate_and_gpu_1fails the same way onmain1a0bbe3there, andgpu_image_get_resinfo_past_last_levelcomes from this head's base, which predatesmain's fixea088a5.30457b21(rebased ontomain426a5a74, the firstmainwith green CI after5478c4a7, whose two failing tests main fixed in0d13b071), RTX 3070 (616.56):gpu_suite (--skip gpu_sparse_vram) 145 passed, 0 failed withXCL_DIRECT_DXIL=0and with=1.main426a5a74gives 143 passed on both.main5ce558f:mainfails both on both paths (21 for0x80000015; 0 for 1). This branch passes them withXCL_DIRECT_DXIL=0and1.gpu_tests (--skip gpu_sparse_vram): 134 passed withXCL_DIRECT_DXIL=0; with1, 133 passed and 1 failed,gpu_image_get_resinfo_1d_array, which also fails onmain(#2046 fixes it).dxil::units: 136 passed.Regression run
Pair for the current head
30457b2againstmain1a0bbe3, run by thehollowedone (comment, thanks): RTX 3080 Ti (621.35), stockscripts/smoke.ps1, clean release builds, 60 s offline. Pasted unedited.Earlier: The earlier pair, comment, was for
7a62a79, before the rebase ontomain5478c4a7..A second pair, by ThiagoAlexsander on an RTX 5080 (comment, thanks):
main426a5a71529 frames shown, this head30457b21641, 0 crashes and 0 device removals on both.Not tested
AI use
🤖 Generated with Claude Code
@JJAutoCompare on GitHub · 2026-11-25 02:32 UTC · original
Tested
I ran the two checked-in VOP3 sign-bit fixtures on clean PR head
7a62a796287b06882663220725482da58a124188. I rechecked the PR after the run and confirmed it was open at that SHA.Windows 11 Enterprise Evaluation (build 26200.9974), AMD Ryzen 7 3800X, Intel Arc A770 (driver 32.0.101.9175), Rust and Cargo 1.100.0 (
x86_64-pc-windows-msvc), and DXC/DXIL 1.9.2609.5. The Cargo test profile was unoptimized with debug info disabled.XCL_DIRECT_DXIL=0) ran both fixtures. 2 passed, 0 failed, 0 ignored, 0 skipped.XCL_DIRECT_DXIL=1) ran both fixtures. 2 passed, 0 failed, 0 ignored, 0 skipped.0x80000015forv_lshl_add_u32with NEG and0x00000004forv_add_lshl_u32with ABS. The align results were0x00000001forv_alignbit_b32with NEG,0x00000080forv_alignbyte_b32with NEG, and0x00000000forv_alignbit_b32with ABS.Not tested
Other modifier and operand combinations, other GPUs, a
mainbaseline, the full workspace suite, and retail-title smoke runs.AI use
T3 Code / Codex (
gpt-6.2-sol) ran the tests, checked the exact PR head and fixture assertions, and wrote this report.@JoaoPauluu on GitHub · 2026-11-25 03:14 UTC · original
A run with vkd3d-proton as the host D3D12. The DXIL goes through dxil-spirv and then the NVIDIA Vulkan driver, a different compiler from a native-Windows run: this PR's 2 new tests pass.
Tested
x86_64-pc-windows-gnu.7a62a79as it is (merge base withmain5ce558f), no uncommitted changes. The lib test binary runs under Wine, one test per process.gpu_align_abs_neg_act_on_the_sign_bit: ok, not skippedgpu_shift_add_abs_neg_act_on_the_sign_bit: ok, not skippedNot tested
AI use
@DavidM1911 on GitHub · 2026-11-25 04:55 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@Toons29 on GitHub · 2026-11-25 09:42 UTC · original
Regression run of
7a62a796on the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon568e7db7, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 105 % of
main's frames, 100 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; a script posted this right after the run, with both blocks exactly as printed.@raylitebull on GitHub · 2026-11-25 10:47 UTC · original
7a62a79now conflicts incrates/xcl/src/gpu/recomp/tests.rsafter #2054 merged onmain.Please rebase onto
main; once rebased, an AMD synthetic GPU test run on the VOP3 sign-bit tests will also be needed alongside NVIDIA/Arc coverage.@oni-swr on GitHub · 2026-11-25 12:25 UTC · original
AMD synthetic GPU run of
30457b210086c924df4be115feaded0128cfcc2e(exact PR head, tested as-is, not merged ontomain; the diff touches the recompiler and its tests only). Synthetic Cargo tests only: no retail title, nosmoke.ps1.Tested
Compiling xcl v0.1.0came from the PR checkout.cargo build --workspace, then:cargo test -p xcl --lib gpu_shift_add_abs_neg -- --nocapture:gpu_shift_add_abs_neg_act_on_the_sign_bit ... ok(1 passed, 0 failed, 0 ignored).cargo test -p xcl --lib gpu_align_abs_neg -- --nocapture:gpu_align_abs_neg_act_on_the_sign_bit ... ok(1 passed, 0 failed, 0 ignored).cargo test --workspace --no-fail-fast -- --test-threads=4: 1243 passed, 2 failed, 46 ignored, 7 distinctSKIPPEDlines. These are not coverage: f16/f32 per-lane form refused (6, wave32 and wave64) andheap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1. It fails the same way onmain1a0bbe3on this machine.gpu::recomp::tests::gpu_image_get_resinfo_past_last_level. This head does not containmain's commitea088a5("image_get_resinfo past the last level gives 0 sizes on AMD too"), so it is probably fixed by rebasing. I did not run the merged tree.Not tested
scripts/smoke.ps1regression run, NVIDIA, Intel, Wine/vkd3d.main.AI use
Claude Code, Claude Sonnet 5.5 ran the tests, checked the diff, and wrote this report.
@thehollowedone on GitHub · 2026-11-25 12:50 UTC · original
Here is the requested
scripts/smoke.ps1pair from clean release builds of main 1a0bbe3 and PR head 30457b2.RTX 3080 Ti (621.35), Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC. The 60 s offline runs used separate copies of the same starting profile and DXIL seed, no input, PSO preload off, a 16 GiB job commit cap, and a 12 GiB system commit floor.
On the exact head,
cargo test --offline --locked -p xcl --lib abs_neg_act_on_the_sign_bit -- --nocapture --test-threads=1reported 2 passed, 0 failed, 0 ignored, and no runtime skip notices in each ofXCL_DIRECT_DXIL=0and=1. Both the shift-add and align fixtures ran on the GPU in each mode.The smoke pair covers startup. AMD hardware, Wine, and world load were outside this test.
AI-assisted. Codex (GPT-6, exact variant unavailable) ran the tests and drafted this report.
@DavidM1911 on GitHub · 2026-11-26 07:13 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
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.