Recompiler: enforce -0.0 < +0.0 order in f16/f32 min and max (#1282) #1567
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1577"
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?
Imported from ivall/xcl. Originally posted by hajduzsolt on 2026-11-24T17:52:51Z.
Adds fmin_ieee and fmax_ieee HLSL helpers so RDNA2 v_min_, v_max_, v_min3_, v_max3_, v_pk_min_f16, v_pk_max_f16, and v_med3_* over f16/f32 strictly enforce -0.0 < +0.0 across D3D12 drivers while preserving NaN suppression. Fixes #1282.
What is in it
Tested
Regression run
main:
PR:
Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T19:51:40Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by throny on 2026-11-24T19:55:14Z.
Two contributors checked independently and found that #1348 solves the same problem (for #1282) in a different way: #1607, group D3. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint, not a request from the maintainers; nobody from the project has adopted #1607 so far.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
Imported from ivall/xcl. Originally posted by regiumlepidi on 2026-11-25T00:09:04Z.
RTX 5070 Ti:
d6d8f11merged intomain8e87fc7passes on both paths; on this GPU the GPU test also passes without the fixTested
XCL_SAMPLE_*cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --nocapture, one run per cell; PR headd6d8f116d7398e6c702665f65b21c9505f4ca35cmerged locally into8e87fc7b62a87ea589ccb9ea6182f514016cf7db, no conflicts (passed / failed / ignored):XCL_DIRECT_DXIL=1main8e87fc7fuzz_validate_and_gpu_0to_3(#1905, this driver) and, withXCL_DIRECT_DXIL=1,offline_compute_pipeline_is_reused_by_a_second_process, all as onmaintests.rschange applied tomain8e87fc7:float_minmax_uses_ieee_signed_zero_helpers(HLSL text) fails, butgpu_float_minmax_orders_negative_zero_below_positive_zeropasses on both paths. So this driver already orders -0 below +0 inmin/maxand returns the number for a qNaN operand; the GPU test does not show the bug here. A GPU whosemin/maxtreat ±0 as equal is needed to see it failSKIPPEDlines 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), any GPU where the test fails without the fix, release build, any retail titleAI use
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T02:43:46Z.
XCL PR #1577 — Intel Arc A770 signed-zero compatibility
https://github.com/xcl-dev/xcl/pull/1577
Tested
Exact clean PR head
d6d8f116d7. GitHub confirmed the PR was open at that SHA before and after the run. I read the existing conversation, including the RTX 3060 Ti and RTX 5070 Ti reports.Intel Arc A770 (32.0.101.9175), AMD Ryzen 7 3800X, Windows 11 Enterprise Evaluation 26200.9974, Rust 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc), unoptimized Cargo test profile. The runner reported dxcompiler and dxil 1.9.2609.5 (DXC 01b62ad4).
Process-only setup: CARGO_BUILD_JOBS=2, CARGO_INCREMENTAL=0, CARGO_PROFILE_DEV_DEBUG=0, CARGO_PROFILE_TEST_DEBUG=0, CARGO_TARGET_DIR=L:/XclTooling/pr1778-2e2ee55-20261125-020159/target, TEMP=TMP=L:/XclTooling/pr1577. GPU runs used XCL_ADAPTER=A770 and XCL_DXC_DIR=$env:LOCALAPPDATA/XclTooling/dxc-1.9.2609/bin/x64.
Prebuild outside the lock: cargo test -p xcl --lib --locked --no-run (54.18 s wall, exit 0). The commands below used the executable printed by Cargo:
$bin = 'L:/XclTooling/pr1778-2e2ee55-20261125-020159/target/debug/build/xcl/77aca8ccb20e299f/out/xcl-77aca8ccb20e299f.exe'
$lock = 'L:/XclTooling/Invoke-ArcTest.ps1'
$gpu = 'gpu::recomp::tests::gpu_float_minmax_orders_negative_zero_below_positive_zero'
$env:XCL_DIRECT_DXIL = '0'
& $bin gpu::recomp::tests::float_minmax_uses_ieee_signed_zero_helpers --exact --nocapture --test-threads=1
& $lock -Test { & $bin $gpu --exact --nocapture --test-threads=1 }
$env:XCL_DIRECT_DXIL = '1'
& $lock -Test { & $bin $gpu --exact --nocapture --test-threads=1 }
& $lock -Test { & 'L:/XclTooling/CapabilityProbe/capabilities.exe' }
HLSL translation test: 1 passed, 0 failed, 0 ignored, 0 SKIPPED, 832 filtered out (0.00 s harness). It checked complete translation and the signed-zero helpers in the emitted HLSL for f32/f16 scalar min/max, min3/max3 and packed f16 min/max. The translation-only test used the default logical wave64 options.
HLSL/DXC GPU test: 1 passed, 0 failed, 0 ignored, 0 SKIPPED, 832 filtered out (0.25 s harness, 0.41 s wall including lock). The fixture compiled HLSL with DXC as cs_6_6 and dispatched it on the Arc.
Direct DXIL GPU test: 1 passed, 0 failed, 0 ignored, 0 SKIPPED, 832 filtered out (0.20 s harness, 0.27 s wall including lock). The fixture's kernel_wave routes to direct_kernel when enabled, so this was a separate dispatch through the direct translator. The PR's HLSL helpers are only exercised by the HLSL path.
On both GPU paths, all 14 register assertions passed on each of 32 lanes (448 bit-exact comparisons per path). The assertions cover f32 and scalar f16 min/max for both mixed-sign zero operand orders, f32 min3/max3, packed f16 min/max across both halves, and f32 qNaN suppression with a finite first operand (3.0 for min and -2.0 for max). Scalar f16 checks include preservation of the upper 0xCAFE bits.
The D3D12 probe identified the Arc A770 (PCI 8086:56A0), WaveOps=1 and WaveLaneCountMin/Max=8/32. The fixture ran wave32 only. gpu_waves() omits wave64 on this adapter without emitting a SKIPPED line and does not select split wave64.
The GPU commands ran in a child PowerShell with process-scoped RemoteSigned after the default session blocked script loading. One retry acquired the lock but its output pipeline stopped on the DXC stderr diagnostic before capturing a result. Counts above come from the subsequent complete runs. Machine policy was untouched.
Logs: prebuild-20261125-033409.log, cpu-20261125-033531.log, gpu-hlsl-dxc-20261125-033726.log, gpu-direct-dxil-20261125-033726.log, wave-capability-20261125-033726.log.
Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T05:48:26Z.
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
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:33:05Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:10:38Z.
Triage (#1607) – head
67d551e#1348 made the same fix and was closed in favour of this PR. #1301 adds only GPU tests for the same ordering, including v_min_f64 / v_max_f64.
emit.rs: fmin_ieee / fmax_ieee pick the sign of two zeros correctly and are used for v_min/max/min3/max3 f16/f32, v_pk_min/max_f16 and med3f; the tests fail without the change. Not covered: v_min_f64 / v_max_f64 (still plain min/max in emit.rs, so #1301's f64 cases would still fail) and the direct DXIL backend (dxil/lower_valu.rs), which is not changed.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.