D3D12.X: pipelines not built yet share the copies of equal shaders #3505

Open
ArtuArtaza wants to merge 2 commits from upstream-pr/3505 into main
ArtuArtaza commented 2026-11-30 03:54:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ArtuArtaza on 2026-11-30T03:54:54Z.


A pipeline made in the background keeps its description, with a copy of each shader's bytes, until a worker builds it (OwnedDesc); a lazy one keeps it until its first use, often the whole run. A retail title makes about 83,000 pipelines at its start (81,500 of them graphics) and about 2,000 of them are built in a run, so the copies of the rest stay for the whole session. device_x::intern_shader_blob already keeps one copy of each distinct shader for the tracked base pipelines (7e242379); own_shader and own_stream now take their copies from that pool.

The second commit makes the pool's copies Arc<Vec<u8>>: its weak entries kept the bytes of an Arc<[u8]> after their last owner went, until the next sweep (8,192 entries or more). That was there before this PR, which gives the pool more callers. Found by ettehn; that the compute build key has to change with it, and the shape, are thehollowedone's (comments below).

This is the idea of #827 (Cattn, open, conflicts with main) and part of #3091 (Prime1997, open, conflicts with main; its weak Vec entries too), written again on today's main because the pool it needs is there now.

What is in it

  • crates/xcl/src/hle/d3d12x/real.rs: own_shader and own_stream take their copies through device_x::intern_shader_blob. Test owned_descriptions_share_the_copies_of_equal_shaders (graphics and stream descriptions of equal bytes at other addresses hold one copy; other bytes hold their own; a copy outlives the descriptions that shared it).
  • crates/xcl/src/hle/d3d12x/device_x.rs: intern_shader_blob is pub(super); the pool, Base and the descriptions hold Arc<Vec<u8>> (same lookup, full compare and second lookup as before). Test the_pool_keeps_no_bytes_of_a_shader_without_owners: after the last owner goes the pool's entry is still there, and Windows says the pages of the bytes are free (VirtualQuery).
  • crates/xcl/src/hle/d3d12x/real/compute_build_key.rs, pso_async.rs (its tests): the build key holds the same Arc<Vec<u8>> as the description, so no second copy.

