gpu: a compiler crash spends the rest of the frame's pipeline budget #318
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/318"
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 ShadyUnderLight on 2026-11-27T11:15:15Z.
Refs #181
What and why
Issue #181: Metal's compiler service crashes on a few world pipelines, and each crash costs the frame about 0.85 s while Metal retries. #263 fixes the cause for the mesh and pixel pairs it dumped (invalid IR from the export order). This is the safety net the issue asks for on top of that fix: a crash must not be paid for again and again inside one frame.
Measured on one run of
main(commit38786fd, macOS 27.2.1, M5 Max, series-x, cold crash cache): nineXPC_ERROR_CONNECTION_INTERRUPTEDrefusals all landed inframe~2259, from 05:19:27.027 to 05:19:34.304 — 7.3 s of one frame, about 0.85 s each, all of it spent waiting for compiles that died. The frame cannot advance meanwhile, and the title's own watchdog is 30 s.What changed
victory_metal::is_compiler_crashis public. It is the predicate the crash cache already used (XPC_ERROR_CONNECTION_INTERRUPTED,Compiler encountered an internal error): Metal's compiler dying on the pipeline, not a shader the host cannot run.prewarm::FrameBudgetgainsspend()andspent_by_crash(). A frame can now be spent before its 10 s of wall time:left()is zero for the rest of it, and the next frame starts whole.glue::compile_failed(name, error): when a compile ends in a compiler crash it spends the rest of the frame's budget and warns once a frame (a compile crashed Metal's compiler; no new pipelines this frame).glue::compile_wait: a frame that a crash spent returns zero — it does not hand out the 20 msARCHIVEDwindow that a frame merely past its time still gets. The compiler service is usually down for the rest of such a frame, and that window let 12 pipelines of one frame be refused within 0.22 s, each cached as refused and remembered byremember_crashas a crash of its own.Errarms ofTitle::make_renderandTitle::make_computecall it.docs/native-host.md: the compiler-crash section says so, with the numbers.Nothing else changes:
FIRST_BIND_BUDGET(10 s),COMPILE_DEADLINE(60 s) and the wait that a frame past its time gets are untouched, and a pipeline whose compile failed with a host error is refused exactly as before.Tests
prewarm::tests::a_spent_frame_starts_the_next_one_whole: a crash-spent frame reports zero for the rest of it andspent_by_crash(); a frame merely past its time does not; the next frame clears both.native::glue::a_compiler_crash_spends_the_frame_budget: the real XPC text spends the frame; a non-crash refusal (a target format the host does not know) does not.Both fail without the change: the spend was removed and then the classification was removed, each time the relevant assertion failed, then both were restored.
Verification on a real run
Same machine, headless,
series-x, cold crash cache, 230 s:38786fd): 9 crashes in one frame over 7.304 s, as above.frame 2347(vertex a1785729710c22b3 pixel 80b896aafd2ec5f4, after a 677 ms mesh compile) spends the budget, and the frame's next pipelines are put off within 22 ms (put_off=1,2,4in the log). The 16 frames that logged the warning had no second paid crash. Refusals that follow a crash in the same frame, once the service is down, come back instantly (11 of them in 47 ms) instead of waiting about 0.85 s each.That run also ended with no GPU error and no watchdog line, but it was killed by the timer at 230 s and reached frame 2103 against 2334 in the run it is compared with, so I am not claiming that as an effect of this change.
cargo test -p victory-gpu -p victory-metal -p victory-shader(native arm64): 321 / 33 / 12 / 14 / 332 passed, 0 failed.cargo clippy --workspace --all-targets --target x86_64-pc-windows-gnullvm -- -D warnings: clean.cargo xtask policy: 371 files ok.mainatce2b7860is merged in, and the checks above are on the merged tree.Not addressed
remember_crashas if they had crashed on their own. That is existing behaviour onmain; this change only reduces how many are attempted. Skipping the record when the frame was already spent by a crash would be a separate change.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T11:54:14Z.
Thank you for taking the second half of #181 and for writing down what the change does not fix.
Two questions before it leaves draft.
ce2b7860and post the same two numbers (crashes in one frame and time spent).I have not run it. Counts and ids only, as before.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T13:36:27Z.
This is on main as of
b639c175, merged from the head before your latest push, so GitHub still shows the PR open. Your commits are in the history under your name. Checked as part of a batch of nine PRs on main60baf130: tests, Windows clippy, policy, a full-corpus comparison and one world run (240 s, no crash, no GPU errors, scene colour lit).If your new head has changes beyond a rebase, please rebase it onto main so only those remain; otherwise please close this. Thank you.
On my question about whether other pipelines ever get their turn: a remembered crash is refused with a message that is not counted as a crash, so it does not take the frame's budget again. That answers it.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by ShadyUnderLight on 2026-11-27T13:43:25Z.
Thank you — I see
3a03e6edinmain(merged as5cdb9e05), so the fix is in and there is nothing left to review here.The only thing in this head beyond that merge is the diagnostic line I added while working on your put-off/made question: the frame log had no pipeline counters. I have split that out as its own change against current
main: #350. Nothing else remains, so I am closing this one.On the remembered crash: agreed, and thank you for checking it. That refusal comes from the crash memory, its message is not one of the two a crash is recognised by, so it does not spend the frame budget again and the frame.s other pipelines get their turn.
Pull request closed