Recompiler: map out-of-range typed buffer format codes (>77) to INVALID instead of 77 #1574
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!1574
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1574"
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?
@b3IKK on GitHub · 2026-11-24 17:50 UTC · original
b3IKK:recomp/fmt-info-oob-invalid→main· +32 −2 · 2 files · 1 commits · openAddresses
XCL-BT-010from #1488.BufKind::FormatLoadandBufKind::FormatStoreincrates/xcl/src/gpu/recomp/emit.rsemittedFMT_INFO[min(fmt, 77u)]. Because entry77is valid32_32_32_32_FLOAT(16 bytes) while entry0isINVALID, any out-of-range 7-bit format code in78..=127was clamped to format77and treated as a valid 16-byte float4 read or write instead ofINVALID.This emits
uint t_fmt = fmt; uint t_info = (t_fmt <= 77u) ? FMT_INFO[t_fmt] : 0u;so out-of-range format codes evaluate to0(INVALID), returning0on loads and skipping stores.Note on premise: mapping reserved codes
78..=127toINVALID(0) is derived from the GFX10IMG_FORMATtable layout (0..=77valid,0 = INVALID), not measured on RDNA2 hardware (no RDNA2 GPU is available on this test machine to probe reserved format codes directly; the previousmin(fmt, 77u)was an array-bounds clamp that accidentally aliased78..=127to32_32_32_32_FLOAT).What is in it
crates/xcl/src/gpu/recomp/emit.rs: mapfmt > 77uto0u(INVALID) instead of clamping to77uinBufKind::FormatLoadandBufKind::FormatStore.crates/xcl/src/gpu/recomp/tests.rs: add GPU testgpu_typed_buffer_out_of_range_format_codes_are_invalid(verified failing before the fix with0xDEADBEEFreturned on format78).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 777 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2no wave64—gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware; 1no heap windows—heap_window_out_of_memory_falls_back_to_the_switch_form)cargo test -p xcl --lib gpu_typed_buffer_out_of_range_format_codes_are_invalid: 1 passed, 0 failed (failed on RTX 5080 before the fix)Regression run
main:
PR:
Not tested
78..=127(derived from the GFX10 format table, not hardware-probed)AI use
XCL-BT-010from #1488, wrote the fix and GPU regression test, ran the test suite andscripts/smoke.ps1regression runs, and drafted this PR description.github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@upipibi on GitHub · 2026-11-24 18:13 UTC · original
One question on the premise: is "78–127 is INVALID (loads give 0, stores are dropped)" measured on RDNA2 hardware, or taken from the table's layout? The GPU test checks what this PR emits, not what the console does. #1414's measurements (77 formats on a gfx1036 by Lyrnc) stop at the valid codes. A reserved code could also behave like another format, or like 0 with the descriptor ignored. If nobody has a hardware answer, "derived, not measured" in the description would make that clear.
AI use: Claude Code (Claude Opus 5.5) read the change and wrote this.
@b3IKK on GitHub · 2026-11-24 18:29 UTC · original
Good point @upipibi — mapping reserved codes 78..=127 to INVALID (0) is derived from the GFX10 format table definition (0..=77 valid, 0 = INVALID) rather than probed on RDNA2 silicon (no AMD GPU on this machine). I updated the PR description and Not tested section to state that explicitly.
@futurepro62 on GitHub · 2026-11-24 18:54 UTC · original
Full-suite run, since this PR has no test report yet. Tested exact head
6ac16dd(on its base9e3831e).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: 776 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.gpu_typed_buffer_out_of_range_format_codes_are_invalid.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 777 passed, 0 failed, 41 ignored. SKIPPED:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).heap_window_out_of_memory_falls_back_to_the_switch_formwas skipped with--skip. It fails on main9e3831etoo, not because of this PR: underXCL_REQUIRE_GPU=mesh,runner::skip_testturns every skip except "no wave64" into a failure, including this test's opt-in "no heap windows" skip (XCL_HEAP_WINDOWSunset). Reported as #1651.Not tested
AI use
@DavidM1911 on GitHub · 2026-11-24 19:51 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
@Belox17 on GitHub · 2026-11-24 20:02 UTC · original
Test report for
6ac16ddfon NVIDIA (RTX 3060 Ti): passes, and the GPU test fails without the fixTested
6ac16ddfas is (base9e3831e), clean tree.gpu_typed_buffer_out_of_range_format_codes_are_invalid) withcargo test -p xcl --lib <name>: 1 passed (the GPU part ran on this adapter, noSKIPPED).cargo test --workspace -- --test-threads=4on the head: 777 passed, 0 failed, 41 ignored; its base9e3831eon the same machine: 776 passed, 0 failed, 41 ignored. SKIPPED on both:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).mainc160d86e(clean merge): 859 passed, 0 failed, 42 ignored;mainalone: 858 passed, 0 failed, 42 ignored, the same three SKIPPED as above.emit.rsreverted (test kept), the GPU test fails on this adapter:lane 0: format 78 load must yield 0 (INVALID), left[3735928559, 3735928559, 3735928559, 3735928559](0xDEADBEEF), right[0, 0, 0, 0].Not tested
AI use: Claude Code (Claude Opus 5.5) ran the commands on this machine and wrote this report from those runs.
@frenziedcoder on GitHub · 2026-11-26 07:44 UTC · original
Measured on NVIDIA, for @bmjask's review point: merged onto current
main, this PR's own test passes on the default backend and fails withXCL_DIRECT_DXIL=1. So the test is already the Direct-DXIL coverage the review asks for, once it runs on amainwhose test runner honours the switch.RTX 5080 16 GB (driver 621.40), Windows 11 Pro 26200, rustc 1.100.0 MSVC, debug, DXC 1.8.2502.11.
cargo test -p xcl --lib gpu_typed_buffer_out_of_range_format_codes_are_invalid -- --test-threads=1, each backend in its own process (XCL_DIRECT_DXILremoved for the default run,=1for the other), Cargo's exit code kept and the named test required to have run:XCL_DIRECT_DXIL=1main08db8020+ this PR (clean merge)lane 0: format 78 load must yield 0 (INVALID)6ac16dd(base9e3831e)9e3831erunner::run_codealways compiles the HLSL and nothing undergpu/readsXCL_DIRECT_DXIL9e3831e+ only this PR's test (no fix)That second row is why the green reports above (all on
9e3831e) could not show it. Onmainb49be183fmt_infoincrates/xcl/src/gpu/dxil/lower_mem.rsstill doesk.min(77)/umin(fmt, 77); no commit since08db8020touches it.AI use: Claude Code (Claude Opus 5.5) ran the checks on my machine and wrote this comment.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.