D3D12.X: report tracked resource and heap counts #1623

Open
github-bot wants to merge 1 commit from github-bot/gh-1623 into main AGit
Owner

@⁠gabrielsteglich on GitHub · 2026-11-24 18:22 UTC · original
gabrielsteglich:feat/d3d12-object-telemetry → main · +195 −1 · 5 files · 1 commits · open

Adds opt-in counts of the D3D12 resources and heaps tracked by XCL. The counts let a startup trace compare object growth with process commit and video memory use. Part of #1333. Issue reservation

What is in it

  • XCL_D3D12_OBJECT_COUNTS=1 adds tracked resources, heaps, and deferred resources to report.json. Resources held until GPU work completes stay in the resource total. With XCL_ACTIVITY=1, the same counts appear next to each memory sample.
  • Unit and native D3D12 tests cover adoption, final release, and a resource held until a blocked queue completes.

Tested

  • Windows 11 Pro build 26300, Core i9-13900K, NVIDIA GeForce RTX 3090 (621.01), Rust 1.97.0 MSVC, and DXC 1.9.2602.17.
  • cargo build --offline --locked --release -p xcl succeeded on both commits. On e7f519f, cargo build --offline --locked --workspace and cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --show-output succeeded in the debug profile. Cargo reported 893 passed, 0 failed, and 42 ignored. Optional sample-data tests were disabled.
  • Five tests reported SKIPPED.
    • gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask and gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware require native wave64.
    • test_title_draws_with_a_root_signature_under_the_debug_layer and uploads_start_from_each_subresources_state require the D3D12 debug layer.
    • heap_window_out_of_memory_falls_back_to_the_switch_form requires heap windows in the test configuration.
  • The native test counted the resource while the queue was blocked and removed it after GPU completion. The candidate startup logged 30 samples and ended with 4,006 tracked resources, 27 tracked heaps, and zero deferred resources.
  • DavidM1911 independently ran cargo test -p xcl --lib on Windows 11 with an RTX 3060 Ti and reported zero failures after locally merging the previous PR revision with main. Independent verification

Regression run

scripts/smoke.ps1 ran the same retail title offline for 60 seconds per build after the rebase, with fresh title profiles and separate XCL DXIL caches. XCL_D3D12_OBJECT_COUNTS=1 was set on both builds. Each build compiled eight shaders during the run.

main

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: NVIDIA GeForce RTX 3090
title: retail
seconds: 60
exit: 0x0
frames shown: 1190 (PresentX 1190)
presents per 2 s (last 3): 36 29 21
device removals: 0
crashes: 0
peak commit: 11489 MB

PR head

xcl-smoke v1
commit: e7f519f15531496ca2ef14f6e27a515301a55dfd
gpu: NVIDIA GeForce RTX 3090
title: retail
seconds: 60
exit: 0x0
frames shown: 1218 (PresentX 1219)
presents per 2 s (last 3): 36 36 36
device removals: 0
crashes: 0
peak commit: 11274 MB

Not tested

  • The loss of the device reported in #1333, gameplay beyond startup, and AMD or Intel GPUs. XCL's counts cover the objects it adopts.

AI use

  • OpenAI's coding agent with GPT-6 assisted with implementation, review, tests, and this description. The local measurements came from the RTX 3090 system listed above.
