Skip to content

[upstream #1813] DirectStorage: EnqueueSignal takes a fence in memory VirtualQuery does not know - #324

Draft
ufoptg wants to merge 7 commits into
mainfrom
upstream-pr/1813
Draft

ufoptg wants to merge 7 commits into
mainfrom
upstream-pr/1813

Conversation

@ufoptg

@ufoptg ufoptg commented Nov 25, 2026

Copy link
Copy Markdown
Owner

On a Mac, a DirectStorage fence is never signalled, so a title that waits on one waits forever. EnqueueSignal checks the fence and its table with gpu::shader::readable, which asks VirtualQuery. D3DMetal (CrossOver) keeps its D3D12 objects in memory that Wine's VirtualQuery does not know (the test title's fence is at 0x7fcc2d0f7540), so every fence is refused and its signal dropped, with nothing in the log. This PR reads the fence pointer and its table with read_own (ReadProcessMemory), the helper this file already uses for the page lists. It still refuses memory that cannot be read. Part of #258, found while testing xcl-dev#1329 there (xcl-dev#1329 (comment)).

What is in it

  • crates/xcl/src/hle/dstorage.rs, queue_enqueue_signal: the fence's first word and the table's first 11 words are read with read_own. A null pointer, a null table or memory that cannot be read still enqueues nothing, as before. The Signal call itself is unchanged.
  • Test a_fence_of_the_hosts_d3d12_is_signalled: a fence from the host's D3D12 (WARP if there is no adapter, as in fence_x.rs) is taken by EnqueueSignal, and Submit signals it. A pointer to a reserved, uncommitted page is still not taken.

Tested

Regression run
This changes crates/xcl/src/hle, so it needs xcl-smoke pairs. I have no title. On Windows a D3D12 fence is in memory VirtualQuery knows, and both checks take it, so I expect nothing to change there. A Windows pair would confirm that, and a Mac pair would show the effect on a title. Draft until the pairs are here.

main:

PR:

Not tested

  • Windows and Linux / Wine with vkd3d-proton. The new test only needs a D3D12 device (WARP works), but I have not run it there.
  • The whole unit test suite; only hle::dstorage::.
  • A retail title.

AI use

  • Claude Code, Claude Opus 5.5 found the cause, wrote the change, the test and this description, and ran the tests on this machine.

Mirror of xcl-dev#1813 (auto-synced, do not edit).

grahamster2 and others added 7 commits November 23, 2026 22:30
The `title:` line of an xcl-smoke block printed the game folder's name,
and folder names are whatever people called their copy, so PR
descriptions ended up naming specific copies of a commercial game
(xcl-dev#677). It now prints the first 8 hex digits of the SHA-256 of the
folder name (trimmed, UTF-8). pr_check.py only compares the main and PR
blocks' titles for equality, so the check is unchanged, and two
different folders still get different titles. Existing blocks can be
converted with the same function (Python:
hashlib.sha256(name.strip().encode()).hexdigest()[:8]).

-Title <label> prints a label of your choice instead. Control, format
and line/paragraph separator characters and backticks are refused:
pr_check.py splits lines with str.splitlines(), so a U+2028 in a label
would otherwise add keys such as `commit:` to the block.

scripts/smoke-title.tests.ps1 checks hashes of ASCII, accented, CJK and
emoji names against Python's, a trailing backslash, -Title, and the
refused labels, with a stand-in for xcl.exe.

Fixes xcl-dev#677
…v#1307)

The structured form wraps the items that follow a forward jump in a guard
that lists every pending skip flag, and reopens it whenever the set
changes. With many flags pending at once that grows with the square of
the flags. Since b8b1f49 one compute program of the retail pack reaches
it: 148 MB of HLSL from 334 KB of code (3 861 flags, guards of up to 597
terms, 99 MB in guard lines), against 14 MB as pc blocks. DXC on that
fits the host's commit growing about 1 GB/s until it runs out, seen with
b8b1f49 and not without it.

Structured code longer than 128 bytes per byte of program is now
translated as pc blocks. Over the whole pack (CPU-side translation of
every program, macOS), only that program changes, to 13.8 MB. The next
largest structured program is at 61 bytes per byte. Every other program
comes out as it does on main, so b8b1f49's gain stays (1 670 -> 170
programs as pc blocks).

oversized_structured_code_falls_back_to_pc_blocks: 200 conditional
forward jumps whose targets all follow them, in order, cross the bound;
50 do not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-oom

dxil: eliminate giant-shader IR and CFG blowup in FormatLoad and multi-window memory
Scripts: smoke blocks name the game folder by a hash, not its name
…s not know

EnqueueSignal checked the fence and its table with gpu::shader::readable,
which asks VirtualQuery. A native host's D3D12 (D3DMetal under CrossOver)
keeps its objects in memory Wine's VirtualQuery does not know, so every
fence there was refused and its signal dropped: a title waiting on a
DirectStorage fence waited forever. The fence pointer and its table are
now read with read_own (ReadProcessMemory), which still refuses memory
that cannot be read.

Test: a_fence_of_the_hosts_d3d12_is_signalled.

Part of #258.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants