Repository navigation
gpu/pipeline: reject empty descriptor source joins in bound_view_stores (D3D12-GPU-BOUND-STORES-EMPTY-LEAVES) - #2892
Conversation
|
Verified on native Windows 11 (MSVC target, rustc 1.98.1), since the runs in the description are under Wine. Head
The test catches the change. With Not checked: the full GPUs tested: n/a (CPU unit tests only). AI-assisted: yes (Claude Code). |
KelboLive
left a comment
There was a problem hiding this comment.
The guard is sound and minimal: leaves() is non-empty for Loaded/Built (resource.rs:101-110), so single-source descriptors still pass, while empty Phi/Select/LanePhi joins now fail closed — and the loss is visible through BOUND_SAID, undeclared_why and batch closure rather than silently dropped. Extracting bound_view_stores (pipeline.rs:599-650) so the proof can be tested directly is the right move, and deleting !leaves.is_empty() && fails the new test exactly at pipeline.rs:1382 (unproven descriptor: LanePhi { block: 0, args: [] }). 632/0/59 on the crate, merge clean against current main.
Two follow-ups worth doing in this PR or a note:
- Make the test case reachable in practice.
per_lanereally can emitLanePhiwith every argNone(resource.rs:1954-1976), so a captured real shader/pipeline would be stronger than only the synthetic overwrite — the test currently proves the predicate, not that the tracker produces such a join. - The same vacuous
.all()overleaves()sits atemit/lower.rs:9185and:9771. If empty joins are reachable there, the class is only half closed; either audit those two sites or reject empty joins where they are built.
One correction to the body: #2868 is not zero-overlap at file level — it also edits pipeline.rs (+199), and the two conflict textually where both append tests to bound_tests (merge-tree against its head exits 1). Semantically orthogonal and trivial to resolve by keeping both, but "zero overlap" will mislead whoever merges second. Against current main alone, this is clean.
Claimed in the coordination issue as:
D3D12-GPU-BOUND-STORES-EMPTY-LEAVES.What and why
Close a vacuous-truth soundness bug in
stores_in_bound_views(d3d12/crates/leonida-gpu/src/pipeline.rs): require at least one leaf descriptor source (!leaves.is_empty()) before declaring a buffer store or atomic bound.main,stores_in_bound_viewschecks:Iterator::allreturnstrueon an empty iterator, any descriptor whose tracked source has zero leaves — such asSource::LanePhi { args: [] },Source::LanePhi { args: [None, None] },Source::Phi { args: [] }, orSource::Select { args: [] }— vacuously evaluated totrueand was misclassified as provably bound forLEONIDA_INDIRECT_BATCH=4.bound_view_stores(program, &p, &res)fromstores_in_bound_viewsso tracked IR edge cases can be unit-tested directly.let leaves = d.source.leaves(); !leaves.is_empty() && leaves.into_iter().all(declared).d3d12/crates/leonida-gpu/src/pipeline.rsand keepsstores_bound() -> boolsignature unchanged — zero overlap withenlight3d's#2868(D3D12-BATCH-HEAP-READS, which touchesdraw.rs+indirect/batch.rs) or#2569.d3d12/crates/leonida-gpu/src/pipeline.rs) + red→green unit test + MEASURED 300 s in-world Option-A roam gate.Tested
python3 -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/pipeline.rs→ exit 0.leonida-gpuunit test binary (x86_64-pc-windows-msvc) and ran under Wine:origin/main(withbound_view_storesextracted preservingorigin/main's.all(declared)logic and the new testbound_view_stores_rejects_empty_joins_and_missing_descriptors):2e7c3467d(rebased onto3e7b34a52):pipeline::tests::3 passed; 0 failed.)2e7c3467d, Series S + DLSS Quality1280×720 → 1920×1080,LEONIDA_INDIRECT_BATCH=4, Option Amods/gate_drivermode = roam):310.70 sin-world after world entry at66.99 s; also passed an earlier cold-cache 310.19 s run with0errors).1,708frames after +60 s (1,796total world presents),10.52median FPS (12.26end median FPS),394.52 msp95 frame time,4.022 slongest present gap (<= 10.0 s).6,759 MiBpeak VRAM (<= 7,400 MiB),0device losses (0x887A0005),0crashes,0panics,0faults before stop,0kernelNVRM: Xiderrors.GATE CONTROLreached att = 70.0 s(moved = 7.63 m,mode = roam),32GATE MARKroam ticks,0GATE FAIL.GPUs tested: NVIDIA GeForce RTX 3070 Ti 8 GB, driver 620.73.04, Arch Linux (Wine 11.22 + VKD3D-Proton 3.2.0).
AI-assisted: yes (authored by Gemini 4 Neon; reviewed in a separate independent review pass by Gemini 4 Neon).
Checklist
main(3e7b34a52) and merges cleanly (a conflicting pull request is labeledneeds rebase).check_no_game_data.pyclean on both source and PR description).docs/design.md, with how it was confirmed. (n/a — GPU bound-store proof soundness fix)