boot_trace: summarize Vulkan pipeline waits and compilation #2369

Merged
plamea merged 1 commit from upstream-pr/2369 into main 2026-11-28 08:05:06 +00:00
plamea commented 2026-11-26 16:14:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by plamea on 2026-11-26T16:14:03Z.


Claimed as BOOT-TRACE-PIPELINE-TIMING in the coordination issue.

Summary

  • Read the existing pipeline diagnostics when LEONIDA_TRACE_PIPELINE_COMPILE=1 is used in a D3D12 trace.
  • Report separate maxima for Vulkan compilation and caller waits. Match starts to completions by worker, trigger, variant and key so overlapping jobs can be counted independently.
  • Include numeric totals in --counts-only without pipeline keys or shader names. Existing traces without pipeline diagnostics keep their previous summary shape.

Verification

  • 35 boot-trace tests and five dev-wrapper tests passed. The regression fixture covers overlapping jobs, incomplete traces, non-success results and the counts-only output.
  • Eight targeted runtime tests passed on native Windows 11, NVIDIA RTX 3050 Laptop GPU (4 GiB), driver 621.24. A Vulkan translated-draw fixture independently compared all 4,096 pixels and produced a trace with one completed cache-hit pipeline build and one recorded caller wait. The parser matched the timing fields in that trace.
  • Translator regression suite: 500 files, 6,365 tests, 0 failed files.
  • Game-data check passed for the three changed files.

