Repository navigation
Recompiler: translate v_trig_preop_f64 in both backends - #2315
NWProgramming00 wants to merge 1 commit into
Conversation
Both backends refused v_trig_preop_f64. This follows the RDNA2 ISA pseudocode with the table measured on an RDNA2 gfx1036: the 53 bits of 2/pi that start S1[4:0] * 53 bits (plus exp(S0) - 1077 past 1077) below b1200, times 2^(-53 - shift), plus 2^128 when exp(S0) >= 1968. The hardware's table ends at b17. The product is then always exact, so the double is built from integers. The HLSL backend reads a 37-word table that it declares only when the instruction is used. Direct DXIL selects the words. An output modifier is refused; it was not measured. gpu_trig_preop_f64_matches_rdna2 checks both backends against 64 rows measured on the gfx1036. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent focused check of Tested
Not tested The larger hardware capture, retail smoke, and the full workspace suite. AI use OpenAI Codex (GPT-6.2 Sol) ran the tests, checked the logs and wrote this report. |
|
RDNA3 confirmation: the new f64 trig translation is bit-exact on gfx1100 too. The fix is calibrated against gfx1036 hardware measurements; here it is on RDNA3 (RX 7900 XT, NAVI31) under RADV, which the PR does not list as tested. Tested:
Not tested: Windows on this card; gfx103x native Linux (native target, not Wine). AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting. |
Both backends refused
v_trig_preop_f64. This translates it as RDNA2 hardware runs it. I measured the hardware first, then checked xcl against it bit for bit.What the hardware does (gfx1036, 2,072 measured rows, MODE with f64 denormals kept)
shiftbits below b1200, times 2^(−53 − shift).shift = S1[4:0] × 53, plusexp(S0) − 1077when the S0 exponent is above 1077.What is in it
crates/xcl/src/gpu/recomp/emit.rs:trig_preop()helper and the 37-word table (TRIG_PREOP_2_OVER_PI);crates/xcl/src/gpu/dxil/lower_wide.rs: the same computation in the direct DXIL translator. It reads the table with a chain of selects, because that translator has no constant arrays.crates/xcl/src/gpu/dxil/lower.rsandemit.rs:v_trig_preop_f64leaves the list of f64 ops that follow the f64 round mode (it does not round).OMOD/CLAMP) is refused, because I did not measure it.crates/xcl/src/gpu/recomp/tests.rs:gpu_trig_preop_f64_matches_rdna2checks both backends against 64 rows measured on the gfx1036.trig_preop_f64_with_omod_is_refusedchecks the OMOD refusal in both backends.Tested
XCL_ADAPTER=radeon). Rust 1.100 MSVC, release.cargo build --release --workspace, thencargo test --release --workspace --no-fail-fast -- --test-threads=4, with and withoutXCL_DIRECT_DXIL=all, against base1a0bbe3on the same machine:1a0bbe344455fe)XCL_DIRECT_DXIL=allXCL_DIRECT_DXIL=allThe +2 are the new tests. The failing tests are the same on base and PR, and all are tracked:
fuzz_validate_and_gpu_0..3on NVIDIA (#1905),fuzz_validate_and_gpu_1on RDNA2 (#2115, #2170) andoffline_compute_pipeline_is_reused_by_a_second_processwith direct DXIL (#1674).Regression run
Base (
main06c9f55), NVIDIA GeForce RTX 5070 Ti:This PR (
44455fe), same card:Earlier runs here ended at about 44 s on
mainand on this PR alike. The cause was #695: this PC had no active playback device. With one active, both runs reach their end.Not tested
OMOD/CLAMPon this instruction (refused).AI use
🤖 Generated with Claude Code