gpu(native): drop a draw or dispatch that cannot run, not its whole piece #57
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/57"
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?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sandile-0511 on 2026-11-26T11:35:23Z.
What this changes
Two cases made
NativeHost::executerefuse a whole piece for one command, which also dropped the piece's value writes:Both are now dropped by themselves, counted (
unset_roots(),no_targets()) and logged once. Any other error still refuses the piece, sounmapped_title_address_is_refusedis unchanged. This follows the existing rule for refused pipelines ("drops its work and nothing else").What the console gives a shader in root slot 255 is not known; the comment says so. The match on the error text (
NEVER_SET) is a string check; a typed error would be cleaner if you prefer that.How it was tested
cargo test -p victory-gpu --libon arm64: 147 passed, 0 failed, 1 ignored. New tests, both on Metal:a_dispatch_with_an_unset_root_parameter_is_dropped_aloneanda_draw_with_no_render_target_is_dropped_alone; each checks that the value write recorded with the dropped command still lands.cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings(clean, run on a Mac)cargo xtask policy(365 files ok)Checklist
VICTORY_*variable and documented (two warn-once lines, no new switch)Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T11:51:46Z.
Review: CHANGES_REQUESTED
Keeping the value writes is the right fix for the queue stall. Please preserve the pass boundary when dropping a command. Two same-target draws around a dropped dispatch can now share an encoder and lose the fence that orders their pool-buffer accesses (
host.rs~892–929,victory-metal/src/gfx.rs~841–859). A producer/consumer test across that boundary would cover it. Please also gate the new warnings behindVICTORY_TRACE_TARGETSand document the fallback indocs/native-host.md.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sandile-0511 on 2026-11-26T12:30:41Z.
A dropped command now still ends the pass it would have ended. While filtering, each kept command records whether a command dropped just before it would have separated it from its predecessor, and grouping does not extend a pass across that. It is exact: a draw dropped between two draws to the same targets parts nothing, as before.
Two tests cover it, including your case (clear, draw, dropped dispatch, draw to the same target). To be straight about what they prove: with the fix off they fail on the pass count (a new
passes()counter), not on pixels or data. I could not provoke the ordering problem itself on this GPU, and no fixture has a draw that writes a pool buffer. The warnings are gated behindVICTORY_TRACE_TARGETSand the fallback is documented under "Dropped work is logged loudly".Not done: the two counters are per host and are not in the "native draws so far" line, since that line reads global atomics without the title lock. Work dropped at record time (no host pipeline, mesh, indirect) may lose a boundary the same way; that predates this PR and I can open an issue for it.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T12:48:33Z.
Review: APPROVED
Thanks: the pass boundary is kept (mutating
cutfails both pass tests), the warnings are gated and the fallback is documented. Approved. Follow-up nits: assert a pass-count delta rather than the cumulative 3, and update the "logged loudly" docs heading now that drops are quiet by default.