Repository navigation
Conversation
bmjask
left a comment
There was a problem hiding this comment.
No confirmed code-level defect found, but this is high-risk and not merge-ready. The target validation gap is material: the intended assertion-enabled stock Proton/vkd3d-proton scenario was not reproduced directly; the author run used GE-Proton with assertions disabled. Please reproduce it before merge. Also, the shared runtime vtable is patched while other threads may call it; aligned entry stores are relied upon, but there is no concurrent call/patch stress test despite the process-wide blast radius. Finally, the branch is dirty/non-mergeable and stacked on #867, so it needs a rebase and refreshed CI/test evidence.
86a10c6 to
0c249f0
Compare
|
Thanks @bmjask for the review! Addressed all three points at
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Independent AMD RDNA4 / Linux (RADV, native wave64) test report for head Hardware & environment
Unit / GPU tests (
Retail title (60 s, stock assertion-enabled Proton Experimental
Not tested
AI use
|
…er Wine (xcl-dev#175) vkd3d-proton validates iface->lpVtbl on adopted D3D12 objects passed back into d3d12core.dll (command allocators, lists, heaps, resources, PSOs, and fences). On unmodified assertion-free vkd3d-proton (such as GE-Proton or -Db_ndebug=true builds), XCL's in-place vtable adoption causes CreateCommandList/Reset to fail with E_INVALIDARG and fence waits to reject adopted fences. Under Wine (gated behind util::under_wine(), native Windows unchanged): - UnadoptGuard temporarily restores the native vtable on adopted command allocators (including alloc_pool backings and reset_pc_allocator), command lists, heaps (CreatePlacedResource/CreatePlacedResource1), RTV resources, and PSOs around calls into d3d12core.dll. - FenceProxy wraps title ID3D12Fence1 objects so the underlying PC fence keeps its native lpVtbl, unwrapping in queue Signal/Wait while preserving Fence::xcl-dev#12 completed_value_address and freeing on final Release. - real::create_raw_fence creates un-proxied native ID3D12Fence objects for XCL's own internal queue tracking (late_release, alloc_pool, list_x, cpu_writes, present, vram, drain_gpu) so un-adopted internal queues like sparse::queue() never receive a FenceProxy. Note: assert-enabled vkd3d-proton builds (such as stock Proton Experimental) still validate iface->lpVtbl inside an adopted object's own methods, so an assertion-free build (-Db_ndebug=true / GE-Proton) remains required for in-place adoption. Assisted-by: Antigravity (Google DeepMind)
0c249f0 to
96b91da
Compare
|
Thanks @ClosetPie107 for the independent AMD RDNA4 verification on stock assertion-enabled Proton Experimental (60 s at 30.0 fps, 0 assertions, 0 crashes) and @DavidM1911 for verifying on Windows 11! Rebased onto
AI use: Antigravity (Gemini 4 Neon) rebased onto |
|
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
Thanks! — Devin |
Royalflamejlh
left a comment
There was a problem hiding this comment.
The new test concurrent_calls_and_patches_on_readonly_vtable_never_tear_or_miss_orig_fn failed on 0c249f0 under Wine in 3 of 21 runs of real::in_place_tests real::wine_vtable_tests (4 tests) at --test-threads=4, the count scripts/test.ps1 uses, at real.rs:8070 ("callers must observe the patched hook"); alone and at one thread it passed 10 of 10 each. The test is unchanged at the rebased head 96b91da (the loop and the assert are now at :8058 and :8097); we have not rerun it there. The change itself works on Linux + NVIDIA: on a vkd3d-proton built with assertions on and without XCL's relaxed-vtable patch, #867 alone aborts before the first frame and #2477 on top runs.
The callers stop after 20,000 calls each (:8058 at 96b91da), so if the patch lands after they finish, hook_hits stays 0 (a reading of the test). With the loop bounded by time instead, the same 4 tests passed 25 of 25 runs at --test-threads=4 here, each in 0.02–0.04 s: the callers still stop once the hook has been seen, so the 10 s only bounds a failing run:
// real.rs:8058 at 96b91da, in place of `for _ in 0..20_000 {`
let until = std::time::Instant::now() + std::time::Duration::from_secs(10);
while std::time::Instant::now() < until {Setup: main e0d93c84 (the commit this head is rebased on) + #684 e56dbc3, then + #867 f98da36, then + #2477 0c249f0. RTX 4070 12 GB (615.71.09), Fedora 44, Wine 11.21 Staging, release, Series X profile, 100 s, XCL_PSO_PRELOAD=0. vkd3d-proton v3.1-90-g30b0eb9b without the relaxed-vtable patch, assertions on (d3d12core.dll 5b59f1b8…) and off.
| tree | assertions | runs | result |
|---|---|---|---|
| base + #684 | on | 1 | Assertion failed: iface->lpVtbl == &d3d12_heap_vtbl (vkd3d_private.h:1078), 0 frames |
| + #867 | on | 1 | the same, 0 frames |
| + #867 + #2477 | on | 2 | ran, presented until about 76 and 70 s |
| + #867 + #2477 | off | 1 | ran, presented until about 88 s |
- The heads before the rebase (
86a10c6,c79e3b3) gave the same pattern on the assertion build: the base and #867 aborted in 2 of 2 runs each, and #2477 ran in 3 of 3.
Not tested: Proton's own build; the suite; Windows.
AI use: Claude Code (Claude Opus 5.5) ran the title and the tests, tried the fix and wrote this comment.
Carries forward the permitted in-place vtable patching from closed xcl-dev#1395 (originally by @cmt8) on top of xcl-dev#867, skipping in-place patched tables in UnadoptGuard::new so ext[-1] is never read on runtime-owned vtables. Under Wine, vkd3d-proton asserts iface->lpVtbl == &d3d12_*_vtbl on heaps, resources, descriptor/query heaps, root signatures, pipeline states and command signatures even in release builds. Patching their PC slots in place preserves the runtime's vtable pointer and avoids those aborts on stock Proton Experimental / vkd3d-proton 3.2. Assisted-by: Antigravity (Gemini 4 Neon)
96b91da to
94a05e5
Compare
|
Thanks @Royalflamejlh for the assertion-enabled Applied the suggested 10 s deadline loop in
AI use: Antigravity (Gemini 4 Neon) applied the time-bounded loop fix, ran the 25× stress test and smoke run, and drafted this comment. |
|
Tested on an RTX 5080 16 GB, NVIDIA 620.73.04, Linux, stock Proton Experimental (vkd3d-proton
The parent started with 14,308 MiB free VRAM; this run started with 10,883 MiB. The local guard ended the latter at 5,045 MiB free (cutoff 5,120), about 14 s after preflight. This verifies the heap fix on this Proton build. World rendering, stability beyond that point and gameplay FPS remain unmeasured. Follow-up on AI use: OpenAI Codex (gpt-6.2-astra) ran the comparison, checked the logs and capture, and wrote this report. |
Patch
vkd3d-proton's assert-checked COM vtables in place under Wine so stock assertion-enabledvkd3d-protonbuilds (such as Proton Experimental) no longer abort on adopted heaps, resources, descriptor/query heaps, root signatures, pipeline states, and command signatures. Part of #175 and #1701.Stacked on #867; only the top commit (
94a05e53) belongs here. Carries forward the permitted implementation from closed #1395 (originally authored by @cmt8), composed cleanly with #867'sUnadoptGuard.Under Wine,
vkd3d-protonkeepsassert(iface->lpVtbl == &d3d12_*_vtbl)active even in release builds for these seven classes. Because their console slots sit inside the PC interface, patching their PC slots in place (saving the runtime's original function pointers inIN_PLACEfororig_fn) preserves the runtime's own vtable pointer and eliminates those aborts. All new paths are gated behindutil::under_wine(); native Windows behavior is unchanged.What is in it
crates/xcl/src/hle/d3d12x/real.rs:IN_PLACE/in_place_original/in_place_kind/patch_in_place(from closed D3D12.X: under Wine, vkd3d-proton's assert-checked classes keep their vtable #1395) forHeap,Resource,DescriptorHeap,RootSignature,PipelineState,QueryHeap, andCommandSignatureunder Wine.IN_PLACE_Nis published withOrdering::Releaseandregister()runs before each changed slot is written via an alignedAtomicUsize::store(..., Ordering::Release).UnadoptGuard::newskip vtables patched in place (in_place_original(cur, 0).is_some()) soext[-1]is never dereferenced on runtime-owned vtables.in_place_tests:a_vtable_patched_in_place_keeps_its_originals_and_its_neighbourconcurrent_calls_and_patches_on_readonly_vtable_never_tear_or_miss_orig_fn(4 caller threads continuously invoking slot Implement XSystemGetDeviceType/PLS thunks and Opus audio carrier parsing #1 through aPAGE_READONLYvtable while 2 patcher threads race to callpatch_in_place, with a 10 s deadline instead of a fixed iteration cap so callers do not exit before the patch lands under--test-threads=4; verifies exact-once patching, zero torn entries ororig_fnmisses, andUnadoptGuard::newreturningNone).Tested
x86_64-pc-windows-msvc(clang-cl+lld-link).Proton - Experimentalvkd3d-protond3d12core.dllcontainingiface->lpVtbl == &d3d12_heap_vtblassertions; also independently reproduced by @ClosetPie107 on RX 9070 / stock Proton Experimental and by @Royalflamejlh on RTX 4070 / assertion-enabledvkd3d-proton):#867(without this PR):--exact gpu::recomp::tests::gpu_sparse_vram_descriptors_buffers_and_xmemaborts immediately withAssertion failed: iface->lpVtbl == &d3d12_heap_vtbl, file ../src-vkd3d-proton/libs/vkd3d/vkd3d_private.h, line 1077(exit3).#867:real::passed with0assertions,gpu_sparse_vram_descriptors_buffers_and_xmem+gpu_valu_float_and_intpassed2/0with0assertions, and a 20 s retail title run exited0with337frames shown and all 7 assert-checked classes patched in place.94a05e53(rebased ontomain08db8020+ updated#867e57cb659, with @Royalflamejlh's time-bounded test loop fix) underGE-Proton11-14:real::in_place_tests real::wine_vtable_tests --test-threads=4(× 25 runs): 25/25 passed (5 passed, 0 failed, 0 ignoredeach, ~0.10 s/run)hle::d3d12x::real:: --test-threads=1: 64 passed, 0 failed, 0 ignoredpwsh ./scripts/smoke.ps1:13frames shown (PresentX 13,1 1 1/2 s),exit: 0x0,0crashes,0device removals.Regression run
Produced under Wine (
GE-Proton11-14, AMD Radeon RX 9060 XT,XCL_NETWORK=0 XCL_PSO_PRELOAD=0 XCL_RUN_SECONDS=60 XCL_ACTIVITY=1,VKD3D_CONFIG=""). The PR run used unmodifiedpwsh ./scripts/smoke.ps1via a thin Wine wrapper;main(e0d93c84) crashed before writingreport.json, so its block was extracted from the samexcl.log(peak commit: 0 MBis what Wine reports inxcl.log).main(e0d93c84):This PR (
94a05e53, stacked on #867):Not tested
util::under_wine()).vkd3d-protonby @Royalflamejlh, @wayback94, and @pickles976).AI use
concurrent_calls_and_patches_on_readonly_vtable_never_tear_or_miss_orig_fn, running the 25×--test-threads=4stress verification and 60 s smoke run, and drafting this update.