fix(victory-shader): implement ties-to-even rounding in integer DXIL for NVIDIA #306
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!306
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-306"
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?
@mauroalvare on GitHub · 2026-11-26 01:57 UTC · original
mauroalvare:fix/victory-rndne-nvidia→main· +141 −1 · 2 files · 1 commits · openChange
In VIctory's RDNA2-to-DXIL translator (
third_party/victory/crates/victory-shader/src/emit/lower.rs),v_rndne_f32,v_rndne_f16, andv_cvt_pk_u8_f32lowered round-to-nearest-even to DXILdx.op.unary.f32(26)(Round_ne).On NVIDIA driver 621.xx (measured on RTX 5070 Ti
621.40; previously observed inPrototypeScarlettin #227 / PR #260), the driver constant-foldsRound_ne(2.5)after a barrier to3.0(0x40400000, round half away from zero) instead of2.0(0x40000000, ties to even), and replaces NaN payloads with0x7FFFFFFF(while WARP leaves signalling NaNs unquieted).Fix:
Lower::rndne_f32, computing branchless IEEE-754 ties-to-even rounding in 32-bit integer bit arithmetic (matching RDNA 2 for ties-to-even, signed zeros±0.0, subnormals, integers>= 2^23, infinities, qNaN payload preservation, and sNaN quieting).v_rndne_f32,v_rndne_f16, andv_cvt_pk_u8_f32throughLower::rndne_f32.Linked issue: Refs #227
Verification
Base SHA:
c4c93bdc413191a9dc909998d2d53080a3f0c880(LooperSalty/AnyXboxX:main)Hardware: Windows 11, Ryzen 7 9700X, NVIDIA GeForce RTX 5070 Ti (driver
621.40), WARP,dxil.dll10.0.26100.0, Rust1.98.1(MSVC).Before the fix (failing on base
c4c93bdon RTX 5070 Ti):After the fix (from
third_party/victory):Oracle and test data
The new regression test
v_rndne_f32_ties_to_even_and_specialsinthird_party/victory/crates/victory-shader/src/emit/valu_tests.rssynthesizes minimal GFX10 compute shaders for:v_rndne_f32across ties-to-even (±0.5,±1.5,±2.5,±3.5,4.5,8388607.5), signed zeros, subnormals, infinities, quiet NaNs (0x7FC00000,0x7FC00001,0xFFC00000), and signalling NaNs (0x7F800001,0xFF800001);2.5,-2.5,0.5,-0.5intov_rndne_f32acrosss_barrier;2.5acrosss_barrierintov_rndne_f16(0x4100 -> 0x4000) andv_cvt_pk_u8_f32(2.5 -> 2).All shaders are validated with
dxil.dlland executed bit-for-bit on both RTX 5070 Ti and WARP against IEEE-754 / AMD RDNA 2 ISA semantics. No game, console, or SDK files were used.Checklist
E_NOTIMPL), never a fake success.Round_nedriver bug identified in #227 / PR #260).AI assistance: investigated, implemented, tested on RTX 5070 Ti and WARP, and drafted with Antigravity (Gemini).
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.