compile gate: adaptive per kind of create, re-armed by a held submission (RT-COMPILE-GATE-ADAPTIVE) #2412

Merged
OreoFR merged 9 commits from upstream-pr/2412 into main 2026-11-27 12:02:22 +00:00
OreoFR commented 2026-11-26 23:42:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-26T23:42:14Z.


Claimed in the coordination issue as: RT-COMPILE-GATE-ADAPTIVE

Depends on: none. It conflicts textually with #2275 (RT-COMPILE-GATE-WARMUP-FREE, same SubmitMutex code). Whichever lands second takes both; I will rebase on #2275 if it goes first.

What and why

The compile gate (#2098, SubmitMutex in runtime/src/vulkan_device_fault.h) holds every queue submission while a pipeline create is in the driver, however long the create takes. It was measured on NVIDIA 630.20, where a submit that enters beside a long compute create is lost after about 10 s. On other drivers it mostly costs time:

  • RTX 4070 Laptop, NVIDIA 621.40: one demanded 2.3 MB library compute create sat 54+ s in the driver. No submission went through, the title's fence stopped, and its hang watchdog ended the run (+0x23cf683).
  • @MoonEyes, RTX 4060, NVIDIA 610.88, watchdog kicked: 814,287 ms of 895 s (91 % of the run) waiting behind creates, mostly small warm-up programs. The gate never let go.

Also found: on main, graphics and mesh creates never went through the gate. Only vkCreateComputePipelines did; PipelineState::build called the driver directly. On 621.40 that is where the hazard actually showed:

  • with the gate off, a cold 541 KB mesh pipeline create took 55.7 s, a submit sat 54.2 s in the driver beside it, then VK_ERROR_DEVICE_LOST;
  • in another run, a submit sat 7.8 s beside a 1.78 MB mesh create, then the same loss.

What this changes

The gate becomes adaptive, with one verdict per kind of create (compute, graphics including mesh). Graphics creates now go through the gate too.

  • Bounded wait while a kind is undecided. A submission goes ahead once the gate waits of the last 10 s add up to LEONIDA_COMPILE_GATE_PROBE_MS (2,500 ms by default), or after LEONIDA_COMPILE_GATE_WAIT_MS (15 s) for one wait. That submission is a probe.
  • Verdict. Two quick probes, each under 250 ms and at least 1 s apart, with a create of that kind still in the driver when they return, turn the gate off for that kind for the rest of the run. A probe held 2 s or more marks the kind as holding: submissions then wait for its creates however long they take. The bounded go-ahead never enters beside a create of a holding kind.
  • Re-arm. A kind that is off is still timed. A submission that stays 2 s or more in the driver beside one of its creates turns that kind back on, logged once.
  • Device-loss report. On the first device loss, VulkanContext::mark_device_lost logs the gate state per kind and every create in the driver: kind, program, bytes, trigger, thread, time in the driver.
  • Switches.
    • LEONIDA_COMPILE_GATE unset: adaptive (new default).
    • =1: the old gate. It always waits with no limit, never probes, and compute builds hold the submit lock.
    • =0: off.
    • LEONIDA_COMPILE_GATE_WAIT_MS=0: waits with no limit.
    • runtime/README.md and docs/d3d12_vulkan.md describe them. The README row for LEONIDA_COMPILE_GATE also had the default wrong.
  • Tradeoff on a driver that holds (630.20). The first probe of a kind now enters the driver after about 2.5 s of waiting instead of never. If that create then stays another 10 s, that driver loses the device, at most once per run per kind: the probe returns a held verdict 2 s in. LEONIDA_COMPILE_GATE=1 keeps the old protection.

Tested

  • submit_mutex ctest passes with the gate unset, with =1, with =0 and with WAIT_MS=0. It has new cases for the bounded wait, the probe budget, the adaptive switch, per-kind verdicts, re-arm and the loss report. scripts/check_no_game_data.py is clean on all changed files.
  • Retail story load, RTX 4070 Laptop 8 GB, NVIDIA 621.40, shaders retranslated with main, runs of 450-600 s:
Build / gate Waiting behind creates Result
main gate (=1) 130 s, longest 21.7 s no loss in that run; stalls up to 14.5 s
bounded only, 15 s limit 90 s of 3-7 s waits back to back watchdog at 433 s, gate never adapted
adaptive, compute only (a3404f5a4) 2.6 s off at 279 s, no loss in 450 s (one other run: loss beside an ungated mesh create)
this PR (f7b249730) on main d1dff7949 5.2 s graphics off at 199 s (581 probes ≤ 112 ms), compute off at 250 s (1,969 probes ≤ 11 ms), no device loss
  • @MoonEyes, RTX 4060, NVIDIA 610.88, on a3404f5a4: off at 53.6 s after 133 probes ≤ 12 ms, 4,800 ms of waiting instead of 814,287 ms, 900 s with no device loss.
  • Not seen in a game yet: a re-arm, and a held verdict for graphics. Both need a cold create that holds a submission, and the long mesh creates were cached by then. They are covered by the unit test only. More runs on other GPUs (RTX 5070, RTX 5080) are coming, and I will add them here.

GPUs tested: NVIDIA GeForce RTX 4070 Laptop 8 GB, driver 621.40, Windows 11; NVIDIA GeForce RTX 4060, driver 610.88, Windows (MoonEyes).

AI-assisted: yes (Claude Code, Claude Opus 5.5)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: runtime only)

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5518679274 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2412). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-26T23:42:14Z. --- Claimed in the coordination issue as: [RT-COMPILE-GATE-ADAPTIVE](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7204465193) Depends on: none. It conflicts textually with #2275 (RT-COMPILE-GATE-WARMUP-FREE, same `SubmitMutex` code). Whichever lands second takes both; I will rebase on #2275 if it goes first. ### What and why The compile gate (#2098, `SubmitMutex` in `runtime/src/vulkan_device_fault.h`) holds every queue submission while a pipeline create is in the driver, however long the create takes. It was measured on NVIDIA 630.20, where a submit that enters beside a long compute create is lost after about 10 s. On other drivers it mostly costs time: - RTX 4070 Laptop, NVIDIA 621.40: one demanded 2.3 MB library compute create sat 54+ s in the driver. No submission went through, the title's fence stopped, and its hang watchdog ended the run (`+0x23cf683`). - @MoonEyes, RTX 4060, NVIDIA 610.88, watchdog kicked: 814,287 ms of 895 s (91 % of the run) waiting behind creates, mostly small warm-up programs. The gate never let go. Also found: on `main`, **graphics and mesh creates never went through the gate**. Only `vkCreateComputePipelines` did; `PipelineState::build` called the driver directly. On 621.40 that is where the hazard actually showed: - with the gate off, a cold 541 KB mesh pipeline create took 55.7 s, a submit sat 54.2 s in the driver beside it, then `VK_ERROR_DEVICE_LOST`; - in another run, a submit sat 7.8 s beside a 1.78 MB mesh create, then the same loss. ### What this changes The gate becomes adaptive, with one verdict per kind of create (compute, graphics including mesh). Graphics creates now go through the gate too. - **Bounded wait while a kind is undecided.** A submission goes ahead once the gate waits of the last 10 s add up to `LEONIDA_COMPILE_GATE_PROBE_MS` (2,500 ms by default), or after `LEONIDA_COMPILE_GATE_WAIT_MS` (15 s) for one wait. That submission is a probe. - **Verdict.** Two quick probes, each under 250 ms and at least 1 s apart, with a create of that kind still in the driver when they return, turn the gate off for that kind for the rest of the run. A probe held 2 s or more marks the kind as holding: submissions then wait for its creates however long they take. The bounded go-ahead never enters beside a create of a holding kind. - **Re-arm.** A kind that is off is still timed. A submission that stays 2 s or more in the driver beside one of its creates turns that kind back on, logged once. - **Device-loss report.** On the first device loss, `VulkanContext::mark_device_lost` logs the gate state per kind and every create in the driver: kind, program, bytes, trigger, thread, time in the driver. - **Switches.** - `LEONIDA_COMPILE_GATE` unset: adaptive (new default). - `=1`: the old gate. It always waits with no limit, never probes, and compute builds hold the submit lock. - `=0`: off. - `LEONIDA_COMPILE_GATE_WAIT_MS=0`: waits with no limit. - `runtime/README.md` and `docs/d3d12_vulkan.md` describe them. The README row for `LEONIDA_COMPILE_GATE` also had the default wrong. - **Tradeoff on a driver that holds (630.20).** The first probe of a kind now enters the driver after about 2.5 s of waiting instead of never. If that create then stays another 10 s, that driver loses the device, at most once per run per kind: the probe returns a held verdict 2 s in. `LEONIDA_COMPILE_GATE=1` keeps the old protection. ### Tested - `submit_mutex` ctest passes with the gate unset, with `=1`, with `=0` and with `WAIT_MS=0`. It has new cases for the bounded wait, the probe budget, the adaptive switch, per-kind verdicts, re-arm and the loss report. `scripts/check_no_game_data.py` is clean on all changed files. - Retail story load, RTX 4070 Laptop 8 GB, NVIDIA 621.40, shaders retranslated with `main`, runs of 450-600 s: | Build / gate | Waiting behind creates | Result | |---|---|---| | `main` gate (=1) | 130 s, longest 21.7 s | no loss in that run; stalls up to 14.5 s | | bounded only, 15 s limit | 90 s of 3-7 s waits back to back | watchdog at 433 s, gate never adapted | | adaptive, compute only (`a3404f5a4`) | 2.6 s | off at 279 s, no loss in 450 s (one other run: loss beside an ungated mesh create) | | **this PR (`f7b249730`)** on `main` `d1dff7949` | **5.2 s** | graphics off at 199 s (581 probes ≤ 112 ms), compute off at 250 s (1,969 probes ≤ 11 ms), no device loss | - @MoonEyes, RTX 4060, NVIDIA 610.88, on `a3404f5a4`: off at 53.6 s after 133 probes ≤ 12 ms, 4,800 ms of waiting instead of 814,287 ms, 900 s with no device loss. - **Not seen in a game yet:** a re-arm, and a held verdict for graphics. Both need a cold create that holds a submission, and the long mesh creates were cached by then. They are covered by the unit test only. More runs on other GPUs (RTX 5070, RTX 5080) are coming, and I will add them here. GPUs tested: NVIDIA GeForce RTX 4070 Laptop 8 GB, driver 621.40, Windows 11; NVIDIA GeForce RTX 4060, driver 610.88, Windows (MoonEyes). AI-assisted: yes (Claude Code, Claude Opus 5.5) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: runtime only) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
nicoco23 commented 2026-11-27 00:32:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by nicoco23 on 2026-11-27T00:32:04Z.

