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

Closed
gabrielsteglich wants to merge 1 commit from upstream-pr/1623 into main
gabrielsteglich commented 2026-11-24 18:22:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gabrielsteglich on 2026-11-24T18:22:38Z.


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.
<!-- greyfinch-sync:ivall/xcl:issue:5477918496 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1623). Originally posted by [gabrielsteglich](https://github.com/gabrielsteglich) on 2026-11-24T18:22:38Z. --- 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://github.com/xcl-dev/xcl/issues/1333#issuecomment-7139623263) **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://github.com/xcl-dev/xcl/pull/1623#issuecomment-7143843349) **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.
gut0to commented 2026-11-24 18:26:34 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gut0to on 2026-11-24T18:26:34Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:ivall/xcl:review:6045023581 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1623#pullrequestreview-6045023581). Originally posted by [gut0to](https://github.com/gut0to) on 2026-11-24T18:26:34Z. **Review:** COMMENTED --- 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.
gabrielsteglich commented 2026-11-24 21:08:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gabrielsteglich on 2026-11-24T19:24:06Z.


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

<!-- greyfinch-sync:ivall/xcl:comment:7142042952 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1623#issuecomment-7142042952). Originally posted by [gabrielsteglich](https://github.com/gabrielsteglich) on 2026-11-24T19:24:06Z. --- Thanks, @gut0to. I've added the exact names of all five skipped tests to the Tested section. The PR description check passed again.
DavidM1911 commented 2026-11-24 21:09:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T20:37:53Z.


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

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

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7143843349 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1623#issuecomment-7143843349). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T20:37:53Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~22 ignored. Thanks!
JJAutoCompare commented 2026-11-25 05:08:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T05:02:09Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7153389049 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1623#issuecomment-7153389049). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-25T05:02:09Z. --- # 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.
DarkPanda69 commented 2026-11-25 14:10:00 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-25T13:26:29Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7163781369 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1623#issuecomment-7163781369). Originally posted by [DarkPanda69](https://github.com/DarkPanda69) on 2026-11-25T13:26:29Z. --- **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.
bmjask commented 2026-11-25 21:42:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-11-25T21:42:05Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:ivall/xcl:review:6065370495 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1623#pullrequestreview-6065370495). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-25T21:42:05Z. **Review:** COMMENTED --- 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.
DavidM1911 commented 2026-11-26 06:06:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T05:58:06Z.


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

<!-- greyfinch-sync:ivall/xcl:comment:7183968461 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1623#issuecomment-7183968461). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T05:58:06Z. --- 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
upipibi commented 2026-11-26 16:06:16 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by upipibi on 2026-11-26T15:26:19Z.


NVIDIA test report for e7f519f: RTX 3070 8 GB (Ampere, driver 616.56), Windows 11 26100, Rust 1.100.0, debug. Head tested as-is on its base 4178e88 (not merged with current main, so the lib count is lower than on newer heads).

  • cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4 (head as-is): 834 passed, 0 failed, 22 ignored; 3 SKIPPED (2 no wave64, 1 pso_measurement_compiles_an_exact_synthetic_record without Developer Mode), none in this PR's files.
  • cargo test -p xcl --test d3d12_object_counts -- --exact tracked_objects_follow_native_release_and_gpu_completion --test-threads=1 --nocapture, 3 runs: 3/3 passed, 0 SKIPPED. DXGI adapter 0, which create_device(None, ..) takes, is the RTX 3070 on this machine. adopted_objects_stay_counted_through_deferred_release, same flags: 3/3 passed.
    Lib tests and the PR's integration test only; no title run.
    AI-assisted (Claude Code, Claude Opus 5.5).
<!-- greyfinch-sync:ivall/xcl:comment:7196266141 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1623#issuecomment-7196266141). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-26T15:26:19Z. --- NVIDIA test report for `e7f519f`: RTX 3070 8 GB (Ampere, driver 616.56), Windows 11 26100, Rust 1.100.0, debug. Head tested as-is on its base `4178e88` (not merged with current `main`, so the lib count is lower than on newer heads). - `cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4` (head as-is): 834 passed, 0 failed, 22 ignored; 3 SKIPPED (2 `no wave64`, 1 `pso_measurement_compiles_an_exact_synthetic_record` without Developer Mode), none in this PR's files. - `cargo test -p xcl --test d3d12_object_counts -- --exact tracked_objects_follow_native_release_and_gpu_completion --test-threads=1 --nocapture`, 3 runs: 3/3 passed, 0 SKIPPED. DXGI adapter 0, which `create_device(None, ..)` takes, is the RTX 3070 on this machine. `adopted_objects_stay_counted_through_deferred_release`, same flags: 3/3 passed. Lib tests and the PR's integration test only; no title run. AI-assisted (Claude Code, Claude Opus 5.5).

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1613
No description provided.