**@⁠gabrielsteglich** on GitHub · 2026-11-24 18:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/1623) `gabrielsteglich:feat/d3d12-object-telemetry` → `main` · +195 −1 · 5 files · 1 commits · open Adds opt-in counts of the D3D12 resources and heaps tracked by XCL. The counts let a startup trace compare object growth with process commit and video memory use. Part of #1333. [Issue reservation](https://git.gtahub.st/github/xcl-dev--xcl/issues/1333) **What is in it** - `XCL_D3D12_OBJECT_COUNTS=1` adds tracked resources, heaps, and deferred resources to `report.json`. Resources held until GPU work completes stay in the resource total. With `XCL_ACTIVITY=1`, the same counts appear next to each memory sample. - Unit and native D3D12 tests cover adoption, final release, and a resource held until a blocked queue completes. **Tested** - Windows 11 Pro build 26300, Core i9-13900K, NVIDIA GeForce RTX 3090 (621.01), Rust 1.97.0 MSVC, and DXC 1.9.2602.17. - `cargo build --offline --locked --release -p xcl` succeeded on both commits. On `e7f519f`, `cargo build --offline --locked --workspace` and `cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --show-output` succeeded in the debug profile. Cargo reported 893 passed, 0 failed, and 42 ignored. Optional sample-data tests were disabled. - Five tests reported `SKIPPED`. - `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware` require native wave64. - `test_title_draws_with_a_root_signature_under_the_debug_layer` and `uploads_start_from_each_subresources_state` require the D3D12 debug layer. - `heap_window_out_of_memory_falls_back_to_the_switch_form` requires heap windows in the test configuration. - The native test counted the resource while the queue was blocked and removed it after GPU completion. The candidate startup logged 30 samples and ended with 4,006 tracked resources, 27 tracked heaps, and zero deferred resources. - DavidM1911 independently ran `cargo test -p xcl --lib` on Windows 11 with an RTX 3060 Ti and reported zero failures after locally merging the previous PR revision with `main`. [Independent verification](https://git.gtahub.st/github/xcl-dev--xcl/pulls/1623) **Regression run** `scripts/smoke.ps1` ran the same retail title offline for 60 seconds per build after the rebase, with fresh title profiles and separate XCL DXIL caches. `XCL_D3D12_OBJECT_COUNTS=1` was set on both builds. Each build compiled eight shaders during the run. `main` ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: NVIDIA GeForce RTX 3090 title: retail seconds: 60 exit: 0x0 frames shown: 1190 (PresentX 1190) presents per 2 s (last 3): 36 29 21 device removals: 0 crashes: 0 peak commit: 11489 MB ``` PR head ``` xcl-smoke v1 commit: e7f519f15531496ca2ef14f6e27a515301a55dfd gpu: NVIDIA GeForce RTX 3090 title: retail seconds: 60 exit: 0x0 frames shown: 1218 (PresentX 1219) presents per 2 s (last 3): 36 36 36 device removals: 0 crashes: 0 peak commit: 11274 MB ``` **Not tested** - The loss of the device reported in #1333, gameplay beyond startup, and AMD or Intel GPUs. XCL's counts cover the objects it adopts. **AI use** - OpenAI's coding agent with GPT-6 assisted with implementation, review, tests, and this description. The local measurements came from the RTX 3090 system listed above.
Add opt-in snapshots of adopted D3D12 resources and heaps to activity logs and reports so a run can correlate object growth with process commit and video memory. Keep resources in the live count while their last release waits for GPU work.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:59:48 +00:00
Author
Owner

@⁠gabrielsteglich on GitHub · 2026-11-24 19:24 UTC · original

Thanks, @⁠gut0to. I've added the exact names of all five skipped tests to the Tested section. The PR description check passed again.

**@⁠gabrielsteglich** on GitHub · 2026-11-24 19:24 UTC · [original](https://github.com/xcl-dev/xcl/pull/1623#issuecomment-7142042952) Thanks, @⁠gut0to. I've added the exact names of all five skipped tests to the Tested section. The PR description check passed again.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 20:37 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 20:37 UTC · [original](https://github.com/xcl-dev/xcl/pull/1623#issuecomment-7143843349) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~22 ignored. Thanks!
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 05:02 UTC · original

XCL PR #1623 focused verification

Clean detached HEAD e7f519f15531496ca2ef14f6e27a515301a55dfd on STOR-WINLAB. Windows 11 Enterprise Evaluation x64 build 26200, AMD64 family 23 model 113 stepping 0, Intel Arc A770 driver 32.0.101.9175, DXC 1.9.2609.5, rustc 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc). The fixture requests the default D3D12 adapter. The lab probe identified the inbox default device by LUID as the A770 (8086:56A0).