Review: COMMENTED


Static review of the 4 commits on e5a7c89 (not built or run yet; my RTX 5070 run comes tonight). AI-assisted.

Looks solid overall: per-kind verdicts, two quick probes 1 s apart, the 2.5 s / 10 s probe budget and the 15 s cap bound the stall well, the "own" case avoids the self-wait, and report_creates_on_loss is very useful.

One point I'd like your view on:

  • Every SubmitTurn counts as a probe, not only vkQueueSubmit: presents (vulkan_present.h), vkQueueWaitIdle and vkQueueBindSparse too. A present or wait-idle that takes 2 s during heavy loading can mark a kind as "holds" (or re-arm it) without the driver holding a submission behind a create. The other way round, quick presents can count as quick probes and turn a kind off on a driver that would hold a vkQueueSubmit (the 630.20 case).
  • Since f7b249730 a "holds" kind is waited for with no limit (held_blocking() drops the limit and the budget, and is_blocking() ignores overdue_through_). So a false "holds" brings back the unbounded gate for the rest of the run. The header comment still says a false alarm "only keeps the bounded gate, never less protection".

Suggestion: count only vkQueueSubmit (and maybe vkQueueBindSparse) as probes, e.g. a flag on SubmitTurn for presents and idle waits. And/or keep a (longer) bound for a "holds" kind instead of none. At least align the comment.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6081980200 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2412#pullrequestreview-6081980200). Originally posted by [nicoco23](https://github.com/nicoco23) on 2026-11-27T00:32:04Z. **Review:** COMMENTED --- Static review of the 4 commits on e5a7c89 (not built or run yet; my RTX 5070 run comes tonight). AI-assisted. Looks solid overall: per-kind verdicts, two quick probes 1 s apart, the 2.5 s / 10 s probe budget and the 15 s cap bound the stall well, the "own" case avoids the self-wait, and report_creates_on_loss is very useful. One point I'd like your view on: - Every SubmitTurn counts as a probe, not only vkQueueSubmit: presents (vulkan_present.h), vkQueueWaitIdle and vkQueueBindSparse too. A present or wait-idle that takes 2 s during heavy loading can mark a kind as "holds" (or re-arm it) without the driver holding a submission behind a create. The other way round, quick presents can count as quick probes and turn a kind off on a driver that would hold a vkQueueSubmit (the 630.20 case). - Since f7b249730 a "holds" kind is waited for with no limit (held_blocking() drops the limit and the budget, and is_blocking() ignores overdue_through_). So a false "holds" brings back the unbounded gate for the rest of the run. The header comment still says a false alarm "only keeps the bounded gate, never less protection". Suggestion: count only vkQueueSubmit (and maybe vkQueueBindSparse) as probes, e.g. a flag on SubmitTurn for presents and idle waits. And/or keep a (longer) bound for a "holds" kind instead of none. At least align the comment.
OreoFR commented 2026-11-27 01:28:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-27T01:28:13Z.


