Recompiler: saturate UINT/SINT and use RTZ in fmt_encode #1929
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!1929
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1929/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?
@n-romanovich on GitHub · 2026-11-24 23:40 UTC · original
n-romanovich:recomp/fmt-encode-sat-rtz-unorm→main· +47 −4 · 2 files · 1 commits · merged 2026-11-25 01:00 UTCAddresses #1489 (
XCL-BT-026).In
fmt_encode:UINT(ty == 4u) andSINT(ty == 5u) channels narrower than 32 bits previously returned rawxand relied onput_bitsmasking, wrapping out-of-range integers instead of saturating them to[0, (1 << w) - 1]/[-(1 << (w - 1)), (1 << (w - 1)) - 1].FLOATstores previously usedf32tof16, overflowing finite values above65504.0to+Infinstead of saturating to max finite viaf16_rtz(while preserving true±Inf).What is in it
crates/xcl/src/gpu/recomp/emit.rs:f16_rtzbeforefmt_encode.UINT(ty == 4u) andSINT(ty == 5u) values whenw < 32u.f16_rtz(f)for 16-, 11-, and 10-bitFLOATformats.crates/xcl/src/gpu/recomp/tests.rs:gpu_fmt_encode_int_sat_and_f16_rtzcovering16_16_UINT,16_16_SINT,16_16_FLOAT, and11_11_10_FLOAT.Tested
Hardware: Windows 11 x64, NVIDIA GeForce RTX 5060 Ti.
cargo test -p xcl --lib fmt_encode -- --test-threads=4: 2 passed, 0 failed, 0 ignored (951 filtered out)cargo test --workspace -- --test-threads=4: 977 passed, 0 failed, 45 ignoredSKIPPED: 21gpu::recompwave64 / refused per-lane f16 tests (no wave64/ refused per-lane f16),shaders::tests::pso_measurement_compiles_an_exact_synthetic_record(Windows Developer Mode is required,0x887A002D),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows)Regression run
Main (
20cf13022f764208384c610c2ae6a3f4eed201a2):PR (
ffc90817f895a943b1bd885afc6cd6270d3c0441):Not tested
AI use
smoke.ps1runs.@futurepro62 on GitHub · 2026-11-24 23:56 UTC · original · edited 2026-11-25 00:03 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
ffc9081(on its base20cf130).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::dxil::fuzz_tests: 967 passed, 0 failed, 43 ignored. SKIPPED (no wave64):a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,a_per_lane_2d_or_3d_group_runs_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.gpu_fmt_encode_int_sat_and_f16_rtz.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 976 passed, 0 failed, 45 ignored. SKIPPED:f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out tests that fail on main62265d3too, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651) and the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests (follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh, andgpu::dxil::fuzz_testsseeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card (drivers 616.64 and 621.40). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
@DarkPanda69 on GitHub · 2026-11-25 00:11 UTC · original
AMD run with native 64-lane waves, which this PR lists as not tested (the other report here is NVIDIA).
Tested: pass, head
ffc9081applied onmain80f4819, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17.cargo test -p xcl --lib -- gpu:: --test-threads=4:gpu_fmt_encode_int_sat_and_f16_rtzok. The 2 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1and_3, which fail the same way onmain80f4819without this PR on this card, so they are not from this change.gpu_fmt_encode_int_sat_and_f16_rtzok.Not tested: Linux; the whole workspace suite; a title.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@DavidM1911 on GitHub · 2026-11-25 02:33 UTC · original
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!