Skip to content

D3D12.X: XCL_REFUSE_CS leaves listed compute programs out of the driver - #2527

Draft
GreemSC wants to merge 1 commit into
xcl-dev:mainfrom
GreemSC:refuse-cs
Draft

GreemSC wants to merge 1 commit into
xcl-dev:mainfrom
GreemSC:refuse-cs

Conversation

@GreemSC

@GreemSC GreemSC commented Nov 25, 2026 •

Copy link
Copy Markdown

A switch to leave listed compute programs out of the driver: XCL_REFUSE_CS=HASH[,HASH…], with the record hashes that driver compile start … record HASH logs, or XCL_REFUSE_CS=@path to read them from a file (commas, spaces or one per line, # comments; asked for on #505 for a list of ~1,000 programs). A listed program is refused before the driver sees it, by any of the three ways a compute program reaches it (a warm whole pipeline, the pieces of a direct-DXIL dispatch chain, the whole build), and takes the existing path of a compute PSO the driver refuses: its dispatches are skipped.

Why: a program whose driver compile never ends takes the process's memory with it, and today the only way past it is a local patch. On Linux (vkd3d-proton, RADV), the direct DXIL of record 95cc13288a27a96e (2.4 MB) started its compile 95–102 s into four retail runs and never finished; the thread stays in d3d12core.dll at the same addresses, and the game's memory grew from 9.8 GB to our 16 GB cap. #1035 is the same shape on the HLSL path. Several testers carry their own switch for this (an XCL_REFUSE_CS of their own on #2057, a local skip of the ray-tracing resolve programs on #505), and #505 has one RX 7800 XT on Windows where the same program never finishes either.

Part of #1035.

What is in it

  • crates/xcl/src/hle/d3d12x/real.rs: refused_cs / record_hashes (the variable or its @path file, read once; an unreadable file is logged and refuses nothing); the check right after the record hash in translated_compute_pso_once, before the CachedWhole attempt, dispatch_chain::build and the whole build; load_refused_cs; a unit test of the parsing (list and file forms).
  • crates/xcl/src/host.rs: load_refused_cs() before vfs::init and the VFS hooks, so an @path on a host drive the title's mounts also name is read before it is remapped (found by KDenKC).
  • README.md: the variable, next to the refused-program log line it reuses.

Tested

  • RX 7900 XT 20 GB (Mesa 26.2.5 RADV), i7-12700K, Linux 7.2 with Proton-CachyOS Wine 11 and a local vkd3d-proton build (dxil-spirv 53aac41); Rust 1.100.0; the test binary is the Windows MSVC one (cargo test --release -p xcl --lib --target x86_64-pc-windows-msvc --no-run), run under Wine with DXC 1.9.2609.
  • Whole lib suite under Wine, --test-threads=4, skipping reset_dxgi_device_manager_with_d3d12_device_and_token_validation (it calls DXGID3D10CreateDevice, which Wine does not implement, and aborts the process): this head (rebased on b49be18) 1244 passed, 65 failed, 27 ignored, 7 SKIPPED; main b49be18 on the same machine: 1243 passed, 65 failed, 27 ignored, 7 SKIPPED. The 65 failures are the same tests on both (Wine / vkd3d-proton environment); the one more pass is refused_record_hashes_parse.
  • Windows, from this thread on the previous head e4705c1 (before the rebase and the two fixes): RTX 3070 smoke pair and the parser test by razormontana; cargo test -p xcl --lib all passed on an RTX 3060 Ti by DavidM1911.
  • In the retail title, with an earlier local version of this switch (same parsing; it refused inside compute_container) on our Linux tree (main 68a284a + D3D12.X: run sparse::readback_after_execute asynchronously per queue #1732, XG: fix CopyFromSubresource 7-argument ABI and guard destination span #684, Recompiler: direct DXIL gives every loop head and block one back edge #1860, Recompiler: split wave64 compute groups of several waves across dispatches #2097, D3D12.X: an ExecuteIndirect of a split program runs its pieces #2404), XCL_REFUSE_CS=95cc13288a27a96e: compute PSO of record 95cc13288a27a96e (2420644 B DXIL) refused by XCL_REFUSE_CS at 96.6 s / 99.3 s in two runs, no driver compile of it started, and one of the runs presented to 278 s (the intro cutscene with its subtitles and credits) before the machine's memory stopped it. This commit itself was not run that far (see the regression run).

Regression run

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: AMD Radeon RX 7900 XT (RADV NAVI31)
title: 0e570ca6
seconds: 60
exit: 0x3
frames shown: none logged (the run did not reach its end)
presents per 2 s (last 3): 0
device removals: 0
crashes: 2
peak commit: n/a MB
xcl-smoke v1
commit: 8ed5a0a8bf95dc0f93e47134ef3ae984051b5fcf
gpu: AMD Radeon RX 7900 XT (RADV NAVI31)
title: 0e570ca6
seconds: 60
exit: 0x3
frames shown: none logged (the run did not reach its end)
presents per 2 s (last 3): 0
device removals: 0
crashes: 2
peak commit: n/a MB

Both through scripts/smoke.ps1 with Linux PowerShell, the -Xcl being a wrapper that runs the built xcl.exe under Proton's Wine (XCL_DIRECT_DXIL=1 XCL_PSO_PRELOAD=0 XCL_LATE_RELEASE=0, same for both). Both runs end the same way at about 2.5 s, in the title's own assert at game_scarlett_master.exe+0x2478b7b: the known stop of plain main under Wine without #871. So on this machine the regression run covers only start-up; razormontana's Windows pair above is on the previous head. I am keeping this a draft until there is a Windows pair on this head.

Not tested

  • Windows (native) on this head, and a regression run that gets past start-up on this machine (see above), NVIDIA, the full workspace suite (only the xcl lib suite, under Wine).
  • No unit test of the order of the check against the three build paths: it needs a device; the order is in translated_compute_pso_once.
  • Without the variable set, the change does nothing but read it once.

AI use

  • Claude Code (Claude Opus 5.5): wrote the change, the test and this description, ran the builds, the tests and the runs.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

@GreemSC

GreemSC commented Nov 25, 2026

Copy link
Copy Markdown
Author

@DavidM1911 thanks. The one piece this draft still lacks is a regression run that gets past start-up: under Wine, plain main stops at 2.5 s here (without #871), so both of my xcl-smoke blocks end there. If you have the retail title on that machine, the two blocks from scripts/smoke.ps1 on 6d12f58 (main) and 64be563 (this head), same title and seconds, would be what it needs.

AI use: Claude Code (Claude Opus 5.5) wrote this reply.

@SlopTart

Copy link
Copy Markdown

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 target x86_64-pc-windows-gnu run 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): 164 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 refused_record_hashes_parse: passed. Lane note: this PR's NVIDIA-side release behavior is not exercisable here (AMD), but the XCL_REFUSE_CS parsing path is, and it is.

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.

@razormontana

Copy link
Copy Markdown
Contributor

I ran the requested native Windows smoke pair and a focused parser test on exact head e4705c1aef7255c9e59f4eb57f510a8ee2c9489d.

Tested

  • Windows 11 build 22631.5335, Intel Core i7-10700K, GeForce RTX 3070 8 GB with driver 32.0.16.1742. Rust 1.100.0 MSVC. Both runtime binaries were release builds.
  • cargo test --offline --locked -p xcl --lib hle::d3d12x::real::big_compile_tests::refused_record_hashes_parse -- --exact --show-output passed 1 test on the PR head in debug, with 0 failures and 0 ignored.
  • Both clean commits completed the requested 60 seconds using scripts/smoke.ps1. The trial settings matched, with Direct DXIL enabled, the refusal setting unset, networking off, and separate copies of the same warmed XCL cache. NVIDIA's driver cache was left in place. Both runs shared CPU time with concurrent builds, and this is a smoke check.

Regression run

Main e1d84b7

xcl-smoke v1
commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea
gpu: NVIDIA GeForce RTX 3070
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 388 (PresentX 388)
presents per 2 s (last 3): 25 21 16
device removals: 0
crashes: 0
peak commit: 13744 MB

PR head e4705c1

xcl-smoke v1
commit: e4705c1aef7255c9e59f4eb57f510a8ee2c9489d
gpu: NVIDIA GeForce RTX 3070
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 508 (PresentX 508)
presents per 2 s (last 3): 15 19 3
device removals: 0
crashes: 0
peak commit: 14414 MB

Source review

The refusal check runs after the direct-DXIL dispatch-chain branch. Successful chains return before the check, and building their pieces invokes the driver. A listed record can therefore still reach the driver through the split path. This is a source finding on e4705c1. Refusal and branch order, piece builds

Not tested

The full workspace suite and live XCL_REFUSE_CS=@file behavior remain unverified on this head.

AI use

Yes, Codex GPT-6.2 reviewed the source, ran the PR-head checks, and drafted this report.

@GreemSC

GreemSC commented Nov 25, 2026

Copy link
Copy Markdown
Author

@razormontana Thank you! I'll check it tomorrow (my time).

@DavidM1911

Copy link
Copy Markdown
Contributor

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

@KDenKC

KDenKC commented Nov 26, 2026

Copy link
Copy Markdown

@GreemSC two integration findings for e4705c1, checked against main b49be18.

  1. Check refusal before either whole reuse or splitting. At your head, dispatch_chain::build returns success before the refusal check, so a listed program successfully split by direct DXIL is never refused. On current main, real.rs:4344 computes record, then tries CachedWhole at 4345 and dispatch_chain::build at 4351. Please put the refusal check immediately after record, before both paths; otherwise a warm whole can also reach the driver first. Our local merge resolution uses that placement. Joori reported 389–392 refusals from a 1,004-record list; that count alone does not establish which listed programs were reached.

  2. Read @path before VFS installation, or document the host-path constraint. refused_cs lazily calls read_to_string on first use. Main installs VFS hooks at host.rs:134, before title entry at 154. On our setup, a host D:\... list was remapped and failed with The system cannot find the path specified. (os error 3): no program is refused. Loading the list once at host startup before the hooks avoids this; alternatively document which host paths remain usable after remapping.

Tested

Static control-flow review of the pinned diff and main; inspected our rig's logged @path failure. The rig used a local main merge with the refusal check moved before both paths, not the unmodified PR head. Thanks to Joori for the refusal-count report.

Not tested

No new build, suite or title run for this review; no claim that all 1,004 records should be encountered in one run.

AI use

Codex (GPT-6.1-Sol) checked the code and log and drafted this comment. Claude Code (Claude Opus 5.5) checked the links and the line numbers.

A program whose driver compile never ends takes the process's memory with
it: under vkd3d-proton on RADV, the direct DXIL of record 95cc13288a27a96e
(2.4 MB) started its compile 95-102 s into four retail runs and never
finished while the game's memory grew from 9.8 GB to the 16 GB cap; xcl-dev#1035
is the same shape on the HLSL path. Testers carry local switches for this.

`XCL_REFUSE_CS=HASH[,HASH...]` takes the record hashes that `driver compile
start` logs; `XCL_REFUSE_CS=@path` reads them from a file (commas, spaces or
one per line, `#` comments), for lists of a thousand programs. A listed
program is refused before the driver sees it and takes the existing path of
a refused compute PSO: its dispatches are skipped.

The check comes right after the record hash, before every way a compute
program reaches the driver: a warm whole pipeline, the pieces of a direct
DXIL dispatch chain and the whole build. The `@path` list is read when the
host starts, before the VFS hooks, so a host path on a drive the title's
mounts also name is still found.

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

GreemSC commented Nov 26, 2026

Copy link
Copy Markdown
Author

@KDenKC @razormontana thank you, both points are fixed in 8ed5a0a (rebased on main b49be18, one commit):

  1. Order. The check now comes right after record in translated_compute_pso_once, before the CachedWhole attempt, dispatch_chain::build and the whole build, so a listed program reaches the driver by none of the three.
  2. @path. load_refused_cs() reads the list in host.rs before vfs::init and the VFS hooks; the README says it is read when XCL starts, before the title's mounts apply.

Tested (RX 7900 XT, RADV, Linux, Proton-CachyOS Wine; Windows MSVC test binary under Wine): whole xcl lib suite, --test-threads=4: this head 1244 passed, 65 failed, 27 ignored, 7 SKIPPED; main b49be18 same machine 1243 / 65 / 27 / 7, the same 65 failures on both (Wine environment), the extra pass being refused_record_hashes_parse. The smoke pair on b49be18 / 8ed5a0a under Wine stops at ~2.5 s on both (the known stop of plain main under Wine), so it covers only start-up.

Not tested: Windows on this head. razormontana's RTX 3070 pair was on e4705c1; a rerun on 8ed5a0a would be welcome, and the PR stays a draft until there is one.

AI use: Claude Code (Claude Opus 5.5) made the change, ran the tests and wrote this reply.

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