Repository navigation
XG: fix CopyFromSubresource 7-argument ABI and guard destination span - #684
JGonzalezRodriguez wants to merge 1 commit into
Conversation
CopyFromSubresource (vtable slot xcl-dev#9) takes an extra u32 argument before src: (dst, plane, sub, arg4, src, row_pitch, slice_pitch). With the old 6-argument signature, src was decoded as row_pitch and rows were copied far outside dst, causing access violations (xcl-dev#477, xcl-dev#662). Update copy_from and xg_oracle to the 7-argument ABI, validate row_pitch, 3D slice_pitch, and destination span readability before writing (logging a bounded warning and returning E_INVALIDARG on invalid spans), and add 2D, 3D, and invalid-span unit tests. Fixes xcl-dev#477 Part of xcl-dev#662
|
This branch seems to fix #477 on Linux! |
|
Hardware check of Tested
Regression run PR ( Not tested
AI use
|
|
@odd/tasks/draft-pr684-comment.md |
|
A retail run that reaches the call, on native Windows – the reports above cover the suite and the 60 s regression pair, which stay on the title's first screens. Tested
Not tested: AMD and Intel GPUs; One thing you may want: I had the same fix with a test of the title's own first call – BC7 512×512 with its full mip chain through both methods, level by level, nothing written between or after the rows; on AI use: Claude Code with Claude Fable 5.2 ran the builds, tests and runs and wrote this report; every number is from a run on the machine named. No game files are attached. |
|
Tested - Tool: OpenCode with DeepSeek V4.1 Flash 1017
Tested - native Windows, AMD RDNA2
Not tested: the #477 crash through a retail title ( AI use: OpenCode with DeepSeek V4.1 Flash 1017 ran the tests and drafted this report. |
|
Linux (Wine) run that reaches the call, with details for the one-line Linux report above. Tested
What came after
Not tested: Windows. The workspace suite: XCL doesn't build or run tests on Linux, so only the cross-built binaries ran. This PR without #273 on a run that reaches the call. AI use: Claude Code (Claude Opus 5.5) built the branches, read the logs and the kernel journal, and drafted this comment. The runs are mine, on the hardware above. |
|
Code audit + NVIDIA RTX 5080 test run on Review
Tested
Not tested
AI use: code review and test run orchestrated with Antigravity (Gemini 4 Neon) on the hardware listed above. |
Integrates upstream PR xcl-dev#684 while retaining read_committed on sparse or partially-committed source ranges: - Fix vtable slot xcl-dev#9 signature to (dst, plane, sub, arg4, src, row_pitch, slice_pitch) so src is no longer misinterpreted as pitch. - Validate row_pitch, 3D slice_pitch, and destination span before copying.
Integrates upstream PR xcl-dev#684 while retaining read_committed on sparse or partially-committed source ranges: - Fix vtable slot xcl-dev#9 signature to (dst, plane, sub, arg4, src, row_pitch, slice_pitch) so src is no longer misinterpreted as pitch. - Validate row_pitch, 3D slice_pitch, and destination span before copying.
Test stack: upstream PRs xcl-dev#684, xcl-dev#541 and xcl-dev#273 on main
Integrates upstream PR xcl-dev#684 while retaining read_committed on sparse or partially-committed source ranges: - Fix vtable slot xcl-dev#9 signature to (dst, plane, sub, arg4, src, row_pitch, slice_pitch) so src is no longer misinterpreted as pitch. - Validate row_pitch, 3D slice_pitch, and destination span before copying.
|
Linux + NVIDIA run that reaches the call: Setup: Fedora 44 (kernel 7.2.9), Wine 11.21 Staging (X11), vkd3d-proton 3.1 with the relaxed-vtable patch from #175 and a local dxil-spirv patch,
The fault on
With the PR, the title presented for about 14 s more and then stopped, and its watchdog ended it 29 s later. Not tested: the AI use: Claude Code (Claude Fable 5.2) read the diff, ran both builds of the title on my machine with |
Integrates upstream PR xcl-dev#684 while retaining read_committed on sparse or partially-committed source ranges: - Fix vtable slot xcl-dev#9 signature to (dst, plane, sub, arg4, src, row_pitch, slice_pitch) so src is no longer misinterpreted as pitch. - Validate row_pitch, 3D slice_pitch, and destination span before copying.
Integrates upstream PR xcl-dev#684 while retaining read_committed on sparse or partially-committed source ranges: - Fix vtable slot xcl-dev#9 signature to (dst, plane, sub, arg4, src, row_pitch, slice_pitch) so src is no longer misinterpreted as pitch. - Validate row_pitch, 3D slice_pitch, and destination span before copying.
…nation guard Carried from upstream PR xcl-dev#684 by gsucristo (XG: fix CopyFromSubresource 7-argument ABI and guard destination span), as our Linux tree has used it since 11-25. Not our work. Platform: carried Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…stic) Counts the calls and logs the first four (then powers of two): whether the title reaches it, which tells if xcl-dev#684 / xcl-dev#1435's 7-argument form matters for our runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main has merged nvidia-dev (xcl-dev#3203): its two-pass mesh, sparse and upload paths now submit through real::native_queue_execute / _signal / _wait. Those already carry xcl-dev#867's UnadoptGuard and unwrap_fence; the conflicts and the main-only submit paths were resolved as follows. Taken from main, the stack's version dropped (main does the same): - recomp/dxc.rs (3): xcl-dev#688's private DXC heaps; main's form (3842807) falls back on any failure and never destroys a heap. - device_x.rs (10): xcl-dev#3091 (cherry-pick 511a297); main's 7e24237 keeps interned shader copies for base pipelines. xcl-dev#3091's tests and its real.rs test counter (GRAPHICS_FALLBACK_ATTEMPTS) and README line go; xcl-dev#2753's console_bytes is re-applied on main's file. - bind.rs (16): the stack's only change there was xcl-dev#1803, merged in main. main's file, plus the xcl-dev#2816 feedback-copy UnadoptGuard in poll_two_pass_feedback (ed887d2, from linux/stack-nvidia-dev). - pso.rs: main has daae033 (multidimensional groups take direct DXIL, xcl-dev#3189's change), so the stack-only commit is in main; translate calls take main's translate_compute_rodata / translate_entry_rodata_rt32. - list_x.rs tests: xcl-dev#3090's barrier tests were in twice (cherry-pick and main's merge); the cherry-picked copy goes. - runner.rs device(), xbox.rs Fssm::rodata: added on both sides; one copy. - README.md: the precompile-wrapper paragraph was added on both sides; one copy. Both kept: - build.rs (2): TRANSLATION_GLUE_REVISION "pso-glue-v5-linux-multidimensional- direct" (main's v5 + the stack suffix); translator sources keep xcl-dev#2229's cfg.rs and code_loads.rs, drop dxc.rs as main does. - dxil/kernel.rs (6): TRANSLATOR_VERSION 13 (main 12; the stack's xcl-dev#2229 head output differs, as on linux/stack-nvidia-dev); main's rt32 entry points with xcl-dev#2229's code_loads. - dxil/lower.rs (4), lower_mem.rs (3), lower_window.rs (1), recomp/emit.rs (11), recomp/mod.rs (3), recomp/tests.rs (1), core_tests.rs: main has an earlier copy of xcl-dev#2229 (41f1a85); xcl-dev#2229's head (code_loads, xcl_cload / xcl_gload(hi, a)) is kept over it, as on linux/stack-nvidia-dev; main's loop_ids, IO slots, ps_mask_live_scc and rt32 mask kept beside it, and main's duplicate core_tests copy of the rodata test goes. lower_mem.rs keeps the stack's scratch_ptr insert-before-terminator line. - real.rs (6): the class scan keeps `own` with main's release_through_its_own_vtable; xcl-dev#2477's in-place patch after main's two-pass defer hooks; q_signal_pc / q_wait_pc beside main's page mappings; the title ExecuteCommandLists keeps xcl-dev#867's list guards inside main's watch::in_driver scope; test modules of both. - list_x.rs (1): xcl-dev#867's allocator / PSO guards with main's `on = pc_alloc`. - sparse.rs (1): main's new_state, with xcl-dev#867's raw fences for the sparse and readback fences and the async readback fence pairs (as on linux/stack-nvidia-dev); pc_execute (main's texture_upload submit path) unadopts its list for the submit. - title_textures.rs (1): main's early fence creation, as a raw fence. - dstorage.rs (4): xcl-dev#2864's unpack cache on main's Cow source and stage buffers. - xg.rs (2): main's copy_args (adccb7d) covers xcl-dev#684's argument fix; xcl-dev#684's destination guard kept. - present.rs (1), gpu_compute_e2e.rs (1), README.md (2): tests and text of both. linux/README.md: main line updated; xcl-dev#1599, xcl-dev#2082, xcl-dev#1803, xcl-dev#3090, xcl-dev#688, xcl-dev#3091 and the stack-only multidimensional row leave the table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@JGonzalezRodriguez this conflicts with AI use: Claude Code (Claude Fable 5.2) made the trial merge and wrote this. |
|
The ABI half of this PR is already on main, done differently. adccb7d (the change of closed #1435) has AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
|
Thanks for this, @JGonzalezRodriguez. Since the argument fix landed on AI use: Claude Code (Claude Opus 5.5) made the port and wrote this. |
Fix
XGTextureAddressComputer::CopyFromSubresource(vtable slot #9) taking 7 arguments instead of 6, and validate the destination span before writing rows.CopyFromSubresourcereceives an extrau32parameter beforesrc(dst, plane, sub, arg4, src, row_pitch, slice_pitch). With the previous 6-argument signature,srcwas read asrow_pitch, causingcopy_nonoverlappingto stride rows by the low 32 bits of the source pointer and trigger access violations (#477, first crash in #662).Supersedes #539 (the other parts of #539 have either landed on
mainin #435 / #451 / #486 / #574 / #602 / #634 / #636, are covered by focused open PRs, or need a separate single-purpose PR).Fixes #477
Part of #662
What is in it
crates/xcl/src/hle/xg.rs:copy_from(vtable slot Olympus: harden DXIL cache identity and validation #9) and the module doc comment to the 7-argument signature(dst, plane, sub, arg4, src, row_pitch, slice_pitch).row_pitch, 3Dslice_pitch, and destination span readability (gpu::shader::readable) before copying, logging a bounded warning and returningE_INVALIDARGon invalid spans.copy_into_and_copy_from_round_trip,copy_from_3d_round_trip, andcopy_from_rejects_invalid_dst_span.crates/xcl/tests/xg_oracle.rs:CopyFromSubresourcecall insubresource_copies_match_the_console_libraryto the 7-argument signature.Tested
rustc 1.98.1, debug,x86_64-pc-windows-msvcviaclang-cl+lld-link+xwin):cargo check --workspace --target x86_64-pc-windows-msvc --tests: passed (0 errors, 0 warnings).wine-11.0) on AMD Ryzen 9 7950X3D + NVIDIA GeForce RTX 4090 (driver610.57.04), debug:xcl --lib hle::xg::tests: 6 passed, 0 failed, 0 ignored (rgba8_64kb_s_layout,d16s8_is_planar_depth_and_stencil,console_floats_are_32_bits,copy_into_and_copy_from_round_trip,copy_from_3d_round_trip,copy_from_rejects_invalid_dst_span).xg_oracle: 6 passed, 0 failed, 12 ignored (oracle tests return early withoutXCL_SAMPLE_XG).xgcommits from D3D12.X / XG: async texture upload, detiling, VRAM, XG ABI, and PSO scheduling improvements #539 were also independently tested against a retail title by @ddm-j in D3D12.X / XG: async texture upload, detiling, VRAM, XG ABI, and PSO scheduling improvements #539 (comment) (confirmed validrow_pitch/slice_pitchand no access violation).Regression run
scripts/smoke.ps1runs (opened as draft until native Windowsscripts/test.ps1andmain+ PRxcl-smokeblocks are attached).Not tested
scripts/test.ps1(full workspace suite) andscripts/smoke.ps1regression runs (author builds on Linux/Wine).tests/xg_oracle.rswithXCL_SAMPLE_XGset against the consolexg_xs.dll.AI use
origin/main, refined the 2D/3D destination span check, wrote unit tests, ran cross-compile + Proton Wine checks, and drafted the PR description; reviewed by author).