Tested

  • cargo build --workspace and cargo test --workspace --no-run both succeeded outside the Arc mutex with incremental compilation and dev/test debug info disabled.
  • CPU outside the mutex with XCL_ADAPTER=NONE_CPU_ONLY. Ran xcl-77aca8ccb20e299f.exe --exact hle::d3d12x::real::object_count_tests::adopted_objects_stay_counted_through_deferred_release. The test verified resource and heap adoption, deferred resource accounting, and immediate and deferred release paths.
  • GPU via Invoke-ArcTest.ps1 with XCL_ADAPTER=A770 and RUST_TEST_NOCAPTURE=1. Ran d3d12_object_counts-291c762794d784ae.exe --exact tracked_objects_follow_native_release_and_gpu_completion. The fixture created a D3D12 device and verified zero initial counts. It failed at CreateHeap (line 28) with 0x80070057 (The parameter is incorrect), before adoption and queue completion. The failure reproduced and libtest exited 101.
  • Totals parsed from pr1623-focused.log are 1 passed, 1 failed, 0 ignored, 0 SKIPPED. Both commands used the test executables produced by workspace compilation.

Not tested

Scope was full workspace compilation and the two focused tests. The full GPU workspace suite, retail-title smoke, activity log and report.json output were omitted. The failed GPU fixture did not reach the native release and GPU completion assertions.

AI use

T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr1623-focused.log and published.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 05:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/1623#issuecomment-7153389049) # XCL PR #1623 focused verification Clean detached HEAD `e7f519f15531496ca2ef14f6e27a515301a55dfd` on STOR-WINLAB. Windows 11 Enterprise Evaluation x64 build 26200, AMD64 family 23 model 113 stepping 0, Intel Arc A770 driver 32.0.101.9175, DXC 1.9.2609.5, rustc 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc). The fixture requests the default D3D12 adapter. The lab probe identified the inbox default device by LUID as the A770 (8086:56A0). **Tested** - `cargo build --workspace` and `cargo test --workspace --no-run` both succeeded outside the Arc mutex with incremental compilation and dev/test debug info disabled. - CPU outside the mutex with `XCL_ADAPTER=NONE_CPU_ONLY`. Ran `xcl-77aca8ccb20e299f.exe --exact hle::d3d12x::real::object_count_tests::adopted_objects_stay_counted_through_deferred_release`. The test verified resource and heap adoption, deferred resource accounting, and immediate and deferred release paths. - GPU via `Invoke-ArcTest.ps1` with `XCL_ADAPTER=A770` and `RUST_TEST_NOCAPTURE=1`. Ran `d3d12_object_counts-291c762794d784ae.exe --exact tracked_objects_follow_native_release_and_gpu_completion`. The fixture created a D3D12 device and verified zero initial counts. It failed at `CreateHeap` (line 28) with `0x80070057` (The parameter is incorrect), before adoption and queue completion. The failure reproduced and libtest exited 101. - Totals parsed from `pr1623-focused.log` are 1 passed, 1 failed, 0 ignored, 0 SKIPPED. Both commands used the test executables produced by workspace compilation. **Not tested** Scope was full workspace compilation and the two focused tests. The full GPU workspace suite, retail-title smoke, activity log and report.json output were omitted. The failed GPU fixture did not reach the native release and GPU completion assertions. **AI use** T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against `pr1623-focused.log` and published.
Author
Owner

@⁠DarkPanda69 on GitHub · 2026-11-25 13:26 UTC · original · edited 2026-11-25 19:29 UTC

Correction: tracked_objects_follow_native_release_and_gpu_completion (tests/d3d12_object_counts.rs) creates its device with agility::create_device(None, ..), so it runs on DXGI adapter 0, which on this machine is the RX 9070 XT, whatever XCL_ADAPTER says. Both runs of that test below were on the RX 9070 XT: the AMD result stands, but the RTX 3060 line for d3d12_object_counts is not an RTX 3060 result. The per-card gpu:: counts are unaffected.


AMD run (listed as untested), plus an RTX 3060: the new integration test passes on both, and nothing in the GPU suite changes.

Head e7f519f applied on main 1a0bbe3, debug, Windows 11 Pro 26200:

  • RX 9070 XT (RDNA4, driver 32.0.32029.2010):
    • cargo test -p xcl --test d3d12_object_counts: 1 passed, 0 SKIPPED (tracked_objects_follow_native_release_and_gpu_completion ok, so the counts follow native release and GPU completion on the AMD driver too).
    • cargo test -p xcl --lib -- gpu::: 629 passed, 2 failed, 22 ignored, 6 SKIPPED, the same counts as main; the 2 failures are the AMD fuzz seeds tracked in #2115.
  • RTX 3060 (driver 32.0.16.1088): d3d12_object_counts 1 passed; gpu:: 631 passed, 0 failed, 22 ignored.

