Repository navigation
Recompiler: fold finite constant legacyF16ToF32 conversions in direct DXIL - #2552
ramon-victor wants to merge 1 commit into
Conversation
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! — Devin |
|
Wave64 run (listed as untested; the wave64 GPU tests skipped on the RTX 3070) on an AMD RX 9070 XT, plus an RTX 3060: both new tests pass, and nothing else changes in the direct-DXIL GPU suite. Head
On both cards, the only result changes against Not tested: Intel, a title. |
|
Independent AMD RDNA4 (native wave64) verification of exact PR head Tested
(Compare against Not tested
AI use
|
|
Tested: current PR head merged onto current
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. |
Integrates upstream amd-dev 9f02a3b (BVH null/OOB guard), b67375b (scratch SADDR 0x7F), 4ae5668/xcl-dev#2565 (32-bit VALU add/sub carry without i64), plus open PRs xcl-dev#2559 (bfm/ffbh_i), xcl-dev#2557 (known_nonzero_bits folding), xcl-dev#2552 (f16-to-f32 fold), xcl-dev#2568 (integer min/max range opt), and xcl-dev#2580 (empty DXC blob null slice). Assisted-by: Antigravity (Gemini 4 Neon)
…l-dev#2557/xcl-dev#2568 - real.rs: require 8-byte alignment in UnadoptGuard::new before atomic vtable load (fixes debug misaligned-pointer panic on synthetic unaligned test handles). - list_x.rs: add UnadoptGuard and create_raw_fence in Wine GPU tests. - opt.rs: revert unmerged xcl-dev#2557/xcl-dev#2568 passes while keeping xcl-dev#2552. Assisted-by: Antigravity (Gemini 4 Neon)
|
Independent desktop NVIDIA (Wave32-only Ada) verification of PR #2552 at head Environment
Targeted release tests & build (
|
| Command | Result |
|---|---|
cargo test --release -p xcl --lib f16_bits_to_f32_bits_exhaustive -- --nocapture (3 consecutive runs) |
1 passed; 0 failed; 0 ignored; 1325 filtered out × 3 (0.00s × 3, 0 skipped) |
cargo test --release -p xcl --lib f16_to_f32_constant_folding_validates_and_matches_gpu -- --nocapture (3 consecutive runs) |
1 passed; 0 failed; 0 ignored; 1325 filtered out × 3 (0.22s, 0.18s, 0.20s, 0 skipped — live Wave32 GPU parity on RTX 4060) |
cargo test --release -p xcl --lib gpu::dxil:: -- --test-threads=4 (3 consecutive runs) |
185 passed; 0 failed; 3 ignored; 1138 filtered out × 3 (3.95s, 3.63s, 3.61s; 184 executed + 1 expected Wave32-only skip dispatch_chain_native_wave64_builds_whole: no wave64) |
cargo build --release -p xcl |
Clean build (1m 12s, exit 0, 0 new warnings) |
Paired quiet 60 s retail smoke (title: 29640639)
Exact parent & merge-base (e1d84b7d9153f86a97d2ec5d209d196046fc0bea, cached baseline on the same machine):
xcl-smoke v1
commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1531 (PresentX 1531)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13982 MB
PR #2552 (84f6bdc97a46acac6b875e4419facfcd23e650dd):
xcl-smoke v1
commit: 84f6bdc97a46acac6b875e4419facfcd23e650dd
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1593 (PresentX 1593)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14014 MB
Runtime log observations (xcl.log)
9222log lines,0[ERROR]/ device-removal / panic lines.- Final draw/memory telemetry in log:
19531 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample14013 MB committed by the process; video memory 6114 MB local, 4682 MB non-local.
Limits of coverage
- Exhaustive 16-bit half-to-float bit conversion (
f16_bits_to_f32_bits_exhaustive) and direct-DXILlegacyF16ToF32constant folding were verified end-to-end on desktop Wave32-only NVIDIA RTX 4060 (f16_to_f32_constant_folding_validates_and_matches_gpu× 3,0skipped, plusgpu::dxil::184executed +1expectedno wave64skip × 3). - Native Wave64 GPU execution is not available on this Wave32-only RTX 4060, and the warm-cache 60 s retail smoke on
title: 29640639confirms zero runtime regression rather than re-compiling a coldXCL_DIRECT_DXIL=1shader set (frame-count and commit deltas vs. cached parent reflect single-run startup variance, not this PR).
AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
|
RX 9070 / RADV / Wine verification of exact head Tested
Main fails the finite-constant IR assertion before that original test dispatches. Head/integration remove the finite calls and preserve all four dynamic/non-finite calls in the second original shader. Full captured readbacks, including unmodified slots and all active lanes, were independently checked. The helper's original exhaustive CPU test covers all 65,536 half bit patterns. Additional owned filter
Across both groups: 584 captured GPU dispatches, including 288 native wave64, and 2,934,784 output/guard words. Python's independent IEEE-half decoder verifies finite/infinite outputs bit-for-bit and NaNs by class; untouched slots, guards and physical widths also match. Matrix payloads repeat byte-for-byte within each source and across source arms, including NaN payloads. Exact head and integration captures match. 0 ignored, 0 skipped. Inherited Not tested Full suite, HLSL backend, whole RDNA2 mixed/packed-f16 instructions, guest Compute ABI integration, native Windows, other GPUs, retail workload, AI use OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the diff, wrote the owned test-only matrix and captures, ran comparisons, independently verified IEEE conversion results, NaN classes, guards, wave widths and source/executable provenance, and drafted this report. Publication authorized by the account owner. |
|
merge-check claim |
|
merge-check |
|
merge-check claim |
|
merge-check |
Part of #1269.
Problem
RDNA2 mixed-precision and half-conversion instructions (
v_fma_mix_f32,v_fma_mixlo_f16,v_fma_mixhi_f16,v_cvt_f32_f16, packed f16 helpers) frequently convert inline or constant-folded 16-bit half operands tof32viaShader::f16_to_f32(dx.op.legacyF16ToF32). Even afteropt.rsfolds the precedingand 0xFFFF/lshr 16extraction to a constant integer,dx.op.legacyF16ToF32was left as an intrinsic call and was also absent fromopt::removable, preventing constant folding and dead-code elimination.Fix
f16_bits_to_f32_bits(h: u16) -> Option<u32>incrates/xcl/src/gpu/dxil/ops.rs, performing exact IEEE-754 binary16 → binary32 conversion for all finite values (±0.0, all subnormals, all normals) while returningNonefor±InfandNaNso DXIL never materializes non-finite float constants.Shader::f16_to_f32(ops.rs) and post-SSA/constant-propagationdx.op.legacyF16ToF32calls inModule::simplify_op(module/opt.rs).dx.op.legacyF16ToF32calls inModule::removable(module/opt.rs);legacyF16ToF32isReadNone, uses no 64-bit types, and sets no DXIL shader feature flags.ops::f16_fold_testscovering all 65,536 half bit patterns, finite direct & shift/mask-folded constants (verifying zero remaininglegacyF16ToF32), non-finite preservation, and bit-exact RTX 3070 GPU parity with hardwaredx.op.legacyF16ToF32.Measured impact
573-program retail direct-DXIL validation sweep (
dxil.dll1.8.2502.11):6d12f58):573/573validated (val_fail=0),51,117,488total DXIL bytes (p50=22,865 us,p95=408,132 us).84f6bdc):573/573validated (val_fail=0),51,074,004total DXIL bytes (-43,484 B/-0.085%;p50=19,788 us,p95=389,471 us).Tested
cargo test --lib -p xcl f16_fold): 2 passed, 0 failed (f16_bits_to_f32_bits_exhaustive,f16_to_f32_constant_folding_validates_and_matches_gpu)..\scripts\test.ps1, NVIDIA GeForce RTX 3070, Windows 11):1425 passed, 0 failed, 46 ignored.dxil.dllvalidation sweep:573/573passed,0failures.cargo build --release -p xcl) and 60 s retail smoke run (see below).Not tested
Regression run
Main (
f087b99):This PR (
84f6bdc):AI use