Recompiler: apply NEG_HI as ABS on v_dot2_f32_f16's f32 accumulator #1286
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!1286
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1286/head"
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?
@emirduran707 on GitHub · 2026-11-24 14:20 UTC · original
emirduran707:recomp-dot2-f32-f16-abs-src2→main· +54 −0 · 2 files · 1 commits · closed without mergingv_dot2_f32_f16applied only NEG bit 2 to its f32 accumulator (src2). NEG_HI bit 2, which for an f32 operand of a VOP3P instruction is its absolute-value modifier, was ignored. LLVM shows the encoding: itsllvm.amdgcn.fdot2.llcodegen test (v_fdot2_abs_c) expectsv_dot2_f32_f16 v0, v0, v1, v2 neg_hi:[0,0,1]forfabs(c).SIDefines.hdefinesNEG_HI = ABS, and the src2 operand is selected withSelectVOP3PModsF32→SelectVOP3Mods, which foldsfabsinto it. With v1 = v2 = two halves of 1.0 and v3 = -5.0,neg_hi:[0,0,1]gives 7.0 on the hardware and gave -3.0 here.The accumulator now takes
absfor NEG_HI bit 2, then the negation for NEG bit 2, the same orderv_fma_mix*uses in this file.What is in it
crates/xcl/src/gpu/recomp/emit.rs: the modifier.crates/xcl/src/gpu/recomp/tests.rs:dot2_f32_f16_neg_hi_on_src2_is_abs(translation, no GPU) andgpu_dot2_f32_f16_abs_neg_on_src2(neg_hi → 7.0, neg plus neg_hi → -3.0, neg alone → 7.0).Tested
cargo test --workspace -- --test-threads=4onfb14017: 743 passed, 0 failed, 41 ignored; no SKIPPED GPU tests (the new GPU test ran and passed on this adapter)abson the accumulator); with it it passes; the GPU test was run only with the changeRegression run
main:
this PR:
Not tested
AI use
🤖 Generated with Claude Code
@thehollowedone on GitHub · 2026-11-24 14:31 UTC · original
Independent mixed-operand GPU check on
fb14017, Windows 11 build 26300, RTX 3080 Ti / 621.35, Rust 1.99.1 MSVC, DXC 1.8.2502.11, debug.I ran
v_dot2_f32_f16with mixed-sign packed inputs and lane-varying FP32 accumulators. The shader tested a plain control, ABS with a low-half sign change, ABS with a high-half sign change, and ABS followed by NEG with both packed halves negated. The PR matched all four expected outputs in all 32 wave32 lanes and 64 split-wave64 lanes. With only the parent emitter restored, the plain control still matched, and each ABS form mismatched on 16/32 wave32 lanes and 32/64 split-wave64 lanes.The two stock tests and the added mixed-operand check passed on the PR with no skips. Synthetic shaders only. AI-assisted. Codex (GPT-6, exact variant unavailable) wrote and ran the scratch fixture and drafted this report.
@futurepro62 on GitHub · 2026-11-24 14:32 UTC · original · edited 2026-11-24 14:40 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
fb14017(on its base47efa2e).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 743 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.dot2_f32_f16_neg_hi_on_src2_is_abs,gpu_dot2_f32_f16_abs_neg_on_src2.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 743 passed, 0 failed, 41 ignored, no skips.Not tested
AI use
@regiumlepidi on GitHub · 2026-11-25 00:10 UTC · original
RTX 5070 Ti:
fb14017merged intomain8e87fc7passes its tests on the default path; the GPU test still fails withXCL_DIRECT_DXIL=1Tested
XCL_SAMPLE_*cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --nocapture, one run per cell; PR headfb1401743aeab7fcb5fc4477f1af878b08a4689dmerged locally into8e87fc7b62a87ea589ccb9ea6182f514016cf7db, no conflicts (passed / failed / ignored):XCL_DIRECT_DXIL=1main8e87fc7dot2_f32_f16_neg_hi_on_src2_is_absandgpu_dot2_f32_f16_abs_neg_on_src2pass. The 4 failures arefuzz_validate_and_gpu_0to_3(#1905, this driver), as onmainXCL_DIRECT_DXIL=1: those 4,offline_compute_pipeline_is_reused_by_a_second_process(fails onmaintoo) andgpu_dot2_f32_f16_abs_neg_on_src2:wave32 lane 0 v_dot2_f32_f16 neg_hi:[0,0,1], left3225419776(-3.0), right1088421888(7.0). The PR's diff touches onlyrecomp/emit.rsandrecomp/tests.rstests.rschange applied tomain8e87fc7: both new tests fail on both paths; the GPU test with the values aboveSKIPPEDlines in each run (18 no wave64, 1 const mask + wave64, 3 per-lane form refused, Developer Mode,d3d12SDKLayers.dll, heap windows, debug layer); none names the new testsNot tested
gpu_waves()runs wave32 only here), release build, any retail title, other GPUs or driversDirect translator patch
gpu_dot2_f32_f16_abs_neg_on_src2fails withXCL_DIRECT_DXIL=1because the direct translator has the same bug:dxil/lower_wide.rsignores NEG_HI[2] on the accumulator. The patch below mirrors this PR there. With this PR's commit and the patch onmain8e87fc7, the new tests pass on both paths, andcargo test --workspace --locked --no-fail-fast -- --test-threads=4gives 988 / 4 / 45 (default) and 987 / 5 / 45 (direct); the failures are the same as onmain. Take it into this PR if you like, or say if you would rather it go in a separate PR stacked on this one.Patch (applies with
git applyon this PR merged intomain8e87fc7)AI use
@xpatfussy69x on GitHub · 2026-11-25 08:26 UTC · original
Test report for head
fb14017as pushed (not merged onto currentmain) – NVIDIA, wave32.Tested
.\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 743 passed, 0 failed, 41 ignoreddot2_f32_f16_neg_hi_on_src2_is_absandgpu_dot2_f32_f16_abs_neg_on_src2ran and passedXCL_SAMPLE_*data set (game-data tests not run)Not tested
main;XCL_DIRECT_DXIL=1(this run used the default HLSL path)AI use
@raylitebull on GitHub · 2026-11-25 18:24 UTC · original
Superseded/landed via #1979 (which preserved the emit.rs + ests.rs commit with authorship and added the lower_wide.rs XCL_DIRECT_DXIL=1 counterpart so both backends pass gpu_dot2_f32_f16_abs_neg_on_src2).
@emirduran707 on GitHub · 2026-11-25 18:46 UTC · original
Closing as landed on \main\ via #1979 (\c09ccf). Thanks for preserving authorship and adding the Direct DXIL counterpart.
Pull request closed