Repository navigation
Conversation
The VEC_F table lowers v_rcp_f32, v_rcp_iflag_f32, v_sqrt_f32, v_rsq_f32, v_exp_f32 and v_log_f32 to 1.0 / x, sqrt, rsqrt, exp2 and log2, and no check ran any of them. tests/startup_gfx2hlsl_float_transcendental_check.py draws them with the shared per-lane runner (byte-identical copy of tests/startup_gfx2hlsl_lane_alu.py) on powers of two (and 0 and 9 for the square root), so every result is exact and the draw checks which function and which base each operation is lowered to, not its precision. Each operation has a mutated lowering whose first draw must read its own words. All 24 draws match on WARP and an RX 6600 through FXC ps_5_1 and DXC ps_6_0, and the 12 mutated draws read their mutated words.
tedin7
left a comment
There was a problem hiding this comment.
Review of head 627d66e8d5c45b176e88ee53bb6037021b0d9fbe. Tests, CMake, CI list and docs only; tools/startup/gfx2hlsl.py is unchanged. Verdict: 0 P1, 0 P2, with coverage nits.
Linux limits. Linux x86_64, llvm-mc-19 (the new CI entry pins llvm-mc-15), Python 3.14. No Windows, no DXC/FXC, no WARP or GPU: I could NOT run the draw mode, so the claimed 24 matching and 12 mutated draws on WARP and RX 6600 are not verified by me.
What I ran
python3 -B tests/startup_gfx2hlsl_float_transcendental_check.py(controls): passes.... binary llvm-mc-19:fixture words match llvm-mc.git diff --check origin/main...HEAD,docs_links_check.py,bidi_controls_check.py: clean; no non-ASCII bytes in the diff.- Semantics: the lowerings are
1.0 / x(rcp and rcp_iflag),rsqrt,sqrt,exp2,log2;v_exp_f32andv_log_f32are base 2 in the ISA, and every draw input is a power of two (or 0 and 9 for sqrt), so every reference is exact and the test checks which function is used, not the approximation error (the docs say so). Reference values recomputed by hand for a few lanes (rcp 4 = 0.25, rsq 16 = 0.25, exp2(10) = 1024, log2(2^-20) = -20): consistent. - Mutations (restored with
git checkout -- .):v_rcp_iflag_f321.0 / {0}->2.0 / {0}: controls FAILED (('v_rcp_iflag_f32', 0), the mutation regex no longer matches).v_exp_f32exp2->exp: controls FAILED (('v_exp_f32', 0), same mechanism).v_rsq_f32rsqrt({0})->1.0 / sqrt({0}): controls FAILED (same mechanism; the value is the same, the shape is not).- test body word of
v_rsq_f320x5d -> 0x5c: FAILED inbinary(assembled words differ). v_sqrt_f32sqrt({0})->sqrt(abs({0})): controls andbinaryPASSED. This one also survives the draws: everyv_sqrt_f32draw input is 0 or positive, so the negative-domain behavior is not observed anywhere.
Coverage nits (not blocking)
- Specials are untested for all six operations:
rcp(+/-0),rsq(0),sqrt(-x)andsqrt(-0),log2(0),log2(-x),exp2overflow and underflow, NaN and infinity, and denormal inputs. These are where RDNA 2 and HLSL may differ (flush, sign of zero, NaN payload), so the "which function is lowered" check does not protect them. v_rcp_f32andv_rcp_iflag_f32share one lowering and one input set; the flag behavior of_iflagis not (and cannot be) observed.- As on the sibling PR #1741, a wrong value that keeps the shape of the translated text is only caught by the Windows draws.
Not approving (comment only).
AI-assisted; commands listed were executed locally.
Draw mode, run on Windowstedin7's review says it plainly: 2026-11-24, head Same totals as the table in the PR body. What differs, row by row: the hardware row is a different AMD architecture, One line of detail on the mutations, because it separates "reads a different number" from "reads the mutation's own reference": for Environment: Windows 11 25H2 Limits: one adapter, one driver, no debug layer. As the test says, the inputs are exact powers of two, plus the two AI-assisted; runs executed on the machine above. |
|
Hardware run of head 627d66e. Windows 11 Pro 26100.9168, DXC/FXC from Windows SDK 10.0.26100,
The rcp, rcp_iflag and rsq rows pass on the Quadro too. The failing draw:
No changes made. |
|
@Asimmimx could you rebase this branch onto current GitHub reports head Files that conflict with current
Commands run locally: Once it is rebased and CI is green it will be re-checked right away. AI-assisted; commands listed were executed locally. |
Refs #1149.
Change
The
VEC_Ftable oftools/startup/gfx2hlsl.pylowers six operations to HLSL, and no check ran any of them:v_rcp_f32,v_rcp_iflag_f321.0 / xv_sqrt_f32sqrt(x)v_rsq_f32rsqrt(x)v_exp_f32exp2(x)v_log_f32log2(x)This PR adds a check only. The translator does not change.
tests/startup_gfx2hlsl_float_transcendental_check.pydraws them with the per-lane runnertests/startup_gfx2hlsl_lane_alu.py. The runner is byte-identical to the copies in #1703, #1706, #1708, #1712 and #1741. Each draw runs one operation per lane on flat inputs, alternating_e32and_e64, and compares the four result words exactly.Exact inputs only. Every input is a power of two, or 0 and 9 for the square root, so every result is exact:
The draw therefore checks which function and which base each operation is lowered to.
v_exp_f32andv_log_f32are base 2 in the AMD RDNA 2 ISA reference. The draw does not check the precision of an adapter's approximation.Mutations, one per operation. The first draw with the mutated lowering must read the mutation's own reference words:
2.0 / xfor the reciprocals;exp2(x) * 2;log2(x) + 1.v_sin_f32andv_cos_f32are not covered. Their results at the few exact points depend on the approximation.Results
Commit
627d66e8onorigin/main. Windows 11 26300.9974, DXC 1.8.2502.11, FXC 10.0.26100, debug layer on.There were no skips.
binarywith llvm-mc 19.1.1 givesfixture words match llvm-mc.docs_links_check.pypasses.AI-assisted (Claude Code).