Recompiler: round normalized D16 buffer loads exactly #2360
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2360
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2360/head"
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?
@mokkamokacaffe on GitHub · 2026-11-25 16:31 UTC · original
mokkamokacaffe:recomp/d16-normalized-buffer-rounding→main· +241 −13 · 2 files · 2 commits · closed without mergingPart 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
@FIJI1299 on GitHub · 2026-11-25 17:33 UTC · original
Tested commit
<647932f>on Windows with an NVIDIA GPU (wave32):Environment
621.35,wave32only — no nativewave64)1.8.2502.11(Windows SDK10.0.26100.0)Results
cargo test -p xcl --lib): 1060 passed, 147 failed, 26 ignored (includinggpu::recomp::tests::buffer_format_d16_packs_and_unpacks_halves).4 (no wave64),1 (cannot disable the driver cache (Windows Developer Mode is required): 0x887A002D).Note
This branch appears to predate the
wave32/ split-wave64 updates onmain(currentmainskips 13no wave64tests on this adapter instead of 4), causing 124 tests ingpu::recomp::teststo fail onwave32-only NVIDIA hardware. Rebasing onto currentmainshould allow re-testing on this GPU.@throny on GitHub · 2026-11-25 18:29 UTC · original
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.
@SlopTart on GitHub · 2026-11-25 18:40 UTC · original
Tested: current PR head
647932fcmerged onto currentorigin/main(clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo targetx86_64-pc-windows-gnurun under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29,1.9.2609.5 (01b62ad47)).One red across the whole lane, and the cause is visible in every failure. The
gpu_suite at this head gives40 passed; 108 failedwith a cold shader cache (deterministic at--test-threads=1and--test-threads=2). 106 of the failures print the same DXC compile error in the generated prelude:snormis a reserved HLSL modifier keyword, so this pinned DXC refuses the parameter name. The helper sits in the shared translator prelude, so every program that embeds the prelude fails to compile, which is why the failure count is a large fraction of the suite rather than one test.Standalone repro against the same pinned
dxc.exe(extracted from the 2026-09-29 zip), no XCL involved:gives
error: modifiers must appear before typeat column 47 pluserror: expected expressionon(uint)snorm.Observations around the new tests themselves:
1 passed(that path does not compile the HLSL prelude), and the new D16 tests are not among the 106 failures.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.
@DavidM1911 on GitHub · 2026-11-25 18:56 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: 143 real failures, deterministic (also fail--test-threads=1, 1064/143):Every DXC compile of the generated HLSL prelude fails:
The parameter name
snormcollides with the HLSLsnormtexture modifier keyword — rename it (e.g.signed_norm) and the whole suite should recover. Serious breakage, needs a fix before merge.— Devin
@mokkamokacaffe on GitHub · 2026-11-25 23:14 UTC · original
The updated head
62ff8aedresolves the merge conflict and the generated-HLSL failure by renaming the reservedsnormparameter tosigned_norm.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.
@DavidM1911 on GitHub · 2026-11-26 08:15 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: 1 failure under parallel scheduling; clean on--test-threads=1rerun (1312 passed, 0 failed, 27 ignored, 82s). Intermittent single-test flake — tracked in #1978.Thanks!
— Devin
Pull request closed