D3D12.X: a direct list at a released compute list's heap vtable address gets the compute list's methods #2588

Open
opened 2026-11-26 05:34:26 +00:00 by github-bot · 0 comments
Owner

@⁠SergeAx on GitHub · 2026-11-26 00:31 UTC · original

With the D3D12 Agility SDK 1.620, an open command list's vtable lives in heap memory and is freed with the list. real::class_for (hle/d3d12x/real.rs) caches an adopted object's extended vtable by the runtime vtable's address, and copies the runtime's methods into it only the first time it sees that address. When a direct list's open vtable lands where a released compute list's was, the direct list gets the compute list's methods: its ClearDepthStencilView makes Close fail with E_FAIL.

This is why hle::d3d12x::vram::tests::d32s8_targets_take_their_own_size_of_video_memory fails now and then in parallel runs (Close().unwrap() at vram.rs:2040 → 0x80004005, reported in #42).

Found on

  • NVIDIA GeForce RTX 5080, driver 621.14; Windows 10 22H2 (19045.6466), Agility SDK 1.620.2; main 6d12f58, debug

Measured

  • The lib test binary run as --test-threads=4 hle::d3d12x hle::xgameruntime (or hle::kernelx instead of hle::xgameruntime) fails that test in 2–5 runs out of 10. It never fails with the tests run one at a time, or with any single d3d12x submodule added.
  • While it fails, a ClearDepthStencilView on any DSV (also a new committed D32S8 target in a new heap) fails its Close. The other commands of the test close fine, and the device is not removed.
  • In 3 of 3 failing runs, the failing list's open runtime vtable had first been seen by class_for on a list of type 2 (compute).
  • A test that creates a compute list, releases it, and records a depth clear on a direct list that gets the same open vtable address fails in 5 runs out of 5 with the device adopted, and passes in 5 out of 5 without adopting it. At that address the runtime's slot 47 (ClearDepthStencilView) changes from the compute list's method to the direct list's. XCL's copy keeps the compute list's.

Plan
A class made for a vtable outside any module keeps the runtime methods it copied, and class_for takes it only while they are still the ones at that address. Vtables in a module's image are looked up as before, at no extra cost. That test becomes the regression test.

AI use: found with Claude Code (Claude Opus 5.5), which ran the measurements above and wrote this issue.

**@⁠SergeAx** on GitHub · 2026-11-26 00:31 UTC · [original](https://github.com/xcl-dev/xcl/issues/2588) With the D3D12 Agility SDK 1.620, an open command list's vtable lives in heap memory and is freed with the list. `real::class_for` (`hle/d3d12x/real.rs`) caches an adopted object's extended vtable by the runtime vtable's address, and copies the runtime's methods into it only the first time it sees that address. When a direct list's open vtable lands where a released compute list's was, the direct list gets the compute list's methods: its `ClearDepthStencilView` makes `Close` fail with `E_FAIL`. This is why `hle::d3d12x::vram::tests::d32s8_targets_take_their_own_size_of_video_memory` fails now and then in parallel runs (`Close().unwrap()` at `vram.rs:2040` → `0x80004005`, reported in #42). **Found on** - NVIDIA GeForce RTX 5080, driver 621.14; Windows 10 22H2 (19045.6466), Agility SDK 1.620.2; main `6d12f58`, debug **Measured** - The lib test binary run as `--test-threads=4 hle::d3d12x hle::xgameruntime` (or `hle::kernelx` instead of `hle::xgameruntime`) fails that test in 2–5 runs out of 10. It never fails with the tests run one at a time, or with any single `d3d12x` submodule added. - While it fails, a `ClearDepthStencilView` on any DSV (also a new committed D32S8 target in a new heap) fails its `Close`. The other commands of the test close fine, and the device is not removed. - In 3 of 3 failing runs, the failing list's open runtime vtable had first been seen by `class_for` on a list of type 2 (compute). - A test that creates a compute list, releases it, and records a depth clear on a direct list that gets the same open vtable address fails in 5 runs out of 5 with the device adopted, and passes in 5 out of 5 without adopting it. At that address the runtime's slot 47 (`ClearDepthStencilView`) changes from the compute list's method to the direct list's. XCL's copy keeps the compute list's. **Plan** A class made for a vtable outside any module keeps the runtime methods it copied, and `class_for` takes it only while they are still the ones at that address. Vtables in a module's image are looked up as before, at no extra cost. That test becomes the regression test. AI use: found with Claude Code (Claude Opus 5.5), which ran the measurements above and wrote this issue.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:34:26 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.