Round unsigned shader conversions once (port of Marvisak/VIctory#2186) #2018
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!2018
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2018"
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?
@xiepeixuan on GitHub · 2026-11-29 07:34 UTC · original
xiepeixuan:auto/v-cvt-f32-u32→main· +98 −2 · 4 files · 2 commits · openNo issue in this repo. Upstream context: FIND-5 in Marvisak/VIctory#1633.
What it changes
The AMD RDNA 2 ISA reference, §12.8, p. 138 specifies
V_CVT_F32_U32as “0.5ULP accuracy” andD.f = (float)S0.u. WARP can misround a full-width DXIL unsigned cast. The lowering converts the two 16-bit halves separately and computeshi * 65536 + lo. Both casts and the scaled high half are exact, so only the sum rounds.Ported from Dmitrii (Razdva122), Marvisak/VIctory#2186, merged commit 084d4ff3ae (original b21594a4). The WARP test uses all 34
U32_EDGESvalues and the 50 midpoint/reported cases: 82 distinct inputs after deduplication, compared exactly with(x as f32).to_bits().Player-visible effect: The RTX 5080 report in Marvisak/VIctory#2186 found that the plain cast already rounded correctly on NVIDIA hardware:
0xffffff7freturned0x4f7fffffbefore and after the fix. No visible change is expected on NVIDIA GPUs. The fix makes WARP match hardware bit-for-bit on the tested inputs and keeps the WARP regression exact. Cost: five DXIL operations instead of one perv_cvt_f32_u32. Physical-GPU performance was not measured.How it was tested
716a0c99d4c616c0b5f9a1b8b068af58ddb85f03and rebased headdc3dd4e1d7fd69718515fc0c22b4a1491199871b. Synthetic GFX10 Wave32, CPU evaluator and D3D12 WARP only; no physical GPU or game run.0xde84975ereturned0x4f5e8498instead of0x4f5e8497. The rebased head passed (exit 0) and matched all 82 inputs.0x01000001(exit 101); the rebased head passed (exit 0).cargo test -p victory-shader --locked: Linux 295 → 296 passed, 0 failed and 2 ignored on both. Windows 457 → 459 passed, 5 failed and 9 ignored on both. The five Windows failures were the same device/readback tests on both revisions.emit::intersect_tests::flat_global_stores_and_atomics_fence_uavs_at_group_barriers_across_wavesemit::wave64_tests::cs_sort_ray_tiles_divergent_loop_atomics_stay_wave32_with_fence_onlyemit::wave64_tests::nv05d1_native_readlane_gpu_referenceemit::wave64_tests::one_console_wave_divergent_loop_lds_widens_for_one_and_two_block_loopsemit::wave64_tests::one_console_wave_divergent_loop_wave_ops_widen_for_one_and_two_block_loopscargo check --workspace --lockedpassed on both revisions. Both strict configurations stopped only at diagnostics also present on main:unused_imports(PAIR_MEETINGSandanalysis::lane_regions),clippy::while_immutable_condition, andclippy::too_many_arguments. Default Clippy also reporteddead_code(unwind_copy) on both. All-features Clippy comparison.Checked for overlap
Other uses checked
The GFX10 opcode table and VALU dispatch are unchanged; only
v_cvt_f32_u32gets new arithmetic.v_cvt_f32_i32, the fourv_cvt_f32_ubyte*paths, and the sharedfmadandwrite_fimplementations and their other callers are unchanged, including output modifiers and lane guards. The other uses found are synthetic shader fixtures. The existing shader source fingerprint invalidates cached DXIL on rebuild; no cache key or switch changed.Opened as a draft early so others know this is being worked on (README: 'Opening a draft pull request early works too').
AI-assisted (Codex). Not run in the game.
d2917a17cftodc3dd4e1d7github-bot referenced this pull request2026-11-29 22:46:14 +00:00
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.