Skip to content

Fix #726: NaN-safe v_med3_f32 lowering - #2010

Open
tharun-37 wants to merge 1 commit into
Marvisak:mainfrom
tharun-37:fix/med3-nan
Open

tharun-37 wants to merge 1 commit into
Marvisak:mainfrom
tharun-37:fix/med3-nan

Conversation

@tharun-37

Copy link
Copy Markdown

Split from #2000 (shader-only, covered by macOS test queue). NaN-safe min/max so a NaN operand yields the smaller of the two numbers. v_med3_f32_matches_rdna2_with_nan passes.

@Dathinel

Copy link
Copy Markdown
Contributor

The existing v_med3_f32_matches_rdna2_with_nan test runs on Windows. On an RTX 3050 Laptop (driver 610.62) and WARP it passes on both 940d32f and this PR's 36451bd, including the original (1, 2, NaN) case. A macOS test run omits this module.

I also compared all 216 ordered triples drawn from −1, −0, +0, +2 and two quiet NaNs with different signs and payloads. Both revisions matched the same reference for every triple on each backend. I compared signed zeros by bit pattern and accepted any NaN for the all-NaN case.

The remaining check that can distinguish the fix is a before/after run on the Intel UHD setup that reproduces #726. The patch still emits unordered floating-point comparisons for its NaN checks. On that setup, please record the actual adapter and the result of this exact test on each revision:

cargo test --locked -p victory-shader --lib emit::valu_tests::v_med3_f32_matches_rdna2_with_nan -- --exact --nocapture

Synthetic inputs only. AI-assisted.

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f, cargo test -p victory-shader --locked.

144 passed / 0 failed. NaN-safe v_med3_f32 lowering — fixes issue #726. Note: #2000 claimed #726 too (as part of #721/#722/#726); #2009+#2010 split it. Also relates to #1259 (v_med3 -0/+0 ordering) — check the three compose.

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Needs work.

CI: check passing.


Generated by Claude Code

@sinan-cmyk

Copy link
Copy Markdown

Offline measurement on a retail dump

Result: no count change against main.

I merged head 36451bd onto main 940d32f (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 23,918 on main, 23,918 with this PR.

No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants