Repository navigation
Conversation
…xcl-dev#796) v_sin_* / v_cos_* take the argument in turns. XCL emitted sin(x * 6.2831853f), which rounds the phase away at radian scale before any reduction: on an RTX 3070 sin(100000.125) gave 0.6716 for 0.7071, and ±MaxFloat gave NaN because the product overflows. The RDNA 2 ISA's own examples (p.142, p.149) have sin(-MaxFloat) = 0, cos(-MaxFloat) = 1, cos(0.25) = 0 and V_SIN_F16(0x7bff) = 0. sin_turns / cos_turns reduce exactly with x - trunc(x) first, return exact zeros at whole and half turns (sin) and quarter turns (cos), keep sin(-0) = -0, and give ±inf the ISA's 0xFFC00000 and a NaN itself on the bits (DXC's relaxed float math otherwise turned sin(inf) into 0 on the 3070). The f16 forms use the same helpers on the exact f32 value. gpu_sin_cos_reduce_in_turns checks every functional example the ISA prints for the four instructions plus whole, half and quarter turns and large arguments; it fails on main with 21 mismatches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent native Windows NVIDIA RTX 5080 (wave32) + D3D12 debug layer build/test run and code review at head Code Review
Tested
Not tested
AI use: Antigravity (Gemini 4 Neon reviewed the diff; Gemini 4 Hydrogen ran the RTX 5080 workspace tests) drafted this report. |
|
Test run of Tested
Review: Reducing in turns ( Not tested: no retail title or regression run (I have no unpacked game), no Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code. |
|
Updated hardware check for new head Tested
Regression run PR ( Not tested
AI use
|
|
Regression runs for this PR's head main: this PR: Tested
Not tested
Report written with Claude Code (Claude Opus 5.5) from runs on this machine. |
|
2| |
…e RDNA2 results luckyteagirl measured the native instructions on an RX 6800M (gfx1031) in xcl-dev#796 (comment). gpu_sin_cos_reduce_in_turns now uses those results as hardware rows: - f32: -0, 0.25 / -0.75, 0.5 / 8388607.5, ±MaxFloat, and ±Inf giving 0xFFC00000. Rows that used to check only "near ±1" now check exact bits. - f16: -0, 255, ±65504, and ±Inf giving 0xFE00. - 0.125 turns (f32 at 0.125, 255.125, 100000.125, 1000000.125, giving 0x3F3504F4 / 0x3F3504F3; f16 at 0.125, 255.125, giving 0x39A8): these values come from each GPU's own sine approximation, so they are compared within one ulp. On the RTX 3070, v_sin_f16 / v_cos_f16 of ±Inf gave 0x7FFF, because f32tof16 turns the f32 NaN into that value. They now take the infinity from the source bits and give 0xFE00. With clamp the NaN saturates as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Updated AI-assisted (Claude Code). |
|
Test report: NVIDIA RTX 5060 Ti (wave32), head Tested
Not tested
AI use: Claude Code (Claude Opus 5.5) ran the commands above and wrote this report. No code changes. |
|
Tested on NVIDIA (32-lane waves): passes
Not tested: AMD, any title (no smoke run). AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report. |
|
@eizispark @Anon64 thanks for the smoke pairs. Both were made on AI-assisted (Claude Code). |
|
Regression pair for Tested
this PR, Presents per 2 s over the whole run (from the
Both runs are at the 60-a-window cap most of the time. The 63-frame gap is two single dips in the PR's run (36 against 50 at 6-8 s, 39 against 60 at 14-16 s) and a slow phase from about 44 s that both runs have (111 frames in the last 16 s against 138). On #1244 today the same slow phase gave one pair 87 % and the next 103 %, so one pair can't separate a few percent from run-to-run spread. Not tested
AI use: Claude Code (Claude Opus 5.5) |
|
Tested The checked-in Intel Arc A770 driver 32.0.101.9175, Ryzen 7 3800X, Windows 11 Enterprise Evaluation build 26200.9974, Rust 1.100.0 x86_64-pc-windows-msvc, and the unoptimized Cargo test profile with debug info disabled. The test logged dxcompiler and dxil 1.9.2609.5. The A770 capability probe reported an 8–32 lane range. The test used split wave64 and checked 64 logical lanes. $env:CARGO_TARGET_DIR = 'L:/XclTooling/pr1512-tiling-edges-fddfa267/target'
$env:TEMP = 'L:/XclTooling/pr818/run-20261125-023707-153/temp'
$env:TMP = $env:TEMP
$env:CARGO_BUILD_JOBS = '2'
$env:CARGO_INCREMENTAL = '0'
$env:CARGO_PROFILE_DEV_DEBUG = '0'
$env:CARGO_PROFILE_TEST_DEBUG = '0'
$env:XCL_ADAPTER = 'A770'
$env:XCL_DXC_DIR = "$env:LOCALAPPDATA/XclTooling/dxc-1.9.2609/bin/x64"
cargo test -p xcl --lib --locked --no-runThe prebuild exited 0 outside the GPU lock. The following block ran in & 'L:/XclTooling/Invoke-ArcTest.ps1' -Test {
& 'L:/XclTooling/CapabilityProbe/capabilities.exe'
& 'L:/XclTooling/pr1512-tiling-edges-fddfa267/target/debug/build/xcl/77aca8ccb20e299f/out/xcl-77aca8ccb20e299f.exe' 'gpu::recomp::tests::gpu_sin_cos_reduce_in_turns' --exact --nocapture --test-threads=1
}
Not tested Native wave64, the old lowering on Arc, other GPUs, the full workspace suite, and retail-title smoke runs. AI use Codex in T3 Code ( |
v_sin_*/v_cos_*take their argument in turns. XCL emittedsin(x * 6.2831853f), which rounds the phase away at radian scale before any reduction, so the error grows with the number of turns. ±MaxFloat overflows the product to infinity and gives NaN. The RDNA 2 ISA's functional examples (p.142 for f32, p.149 for f16) reduce in turns and accept every finite input:V_COS_F32(0.25) = 0,V_SIN_F32(-MaxFloat) = 0,V_COS_F32(-MaxFloat) = 1,V_SIN_F16(0x7bff) = 0. Mesa's ACO drops its explicitv_fractfrom GFX9 on ("before GFX9, v_sin_f32 and v_cos_f32 had a valid input domain of [-256, +256]").Fixes #796.
What is in it
crates/xcl/src/gpu/recomp/emit.rs: HLSL helperssin_turns/cos_turns(andtrig_nonfinite), used byv_sin_f32,v_cos_f32,v_sin_f16andv_cos_f16.x - trunc(x), which is exact in f32, and then scale.sin(-0) = -0.0xFFC00000and a NaN input gives itself, quiet. Without that guard, DXC's relaxed float math turnedsin(±inf)into 0 on the 3070 (inf - trunc(inf)was lost).crates/xcl/src/gpu/recomp/tests.rs: GPU testgpu_sin_cos_reduce_in_turns.sin/cos(2π·(x - trunc(x))), within 2^-16 (f32) or 2^-10 (f16) absolute.Tested
NVIDIA GeForce RTX 3070, driver 616.56, AMD Ryzen 9 5950X, Windows 11 Pro 26100, rustc 1.100.0, debug, DXC 1.8.2502.11
cargo test --workspace --no-fail-fast -- --test-threads=4on baf0639: 705 passed, 0 failed, 41 ignoredSKIPPED GPU tests:
gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64)The new test fails on
main(e50836b) with 21 mismatches, among themsin(100000.125) = 0.6716,sin(±MaxFloat)/cos(±MaxFloat)= NaN,cos(-0.75) = -1.9e-7,sin(12345.5) = 0.0061,V_SIN_F16(0x7bff) = 0xA648,V_COS_F16(0x7bff) = 0x3BFF. It passes with the change.Open PR Tests: f32 and f16 transcendentals on the GPU against f64 references #643's
gpu_transcendental_f32/_f16(its head 232ee73, applied locally on top) pass both onmainand with this change. Worst errors on the 3070 from its own output:mainTests: f32 and f16 transcendentals on the GPU against f64 references #643 can keep its tolerances. With this PR its 2^-10 absolute allowance for sin / cos could tighten to the D3D class it uses for the others, and its skip of inputs above 256 turns could go.
Regression run
From Kalmarv's run (#818 (comment)), thanks:
main:
PR:
Not tested
sin(0.5)) and at a negative whole turn: the ISA prints none. This PR returns +0, matchingV_SIN_F32(-MaxFloat) = 0x00000000.v_sin/v_cosnow does atrunc, a subtraction and two compares more.AI use
🤖 Generated with Claude Code