Not tested: the device loss from #1333, a title, Intel.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

**@⁠DarkPanda69** on GitHub · 2026-11-25 13:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/1623#issuecomment-7163781369) · edited 2026-11-25 19:29 UTC **Correction:** `tracked_objects_follow_native_release_and_gpu_completion` (`tests/d3d12_object_counts.rs`) creates its device with `agility::create_device(None, ..)`, so it runs on DXGI adapter 0, which on this machine is the RX 9070 XT, whatever `XCL_ADAPTER` says. Both runs of that test below were on the RX 9070 XT: the AMD result stands, but the RTX 3060 line for `d3d12_object_counts` is not an RTX 3060 result. The per-card `gpu::` counts are unaffected. --- AMD run (listed as untested), plus an RTX 3060: the new integration test passes on both, and nothing in the GPU suite changes. Head `e7f519f` applied on `main` `1a0bbe3`, debug, Windows 11 Pro 26200: - **RX 9070 XT** (RDNA4, driver 32.0.32029.2010): - `cargo test -p xcl --test d3d12_object_counts`: 1 passed, 0 SKIPPED (`tracked_objects_follow_native_release_and_gpu_completion` ok, so the counts follow native release and GPU completion on the AMD driver too). - `cargo test -p xcl --lib -- gpu::`: 629 passed, 2 failed, 22 ignored, 6 SKIPPED, the same counts as `main`; the 2 failures are the AMD fuzz seeds tracked in #2115. - **RTX 3060** (driver 32.0.16.1088): `d3d12_object_counts` 1 passed; `gpu::` 631 passed, 0 failed, 22 ignored. Not tested: the device loss from #1333, a title, Intel. AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 05:58 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

**@⁠DavidM1911** on GitHub · 2026-11-26 05:58 UTC · [original](https://github.com/xcl-dev/xcl/pull/1623#issuecomment-7183968461) 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
Author
Owner

@⁠gut0to on GitHub · 2026-11-24 18:26 UTC · original · reviewed

The full workspace run and the smoke comparison are useful. One CONTRIBUTING.md detail: it asks for the names of skipped GPU tests on the adapter; this lists five skips only by category/count. Could you include the exact test names for the wave64, debug-layer, and heap-window skips? AI-assisted review; I checked this against the Tested section and project guide.

**@⁠gut0to** on GitHub · 2026-11-24 18:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/1623#pullrequestreview-6045023581) · **reviewed** The full workspace run and the smoke comparison are useful. One CONTRIBUTING.md detail: it asks for the names of skipped GPU tests on the adapter; this lists five skips only by category/count. Could you include the exact test names for the wave64, debug-layer, and heap-window skips? AI-assisted review; I checked this against the Tested section and project guide.
Author
Owner

@⁠bmjask on GitHub · 2026-11-25 21:42 UTC · original · reviewed

No concrete source defect found. Resource/heap adoption/release accounting and deferred lifetime handling are correct; native blocked-queue test plus current CI/smoke are strong. Independent relaxed atomics mean live snapshots can momentarily be internally inconsistent under concurrent release; document as approximate or add concurrent snapshot stress coverage. I found no blocker.

**@⁠bmjask** on GitHub · 2026-11-25 21:42 UTC · [original](https://github.com/xcl-dev/xcl/pull/1623#pullrequestreview-6065370495) · **reviewed** No concrete source defect found. Resource/heap adoption/release accounting and deferred lifetime handling are correct; native blocked-queue test plus current CI/smoke are strong. Independent relaxed atomics mean live snapshots can momentarily be internally inconsistent under concurrent release; document as approximate or add concurrent snapshot stress coverage. I found no blocker.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1623/head:github-bot/gh-1623'
git switch 'github-bot/gh-1623'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1623'
git switch 'github-bot/gh-1623'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1623'
git switch 'github-bot/gh-1623'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1623'
git switch 'main'
git merge --squash 'github-bot/gh-1623'
git switch 'main'
git merge --ff-only 'github-bot/gh-1623'
git switch 'main'
git merge 'github-bot/gh-1623'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.