Repository navigation
[upstream #1144] Recompiler: v_div_fmas_f32 scales by VCC and v_div_fixup_f32 handles NaN/zero/sign - #18
Closed
ufoptg wants to merge 1 commit into
Closed
[upstream #1144] Recompiler: v_div_fmas_f32 scales by VCC and v_div_fixup_f32 handles NaN/zero/sign#18ufoptg wants to merge 1 commit into
ufoptg wants to merge 1 commit into
Conversation
…NaN/zero/sign v_div_fmas_f32 emitted mad(s0, s1, s2) and ignored its implicit VCC operand instead of scaling by 2^32 (ldexp_f(..., 32)) for lanes with VCC == 1. div_fixup returned q unchanged when q was NaN (overflow in the quotient sequence), when n == +-0.0 with finite d, and without forcing the result sign to sign(d) ^ sign(n). Handle NaN/zero/inf special cases and sign on the IEEE-754 bits directly, with GPU tests for both instructions across wave32 and split wave64. Assisted-by: OpenCode (Gemini 4 Neon)
Owner
Author
|
Upstream PR xcl-dev#1144 was closed or merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
v_div_fmas_f32emittedmad(s0, s1, s2)and ignored its implicitVCCoperand, so lanes withVCC == 1never got the2^32scale (ldexp_f(..., 32)).div_fixup(v_div_fixup_f32) returnedqunchanged whenqwasNaN(overflow in the division sequence), whenn == ±0.0with finited, and without setting the result sign tosign(d) ^ sign(n). This replacesdiv_fixupwith an IEEE-754 bit-level implementation covering NaN,0/0,Inf/Inf,x/0,Inf/x,x/Inf,0/x,q = NaNoverflow, andcopysign(q, sign(d) ^ sign(n)).What is in it
crates/xcl/src/gpu/recomp/emit.rs: scalev_div_fmas_f32by2^32vialdexp_ffor lanes withVCC == 1; updatediv_fixupfor NaN/zero/inf/sign cases.crates/xcl/src/gpu/recomp/tests.rs: add GPU testsgpu_div_fmas_f32_scales_by_vccandgpu_div_fixup_f32_special_cases_and_signacross wave32 and split wave64 (both verified failing before the fix).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 743 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2no wave64—gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware)cargo test -p xcl --lib gpu_div_fmas_f32_scales_by_vccandgpu_div_fixup_f32_special_cases_and_sign: both pass across wave32 and split wave64 (both failed on the GPU before the fix)Regression run
main:
PR:
Not tested
AI use
emit.rs, wrote the fix and GPU tests, ran the test suite andscripts/smoke.ps1regression runs, and drafted this PR description.Mirror of xcl-dev#1144 (auto-synced, do not edit).