Repository navigation
Conversation
A D16 buffer format load packed a UNORM / SNORM channel with f32tof16 of the decoded f32: two roundings, the second toward zero on D3D12. RDNA2 rounds code / (2^w - 1) once to nearest even, so about half of all codes came back one unit in the last place low (16_UNORM 0x0801: 0x2800 for 0x2801). That value's binary expansion repeats the w-bit code, so its first 32 bits, floor((code << 32) / (2^w - 1)), decide the rounding and a tie cannot happen. Both paths; checked against exact rounding for every code at w = 2..16. xcl-dev#2026 (XCL-BT-020's third item). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested Independent Windows/D3D12 check on exact head
The counts were identical on both adapters and both backends. For example, 16_UNORM Not tested Real-title smoke runs, full workspace test suite, other channel widths, and image format loads. The exhaustive probe covers single-channel 16-bit buffer inputs. AI use OpenAI Codex (GPT-6 family, exact variant unavailable) prepared and ran the temporary probe, checked the outputs, and drafted this report. |
|
Tested Independent Intel Arc A770 verification for #2026 on clean PR head
7 passed, 0 failed, 0 ignored, 0 skipped across seven processes. The rounding regression checked 64 UNORM and 64 SNORM output halves per backend.
Not tested Exhaustive GPU output, other normalized channel widths, D16 image loads, the parent commit, the full workspace suite, and retail-title smoke runs. AI use Codex ( Follow-up on 83d3d05Tested Independent STOR-WINLAB Arc A770 rerun for #2027 at Windows 11 Enterprise Evaluation 25H2 x64 (26200.9974), AMD Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust and Cargo 1.100.0 (
& $exe gpu::recomp::tests::gpu_buffer_d16_loads_of_16_bit_norms_round_once --exact --nocapture --test-threads=1
Each run matched all 128 expected binary16 values across 64 UNORM and 64 SNORM inputs. The wrapper logged both settings, and the stock fixture's Not tested Other buffer widths or codes outside the fixture, image loads, filtered sampling, other shaders or adapters, the parent commit, the full workspace suite, and retail-title smoke runs. AI use T3 Code / Codex (gpt-6.2-sol) inspected the existing fixture and backend routing, ran the two tests, and wrote this report. Raw evidence in |
|
Diff audit on Remaining before merge:
|
66d3cde to
83d3d05
Compare
|
Tested
The two blocks below can be copied into Regression run in the PR description. A comment by itself does not satisfy XCL's description check. main: PR head: Not tested
AI use OpenAI Codex (GPT-6, exact variant not exposed in this session) ran the tests and smoke comparisons and drafted this report from their logs. |
|
A run with vkd3d-proton as the host D3D12 (DXIL → SPIR-V through dxil-spirv, then the NVIDIA Vulkan driver), so the DXIL goes through a different compiler than the native-Windows runs here: this PR's test passes. Tested
Not tested
AI use
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
d16_fmt passed float channels to f32tof16 / legacyF32ToF16, whose rounding is the host's: it truncates on the RTX 3070 and WARP but rounds to nearest under vkd3d-proton (Marvisak/VIctory#2006), where RDNA2 truncates (boykopovar/AnyPS5#22750). Use f16_rtz in both paths, as the format stores already do. gpu_buffer_d16_loads_of_32_bit_floats_truncate loads 32_FLOAT values that the two roundings tell apart (1 + 1.5 / 1.75 ulp, 65535, +/-70000, a denormal half-way, -1.5, +inf). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # crates/xcl/src/gpu/recomp/tests.rs
|
Regression run of Against the limits in CONTRIBUTING.md: 104 % of AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, AI use: Claude Code (Claude Opus 5.5) built both trees and ran |
b0aae2e to
2b08a14
Compare
2b08a14 to
0cab3ef
Compare
Part of #2026 (XCL-BT-020's third item, #1488). The image half follows in a second PR.
A D16 buffer format load packed a UNORM / SNORM channel with
f32tof16of the decoded f32. That's two roundings, and on D3D12 the second one rounds toward zero. RDNA2 roundscode / (2^w − 1)once, to nearest even. So about half of all codes came back one unit in the last place low: 16_UNORM0x0801gave0x2800, where RDNA2 gives0x2801.What is in it
recomp/emit.rs:norm16_repandd16_fmtin the prelude. The FormatLoad D16 channel goes throughd16_fmtinstead off32tof16.round(f · (2^w − 1)).code / (2^w − 1)has a binary expansion that repeats thew-bit code. So its first 32 bits,floor((code << 32) / (2^w − 1)), decide the rounding, and a tie can't happen.|v| / (2^(w−1) − 1)and adds the sign.f32tof16.dxil/lower_mem.rs: the same asLw::d16_fmt, at the three D16 format-load sites.recomp/tests.rs:gpu_buffer_d16_loads_of_16_bit_norms_round_once, with 64 lanes each loading their own 16_UNORM and 16_SNORM code, against exact single rounding.Second commit (
b0aae2e): float channels of a D16 format load truncate withf16_rtzon both paths, instead of passing throughf32tof16/legacyF32ToF16. That conversion's rounding is the host's: it truncates on the RTX 3070 and WARP, but under vkd3d-proton it rounds to nearest (Shaders: D16 image reads of UNORM / SNORM texels are one ULP low for about half the codes Marvisak/VIctory#2006), while RDNA2 truncates (fix(shader): pack D16 image reads toward zero and saturate 32-bit integers as RDNA2 does boykopovar/AnyPS5#22750). New testgpu_buffer_d16_loads_of_32_bit_floats_truncate: 32_FLOAT values the two roundings tell apart (1 + 1.5 / 1.75 ulp, 65535, ±70000, a denormal half-way), plus -1.5 and +inf.Tested
0cab3ef(rebased ontomain426a5a74, the firstmainwith green CI after5478c4a7, whose two failing tests main fixed in0d13b071), RTX 3070 (616.56):gpu_suite (--skip gpu_sparse_vram) 145 passed, 0 failed withXCL_DIRECT_DXIL=0and with=1.main426a5a74gives 143 passed on both.b0aae2e, RTX 3070 (616.56): thed16tests pass withXCL_DIRECT_DXIL=0and1(6 of 6).gpu_tests: 134 passed with0; with1, 133 passed and 1 failed:gpu_image_get_resinfo_1d_array, which fails onmaintoo (Direct DXIL: image_get_resinfo of a 1D array gives the layers in y #2046). This GPU already truncates, so the new test passes with or without the second commit here. Its value is on hosts that round to nearest (vkd3d-proton, and AMD perdxil/ops.rs).norm16_rep/d16_fmtagainst exact rational rounding: every code atw= 2…16, UNORM and SNORM, with the decoded value off by up to ±2 ULP (524,272 checks). No mismatches.main5ce558f(rebased; Recompiler: direct DXIL cache entries change when its sources do #1947 now keys the translated cache on thegpu/dxilsources, so there is noTRANSLATOR_VERSIONbump):mainfails with 57 of 128 halves one ULP low (for example 16_SNORM0x5b5b:0x39b5, want0x39b6). This branch passes, withXCL_DIRECT_DXIL=0and1.gpu_tests (--skip gpu_sparse_vram), with the whole stack (Recompiler: D16 format loads of UNORM / SNORM data round once to nearest #2027, Recompiler: D16 image reads of UNORM / SNORM texels round once to nearest #2030, Recompiler: D16 image loads of 32-bit integer texels saturate to 16 bits #2042): 135 passed withXCL_DIRECT_DXIL=0; with1, 134 passed and 1 failed,gpu_image_get_resinfo_1d_array, which fails the same way onmain5ce558f(Direct DXIL: image_get_resinfo of a 1D array gives the layers in y #2046 fixes it).dxil::andbuffer_formatunits: 138 passed.Regression run
I have no retail title here. Could someone with one post the
xcl-smokeblocks formainand this head? (Toons29's pair, comment, was forb0aae2e, before the rebase ontomain5478c4a7.)Not tested
AI use
🤖 Generated with Claude Code