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>
…rest image_load / image_sample / image_gather4 with D16 packed each channel with f32tof16 of the f32 the view returned: rounded twice, the second time toward zero on D3D12. RDNA2 rounds code / (2^w - 1) once to nearest even: 123 of the 256 8_8_8_8_UNORM codes came back one unit in the last place low (code 9: 0x2884 for 0x2885). The channels go through d16_fmt with the T#'s format, as the buffer format loads do. xcl-dev#2026. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
image_load with D16 kept the low half of a 32-bit UINT / SINT texel (70000 loaded as 0x1170). RDNA2 saturates: UINT to 0xFFFF, SINT to -32768..32767 (AnyPS5#22750, gfx1036; XCL-BT-028 in xcl-dev#1489). 8- and 16-bit integer formats never leave that range. Both paths. xcl-dev#2026. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested Independent Windows/D3D12 check on exact head
Not tested Real-title smoke runs, the full workspace suite, and other multisample counts. The extra multisample probe covered Direct DXIL. AI use OpenAI Codex (GPT-6 family, exact variant unavailable) prepared and ran the temporary probe, checked the outputs, and drafted this report. |
|
Diff audit on Remaining before merge:
|
86e9cef to
a4296ca
Compare
a4296ca to
7add2e7
Compare
|
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
|
|
Tested Independent Windows/D3D12 check on clean PR #2042 head
$testExe = 'L:\XclTooling\pr1947-1831ec4-t3-97236edf\target\debug\build\xcl\97fdf2b9ff8e1482\out\xcl-97fdf2b9ff8e1482.exe'
& $testExe gpu::recomp::tests::gpu_image_d16_loads_saturate_32_bit_integers --exact --nocapture --test-threads=1
Each run checked 64 lane results per format. Not tested MSAA and mip image loads, odd-channel high-half preservation, the full workspace suite, retail-title smoke runs, and other GPU adapters. The #2030 and #1977 tests were outside this run. AI use T3 Code / Codex ( |
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> (cherry picked from commit b0aae2e)
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
# Conflicts: # crates/xcl/src/gpu/recomp/tests.rs
d16_fmt reads a UNORM / SNORM value back as a code of the format and rounds code / (2^w - 1) once. A load, a gather or a point-sampled texel is such a code; a filtered sample is a blend of texels (or mips) and is not, so rounding it to a code quantizes it again: half way between codes 0 and 255 gave 0x3804 (code 128), not 0x3800 (reported on xcl-dev#2030, RTX 3090 and AMD). Both paths now pack a sample whose S# can filter (XY_MAG / XY_MIN_FILTER not point, or MIP_FILTER linear, as desc::sampler_d3d12 maps them) with f16_rtz of the host's value, as d16_fmt packs float channels. Gathers and point samplers keep d16_fmt. A static sampler decides it when translating; otherwise S# word 2 decides it when the shader runs. image_get_lod's D16 result, an LOD and not a texel, goes back to f32tof16 in the HLSL path, as the direct DXIL path packs it. gpu_image_d16_filtered_samples_keep_the_blend samples a 2x1 RGBA8_UNORM texture between codes 0 and 255 with heap and static linear samplers and checks f16_rtz of the f32 sample in every lane (0x3800 half way), and codes 9 and 128 through heap and static point samplers (0x2885, 0x3804). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 2d4b3a5)
|
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 |
4bfb5f4 to
1f7d22b
Compare
1f7d22b to
270774b
Compare
Stacked on #2030 (itself on #2027): only the last commit (
Recompiler: D16 image loads of 32-bit integer texels saturate to 16 bits) belongs to this PR. It edits the same image D16 packing as #2030. Part of #2026; XCL-BT-028 in #1489.image_loadwithD16=1kept the low 16 bits of a 32-bit UINT / SINT texel, so 70000 loaded as0x1170. RDNA2 saturates instead: UINT to0xFFFF, SINT to-32768..32767(boykopovar/AnyPS5#22750, gfx1036). This is the image counterpart of #1977's buffer change.What is in it
recomp/emit.rs: the image-load D16halfclosure saturates integer channels by class (min(e, 0xFFFF)for UINT, a clamp for SINT) instead of& 0xFFFF.dxil/lower_image.rs:Lw::d16_int, used at the load and MSAA-load D16 sites.recomp/tests.rs:gpu_image_d16_loads_saturate_32_bit_integerscovers R32_UINT and R32_SINT textures with values in range and past both ends.8- and 16-bit integer formats never leave that range, so they're unchanged.
4bfb5f4: carries Recompiler: D16 image reads of UNORM / SNORM texels round once to nearest #2030's2d4b3a5(filtered D16 samples keep the host's blend), so the stack stays consistent.Tested
270774b(rebased ontomain426a5a74, the firstmainwith green CI after5478c4a7, whose two failing tests main fixed in0d13b071), RTX 3070 (616.56):gpu_suite (--skip gpu_sparse_vram) 148 passed, 0 failed withXCL_DIRECT_DXIL=0and with=1.main426a5a74gives 143 passed on both.4bfb5f4, RTX 3070 (616.56):d16tests 9 of 9 on both paths;gpu_suite: 137 passed withXCL_DIRECT_DXIL=0; with1, 136 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). CI Build and test: passing.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):32_UINT 0x11170:0x1170, want0xffff). With it, it 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? (The earlier pair, comment, was for4bfb5f4, before the rebase ontomain5478c4a7.)Not tested
AI use
🤖 Generated with Claude Code