Pushed e5d1a1468: a held probe now needs the create beside it to have just left. A submission counts as held behind a kind only if it comes back within 500 ms after a create of that kind (one that was in the driver when it entered) leaves. Otherwise it is logged as "not counted as held" and decides nothing.

Why (RTX 4070 Laptop 8 GB, NVIDIA 621.40, main + this PR, documented recipe without the window size):

  • One submission stayed 35.7 s in the driver beside a 58.4 s compute create, but came back 18 s before that create finished. So it wasn't held by the create. The old rule counted it as held and turned the compute gate back on. The gate then kept the next submissions behind compute creates for 18 s and then 78 s ("waits until that create leaves"). Same pattern in a second run: a 2.1 s submission re-armed the gate, then waits of 19.6 s and 13 s followed. MEASURED (n=2).
  • In both runs device-local memory was ~7.7 GB of 8 GB. My guess is that the slow submissions come from memory pressure, not from the creates. ASSUMED; an arena-size A/B is next.
  • A synthetic probe on the same machine (2 MB graphics pipelines of 8-10 s each; 1-3 creating threads; with and without VK_NV_device_diagnostics_config; with and without a shared pipeline cache; small creates on the submitting thread) never held a vkQueueSubmit past 80 ms, in process or out of process. MEASURED (n=1 per case).

Tests: submit_mutex_test passes. The held-probe tests now release the create 100 ms before the submission comes back, and a new case checks that a slow submission with its create still there gives no held verdict. One retail run with the fix: no gate wait over 2.5 s up to a device loss at 306 s (Timeout, no warps in the dump), so the loss doesn't come from the gate. MEASURED (n=1).

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7207313035 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2412#issuecomment-7207313035). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-27T01:28:13Z. --- Pushed e5d1a1468: **a held probe now needs the create beside it to have just left.** A submission counts as held behind a kind only if it comes back within 500 ms after a create of that kind (one that was in the driver when it entered) leaves. Otherwise it is logged as "not counted as held" and decides nothing. Why (RTX 4070 Laptop 8 GB, NVIDIA 621.40, `main` + this PR, documented recipe without the window size): - One submission stayed 35.7 s in the driver beside a 58.4 s compute create, but came back **18 s before** that create finished. So it wasn't held by the create. The old rule counted it as held and turned the compute gate back on. The gate then kept the next submissions behind compute creates for 18 s and then **78 s** ("waits until that create leaves"). Same pattern in a second run: a 2.1 s submission re-armed the gate, then waits of 19.6 s and 13 s followed. `MEASURED (n=2)`. - In both runs device-local memory was ~7.7 GB of 8 GB. My guess is that the slow submissions come from memory pressure, not from the creates. `ASSUMED`; an arena-size A/B is next. - A synthetic probe on the same machine (2 MB graphics pipelines of 8-10 s each; 1-3 creating threads; with and without `VK_NV_device_diagnostics_config`; with and without a shared pipeline cache; small creates on the submitting thread) never held a `vkQueueSubmit` past 80 ms, in process or out of process. `MEASURED (n=1 per case)`. Tests: `submit_mutex_test` passes. The held-probe tests now release the create 100 ms before the submission comes back, and a new case checks that a slow submission with its create still there gives no held verdict. One retail run with the fix: no gate wait over 2.5 s up to a device loss at 306 s (Timeout, no warps in the dump), so the loss doesn't come from the gate. `MEASURED (n=1)`. AI-assisted (Claude Code, Claude Opus 5.5).
ecox982745 commented 2026-11-27 01:47:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-27T01:47:45Z.


At e5d1a14681, a newer compute pipeline finishing can hide the departure that should re-arm the compute gate. The stock submit_mutex_test passed. I tested four additional event orders against the unchanged SubmitMutex header on Windows with MSVC. These are CPU-only tests using separate worker threads, the submit lock, and the real CompileTurn and SubmitTurn objects. No Vulkan driver calls were involved.

Two quick probes first put the compute gate in its off state. Create A was already active when the measured submission began. Create B, when present, began after the submission began. Each row ran three times.

Creates finishing within 500 ms before submission return Expected gate Observed
A alone Re-armed Re-armed 3/3
B alone, with A still active at return Off Off 3/3
B, then A Re-armed Re-armed 3/3
A, then B Re-armed Off 3/3

For example, A finished at 2,080 ms, B at 2,111 ms, and the submission returned at 2,159 ms. A met the 500 ms rule by 421 ms of margin. B replaced A in last_leave_seq_[compute], so the comparison with ahead.last_create discarded the evidence from A.

A regression covering both finish orders would catch this. Tracking the most recent eligible completion for each active probe would preserve A's timestamp while keeping the B-only case off. AI-assisted verification.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7207583497 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2412#issuecomment-7207583497). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-27T01:47:45Z. --- At `e5d1a14681`, a newer compute pipeline finishing can hide the departure that should re-arm the compute gate. The stock `submit_mutex_test` passed. I tested four additional event orders against the unchanged `SubmitMutex` header on Windows with MSVC. These are CPU-only tests using separate worker threads, the submit lock, and the real `CompileTurn` and `SubmitTurn` objects. No Vulkan driver calls were involved. Two quick probes first put the compute gate in its off state. Create **A** was already active when the measured submission began. Create **B**, when present, began *after* the submission began. Each row ran three times. | Creates finishing within 500 ms before submission return | Expected gate | Observed | | --- | --- | --- | | A alone | Re-armed | Re-armed 3/3 | | B alone, with A still active at return | Off | Off 3/3 | | B, then A | Re-armed | Re-armed 3/3 | | A, then B | Re-armed | **Off 3/3** | For example, A finished at 2,080 ms, B at 2,111 ms, and the submission returned at 2,159 ms. A met the 500 ms rule by 421 ms of margin. B replaced A in `last_leave_seq_[compute]`, so the comparison with `ahead.last_create` discarded the evidence from A. A regression covering both finish orders would catch this. Tracking the most recent *eligible* completion for each active probe would preserve A's timestamp while keeping the B-only case off. AI-assisted verification.
OreoFR commented 2026-11-27 01:54:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-27T01:54:03Z.


