Repository navigation
Round unsigned shader conversions once (port of Marvisak/VIctory#2186) - #2018
Draft
xiepeixuan wants to merge 2 commits into
Draft
xiepeixuan wants to merge 2 commits into
xiepeixuan wants to merge 2 commits into
Conversation
Port Dmitrii (Razdva122) in Marvisak/VIctory#2186 (084d4ff3aeade44017851a52220da5e9f004bd38).
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No 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
e1f2eb60492d94dd0230606b453ba82b34e1b98d. Fixed head:d2917a17cf80dad3f80a7b3d217ed7111944a9fb. No physical GPU or game run; CPU bitcode evaluator and D3D12 WARP software readback. The new regressions exercise GFX10 Wave32, not Wave64.0xde84975ereturned0x4f5e8498instead of0x4f5e8497. The fixed head passed (exit 0) and matched all 82 inputs.0x01000001(exit 101); the fixed head passed (exit 0).cargo test -p victory-shader --locked: Linux 273 → 274 passed, 0 failed, 2 ignored on each revision. Windows 394 → 396 passed, 1 failed, 8 ignored on each revision. The sole Windows failure on both isnv05d1_native_readlane_gpu_reference, which requires a physical GPU. Filtering out only that test gives 394 → 396 passed, 0 failed, 8 ignored.cargo check --workspace --lockedpassed on both revisions. Both strict Clippy variants hit the same existingmanual_checked_opslint (Shaders: the host LDS wait cap uses checked_div, so clippy's manual_checked_ops no longer stops the check #1855); the full workspace test step was skipped.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.