Shaders: lower binary64 ceiling and floor #2713
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!2713
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2713"
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 18:39 UTC · original
andrewpozdnakov7-jpg:codex2/directed-f64-rounding→main· +185 −0 · 3 files · 3 commits · openSummary
Lower RDNA 2 V_CEIL_F64 and V_FLOOR_F64 in VOP1 and VOP3. The lowering rounds the two 32-bit register words directly, keeps the sign of zero, and writes both destination words under the lane guard. The emitted shader requires neither the doubles nor the int64 optional feature.
The RDNA 2 ISA defines these as rounding toward positive and negative infinity.
Verification
13f91ca, the same two synthetic D3D12 tests fail during translation with Unsupported v_ceil_f64 and Unsupported v_floor_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].
@kotekompotek on GitHub · 2026-11-25 18:55 UTC · original
Verified the bit-level algorithm: exponent >= 1075 short-circuits to integral (covers NaN/inf passthrough), the low-word bias plus carry-into-high handles the 32-bit boundary, clears_high (>32) vs clears_low (>=32) split is exactly right, and below-one maps to signed zero or signed one preserving -0.0 semantics (ceil(-0.5) = -0.0). Inline float constants widened f32->f64 and the 1/(2pi) constant handled explicitly. No doubles/int64 feature needed is a nice property for older hosts.
@fuzeofficlal on GitHub · 2026-11-25 19:34 UTC · original
Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP +
dxil.dllverification and IEEE-754 review of0af08f5(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 -- directed_f64 emit::tests emit::lower --test-threads=1(RTX 5090 hardware + WARP +dxil.dllactive): 46 passed, 0 failed.325fda6): clean zero-conflict merge; all 4 binary64 tests (directed_f64_*andfract_f64_*) pass together on RTX 5090 + WARP +dxil.dll.Review Notes
SFI0DOUBLEandINT64flags clear while handling±0.0sign preservation (ceil(-0.0) = floor(-0.0) = -0.0), subnormals (±2^-1074), word-boundary shifts (n < 32,n == 32,n > 32withshift = n & 31),|x| >= 2^52,±Inf,abs/neg, and240..=248inline constants cleanly, while conservatively rejectingclamp/omod/sdwa/dpp.round_directed_f64passes ansNaNthrough unquieted (unlike #2728's| 0x0008_0000quietening), and if both #2713 and #2728 land, the ~40-linef64source operand +abs/negdecode block can be shared in a single helper.@oni-swr on GitHub · 2026-11-25 19:41 UTC · original
Independent WARP/CPU verification
Head:
0af08f5419502a3054bcdd0d61af2cbff1e6a797Base:
origin/main13f91caee25f2fdf2c062be5f7a27f058e51cbcaStatus: open, non-draft; clean merge tree; no
oni-swrcomment on this head.Environment: Windows x64, WARP selected (
VICTORY_WARP=1,VICTORY_D3D12_WARP=1),dxil.dll1.8.2502.11 from Windows SDK 10.0.26100.0; rustc 1.98.1.Commands (each with
CARGO_TARGET_DIR=D:\victory-warp-2690-targetand the WARP variables above):cargo test --locked -p victory-shadercargo test --locked -p victory-shader directed_f64_cargo clippy --locked -p victory-shader --all-targets -- -D warningsResults: baseline 267 passed, 3 failed, 3 ignored; PR 269 passed, the same 3 failed, 3 ignored. The unchanged WARP failures are
a_mask_joined_with_data_at_a_uniform_loop_is_its_number,gathers_at_a_level_match_the_hardware, andpermutes_read_the_lane_named_and_zero_from_lanes_left_out(two wave-32 pipeline availability failures and one gather mismatch). Both new f64 tests passed (2/2). Clippy passed.Negative control: disabled the new dispatch arm; the directed-f64 targeted test failed (exit 101), as expected. No issue found in the changed lowering by review.
Not tested: physical GPU, retail title, release build. AI-assisted: Codex (gpt-6-luna).
@pablogonz12 on GitHub · 2026-11-25 19:41 UTC · original
AMD/RADV offline check of the head commit (no game run).
origin/main13f91caee.victory-shader --example retranslate, then dxil-spirv (master),spirv-val --target-env vulkan1.3, and a realvkCreateCompute/GraphicsPipelineson RADV (vkpipe, one process per program, so a driver crash or hang is recorded per program rather than stopping the batch).Result, base
13f91caeevs head0af08f541: both translate 749 / 751 (the same 2 refused in both:a lane mask read as data is not supported). 0 of the 751 programs' DXIL bytes change, no pipeline result or time differs.These 751 world shaders do no binary64 floor/ceiling, so the lowering is not reached by the dump; the tests added in the branch are the evidence (and
victory-shader's test target does not build on Linux here, Windows validator module). No regression visible from this side.Not tested in a game run; not tested on NVIDIA.
@cloph-dsp on GitHub · 2026-11-25 19:42 UTC · original
Independent local verification (Windows, rustc/cargo 1.100.0/MSVC,
--locked,CARGO_BUILD_JOBS=2, synthetic inputs only, no game data, no physical GPU, no clippy/rustup):0af08f5checked out in a separate worktree. Diff is 2 files, +168/-0, incrates/victory-shader/src/emit/lower.rsandvalu_tests.rs;git diff --check origin/main..HEADis clean.cargo test --locked -p victory-shader --lib directed_f64_ceil_and_floor_write_both_words --quiet→ 1 passed, 0 failed.-p victory-shader --librun cannot complete here: it crashes withSTATUS_ACCESS_VIOLATIONatemit::memory_tests::heap_direct_texture_reads_mark_their_heap_index. That exact test also crashes on unmodifiedorigin/main(13f91cain a detached worktree), so it is pre-existing and unrelated to this PR. All 20emit::lower::testsreached before the crash passed, including the new one.directed_f64_ceil_and_floor_write_both_wordsis absent fromorigin/main(git grepinvalu_tests.rs), so the added coverage is genuinely new.No blocking finding from this check; the full-suite limitation is a pre-existing hardware/WARP issue, not introduced here. AI-assisted (Hy4 flash).
@Marvisak on GitHub · 2026-11-25 22:23 UTC · original · edited 2026-11-26 03:23 UTC
Automated triage for the maintainers.
Verdict: merge candidate (unchanged). The new head merges
mainand movesLower::round_directed_f64intocrates/victory-shader/src/emit/lower/directed.rs.lower.rskeepsmod directed;and thev_ceil_f64/v_floor_f64arm. I compared the moved function with the one reviewed at0af08f5. It differs only in rustfmt line breaks,pub(super)and imports, and the tests are unchanged. The earlier minor note still applies: a signaling NaN passes through unquieted.Note for maintainers: #2350 (same author) adds
mod frexp;at the same line oflower.rs. Whichever lands second needs a trivial conflict fix.CI: passing (
check).Generated by Claude Code
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.