D3D12.X: XCL_REFUSE_CS leaves listed compute programs out of the driver #2527
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!2527
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2527"
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?
@GreemSC on GitHub · 2026-11-25 21:41 UTC · original
GreemSC:refuse-cs→main· +82 −1 · 3 files · 1 commits · openA switch to leave listed compute programs out of the driver:
XCL_REFUSE_CS=HASH[,HASH…], with the record hashes thatdriver compile start … record HASHlogs, orXCL_REFUSE_CS=@pathto read them from a file (commas, spaces or one per line,#comments, a leading UTF-8 byte order mark skipped; 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 ind3d12core.dllat 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 (anXCL_REFUSE_CSof 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@pathfile, read once; an unreadable file is logged and refuses nothing); the check right after the record hash intranslated_compute_pso_once, before theCachedWholeattempt,dispatch_chain::buildand the whole build;load_refused_cs; a unit test of the parsing (list and file forms, a file with a UTF-8 BOM: luckyteagirl's review; it fails without the BOM skip).crates/xcl/src/host.rs:load_refused_cs()beforevfs::initand the VFS hooks, so an@pathon 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
cargo test --release -p xcl --lib --target x86_64-pc-windows-msvc --no-run), run under Wine with DXC 1.9.2609.--test-threads=4, skippingreset_dxgi_device_manager_with_d3d12_device_and_token_validation(it callsDXGID3D10CreateDevice, which Wine does not implement, and aborts the process): this head22578b31244 passed, 65 failed, 27 ignored, 7 SKIPPED;mainb49be18on the same machine: 1243 passed, 65 failed, 27 ignored, 7 SKIPPED. 64 of the 65 failures are the same tests on both (Wine / vkd3d-proton environment); the other differs (gpu_qsad_and_mqsadhere,gpu_sdwa_f16_inline_constantsonmain), and both pass run alone. The one more pass isrefused_record_hashes_parse.cargo test --workspace --release --no-fail-fast -- --test-threads=4: 1436 passed, 0 failed, 47 ignored; 29 SKIPPED (21 no wave64, 3 per-lane form refused, 3 no debug layer, 1 no heap windows, 1 driver cache). WithXCL_REFUSE_CS=@list(the 1,000CS_RaytracingResolverecords, a#comment line first),XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1, 900 s: 320 distinct listed records refused, no logged driver compile of a listed one, no device removal (two same-dayb49be18runs with the same switches and no list sent 181 / 183 listed records to the driver and lost the device at 211 / 216 s; different commits, so this does not show that the list keeps the device).e4705c1;cargo test -p xcl --liball passed on an RTX 3060 Ti by DavidM1911; jennydeth (RTX 3060) with the check moved to where this head has it: 280–289 listed records refused, none reached the driver, two 900 s runs kept the device; NWProgramming00 (RTX 5070 Ti) with the same placement on an oldermain:XCL_REFUSE_CS=95cc13288a27a96etakes the title past world entry, where every run without it hung the GPU.compute_container) on our Linux tree (main68a284a+ #1732, #684, #1860, #2097, #2404),XCL_REFUSE_CS=95cc13288a27a96e:compute PSO of record 95cc13288a27a96e (2420644 B DXIL) refused by XCL_REFUSE_CSat 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
Windows, RTX 3060 12 GB, run by @jennydeth on this head (her comment; retail title,
scripts/smoke.ps1, default settings, no list, 600 s):93 % of
main's frames, 101 % of its peak commit, no removal and no crash. With no list set these runs cover start-up withload_refused_cs()and the default path, not the refusal; neither reaches the world (presents stop at 108.5 s onmain, 100.4 s here, while big compute programs compile). On Linux under Wine the same pair stops at ~2.5 s on both commits (plainmainwithout the Wine stack), so it covers only start-up there.Not tested
b49be18); a regression run that gets past start-up on Linux; the BOM case in a run (the parser test covers it).translated_compute_pso_once.AI use
@DavidM1911 on GitHub · 2026-11-25 21:54 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. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@GreemSC on GitHub · 2026-11-25 21:56 UTC · original
@DavidM1911 thanks. The one piece this draft still lacks is a regression run that gets past start-up: under Wine, plain
mainstops at 2.5 s here (without #871), so both of myxcl-smokeblocks end there. If you have the retail title on that machine, the two blocks fromscripts/smoke.ps1on6d12f58(main) and64be563(this head), same title and seconds, would be what it needs.AI use: Claude Code (Claude Opus 5.5) wrote this reply.
@SlopTart on GitHub · 2026-11-25 23:07 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): 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 theXCL_REFUSE_CSparsing 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 on GitHub · 2026-11-25 23:10 UTC · original
I ran the requested native Windows smoke pair and a focused parser test on exact head
e4705c1aef7255c9e59f4eb57f510a8ee2c9489d.Tested
cargo test --offline --locked -p xcl --lib hle::d3d12x::real::big_compile_tests::refused_record_hashes_parse -- --exact --show-outputpassed 1 test on the PR head in debug, with 0 failures and 0 ignored.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
e1d84b7PR head
e4705c1Source 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 buildsNot tested
The full workspace suite and live
XCL_REFUSE_CS=@filebehavior 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 on GitHub · 2026-11-25 23:17 UTC · original
@razormontana Thank you! I'll check it tomorrow (my time).
@DavidM1911 on GitHub · 2026-11-26 01:36 UTC · original
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 on GitHub · 2026-11-26 03:41 UTC · original
@GreemSC two integration findings for
e4705c1aef, checked against mainb49be18.Check refusal before either whole reuse or splitting. At your head,
dispatch_chain::buildreturns success before the refusal check, so a listed program successfully split by direct DXIL is never refused. On current main,real.rs:4344computesrecord, then triesCachedWholeat 4345 anddispatch_chain::buildat 4351. Please put the refusal check immediately afterrecord, 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.Read
@pathbefore VFS installation, or document the host-path constraint.refused_cslazily callsread_to_stringon first use. Main installs VFS hooks athost.rs:134, before title entry at 154. On our setup, a hostD:\...list was remapped and failed withThe 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
@pathfailure. 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.
e4705c1aefto8ed5a0a8bf@GreemSC on GitHub · 2026-11-26 06:29 UTC · original
@KDenKC @razormontana thank you, both points are fixed in
8ed5a0a(rebased onmainb49be18, one commit):recordintranslated_compute_pso_once, before theCachedWholeattempt,dispatch_chain::buildand the whole build, so a listed program reaches the driver by none of the three.@path.load_refused_cs()reads the list inhost.rsbeforevfs::initand 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
xcllib suite,--test-threads=4: this head 1244 passed, 65 failed, 27 ignored, 7 SKIPPED;mainb49be18same machine 1243 / 65 / 27 / 7, the same 65 failures on both (Wine environment), the extra pass beingrefused_record_hashes_parse. The smoke pair onb49be18/8ed5a0aunder Wine stops at ~2.5 s on both (the known stop of plainmainunder Wine), so it covers only start-up.Not tested: Windows on this head. razormontana's RTX 3070 pair was on
e4705c1; a rerun on8ed5a0awould 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.
@jennydeth on GitHub · 2026-11-26 08:26 UTC · original
@KDenKC, a run-time confirmation of your point 1 (7181939073) on
e4705c1, from an RTX 3060 12 GB. @GreemSC,8ed5a0anow puts the check where my moved check was, and beforeCachedWholetoo; I have not run8ed5a0aitself. WithXCL_DIRECT_DXIL=1and the 1,000CS_RaytracingResolverecords listed:e4705c1: 50 records were refused, and 141 logged builds of listed records still went to the driver, just before a silent removal.@path: the list file was read without trouble in these runs.Setup
scripts/smoke.ps1 -Game <folder> -Seconds 900(XCL_NETWORK=0), the same scripted pad presses into the story load in every run,XCL_FRAME_DUMP=300.XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_DRED=1 XCL_REFUSE_CS=@list.xcl rpf shaders.rpf --extract CS_RaytracingResolve, 1,004 records, 1,000 distinctfnv64hashes.--precompile --only cs --pipelinesonmain08db802, plus earlier runs. With the moved check, the title reached 26 and 34 programs with no driver blob, none on the list and none over 8 s.e4705c1merged onto #2404 (809da30) + #2519 (50af98e), merged intomain08db802. That stack is what #2404 and #2519 were tested on.refused_cs(record)block added just beforeif let Some(plan) = compiled.dispatch_chain. The old check below it was left in place.CachedWholepath, so these runs do not test the check before it.e4705c1, run 1e4705c1, run 2compute split)0x887a0005at 102.6 s0x887a0005at 96.3 s0x00x0e4705c1: these two runs end like the other 11 warm direct-DXIL runs on this card with no list. All of those lost the device, most within 2–10 s of the last present. The 8 withXCL_DRED=1logged onlyDRED page fault at GPU VA 0x0; allocations there: []; recently freed: []. The runs are on #2403.frame dump copy: GPU fence still pending after 2000 ms.0xc0000005, a read fault in the system'sVCRUNTIME140.dll, on a thread whose stack shows onlyxcl.exeframes. That is one run of three, so I don't put it on the change.Not tested:
8ed5a0a(its placement beforeCachedWholeon currentmain);e4705c1on its own (without #2404 / #2519); the HLSL path (no split programs there, so the existing check already applies); AMD.AI use: Claude Code (Claude Opus 5.5) built the trees, made the local change, ran the runs on my machine, read the logs and wrote this.
@luckyteagirl on GitHub · 2026-11-26 08:44 UTC · original · reviewed
At exact head
8ed5a0aon current mainb49be18, a UTF-8 BOM in the newXCL_REFUSE_CS=@pathfile silently drops its first hash. This is a source-derived review; I did not run a title with a BOM-marked list.read_to_string(path)passes the leading U+FEFF through torecord_hashes. That parser splits on commas or Unicode whitespace, then parses each token as hex; U+FEFF is neither a delimiter nor a hex digit. For example, a file with bytesEF BB BFfollowed by95cc13288a27a96e\r\nyields no hashes. With a one-entry list, the documented refusal therefore does nothing; with a longer list, the first entry is lost unless a header/comment happens to absorb the BOM.Could the
@pathloader strip one leading U+FEFF before parsing? A BOM plus one valid hash in the parser/file fixture would cover the fail-open case.AI assistance: GPT-6.2 Sol found the input path; GPT-6.2 Astra checked the exact-head parser and drafted this review.
@NWProgramming00 on GitHub · 2026-11-26 08:49 UTC · original
A Windows + NVIDIA data point for this switch. With
XCL_REFUSE_CS=95cc13288a27a96e, the retail title of #505 gets past world entry on an RTX 5070 Ti. Without the switch, every run on warm caches ends in a GPU hang right after world entry.Setup
XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_DRED=1, A pressed byXCL_PRESS_A_AT.xcl shaders --precompile --only cs --pipelines. Graphics pipelines were warmed by earlier runs.maine44af70with this PR's commit cherry-picked on top. My base has noec80c07, so there was one conflict intranslated_compute_pso_once. I keptrefused_csright after the record hash, beforedispatch_chain::buildand the whole build. That is the same place as in the PR, but without theCachedWholeattempt my base does not have. I did not run this PR's own head (8ed5a0aonb49be18): its newer translator would have made all my driver caches cold.Without the switch (
maine44af70with local diagnostics only, two runs on warm caches):D3D12 device removed: 0x887a0006(hung, not a page fault). In the first run it came 2 s after the title resumed submitting in the world. In the second, it came 0.8 s after the first#101call.>6, 82 of 329 operations done), and the pipeline bound there wascs 95cc13288a27a96e. On this card that program is 1,218,248 B of DXIL, loaded from the driver's blob, with split wave64. DRED recorded no page fault.With
XCL_REFUSE_CS=95cc13288a27a96e(same tree, same caches, 420 s):#101at 352 s. The title then keeps rendering until the run's 420 s limit: 3–8 presents, 1,650–3,150 draws and 7,400–11,000 dispatches per 2 s, DirectStorage 280–820 requests per 2 s with 0 failed, and no frame-event wait timed out.What this does and does not show
95cc13288a27a96eis what hangs the GPU at world entry, and leaving it out lets the title run in the world for at least 68 s.xcl_budget(65,536). Its outer loops span almost the whole program, though, so one loop that does not exit as on the console could take far longer than the 2 s TDR. That is an inference, not measured. A native wave64 run (no split) would tell whether split wave64 is involved; I have not run one yet.@pathform, AMD, a smoke pair.AI use: Claude Code (Claude Opus 5.5) ran the builds and runs on my machine, read the logs and wrote this comment. Logs stay local.
8ed5a0a8bfto22578b3568@GreemSC on GitHub · 2026-11-26 08:53 UTC · original
New head
22578b3(one commit, still onmainb49be18):record_hashesskips a leading U+FEFF, and the parser test has your case (BOM + valid hashes). Without the skip the test fails with the first hash missing (left: [0x2e0055c25f49848a],right: [0x95cc13288a27a96e, 0x2e0055c25f49848a]); with it, it passes.8ed5a0a/22578b3put it (and beforeCachedWhole), so they back this placement. @NWProgramming00 thank you too: the same placement on an RTX 5070 Ti, past world entry with95cc13288a27a96erefused. I've put both in the description, as tests of other trees.Tested (RX 7900 XT, RADV, Linux, Proton-CachyOS Wine; Windows MSVC test binary under Wine): whole
xcllib suite,--test-threads=4: this head 1244 passed / 65 failed / 27 ignored / 7 SKIPPED,mainb49be181243 / 65 / 27 / 7; 64 of the failures are the same on both, the other one differs (gpu_qsad_and_mqsadhere,gpu_sdwa_f16_inline_constantsonmain) and both pass alone. Smoke under Wine: same ~2.5 s stop as plainmain(start-up only).One thing still missing before this can leave draft: a Windows
scripts/smoke.ps1pair (a commit ofmainand22578b3, same title, same time). @jennydeth or @luckyteagirl, if either of you can run it on your Windows machine, that would settle it; one pair from one of you is enough.AI use: Claude Code (Claude Opus 5.5) made the fix, ran the tests and wrote this reply.
@jennydeth on GitHub · 2026-11-26 10:45 UTC · original
@GreemSC, the Windows pair for
22578b3, from an RTX 3060 12 GB. Both runs used default settings, noXCL_REFUSE_CS, 600 s.Regression run
mainb49be18:This PR,
22578b3:main's 2,200 (93 %) and peak commit of 35,043 MB against 34,639 MB (101 %), with no removal and no crash in either.mainand at 100.4 s with this PR, while big compute programs are still compiling.load_refused_cs()and the default path. They do not cover the refusal.xcl-noprofile.exe. This machine has #2590's 1 GiB shader-heap profile onxcl.exe; a copy under another name does not match it.With the list (
22578b3,XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_DRED=1 XCL_REFUSE_CS=@list, the 1,000CS_RaytracingResolverecords fromxcl rpf shaders.rpf --extract CS_RaytracingResolve, warm caches, 900 s, also asxcl-noprofile.exe):is not built (XCL_REFUSE_CS), first at 6.4 s, last at 377.0 s), and no logged driver compile (≥ 256 KiB) was of a listed record. In the two same-dayb49be18runs below, with the same switches and no list, 181 and 183 distinct listed records went to the driver. On thee4705c1stack my moved check gave the same pattern (280 and 289 refused, none built);e4705c1as it was refused 50, and 141 logged builds of listed records went to the driver.compute splitat 804.8 s); the two same-dayb49be18runs with no list split 291 each, and the moved-check runs on thee4705c1stack 50 and 51.#comment line and was read without trouble.0x80000003ingame_scarlett_master.exe+0x63966f, three threads, 720.4 s), and the process ended at 804.8 s.b49be18runs with the same switches and no list, also asxcl-noprofile.exe, lost the device at 211.2 and 216.0 s (#2403). Two runs against one, on different commits, and the title still runs at well under 1 fps after ~110 s, so this does not show that the list is what keeps the device.Tested
stable-x86_64-pc-windows-msvc); release; DXC 1.9.2609.5.cargo test --workspace --release --no-fail-fast -- --test-threads=4on22578b3: 1436 passed, 0 failed, 47 ignored (37 test targets incl. doc-tests). SKIPPED (29): 21 × no wave64; 3 × per-lane form refused (V_MUL_F16,V_PK_MUL_F16,V_CVT_F16_F32); 3 × no D3D12 debug layer /d3d12SDKLayers.dll; 1 × no heap windows; 1 ×pso_measurement_compiles_an_exact_synthetic_record(cannot disable the driver cache).scripts/smoke.ps1 -Game <folder>(XCL_NETWORK=0), the same scripted pad presses into the story load in every run;XCL_FRAME_DUMP=300in the pair,100in the list run.Not tested:
22578b3with direct DXIL and no list (the controls areb49be18); the heap in effect in each run (not read); AMD / wave64; the BOM case in a run (the parser test covers it).AI use: Claude Code (Claude Opus 5.5) built the commits, ran the suite and the runs on my machine, read the logs and wrote this.
@GreemSC on GitHub · 2026-11-26 10:49 UTC · original
@jennydeth thank you, that is exactly what was missing. I've put your pair under Regression run (credited and linked) and your suite counts and list run under Tested, and I'm marking the PR ready for review.
AI use: Claude Code (Claude Opus 5.5).
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.