D3D12.X: a list vtable at a reused heap address gets its own methods #2593
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!2593
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2593"
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?
@SergeAx on GitHub · 2026-11-26 00:53 UTC · original
SergeAx:d3d12x-heap-vtable-classes→main· +81 −3 · 1 files · 1 commits · openFixes #2588.
With the Agility SDK 1.620, an open command list's vtable is in heap memory and goes with the list.
real::class_forcached the extended vtable by the runtime vtable's address and copied the runtime's methods only once, so a direct list whose open vtable came where a released compute list's had been called the compute list's methods: itsClearDepthStencilViewmadeClosefail withE_FAIL. That is the parallel-only failure ofvram::tests::d32s8_targets_take_their_own_size_of_video_memory(#42).What is in it
crates/xcl/src/hle/d3d12x/real.rs: aClassof a vtable outside any module keeps the methods it copied (copied), andclass_fortakes it only while they are still the ones at that address. Vtables in a module's image are looked up as before.crates/xcl/src/hle/d3d12x/real.rs(class_tests):a_direct_list_at_a_released_compute_lists_vtable_records_with_its_own_methods.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4at52c0802f: 1426 passed, 4 failed, 47 ignored. The 4 are #1905 (fuzz_validate_and_gpu_0.._3, seeds 70, 545, 1019 and 1507), as on main6d12f58(#42).V_MUL_F16,V_PK_MUL_F16,V_CVT_F16_F32);heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windowscopied, and passes in 5 out of 5 with this change.--test-threads=4 hle::d3d12x hle::xgameruntime: the D32S8 test failed in 2–5 runs out of 10 on6d12f58, and in 0 out of 12 with this change.Regression run
main:
this PR:
Not tested
D3D12Core.dll, which this change looks up as before)list_x::tests::a_reset_while_the_last_submit_runs_records_on_another_pc_list)AI use
@DavidM1911 on GitHub · 2026-11-26 01:09 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 26 ignored.Thanks!
— Devin
@DarkPanda69 on GitHub · 2026-11-26 01:11 UTC · original
AMD run (listed as untested), on Windows 11 too: on an RX 9070 XT the new test skips. The reuse it waits for did not happen in 3 runs, so on this machine it passes without exercising the fix.
Head
52c0802applied onmainb49be18, debug, Windows 11 Pro 26200, RX 9070 XT (RDNA4, driver 32.0.32029.2010). The test takes the default adapter (create_device(None, ..)), which is the RX 9070 XT on this machine.cargo test -p xcl --lib -- a_direct_list_at_a_released_compute_lists_vtable --nocapture, 3 times, each:So in the test's 200 tries, no direct list landed on a released compute list's vtable address here. Your report's SKIPPED list doesn't include this test, so it did run on the RTX 5080. Whether the address reuse is rarer here because of the GPU driver, Windows 11 or the heap was not looked into. This run also says nothing about whether the fix is right on AMD; it only shows the test does not reach it on this machine.
Not tested: the machine's RTX 3060 (the test always uses the default adapter), Intel, a title.
AI use: Claude Code (Claude Opus 5.5) ran the test on this machine and wrote this report.
@mokkamokacaffe on GitHub · 2026-11-26 01:29 UTC · original
I found an additional cache-boundary case in the current implementation.
same_methodswalks the historicalcopied.len()before deriving the replacement vtable’s current interface and scanned length. A shorter replacement can therefore be read using the older length, while a longer table sharing the old prefix can reuse stale internal method handling.I prepared a focused follow-up at
ea5a19a. It derives the live table shape first, compares the complete snapshot and metadata, preserves the image-backed fast path, and adds CPU-only coverage for:Tested
heap_classes_match_only_the_same_shape_and_methods: passedgit diff --check: passedNot tested
xcl-smokerunsExact-head GPU and smoke runs remain required after this change is folded into #2593.
AI use
@SlopTart on GitHub · 2026-11-26 05:13 UTC · original
Tested: current PR head merged onto current
origin/main(clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo targetx86_64-pc-windows-gnurun under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).gpu_suite (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.Targeted run of
a_direct_list_at_a_released_compute_lists_vtable_records_with_its_own_methods: passed.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.
@SergeAx on GitHub · 2026-11-26 05:31 UTC · original
@mokkamokacaffe thanks for looking. I read
class_forat52c0802andea5a19a, and I don't think the extra check is needed:same_methodsreadscopied.len()words atorig: the old class'sscanned, the same words its own scan read at that address. A class is reused only when all of those words equal its snapshot; a fresh scan would then find the same words in the same module and stop no earlier, so the table cannot come out shorter.scanned, where the old scan stopped, now points into the same module. With the firstscannedwords identical, it is the same runtime class, whose table length is fixed: a word after it is heap memory past the vtable, not a method. The runtime calls only its own methods, all among the compared words, and for the title such a slot answers the same either way: the guard of an internal slot answers a title call as the stub does (logged, 0), andconsole_slots/console_remapgive it the same handler in both cases.CLASSESand the lookup matches by methods, so A's class is found again when A's table comes back.ea5a19aruns the QI probe and the scan on every adopt of an object with a heap vtable before matching (every command list on Agility 1.620), where this PR comparesscannedwords. Its new test covers the newmatching_classhelper; it does not show a case where this PR's lookup returns the wrong class. So I'm keeping #2593 as it is.AI use: Claude Code (Claude Opus 5.5) read both commits and wrote this reply.
@upipibi on GitHub · 2026-11-26 06:48 UTC · original
NVIDIA test report for
52c0802: RTX 3070 8 GB (Ampere, driver 616.56), Windows 11 26100, Rust 1.100.0, debug.a_direct_list_at_a_released_compute_lists_vtable_records_with_its_own_methods,--exact --test-threads=1 --nocapture, 5 runs: 5 passed; the reuse happened (no SKIPPED line) in 0 of 5, so it skipped as on the RX 9070 XT. The cause here is the D3D12 runtime, not the driver: with no Agility SDK found,create_deviceused the inboxD3D12Core.dll10.0.26100.9549, whose command list vtables are in the DLL image (PC vtable D3D12Core.dll+0x30ed90/+0x30e830). Compute and direct lists then have different static vtables, andcopiedis never set.XCL_D3D12_DIRset to the Agility SDK 1.620.2 (NuGetMicrosoft.Direct3D.D3D121.620.2), 5 runs: 5 passed; the list vtables were heap addresses, and the reuse happened (no SKIPPED line) in 4 of 5, so the fix is exercised on this driver. With the lookup changed to ignorecopied(local edit, Agility 1.620.2), it failed 5 of 5:ClearDepthStencilView of a direct list at a compute list's vtable 0x... failed its Close.hle::d3d12x::real::at default threads, inbox runtime, 3 runs: 60 passed, 0 failed each time; the new test SKIPPED in all 3.cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4(thehle::xaudio2tests hang on this machine, onmaintoo), inbox runtime: 1296 passed, 0 failed, 27 ignored; 26 SKIPPED lines (21 × no wave64; 3 × wave32 per-lane form refused:V_MUL_F16,V_PK_MUL_F16,V_CVT_F16_F32;pso_measurement_compiles_an_exact_synthetic_record: driver cache needs Developer Mode; and the new test).The RX 9070 XT report doesn't say which D3D12 runtime it loaded; if it was the inbox one, its skip has the same cause, and a run with
XCL_D3D12_DIRwould show whether AMD reuses the address.Lib tests only; no title run.
AI-assisted (Claude Code, Claude Opus 5.5).
@mokkamokacaffe on GitHub · 2026-11-26 11:35 UTC · original
@SergeAx Thanks for the detailed correction. I re-read
class_forat52c0802alongsideea5a19a, and I agree that my follow-up did not establish a failing case in this PR:scannedsnapshot to match.CLASSESand is selected by its method snapshot.matching_classpolicy itself; it did not reproduce an incorrect class selection by the existing lookup.I therefore withdraw the
ea5a19asuggestion and support keeping #2593 scoped as it is. The later Agility 1.620.2 NVIDIA report also gives the important missing distinction: the regression is exercised with heap-backed vtables, while inbox-runtime/image-backed tables legitimately skip it.Thanks for checking the proposed follow-up closely.
AI use
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.