Recompiler: cube sc / tc negate by the sign bit on both backends #2348
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!2348
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2348"
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?
@Victorbriez on GitHub · 2026-11-25 16:13 UTC · original
Victorbriez:recomp/cube-sign-negation→main· +59 −6 · 3 files · 1 commits · openBoth backends negated the sources of
v_cubesc_f32/v_cubetc_f32withfsub -0.0, x: the HLSL helpers through-x, the direct lowering throughfneg. A driver may flush a denormal there: NVIDIA does on the HLSL path, sov_cubetc_f32returned ±0 for a denormal source; RADV under vkd3d-proton does on the direct path (reported below). Both now flip the sign bit. Fixes #2347.What is in it
bc43fd6): aneg_bitshelper in the HLSL prelude, used bycube_scandcube_tc(crates/xcl/src/gpu/recomp/emit.rs); anfneg_bitshelper used bycubein the direct lowering (crates/xcl/src/gpu/dxil/prelude.rs); and the GPU testgpu_cube_coordinates_negate_denormals_by_signon both backends (crates/xcl/src/gpu/recomp/tests.rs)Tested
bc43fd6(onmain3ceb550), no uncommitted changesmain(hlsl lane 0: tc0x80000000, want0x80000001) and passes with the fix on both backendscargo test --workspace --no-fail-fast -- --test-threads=4:main3ceb5501346 passed, 1 failed, 46 ignored; this PR 1347 passed, 1 failed, 46 ignored (the new test). The one failure is the same on both,a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrierfrom #2074, and is not touched hereV_MUL_F16,V_PK_MUL_F16,V_CVT_F16_F32, #2182); 1 × no heap windows; 1 × Developer Mode off (0x887A002D); 2 × no xgameruntime.dllvalu_fuzz_backends_agree(its file added locally, not part of this PR):main1 instruction differs (V_CUBETC_F32, 58 of 256); this PR 0 differ, 333 of 341 compared (on eda3db7, the same change before this rebase; not rerun onbc43fd6)Regression run
scripts/smoke.ps1onmainand on this head, I will add both blocks here. Until then this stays a draft.Not tested
AI use
🤖 Generated with Claude Code
@SlopTart on GitHub · 2026-11-25 16:41 UTC · original
Tested: current PR head merged onto current
origin/main(clean,a5b31491), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo targetx86_64-pc-windows-gnurun under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).The new test goes red on this lane, but only on the
direct_dxilbackend.gpu_suite (--release --locked,--test-threads=2): 145 passed / 4 failed / 1 ignored vs baseline 144 / 3. The three baseline failures are this rig's known set (fuzz seed 1003 of #2115,gpu_nonfused_mad_and_mac_prevent_fma_contraction,gpu_depth_buffer_created_for_unordered_access_is_placed); the 4th is the newgpu_cube_coordinates_negate_denormals_by_sign.--test-threads=1, always the first assert of the second backend loop:direct_dxil lane 0: (sc, tc) of [0000ffff, 00000001, bf800000]->left: [2147483648, 2147483648]right: [2147549183, 2147483649](tests.rs:9690).0x8000FFFF/0x80000001(denormals negated by sign bit), got0x80000000twice, i.e. the GPU returned-0.0for both: the denormals were flushed to zero. Thehlslbackend loop passes on this lane (the PR's fix holds there); it is thedirect_dxilbackend's emitted code that still loses denormals on RADV, exactly thefsub -0.0, xclass the test doc-comment warns about.Not tested: retail titles (no title data on this lane, counts only).
AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
@Victorbriez on GitHub · 2026-11-25 17:10 UTC · original
Thanks, you are right, and the description was wrong about the direct backend: its
fneg(crates/xcl/src/gpu/dxil/lower.rs) isfsub -0.0, xtoo, not a sign-bit flip. NVIDIA keeps the denormal there, RADV under vkd3d-proton does not.eda3db7 (on
main50a9fde) flips the sign bit in the directcubeas well (fneg_bitsincrates/xcl/src/gpu/dxil/prelude.rs, an integer xor). On the RTX 3070 the test still passes on both backends and #2169's fuzzer finds no difference; the description has the new counts. Could you rerungpu_cube_coordinates_negate_denormals_by_signon your RADV lane with this head?AI use: Claude Code (Claude Opus 5.5) checked the report against the code, wrote the change and this reply; I checked it before posting.
@DavidM1911 on GitHub · 2026-11-25 18:27 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.Thanks!
@emirduran707 on GitHub · 2026-11-25 19:54 UTC · original
Independent AMD RDNA4 (native wave64) test report on exact head
bc43fd6dc4035f3687fe2667024b65e9742442f6(clean detached checkout, no local changes).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17; tests debug, smoke release.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1345 passed, 3 failed, 46 ignored; 8 SKIPPED (6 inlower_dxil::tests::{f16,f32}_programs_on_the_gpurefused by per-lane form;heap_window_out_of_memory_falls_back_to_the_switch_form;pso_measurement_compiles_an_exact_synthetic_record). All native wave64 GPU tests ran and passed.gpu::recomp::tests::gpu_cube_coordinates_negate_denormals_by_sign.main:gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(seed 722) andfuzz_validate_and_gpu_3(seed 1599) on this GPU, plusgpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier(from50a9fde/ #2074, fixed later onmainin #2420).Regression run (60 s retail-title smoke,
XCL_NETWORK=0, release)(Matched
main68a284abaseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)Not tested
AI use
@Victorbriez on GitHub · 2026-11-25 20:17 UTC · original
Thanks a lot, this is the AMD / native wave64 run and the regression run this PR was missing.
PR checksneeds bothxcl-smokeblocks pasted under Regression run, and themainone has to be the block itself, not a summary. Could you paste the fullxcl-smoke v1block of yourmain68a284arun (the 1573 frames / 14420 MB one)? I will then put both blocks in the description, credited to you, with your hardware and the counts.AI use: Claude Code (Claude Opus 5.5) read the report and drafted this reply; I checked it before posting.
@bmjask on GitHub · 2026-11-25 20:26 UTC · original · reviewed
No source-level defect found. The sign-bit XOR is consistent across HLSL and Direct-DXIL, preserves bit patterns, and the new GPU test covers both backends with denormals; the submitted RDNA4 report and head smoke are encouraging. Merge readiness is administrative: all current PR-description checks fail because the required full main baseline smoke block is missing (a summary is not enough). Please add the complete main block and rerun the description check.
@DavidM1911 on GitHub · 2026-11-26 08:15 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.