D3D12.X: report debug layer messages by id, and gate new ids in smoke #2039
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!2039
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2039"
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?
@brandostrong on GitHub · 2026-11-25 01:33 UTC · original
brandostrong:d3d12x-debug-layer-report→main· +120 −10 · 4 files · 2 commits · openThe debug layer's messages reach XCL's log, but only the first 8 of each message id are printed: a run that hit one 5 151 times looked like eight hits.
report.jsonnow carriesd3d12.debug_layer– every message counted, by id, with the first text of each id –smoke.ps1 -DebugLayerprintsdebug layer messages: 538x5151 745x5307from it, andpr_check.pyrefuses a PR whose run shows ids main's run did not: new validation errors, which frames and peak commit say nothing about. Ids main's run showed and the PR's no longer shows are a fix, not a problem.Part of the validation line claimed on #1269.
What is in it
crates/xcl/src/hle/d3d12x/real.rs: the per-id counts, already in the callback but a local static nothing could read, become a module static; every message is counted, the first text of each id is kept, and both reachreport.jsonasd3d12.debug_layer.debug_layer_counts_fromturns a map into the report form, so the report test works on its own map and never touches the global one. Two unit tests (counted past the cap, ids in order with the first text cut to 200 characters).scripts/smoke.ps1: a-DebugLayerswitch and thedebug layer messages:line –n/awhen the layer was off,nonewhen there were none. The caller's ownXCL_D3D12_DEBUGis restored after the run, not deleted.scripts/pr_check.py:smoke_idsand the new-id comparison, only between blocks that both report them.scripts/test_pr_check.py: new ids fail; same, fewer,n/aand no line all pass.Tested
1039318:cargo build --workspacethencargo test --workspace -- --test-threads=4: 1156 passed, 0 failed, 46 ignored; 24 GPU tests skipped (20no wave64, 1no heap windows, 3 refused on the #1426 semantics)python scripts/test_pr_check.py: OK, 15 tests;pwsh scripts/smoke-title.tests.ps1:smoke-title: okxcl,XCL_D3D12_DEBUGis set only when-DebugLayeris passed and does not leak after the run; the line renders from a fixturereport.jsonas538x5151,n/aandnonereport.jsonhas the counts and not the texts): 13 273 messages counted against 57 lines in the log – 538×5 151 resource-state errors, 745×5 307GetGPUVirtualAddresson non-buffer resources, 1047×1 618 simultaneous-access hazards across queues, 677×491, 679×252, 680×45, 1422×9. 745 is XCL's own address probe inres_gpu_va_x(it asks the PC method, gets 0, substitutes the title's address), so it is expected in any debug-layer run, on both sides of a pair.Regression run
Both runs have the debug layer on – main's through
XCL_D3D12_DEBUG=1in the environment, because the-DebugLayerswitch is this PR's – so the two sides pay the same cost. Main's block has nodebug layer messages:line, so the new-id comparison is skipped for this pair.maincbc296a:this PR's head
1039318(-DebugLayer):Not tested
n/a, which is why-DebugLayeris a switch and not the default (#1444 is about device creation failing in exactly that case)ID3D12InfoQueuepath for Windows 10 does not feed this counter yet: it needs the samenote_debug_messagecall when that PR lands, or Windows 10 runs will log messages the report does not count-DebugLayerswitch, so this pair exercises only the head side (the tests cover same / fewer /n/a/ no line)AI use
debug_layer_counts_from, restoring the caller'sXCL_D3D12_DEBUG), the rebase ontocbc296a, the suite rerun and both regression runs.🤖 Generated with Claude Code
@raylitebull on GitHub · 2026-11-25 01:43 UTC · original
Code review on
60f8fc5:DEBUG_MSGS(BTreeMap<i32, (u32, String)>) while keepingDEBUG_MSG_LOG_LIMIT = 8on log output, exposingD3d12Stats.debug_layer, and gating newly introduced IDs inscripts/pr_check.py/scripts/smoke.ps1 -DebugLayeris very clean and practical.debug_layer_report_tests::the_report_lists_ids_in_order_with_full_counts(crates/xcl/src/hle/d3d12x/real.rs) mutates the process-globalDEBUG_MSGSstatic and asserts exact contents (vec![(541, 1), (725, 3)]). If another GPU test runs concurrently in the same binary withXCL_D3D12_DEBUG=1(e.g.,--test-threads=4), real debug-layer callbacks can race intoDEBUG_MSGSand break that assertion. Extracting adebug_layer_counts_from(msgs: &BTreeMap<...>)helper lets the test stay isolated.scripts/smoke.ps1,if ($DebugLayer) { Remove-Item Env:XCL_D3D12_DEBUG }unconditionally deletesEnv:XCL_D3D12_DEBUGeven if the calling shell had it set beforehand (similar to#521).Build and test (Windows, no GPU)is green.Remaining before merge: Addressing
PR description(and the global-state test isolation note above) plus AMD and NVIDIA verification on the updated head.@DavidM1911 on GitHub · 2026-11-25 04:28 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!
@brandostrong on GitHub · 2026-11-25 09:54 UTC · original
Both notes are addressed at the current head
1039318f(the review was on60f8fc5):the_report_lists_ids_in_order_with_full_countsno longer touches the global: it fills a localBTreeMapand asserts through the extracteddebug_layer_counts_from(&msgs)(crates/xcl/src/hle/d3d12x/real.rs:176for the helper,:7220for the test), with a comment naming the race you spotted — a concurrent GPU test withXCL_D3D12_DEBUG=1feeds the global map.counts_every_message_and_caps_only_the_printingwas already local-map only.scripts/smoke.ps1now saves the caller's value first (:57) and restores it after the run (:70-72): with-DebugLayerit sets1for the child and puts back what the shell had, removing the variable only if the shell had none.Tested on the current head:
cargo test --release --offline --workspace -- --test-threads=4on an RTX 4090 — 1155 passed, 0 failed, 46 ignored, 23SKIPPED(no wave64and the direct path's refused f16 / f32 forms). AMD and a second NVIDIA card are still the gap, as you say.AI use: Claude Code (Claude Opus 5.5) wrote this reply.
@RavenCurseBurg on GitHub · 2026-11-25 21:07 UTC · original · edited 2026-11-26 09:06 UTC
Tested on
1039318fce8565e8298b5fea211f23f524a59bf1, Windows 11 build 26100.9711, Core i7-13700, Windows PowerShell 5.1 and PowerShell 7.6.9.I ran
scripts/smoke.ps1 -Game fixture -Title fixture -Seconds 1with and without-DebugLayer. A small executable recorded the inherited setting on a successful launch. Passing an existing directory as-Xclexercised a realProcess.Starterror. I tested three initial caller states: absent,0andoriginal.On the PR head, each failed start with
-DebugLayerleftXCL_D3D12_DEBUG=1in the calling shell (3 of 12 cases on each edition). The script-only fix and regression test restore the setting infinallyaroundStart(). All 24 cases then preserved the caller's value. Successful children still received1with the switch and their original value without it.In both shells,
-NoProfile -ExecutionPolicy Bypass -File scripts/smoke-debug-layer.tests.ps1failed on the head and passed on the candidate. Both shells also passedscripts/smoke-title.tests.ps1; Python script discovery passed 27/27.Not tested — An actual debug-layer or game launch, the Rust workspace, or a caller with a native present-but-empty variable. OpenAI Codex (GPT-6) wrote and ran the fixtures, implemented the fix, and prepared this report.
Rebase onto current main
The two-commit rebased branch descends directly from
b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7. The original Rust conflict arose where two sets of test modules had been added at the end ofreal.rs. I verified byte-for-byte that the rebased file contains main's modules, the original PR's debug test module, and the same six non-test diff hunks. The script commit carries forward main's batch-launch and-OutDirhandling alongside-DebugLayer, using the child-only settings from #2714.git merge-tree --write-treeagainst that main returned the candidate's own tree.All 27 Python script tests passed. The artifact, debug-layer and title fixtures each passed in both shells. Thirty additional debug-on/off cases on the rebased script covered success, failed process start and missing log output. The caller kept its values; a successful debug-enabled fixture also reported the expected synthetic message ID and count. I supplied a mock adapter for fixture fallback. The Rust crate and its Rust tests were not compiled or run here. An actual debug-layer/title run and upstream CI remain outstanding. OpenAI Codex (GPT-6) prepared the rebase and ran the Windows script checks.
@DavidM1911 on GitHub · 2026-11-26 07:05 UTC · original
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.github-bot referenced this pull request2026-11-26 08:47:35 +00:00
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.