Repository navigation
Recompiler: an empty DXC blob reads as no bytes (#2413) - #2441
crastinator wants to merge 1 commit into
Conversation
DXC can hand back an empty blob with a null buffer pointer (an empty error buffer when a compile fails, or an empty result). compile_here passed that pointer to slice::from_raw_parts, which requires a non-null pointer even for length 0: undefined behaviour, and a debug build aborts on the precondition check. Both places now read the blob through blob_bytes, which gives an empty slice for a null pointer or a zero size. Part of xcl-dev#2413 (the dxil.dll handle left loaded after a failed candidate is a separate change).
|
Tested: current PR head merged onto current
Not tested: retail titles (no title data on this lane, counts only). AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting. |
|
NVIDIA test report for Tested
Regression run ( base ( this PR: Not tested: the world load (the smoke runs stop at the start screen, so code that only runs later is not exercised there); AMD (the description and @SlopTart's run cover it). AI use: Claude Code (Claude Opus 5.5) built and ran the tests and smoke runs on my machine and wrote this report. |
Tested
Not tested
AI use
|
DXC can return an empty blob with a null buffer pointer: an empty error buffer when a compile fails, or an empty result.
compile_herepassed that pointer straight toslice::from_raw_parts, which needs a non-null pointer even for length 0. That is undefined behaviour, and a debug build aborts on the precondition check. Both places now read the blob throughblob_bytes, which returns an empty slice for a null pointer or a zero size.Part of #2413. The
dxil.dllhandle left loaded after a failed candidate folder (the second half of the issue) is a separate change.What is in it
crates/xcl/src/gpu/recomp/dxc.rs:blob_bytes/bytes_at, used for the error buffer and the result incompile_here; a unit test for the null and zero-size cases.Tested
53aac418); cross-built forx86_64-pc-windows-msvc, Rust stable, DXC 1.9.2609.5.cargo test -p xcl --lib -- recomp::dxc: 17 passed, 0 failed, 0 ignored.cargo test -p xcl --lib -- --test-threads=1and every integration test), merged ontomain2898511and compared per test with the same run of thatmain: 1350 passed, 14 failed, 46 ignored (main: 1346 / 17 / 46). The 14 failures all fail onmaintoo (Wine lane: e2e,pls_quota,predication_e2e, Tests: heap_window_out_of_memory_falls_back_to_the_switch_form fails under XCL_REQUIRE_GPU=mesh (opt-in skip counted as missing coverage) #1651's heap-window test, fma/f32/f64 recompiler GPU tests, Opus/XMA2 voices and others). The three that pass here and failed onmainare the Tests: placed_title_textures_share_vram_and_preserve_pixels fails now and then at its cubemap reuse check (main 9ce2070) #718 flake family, not fixes.uploads_start_from_each_subresources_state(no D3D12 debug layer under Wine).Regression run
The blocks come from #257's
scripts/linux/smoke.sh(thesmoke.ps1block under Wine; itstitle:line hashed assmoke.ps1does),XCL_COHERENT_MB=512for both.main:
this PR:
Not tested
from_raw_parts(GetBufferPointer…)calls on DXC blobs (gpu/recomp/dxil/assemble.rslines 21 and 53) are left as they are; root signature blobs elsewhere are never empty.AI use