Recompiler: honor FP32 denormal mode in FREXP exponent #1994
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!1994
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1994/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?
@pane33 on GitHub · 2026-11-25 00:29 UTC · original
pane33:fix/gpu-frexp-exp-f32-mode→main· +293 −14 · 10 files · 1 commits · merged 2026-11-25 01:35 UTCHonor explicitly written guest FP32 input-denormal mode when translating
V_FREXP_EXP_I32_F32. Derive the exponent from the input bits after a write toMODE[4]and preserve the legacy result before that write.Previously, the exponent calculation could return zero for a preserved FP32 subnormal. For example, the smallest positive subnormal (0x00000001) should produce -148 when input denormals are preserved.
What is in it
MODE[4]writes in the HLSL and Direct DXIL recompiler paths. Direct DXIL reuses its existing MODE state and bumps the translation-cache version from 7 to 8.Tested
7a1f5a2and upstream baseline8e87fc7. Windows x64 build 26300.9974, AMD Ryzen 5 7600X, NVIDIA GeForce RTX 4060 (621.24), Rust 1.100.0, DXC 1.9.2602.17.cargo test -p xcl --lib gpu_frexp_exp_f32_denorm -- --nocapture. The FREXP filter passed six tests in each configuration: four backend-selectable tests and two explicit Direct DXIL tests covering directed rounding and per-lane lowering. Zero skips. Loop/SSA and upstream regression filters passed in both configurations. A standalone GPU probe verified the legacy result at loop entry and exponent -148 after the MODE write crossed the back-edge, in all 32 lanes in each backend.cargo build --workspaceandcargo test --workspace --no-fail-fast -- --test-threads=4: HLSL (Direct DXIL unset) 996 passed, 0 failed, 45 ignored. WithXCL_DIRECT_DXIL=all: 995 passed, 1 failed, 45 ignored. Each suite logged 24 skip events across 14 tests, including partial skips: 19 wave64 cases, 3 unsupported per-lane cases, 1 driver-cache control case, and 1 heap-window case.offline_compute_pipeline_is_reused_by_a_second_processalso fails on the clean upstream baseline with Direct DXIL and passes there with HLSL. Both Direct DXIL failures occur while looking up a top-level.dxilcache file.cargo build --release -p xclsucceeded on both commits.scripts/smoke.ps1for 60 seconds per run on a newer retail game. Both candidate runs were repeated after the push. HLSL: frames 1,069 to 1,128 (+5.52%), peak committed memory 15,336 to 15,327 (-0.06%) MB. Direct DXIL: frames 1,149 to 1,154 (+0.44%), peak committed memory 15,329 to 15,323 (-0.04%) MB. All four comparison runs exited with0x0, zero crashes and zero device removals. The deltas are single-run observations.Regression run
Each run used a clean profile, an isolated XCL cache, no input and the RTX 4060. Direct DXIL runs used
XCL_DIRECT_DXIL=allandXCL_DIRECT_DXIL_STATS=1. Per-lane lowering and the PSO disk cache were disabled.Baseline HLSL
Baseline Direct DXIL
Candidate Direct DXIL
Candidate HLSL
Not tested
XCL_SAMPLE_*datasets. Retail coverage of the specific FREXP opcode remains unverified.AI use
Assisted-by: Codex (GPT-6.2-Sol)for the implementation and tests. Codex (GPT-6 family, exact variant unavailable in the current session) reviewed upstream changes, resolved the test-placement conflict, ran and summarized synthetic and retail validation, and prepared this draft.@upipibi on GitHub · 2026-11-25 00:40 UTC · original
An independent hardware reference for the rule: boykopovar/AnyPS5's debt notes (
docs/dev/debt/shader.md, f32 denormals entry) record, from their hardware oracle on RDNA2 gfx1035 at IEEE=0 and 1, thatv_frexp_exp_i32_f32flushes its f32 input when the f32 denormal field flushes. So a denormal gives exponent 0 under the usual0xc0mode, and with denormals kept the input's own exponent is used (−148 for0x00000001). That matches what this PR does onceMODE[4]is written.Also passes here: RTX 3070 (Ampere, driver 616.56, Windows 11, debug) at
7a1f5a2, with thegpu_tests underXCL_DIRECT_DXIL=0and1giving 117 passed each, and thedxil::units passing.One merge-order note: this is the fourth open PR moving
TRANSLATOR_VERSIONfrom 7 to 8 (with #1946, #1950 and #1952). #1947 would make those bumps unnecessary.AI-assisted (Claude Code). Synthetic tests only.
@DarkPanda69 on GitHub · 2026-11-25 00:46 UTC · original
AMD run with native 64-lane waves, which this PR lists as not tested.
Tested: pass, head
7a1f5a2applied on its basemain6567c5f, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17.cargo test -p xcl --lib -- gpu:: --test-threads=4:gpu_frexp_exp_f32_denorm_*tests ok. The 2 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1and_3, which fail the same way onmain6567c5fwithout this PR on this card.Not tested:
XCL_SAMPLE_*data; the whole workspace suite; a title.AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@raylitebull on GitHub · 2026-11-25 01:07 UTC · original
Both AMD and NVIDIA passes look clean on
7a1f5a2.Remaining before merge: please rebase onto
main—#1950already tookTRANSLATOR_VERSION = 8and#1947now auto-hashesgpu/dxilsources (XCL_DIRECT_DXIL_SOURCE_ID), so the manualkernel.rsversion bump can be dropped — then letBuild and test (Windows, no GPU)complete cleanly.@zhouzhidong3-hash on GitHub · 2026-11-25 01:10 UTC · original
Independent RTX 5070 focused verification of #1994
Commit
7a1f5a2e65. No tracked source differences after execution.Windows x64, NVIDIA GeForce RTX 5070 driver 591.86, Rust 1.100.0 MSVC debug test build, DXC/DXIL 1.8.2502.11, local D3D12 Agility SDK. XCL_ADAPTER=5070 was explicitly set.
Command in each configuration
cargo test --locked -p xcl --lib gpu_frexp_exp_f32_denorm -- --test-threads=1 --nocaptureLogs are gpu-0.log and gpu-all.log in this directory. Earlier retry logs with six skips are environment failures and provide zero GPU coverage. Initial build attempts exited 101 due to transient executable-launch denial, subsequently resolved without security-setting changes. Its cause remains unknown.
Not tested in this run: baseline control, full workspace suite, Release build, native RDNA2, wave64, retail game behavior, or runtime fallback instrumentation. These results establish focused synthetic assertion coverage on this adapter.
AI assistance: OpenAI Codex prepared the environment, ran the unchanged upstream tests, inspected logs and drafted this report.
@JJAutoCompare on GitHub · 2026-11-25 01:18 UTC · original
Independent Intel Arc A770 verification of
7a1f5a2e6541c9fa0ef921e319fa81a2fdc2e42f. The checkout was clean before and after testing and still matched the open PR head before posting.Tested
32.0.101.9175, Windows 11 Enterprise Evaluation x64 build26200.9974, AMD Ryzen 7 3800X (6 cores / 12 threads exposed), Rust/Cargo 1.100.0 (x86_64-pc-windows-msvc), debug, DXC and DXIL validator 1.9.2609.5.cargo test -p xcl --lib --no-runoutside the shared Arc lock. Ran the command below once withXCL_DIRECT_DXIL=0and once withXCL_DIRECT_DXIL=1inside the lock, both withXCL_ADAPTER=A770. TEMP, TMP and the Cargo target were isolated on L:, withCARGO_BUILD_JOBS=2andCARGO_INCREMENTAL=0.XCL_DIRECT_DXIL=0XCL_DIRECT_DXIL=1The four backend-selectable cases (denormal modes, partial register writes, control flow, initial mode) passed through HLSL and Direct DXIL. The explicit Direct DXIL per-lane case passed in both runs. The explicit Direct DXIL test
gpu::dxil::round_tests::gpu_frexp_exp_f32_denorm_with_directed_roundingfailed in both runs after validation, at PSO creation, before its GPU output assertions.Not tested
Baseline, cause of the PSO failure, native wave64, other hardware or driver versions, full workspace suite, retail-title smoke, and optional sample data.
AI use
Codex (
gpt-6.2-sol) ran the existing tests, checked the logs and wrote this report.@DavidM1911 on GitHub · 2026-11-25 03:42 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!