Repository navigation
Shaders: lower v_trig_preop_f64 argument reduction - #2988
andrewpozdnakov7-jpg wants to merge 2 commits into
Conversation
kotekompotek
left a comment
There was a problem hiding this comment.
Verified: correct Payne-Hanek window semantics — segment&31 *53 + max(0, exp-1077) indexes the 2/pi bitstream, the 1968 large-exp boost shifts by +128 (table clamp to the zero tail handles overflow), and the pack path normalizes the 53-bit window via leading-zero count with a truncate-toward-zero subnormal path. Exponent-only input handling is sound (inline consts are all below the shift threshold; abs/neg don't touch the exponent). The test rows pin the exact 1077 and 1968 boundaries plus sel=0x20 wrap and inf/NaN inputs.
|
Independent test report: Windows, software WARP only, synthetic inputs only. Not a code review. Head Setup: Results (
Independent reference: I wrote a Python model from the RDNA2 ISA pseudocode. Its 2/π bits come from mpmath at 1600 bits of precision, not from the PR's table. The model's rules:
It matches all 48 rows of the PR's test exactly. Sweep: 16,704 rows, with the expected values taken from that model:
Limitation: table length. If the model uses the full 1201-bit table that the ISA text gives ( Disclosure: tested with Claude Code (Claude Opus 5.5). |
fuzeofficlal
left a comment
There was a problem hiding this comment.
Code review on 9b0f44f0 (static source & bit-exact integer model verification; emitted DXIL was not executed on hardware):
crates/victory-shader/src/emit/lower.rs:6319wiresv_trig_preop_f64intocrates/victory-shader/src/emit/lower/trig_preop.rs:49-101, checking the destination register pair, masking the selector, bounding table loads/shifts (:158-230), and writing both output words under the active execution guard.- Verified the lowered word arithmetic and table indexing against an independent integer model across all 65,536 exponent × masked-selector combinations, matching every case including all 48 fixture rows in
semantics_tests.rs:3022.
|
Thanks for checking both tables. I also compared the 96 published trig results in AnyPS5 #447. Both models match those cells. The width comes from its separately reported Radeon 660M end-of-table sweep. 313acc3 adds three model-derived cases that distinguish the widths. I ran the same fixture on Agility WARP with the production table and with a temporary 1201-bit table.
The production table passed all 106 cases. The extended table failed these three cases in each modifier form. The table here contains model and WARP results. Direct RDNA2 observations for these three input pairs would provide a separate check of the reported tail width. |
|
Automated triage for the maintainers. Verdict: merge candidate. This lowers The lowering reads a 53-bit window of 2/pi starting at One point to check before merging: the source CI: passing ( Generated by Claude Code |
Dukestar69
left a comment
There was a problem hiding this comment.
Tested locally merged onto origin/main (63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP + dxil.dll):
- Diff review: Lowering
v_trig_preop_f64in its ownemit/lower/trig_preop.rssubmodule keepslower.rswithin the 512 KiB file-size policy limit and verifies argument reduction end-to-end on GPU. cargo test -p victory-shader trig_preop -- --test-threads=1(RTX 5090 & WARP): all tests passed on both.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 192 files ok.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
…ment reduction # Conflicts: # crates/victory-shader/src/emit/lower.rs
…ment reduction # Conflicts: # crates/victory-shader/src/emit/lower.rs
Summary
Lower v_trig_preop_f64 by reading the selected 53-bit window of 2/pi, applying the large-input scale and packing both binary64 words with truncation. The table uses the measured 1184-bit RDNA2 prefix. All operations use i32 DXIL under VIctory's current f64 denormal model.
Verification
Sources: AMD RDNA2 ISA guide, RDNA2 table measurements, and hardware result rows.
AI-assisted with Codex.