Shaders: lower binary64 frexp exponent and significand #2350
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!2350
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2350"
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 11:25 UTC · original
andrewpozdnakov7-jpg:codex2/shader-f64-frexp→main· +211 −0 · 3 files · 2 commits · openShaders using
v_frexp_exp_i32_f64orv_frexp_mant_f64fail lowering on currentmain. The emitter now extracts the two binary64 words, computes the signed exponent, and normalizes the significand with 32-bit integer operations. It preserves signed zeros and the original infinity and NaN bits in the significand. Subnormal normalization carries bits across the two words. AMD RDNA 2 ISA, VOP1The three synthetic tests were all rejected as
Unsupportedon940d32f. On the patch, Microsoft DXIL validation and WARP confirm 44 dispatch results, including subnormal shifts of 31, 32 and 33, both zero signs, NaN payloads, register pairs, an inline integer and a negated literal. The tests verify that the DXIL does not require doubles or 64-bit integers. All 31 VALU tests pass. Strict shader Clippy and the staged asset policy pass.Output
clampandomodare refused by name. The tests cover the translated output on WARP. The corresponding RDNA hardware behavior has not been measured here.Coordination claim
Please retain the Git author when reapplying this change. If you fold it into another commit, please add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.AI-assisted. Synthetic tests only.
@Marvisak on GitHub · 2026-11-25 15:33 UTC · original · edited 2026-11-26 03:23 UTC
Automated triage for the maintainers.
Verdict: merge candidate (unchanged). The new head merges
mainand movesLower::frexp64into a child module,crates/victory-shader/src/emit/lower/frexp.rs.lower.rskeeps onlymod frexp;and the dispatch arm forv_frexp_exp_i32_f64/v_frexp_mant_f64. I compared the moved function with the one reviewed at92efc68. The only differences are thepub(super)visibility and the imports; the logic is unchanged, and so are the tests invalu_tests.rs.Note for maintainers: #2713 (same author) adds
mod directed;at the same line oflower.rs. The two PRs conflict with each other there, and the conflict is trivial.CI: passing (
check).Generated by Claude Code
@DenRakEiw on GitHub · 2026-11-25 11:30 UTC · original · approved these changes
Verified against
origin/main(940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:v_frexp_exp_i32_f64andv_frexp_mant_f64including binary64 immediates and sign modifiers.cargo test -p victory-shader frexp: 3/3 passed on RTX 5090, 3/3 passed on WARP (v_frexp_exp_i32_f64_extracts_the_exponent,v_frexp_mant_f64_extracts_the_significand,v_frexp_f64_uses_binary64_immediates_and_sign_modifiers).cargo clippy -p victory-shader --all-targets -- -D warnings: 0 warnings.cargo xtask policy: 183 files ok.AI-assisted (Gemini 4 Neon).
@catminou4 on GitHub · 2026-11-25 11:51 UTC · original · approved these changes
Tested locally: merged into main
940d32f69b,cargo test -p victory-shader --lockedon macOS arm64 — 144 passed, 0 failed, 2 ignored (Windows-gated hardware execution tests not run here). Approving — binary64 frexp exponent and significand lowered.@fuzeofficlal on GitHub · 2026-11-26 16:38 UTC · original · approved these changes
Reviewed
d30794e6e97ce92acdb2de18cb0958f1f6e63c9c(merged cleanly onto63bcca43c6a00a758510398fa43096ce7e4f7df0) and verified on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP +dxil.dll).The 32-bit two-dword normalization is bit-exact across normal values, subnormals (including the
shift = 31 / 32 / 33 / 52cross-word boundary), signed zeros, infinities, and NaNs without requiring nativef64ori64DXIL capabilities (verified across 50,318 bit patterns), and movingfrexp64intoemit/lower/frexp.rskeepsemit/lower.rsgrowth to just+96 B(520,659 B,3,629 Bbelow the 512 KiB cap).Optional follow-up notes:
MODEtracking forIEEE/ f64 input-denorm-flush is added later, note that RDNA2 quiets sNaN inv_frexp_mant_f64underIEEE=1and flushes subnormals to signed zero under input denorm flush.248(1/(2pi)low dword0x6dc9_c882, exponent-2) and asserting zeroSFI0doubles/int64flags on a dynamic-register shader (not just immediate inputs) would tighten coverage further.Verification
cargo run -p xtask -- policy(191 files ok),cargo clippy(default &--all-features) clean, changed linesrustfmt-clean.emit::valu_tests(38/38 passed) andemit::census_tests(1/1 passed) on both RTX 5090 and WARP withdxil.dllactive (PR head and merged onto63bcca43).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.