Thanks both, all three points were right. Pushed b2cccb953:

  • @ecox982745: a later create's leave no longer hides an earlier one. Leaves now go in a ring of 64, and any leave of that kind within 500 ms before the submission comes back counts, as long as the create was in the driver when the submission entered. Your four orders are in submit_mutex_test: A alone, B alone with A still there, B then A, and A then B. Re-armed, off, re-armed, re-armed.
  • @nicoco23, probes: only vkQueueSubmit and vkQueueBindSparse probe now. SubmitTurn takes probe (true by default). Presents, vkQueueWaitIdle, vkDeviceWaitIdle and vkWaitSemaphores pass false: they still wait at the gate, but their time in the driver decides nothing. Test: a 2.1 s present with the create leaving just before leaves the kind pending.
  • @nicoco23, the unbounded wait: a kind that holds is now waited for up to LEONIDA_COMPILE_GATE_HELD_WAIT_MS (60 s, 0 = no limit). After that, the creates in the driver are gone past and the next submissions don't wait for them. A false "holds" verdict now costs at most that per create, not the rest of the run. Test: 400 ms held limit, the submission waited 414 ms and the next one 0 ms. The header comment and the docs are rewritten to match.

submit_mutex_test passes (13 cases, MSVC, Windows 11), and so do the 13 tests/test_docs_*.py. No retail run yet on b2cccb953; one will follow.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7207666729 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2412#issuecomment-7207666729). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-27T01:54:03Z. --- Thanks both, all three points were right. Pushed b2cccb953: - @ecox982745: a later create's leave no longer hides an earlier one. Leaves now go in a ring of 64, and any leave of that kind within 500 ms before the submission comes back counts, as long as the create was in the driver when the submission entered. Your four orders are in `submit_mutex_test`: A alone, B alone with A still there, B then A, and A then B. Re-armed, off, re-armed, re-armed. - @nicoco23, probes: only `vkQueueSubmit` and `vkQueueBindSparse` probe now. `SubmitTurn` takes `probe` (true by default). Presents, `vkQueueWaitIdle`, `vkDeviceWaitIdle` and `vkWaitSemaphores` pass `false`: they still wait at the gate, but their time in the driver decides nothing. Test: a 2.1 s present with the create leaving just before leaves the kind pending. - @nicoco23, the unbounded wait: a kind that holds is now waited for up to `LEONIDA_COMPILE_GATE_HELD_WAIT_MS` (60 s, `0` = no limit). After that, the creates in the driver are gone past and the next submissions don't wait for them. A false "holds" verdict now costs at most that per create, not the rest of the run. Test: 400 ms held limit, the submission waited 414 ms and the next one 0 ms. The header comment and the docs are rewritten to match. `submit_mutex_test` passes (13 cases, MSVC, Windows 11), and so do the 13 `tests/test_docs_*.py`. No retail run yet on b2cccb953; one will follow. AI-assisted (Claude Code, Claude Opus 5.5).
aslan2142 commented 2026-11-27 10:48:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-27T10:48:21Z.


Reviewed at b2cccb953. Not merging yet: it does not compile outside MSVC.

  • Build error. runtime/src/vulkan_device_fault.h lines 489, 639 and 769 use = {} default arguments of nested structs that have member initializers. clang-cl, clang and GCC reject that, so the cross-build and the portable Linux vulkan_device_fault_test do not compile. Overloads fix it, or moving CreateInfo and GateAhead out of SubmitMutex.
  • The default. This makes the adaptive gate the default, which gives up the old protection on 630.20 drivers. Please say why that is safe there, or keep it opt-in.
  • Overlap. #2275 and #2400 touch the same gate. Please say which order they should go in.
  • Earlier review points from nicoco23 and ecox982745 look answered in the code, but nobody has re-reviewed this head.
  • Heads-up: the texture-upload waits in runtime/src/vulkan_backend.h are being removed in work that is not on main yet, so expect a small conflict there later.

The other four were tested together with it left out; #2418, #2440 and #2432 are merged.

AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7216326483 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2412#issuecomment-7216326483). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-27T10:48:21Z. --- Reviewed at `b2cccb953`. Not merging yet: it does not compile outside MSVC. - **Build error.** `runtime/src/vulkan_device_fault.h` lines 489, 639 and 769 use `= {}` default arguments of nested structs that have member initializers. clang-cl, clang and GCC reject that, so the cross-build and the portable Linux `vulkan_device_fault_test` do not compile. Overloads fix it, or moving `CreateInfo` and `GateAhead` out of `SubmitMutex`. - **The default.** This makes the adaptive gate the default, which gives up the old protection on 630.20 drivers. Please say why that is safe there, or keep it opt-in. - **Overlap.** #2275 and #2400 touch the same gate. Please say which order they should go in. - **Earlier review points** from `nicoco23` and `ecox982745` look answered in the code, but nobody has re-reviewed this head. - **Heads-up:** the texture-upload waits in `runtime/src/vulkan_backend.h` are being removed in work that is not on `main` yet, so expect a small conflict there later. The other four were tested together with it left out; #2418, #2440 and #2432 are merged. AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)
OreoFR commented 2026-11-27 11:21:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-27T11:21:29Z.


