D3D12.X: coordinate view texture creation by cache key #2802

Closed
CryingLaughing wants to merge 2 commits from upstream-pr/2812 into main
CryingLaughing commented 2026-11-26 14:07:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by CryingLaughing on 2026-11-26T14:07:41Z.


Stacked on #2762. Part of #2743.

The view-resource cache now shares one pending placement per normalized address and description. Concurrent callers for that key receive the completed resource. Lookups for other keys can proceed during creation.

What is in it

  • Adds a pending entry for creation. Once the resource is published, the entry holds only the completed result. Zero remains a cached result, and the completed entry count still includes failures.
  • Checks shared pending creation, independent keys, cached zero and publication with a bounded CPU fixture.

Tested

  • Head ab169f5396bda3df5a48497e668f49a99192e892, based on #2762 head 496ef5780a4549fc3f15bc65340deb1db4794d6b. RTX 4080 driver 621.01, i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 x64 MSVC, DXC 1.8.2502.11.
  • The focused cache test passed 1/0/0. The separate native sequential resource identity check passed 1/0/0 with zero capability skips and reused the exact and padding-only requests.
  • cargo build --workspace --locked -j 4 and cargo test --workspace --locked -j 4 -- --test-threads=4 --show-output passed 1,437 passed, 0 failed, 47 ignored across 37 harnesses, including 29 capability skips.

Regression run

Independent retail smoke by Anon64 compared release builds of main and this exact head on an RTX 3060 12 GB (driver 581.80), Core i9-14900KF, and Windows 11 build 26200. The 60-second runs used the same title. The head retained 103.0% of the baseline frames and used 104.6% of its peak commit, with zero crashes or device removals. The run did not establish whether the title reached the changed code.

main:

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1461 (PresentX 1462)
presents per 2 s (last 3): 10 1 1
device removals: 0
crashes: 0
peak commit: 23855 MB

PR:

xcl-smoke v1
commit: ab169f5396bda3df5a48497e668f49a99192e892
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1505 (PresentX 1506)
presents per 2 s (last 3): 8 20 12
device removals: 0
crashes: 0
peak commit: 24952 MB

Not tested

  • Concurrent native allocations and the effect on title memory use.
