Repository navigation
Recompiler: round normalized D16 buffer loads exactly - #2360
mokkamokacaffe wants to merge 2 commits into
Conversation
Convert UNORM and SNORM source codes directly to binary16 so the intermediate binary32 decode cannot double-round the result. Cover every supported normalized code width exhaustively. Part of xcl-dev#2026 Assisted-by: OpenAI Codex (GPT-5)
|
Tested commit Environment
Results
NoteThis branch appears to predate the |
|
Two contributors checked independently and found that #2027 solves the same problem (for #2026) in a different way: #1607, group D102. You may want to compare them with the other author and agree on one, or say in the PR why both are needed. This is a hint from the community triage in #1607, not a maintainer decision. AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table. |
|
Tested: current PR head One red across the whole lane, and the cause is visible in every failure. The
Standalone repro against the same pinned gives Observations around the new tests themselves:
Renaming the parameter (anything that is not a modifier keyword) would restore the prelude compiles. The exact rounding behaviour of the change could not be judged on this lane because the HLSL backend does not compile at this head. Not tested: retail titles (no title data on this lane, counts only). The post-rename rounding behaviour itself. AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Every DXC compile of the generated HLSL prelude fails: The parameter name — Devin |
bmjask
left a comment
There was a problem hiding this comment.
No concrete numeric defect found; the endpoint/subnormal/selectors logic appears consistent across backends. This draft is not merge-ready: it lacks Windows CI, DXC/Direct-DXIL validation, GPU output parity, and paired smoke. The exhaustive test validates only the Rust helper, not emitted HLSL or the separate Direct-DXIL lowering. Add a GPU D16 typed-buffer test for both backends covering UNORM/SNORM tie-adjacent normal/subnormal values, selectors, and hi_x.
|
The updated head After comparing this with #2027 and the RDNA2 measurements linked there, #2027 is the more complete implementation. Both PRs produce the intended single-rounding result for UNORM/SNORM codes, while #2027 also applies the measured truncation behavior to the other non-integer D16 channels and has GPU coverage for both the HLSL and Direct DXIL paths, exact-head NVIDIA validation, and paired smoke runs. Closing this PR in favor of #2027 so testing and review remain focused there. |
Part of #2026.
D16 typed-buffer loads currently decode UNORM/SNORM source codes to binary32 and then use
f32tof16. The intermediate binary32 rounding makes roughly half of the normalized codes one binary16 ULP too low. Convert the original integer code directly to binary16 so it is rounded once, to nearest-even.This is the first split proposed in #2026. Image reads remain a separate follow-up.
What is in it
crates/xcl/src/gpu/recomp/emit.rs: emit an integer-only normalized-code-to-binary16 conversion for HLSLbuffer_load_format_d16_*andtbuffer_load_format_d16_*operations.snormidentifier in the generated helper; independent DXC runs on the original head exposed this as the cause of the broad shader-compilation failures.crates/xcl/src/gpu/dxil/lower_mem.rs: emit the same conversion directly in DXIL while preserving destination selection, integer formats andhi_xbehavior.Tested
x86_64-pc-windows-msvc:cargo check -p xcl --lib --target x86_64-pc-windows-msvc: passed.cargo check -p xcl --tests --target x86_64-pc-windows-msvc: passed.lib.exe-compatible archive wrapper was used only to let the Windows-onlylibudis86-sysbuild script complete; no Windows binary was linked or run.git diff --check origin/main...HEAD: passed.mainate1d84b7; the conflict inemit.rsretained both this PR's exhaustive D16 test andmain's newer RLA shader tests.main: onlycrates/xcl/src/gpu/recomp/emit.rsandcrates/xcl/src/gpu/dxil/lower_mem.rs, 241 additions and 13 deletions;git diff --check origin/main...HEADpassed at62ff8aed9394.Regression run
main:
Pending: requires Windows, a D3D12 GPU and a real-title installation.
this PR:
Pending on clean head
62ff8aed9394: requires Windows, a D3D12 GPU and the same title and duration as the main run.Not tested
snorm; this is renamed tosigned_normat the current head and needs a clean rerun.scripts/smoke.ps1retail-title runs.AI use