Repository navigation
Conversation
D3DMetal calls Release on adopted resources from a native thread of its own at submit time. That thread has no Wine TEB, so the first-time std::env::var read inside the OnceLock in late_release::enabled() enters Wine's ntdll and never returns. Reading the setting once in adopt(), on the Wine thread that creates the object, makes sure the OnceLock is already set before the host's thread can reach it. Part of xcl-dev#258. Assisted-by: Claude Code (Claude Opus 4.6 (1M context))
Hardware test report — commit
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
PR #1789 compatibility verification on STOR-WINLABTested commit Tested
Failures and skips
Not tested Wine/D3DMetal and the native release thread without a Wine TEB, a main-branch baseline, retail-title smoke runs, sample-dependent paths, and other GPU vendors. This run establishes Windows behavior for the tested head. A baseline would be needed to attribute the suite failures to the PR. AI use T3 Code / Codex ( |
bmjask
left a comment
There was a problem hiding this comment.
No confirmed source defect found. Initializing late-release configuration on the Wine adoption thread preserves Windows behavior and addresses the D3DMetal host-thread situation. Merge readiness needs evidence reconciliation: independent reports show a clean suite/smoke, but the visible PR-description check fails. Residual validation includes no automated host-thread-without-TEB or D3DMetal integration regression, plus no NVIDIA/Intel Windows smoke.
Apple's D3DMetal (CrossOver, the Game Porting Toolkit) calls Release on threads of its own (its queue thread at submit, for a barrier's resource) and from inside calls XCL makes while XCL holds a lock of its own. When that Release is the title's last one and late release keeps the object, res_release took the maps' locks, the sparse state's and the texture table's, and late_release::hold signalled the queues and waited. Whatever the host's thread waits for there, its queue waits for too. (The one such wait seen in a retail run on the Mac port, sparse's forget_buffer, no longer waits since xcl-dev#1981; the others are the same shape and are not waited for here either.) On a host whose D3D12 is in no PE module (class_for: module_of of the table's first method is 0, noted once when the first such table is adopted) a kept last Release now writes the resource into a ring of atomics (late_release::hand_over) and returns: no lock, no fence, no allocation, no thread start, no environment read (xcl-dev#1789 reads XCL_LATE_RELEASE at adoption). The next drain_known, on the late-release thread (started at adoption on such a host) or a submit, forgets what XCL keeps by the address (real::forget_released, the old body of res_release) and holds the object like any other; the address cannot come again before that, the object is still there. With the ring full (16,384 slots) the reference is kept for good and counted. D3D12 on Windows and vkd3d-proton are PE modules: there the flag is never set, the ring stays empty (drain_known reads two atomics) and a Release does what it did. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a Mac (CrossOver, D3DMetal), D3DMetal releases the resources of an executed command list from a native thread of its own, which has no Wine TEB. The first
Releasethere callslate_release::enabled(), whoseOnceLockreadsXCL_LATE_RELEASEfrom the environment for the first time, and that read never returns on that thread. This reads the setting inreal::adopt, on the Wine thread that creates the object, so theOnceLockis set before the host's thread can reach it. Nothing changes on Windows: the same value is read once, only earlier.Part of #258. It is the first commit of the series Ahmet-Dedeler reviewed in #258 (comment); the rest (deferring a
Releasethat arrives on a host thread) stays a separate PR, since no test here needs it yet (#258 (comment)).What is in it
crates/xcl/src/hle/d3d12x/late_release.rs:init(), which forces the one-time read.crates/xcl/src/hle/d3d12x/real.rs:adoptcalls it for every adopted object.Tested
x86_64-pc-windows-gnu(mingw-w64 GCC 16.2.0), debug, DXC 1.9.2609. Each test in its own process (<test exe> --exact <test> --test-threads=1 --nocapture, 90 to 120 s timeout).console_wave64_compute_through_the_pso_hook_dispatch_and_read_back(tests/gpu_compute_e2e.rs) andhle::d3d12x::title_textures::tests::gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes:main85e3826 + Recompiler: keep a draw's descriptor heaps alive until the list has run #553 + Ahmet-Dedeler'sddf3be7(which fix the other hangs in these two tests on this host): both time out, the first 2 of 2.main85e3826 alone, with and without this commit: no run passes; each times out or ends without a result, on the hangs Recompiler: keep a draw's descriptor heaps alive until the list has run #553 andddf3be7fix.late_releaseunit tests (a_held_resource_goes_when_the_queue_is_past_its_batch,without_queues_a_batch_goes_at_once): pass.Regression run
This changes runtime files, so it needs an
xcl-smokepair from someone with a title; I have none.Not tested
XCL_LATE_RELEASEearlier.AI use