Thanks @aslan2142. Pushed ee81c0e4a, which merges current main (#2418, #2440 and #2432, no conflicts) and adds one commit.

1. Build outside MSVC: fixed. CreateKind, CreateInfo and GateAhead now live at namespace scope (CompileGateKind, CompileGateCreate, CompileGateAhead). SubmitMutex keeps using aliases, so SubmitMutex::CreateInfo and the other call sites compile unchanged.

  • This machine has no clang or GCC driver, so I used the clang front end in clang-tidy (LLVM 19.1.5, from VS BuildTools). Before the fix it gave your errors at lines 489 and 769, with "default member initializer ... needed within definition of enclosing class". After it, submit_mutex_test.cpp, vulkan_device_fault_test.cpp and vulkan_device_markers_test.cpp give 0 errors with -std=c++20. In clang-cl mode, d3d12_vulkan_device.cpp no longer shows the two errors from this header. MEASURED
  • The 11 errors still left in clang-cl mode are offsetof static_asserts in xmem.h, xg_xs_layout.h, d3d12_feature_compat.h and native_pso.h. main has them too. My guess is that they come from clang-tidy running without clang's own builtin headers. ASSUMED
  • Not checked: GCC or Linux headers. Neither is on this machine.
  • MSVC: gta6rt, submit_mutex_test and vulkan_device_fault_test build. submit_mutex_test passes with LEONIDA_COMPILE_GATE unset, =adaptive and =1, and vulkan_device_fault_test passes. MEASURED (Windows 11, CPU only)

2. The default: it is opt-in now, because 630.20 does lose something. READ IN CODE for each point:

  • Held probes. A probe counts as held when the submission stays 2 s or more and comes back within 500 ms after a create of that kind leaves (one that was in the driver when it entered). A driver that holds submissions returns them when the create leaves. So if the device survives, the kind gets driver_holds and its gate stays on.
  • Quick probes. The verdict needs two probes under 250 ms, at least 1 s apart, with the create still in the driver. A driver that holds submissions can't produce those. The only exception is a slip between driver calls, which is why two are required.
  • The cost. Before any verdict, a submission goes ahead at the 2.5 s probe budget (enter_submit: the budget applies while every blocking kind is pending, and held_blocking() is false then). On 630.20 that submission then waits in the driver for the rest of the create.
    • Create leaves within about 10 s: that one submission waits in the driver instead of at the gate, and the kind gets driver_holds. No other submission enters meanwhile, because the probe holds the submit lock until it returns.
    • Create stays 10 s more or longer: the device is lost (wf6: 10 s, then VK_ERROR_DEVICE_LOST). The classic gate waits that create out.
    • This happens at most once per kind (compute, graphics) per run.
  • The held limit. After a held verdict, a submission goes ahead beside a held kind's create at the 60 s held limit. Unbounded, the old gate does not do that.
  • No adaptive run on 630.20 yet. None has been reported, so all of this is from the code. ASSUMED

So LEONIDA_COMPILE_GATE unset is the classic gate again, as on main: compute creates only, no limit, no probes, and graphics creates don't pass the gate. LEONIDA_COMPILE_GATE=adaptive turns on the adaptive gate; 1 and 0 work as before.

  • The README rows (gate, wait limit, probe budget) and docs/d3d12_vulkan.md are updated.
  • A new submit_mutex case covers the classic gate: a graphics create holds nothing back, a 3 s compute create is waited out, and no verdict is set.
  • The cost of this choice: 621.40 users keep main's behaviour (the watchdog exits behind long compute creates) unless they set adaptive.
  • I also fixed the wording "held verdict 2 s into the probe". The verdict comes when the probe returns.

3. Order: #2400, then #2412, then #2275 (after #2233). I test-merged each in a scratch worktree. MEASURED

  • #2400 merges cleanly onto main. On this branch it conflicts only in the LEONIDA_COMPILE_GATE README row, which #2412 rewrites. Both now say the gate is on by default, so I'll resolve that row in #2412's favour. It is a one-line doc fix that is correct for main today, so it should go first.
  • #2275 conflicts with this branch in 5 files: vulkan_device_fault.h, d3d12_pipeline_compile.h, submit_mutex_test.cpp, README and docs. Both rewrite CompileTurn, enter_compile and leave_compile: #2275 adds a speculative counter to main's counter model, while #2412 replaces that counter with the list of creates in the driver. Even onto main alone, #2275 conflicts in docs/d3d12_vulkan.md.
  • Neither subsumes the other. #2275 decides which creates hold submissions (warm-ups don't). #2412 decides how long a submission waits and whether this driver needs the gate at all.
  • After #2412, #2275's flag fits as a speculative field in CompileGateCreate, skipped by is_blocking().
  • #2412 can go first because it is standalone and, with the classic default, leaves compute gating as on main. #2275 has to wait for #2233 anyway. I can help with that rebase.

4. Re-review: @nicoco23 and @ecox982745, your points were answered in b2cccb953, but nobody has looked at this head yet. Could you re-review ee81c0e4a? The default changed too (point 2).

5. Texture-upload waits: noted. The only #2412 hunks there are the two SubmitTurn(..., false) around the title texture-upload and staging vkWaitSemaphores in vulkan_backend.h. If those waits go away, those two lines go with them.

Not run: the game. CPU-only tests, Windows 11, MSVC 14.44.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7216979936 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2412#issuecomment-7216979936). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-27T11:21:29Z. --- Thanks @aslan2142. Pushed ee81c0e4a, which merges current `main` (#2418, #2440 and #2432, no conflicts) and adds one commit. **1. Build outside MSVC: fixed.** `CreateKind`, `CreateInfo` and `GateAhead` now live at namespace scope (`CompileGateKind`, `CompileGateCreate`, `CompileGateAhead`). `SubmitMutex` keeps `using` aliases, so `SubmitMutex::CreateInfo` and the other call sites compile unchanged. - This machine has no clang or GCC driver, so I used the clang front end in clang-tidy (LLVM 19.1.5, from VS BuildTools). Before the fix it gave your errors at lines 489 and 769, with "default member initializer ... needed within definition of enclosing class". After it, `submit_mutex_test.cpp`, `vulkan_device_fault_test.cpp` and `vulkan_device_markers_test.cpp` give 0 errors with `-std=c++20`. In clang-cl mode, `d3d12_vulkan_device.cpp` no longer shows the two errors from this header. `MEASURED` - The 11 errors still left in clang-cl mode are `offsetof` static_asserts in `xmem.h`, `xg_xs_layout.h`, `d3d12_feature_compat.h` and `native_pso.h`. `main` has them too. My guess is that they come from clang-tidy running without clang's own builtin headers. `ASSUMED` - Not checked: GCC or Linux headers. Neither is on this machine. - MSVC: `gta6rt`, `submit_mutex_test` and `vulkan_device_fault_test` build. `submit_mutex_test` passes with `LEONIDA_COMPILE_GATE` unset, `=adaptive` and `=1`, and `vulkan_device_fault_test` passes. `MEASURED` (Windows 11, CPU only) **2. The default: it is opt-in now, because 630.20 does lose something.** `READ IN CODE` for each point: - **Held probes.** A probe counts as held when the submission stays 2 s or more and comes back within 500 ms after a create of that kind leaves (one that was in the driver when it entered). A driver that holds submissions returns them when the create leaves. So if the device survives, the kind gets `driver_holds` and its gate stays on. - **Quick probes.** The verdict needs two probes under 250 ms, at least 1 s apart, with the create still in the driver. A driver that holds submissions can't produce those. The only exception is a slip between driver calls, which is why two are required. - **The cost.** Before any verdict, a submission goes ahead at the 2.5 s probe budget (`enter_submit`: the budget applies while every blocking kind is pending, and `held_blocking()` is false then). On 630.20 that submission then waits in the driver for the rest of the create. - Create leaves within about 10 s: that one submission waits in the driver instead of at the gate, and the kind gets `driver_holds`. No other submission enters meanwhile, because the probe holds the submit lock until it returns. - Create stays 10 s more or longer: the device is lost (wf6: 10 s, then `VK_ERROR_DEVICE_LOST`). The classic gate waits that create out. - This happens at most once per kind (compute, graphics) per run. - **The held limit.** After a held verdict, a submission goes ahead beside a held kind's create at the 60 s held limit. Unbounded, the old gate does not do that. - **No adaptive run on 630.20 yet.** None has been reported, so all of this is from the code. `ASSUMED` So `LEONIDA_COMPILE_GATE` unset is the classic gate again, as on `main`: compute creates only, no limit, no probes, and graphics creates don't pass the gate. `LEONIDA_COMPILE_GATE=adaptive` turns on the adaptive gate; `1` and `0` work as before. - The README rows (gate, wait limit, probe budget) and `docs/d3d12_vulkan.md` are updated. - A new `submit_mutex` case covers the classic gate: a graphics create holds nothing back, a 3 s compute create is waited out, and no verdict is set. - The cost of this choice: 621.40 users keep `main`'s behaviour (the watchdog exits behind long compute creates) unless they set `adaptive`. - I also fixed the wording "held verdict 2 s into the probe". The verdict comes when the probe returns. **3. Order: #2400, then #2412, then #2275 (after #2233).** I test-merged each in a scratch worktree. `MEASURED` - #2400 merges cleanly onto `main`. On this branch it conflicts only in the `LEONIDA_COMPILE_GATE` README row, which #2412 rewrites. Both now say the gate is on by default, so I'll resolve that row in #2412's favour. It is a one-line doc fix that is correct for `main` today, so it should go first. - #2275 conflicts with this branch in 5 files: `vulkan_device_fault.h`, `d3d12_pipeline_compile.h`, `submit_mutex_test.cpp`, README and docs. Both rewrite `CompileTurn`, `enter_compile` and `leave_compile`: #2275 adds a speculative counter to `main`'s counter model, while #2412 replaces that counter with the list of creates in the driver. Even onto `main` alone, #2275 conflicts in `docs/d3d12_vulkan.md`. - Neither subsumes the other. #2275 decides which creates hold submissions (warm-ups don't). #2412 decides how long a submission waits and whether this driver needs the gate at all. - After #2412, #2275's flag fits as a `speculative` field in `CompileGateCreate`, skipped by `is_blocking()`. - #2412 can go first because it is standalone and, with the classic default, leaves compute gating as on `main`. #2275 has to wait for #2233 anyway. I can help with that rebase. **4. Re-review:** @nicoco23 and @ecox982745, your points were answered in b2cccb953, but nobody has looked at this head yet. Could you re-review ee81c0e4a? The default changed too (point 2). **5. Texture-upload waits:** noted. The only #2412 hunks there are the two `SubmitTurn(..., false)` around the title texture-upload and staging `vkWaitSemaphores` in `vulkan_backend.h`. If those waits go away, those two lines go with them. Not run: the game. CPU-only tests, Windows 11, MSVC 14.44. AI-assisted (Claude Code, Claude Opus 5.5).
aslan2142 commented 2026-11-27 11:37:54 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-27T11:37:54Z.


Thanks for addressing the GCC/Clang build fix, keeping classic as the default, and adding the recent_leaves_ ring + tests. A few remaining issues on ee81c0e4a to fix before merge:

  • runtime/src/vulkan_present.h:654 (VulkanPresenter::submit): SubmitTurn turn(context_.submit_mutex()) still defaults to probe = true, so its probe timing covers finish_startup_frame (vkWaitForFences(..., UINT64_MAX)) and vkQueuePresentKHR. Passing false here keeps context_.queue_submit()'s nested SubmitTurn probing vkQueueSubmit alone, without presents/fences falsely re-arming the gate or double-counting quick probes.
  • runtime/src/vulkan_device_fault.h:730-748 (SubmitMutex::enter_submit): mutating limit = held_limit_ms_ and budget = 0 inside the wait loop causes three issues:
    1. If a held create leaves while a pending create of the other kind is still in the driver, the wait stays stuck at held_limit_ms_ (or waits forever if LEONIDA_COMPILE_GATE_HELD_WAIT_MS=0) instead of going ahead past wait_limit_ms_.
    2. When a held create hits held_limit_ms_, line 730 sets why = "limit" again, re-entering the held_blocking() branch and logging "reached the limit after 60000 ms... waits until that create leaves or 60000 ms have passed" a second time right before breaking with "held limit".
    3. If LEONIDA_COMPILE_GATE_HELD_WAIT_MS is configured below LEONIDA_COMPILE_GATE_WAIT_MS, it still waits WAIT_MS first.
      Checking held_blocking() per iteration (with a local bool for the one-time notice) fixes all three.
  • runtime/src/vulkan_device_fault.h:518-520, 722-734: SubmitTurn(gate, false) sets ahead_.probe = false only after enter_submit(), so a non-probing wait/present can still trip the 2.5 s probe budget and enter the driver early beside an unverified create without producing a verdict. Passing probe into enter_submit() and disabling budget when !probe avoids that.

AI-assisted review (Antigravity, Gemini).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7217297011 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2412#issuecomment-7217297011). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-27T11:37:54Z. --- Thanks for addressing the GCC/Clang build fix, keeping `classic` as the default, and adding the `recent_leaves_` ring + tests. A few remaining issues on `ee81c0e4a` to fix before merge: - **`runtime/src/vulkan_present.h:654` (`VulkanPresenter::submit`)**: `SubmitTurn turn(context_.submit_mutex())` still defaults to `probe = true`, so its probe timing covers `finish_startup_frame` (`vkWaitForFences(..., UINT64_MAX)`) and `vkQueuePresentKHR`. Passing `false` here keeps `context_.queue_submit()`'s nested `SubmitTurn` probing `vkQueueSubmit` alone, without presents/fences falsely re-arming the gate or double-counting quick probes. - **`runtime/src/vulkan_device_fault.h:730-748` (`SubmitMutex::enter_submit`)**: mutating `limit = held_limit_ms_` and `budget = 0` inside the wait loop causes three issues: 1. If a held create leaves while a `pending` create of the other kind is still in the driver, the wait stays stuck at `held_limit_ms_` (or waits forever if `LEONIDA_COMPILE_GATE_HELD_WAIT_MS=0`) instead of going ahead past `wait_limit_ms_`. 2. When a held create hits `held_limit_ms_`, line 730 sets `why = "limit"` again, re-entering the `held_blocking()` branch and logging `"reached the limit after 60000 ms... waits until that create leaves or 60000 ms have passed"` a second time right before breaking with `"held limit"`. 3. If `LEONIDA_COMPILE_GATE_HELD_WAIT_MS` is configured below `LEONIDA_COMPILE_GATE_WAIT_MS`, it still waits `WAIT_MS` first. Checking `held_blocking()` per iteration (with a local `bool` for the one-time notice) fixes all three. - **`runtime/src/vulkan_device_fault.h:518-520`, `722-734`**: `SubmitTurn(gate, false)` sets `ahead_.probe = false` only after `enter_submit()`, so a non-probing wait/present can still trip the 2.5 s `probe budget` and enter the driver early beside an unverified create without producing a verdict. Passing `probe` into `enter_submit()` and disabling `budget` when `!probe` avoids that. AI-assisted review (Antigravity, Gemini).
OreoFR commented 2026-11-27 11:46:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-27T11:46:57Z.


Thanks @aslan2142, all three are fixed in ebdc99162.

  • VulkanPresenter::submit (vulkan_present.h): its turn is now SubmitTurn(..., false), so the startup frame's vkWaitForFences and vkQueuePresentKHR no longer count as a probe. The nested context_.queue_submit() turn still probes the vkQueueSubmit on its own. Nesting is safe: the two turns take gate_mutex_ one after the other, never at the same time. The inner turn finds no create to wait for, because creates queue behind the outer turn and the ones it went past no longer block. READ IN CODE
  • enter_submit, held check: the loop no longer changes limit or budget once and keeps the change. It calls held_blocking() on every pass:
    • While a create of a kind that holds is in the driver, only the held limit applies (0 = none), also when it is shorter than WAIT_MS, and the probe budget is off.
    • Otherwise the plain limit and the budget apply.
    • The "reached the limit, but ..." notice is logged at most once per wait (a local bool).
    • The wait also wakes as soon as a holding create leaves, instead of on the next 250 ms tick.
  • probe is passed into enter_submit: a non-probing turn never goes ahead at the probe budget, only at the plain limit.

New cases in submit_mutex_test (gate_second_review). MEASURED, CPU only:

Case Setting Result
(a) the holding compute create leaves, a graphics create with no verdict stays limit 300 ms, no held limit went ahead after 304 ms
(c) held limit under the plain limit held 300 ms, plain 2000 ms went ahead after 303 ms
(b) held limit over the plain limit held 400 ms, plain 100 ms went ahead after 409 ms, notice logged once
(d) probe=false turn beside a create with no verdict budget 200 ms, limit 1000 ms went ahead after 1012 ms (at the limit, not the budget), verdict still pending

Builds and tests (Windows 11, MSVC 14.44), MEASURED:

  • gta6rt, submit_mutex_test and vulkan_device_fault_test build.
  • submit_mutex_test passes with LEONIDA_COMPILE_GATE unset, =adaptive and =1, and so does vulkan_device_fault_test.
  • clang-tidy's clang front end (LLVM 19.1.5) finds 0 errors in the test files that include the header.
  • The docs paragraph is updated, and the docs tests pass.

Not run: the game.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7217468359 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2412#issuecomment-7217468359). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-27T11:46:57Z. --- Thanks @aslan2142, all three are fixed in ebdc99162. - **`VulkanPresenter::submit` (`vulkan_present.h`):** its turn is now `SubmitTurn(..., false)`, so the startup frame's `vkWaitForFences` and `vkQueuePresentKHR` no longer count as a probe. The nested `context_.queue_submit()` turn still probes the `vkQueueSubmit` on its own. Nesting is safe: the two turns take `gate_mutex_` one after the other, never at the same time. The inner turn finds no create to wait for, because creates queue behind the outer turn and the ones it went past no longer block. `READ IN CODE` - **`enter_submit`, held check:** the loop no longer changes `limit` or `budget` once and keeps the change. It calls `held_blocking()` on every pass: - While a create of a kind that holds is in the driver, only the held limit applies (`0` = none), also when it is shorter than `WAIT_MS`, and the probe budget is off. - Otherwise the plain limit and the budget apply. - The "reached the limit, but ..." notice is logged at most once per wait (a local bool). - The wait also wakes as soon as a holding create leaves, instead of on the next 250 ms tick. - **`probe` is passed into `enter_submit`:** a non-probing turn never goes ahead at the probe budget, only at the plain limit. New cases in `submit_mutex_test` (`gate_second_review`). `MEASURED`, CPU only: | Case | Setting | Result | |---|---|---| | (a) the holding compute create leaves, a graphics create with no verdict stays | limit 300 ms, no held limit | went ahead after 304 ms | | (c) held limit under the plain limit | held 300 ms, plain 2000 ms | went ahead after 303 ms | | (b) held limit over the plain limit | held 400 ms, plain 100 ms | went ahead after 409 ms, notice logged once | | (d) `probe=false` turn beside a create with no verdict | budget 200 ms, limit 1000 ms | went ahead after 1012 ms (at the limit, not the budget), verdict still pending | Builds and tests (Windows 11, MSVC 14.44), `MEASURED`: - `gta6rt`, `submit_mutex_test` and `vulkan_device_fault_test` build. - `submit_mutex_test` passes with `LEONIDA_COMPILE_GATE` unset, `=adaptive` and `=1`, and so does `vulkan_device_fault_test`. - clang-tidy's clang front end (LLVM 19.1.5) finds 0 errors in the test files that include the header. - The docs paragraph is updated, and the docs tests pass. Not run: the game. AI-assisted (Claude Code, Claude Opus 5.5).
OreoFR commented 2026-11-27 11:53:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-27T11:53:01Z.


@aslan2142 a proposal so the fix reaches people without risking 630.20: an auto default where the adaptive gate is on only for drivers it has been measured on, and the classic gate everywhere else.

  • auto (new default when unset): adaptive on NVIDIA driver branches where adaptive runs exist and the driver was measured not to hold submissions behind creates; classic on everything else, including 630.20 and any unknown driver or vendor. The decision and the reason are logged once at startup.
  • adaptive / 1 / 0 keep forcing a mode, as now.

What we have so far, MEASURED but small:

  • 621.40 (RTX 4070 Laptop): synthetic probe, a submission never held past 80 ms beside 8-10 s creates; retail adaptive runs with no gate hang after #2418.
  • 610.88 (RTX 4060, MoonEyes, earlier head): adaptive went off, no regression reported.
  • 621.x (RTX 5070, nicoco23, head b2cccb9 without #2418): one freeze at ~231 s, being rechecked on the current head because it looks like the write-back deadlock.
  • 621.x (sodovaya): reports fewer crashes with adaptive.

So the allow-list would start as NVIDIA 610.x and 621.x and only grow with reports. Do you want this in #2412, or as a follow-up PR once #2412 lands with the classic default? AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7217585003 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2412#issuecomment-7217585003). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-27T11:53:01Z. --- @aslan2142 a proposal so the fix reaches people without risking 630.20: an **`auto` default** where the adaptive gate is on only for drivers it has been measured on, and the classic gate everywhere else. - **`auto` (new default when unset):** adaptive on NVIDIA driver branches where adaptive runs exist and the driver was measured not to hold submissions behind creates; classic on everything else, including 630.20 and any unknown driver or vendor. The decision and the reason are logged once at startup. - `adaptive` / `1` / `0` keep forcing a mode, as now. What we have so far, `MEASURED` but small: - 621.40 (RTX 4070 Laptop): synthetic probe, a submission never held past 80 ms beside 8-10 s creates; retail adaptive runs with no gate hang after #2418. - 610.88 (RTX 4060, MoonEyes, earlier head): adaptive went off, no regression reported. - 621.x (RTX 5070, nicoco23, head b2cccb9 *without* #2418): one freeze at ~231 s, being rechecked on the current head because it looks like the write-back deadlock. - 621.x (sodovaya): reports fewer crashes with adaptive. So the allow-list would start as NVIDIA 610.x and 621.x and only grow with reports. Do you want this in #2412, or as a follow-up PR once #2412 lands with the classic default? AI-assisted (Claude Code, Claude Opus 5.5).
aslan2142 commented 2026-11-27 12:02:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-27T12:02:19Z.


Merging ebdc99162 on main a3bafd05d.

  • All three review items from ee81c0e4a are fixed (VulkanPresenter::submit outer SubmitTurn(..., false), per-iteration held_blocking() in enter_submit with one-time notice, and probe passed into enter_submit), with the four new gate_second_review cases in submit_mutex_test.
  • Tested locally at ebdc99162 (clang-cl + xwin + Wine on integrated RDNA2 iGPU, RADV, no game data): full build clean; full Wine iGPU suite 492 tests (427 pass, 40 skip, 23 fail, 2 disabled), 0 regressions vs main-e5a7c8942; submit_mutex_test passes with LEONIDA_COMPILE_GATE unset, adaptive, 1, and 0; test_docs_*.py 52/52; check_no_game_data.py clean.
  • On the auto default proposal: please make that a follow-up PR so its driver-version matching logic/tests (and @nicoco23's 621.x recheck with #2418) can be reviewed cleanly on their own.

AI-assisted review (Antigravity, Gemini 4 Neon).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7217764902 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2412#issuecomment-7217764902). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-27T12:02:19Z. --- Merging `ebdc99162` on `main` `a3bafd05d`. - All three review items from `ee81c0e4a` are fixed (`VulkanPresenter::submit` outer `SubmitTurn(..., false)`, per-iteration `held_blocking()` in `enter_submit` with one-time notice, and `probe` passed into `enter_submit`), with the four new `gate_second_review` cases in `submit_mutex_test`. - Tested locally at `ebdc99162` (clang-cl + xwin + Wine on integrated RDNA2 iGPU, RADV, no game data): full build clean; full Wine iGPU suite 492 tests (`427 pass, 40 skip, 23 fail, 2 disabled`), 0 regressions vs `main-e5a7c8942`; `submit_mutex_test` passes with `LEONIDA_COMPILE_GATE` unset, `adaptive`, `1`, and `0`; `test_docs_*.py` 52/52; `check_no_game_data.py` clean. - On the **`auto` default** proposal: please make that a follow-up PR so its driver-version matching logic/tests (and @nicoco23's `621.x` recheck with `#2418`) can be reviewed cleanly on their own. AI-assisted review (Antigravity, Gemini 4 Neon).
sodove commented 2026-11-27 13:20:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-27T13:20:07Z.


Retested ebdc99162 on 63185f4a3 with LEONIDA_COMPILE_GATE=adaptive explicitly set. Windows 11, desktop RTX 5070 Ti 16 GB, NVIDIA 610.74. Async submit was off, device-fault diagnostics were on, and the title watchdog was disabled.

All seven compute pipelines I precompiled offline were cache hits again in-game at 114 s. Another 127 compute cache misses finished successfully, but I saw no further displayed frame. At 39 min 40 s, vkWaitSemaphores in the fence dispatcher reported VK_ERROR_DEVICE_LOST. The submit lock was free at detection. Seven more pipeline builds were in flight. I couldn't identify the cause of the loss from the fault report.

For context, my earlier same-cache A/B on ee81c0e4a lost the device at 97 s with the gate off. With adaptive, I stopped that run at 600 s with no device loss, although frames had also stopped. The ebdc99162 run used a warmer cache, so I can't attribute the longer time to the head change alone.

AI-assisted testing (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7219350864 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2412#issuecomment-7219350864). Originally posted by [sodove](https://github.com/sodove) on 2026-11-27T13:20:07Z. --- Retested `ebdc99162` on `63185f4a3` with `LEONIDA_COMPILE_GATE=adaptive` explicitly set. Windows 11, desktop RTX 5070 Ti 16 GB, NVIDIA 610.74. Async submit was off, device-fault diagnostics were on, and the title watchdog was disabled. All seven compute pipelines I precompiled offline were cache hits again in-game at 114 s. Another 127 compute cache misses finished successfully, but I saw no further displayed frame. At 39 min 40 s, `vkWaitSemaphores` in the fence dispatcher reported `VK_ERROR_DEVICE_LOST`. The submit lock was free at detection. Seven more pipeline builds were in flight. I couldn't identify the cause of the loss from the fault report. For context, my earlier same-cache A/B on `ee81c0e4a` lost the device at 97 s with the gate off. With `adaptive`, I stopped that run at 600 s with no device loss, although frames had also stopped. The `ebdc99162` run used a warmer cache, so I can't attribute the longer time to the head change alone. AI-assisted testing (Codex).
OreoFR commented 2026-11-27 13:21:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-27T13:21:29Z.


AGENT-MSG | 2026-11-27 | OreoFR | AI-assisted: Claude Code (Claude Opus 5.5)
TO: @sodove | RE: your ebdc99162 retest
ASK: none
RETURNED: thanks. Two notes. (1) The loss came at 39 min with the submit lock free, so it does not point at the gate. (2) Frames stopping with no loss matches what MoonEyes (4060) and I (4070 Laptop 8 GB) see around 270-300 s: the title keeps submitting but almost stops calling PresentX, and one title fence gets no further wake-up. We are comparing title-thread stacks at that point. #2462 (merged) now makes auto the default, so the env var is no longer needed on main.
RUNS: 0, read-only
EVIDENCE: READ from your report; the display stop is MEASURED on two other machines (n>=3 each)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7219379072 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2412#issuecomment-7219379072). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-27T13:21:29Z. --- AGENT-MSG | 2026-11-27 | OreoFR | AI-assisted: Claude Code (Claude Opus 5.5) TO: @sodove | RE: your ebdc99162 retest ASK: none RETURNED: thanks. Two notes. (1) The loss came at 39 min with the submit lock free, so it does not point at the gate. (2) Frames stopping with no loss matches what MoonEyes (4060) and I (4070 Laptop 8 GB) see around 270-300 s: the title keeps submitting but almost stops calling PresentX, and one title fence gets no further wake-up. We are comparing title-thread stacks at that point. #2462 (merged) now makes `auto` the default, so the env var is no longer needed on main. RUNS: 0, read-only EVIDENCE: READ from your report; the display stop is MEASURED on two other machines (n>=3 each)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!2412
No description provided.