Repository navigation
Shaders: stop startup shader preparation promptly when cancelled - #2830
Flamingo572 wants to merge 1 commit into
Conversation
|
RX 9070 / Wine release check of the cancellation primitives, paired with main. Tested
Original module
Both new cancellation tests ran without capability skips. The existing stale-cap regression also dispatched its synthetic control and verified Observed wait and native controls Three fresh serial processes per source, alternating source order. The local probe compiles three owned HLSL inputs: two split pieces and a distinct whole fallback. It calls the inner pipeline helpers directly; it does not launch a preparation window or guest.
For the wait case, both slots are marked busy. The test waits for the observer, sets the cancel flag and watches for return without releasing a slot or externally notifying the CV. Only after return or a two-second observation timeout does it release the slots, notify and join the thread. In every head run it observed return first; in every main run return followed cleanup. Slots were still 2/2 before cleanup and returned to zero afterwards. The uncancelled positive control succeeds on both versions, with identical DXIL and positive-cache filenames/blob bytes across all six processes. No pipeline was refused. The local probe constructs 30 PSOs in total and verifies every 112-byte driver blob. It does not dispatch these three probe shaders; GPU execution above belongs to the separate existing Head probe: 1/0/0 in each process. Main probe: expected 0/1/0, at the final pre-cancelled-build assertion after both controls and blocked-waiter cleanup. All ten completed harness summaries, counters, cache files, source reconstruction and executable hashes were independently checked; no runtime skips or ignored tests. One additional Wine launch failed before libtest with Build: Not tested Cancellation during an in-flight DXC or native driver call, restored-cache cancellation races, the actual preparation UI/guest launch, all multi-record startup loops, other GPUs, native Windows, full suite, retail inputs, AI use OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the diff, added the local probe/observer, ran the original module and paired native checks, independently verified the evidence and drafted this report. Publication authorized by the account owner. |
|
Independent Windows verification on exact head
The launcher preparation window and these checks share the cancellation flag. This covered the pipeline and preparation-screen state below the window. The busy-slot fixture uses its timed entry delay. A live window-close run and cancellation during an active native compiler or driver call remain outside this check. |
|
Overlap with #2179 (open), from reading both diffs, no run. #2179 replaces this driver-slot wait in Whichever of the two merges second needs to pass AI-assisted (Claude Code, Claude Opus 5.5). |
Closing the startup shader preparation window (xcl-dev#2555) sets LaunchPreparation::cancel, which precompile() only checked at the outer record loop. Thread the cancellation flag into Pipelines::make_with_cache_path_cancel, Pipelines::make_one (bounded Condvar wait while driver slots are busy), the whole-form split fallback, and the inner FSSM/program/job loops.
069292c to
d6cf64c
Compare
|
Thank you @SzczepanGrela and @CryingLaughing for testing I force-pushed an amended head If anyone with a retail GDK title can run a paired |
Follow-up to #2555. Closing the startup shader preparation window sets
LaunchPreparation::cancel, whichprecompile()previously checked only at the outer record loop. While a split compute shader, a multi-variant record, or a driver slot wait insidePipelines::make_onewas running, cancellation had to wait until those inner loops or driver slot waits finished.What is in it
crates/xcl/src/shaders.rs:is_cancelled(Option<&AtomicBool>)andPipelines::make_with_cache_path_cancel(preservingPipelines::makeandPipelines::make_with_cache_pathunder#[cfg(test)]), checking cancellation before and during split compute piece builds.Option<&AtomicBool>intoPipelines::make_one, using a bounded 50 msCondvar::wait_timeoutwhile driver build slots are busy and exiting early before uncachedCreateComputePipelineStatebuilds.startup.map(|p| &p.cancel)inprecompile()across compute builds, the whole-form split fallback, completion counters, and innerfssm/programs/jobsloops.pipeline_cap_tests(cancelled_split_compute_build_skips_pieces_and_writes_no_blobsandcancelled_pipeline_waiter_exits_while_driver_slots_are_busy), usingrecomp::runner::skip_testwhen DXC/D3D12 is unavailable.Tested
d6cf64c19c6b38e31e3f2df31631481fcf6e56b0(amended from069292cadbe4fa31e19b2b282b25325ae6eaf0d8to add#[cfg(test)]onmakeandmake_with_cache_path, clearing thedead_codewarning).32.0.16.1742), AMD Ryzen AI 7 350 w/ Radeon 860M (AMD Radeon 860M driver32.0.22042.8003), Windows NT 10.0.26300.0,rustc 1.100.0 (0ef1bc386 2026-11-09)(stable-x86_64-pc-windows-msvc), Windows SDK DXC1.9.2602.17(10.0.26100.0), debug.cargo build --workspace: exited 0 (0 warnings incrates/xcl/src/shaders.rs).cargo test -p xcl --lib pipeline_cap_tests -- --nocapture: 5 passed, 0 failed, 0 ignored (0 skipped; both newcancelled_*tests ran on NVIDIA GeForce RTX 5060 Laptop GPU).cargo test -p xcl --lib -- --skip fuzz_validate_and_gpu --test-threads=4: 1316 passed, 0 failed, 27 ignored (SKIPPEDGPU tests: 21no wave64, 3 refused per-lanef16/f32forms, 1shaders::tests::pso_measurement_compiles_an_exact_synthetic_recordcannot disable the driver cache (Windows Developer Mode is required)).cargo test --workspace --test '*' --no-fail-fast -- --test-threads=4: 128 passed, 0 failed, 20 ignored (SKIPPED: 2 debug-layer e2e testsno d3d12SDKLayers.dll, 1heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows, 1uploads_start_from_each_subresources_state: no D3D12 debug layer)..\scripts\test.ps1on069292castopped inxcl --libbecausegpu::dxil::fuzz_tests::fuzz_validate_and_gpu_{0,1,2,3}hit pre-existing RTX 5060CreateComputePipelineStateE_OUTOFMEMORY(0x8007000E) on seeds 70, 545, 1019, and 1507 (DXIL GPU fuzz tests reproducibly fail with E_OUTOFMEMORY on RTX 5060 #1905), including serially (--test-threads=1).Regression run
Pending Windows 11 run of
scripts/smoke.ps1onmain(8b957bec) and PR headd6cf64c19c6b(no retail GDK title available locally).Not tested
scripts/smoke.ps1regression run on a real GDK title (no retail title available locally).gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_{0..3}on headd6cf64c19c6b(skipped due to pre-existing RTX 5060E_OUTOFMEMORY, DXIL GPU fuzz tests reproducibly fail with E_OUTOFMEMORY on RTX 5060 #1905).XCL_SAMPLE_*game-data tests (unset), wave64-only / AMD RDNA GPUs locally (@SzczepanGrelapreviously tested069292caon RX 9070 / Wine), D3D12 debug layer tests (d3d12SDKLayers.dllnot installed).acquire_running()/OfflineGate) noted by@upipibi; whichever merges second will need to wirecancelinto those waits.AI use
crates/xcl/src/shaders.rs, and opened the initial draft PR.#[cfg(test)]to clear thedead_codewarning, re-verified tests, and updated this PR description.