Shaders: lower binary64 fractional parts #2728
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2728
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2728"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@andrewpozdnakov7-jpg on GitHub · 2026-11-25 19:01 UTC · original
andrewpozdnakov7-jpg:codex2/fract-f64→main· +305 −0 · 3 files · 2 commits · openSummary
Lower RDNA 2 V_FRACT_F64 in VOP1 and VOP3. The lowering uses two 32-bit words, rounds ties to even and keeps finite results below one. It writes both destination words under the lane guard and requires neither host doubles nor int64. VOP3 source abs and neg are supported.
The RDNA 2 ISA defines the operation as x minus floor(x). RDNA 2 and RDNA 4 measurements confirm that tiny negative inputs return the largest binary64 value below one.
Verification
13f91ca, both synthetic tests fail during shader translation with Unsupported v_fract_f64.Coordination claim
Please retain the Git author if cherry-picking or rebasing this commit. If folding it into another commit, add Co-authored-by: andrewpozdnakov7-jpg [email protected].
AI-assisted. The regression uses synthetic inputs.
@kotekompotek on GitHub · 2026-11-25 19:04 UTC · original
Impressive lowering. Verified the hard parts:
Test matrix is genuinely exhaustive. LGTM.
@fuzeofficlal on GitHub · 2026-11-25 19:34 UTC · original
Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP +
dxil.dllverification and IEEE-754 review of325fda6(on13f91ca):Verification (
rustc 1.98.1MSVC, Windows SDK10.0.26100.0dxil.dll)cargo xtask policy: 184 files ok.cargo clippy --locked -p victory-shader --all-targets -- -D warningsand--features host: 0 warnings.cargo test --locked -p victory-shader --lib -- fract_f64 emit::tests emit::lower emit::valu_tests(skipping the 4 long exhaustive 16-bit/3-op tests; RTX 5090 hardware + WARP +dxil.dllactive): 72 passed, 0 failed.0af08f5): clean zero-conflict merge; all 4 binary64 tests pass together on RTX 5090 + WARP +dxil.dll.Review Notes
firstbitLo/firstbitHi+ safeshift_fraction_wordsavoidsSFI0DOUBLE/INT64flags and shift UB, while accurately implementing RDNA2[0.0, 1.0)semantics:fract(-0.0) = +0.0, exact integers and|x| >= 2^52 -> +0.0, positive subnormals preserved without FTZ, negative small/subnormal inputs (-2^-54,-3*2^-54,-2^-1074) rounded-to-nearest-even and clamped tonext_down(1.0), and±Inf/sNaN/qNaNquietened via| 0x0008_0000.f64source decode helper with #2713 if both land).@Marvisak on GitHub · 2026-11-25 23:16 UTC · original
Automated triage for the maintainers.
This adds a lowering for
v_fract_f64(VOP1 and VOP3) in the newcrates/victory-shader/src/emit/lower/fract.rs, dispatched fromLowerinlower.rs. It works on two 32-bit words, so it needs no double or int64 DXIL flags.What I checked:
The behaviour cites the public RDNA2 ISA document and published hardware measurements. The tests cover 32 inputs through VGPR and SGPR pairs, plus abs and neg. CI:
checkpasses. This is a recommendation for a maintainer to look, not an approval.Generated by Claude Code
@HAL9000RELOADED on GitHub · 2026-11-25 23:25 UTC · original
First Radeon run of
7b0550c: RX 7900 XTX (RDNA3), driver 32.0.32015.7029, Windows 10 22H2 (19045), Agility SDK 1.620 in the shader test binaries through #486. Base:481d699(main842b0cb+ #486).victory-shader: 303 passed, 1 failed. Both new tests pass on the card:fract_f64_vop1_returns_both_words_below_oneandfract_f64_vop3_literals_obey_abs_and_neg.pops_wait_loop_exits_immediately_for_inactive_lanes, which wants an SM 6.6 WARP device (this Windows 10 WARP reports SM 6.2). It fails the same way on the base without this PR.So the lowered binary64 fract matches on RDNA3 hardware as well as on the RTX 5090 and WARP.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.