Repository navigation
Conversation
…ID instead of 77 BufKind::FormatLoad and BufKind::FormatStore emitted `FMT_INFO[min(fmt, 77u)]`. Because entry 77 is valid `32_32_32_32_FLOAT` (16 bytes) while entry 0 is `INVALID`, any 7-bit format code in 78..=127 was treated as a valid 16-byte float4 read or write instead of INVALID. Emit `(fmt <= 77u) ? FMT_INFO[fmt] : 0u` so out-of-range format codes evaluate to 0 (INVALID), returning 0 on loads and skipping stores. Addresses XCL-BT-010 in xcl-dev#1488. Assisted-by: OpenCode (Gemini 4 Neon)
|
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. |
|
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. |
|
Full-suite run, since this PR has no test report yet. Tested exact head Tested
Not tested
AI use
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Test report for Tested
Not tested
AI use: Claude Code (Claude Opus 5.5) ran the commands on this machine and wrote this report from those runs. |
bmjask
left a comment
There was a problem hiding this comment.
This duplicates #2336 and has the same P1: it fixes only HLSL emit.rs, while Direct-DXIL lower_mem.rs still aliases typed-buffer format codes 78-127 to 77 under XCL_DIRECT_DXIL=1. Consolidate into one PR that fixes both backends and adds Direct-DXIL coverage. No Windows Build/test check is visible.
|
Measured on NVIDIA, for @bmjask's review point: merged onto current RTX 5080 16 GB (driver 621.40), Windows 11 Pro 26200, rustc 1.100.0 MSVC, debug, DXC 1.8.2502.11.
That second row is why the green reports above (all on AI use: Claude Code (Claude Opus 5.5) ran the checks on my machine and wrote this comment. |
Addresses
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 Tracking & Static Audit: 50 New Source-Level Bugs + 150 Prioritized Backlog Items [Part 1/3] #1488, wrote the fix and GPU regression test, ran the test suite andscripts/smoke.ps1regression runs, and drafted this PR description.