D3D12.X: MakeResident and Evict give the driver the pipeline behind a stand-in #2523
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!2523
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2523"
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?
@oni-swr on GitHub · 2026-11-25 21:33 UTC · original
oni-swr:t3/xcl-fix-2455-standin-hooks→main· +510 −8 · 2 files · 1 commits · draftA shared stand-in (
standin::shell) is a Rust object, not a D3D12Core pipeline. Device #34MakeResidentand #35Evictkeep the PC layout for console code and had no override, so a stand-in pipeline in the title'sppObjectsarray reached the driver as*mut Shell. Both are overridden now: each shell goes to the driver as the pipeline behind it (the real one once built, otherwise its shared driver pipeline) in a copy of the array. The title's array is not changed, and a residency call does not start or wait for a lazy build.Fixes #2455
I checked each entry point in #2455 against
main @ 6d12f58a. Title code cannot reach the others, so this PR leaves them alone:SetResidencyPriority, #51EnqueueMakeResident: device slots from #44 that are not inconsole_slotsare console extensions (console_extensions). A title call gets the logged S_OK stub and never reaches D3D12Core.ID3D12PipelineLibrary::StorePipeline: console device #44 isCreatePlacedResourceX, so a title never gets a native pipeline library. Only the runtime can reach the PCCreatePipelineLibrary, and it has no shells. (#2001 would wire up a pipeline library. If it lands,StorePipelineneeds this treatment.)CreateCommandList(dev_create_command_list): title calls of #12 are split todevice_x::create_command_list_pc, which resolvespInitialState. XCL's own callers pass resolved pipelines or 0 (create_list,create_raw_pc_command_listfromlist_x), and console-shaped lists turn shared stand-ins off.What is in it
crates/xcl/src/hle/d3d12x/real.rs:dev_make_resident/dev_evictoverrides viawith_driver_objects, plus CPU tests (residency_tests) with a fake adopted device and fake driver methodscrates/xcl/src/hle/d3d12x/standin.rs:driver_object(shell → driver pipeline, any other object unchanged). The shells' vtable moves to a module static so a non-shell is told apart without making the vtable.crates/xcl/src/hle/d3d12x/pso_async.rs:current, the pipeline behind a stand-in now, without building or waitingTested
XCL_ADAPTER=NONE_CPU_ONLY; the GPU was in use by another job), commit8b290bf2cargo build --workspace -j 4: OK1838468d(clean detached checkout), AMD Radeon RX 7800 XT (driver 32.0.31035.1003), Windows 11 Pro build 26200, rustc 1.100.0, debug, noXCL_ADAPTERset (hardware adapter, no WARP),XCL_SAMPLE_*unset:cargo test --workspace -j 4 --no-fail-fast -- --test-threads=4aftercargo build --workspace: 1426 passed, 1 failed, 46 ignored across all test binaries (lib: 1301 passed, 1 failed, 26 ignored). All fourresidency_testsran and passed, includinggpu_residency_calls_with_a_stand_in_on_a_debug_device(not skipped). 7 SKIPPED messages: sixf16_programs_on_the_gpu/f32_programs_on_the_gpucases that the lowering refuses (V_MUL_F16 / V_PK_MUL_F16 / V_CVT_F16_F32, #1426) andheap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1("seed 722: res[30] = 0x1, CPU 0x7fffffff"). It fails the same way, same seed, onmainate120925e, so it is not caused by this PR.cargo test -j 4 -p xcl --lib -- hle::d3d12x::standin:: hle::d3d12x::pso_async:: hle::d3d12x::real::residency_tests::: 19 passed, 0 failed, 0 ignored, no SKIPPEDdriver_objectbypassed inwith_driver_objects,residency_calls_give_the_driver_the_pipeline_behind_a_stand_infails because the driver gets the shell's address. The other two tests pass.cargo clippy -p xcl --lib --tests: no warnings on the changed lines. The crate fails clippy onmainalready (3approx_constanterrors ingpu/dxil/lower_valu.rs,lower_wide.rs,gpu/recomp/lower.rs).cargo fmt --check: no diffs on the changed lines. The tree is not rustfmt-clean, so only the new items were formatted.Regression run
Same title, 60 s each, same machine, run one after the other. First block:
mainat the PR's merge base (6d12f58a). Second block: this PR's head, clean tree.Not tested
MakeResident/Evict. The fix is only checked with fake objects. The smoke run above is a regression check; it was not checked whether that title reachesMakeResident/Evictwith a stand-in.AI use
scripts/smoke.ps1, unedited.mainwere made with Claude Code (Claude Sonnet 5.5), which also added them to this description.🤖 Generated with Claude Code
@DavidM1911 on GitHub · 2026-11-25 21:54 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!
@SlopTart on GitHub · 2026-11-25 22:49 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 (cold cache): 164 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.Targeted run of
residency_calls_give_the_driver_the_pipeline_behind_a_stand_inandresidency_calls_without_stand_ins_hand_the_driver_the_titles_array: 2 passed.Not tested: retail titles (no title data on this lane, counts only).
AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
@oni-swr on GitHub · 2026-11-26 00:24 UTC · original
Synthetic verification on Windows for head
8b290bf2944d9dd30cfc5c1f234b4cf312975331.cargo build --workspace -j 4passed.cargo test --workspace -j 4 --no-fail-fast -- --test-threads=4 --show-outputreported 1,425 passed, 1 failed, and 46 ignored. Seven skip messages already reflected in Cargo’s counts covered six direct-DXIL subcases and one heap-window test.fuzz_validate_and_gpu_1at seed 722, also reproduced in the preceding run onmainate1d84b7d.XCL_ADAPTERselected the AMD card andXCL_SAMPLE_*was unset.Real-title smoke remains pending. The PR is still a draft.
AI use: Codex (gpt-6.2-sol) ran the verification and prepared this report.
@luckyteagirl on GitHub · 2026-11-26 07:11 UTC · original · reviewed
This removes the Rust shell pointer from the driver call, but replaces it with a native pipeline state object. Microsoft's
MakeResidentcontract andEvictcontract limit residency changes to descriptor heaps, heaps, committed resources, and query heaps; a PSO is not supported even though it implementsID3D12Pageable. A mixed array with a real heap and a stand-in still reaches the native call with an unsupported PSO entry. The fake driver in the new tests records and accepts that array, so it cannot establish the real call's behavior.Could the shell entry be handled explicitly before forwarding the supported objects, and could a real D3D12 device/debug-layer test check the HRESULT and diagnostics for a mixed array? I have not observed a driver failure or run a title; this is an exact-head API-contract review of
8b290bf2944d9dd30cfc5c1f234b4cf312975331. AI-assisted review with Codex.8b290bf294to1838468d04@oni-swr on GitHub · 2026-11-26 13:25 UTC · original
@luckyteagirl Thanks, you're right. A stand-in's backing pipeline is still a PSO, which
MakeResident/Evictdon't support. Stand-ins are now left out of the array before the driver call (head1838468d). The driver gets the other objects in order and its HRESULT is returned unchanged. A call with only stand-ins returns S_OK without a driver call.Tests:
E_OUTOFMEMORYpass-through;The full suite has 1426 passed, 1 failed and 46 ignored. The failure is the existing seed-722 fuzz test (#2115), which also fails on
main.The paired
scripts/smoke.ps1run is still pending, so the PR stays a draft until thexcl-smokeblocks are added.AI-assisted: code and reply by Claude Code (Claude Sonnet 5.5); coordinated by Codex (gpt-6.2-sol) and Claude Code (Claude Opus 5.5).
@oni-swr on GitHub · 2026-11-26 13:36 UTC · original
Added the smoke pair under Regression run:
mainat the merge base (6d12f58a) and this head (1838468d), same title, 60 s each, RX 7800 XT. Head: 1449 frames vs 1342, peak commit 15667 MB vs 15153 MB, no device removals or crashes. Still a draft: the whole suite has not been run on a GPU yet (see Not tested). Run with Claude Code (Claude Sonnet 5.5); blocks pasted unedited fromscripts/smoke.ps1.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.