AI-assisted with Codex. The traces used to verify this change came from synthetic tests.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5513468034 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2369). Originally posted by [plamea](https://github.com/plamea) on 2026-11-26T16:14:03Z. --- Claimed as BOOT-TRACE-PIPELINE-TIMING in the [coordination issue](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7197144280). ## Summary - Read the existing pipeline diagnostics when `LEONIDA_TRACE_PIPELINE_COMPILE=1` is used in a D3D12 trace. - Report separate maxima for Vulkan compilation and caller waits. Match starts to completions by worker, trigger, variant and key so overlapping jobs can be counted independently. - Include numeric totals in `--counts-only` without pipeline keys or shader names. Existing traces without pipeline diagnostics keep their previous summary shape. ## Verification - 35 boot-trace tests and five dev-wrapper tests passed. The regression fixture covers overlapping jobs, incomplete traces, non-success results and the counts-only output. - Eight targeted runtime tests passed on native Windows 11, NVIDIA RTX 3050 Laptop GPU (4 GiB), driver 621.24. A Vulkan translated-draw fixture independently compared all 4,096 pixels and produced a trace with one completed cache-hit pipeline build and one recorded caller wait. The parser matched the timing fields in that trace. - Translator regression suite: 500 files, 6,365 tests, 0 failed files. - Game-data check passed for the three changed files. AI-assisted with Codex. The traces used to verify this change came from synthetic tests.
KushGene commented 2026-11-26 16:17:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KushGene on 2026-11-26T16:17:24Z.


Independent verification on Linux (Ubuntu/Fedora host, Python 3.15.2, CPU only, no game files), tested in a clean detached worktree at main 246791612 with PR #2369 head d04d24796:

  • Clean apply: git apply --check / git apply applied cleanly with zero conflicts.
  • Before fix (new test on unpatched main): python3 -I tests/test_boot_trace.py -v -> 35 run, 34 ok, 1 failed (test_pipeline_timing_counts_overlapping_compiles_and_waits: AssertionError: 6 != 0 on ignored_lines).
  • After fix:
    • python3 -I tests/test_boot_trace.py -v -> 35/35 passed.
    • python3 -I tests/test_docs_links.py -> 17/17 passed.
    • python3 -I tests/test_ci_registration.py -> 16/16 passed.
    • python3 -I tests/test_text_write_line_endings.py -> 3/3 passed.
    • python3 -m compileall -q make_game.py tools tests -> exit 0.
    • python3 -I scripts/check_no_game_data.py docs/first_run_ui.md tests/test_boot_trace.py tools/boot_trace.py -> exit 0.
    • git diff --check -> clean.

Code review notes: pipeline_timing is omitted when no pipeline events appear (preserving the existing JSON schema), --counts-only includes only integer counters without leaking key or shaders names, and _record_pipeline_timing handles PowerShell <exe> : prefixes and overlapping start/complete tracking cleanly. No issues found.

AI-assisted: yes (Antigravity)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7197444799 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2369#issuecomment-7197444799). Originally posted by [KushGene](https://github.com/KushGene) on 2026-11-26T16:17:24Z. --- Independent verification on Linux (Ubuntu/Fedora host, Python 3.15.2, CPU only, no game files), tested in a clean detached worktree at `main` `246791612` with PR #2369 head `d04d24796`: - **Clean apply:** `git apply --check` / `git apply` applied cleanly with zero conflicts. - **Before fix (new test on unpatched `main`):** `python3 -I tests/test_boot_trace.py -v` -> 35 run, 34 ok, **1 failed** (`test_pipeline_timing_counts_overlapping_compiles_and_waits`: `AssertionError: 6 != 0` on `ignored_lines`). - **After fix:** - `python3 -I tests/test_boot_trace.py -v` -> **35/35 passed**. - `python3 -I tests/test_docs_links.py` -> **17/17 passed**. - `python3 -I tests/test_ci_registration.py` -> **16/16 passed**. - `python3 -I tests/test_text_write_line_endings.py` -> **3/3 passed**. - `python3 -m compileall -q make_game.py tools tests` -> exit 0. - `python3 -I scripts/check_no_game_data.py docs/first_run_ui.md tests/test_boot_trace.py tools/boot_trace.py` -> exit 0. - `git diff --check` -> clean. Code review notes: `pipeline_timing` is omitted when no pipeline events appear (preserving the existing JSON schema), `--counts-only` includes only integer counters without leaking `key` or `shaders` names, and `_record_pipeline_timing` handles PowerShell `<exe> : ` prefixes and overlapping start/complete tracking cleanly. No issues found. AI-assisted: yes (Antigravity)
lixonik commented 2026-11-26 18:02:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-26T18:02:04Z.

Review: COMMENTED


Windows 11: all 35 boot trace tests passed, including pipeline wait and compiler output summaries. Synthetic logs only. No findings.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6078730757 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2369#pullrequestreview-6078730757). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-26T18:02:04Z. **Review:** COMMENTED --- Windows 11: all 35 boot trace tests passed, including pipeline wait and compiler output summaries. Synthetic logs only. No findings. AI-assisted.
wavehs commented 2026-11-26 18:40:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by wavehs on 2026-11-26T18:40:51Z.

Review: COMMENTED


macOS arm64 check of #2369 (pipeline waits in boot_trace). A Python log parser plus its test; no GPU needed.

Tested head d04d24796 with its diff applied to a copy of main bdbc7e923 (branch 17 commits behind; git apply / git merge-tree clean).

Environment: Apple M3 Pro, arm64, macOS 27.2.1, CPython 3.15.2.

Result

  • python -I tests/test_boot_trace.py: 35 tests, OK.
  • Negative control (new test kept, tools/boot_trace.py put back to main's): 1 failure, test_pipeline_timing_counts_overlapping_compiles_and_waits - the parser ignores the [rt] pipeline-* lines, so the summary has no pipeline_timing. The other 34 tests stay green, so the change does not disturb the D3D12/startup parsing.
  • python -I scripts/run_semantic_tests.py tests/semantic: 500 files / 6,367 tests / 0 failed, same as main.

Format cross-check
The three regexes match the producer in runtime/shims/d3d12_pipeline_compile.h field for field:

  • pipeline-use (line 79): trigger tid us ready end_ms;
  • pipeline-compile-begin (line 97): trigger tid bytes variant begin_ms key shaders;
  • pipeline-compile (line 122): trigger tid start_us us hit bytes variant result end_ms key shaders.
    The optional (?:.+ : )? prefix matches the PowerShell error-record wrapping the file already handles. Good.

Review

  • Overlapping compiles with the same (tid, trigger, variant, key) are counted with a stack (active[key] += 1 on begin, decrement on end), and a completion with no begin is counted separately instead of being paired with an unrelated start; the test covers overlapping compiles.
  • starts_without_completion is computed from the live map at EOF, so a truncated log reports the open builds; the if started or completed or logged_waits guard keeps pipeline_timing out of logs that never enabled the trace, which preserves the existing text report for those.
  • counts_only() copies the timing dict, and the text report prints it only when present; the other [rt] diagnostics are not summarized wording is now accurate.

One observation, not a defect: the runtime prints pipeline-use only when elapsed >= 1000 µs (d3d12_pipeline_compile.h:78), so logged_waits is a subset of the waits; the report's "logged" wording is right, but a reader could take "longest wait" as the longest wait overall. A parenthetical "(only uses over 1 ms are logged)" in the text line or the docs would prevent that.

No game files. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6079095140 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2369#pullrequestreview-6079095140). Originally posted by [wavehs](https://github.com/wavehs) on 2026-11-26T18:40:51Z. **Review:** COMMENTED --- **macOS arm64 check of #2369** (pipeline waits in boot_trace). A Python log parser plus its test; no GPU needed. Tested head `d04d24796` with its diff applied to a copy of `main` `bdbc7e923` (branch 17 commits behind; `git apply` / `git merge-tree` clean). Environment: Apple M3 Pro, arm64, macOS 27.2.1, CPython 3.15.2. **Result** - `python -I tests/test_boot_trace.py`: 35 tests, OK. - Negative control (new test kept, `tools/boot_trace.py` put back to `main`'s): 1 failure, `test_pipeline_timing_counts_overlapping_compiles_and_waits` - the parser ignores the `[rt] pipeline-*` lines, so the summary has no `pipeline_timing`. The other 34 tests stay green, so the change does not disturb the D3D12/startup parsing. - `python -I scripts/run_semantic_tests.py tests/semantic`: 500 files / 6,367 tests / 0 failed, same as `main`. **Format cross-check** The three regexes match the producer in `runtime/shims/d3d12_pipeline_compile.h` field for field: - `pipeline-use` (line 79): `trigger tid us ready end_ms`; - `pipeline-compile-begin` (line 97): `trigger tid bytes variant begin_ms key shaders`; - `pipeline-compile` (line 122): `trigger tid start_us us hit bytes variant result end_ms key shaders`. The optional `(?:.+ : )?` prefix matches the PowerShell error-record wrapping the file already handles. Good. **Review** - Overlapping compiles with the same `(tid, trigger, variant, key)` are counted with a stack (`active[key] += 1` on begin, decrement on end), and a completion with no begin is counted separately instead of being paired with an unrelated start; the test covers overlapping compiles. - `starts_without_completion` is computed from the live map at EOF, so a truncated log reports the open builds; the `if started or completed or logged_waits` guard keeps `pipeline_timing` out of logs that never enabled the trace, which preserves the existing text report for those. - `counts_only()` copies the timing dict, and the text report prints it only when present; the `other [rt] diagnostics are not summarized` wording is now accurate. One observation, not a defect: the runtime prints `pipeline-use` only when `elapsed >= 1000` µs (`d3d12_pipeline_compile.h:78`), so `logged_waits` is a subset of the waits; the report's "logged" wording is right, but a reader could take "longest wait" as the longest wait overall. A parenthetical "(only uses over 1 ms are logged)" in the text line or the docs would prevent that. No game files. AI-assisted.
DadaCap commented 2026-11-28 08:05:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T08:05:09Z.


Merged into main (merge commit 6de34615a), approved by DadaCap (maintainer). Thanks!

Checked before merging: Tested in our local release candidate (main + 41 PRs): translator suite 512 files / 6,442 tests clean, Python suite with no new failure versus main, and 360 s game runs on an RTX 5080 with no regression. The merge was pinned to the head commit that was tested (d04d24796).

AI-assisted (Claude Code), posted for DadaCap.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7236352592 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2369#issuecomment-7236352592). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-28T08:05:09Z. --- Merged into `main` (merge commit 6de34615a), approved by DadaCap (maintainer). Thanks! Checked before merging: Tested in our local release candidate (main + 41 PRs): translator suite 512 files / 6,442 tests clean, Python suite with no new failure versus main, and 360 s game runs on an RTX 5080 with no regression. The merge was pinned to the head commit that was tested (d04d24796). _AI-assisted (Claude Code), posted for DadaCap._
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!2369
No description provided.