Recompiler: direct DXIL asks for flushed f32 denormals #1697
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1707"
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 MarcosMDev on 2026-11-24T19:29:33Z.
Part of #1269. The direct backend's entry function carries no
fp32-denorm-mode, so the driver may flush or keep f32 denormals per operation. This asks forftz.Preventive: I found no wrong result on
mainitself. On an RTX 4060, a local pass that reads guarded values past theirselect(not part of this PR) gave wrongv_fmac_f32+v_xor_b32results in 65 of 2204 lanes without NaN, against a CPU simulation that flushes denormals. Without the pass, and on the HLSL path, 0. With this attribute, 0 of 1502 in a new random run. These lane counts were measured onc160d86, before #1693 and0b64aa0, and not repeated. Other passes that remove guards may meet the same.What is in it
gpu/dxil/module.rs: attribute group 5, on the defined (entry) functiongpu/dxil/kernel.rs:TRANSLATOR_VERSION7 (the containers change;mainhas 6)gpu/dxil/tests.rs: the disassembly has the attribute on the entry function (fails without the change)Tested
cargo test --workspace -- --test-threads=4: 960 passed, 0 failed, 43 ignored; 23 SKIPPED lines: 18 no wave64, 3 per-lane programs refused (f16 / conversions),pso_measurement_compiles_an_exact_synthetic_record(driver cache cannot be disabled, no Developer Mode),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows)XCL_DIRECT_DXIL=all cargo test -p xcl --lib gpu:: -- --test-threads=4: 441 passed, 0 failed, 19 ignoredRegression run
Both with
XCL_DIRECT_DXIL=all, main first. main:This PR:
Not tested
s_denorm_modeis ignored today, and FSSM float modes are not consulted here.mainc160d86) had 14 direct shaders (7 PS, 7 VS), no CS.AI use
Imported from ivall/xcl. Originally posted by nnonno91 on 2026-11-24T20:11:01Z.
Native Windows GPU test of
540d9659fbd88f63e60bad310db193c9d48ad323. The direct shader includes the FTZ attribute, and the tested arithmetic cases flush on both AMD and NVIDIA. The same cases already flushed on these drivers at the PR's parent.Tested
XCL_ADAPTER.cargo build --workspace --lockedpassed.cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --show-outputreported 864 passed, 0 failed, 42 ignored. One pass loggedheap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows. WithXCL_DIRECT_DXIL=all,cargo test --locked -p xcl --lib gpu:: -- --test-threads=4 --show-outputreported 370 passed, 0 failed, 19 ignored, no skips.7ccf774cf0a3f4415ff1940aa2b4b554f08f6a32on both GPUs.cargo test --locked -p xcl --test ftz_gpu_probe -- --exact denormal_arithmetic_and_raw_bits --test-threads=1 --nocapturereported 1 passed, 0 failed, 0 ignored per invocation, no skips. It emitted RDNA2V_MUL_F32,V_ADD_F32, and a rawV_MOV_B32and ran wave32 and the adapter's wave64 form.fp32-denorm-mode="ftz"on the head's direct shader. The probe used signed subnormal inputs multiplied by 2^126, signed minimum normal inputs multiplied by 0.5, and two normal operands that cancel to a subnormal sum. Direct DXIL, HLSL default and HLSL-denorm ftzall produced signed zero in 288/288 arithmetic checks per GPU and mode, on both revisions. HLSL-denorm preservereturned the expected nonzero bits in 288/288. All raw bit copies and ordinary products matched their references. The temporary probe was removed from both worktrees.Not tested
Retail frames, the separate guarded-value optimization mentioned in the description, or explicit RDNA2 denormal mode changes.
AI use
OpenAI Codex (GPT-6 family, exact variant unavailable) wrote the temporary probe, ran the tests, checked the logs, and wrote this report.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T22:09:46Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored.Thanks!
Imported from ivall/xcl. Originally posted by MarcosMDev on 2026-11-25T15:24:18Z.
Closing: this is preventive, I found no wrong result on
main, and it now conflicts. The data is in the description and in #1269 for anyone removing guards.Pull request closed