Repository navigation
Conversation
Command lists that call SetPredicationBufferX lazily allocate a PC ID3D12Resource predication buffer. When list_x::on_release removed a released list or list_x::on_create overwrote an entry at a reused command-list address, dropping that pred_buf synchronously inside COM Release could destroy the resource while previously submitted GPU command lists still referenced it. Extend late_release with hold_pc_resources so list_x::on_release and on_create defer pred_buf drops outside the LISTS lock until every known queue has passed the batch fence.
Contributor
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a console command list calls
SetPredicationBufferX, XCL creates a dedicated PC buffer (pred_buf) on the fly to hold the predicate value during recording. Previously, when that command list was released (on_release) or another command list was created at the same memory address (on_create), the old tracking entry and itspred_bufCOM reference were dropped synchronously on the CPU — even if earlier GPU submissions referencing that buffer were still in flight.This change defers dropping those PC-owned
pred_bufresources behind GPU completion fences usinglate_release, matching the lifetime guarantee already enforced for title-owned resources: once retired outside the command-list tracking lock,pred_bufstays alive until every known GPU queue has passed a signalled batch fence, and then drops outside theHELDlock (dropping at once when no queues are active or whenXCL_LATE_RELEASE=0).What is in it
crates/xcl/src/hle/d3d12x/late_release.rs: extendHeld/Batchwithopen_pc/dead_pc(Vec<ID3D12Resource>), addHeld::drain_all, extractensure_thread, addpub(super) unsafe fn hold_pc_resources, releasegone_pcoutsideHELDindrain_known, and add GPU/unit testsheld_pc_resources_wait_until_the_queue_is_past_their_batchandwithout_queues_held_pc_resources_go_at_oncecrates/xcl/src/hle/d3d12x/list_x.rs: addretire_pred_bufand passold.pred_buf.take()fromon_createandon_releaseoutside theLISTSlock, plus GPU teston_release_and_on_create_retire_pred_buf_until_queue_passesTested
rustc 1.100.0 (0ef1bc386 2026-11-09)cargo test -p xcl --lib ... -- --test-threads=1):hle::d3d12x::late_release::tests4 passed / 0 failed / 0 ignored;hle::d3d12x::list_x::tests30 passed / 0 failed / 0 ignoredcargo test --workspace --no-fail-fast -- --test-threads=4: 1155 passed, 2 failed (only pre-existinggpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1seed 722 andfuzz_validate_and_gpu_3seed 1599 reproduced on unmodifiedorigin/main6020a33b, tracked in DXIL fuzz tests: fuzz_validate_and_gpu_1 fails on AMD (seed 722 and others, RDNA2-4), so the default suite is red there #2115 / Direct DXIL: geometry mode, MSAA loads and directed f32 rounding #1679), 46 ignored across 21 test targets (debug build)SKIPPEDtests: gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's)); gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's)); gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's)); gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's)); gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's)); gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's)); heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows; shaders::tests::pso_measurement_compiles_an_exact_synthetic_record: cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D)cargo build --release -p xcl) and 60 s retail title run (5ec87c56) completed cleanly with 0 device removals and 0 crashes; peak commit was 17029 MB vs 19090 MB onmainRegression run
Not tested
SetPredicationBufferX, NVIDIA GPUs, Intel Arc GPUs, wave32-only GPUs, and Linux/WineAI use
late_releasefor owned PC resources, wiringlist_x::on_create/on_releaseretirement outside the lock, adding the unit and GPU tests, running the test suite and smoke runs, and drafting this description. All builds, tests, and regression runs were executed locally on the hardware above.