Recompiler: D16 format loads of UNORM / SNORM data round once to nearest #2017
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2027"
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?
Imported from ivall/xcl. Originally posted by upipibi on 2026-11-25T01:14:00Z.
Known: this PR's D16 normalization uses a 64-bit divide (
d16_fmtindxil/lower_mem.rs,norm16_repinrecomp/emit.rs), so every shader with a D16 load declares Int64 (SFI00x8000) in both backends. A 32-bit fix with tests is onupipibi/xclbranchfix/d16-norm16-no-int64(af15e87, one commit on #2027's head; RTX 3070:gpu_buffer_d162/2 withXCL_DIRECT_DXIL=0and=1, lib suite 1170 passed, 0 failed; a no-GPU test checks that the Int64 flag is clear for all 20 UNORM / SNORM D16 buffer and tbuffer loads). It isn't pushed here because a push needs a new title smoke pair, which I can't make.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.Overlap with #2360 (#1607 group D102): both round UNORM / SNORM codes to f16 once, to nearest. This PR also truncates the other non-integer channels to f16 (
f16_rtz), where #2360 rounds them to nearest. NWProgramming00 measuredbuffer_load_format_d16_xon an RDNA2 gfx1036 (#1607 comment): the hardware truncates 32_FLOAT (6,011 of 6,011 values), and rounds normalized codes once to nearest.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 (Marvisak/VIctory#2006), while RDNA2 truncates (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 (#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; #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 (#2027, #2030, #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(#2046 fixes it).dxil::andbuffer_formatunits: 138 passed.Regression run
Pair for the current head
0cab3efagainstmain1a0bbe3, run by thehollowedone (comment, thanks): RTX 3080 Ti (621.35), stockscripts/smoke.ps1, clean release builds, 60 s offline. Pasted unedited.Earlier: Toons29's pair, comment, was for
b0aae2e, before the rebase ontomain5478c4a7..Not tested
AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by nnonno91 on 2026-11-25T01:18:36Z.
Tested
Independent Windows/D3D12 check on exact head
d7bd99057d01219b23acb0ec52a68d2e11e88c77. Windows 11 25H2 (26200.9974), Ryzen 7 9800X3D, AMD Radeon(TM) Graphics (32.0.21042.62, native wave64), and GeForce RTX 5090 (32.0.16.1742, split wave64). Rust 1.100.0 x64 MSVC, DXC/DXIL 1.8.2502.11, unoptimized dev/test profiles with debug info off.cargo build --workspace --lockedpassed at the PR head.cargo test --locked -p xcl --lib gpu::recomp::tests::gpu_buffer_d16_loads_of_16_bit_norms_round_once -- --exact --test-threads=1 --nocapturepassed on each GPU withXCL_DIRECT_DXIL=0and1(1 passed, 0 failed, 0 ignored, 0 skipped per run). With only the test added to parentde36462e0b1043b915a418d4591ed1e397622ede, all four baseline runs failed as expected (57 of 128 half values differed in each).cargo test --locked -p xcl --test d16_norm_gpu_probe -- --exact all_16_bit_normalized_buffer_codes_match_exact_rounding --test-threads=1 --nocapturecompared all 65,536 codes per format for 16-bit UNORM and SNORM. The temporary compute shader usedBUFFER_LOAD_FORMAT_D16_Xfor both formats and wrote one packed pair to a separate output region per input. The CPU reference found the nearest binary16 value with exact integer cross-products. Both HLSL + DXC and Direct DXIL ran in each test. Each probe process passed (1 passed, 0 failed, 0 ignored, 0 skipped), with the parent run explicitly checking for the old rounding error.The counts were identical on both adapters and both backends. For example, 16_UNORM
0x0801changed from0x2800to the expected0x2801.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.
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T01:30:03Z.
Tested
Independent Intel Arc A770 verification for #2026 on clean PR head
d7bd99057d01219b23acb0ec52a68d2e11e88c77. Windows 11 Enterprise Evaluation 25H2 (26200.9974), Ryzen 7 3800X, Arc A770 driver32.0.101.9175, Rust/Cargo 1.100.0 (x86_64-pc-windows-msvc), and DXC/DXIL1.9.2609.5.cargo test --locked -p xcl --lib --no-run(exit 0). The test profile was unoptimized, withCARGO_BUILD_JOBS=2,CARGO_INCREMENTAL=0,CARGO_PROFILE_DEV_DEBUG=0, andCARGO_PROFILE_TEST_DEBUG=0.XCL_ADAPTER=A770,XCL_REQUIRE_GPU=wave64, andXCL_DXC_DIRset to the 1.9.2609 package, ran the prebuilt lib-test executable under the shared Arc lock. For each test below, the command was& $exe gpu::recomp::tests::<name> --exact --nocapture --test-threads=1, in a separate process for each listedXCL_DIRECT_DXILsetting.0(HLSL + DXC)1(direct DXIL for kernel execution)gpu_buffer_d16_loads_of_16_bit_norms_round_oncegpu_typed_buffer_loads_and_storesbuffer_format_d16_packs_and_unpacks_halvesbuffer_format_table_matches_llvm7 passed, 0 failed, 0 ignored, 0 skipped across seven processes. The rounding regression checked 64 UNORM and 64 SNORM output halves per backend.
powershell -NoProfile -ExecutionPolicy Bypass -File L:/XclTooling/pr2027/reference.ps1 -Source <worktree>/crates/xcl/src/gpu/recomp/tests.rs. The reference used exact integer distances between adjacent binary16 values to check all 128 committed fixture values. It also compared a CPU model of the PR conversion against that reference for all 65,536 codes per format at five binary32 magnitude offsets (−2 through +2 ULP, clamped at zero). Each format had 327,680 comparisons and zero mismatches.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 (
gpt-6.2-sol) wrote and ran the temporary reference check, ran the focused tests, and wrote this report.Follow-up on
83d3d05Tested
Independent STOR-WINLAB Arc A770 rerun for xcl-dev/xcl#2027 at
83d3d05107998927f48efe501584dacfd934c14c. GitHub showed the PR open at that exact head before and after the run. The worktree was clean and detached at the same SHA throughout testing. The existing JJAutoCompare Arc result in comment 7149616157 coversd7bd99057d01219b23acb0ec52a68d2e11e88c77. The PR discussion and reviews had no equivalent exact-head Arc result.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 (
stable-x86_64-pc-windows-msvc, rustc0ef1bc386), DXC and DXIL 1.9.2609.5. Cargo used the unoptimized test profile with two jobs and debug info and incremental compilation disabled.cargo test --locked -p xcl --lib --no-runcompleted outside the Arc lock (exit 0). Under& 'L:/XclTooling/Invoke-ArcTest.ps1' -Test { ... }, ran the exact prebuilt command below in separate processes forXCL_DIRECT_DXIL=0and1, withXCL_ADAPTER=A770,XCL_REQUIRE_GPU=wave64, and the specified DXC directory.0)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
runner::run_codeuses the direct translator without fallback when enabled. Both stderr logs show the DXC version because the fixture checks DXC availability before dispatch. The wrapper exited 0 and logged the mutex release.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
L:/XclTooling/pr2027/run-20261125T041438211Z:environment.log,prebuild.{stdout.log,stderr.log,exit.txt},direct-0.{stdout.log,stderr.log,exit.txt},direct-1.{stdout.log,stderr.log,exit.txt}, andgpu-wrapper.{stdout.log,stderr.log,exit.txt}.Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T01:34:45Z.
Diff audit on
d7bd990looks strong (norm16_rep/d16_fmtinrecomp/emit.rs+dxil/lower_mem.rsmatches exact single rounding across all 65,536 16-bit UNORM/SNORM codes on AMD iGPU, RTX 5090, RTX 3070, and Intel Arc A770).Remaining before merge:
mainto clearCONFLICTING/DIRTY(also drop the manualTRANSLATOR_VERSION = 9bump inkernel.rs, as#1947now auto-hashesgpu/dxilsources viaXCL_DIRECT_DXIL_SOURCE_ID).xcl-smoke v1blocks (mainand PR) soPR descriptionpasses (or ask another contributor with a retail title to post them).Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-25T02:19:49Z.
Tested
83d3d05107998927f48efe501584dacfd934c14cand main5ce558f82a48c51d527f6035234dacbd29db3f05. Windows 11 build 26200, Ryzen 9 5980HX, AMD Radeon RX 6800M driver30.0.13002.13003, Rust 1.99.0 MSVC, DXC/DXIL 1.9.2609.5.XCL_ADAPTER=6800MandXCL_REQUIRE_GPU=1,cargo test --locked -p xcl --lib -j 2 gpu::recomp::tests::gpu_buffer_d16_loads_of_16_bit_norms_round_once -- --exact --test-threads=1 --nocapturepassed under bothXCL_DIRECT_DXIL=0(HLSL/DXC) and=1(direct DXIL): 1 passed, 0 failed, 0 ignored, no explicit skip in each run.cargo build --locked --release -p xcl -j 2passed for both revisions. A locally owned title completed a paired 7-secondscripts/smoke.ps1run on the RX 6800M. Each run showed one frame, with no crash or device removal. Peak process commit was 6,963 MB on main and 7,058 MB on the PR.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.
Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-25T02:20:28Z.
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
x86_64-pc-windows-gnu.83d3d05as it is (merge base withmain5ce558f), no uncommitted changes. The lib test binary runs under Wine, one test per process.gpu_buffer_d16_loads_of_16_bit_norms_round_once: ok, not skippedNot tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T04:12:14Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
Imported from ivall/xcl. Originally posted by Toons29 on 2026-11-25T10:20:41Z.
Regression run of
b0aae2econ the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon568e7db7, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 104 % of
main's frames, 100 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; a script posted this right after the run, with both blocks exactly as printed.Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-25T12:21:24Z.
Here is the requested
scripts/smoke.ps1pair from clean release builds of main 1a0bbe3 and PR head 0cab3ef.RTX 3080 Ti (621.35), Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC. The 60 s offline runs used separate copies of the same starting profile and DXIL seed, no input, PSO preload off, a 16 GiB job commit cap, and a 12 GiB system commit floor.
The two D16 buffer tests also passed in separate processes with
XCL_DIRECT_DXIL=0and=1.cargo test --offline --locked -p xcl --lib gpu_buffer_d16_loads_of -- --nocapture --test-threads=1gave 2 passed, 0 failed, 0 ignored, and 0 skips in each mode.The smoke pair covers startup. AMD hardware, Wine, and world load were outside this test.
AI-assisted. Codex (GPT-6, exact variant unavailable) ran the tests and drafted this report.
Imported from ivall/xcl. Originally posted by throny on 2026-11-25T18:29:13Z.
Two contributors checked independently and found that #2360 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.
Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T18:41:10Z.
Diff review (
norm16_rep/d16_fmtinrecomp/emit.rs+dxil/lower_mem.rsandf16_rtzfloat D16 truncation) and green CI look solid, with exact-head0cab3efNVIDIA and smoke runs verified.Remaining before merge:
0cab3efAMD test run (previous RX 6800M and RX 9070 runs were on earlier commits83d3d05andb0aae2e).#2360per the#1607(D102) triage note.Imported from ivall/xcl. Originally posted by upipibi on 2026-11-25T18:49:08Z.
@raylitebull On the two points:
0cab3ef: I only have an RTX 3070, so this needs someone with a Radeon card. The earlier RX 6800M and RX 9070 runs were on83d3d05andb0aae2e.f16_rtz, in both backends). #2360 keepsf32tof16, which rounds to nearest. NWProgramming00 measuredbuffer_load_format_d16_xon an RDNA2 gfx1036 with 32_FLOAT: the hardware truncates (6,011 of 6,011 values match truncation, 3,028 match round-to-nearest). Separately, SlopTart's run of #2360 at647932f(comment) shows DXC refusing its prelude helper, becausesnormis a reserved HLSL keyword used as a parameter name there.So on those measurements this PR matches the hardware in both parts. If the maintainers prefer one PR, #2360's UNORM / SNORM routine and this one give the same results for those codes.
AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T07:05:08Z.
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T09:44:00Z.
RX 6800M follow-up on exact head
0cab3ef3b46a9b522fd8838051f2c404baa5fa62, as requested. The detached checkout was clean, and the remote PR head was unchanged before and after the runs. Upstream main wasb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7.Tested
30.0.13002.13003), Rust 1.99.0 MSVC, DXC/DXIL 1.8.2502.11 from Windows SDK 10.0.26100.0.XCL_ADAPTER=6800MandXCL_REQUIRE_GPU=1, used an isolated Cargo target with incremental compilation and test debug info disabled, and ran the following once withXCL_DIRECT_DXIL=0and once withXCL_DIRECT_DXIL=1.6800Mselector.Not tested
The full workspace suite, retail smoke, other adapters, and a matching run on main were outside this run.
AI use
OpenAI Codex (GPT-6.2 Sol) ran the focused tests, inspected the selector and logs, and drafted this report.
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T04:45:28Z.
Independent desktop NVIDIA verification of PR #2027 at head
0cab3ef3b46a9b522fd8838051f2c404baa5fa62(2commits:2a4d3c8baf8150c6e06bc87cfa6897130267e805->0cab3ef3b46a9b522fd8838051f2c404baa5fa62; exact parent & merge-base:426a5a745db4d5e4b037449ede0b70cb342f5192, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12, Wave32-only Ada), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted release tests & build (
0cab3ef3)cargo test --release -p xcl --lib gpu_buffer_d16_loads_of_32_bit_floats_truncate -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1201 filtered out× 3 (0.27s,0.22s,0.22s,0skipped; live RTX 4060 execution)cargo test --release -p xcl --lib gpu_buffer_d16_loads_of_16_bit_norms_round_once -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1201 filtered out× 3 (0.31s,0.23s,0.23s,0skipped; live RTX 4060 execution)cargo test --release -p xcl --lib buffer_format_d16_packs_and_unpacks_halves -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1201 filtered out× 3 (0.09s× 3,0skipped)cargo test --release -p xcl --lib gpu::dxil:: -- --test-threads=4(3 consecutive runs)147 passed; 0 failed; 3 ignored; 1052 filtered out× 3 (3.11s,3.23s,3.16s,0skipped)cargo build --release -p xcl1m 03s, exit0,0new warnings)Paired quiet 60 s retail smoke (
title: 29640639)Exact parent & merge-base (
426a5a745db4d5e4b037449ede0b70cb342f5192, same machine):PR #2027 (
0cab3ef3b46a9b522fd8838051f2c404baa5fa62):Runtime log observations (
xcl.log)9203log lines,0[ERROR]/ device-removal / panic lines (dxil_cache:449hits,11misses,11compilations,0compilation failures;228background pipelines,0failures).19663 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample14472 MB committed by the process; video memory 6115 MB local, 4683 MB non-local.Limits of coverage
gpu_buffer_d16_loads_of_32_bit_floats_truncate(3/3),gpu_buffer_d16_loads_of_16_bit_norms_round_once(3/3),buffer_format_d16_packs_and_unpacks_halves(3/3), andgpu::dxil::(147/147× 3).11recompiled shaders,0failures; single-run frame/commit delta vs. parent reflects normal startup variance, not this PR); AMD/Intel host D16 hardware behavior was not tested here.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by SzczepanGrela on 2026-11-27T05:55:27Z.
RX 9070 / RADV / Wine exhaustive D16 buffer-load check of exact head
0cab3ef3b46a9b522fd8838051f2c404baa5fa62, current mainc2ee10e4e905eb736e56953c52b749e18bcc7edeand the PR automatically applied to that main.Tested
26.3.1-arch3.5, Ryzen 7 7700, CachyOS7.3.0-5-cachyos. Windows GNU release executables, Rust1.97.1, GE-Proton11-12 / Wine 11.0 Staging, native DXGI/D3D12 through vkd3d-proton8293130ebe370b1+(local asserts-disabled build), DXC/DXIL1.9.2602.17.426a5a745db4d5e4b037449ede0b70cb342f5192. Test-only additions torecomp/tests.rs; production code and original assertions unchanged. Main gets the identical two new original tests.cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run --message-format=json-render-diagnostics.<unit.exe> gpu_buffer_d16_loads_of_ --nocapture --test-threads=1, then--test-threads=4, separately withXCL_DIRECT_DXIL=0and=1.On main the normalized test reports 57/128 differing halves. The original 32_FLOAT test passes on all three sources on this stack.
Additional owned filter
<unit.exe> workflow_d16_all_16bit_codes --nocapture --test-threads=1, three fresh processes per source. Every process checks all 65,536 input bit patterns for each of 16_UNORM and 16_SNORM, separately in native wave32 and native wave64, through both HLSL/DXC and direct DXIL. Each dispatch handles a bounded 32-row loop, stores the complete 32-bit D16 results to a separate output region and reads back the whole flat-memory allocation.These counts are identical for both backends, both wave sizes and all three repeats. Each owned head/integration run is 1 passed, 0 failed. Each main run is 0 passed, 1 failed, after collecting all configurations. For example, main loads UNORM
0x0801as0x2800; head/integration return the exact-reference0x2801.The reference rounds the exact rational
u/65535ormax(s/32767,-1)by integer distance to adjacent IEEE-half values, including nearest-even ties. A separate Python implementation independently recomputes all references and GPU readbacks. Eight 32_FLOAT RTZ controls repeated over active lanes also match on all sources:3f803000,3f803800,4788b800,c788b800,477fff00,33c00000,bfc00000,7f800000.Across the nine owned runs: 1,782 captured GPU dispatches, including 18 physical-width probes and 603 native-wave64 dispatches; 4,718,592 normalized outputs and 1,728 active-lane float controls. Independently checked 14,201,856 complete memory words, final address/result registers, zero upper halves, inactive lanes and out-of-output guards. Programs were independently re-encoded from the public ISA tables and loop bounds checked. Readbacks repeat byte-for-byte; exact-head and integration data match. 0 ignored, 0 skipped, no device-removal markers.
The known Int64 requirement remains: all eight D16 shader configurations on head/integration have SFI0 bit
0x8000, including the 32_FLOAT controls. This tests the posted head, without the separate 32-bit repair.Inherited
XCL_*cleared;XCL_NETWORK=0, RX 9070 selected,XCL_REQUIRE_GPU=wave64,XCL_DXC_THREADS=1; private enabled caches per process.Not tested
Full suite, tbuffer/image D16 forms, other channel widths or DST_SEL combinations, split wave64, native Windows, other GPUs, the separate Int64-removal branch, retail workload,
scripts/smoke.ps1, timing or FPS.AI use
OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the diff, wrote the owned test-only matrix, ran comparisons, independently verified exact-rational half results, full readbacks, ISA encoding, guards, wave widths and source/executable provenance, and drafted this report. Publication authorized by the account owner.
Imported from ivall/xcl. Originally posted by throny on 2026-11-28T03:16:30Z.
merge-check claim
head:
0cab3ef3b4Imported from ivall/xcl. Originally posted by throny on 2026-11-28T03:30:26Z.
merge-check
base:
753e8b1ahead:
0cab3ef3b4merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1514 passed, 0 failed, 47 ignored (26 SKIPPED lines); base alone: 1512 passed, 0 failed, 47 ignored
review: the conversion is right by hand: exponent, round bit, the subnormal case, and why no tie can occur; SNORM's most negative value clamps to -1 as the test expects. One thing worth a line, not blocking: in the direct-DXIL lowering everything is computed for every channel and the result picked with a select; for a missing component or a 1-bit SNORM the shift amount is unmasked (up to 63, or -1), which makes the divisor 0 on the arm that is then discarded: an integer division by zero in dead-by-select code is formally undefined, although no driver showed it in the thread's runs. Main masks such shifts elsewhere.
performance: default path, limited to D16 format loads: each now pays a 64-bit unsigned divide and about 40 ALU operations, on the direct path also for float and integer formats because the format is a runtime value. Not measured here. It changes translator sources: every tester re-translates all shaders once.
verdict: safe to merge (masking that shift would be better)
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by upipibi on 2026-11-28T08:51:31Z.
@throny On the shift: agreed. In
d16_fmt(gpu/dxil/lower_mem.rs),wis masked to 0-63 andwe = w - 1for SNORM. Sow = 0giveswe = -1, aweof 32 or more makes theshl i32 1, weundefined, andwe = 0(UNORM withw = 0, or 1-bit SNORM) makesdmax = 0, so theudivdivides by zero. All of that is on the arm thatuse_n(2 <=w<= 16) then drops. Nothing failed on any card here, but a division by zero in LLVM IR is undefined even when its result is unused, so it is better masked.I haven't pushed it, because a new head would drop the two smoke pairs and the checks on
0cab3ef. If a maintainer wants it before merging, it's two lines (andcandumaxalready exist inlower.rs), and it leaves every value inside 2..16 bits unchanged:With these, the dropped arm never divides by 0, and nothing else changes. Otherwise I'll leave it for a follow-up.
Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T13:23:01Z.
merge-check claim
head:
0cab3ef3b4Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T15:15:54Z.
merge-check
base:
b937fbab29head:
0cab3ef3b4merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2142 passed, 1 failed, 48 ignored, 25 SKIPPED: 21 no wave64, 3 per-lane f16/f32 forms refused (#1426 semantics), 1 no heap windows; failing: gpu::dxil::msaa_tests::direct_msaa_loads_precede_get_dimensions: it fails on the base too (the base b937fbab's suite, run alone on this PC with the same command and its own target dir: 2140 passed, 1 failed, 48 ignored, 25 SKIPPED, this same test failing), and it also failed when rerun alone on this merge (msaa_tests.rs:299: "dx.op.getDimensions preceded dx.op.textureLoad in the same basic block"); not caused by this PR. The suite ran on this PC at the same time as 1 other PR's suite, in one queued job.
review: none. Whole diff read (lower_mem.rs d16_fmt and emit.rs d16_fmt / norm16_rep in PRELUDE_MEM: a D16 format load's UNORM / SNORM channel of 2-16 bits becomes code / (2^w - 1) rounded once to nearest f16, SNORM with w - 1 bits and the sign; every other non-integer channel truncates (f16_rtz) instead of the host's f32-to-f16; the three D16 load paths of the direct DXIL lowering and the HLSL one use it; recomp/tests.rs GPU test). Checked norm16_rep: exponent 14 - lzcnt(p), 10 mantissa bits plus a round bit with the carry into the exponent, subnormals as p >> 8 rounded at bit 7, 0 and full scale exact; the DXIL and HLSL forms compute the same thing.
performance: reasoned, not measured: D16 format loads of UNORM / SNORM data get a 64-bit division and some ALU per channel; other loads unchanged; translator output changes, so shaders with D16 format loads are translated again once.
verdict: safe to merge
hardware / tool and model: Windows 11 build 26300.9974, NVIDIA GeForce RTX 2070 SUPER 8 GB (driver 621.40, wave32 only), AMD Ryzen 5 3600XT; rustc 1.100.1 (20ddd0171 2026-11-25) x86_64-pc-windows-msvc, debug test profile; trial merge 7070e8f460fb10af200d3d0fdeca5bfd25527d78 (local, not pushed). Claude Code: Claude Opus 5.5 (coordination, full-diff review, draft).