<!-- greyfinch-sync:ivall/xcl:issue:5511507439 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2812). Originally posted by [CryingLaughing](https://github.com/CryingLaughing) on 2026-11-26T14:07:41Z. --- Stacked on #2762. Part of #2743. The view-resource cache now shares one pending placement per normalized address and description. Concurrent callers for that key receive the completed resource. Lookups for other keys can proceed during creation. **What is in it** - Adds a pending entry for creation. Once the resource is published, the entry holds only the completed result. Zero remains a cached result, and the completed entry count still includes failures. - Checks shared pending creation, independent keys, cached zero and publication with a bounded CPU fixture. **Tested** - Head `ab169f5396bda3df5a48497e668f49a99192e892`, based on #2762 head `496ef5780a4549fc3f15bc65340deb1db4794d6b`. RTX 4080 driver 621.01, i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 x64 MSVC, DXC 1.8.2502.11. - The focused cache test passed **1/0/0**. The separate native sequential resource identity check passed **1/0/0** with zero capability skips and reused the exact and padding-only requests. - `cargo build --workspace --locked -j 4` and `cargo test --workspace --locked -j 4 -- --test-threads=4 --show-output` passed **1,437 passed, 0 failed, 47 ignored** across 37 harnesses, including 29 capability skips. **Regression run** [Independent retail smoke by Anon64](https://github.com/xcl-dev/xcl/pull/2812#issuecomment-7195250182) compared release builds of main and this exact head on an RTX 3060 12 GB (driver 581.80), Core i9-14900KF, and Windows 11 build 26200. The 60-second runs used the same title. The head retained 103.0% of the baseline frames and used 104.6% of its peak commit, with zero crashes or device removals. The run did not establish whether the title reached the changed code. main: ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1461 (PresentX 1462) presents per 2 s (last 3): 10 1 1 device removals: 0 crashes: 0 peak commit: 23855 MB ``` PR: ``` xcl-smoke v1 commit: ab169f5396bda3df5a48497e668f49a99192e892 gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1505 (PresentX 1506) presents per 2 s (last 3): 8 20 12 device removals: 0 crashes: 0 peak commit: 24952 MB ``` **Not tested** - Concurrent native allocations and the effect on title memory use.
Anon64 commented 2026-11-26 15:03:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-26T14:44:16Z.


Regression run of ab169f5 on a newer retail title: no device removal, no crash, frames and commit within the limits.

Setup: RTX 3060 12 GB (NVIDIA 581.80), i9-14900KF, Windows 11 26200, release builds of main b49be18 (this PR's base) and of this PR's exact head, scripts/smoke.ps1 -Game <title> for 60 s with XCL_NETWORK=0 and A pressed every 4 s from 20 s. Main ran before and after a batch of 11 PRs and peaked at 23,855 and 23,844 MB, so the baseline held steady over the batch.

main:

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1461 (PresentX 1462)
presents per 2 s (last 3): 10 1 1
device removals: 0
crashes: 0
peak commit: 23855 MB

this PR:

xcl-smoke v1
commit: ab169f5396bda3df5a48497e668f49a99192e892
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1505 (PresentX 1506)
presents per 2 s (last 3): 8 20 12
device removals: 0
crashes: 0
peak commit: 24952 MB

103 % of main's frames, 104 % of its peak commit. One run each.

Not tested: the suite on this head; whether the title reaches the code this PR changes in its first 60 s; AMD.

AI use: Claude Code (Claude Opus 5.5) ran these runs on this machine and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7195250182 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2812#issuecomment-7195250182). Originally posted by [Anon64](https://github.com/Anon64) on 2026-11-26T14:44:16Z. --- **Regression run of `ab169f5` on a newer retail title: no device removal, no crash, frames and commit within the limits.** **Setup:** RTX 3060 12 GB (NVIDIA 581.80), i9-14900KF, Windows 11 26200, release builds of main `b49be18` (this PR's base) and of this PR's exact head, `scripts/smoke.ps1 -Game <title>` for 60 s with `XCL_NETWORK=0` and A pressed every 4 s from 20 s. Main ran before and after a batch of 11 PRs and peaked at 23,855 and 23,844 MB, so the baseline held steady over the batch. main: ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1461 (PresentX 1462) presents per 2 s (last 3): 10 1 1 device removals: 0 crashes: 0 peak commit: 23855 MB ``` this PR: ``` xcl-smoke v1 commit: ab169f5396bda3df5a48497e668f49a99192e892 gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1505 (PresentX 1506) presents per 2 s (last 3): 8 20 12 device removals: 0 crashes: 0 peak commit: 24952 MB ``` 103 % of main's frames, 104 % of its peak commit. One run each. **Not tested:** the suite on this head; whether the title reaches the code this PR changes in its first 60 s; AMD. AI use: Claude Code (Claude Opus 5.5) ran these runs on this machine and wrote this report.
SzczepanGrela commented 2026-11-26 17:32:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SzczepanGrela on 2026-11-26T17:32:43Z.


RX 9070 / Wine concurrent native resource_at check of ab169f5396bda3df5a48497e668f49a99192e892: eight same-key callers share one creation on head and on its current-main integration. Current main creates eight distinct resource objects under the same controlled overlap.

Tested

Compared exact head, current main 8b957bec6f82495aec940944c6bf47faa02db590, and current main with this PR's full diff applied. Head is stacked on #2762 commit 496ef5780a4549fc3f15bc65340deb1db4794d6b; the PR's upstream base is b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7. The integration applied without conflicts; additions/deletions and surrounding diff context matched independently. The padding result below includes the parent change; this was not a runtime comparison against the direct parent.

RX 9070 16 GB, PCI 1002:7550, RADV GFX1201 / Mesa 26.3.1-arch3.5 (mesa / vulkan-radeon packages 3:26.3.1-5), Ryzen 7 7700, CachyOS 7.3.0-5-cachyos, GE-Proton11-12 Wine 11.0 Staging with ntsync. Native d3d12/d3d12core/dxgi, vkd3d-proton 8293130ebe370b1+ with local assertions-disabled build, Rust 1.97.1, release x86_64-pc-windows-gnu.

Source copies received reversible cfg(test) observation immediately before/after the existing native creation call and a local fixture. The actual create_placed_resource_x call, arguments and cache decisions were retained; the factory was not substituted. Removing test additions reconstructs every original source hash. These were instrumented source copies, not clean Git checkouts.

cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run
wine <libtest.exe> hle::d3d12x::real::view_key_tests:: hle::d3d12x::real::srv_tests:: --nocapture --test-threads=N
wine <libtest.exe> hle::d3d12x::real::workflow_view_cache_probe::concurrent_native_views_share_creation --exact --nocapture --test-threads=1

XCL_NETWORK=0, XCL_ADAPTER="AMD Radeon RX 9070", XCL_REQUIRE_GPU=wave64, native DLL overrides, private enabled caches. Native probes ran with XCL_VRAM_ARENAS unset and with XCL_VRAM_ARENAS=1, three fresh processes per source/configuration, alternating source order.

  • Original cache/SRV selections at N=1 and N=4: exact head and integrated head each 4 passed / 0 failed / 0 ignored per invocation; current main 2/0/0. Main has no new view_key_tests module. The head module includes the cached-zero/independent-key CPU check.
  • Native fixture: exact head and integrated head each 1/0/0 per invocation. Main 0/1/0, failing one creation per normalized key after all native creation, identity and descriptor checks completed.

The native fixture uses small RGBA8 render targets, with a 192 KiB owned synthetic address range. It holds creation for the first address until all eight callers are observed: eight caller references to the pending entry on head, eight factory entrants on main. A different address completes while that first creation remains held. After release, every head caller receives the same pointer; main returns eight distinct pointers. An exact repeat uses a previously returned pointer on all three source variants.

Per-process outcomes were identical in every repetition and both placement configurations:

Observation current main exact head / integrated head
Native creator entries for the eight overlapping same-key requests 8 1
Distinct returned objects for those requests 8 1
Different-key completion before release yes yes
New creation for padding-only repeat 1 0
New creation for width 16 to 32 1 1
Total native creations, including the different address 11 3
Completed-entry counter at end unavailable 3

Across 24 harness invocations: 0 ignored, 0 capability skips. The 18 native probes created 102 real resources. Independently checked saved pointer sets, creation counts, joins and native descriptors; each resource's device matched the selected RX 9070 LUID. Default placement mapped one tile per resource; arena mode had no page mappings. Shared page/heap backing means these object counts do not establish VRAM savings. Creation references and synthetic address identities remain valid until process exit, matching the cache's lifetime.

Not tested

Texture drawing, shader dispatch or pixel readback, native driver failures during concurrent creation, other formats or multiple devices, long-running cache lifetime, whole workspace suite, native Windows, other adapters, retail data, scripts/smoke.ps1, FPS, allocation latency or measured RAM/VRAM reduction.

AI use

OpenAI Codex (GPT-6; exact serving variant not exposed) audited the diff, wrote local test-only observations/fixture, ran all source variants, independently verified raw logs/source/executable hashes, and drafted this report. Publication authorized by the account owner.

<!-- greyfinch-sync:ivall/xcl:comment:7199201829 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2812#issuecomment-7199201829). Originally posted by [SzczepanGrela](https://github.com/SzczepanGrela) on 2026-11-26T17:32:43Z. --- RX 9070 / Wine concurrent native `resource_at` check of `ab169f5396bda3df5a48497e668f49a99192e892`: eight same-key callers share one creation on head and on its current-main integration. Current main creates eight distinct resource objects under the same controlled overlap. **Tested** Compared exact head, current main `8b957bec6f82495aec940944c6bf47faa02db590`, and current main with this PR's full diff applied. Head is stacked on #2762 commit `496ef5780a4549fc3f15bc65340deb1db4794d6b`; the PR's upstream base is `b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7`. The integration applied without conflicts; additions/deletions and surrounding diff context matched independently. The padding result below includes the parent change; this was not a runtime comparison against the direct parent. RX 9070 16 GB, PCI `1002:7550`, RADV GFX1201 / Mesa `26.3.1-arch3.5` (`mesa` / `vulkan-radeon` packages `3:26.3.1-5`), Ryzen 7 7700, CachyOS `7.3.0-5-cachyos`, GE-Proton11-12 Wine 11.0 Staging with ntsync. Native d3d12/d3d12core/dxgi, vkd3d-proton `8293130ebe370b1+` with local assertions-disabled build, Rust `1.97.1`, release `x86_64-pc-windows-gnu`. Source copies received reversible `cfg(test)` observation immediately before/after the existing native creation call and a local fixture. The actual `create_placed_resource_x` call, arguments and cache decisions were retained; the factory was not substituted. Removing test additions reconstructs every original source hash. These were instrumented source copies, not clean Git checkouts. ```text cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run wine <libtest.exe> hle::d3d12x::real::view_key_tests:: hle::d3d12x::real::srv_tests:: --nocapture --test-threads=N wine <libtest.exe> hle::d3d12x::real::workflow_view_cache_probe::concurrent_native_views_share_creation --exact --nocapture --test-threads=1 ``` `XCL_NETWORK=0`, `XCL_ADAPTER="AMD Radeon RX 9070"`, `XCL_REQUIRE_GPU=wave64`, native DLL overrides, private enabled caches. Native probes ran with `XCL_VRAM_ARENAS` unset and with `XCL_VRAM_ARENAS=1`, three fresh processes per source/configuration, alternating source order. - Original cache/SRV selections at `N=1` and `N=4`: exact head and integrated head each **4 passed / 0 failed / 0 ignored** per invocation; current main **2/0/0**. Main has no new `view_key_tests` module. The head module includes the cached-zero/independent-key CPU check. - Native fixture: exact head and integrated head each **1/0/0** per invocation. Main **0/1/0**, failing `one creation per normalized key` after all native creation, identity and descriptor checks completed. The native fixture uses small RGBA8 render targets, with a 192 KiB owned synthetic address range. It holds creation for the first address until all eight callers are observed: eight caller references to the pending entry on head, eight factory entrants on main. A different address completes while that first creation remains held. After release, every head caller receives the same pointer; main returns eight distinct pointers. An exact repeat uses a previously returned pointer on all three source variants. Per-process outcomes were identical in every repetition and both placement configurations: | Observation | current main | exact head / integrated head | | --- | ---: | ---: | | Native creator entries for the eight overlapping same-key requests | 8 | 1 | | Distinct returned objects for those requests | 8 | 1 | | Different-key completion before release | yes | yes | | New creation for padding-only repeat | 1 | 0 | | New creation for width 16 to 32 | 1 | 1 | | Total native creations, including the different address | 11 | 3 | | Completed-entry counter at end | unavailable | 3 | Across 24 harness invocations: **0 ignored, 0 capability skips**. The 18 native probes created 102 real resources. Independently checked saved pointer sets, creation counts, joins and native descriptors; each resource's device matched the selected RX 9070 LUID. Default placement mapped one tile per resource; arena mode had no page mappings. Shared page/heap backing means these object counts do not establish VRAM savings. Creation references and synthetic address identities remain valid until process exit, matching the cache's lifetime. **Not tested** Texture drawing, shader dispatch or pixel readback, native driver failures during concurrent creation, other formats or multiple devices, long-running cache lifetime, whole workspace suite, native Windows, other adapters, retail data, `scripts/smoke.ps1`, FPS, allocation latency or measured RAM/VRAM reduction. **AI use** OpenAI Codex (GPT-6; exact serving variant not exposed) audited the diff, wrote local test-only observations/fixture, ran all source variants, independently verified raw logs/source/executable hashes, and drafted this report. Publication authorized by the account owner.

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!2802
No description provided.