D3D12.X: check shader cache capacity before copying entries #2332
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2332
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2332"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@storrmzz on GitHub · 2026-11-25 14:57 UTC · original
storrmzz:shaders/cache-capacity-check→main· +88 −13 · 2 files · 1 commits · draftThe fallback shader cache copied keys and values before checking its 32 MiB limit, then reported S_OK even when it discarded the entry. Reject oversized inputs before copying, check remaining capacity under the store lock, and return DXGI_ERROR_CACHE_FULL without losing a previous value.
What is in it
shader_cache_session.rs, four regression tests, and README documentation. This affects the fallback used when the host refuses CreateShaderCacheSession.Tested
ab861b8196779f65209de31eef1e5f97ee1eb6d8, base06c9f5505f63f10c5ec49ef932d75b2c28177324. Windows 11 Pro build 26300, Ryzen 7 8840HS, Radeon 780M (driver 32.0.31033.3), rustc 1.100.0 MSVC, debug.cargo build --locked --workspace --jobs 2: passed.cargo test --locked --workspace --no-fail-fast --jobs 2 -- --test-threads=4: 1268 passed, 1 failed, 46 ignored. All four new tests and the existing fallback-session GPU test pass. The failure isgpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(seed 722), reproduced on unchanged main before the rebase too.ab2ff4dc8d82e524ac5230dc58c2fcdc2989766a, additionally carrying upstream PRs #2192, #1946 and #2237, builds and passes the full command above: 1271 passed, 0 failed, 46 ignored. Those commits are NOT included in this PR.git diff --checkpasses.Regression run
Not run: no unpacked retail title is available. The required main/head smoke pair is still needed before merge.
Not tested
Retail titles, Wine/vkd3d-proton, other GPUs, ignored tests and optional XCL_SAMPLE_* inputs (unset). No measured peak-memory or world-load improvement. The PR branch's complete suite is not green until the independent shader failure is resolved upstream.
AI use
This PR was created with AI assistance from OpenAI Codex (gpt-6-astra).
@SlopTart on GitHub · 2026-11-25 15:30 UTC · original
Tested: current PR head merged onto current
origin/main(clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo targetx86_64-pc-windows-gnurun under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).gpu_suite (--release --locked,--test-threads=2): 144 passed / 3 failed / 1 ignored, same three baseline failures as plainorigin/mainon this rig (rig's known baseline: fuzz seed 1003 of #2115,gpu_nonfused_mad_and_mac_prevent_fma_contraction,gpu_depth_buffer_created_for_unordered_access_is_placed).hle::d3d12x::shader_cache_session::tests::cache_capacity_*(oversized entry rejected, exact-limit accepted then next key rejected, failed replacement preserves previous value, replacements accounted in a full store): all 4 pass on this lane (--exactmodule filter,--test-threads=1), including through the real vkd3d-protonD3D12_GPU_PRIVATE_VIRTUAL_ADDRESSsession path this driver provides.Caveat, one-off: the very first suite run on this head died mid-suite with
radv/amdgpu: The CS has been rejected (-14)andD3D12 device removed: 0x887a0005(test process exit 5, no individual failure recorded, no GPU reset in dmesg). A second full suite run on the same head was fully clean, and this rig has produced the same kernel-side CS reject under heavy host memory pressure (it co-hosts an ~80 GB pinned model server). No crash reproduces; mentioning it only for completeness, evidence leans environmental rather than this change.AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
@luckyteagirl on GitHub · 2026-11-25 15:35 UTC · original
Independent focused verification of exact PR head
ab861b8196779f65209de31eef1e5f97ee1eb6d8on Windows 11 build 26200, AMD Radeon RX 6800M (driver30.0.13002.13003), Rust 1.99 MSVC, DXC/DXIL 1.9.2609.5.Tested
cargo test --locked -p xcl --lib shader_cache_session::tests:: -- --test-threads=1 --show-output: 5 passed, 0 failed, 0 ignored, 0 explicit skips. The four capacity tests cover an oversized entry, exact-limit insertion, failed replacement preserving the old value, and replacement/shrinking accounting.CreateShaderCacheSession failed on the PC runtime (0x80070057) – using an in-memory session; it checked miss handling, store and exact readback, buffer-too-small behavior, parent-device identity, and delete-on-destroy cleanup. The clean fixture uses the default device, so this run does not identify which adapter it used.XCL_ADAPTER=6800Mchose and printedshader cache test adapter: AMD Radeon RX 6800M; the same five tests passed with 0 failures and 0 explicit skips. I restored the selector change; the PR checkout is clean.I did not reproduce a host cache-session refusal beyond the fixture's deliberately invalid flags, run a full workspace suite, or run a title smoke pair on this PR.
AI use: OpenAI Codex (GPT-6) ran the tests and prepared this report.
@DavidM1911 on GitHub · 2026-11-25 18:04 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.