D3D12.X: PC CreateCommandList gives the driver the pipeline behind a stand-in #2861
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!2861
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2861"
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-26 19:41 UTC · original
oni-swr:t3/xcl-2455-pc-ccl-1126t→main· +218 −3 · 2 files · 2 commits · draftPart of #2455 (the PC
CreateCommandListitem; MakeResident/Evict are #2523, StorePipeline is #2853).A title that calls the PC
ID3D12Device::CreateCommandListwith a stand-in pipeline (standin::Shell) aspInitialStatehad that pointer forwarded toD3D12Core.dllunchanged, but the shell is not a driver object. The override now passespInitialStatethroughpso_async::resolve: the built pipeline if there is one, else the driver pipeline the stand-in shares, else the pointer as it is (null, ordinary pipelines).create_raw_pc_command_listdoes the same on its direct-to-driver path.Judgement call:
resolve, notresolve_for_bind. It never waits for a build still running (the caller is the title's thread), the same choice #2548 makes for Reset/KickoffX/the console-device CreateCommandList indevice_x.rs. The list's first bind of the stand-in goes throughbindas before, so lazy / async compile behaviour is unchanged. #2548 does not touchreal.rs, so there is no overlap.What is in it
crates/xcl/src/hle/d3d12x/real.rs:dev_create_command_listbecomes a wrapper that resolvesa4before thecreator!forwarder;create_raw_pc_command_listresolvesinit_psoreal.rscreate_command_list_standin_tests: 4 CPU tests with a fake driver table (pending stand-in gives the shared driver pipeline without waiting; built stand-in gives the built pipeline; null / driver pipeline unchanged; raw path)Tested
XCL_ADAPTER=NONE_CPU_ONLY), no GPU test run. Windows 11, stable MSVC, debug.cargo test -p xcl --lib -j 4 create_command_list_standin: 4 passed, 0 failed, 0 ignoredresolvecalls removed: 1 passed, 3 failed (the driver got the stand-in's address)cargo check --workspace --tests -j 4: finished, no errorsRegression run
scripts/smoke.ps1onmainand on this head needs the RX 7800 XT, which is in use by another job. Draft until bothxcl-smokeblocks are pasted here.Not tested
cargo test --workspaceand any GPU test (SKIPPED / GPU counts unknown)scripts/smoke.ps1or any retail title; AMD and NVIDIAAI use
🤖 Generated with Claude Code
@luckyteagirl on GitHub · 2026-11-27 06:35 UTC · original · reviewed
Can the PC
CreateCommandListpath preserve the requested initial PSO when a caller records work without rebinding it?pInitialStateis already a bind. A legal caller can supply a PSO there and issue its first draw or dispatch without ever callingSetPipelineState. If the build is still pending at creation, the new wrapper forwards the shared dummy to the driver. Completing the build afterward updates the stand-in's lookup entry, but nothing in this path updates the PSO on the native list. The first work can therefore still use the dummy. The fake driver in the new test returns failure immediately, so it checks pointer safety but does not exercise a list that successfully records with the initial state.The PC
Resetoverride already usesresolve_for_bind, which waits for compute PSOs. Can creation use at least the same handling for pending compute PSOs and define how graphics work recorded with a pending initial PSO gets rebound before it executes?Creation wrapper · PC Reset · D3D12 initial pipeline state
AI-assisted review (GPT-6.2 Sol).
@oni-swr on GitHub · 2026-11-27 06:53 UTC · original
Thanks, this is right for the creation path. Fixed in
e235f13c.Behaviour chosen: wait.
pInitialStateis a bind that nothing repeats, sodev_create_command_list(and the title path increate_list, and the raw split-segment list) now resolve it withresolve_wait, for graphics pipelines too, not only compute ones. A failed build, orXCL_PSO_WAIT_MSrunning out, still gives the driver the shared pipeline as before. A title list's first draw already waits for its tracked pipeline (bind::graphics_bound), so for a list that draws this moves the wait to creation rather than adding one. I did not add a deferred rebind: it needs per-list state and hooks in every draw / dispatch / execute path. Compared with Reset, which does not wait for graphics, this is stricter on purpose.Tests (
create_command_list_standin_tests):a_pending_stand_in_as_the_initial_state_is_waited_for_and_the_driver_gets_the_built_pipeline(graphics and compute).a_list_made_with_a_pending_initial_state_records_with_the_built_pipeline: the fake driver now succeeds and hands out a list XCL adopts, so a list really records with the initial state (the gap you named).a_failed_stand_in_as_the_initial_state_gives_the_driver_its_shared_pipeline.Tested on the PR branch (CPU only,
XCL_ADAPTER=warp):cargo test -p xcl --lib hle::d3d12x: 266 passed, 0 failed, 2 ignored.cargo clippyreports nothing on the changed lines. The PR still has no title smoke pair, so it stays a draft. Not tested: a real title, and a long-building graphics pipeline at creation (the hitch it could add).AI-assisted (Claude Sonnet 5.5).
@SzczepanGrela on GitHub · 2026-11-27 07:21 UTC · original
RX 9070 / Wine check of the initial-PSO behavior at
e235f13ce82c053db6321eadcb5080841feef54e, compared with main83b008188efbf954b846667f48d75e3fa9310a01and a conflict-free application of the two-file PR diff to that main. Source copies had test-only instrumentation, so these are focused synthetic results.Tested
RX 9070 16 GB, RADV GFX1201 / Mesa 26.3.1, Ryzen 7 7700, CachyOS 7.3.0-5, GE-Proton11-12 / Wine 11.0 Staging, vkd3d-proton
8293130ebe370b1+with local asserts-disabled build, DXC/DXIL 1.9.2602.17. Windows-GNU release tests, Rust 1.97.1. Network off, adapter selected explicitly, private enabled caches,XCL_PSO_WAIT_MSunset.cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run, then the resulting PE under Wine:hle::d3d12x::real::create_command_list_standin_tests --nocapture --test-threads=1and=4: head and integration each 6 passed, 0 failed. The same six unchanged test bodies copied to main give 1 passed, 5 failed, for both thread counts.hle::d3d12x::real::workflow_initial_native::workflow_initial_psos_execute_without_rebinding --exact --nocapture --test-threads=1: three fresh full runs per source, plus one pilot per source. All harnesses completed. Zero ignored or skipped tests.The GPU fixture covers the raw-PC helper and adopted-device PC wrapper, each with compute and graphics initial PSOs. It uses a native PSO as an async lookup key for paired controls: pending lazy success, already completed success, failed job with shared fallback, and an ordinary PSO. A pending job returns an already constructed target PSO after a controlled 30 ms delay. Main's job is completed after list creation but before recording work. No
SetPipelineStateis called. Genuinestandin::Shellsuccess/failure cases also execute on head and integration.Results: 219 GPU work cases, including 111 physical-wave64 compute dispatches and 108 draws. Head and integration select the expected driver PSO and produce the expected data throughout. On main, 24 full-matrix cases plus the pilot retain the earlier PSO instead of the requested completed one: compute lane 0 writes
0xd00d0000instead of42, and graphics writes(1,0,0.5,1)instead of(0.25,0.5,0.75,1). Ordinary and failed-build fallback controls work on all sources.A separate Python oracle checked all 126,576 readback words, including compute guards, every lane's wave width and every 16×16 RGBA32F pixel, plus 237 captured native creation arguments. Fresh repeats and head/integration outputs match. No device removal occurred.
Not tested
Retail workload, smoke run, full suite, native Windows, actual pending shader translation/driver compilation, wait-budget expiration or hitch/performance impact. Recording uses the native PC list after test-only removal of its adoption hooks, so implicit rebinding cannot mask the initial state. This does not exercise the console
device_x::create_listcaller or full title recording path. Allocators are native; the earlier adopted-allocator0x80070057boundary was not retested. A genuine Shell was not passed to main's native driver.AI use
OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the public source, wrote the synthetic fixture and independent verifier, ran the tests and drafted this report. Publication authorized by the account owner.
@SlopTart on GitHub · 2026-11-27 08:26 UTC · original
Linux (Wine) dual-lane run at
e235f13c: all five new stand-in tests green on both vendor stacks, no regressions.All of
real::create_command_list_standin_tests(a_built_stand_in...,a_failed_stand_in...,a_list_made_with_a_pending_initial_state...,a_pending_stand_in...,a_raw_pc_list_over_a_driver_device...): ok on rig and boxb, both in-suite.Head
e235f13csits on main8b957bec(3 commits behind current tip; merge-base verified) and was compared against same-day baselines for that base (rig 606/2, boxb 605/3). Nothing moved outside the flake.Side note from our amd-dev thread (#2764): the shader stand-in build path is where our Wine deadlock repro lives (
dispatch 17 waited for the build); youra_pending_stand_in...is_waited_for...case passing here is at the main tree, not the amd-dev queue rework, so don't read this as confirming that side.Suite:
cargo test --release --locked -p xcl --lib --target x86_64-pc-windows-gnu -- --test-threads=2 --skip gpu::.AI use: Hermes agent (local Qwen-class) ran the tests and drafted this; I checked it before posting.
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.