Tested

  • AMD Radeon RX 6700 XT (driver 32.0.21045.29003), Ryzen 5 5600X, 48 GB, Windows 11 build 26200.9974, rustc 1.100.0; tests in debug, title runs in release.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4 on 12713ec6: 2834 passed, 3 failed, 51 ignored (43 test binaries). The 3 are 2 tests, and both fail the same way on unmodified main cfb9753a on this card (ran them there alone): gpu_compact_form_with_micro_blocks_and_literal_table_runs_as_the_plain_form ((50, 0, 1, 5) against (50, 10045, 1, 5): what #3473 fixes) and gpu_two_pass_cache_e2e::two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs (parent and child run, gpu_two_pass_cache_e2e.rs:472 and :584). 4 SKIPPED notices (no GPU_UPLOAD heaps, no heap windows, no Developer Mode).
  • The first test fails with its two lines put back to main (one copy of equal shaders), the second fails on the first commit c635d342 (the bytes go with their last owner); both pass on the head.
  • The branch merged into main 9dfbe3ea: no conflicts, cargo check -p xcl --all-targets passes.
  • The retail title, Series S profile (XCL_DEVICE_TYPE=lockhart), its opening area, XCL_PREPARE=0 XCL_PSO_AHEAD=0, first commit only, 240 s, four runs by turns on main 53e85fb1 with #3455, #3302 and #3473 (earlier main did not get that far on this card without them) plus a counter of the copies made, and the same with the change (two runs each; the counter is not in this PR):
    • shader copies asked for: 155,648 in every run. Made: 155,648 (527 MB) without the change, 18,112 and 18,117 (143 MB) with it.
    • process commit at 236 s: 25,006 and 24,524 MB without, 23,718 and 24,079 MB with it (the driver cache warms from run to run, so only part of that is this change).
    • frames, video memory and errors: no difference that the runs' order does not explain (0 device removals, 0 crashes in all four).
  • The same on main 9dfbe3ea, first commit only, one run each of 150 s with cold caches: 155,648 copies (527 MB) made without, 17,705 (142 MB) with. The whole process' commit at the end shows no difference there (25,439 and 25,493 MB: the cold compiles and the heaps move it more than this does).
  • The same title for 60 s on main cfb9753a and on this PR's head, blocks below: peak commit 13,672 MB and 13,504 MB.

Regression run

main cfb9753a, then this PR's head:

xcl-smoke v1
commit: cfb9753a8cbf5517ee36914b7041cb62b4a97582
gpu: AMD Radeon RX 6700 XT
title: 2c508222
seconds: 60
exit: 0x0
frames shown: 1606 (PresentX 1606)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13672 MB
xcl-smoke v1
commit: 12713ec6a4f0f87320f7ee7206d64796ec69421f
gpu: AMD Radeon RX 6700 XT
title: 2c508222
seconds: 60
exit: 0x0
frames shown: 1577 (PresentX 1577)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13504 MB

Not tested

  • NVIDIA and Intel cards here (ettehn ran the first commit's tests on an RTX 5070 Ti Laptop); the Series X profile; the title past its first world load (its first-time shader compiles stop the frames here, on both sides).
  • The second commit's own effect on the title's memory: only the 60 s run above was made with it.
  • The time intern_shader_blob adds at pipeline creation (one fnv64 of the shader and a lock) was not measured on its own.

AI use

  • Claude Code with Claude Opus 5.5 found the copies, wrote the changes, the tests and this description, and ran the builds, the tests and the runs on my machine; Claude Fable 5.2 compared part of the runs. The pull request was submitted from my account at my request, in that session.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5558677003 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3505). Originally posted by [ArtuArtaza](https://github.com/ArtuArtaza) on 2026-11-30T03:54:54Z. --- A pipeline made in the background keeps its description, with a copy of each shader's bytes, until a worker builds it (`OwnedDesc`); a lazy one keeps it until its first use, often the whole run. A retail title makes about 83,000 pipelines at its start (81,500 of them graphics) and about 2,000 of them are built in a run, so the copies of the rest stay for the whole session. `device_x::intern_shader_blob` already keeps one copy of each distinct shader for the tracked base pipelines (7e242379); `own_shader` and `own_stream` now take their copies from that pool. The second commit makes the pool's copies `Arc<Vec<u8>>`: its weak entries kept the bytes of an `Arc<[u8]>` after their last owner went, until the next sweep (8,192 entries or more). That was there before this PR, which gives the pool more callers. Found by ettehn; that the compute build key has to change with it, and the shape, are thehollowedone's (comments below). This is the idea of #827 (Cattn, open, conflicts with main) and part of #3091 (Prime1997, open, conflicts with main; its weak `Vec` entries too), written again on today's main because the pool it needs is there now. **What is in it** - `crates/xcl/src/hle/d3d12x/real.rs`: `own_shader` and `own_stream` take their copies through `device_x::intern_shader_blob`. Test `owned_descriptions_share_the_copies_of_equal_shaders` (graphics and stream descriptions of equal bytes at other addresses hold one copy; other bytes hold their own; a copy outlives the descriptions that shared it). - `crates/xcl/src/hle/d3d12x/device_x.rs`: `intern_shader_blob` is `pub(super)`; the pool, `Base` and the descriptions hold `Arc<Vec<u8>>` (same lookup, full compare and second lookup as before). Test `the_pool_keeps_no_bytes_of_a_shader_without_owners`: after the last owner goes the pool's entry is still there, and Windows says the pages of the bytes are free (`VirtualQuery`). - `crates/xcl/src/hle/d3d12x/real/compute_build_key.rs`, `pso_async.rs` (its tests): the build key holds the same `Arc<Vec<u8>>` as the description, so no second copy. **Tested** - AMD Radeon RX 6700 XT (driver 32.0.21045.29003), Ryzen 5 5600X, 48 GB, Windows 11 build 26200.9974, rustc 1.100.0; tests in debug, title runs in release. - `cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4` on `12713ec6`: **2834 passed, 3 failed, 51 ignored** (43 test binaries). The 3 are 2 tests, and both fail the same way on unmodified main `cfb9753a` on this card (ran them there alone): `gpu_compact_form_with_micro_blocks_and_literal_table_runs_as_the_plain_form` (`(50, 0, 1, 5)` against `(50, 10045, 1, 5)`: what #3473 fixes) and `gpu_two_pass_cache_e2e::two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs` (parent and child run, `gpu_two_pass_cache_e2e.rs:472` and `:584`). 4 `SKIPPED` notices (no GPU_UPLOAD heaps, no heap windows, no Developer Mode). - The first test fails with its two lines put back to main (`one copy of equal shaders`), the second fails on the first commit `c635d342` (`the bytes go with their last owner`); both pass on the head. - The branch merged into main `9dfbe3ea`: no conflicts, `cargo check -p xcl --all-targets` passes. - The retail title, Series S profile (`XCL_DEVICE_TYPE=lockhart`), its opening area, `XCL_PREPARE=0 XCL_PSO_AHEAD=0`, **first commit only**, 240 s, four runs by turns on main `53e85fb1` with #3455, #3302 and #3473 (earlier main did not get that far on this card without them) plus a counter of the copies made, and the same with the change (two runs each; the counter is not in this PR): - shader copies asked for: 155,648 in every run. Made: 155,648 (527 MB) without the change, 18,112 and 18,117 (143 MB) with it. - process commit at 236 s: 25,006 and 24,524 MB without, 23,718 and 24,079 MB with it (the driver cache warms from run to run, so only part of that is this change). - frames, video memory and errors: no difference that the runs' order does not explain (0 device removals, 0 crashes in all four). - The same on main `9dfbe3ea`, first commit only, one run each of 150 s with cold caches: 155,648 copies (527 MB) made without, 17,705 (142 MB) with. The whole process' commit at the end shows no difference there (25,439 and 25,493 MB: the cold compiles and the heaps move it more than this does). - The same title for 60 s on main `cfb9753a` and on this PR's head, blocks below: peak commit 13,672 MB and 13,504 MB. **Regression run** main `cfb9753a`, then this PR's head: ``` xcl-smoke v1 commit: cfb9753a8cbf5517ee36914b7041cb62b4a97582 gpu: AMD Radeon RX 6700 XT title: 2c508222 seconds: 60 exit: 0x0 frames shown: 1606 (PresentX 1606) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13672 MB ``` ``` xcl-smoke v1 commit: 12713ec6a4f0f87320f7ee7206d64796ec69421f gpu: AMD Radeon RX 6700 XT title: 2c508222 seconds: 60 exit: 0x0 frames shown: 1577 (PresentX 1577) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13504 MB ``` **Not tested** - NVIDIA and Intel cards here (ettehn ran the first commit's tests on an RTX 5070 Ti Laptop); the Series X profile; the title past its first world load (its first-time shader compiles stop the frames here, on both sides). - The second commit's own effect on the title's memory: only the 60 s run above was made with it. - The time `intern_shader_blob` adds at pipeline creation (one `fnv64` of the shader and a lock) was not measured on its own. **AI use** - Claude Code with Claude Opus 5.5 found the copies, wrote the changes, the tests and this description, and ran the builds, the tests and the runs on my machine; Claude Fable 5.2 compared part of the runs. The pull request was submitted from my account at my request, in that session. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ettehn commented 2026-11-30 06:12:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ettehn on 2026-11-30T06:12:54Z.


Independent Windows check of c635d342 merged cleanly into d52ff48c. Release build, Rust 1.97.1 MSVC, RTX 5070 Ti Laptop system (621.24). The device-hook, owned-description and malformed-stream tests passed 25/25, with both D3D12 GPU cases running and no skips.

One lifetime detail is worth carrying over from #3091. The new own_shader / own_stream callers share live copies, but the pool stores Weak<[u8]>. Those weak entries still retain the entire inline slice allocation after the last owner drops it. On an insertion the pool sweeps only after the count threshold, initially 8,192 entries.

I compiled the current pool and hash function in an isolated Rust probe and counted live 256 KiB slice allocations. Holding 128 equal blobs used 32 MiB with standalone copies and 0.25 MiB with the pool. After dropping those owners and then making and dropping 128 distinct blobs one at a time, standalone copies held 0 MiB and the pool still held 32.25 MiB. All 129 weak entries failed to upgrade. Clearing those entries released all the counted allocations. #3091's Weak<Vec<u8>> approach would let the payload go at the last strong drop. These are synthetic allocation counts. I did not measure retail process commit or run the full workspace suite.

OpenAI Codex (GPT-6.2 Sol) assisted with source review and Windows verification.

<!-- greyfinch-sync:ivall/xcl:comment:7270419610 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3505#issuecomment-7270419610). Originally posted by [ettehn](https://github.com/ettehn) on 2026-11-30T06:12:54Z. --- Independent Windows check of `c635d342` merged cleanly into `d52ff48c`. Release build, Rust 1.97.1 MSVC, RTX 5070 Ti Laptop system (621.24). The device-hook, owned-description and malformed-stream tests passed 25/25, with both D3D12 GPU cases running and no skips. One lifetime detail is worth carrying over from #3091. The new `own_shader` / `own_stream` callers share live copies, but the pool stores `Weak<[u8]>`. Those weak entries still retain the entire inline slice allocation after the last owner drops it. On an insertion the pool sweeps only after the count threshold, initially 8,192 entries. I compiled the current pool and hash function in an isolated Rust probe and counted live 256 KiB slice allocations. Holding 128 equal blobs used 32 MiB with standalone copies and 0.25 MiB with the pool. After dropping those owners and then making and dropping 128 distinct blobs one at a time, standalone copies held 0 MiB and the pool still held 32.25 MiB. All 129 weak entries failed to upgrade. Clearing those entries released all the counted allocations. #3091's `Weak<Vec<u8>>` approach would let the payload go at the last strong drop. These are synthetic allocation counts. I did not measure retail process commit or run the full workspace suite. OpenAI Codex (GPT-6.2 Sol) assisted with source review and Windows verification.
thehollowedone commented 2026-11-30 07:21:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-30T07:21:11Z.


Follow-up to ettehn’s retention report: one integration detail matters for the fix. ComputeBuildKey also owns an Arc<[u8]> for a compute shader. If the pool and OwnedDesc move to Arc<Vec<u8>> but the build key converts back to Arc<[u8]>, each pending compute recipe can still keep a second payload copy.

Please carry one shared Arc<Vec<u8>> through Base, OwnedDesc, and ComputeBuildKey. Keep the current hash/length lookup, full-byte collision check, and locked second lookup; pass slices explicitly to hashing. This follows the weak-Vec ownership pattern already in #3091.

Candidate shape
- Weak<[u8]> / Arc<[u8]>
+ Weak<Vec<u8>> / Arc<Vec<u8>>

- Arc::from(bytes)
+ Arc::new(bytes.to_vec())

- shaders_key(blobs)
+ shader_set_key(blobs.iter().map(|blob| blob.as_slice()))

Apply the shared type to the shader owners and the compute build key together. Add a regression that observes the backing buffer being released after the last strong owner drops while the weak index entry remains; Weak::upgrade() == None alone passes for both representations.

<!-- greyfinch-sync:ivall/xcl:comment:7271635852 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3505#issuecomment-7271635852). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-30T07:21:11Z. --- Follow-up to [ettehn’s retention report](https://github.com/xcl-dev/xcl/pull/3505#issuecomment-7270419610): one integration detail matters for the fix. [`ComputeBuildKey`](https://github.com/xcl-dev/xcl/blob/f97120dc196ca05e7f47e919d3675f7d5a2b478a/crates/xcl/src/hle/d3d12x/real/compute_build_key.rs#L24-L75) also owns an `Arc<[u8]>` for a compute shader. If the pool and `OwnedDesc` move to `Arc<Vec<u8>>` but the build key converts back to `Arc<[u8]>`, each pending compute recipe can still keep a second payload copy. Please carry one shared `Arc<Vec<u8>>` through `Base`, `OwnedDesc`, and `ComputeBuildKey`. Keep the current hash/length lookup, full-byte collision check, and locked second lookup; pass slices explicitly to hashing. This follows the weak-`Vec` ownership pattern already in [#3091](https://github.com/xcl-dev/xcl/pull/3091). <details> <summary>Candidate shape</summary> ```diff - Weak<[u8]> / Arc<[u8]> + Weak<Vec<u8>> / Arc<Vec<u8>> - Arc::from(bytes) + Arc::new(bytes.to_vec()) - shaders_key(blobs) + shader_set_key(blobs.iter().map(|blob| blob.as_slice())) ``` Apply the shared type to the shader owners and the compute build key together. Add a regression that observes the backing buffer being released after the last strong owner drops while the weak index entry remains; `Weak::upgrade() == None` alone passes for both representations. </details>
Aniseto commented 2026-11-30 12:05:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-30T12:05:43Z.


Ran the shared shader-copy tests at 12713ec6 on an NVIDIA Blackwell desktop part.

System

  • GPU: NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, mesh shaders), driver 32.0.16.2140 (621.40)
  • CPU: Intel Core i5-12400F, 64 GB RAM
  • OS: Windows 11 Pro build 26200 x64
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5
  • Build: debug

Results

  • XCL_ADAPTER=NVIDIA cargo test -p xcl --lib owned_descriptions_share_the_copies_of_equal_shaders -- --test-threads=1: 1 passed, 0 failed, 0 ignored.
  • XCL_ADAPTER=NVIDIA cargo test -p xcl --lib the_pool_keeps_no_bytes_of_a_shader_without_owners -- --test-threads=1: 1 passed, 0 failed, 0 ignored.

What this adds
Both tests pass on the current head: equal shader bytes are shared by the descriptions and the copy outlives its owners without keeping pool bytes. The thread already has an RTX 5070 Ti Laptop report on the first commit; this adds a desktop 5070 Ti run on driver 32.0.16.2140 at the final head. Synthetic tests only; no title memory measurement was made here.

Not tested
A retail title, a paired smoke run, the full workspace suite here, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - ran the commands above on this machine and wrote this report; no game data was used.

<!-- greyfinch-sync:ivall/xcl:comment:7277937317 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3505#issuecomment-7277937317). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-11-30T12:05:43Z. --- Ran the shared shader-copy tests at `12713ec6` on an NVIDIA Blackwell desktop part. **System** - GPU: NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, mesh shaders), driver 32.0.16.2140 (621.40) - CPU: Intel Core i5-12400F, 64 GB RAM - OS: Windows 11 Pro build 26200 x64 - Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5 - Build: debug **Results** - `XCL_ADAPTER=NVIDIA cargo test -p xcl --lib owned_descriptions_share_the_copies_of_equal_shaders -- --test-threads=1`: 1 passed, 0 failed, 0 ignored. - `XCL_ADAPTER=NVIDIA cargo test -p xcl --lib the_pool_keeps_no_bytes_of_a_shader_without_owners -- --test-threads=1`: 1 passed, 0 failed, 0 ignored. **What this adds** Both tests pass on the current head: equal shader bytes are shared by the descriptions and the copy outlives its owners without keeping pool bytes. The thread already has an RTX 5070 Ti Laptop report on the first commit; this adds a desktop 5070 Ti run on driver 32.0.16.2140 at the final head. Synthetic tests only; no title memory measurement was made here. **Not tested** A retail title, a paired smoke run, the full workspace suite here, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash Free** - ran the commands above on this machine and wrote this report; no game data was used.
ArtuArtaza commented 2026-11-30 12:38:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ArtuArtaza on 2026-11-30T12:38:42Z.


Thanks, you are both right. I reproduced it before changing anything: 128 blobs of 256 KB without owners still held 32,776 KB behind Weak<[u8]>, and 9 KB behind Weak<Vec<u8>>.

12713ec6 carries one Arc<Vec<u8>> through Base, OwnedDesc and ComputeBuildKey. The lookup, the full compare and the second lookup under the lock are the same, and OwnedDesc::shaders_key hashes the slices with shader_set_key.

The new test the_pool_keeps_no_bytes_of_a_shader_without_owners drops the last owner of a 4 MiB blob, checks that the pool's entry is still there, and asks VirtualQuery whether the pages are free. It fails on c635d342 and passes on the head. The suite, the merge check on main 9dfbe3ea and the 60 s runs are in the description. The long title runs there are of the first commit; I did not repeat them with this one.

(Change and reply written by Claude Code with Claude Opus 5.5, sent from my account.)

<!-- greyfinch-sync:ivall/xcl:comment:7278725498 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3505#issuecomment-7278725498). Originally posted by [ArtuArtaza](https://github.com/ArtuArtaza) on 2026-11-30T12:38:42Z. --- Thanks, you are both right. I reproduced it before changing anything: 128 blobs of 256 KB without owners still held 32,776 KB behind `Weak<[u8]>`, and 9 KB behind `Weak<Vec<u8>>`. 12713ec6 carries one `Arc<Vec<u8>>` through `Base`, `OwnedDesc` and `ComputeBuildKey`. The lookup, the full compare and the second lookup under the lock are the same, and `OwnedDesc::shaders_key` hashes the slices with `shader_set_key`. The new test `the_pool_keeps_no_bytes_of_a_shader_without_owners` drops the last owner of a 4 MiB blob, checks that the pool's entry is still there, and asks `VirtualQuery` whether the pages are free. It fails on c635d342 and passes on the head. The suite, the merge check on main 9dfbe3ea and the 60 s runs are in the description. The long title runs there are of the first commit; I did not repeat them with this one. (Change and reply written by Claude Code with Claude Opus 5.5, sent from my account.)
saintwolf commented 2026-11-30 12:57:32 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by saintwolf on 2026-11-30T12:57:32Z.


merge-check claim
head: 12713ec6a4

<!-- greyfinch-sync:ivall/xcl:comment:7279156307 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3505#issuecomment-7279156307). Originally posted by [saintwolf](https://github.com/saintwolf) on 2026-11-30T12:57:32Z. --- merge-check claim head: 12713ec6a4f0f87320f7ee7206d64796ec69421f
saintwolf commented 2026-11-30 13:02:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by saintwolf on 2026-11-30T13:02:56Z.


merge-check
base: 9dfbe3ea66
head: 12713ec6a4
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2886 passed, 3 failed, 51 ignored; SKIPPED: 27 (22 no wave64, 2 no heap windows, 2 no xgameruntime.dll, 1 cannot disable the driver cache 0x887A002D); failing: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16 (also fails on base 9dfbe3ea alone) and two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs in gpu_two_pass_cache_e2e (unrelated); targeted tests passed (the_pool_keeps_no_bytes_of_a_shader_without_owners, owned_descriptions_share_the_copies_of_equal_shaders, build_key_shares_the_owned_shader_allocation)
review: none (read the full +95/-32 diff across device_x.rs, pso_async.rs, real.rs, and compute_build_key.rs: moves ShaderPool from Weak<[u8]> to Weak<Vec> so dropped blobs release their heap buffers immediately rather than waiting for the 8192-entry sweep, and carries one shared Arc<Vec> through Base, OwnedDesc (own_shader / own_stream), and ComputeBuildKey with fnv64+len lookup and full-byte equality checks; not tested: live retail title with ~83k pipelines)
performance: memory win for unbuilt/lazy pipelines sharing equal shaders, and immediate Vec buffer release when owners drop; adds an intern_shader_blob lookup/lock per shader in own_shader/own_stream
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 4070 SUPER (32.0.16.2140), AMD Ryzen 7 7800X3D, Windows 11 Pro 26300, rustc 1.100.0, debug / Antigravity (Gemini 4 Hydrogen)

<!-- greyfinch-sync:ivall/xcl:comment:7279282847 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3505#issuecomment-7279282847). Originally posted by [saintwolf](https://github.com/saintwolf) on 2026-11-30T13:02:56Z. --- merge-check base: 9dfbe3ea6653a9c76ef3ea0d66187a4b5407483b head: 12713ec6a4f0f87320f7ee7206d64796ec69421f merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2886 passed, 3 failed, 51 ignored; SKIPPED: 27 (22 no wave64, 2 no heap windows, 2 no xgameruntime.dll, 1 cannot disable the driver cache 0x887A002D); failing: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16 (also fails on base 9dfbe3ea alone) and two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs in gpu_two_pass_cache_e2e (unrelated); targeted tests passed (the_pool_keeps_no_bytes_of_a_shader_without_owners, owned_descriptions_share_the_copies_of_equal_shaders, build_key_shares_the_owned_shader_allocation) review: none (read the full +95/-32 diff across device_x.rs, pso_async.rs, real.rs, and compute_build_key.rs: moves ShaderPool from Weak<[u8]> to Weak<Vec<u8>> so dropped blobs release their heap buffers immediately rather than waiting for the 8192-entry sweep, and carries one shared Arc<Vec<u8>> through Base, OwnedDesc (own_shader / own_stream), and ComputeBuildKey with fnv64+len lookup and full-byte equality checks; not tested: live retail title with ~83k pipelines) performance: memory win for unbuilt/lazy pipelines sharing equal shaders, and immediate Vec buffer release when owners drop; adds an intern_shader_blob lookup/lock per shader in own_shader/own_stream verdict: safe to merge hardware / tool and model: NVIDIA GeForce RTX 4070 SUPER (32.0.16.2140), AMD Ryzen 7 7800X3D, Windows 11 Pro 26300, rustc 1.100.0, debug / Antigravity (Gemini 4 Hydrogen)
tiagonleal commented 2026-11-30 13:46:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-30T13:46:38Z.


merge-check
base: 9dfbe3ea66
head: 12713ec6a4
merge: clean
build: cargo build --workspace -> ok (also cargo build --release -p xcl)
tests: cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4 -> 2887 passed, 1 failed, 51 ignored; SKIPPED: 24 lines, the same as on the base; failing: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16, which fails the same way on the base alone (2885 passed, 1 failed, 51 ignored; #3513 fixes it). The two-pass cache e2e test that failed in the other check passed here. The new tests the_pool_keeps_no_bytes_of_a_shader_without_owners and owned_descriptions_share_the_copies_of_equal_shaders ran and passed. With own_shader put back to a private copy per description (Arc::new(bytes.to_vec()) at real.rs:8402), owned_descriptions_share_the_copies_of_equal_shaders fails at real.rs:8519 ("one copy of equal shaders"); file restored after.
review: whole diff read (+95/-32, 4 files). Sharing is decided by a full byte compare: intern_shader_blob (device_x.rs:389) looks up by (fnv64, len) and returns an existing copy only when existing.as_slice() == bytes (device_x.rs:396 outside the lock, device_x.rs:404 again under it), so two different shaders are never given one copy. On a key collision with both alive, the newer copy replaces the map entry (device_x.rs:412); the older one stays valid for its owners and only stops being shared. Locking is one global mutex, BASE_SHADERS (device_x.rs:374). The hash is taken outside it, the second compare and the insert under it, so two threads interning the same bytes end with one copy, and the extra to_vec (device_x.rs:400) is dropped. Lifetime: each OwnedDesc holds an Arc<Vec<u8>> per stage and points the descriptor at the Vec buffer (real.rs:8402-8404, stream at real.rs:8481). I found no make_mut, get_mut or write through those pointers in hle/d3d12x, so a shared buffer never moves or changes while a description points at it. A failed or cancelled build only drops its OwnedDesc; the bytes go with the last Arc, and the pool keeps a dead weak entry (the Arc and Vec header, no shader bytes) until the sweep at device_x.rs:408-411. Cost: one fnv64 over each shader at pipeline creation plus the global lock, and a full compare under the lock on a hit; not measured on its own. Overlap: #827 and #3091 change own_shader the same way (the PR says so), and #2297 changes the signature of own_shader; whichever lands second needs a rebase.
performance: scripts/smoke.ps1, 60 s of a retail title, release, after one warm-up run of the base: 1673 frames and 17222 MB peak commit against 1659 frames and 17322 MB on the base (warm-up: 1689, 17197 MB). No device removal, no crash. Pipelines at the end of the run, from the log: 60753 made (58011 graphics) on both, 2336 built against 2295; the built count rose run after run today as caches warmed, so I do not read that difference as this PR. The 100 MB commit difference is inside today's run-to-run spread, and 60 s in the menus does not show the copy savings the PR measures over 240 s. Not verified here: the title past its first world load, and the memory effect over a long run.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB (617.42, wave32), Ryzen 7 9800X3D, 32 GB, Windows 11 26300, rustc 1.100.0 / Claude Code (Claude Opus 5.5 ran the build, suite, tests and smoke, reviewed the diff against the merged source and wrote this)

  • Tiago
<!-- greyfinch-sync:ivall/xcl:comment:7280340671 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3505#issuecomment-7280340671). Originally posted by [tiagonleal](https://github.com/tiagonleal) on 2026-11-30T13:46:38Z. --- merge-check base: 9dfbe3ea6653a9c76ef3ea0d66187a4b5407483b head: 12713ec6a4f0f87320f7ee7206d64796ec69421f merge: clean build: cargo build --workspace -> ok (also `cargo build --release -p xcl`) tests: cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4 -> 2887 passed, 1 failed, 51 ignored; SKIPPED: 24 lines, the same as on the base; failing: `gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16`, which fails the same way on the base alone (2885 passed, 1 failed, 51 ignored; #3513 fixes it). The two-pass cache e2e test that failed in the other check passed here. The new tests `the_pool_keeps_no_bytes_of_a_shader_without_owners` and `owned_descriptions_share_the_copies_of_equal_shaders` ran and passed. With `own_shader` put back to a private copy per description (`Arc::new(bytes.to_vec())` at `real.rs:8402`), `owned_descriptions_share_the_copies_of_equal_shaders` fails at `real.rs:8519` ("one copy of equal shaders"); file restored after. review: whole diff read (+95/-32, 4 files). Sharing is decided by a full byte compare: `intern_shader_blob` (`device_x.rs:389`) looks up by `(fnv64, len)` and returns an existing copy only when `existing.as_slice() == bytes` (`device_x.rs:396` outside the lock, `device_x.rs:404` again under it), so two different shaders are never given one copy. On a key collision with both alive, the newer copy replaces the map entry (`device_x.rs:412`); the older one stays valid for its owners and only stops being shared. Locking is one global mutex, `BASE_SHADERS` (`device_x.rs:374`). The hash is taken outside it, the second compare and the insert under it, so two threads interning the same bytes end with one copy, and the extra `to_vec` (`device_x.rs:400`) is dropped. Lifetime: each `OwnedDesc` holds an `Arc<Vec<u8>>` per stage and points the descriptor at the `Vec` buffer (`real.rs:8402-8404`, stream at `real.rs:8481`). I found no `make_mut`, `get_mut` or write through those pointers in `hle/d3d12x`, so a shared buffer never moves or changes while a description points at it. A failed or cancelled build only drops its `OwnedDesc`; the bytes go with the last `Arc`, and the pool keeps a dead weak entry (the `Arc` and `Vec` header, no shader bytes) until the sweep at `device_x.rs:408-411`. Cost: one `fnv64` over each shader at pipeline creation plus the global lock, and a full compare under the lock on a hit; not measured on its own. Overlap: #827 and #3091 change `own_shader` the same way (the PR says so), and #2297 changes the signature of `own_shader`; whichever lands second needs a rebase. performance: `scripts/smoke.ps1`, 60 s of a retail title, release, after one warm-up run of the base: 1673 frames and 17222 MB peak commit against 1659 frames and 17322 MB on the base (warm-up: 1689, 17197 MB). No device removal, no crash. Pipelines at the end of the run, from the log: 60753 made (58011 graphics) on both, 2336 built against 2295; the built count rose run after run today as caches warmed, so I do not read that difference as this PR. The 100 MB commit difference is inside today's run-to-run spread, and 60 s in the menus does not show the copy savings the PR measures over 240 s. Not verified here: the title past its first world load, and the memory effect over a long run. verdict: safe to merge hardware / tool and model: RTX 5070 Ti 16 GB (617.42, wave32), Ryzen 7 9800X3D, 32 GB, Windows 11 26300, rustc 1.100.0 / Claude Code (Claude Opus 5.5 ran the build, suite, tests and smoke, reviewed the diff against the merged source and wrote this) - Tiago
Kalmarv commented 2026-11-30 15:16:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-30T15:16:57Z.


Independent verification on RTX 5070 Ti (Windows 11, Ryzen 9 9950X, NVIDIA nvgpucomp64.dll 32.0.16.1074, DXC 1.9.2609), local merge of 12713ec6a4f0f87320f7ee7206d64796ec69421f onto main 9dfbe3ea6653a9c76ef3ea0d66187a4b5407483b:

  • Merge & build: Clean merge (+95/-32 across 4 files), cargo build --release -p xcl succeeded.
  • Targeted unit tests (--test-threads=1): 28 passed, 0 failed (hle::d3d12x::device_x::tests: 22/22 including the_pool_keeps_no_bytes_of_a_shader_without_owners; hle::d3d12x::real::compute_build_key::tests: 5/5 including build_key_shares_the_owned_shader_allocation; owned_descriptions_share_the_copies_of_equal_shaders: 1/1).
  • Code review: Read the full diff across device_x.rs, pso_async.rs, real.rs, and compute_build_key.rs. Switching ShaderPool from Weak<[u8]> to Weak<Vec<u8>> ensures shader byte buffers are freed immediately when the last strong Arc drops instead of waiting for the 8192-entry sweep, and own_shader / own_stream / ComputeBuildKey cleanly share the same Arc<Vec<u8>> with full-byte equality verification.
  • 60 s retail smoke (scripts/smoke.ps1, release):
xcl-smoke v1
commit: 219b1f309ed0f2ef72f10aeaee7d75427e25bf0a
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1701 (PresentX 1701)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17326 MB

(0 device removals, 0 crashes.)

Not tested here: Full cargo test --workspace locally and multi-minute in-world peak-commit delta past the opening menus.

Verdict: Safe to merge.

AI use: Antigravity assisted with merging locally, inspecting the diff, running the targeted tests and 60 s smoke, and drafting this report.

<!-- greyfinch-sync:ivall/xcl:comment:7282736783 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3505#issuecomment-7282736783). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-30T15:16:57Z. --- Independent verification on RTX 5070 Ti (Windows 11, Ryzen 9 9950X, NVIDIA `nvgpucomp64.dll` 32.0.16.1074, DXC 1.9.2609), local merge of `12713ec6a4f0f87320f7ee7206d64796ec69421f` onto `main` `9dfbe3ea6653a9c76ef3ea0d66187a4b5407483b`: - **Merge & build:** Clean merge (`+95/-32` across 4 files), `cargo build --release -p xcl` succeeded. - **Targeted unit tests (`--test-threads=1`):** 28 passed, 0 failed (`hle::d3d12x::device_x::tests`: 22/22 including `the_pool_keeps_no_bytes_of_a_shader_without_owners`; `hle::d3d12x::real::compute_build_key::tests`: 5/5 including `build_key_shares_the_owned_shader_allocation`; `owned_descriptions_share_the_copies_of_equal_shaders`: 1/1). - **Code review:** Read the full diff across `device_x.rs`, `pso_async.rs`, `real.rs`, and `compute_build_key.rs`. Switching `ShaderPool` from `Weak<[u8]>` to `Weak<Vec<u8>>` ensures shader byte buffers are freed immediately when the last strong `Arc` drops instead of waiting for the 8192-entry sweep, and `own_shader` / `own_stream` / `ComputeBuildKey` cleanly share the same `Arc<Vec<u8>>` with full-byte equality verification. - **60 s retail smoke (`scripts/smoke.ps1`, release):** ``` xcl-smoke v1 commit: 219b1f309ed0f2ef72f10aeaee7d75427e25bf0a gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1701 (PresentX 1701) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17326 MB ``` (0 device removals, 0 crashes.) **Not tested here:** Full `cargo test --workspace` locally and multi-minute in-world peak-commit delta past the opening menus. **Verdict:** Safe to merge. *AI use: Antigravity assisted with merging locally, inspecting the diff, running the targeted tests and 60 s smoke, and drafting this report.*
ClosetPie107 commented 2026-11-30 16:03:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-30T16:03:11Z.


Test report for #3505 at 12713ec6a4f0f87320f7ee7206d64796ec69421f, against its merge-base with main, cfb9753a, under Wine on AMD.

Tested

  • RX 9070 16 GB (RDNA4), Mesa 26.3.1 RADV, Ryzen 5 9600X, CachyOS; Proton Experimental experimental-11.0-20261112, stock vkd3d-proton master 71cae091. Debug build, x86_64-pc-windows-gnu, under Wine. It wasn't run on Windows.
  • Command: cargo test --locked -p xcl --lib --target x86_64-pc-windows-gnu -- <filter>.
  • The PR's new tests, each alone (--test-threads=1 <name>): both pass: owned_descriptions_share_the_copies_of_equal_shaders, the_pool_keeps_no_bytes_of_a_shader_without_owners. 2 passed, 0 failed.
  • The lib suite at --test-threads=2, with --skip gpu:: and these six: failed_restore_stops_before_importing_an_unbacked_window, grooming_leaves_a_window_under_1_gib_only_its_hole (both run out of memory here), write_buffer_immediate_on_open_existing_heap_visible_to_cpu, coherent_buffer_sanitizes_console_flags_and_state, serialize_root_signature_strips_console_flags_and_preserves_pc_flags and execute_indirect_reads_the_arguments_written_before_it. Under Wine each of the last four ends the process or makes RADV reject later submissions (#3067), so without them the suite reaches its summary:
    • #3505 12713ec6: 1604 passed, 116 failed, 5 ignored
    • base cfb9753a: 1602 passed, 116 failed, 5 ignored
  • The only test failing on #3505 and not on the base is list_x::tests::timestamps_outside_unified_memory_land_after_the_queue, with E_INVALIDARG from a list creation (the cascade above). It passes 3 of 3 alone on #3505 and on the base. Most of the base's failures under Wine are main's known ones on stock vkd3d-proton: list creation refused (E_INVALIDARG, #175 / #1701) and the tests after it (#3067).

Not tested

  • native Windows
  • NVIDIA
  • the gpu:: tests in the suite runs
  • the workspace's other crates and integration tests (only -p xcl --lib)
  • a game run (no regression block)

AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7284037110 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3505#issuecomment-7284037110). Originally posted by [ClosetPie107](https://github.com/ClosetPie107) on 2026-11-30T16:03:11Z. --- Test report for #3505 at `12713ec6a4f0f87320f7ee7206d64796ec69421f`, against its merge-base with `main`, `cfb9753a`, under Wine on AMD. **Tested** - RX 9070 16 GB (RDNA4), Mesa 26.3.1 RADV, Ryzen 5 9600X, CachyOS; Proton Experimental `experimental-11.0-20261112`, stock vkd3d-proton `master` `71cae091`. Debug build, `x86_64-pc-windows-gnu`, under Wine. It wasn't run on Windows. - Command: `cargo test --locked -p xcl --lib --target x86_64-pc-windows-gnu -- <filter>`. - The PR's new tests, each alone (`--test-threads=1 <name>`): both pass: `owned_descriptions_share_the_copies_of_equal_shaders`, `the_pool_keeps_no_bytes_of_a_shader_without_owners`. **2 passed, 0 failed.** - The lib suite at `--test-threads=2`, with `--skip gpu::` and these six: `failed_restore_stops_before_importing_an_unbacked_window`, `grooming_leaves_a_window_under_1_gib_only_its_hole` (both run out of memory here), `write_buffer_immediate_on_open_existing_heap_visible_to_cpu`, `coherent_buffer_sanitizes_console_flags_and_state`, `serialize_root_signature_strips_console_flags_and_preserves_pc_flags` and `execute_indirect_reads_the_arguments_written_before_it`. Under Wine each of the last four ends the process or makes RADV reject later submissions (#3067), so without them the suite reaches its summary: - #3505 `12713ec6`: 1604 passed, 116 failed, 5 ignored - base `cfb9753a`: 1602 passed, 116 failed, 5 ignored - The only test failing on #3505 and not on the base is `list_x::tests::timestamps_outside_unified_memory_land_after_the_queue`, with `E_INVALIDARG` from a list creation (the cascade above). It passes 3 of 3 alone on #3505 and on the base. Most of the base's failures under Wine are `main`'s known ones on stock vkd3d-proton: list creation refused (`E_INVALIDARG`, #175 / #1701) and the tests after it (#3067). **Not tested** - native Windows - NVIDIA - the `gpu::` tests in the suite runs - the workspace's other crates and integration tests (only `-p xcl --lib`) - a game run (no regression block) AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
andresd-cerebras commented 2026-11-30 21:49:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by andresd-cerebras on 2026-11-30T21:49:33Z.

Code review location: crates/xcl/src/hle/d3d12x/real.rs; line 8369

@@ -8364,7 +8366,7 @@ unsafe fn own_stream(desc: *const c_void) -> Option<OwnedDesc> {
                 if p == 0 || n == 0 {
                     buf[at..at + 16].fill(0);
                 } else if crate::gpu::shader::readable(p, n) {
-                    blobs.push(std::slice::from_raw_parts(p as *const u8, n).into());
+                    blobs.push(super::device_x::intern_shader_blob(std::slice::from_raw_parts(p as *const u8, n)));

Interning here into the global pool couples own_stream_rejects_null_truncated_and_unreadable_streams (same 8 bytes 44 58 42 43 01 02 03 04) with base_pso_retains_shader_bytecode_after_title_buffer_changes, whose final weak_vs.upgrade().is_none() assert can then fail when the two run in parallel. Distinct test bytes would fix it.

<!-- greyfinch-sync:ivall/xcl:review-comment:4745983711 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3505#discussion_r4745983711). Originally posted by [andresd-cerebras](https://github.com/andresd-cerebras) on 2026-11-30T21:49:33Z. **Code review location:** `crates/xcl/src/hle/d3d12x/real.rs`; line 8369 ~~~~diff @@ -8364,7 +8366,7 @@ unsafe fn own_stream(desc: *const c_void) -> Option<OwnedDesc> { if p == 0 || n == 0 { buf[at..at + 16].fill(0); } else if crate::gpu::shader::readable(p, n) { - blobs.push(std::slice::from_raw_parts(p as *const u8, n).into()); + blobs.push(super::device_x::intern_shader_blob(std::slice::from_raw_parts(p as *const u8, n))); ~~~~ --- Interning here into the global pool couples `own_stream_rejects_null_truncated_and_unreadable_streams` (same 8 bytes `44 58 42 43 01 02 03 04`) with `base_pso_retains_shader_bytecode_after_title_buffer_changes`, whose final `weak_vs.upgrade().is_none()` assert can then fail when the two run in parallel. Distinct test bytes would fix it.
andresd-cerebras commented 2026-11-30 21:49:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by andresd-cerebras on 2026-11-30T21:49:33Z.

Review: COMMENTED


Withdrawn.

<!-- greyfinch-sync:ivall/xcl:review:6121175216 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3505#pullrequestreview-6121175216). Originally posted by [andresd-cerebras](https://github.com/andresd-cerebras) on 2026-11-30T21:49:33Z. **Review:** COMMENTED --- Withdrawn.
Foniass commented 2026-12-01 09:00:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:00:46Z.


merge-check
base: 7d86c5d2b7
head: 12713ec6a4
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2898 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (device_x.rs, real.rs, real/compute_build_key.rs, pso_async.rs tests). Every background or lazy pipeline description now copies its shaders through intern_shader_blob, with the pool, Base and the compute build key holding Arc<Vec<u8>>. Findings: (1) it repeats the pending-recipe part of open #3091 (Arc<Vec<u8>>, own_shader / own_stream through a shared pool, the ComputeBuildKey type change), as the description says; a maintainer needs to pick one, and #3091 would then keep only its derived and base parts. (2) own_shader / own_stream (real.rs ~8288, ~8369) now run fnv64 over every shader on the creation thread, plus a full byte compare on a hit under the global BASE_SHADERS lock, and OwnedDesc::shaders_key (~8250-8253) hashes the same bytes twice more; reusing the interned hash would drop a pass. Not measured, as the description says. (3) the_pool_keeps_no_bytes_of_a_shader_without_owners (device_x.rs ~2112) depends on the process heap releasing a 4 MiB block's pages (it retries 8 times). Fine: descriptions, bases and build keys hold strong references until after the driver call returns and the pool holds only weak ones; nothing mutates the shared bytes and a hash hit is confirmed by comparing all bytes; the Arc<Vec<u8>> change fixes bytes being kept alive through weak entries.
performance: 60 s smoke of a retail title, main 7d86c5d2 vs this merge (05778095): 1663 -> 1662 frames shown (99 %; last presents per 2 s: 60 60 60), peak commit 17153 -> 17289 MB, 0 device removals, 0 crashes.
verdict: not yet: it duplicates the pending-recipe part of open #3091, and a maintainer has to pick one. Otherwise nothing blocks it: the suite passes, the smoke run is flat, and I found no bug in the diff
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

AI-written and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7306088507 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3505#issuecomment-7306088507). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T09:00:46Z. --- merge-check base: 7d86c5d2b7845695031eeea1327aa81b6c439323 head: 12713ec6a4f0f87320f7ee7206d64796ec69421f merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2898 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none review: read the whole diff (device_x.rs, real.rs, real/compute_build_key.rs, pso_async.rs tests). Every background or lazy pipeline description now copies its shaders through `intern_shader_blob`, with the pool, `Base` and the compute build key holding `Arc<Vec<u8>>`. Findings: (1) it repeats the pending-recipe part of open #3091 (`Arc<Vec<u8>>`, `own_shader` / `own_stream` through a shared pool, the `ComputeBuildKey` type change), as the description says; a maintainer needs to pick one, and #3091 would then keep only its derived and base parts. (2) `own_shader` / `own_stream` (real.rs ~8288, ~8369) now run `fnv64` over every shader on the creation thread, plus a full byte compare on a hit under the global `BASE_SHADERS` lock, and `OwnedDesc::shaders_key` (~8250-8253) hashes the same bytes twice more; reusing the interned hash would drop a pass. Not measured, as the description says. (3) `the_pool_keeps_no_bytes_of_a_shader_without_owners` (device_x.rs ~2112) depends on the process heap releasing a 4 MiB block's pages (it retries 8 times). Fine: descriptions, bases and build keys hold strong references until after the driver call returns and the pool holds only weak ones; nothing mutates the shared bytes and a hash hit is confirmed by comparing all bytes; the `Arc<Vec<u8>>` change fixes bytes being kept alive through weak entries. performance: 60 s smoke of a retail title, main 7d86c5d2 vs this merge (05778095): 1663 -> 1662 frames shown (99 %; last presents per 2 s: 60 60 60), peak commit 17153 -> 17289 MB, 0 device removals, 0 crashes. verdict: not yet: it duplicates the pending-recipe part of open #3091, and a maintainer has to pick one. Otherwise nothing blocks it: the suite passes, the smoke run is flat, and I found no bug in the diff hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5 AI-written and posted by Foniass without a human check of each point.
Foniass commented 2026-12-01 10:04:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T10:04:56Z.


Triage (#1607) – head 12713ec

Same idea as #827: own_shader / own_stream share one copy of equal shader bytes. #827 adds its own weak pool in real.rs and conflicts with main. This PR reuses main's device_x::intern_shader_blob and also fixes the pool keeping Arc<[u8]> bytes alive through its weak entries (now Arc<Vec<u8>>). #3091 does the same as part of a larger change.
No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7307640129 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3505#issuecomment-7307640129). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T10:04:56Z. --- **Triage (#1607)** – head 12713ec Same idea as #827: `own_shader` / `own_stream` share one copy of equal shader bytes. #827 adds its own weak pool in `real.rs` and conflicts with main. This PR reuses main's `device_x::intern_shader_blob` and also fixes the pool keeping `Arc<[u8]>` bytes alive through its weak entries (now `Arc<Vec<u8>>`). #3091 does the same as part of a larger change. No problems found in the diff. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
bmjask commented 2026-12-02 14:12:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T14:12:41Z.


@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.

<!-- greyfinch-sync:ivall/xcl:comment:7348169448 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3505#issuecomment-7348169448). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T14:12:41Z. --- @Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
stijn-boer commented 2026-12-02 18:47:29 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by stijn-boer on 2026-12-02T18:47:29Z.


merge-check
base: c53e969602
head: 12713ec6a4
verdict: not yet: the focused checks passed, but the workspace and retail smoke ended early, and #3091 overlaps this implementation.

Windows / AMD RDNA4 (native D3D12) — shader blob ownership and compute build-key checks on 12713ec

Clean merge onto main at c53e969 (merge commit 5be27dac1344c30d84bc97bed4900a61aa7ef36d). git diff --check was clean.

Setup

  • AMD Radeon RX 9060 XT (driver 32.0.32029.2010), Ryzen 7 5700X, Windows 10 21H2 build 19044.6332
  • Rust 1.100.0, debug builds, Agility SDK 1.620.2 with matching d3d12SDKLayers.dll, DXC 1.9.2609.5

Tested

cargo build --workspace passed. cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output exited 101 on both builds. The baseline table row is from a prior run of the same commit, machine, SDK, and command.

Build Passed Failed Ignored SKIPPED notices
main 338 3 23 0
Merged PR 340 3 23 0

Counts are partial because two test processes aborted on each build.

  • Tests that failed on the PR and passed on main — none observed in comparable results.
  • Focused tests — 7 passed, 0 failed, 0 ignored, 0 skip notices with --test-threads=1 --show-output --nocapture. They cover graphics and stream sharing, release of the final byte owner, and compute build-key allocation sharing, equality, digest collision handling, and padding independence.
  • Debug-layer coverage — both debug-layer E2E tests, including DRED, and uploads_start_from_each_subresources_state passed.
Shared failures and process aborts
  • fuzz_validate_and_gpu_1, fuzz_validate_and_gpu_3, and two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs reported failures on both builds.
  • The library and gpu_compute_e2e test processes exited with 0xc0000409 on both builds.

Retail smoke

Ran scripts/smoke.ps1 -Game <local folder> -Seconds 60 -Xcl <debug binary> with XCL_UMA_DRIVER=mixed for title hash 2c508222.

Build Exit Frames logged Device removals logged Peak commit
main 0xc0000409 None 0 1320 MB
Merged PR, first attempt 0xc0000409 None 0 4912 MB
Merged PR, repeat from fresh data root 0xc0000409 None 0 1320 MB

The higher initial startup commit did not reproduce. These exits leave steady-state pool memory behavior unverified.

Diff review

The pool retains a weak reference to the vector owner, while strong owners retain the bytes. The added tests verified identical graphics and stream shader pointers and release after the last owner. Duplicate tracker #1607 identifies overlapping pending-recipe work in #3091.

Not tested

Remaining workspace tests after the aborts, retail performance, and long-running shader-pool memory under load.

AI use

Codex (GPT-6) merged and built the PR, ran the tests, compared the results with main, reviewed the diff, and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7355158926 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3505#issuecomment-7355158926). Originally posted by [stijn-boer](https://github.com/stijn-boer) on 2026-12-02T18:47:29Z. --- merge-check base: c53e96960265a82477a9c98677afb0402e98d486 head: 12713ec6a4f0f87320f7ee7206d64796ec69421f verdict: not yet: the focused checks passed, but the workspace and retail smoke ended early, and #3091 overlaps this implementation. **Windows / AMD RDNA4 (native D3D12) — shader blob ownership and compute build-key checks on `12713ec`** Clean merge onto `main` at `c53e969` (merge commit `5be27dac1344c30d84bc97bed4900a61aa7ef36d`). `git diff --check` was clean. **Setup** - AMD Radeon RX 9060 XT (driver 32.0.32029.2010), Ryzen 7 5700X, Windows 10 21H2 build 19044.6332 - Rust 1.100.0, debug builds, Agility SDK 1.620.2 with matching `d3d12SDKLayers.dll`, DXC 1.9.2609.5 **Tested** `cargo build --workspace` passed. `cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output` exited 101 on both builds. The baseline table row is from a prior run of the same commit, machine, SDK, and command. | Build | Passed | Failed | Ignored | `SKIPPED` notices | |---|---:|---:|---:|---:| | `main` | 338 | 3 | 23 | 0 | | Merged PR | 340 | 3 | 23 | 0 | Counts are partial because two test processes aborted on each build. - **Tests that failed on the PR and passed on `main`** — none observed in comparable results. - **Focused tests** — 7 passed, 0 failed, 0 ignored, 0 skip notices with `--test-threads=1 --show-output --nocapture`. They cover graphics and stream sharing, release of the final byte owner, and compute build-key allocation sharing, equality, digest collision handling, and padding independence. - **Debug-layer coverage** — both debug-layer E2E tests, including DRED, and `uploads_start_from_each_subresources_state` passed. <details><summary>Shared failures and process aborts</summary> - `fuzz_validate_and_gpu_1`, `fuzz_validate_and_gpu_3`, and `two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs` reported failures on both builds. - The library and `gpu_compute_e2e` test processes exited with `0xc0000409` on both builds. </details> **Retail smoke** Ran `scripts/smoke.ps1 -Game <local folder> -Seconds 60 -Xcl <debug binary>` with `XCL_UMA_DRIVER=mixed` for title hash `2c508222`. | Build | Exit | Frames logged | Device removals logged | Peak commit | |---|---|---|---:|---:| | `main` | `0xc0000409` | None | 0 | 1320 MB | | Merged PR, first attempt | `0xc0000409` | None | 0 | 4912 MB | | Merged PR, repeat from fresh data root | `0xc0000409` | None | 0 | 1320 MB | The higher initial startup commit did not reproduce. These exits leave steady-state pool memory behavior unverified. **Diff review** The pool retains a weak reference to the vector owner, while strong owners retain the bytes. The added tests verified identical graphics and stream shader pointers and release after the last owner. Duplicate tracker #1607 identifies overlapping pending-recipe work in #3091. **Not tested** Remaining workspace tests after the aborts, retail performance, and long-running shader-pool memory under load. **AI use** Codex (GPT-6) merged and built the PR, ran the tests, compared the results with `main`, reviewed the diff, and drafted this report.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3505:upstream-pr/3505'
git switch 'upstream-pr/3505'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3505'
git switch 'upstream-pr/3505'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3505'
git switch 'upstream-pr/3505'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3505'
git switch 'main'
git merge --squash 'upstream-pr/3505'
git switch 'main'
git merge --ff-only 'upstream-pr/3505'
git switch 'main'
git merge 'upstream-pr/3505'
git push origin 'main'
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!3505
No description provided.