d3d12: the slow-pipeline line says where the pipeline came from, and whether its journal was written #2634

Merged
fiestorra merged 2 commits from upstream-pr/2634 into main 2026-11-30 16:00:18 +00:00
fiestorra commented 2026-11-29 20:32:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-29T20:32:05Z.


Claimed in the coordination issue as D3D12-PIPELINE-SLOW-LINE-SOURCE.

What and why

The slow-pipeline line exists to answer "why did this take 14 seconds", and today it only says how long. When a pipeline is rebuilt on every boot, the
question that matters is where it came from - the driver, the shared cache, or the per-pipeline journal - and whether the journal then received it. Without
that, a line saying "took 14.0 s to build" cannot be told apart from a cache that never gets written.

This adds three values to the existing line: the source (shared, journal or none), hit, seeded and written, so the same line says where the entry
came from and whether this build is going to be found next time.

Tested

  • python -I scripts/run_semantic_tests.py tests/semantic: 529 files, 6526 tests, 1 file failed - test_interp_computed_ij_fallback, which fails on
    main today for a reason unrelated to this change (its oracle predates the toward-zero p2 narrow);
  • ctest --test-dir runtime/build -C RelWithDebInfo: the runtime builds and its tests run; nothing here changes behaviour, only what one log line prints;
  • measured on the runs it was written for: 21 slow lines in one boot, 91.9 s in total, largest 20.4 s, and with the new fields the same lines show
    seeded 0, written 1 - which is how the journal-versus-cache question was answered.

GPUs tested

RTX 4090, driver 32.0.16.2124, Windows 11, RelWithDebInfo. No game data is included in this change and none is needed to build it.

The extra commit at the tip (no longer carried)

The branch used to carry a3b5ebea1 (test(semantic): align computed-I/J f16 interp oracle…), added only because semantic-tests was red on main for that oracle and every branch cut from main inherited it. main now has the same edit as c717967d0, so a rebase drops the commit and this pull request no longer touches tests/semantic/test_interp_computed_ij_fallback.py - the diff is only what this change actually needs.

AI-assisted: yes - DeepSeek v4.1 (flash) as the coding agent, with a separate reviewer agent reading the change before submission. Where and on what: the measurements above were taken on Windows 11 with MSVC 19.44.35226 on an RTX 4090 (NVIDIA driver 621.24) where a C++ or GPU path is involved; Python and docs cases need none of it.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5554818630 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2634). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-29T20:32:05Z. --- Claimed in the coordination issue as **D3D12-PIPELINE-SLOW-LINE-SOURCE**. ### What and why The slow-pipeline line exists to answer "why did this take 14 seconds", and today it only says how long. When a pipeline is rebuilt on every boot, the question that matters is *where it came from* - the driver, the shared cache, or the per-pipeline journal - and whether the journal then received it. Without that, a line saying "took 14.0 s to build" cannot be told apart from a cache that never gets written. This adds three values to the existing line: the source (`shared`, `journal` or `none`), `hit`, `seeded` and `written`, so the same line says where the entry came from and whether this build is going to be found next time. ### Tested - `python -I scripts/run_semantic_tests.py tests/semantic`: 529 files, 6526 tests, **1 file failed - `test_interp_computed_ij_fallback`**, which fails on `main` today for a reason unrelated to this change (its oracle predates the toward-zero `p2` narrow); - `ctest --test-dir runtime/build -C RelWithDebInfo`: the runtime builds and its tests run; nothing here changes behaviour, only what one log line prints; - measured on the runs it was written for: 21 slow lines in one boot, 91.9 s in total, largest 20.4 s, and with the new fields the same lines show `seeded 0, written 1` - which is how the journal-versus-cache question was answered. ### GPUs tested RTX 4090, driver 32.0.16.2124, Windows 11, RelWithDebInfo. No game data is included in this change and none is needed to build it. ### The extra commit at the tip (no longer carried) **The branch used to carry `a3b5ebea1`** (`test(semantic): align computed-I/J f16 interp oracle…`), added only because `semantic-tests` was red on `main` for that oracle and every branch cut from `main` inherited it. **`main` now has the same edit as `c717967d0`**, so a rebase **drops the commit** and **this pull request no longer touches `tests/semantic/test_interp_computed_ij_fallback.py`** - the diff is only what this change actually needs. **AI-assisted:** yes - DeepSeek v4.1 (flash) as the coding agent, with a separate reviewer agent reading the change before submission. **Where and on what:** the measurements above were taken on Windows 11 with MSVC 19.44.35226 on an RTX 4090 (NVIDIA driver 621.24) where a C++ or GPU path is involved; Python and docs cases need none of it. Written with an AI assistant.
fiestorra commented 2026-11-29 20:42:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-29T20:42:46Z.


Rebased onto today's main (edf0ff5d0) and it now carries the one commit that main is missing, like my other pull requests:

2 commits over main: this change, and a3b5ebea1 (TEST-INTERP-COMPUTED-IJ-FALLBACK-RTZ)
cmake --build … --target gta6rt   -> built
python3 -m pytest tests/semantic/test_interp_computed_ij_fallback.py -q  -> 9 passed, 13 subtests

Why the second commit is here and not only in its own pull request: semantic-tests (ubuntu-latest) is red on main for the interp oracle, so any branch cut from main inherits that failure
and cannot show a green board of its own. #2633 carries the same change; if it lands first, that commit here becomes a duplicate and can be dropped, and if this lands first #2633 becomes a
no-op - either order ends with the same tree.

The runtime still builds with both, which is the only thing this change could have broken (it is one log line in runtime/shims/d3d12_vulkan_device.cpp).

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7262297907 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2634#issuecomment-7262297907). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-29T20:42:46Z. --- Rebased onto today's `main` (`edf0ff5d0`) and it now carries the one commit that `main` is missing, like my other pull requests: ``` 2 commits over main: this change, and a3b5ebea1 (TEST-INTERP-COMPUTED-IJ-FALLBACK-RTZ) cmake --build … --target gta6rt -> built python3 -m pytest tests/semantic/test_interp_computed_ij_fallback.py -q -> 9 passed, 13 subtests ``` Why the second commit is here and not only in its own pull request: `semantic-tests (ubuntu-latest)` is red on `main` for the interp oracle, so any branch cut from `main` inherits that failure and cannot show a green board of its own. **#2633** carries the same change; if it lands first, that commit here becomes a duplicate and can be dropped, and if this lands first #2633 becomes a no-op - either order ends with the same tree. The runtime still builds with both, which is the only thing this change could have broken (it is one log line in `runtime/shims/d3d12_vulkan_device.cpp`). Written with an AI assistant.
fiestorra commented 2026-11-30 14:36:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-30T14:36:00Z.


A reviewer agent found a defect in this branch that my own check missed, and this commit fixes it. Recording it here rather than quietly amending.

The defect: the new slow-pipeline line replaced the fprintf and also removed return out;, so build_compute_pipeline - which returns ComputeBuild by value - fell off the end of a non-void function. Every call that reached the end would have read an uninitialised ComputeBuild.

Why my earlier "the runtime builds and its tests run" did not catch it, measured today:

MSVC 19.44.35226, /W4 /permissive- as runtime/CMakeLists.txt sets
  without return out;   ->  builds OK, no C4715, no C4716
  with    return out;   ->  builds OK
  ctest -R '^(d3d12_vulkan_device|pipeline_cache|heavy_pipeline_cache|pipeline_workers|display_white_cache)'
       -> 9 of 9 pass, in both cases

MSVC reports neither warning for this shape - the fall-off is undefined behaviour it does not diagnose at this level - and the tests pass either way, because none of them reaches the completed-build path with a value that exposes the garbage. So "it builds and its tests pass" was true and the code was still wrong. That is the exact failure mode a second reader catches and a build does not.

What this commit changes: return out; restored where it was, and the new statements dedented to the block they belong to (hit_reported at the function's declaration level, the if body and its continuation lines at eight, not twelve). Diff against main: 13 insertions, 12 deletions, one file - same file, same intent, no behaviour change beyond removing the UB.

Also corrected after the same review: the body said the line prints "(shared, journal or none)"; the code prints "a compile", "the shared cache" or "its journal file". The code is right; the sentence is the one that was wrong, and it stays wrong in the paragraph above if I edit only the code - so treat the code as the description.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7281629659 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2634#issuecomment-7281629659). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-30T14:36:00Z. --- **A reviewer agent found a defect in this branch that my own check missed, and this commit fixes it. Recording it here rather than quietly amending.** **The defect:** the new slow-pipeline line replaced the `fprintf` **and also removed `return out;`**, so `build_compute_pipeline` - which returns `ComputeBuild` by value - **fell off the end of a non-void function**. Every call that reached the end would have read an **uninitialised `ComputeBuild`**. **Why my earlier "the runtime builds and its tests run" did not catch it, measured today:** ``` MSVC 19.44.35226, /W4 /permissive- as runtime/CMakeLists.txt sets without return out; -> builds OK, no C4715, no C4716 with return out; -> builds OK ctest -R '^(d3d12_vulkan_device|pipeline_cache|heavy_pipeline_cache|pipeline_workers|display_white_cache)' -> 9 of 9 pass, in both cases ``` **MSVC reports neither warning for this shape** - the fall-off is undefined behaviour it does not diagnose at this level - **and the tests pass either way**, because none of them reaches the completed-build path with a value that exposes the garbage. **So "it builds and its tests pass" was true and the code was still wrong.** **That is the exact failure mode a second reader catches and a build does not.** **What this commit changes:** `return out;` restored where it was, and the new statements dedented to the block they belong to (`hit_reported` at the function's declaration level, the `if` body and its continuation lines at eight, not twelve). **Diff against `main`: 13 insertions, 12 deletions, one file - same file, same intent, no behaviour change beyond removing the UB.** **Also corrected after the same review:** the body said the line prints "(`shared`, `journal` or `none`)"; the code prints `"a compile"`, `"the shared cache"` or `"its journal file"`. **The code is right; the sentence is the one that was wrong**, and it stays wrong in the paragraph above if I edit only the code - so treat the code as the description. Written with an AI assistant.
fiestorra commented 2026-11-30 14:51:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-30T14:51:07Z.


Correction to what I wrote here an hour ago, and it is about my instrument rather than the code: MSVC DID report this, and my check filtered it out.

I wrote that "MSVC at /W4 reports neither C4715 nor C4716 for this shape". That is false. Reproduced just now on the original commit of this branch (37a825340, before the fix):

cmake --build runtime/build-ninja --target gta6rt_d3d12_com
  d3d12_vulkan_device.cpp(17807) : warning C4715:
    'rt::d3d12::`anonymous namespace'::build_compute_pipeline': not all control paths return a value
  build exit status: 0
  lines containing ": error": 0

So the compiler said exactly where and what, at /W4, on the first build. My command grepped the output for : error - and once for C4716, which is a different code - so the one line that named the defect was thrown away by the filter I wrote to look for it.

Why this correction matters more than the defect: I reported "the compiler stayed silent" as a finding about MSVC, and it was a finding about my grep. The instrument worked; I read the wrong dial. Had I trusted the tool and not my filter, the defect would have been caught before the pull request, and the reviewer agent would have had nothing to find.

What the fix does not change: the commit before this one stands - the return out; is restored and the statements are indented with their block. Only the story about why it slipped through changes.

And the general form, which is the third time today this shape has bitten me: a filter that looks for one kind of evidence cannot tell you what it discarded. grep ': error' on a compiler's output must be grep 'error\|warning C4715\|warning C4716', or better, no grep at all until the build's own summary is read.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7282030840 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2634#issuecomment-7282030840). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-30T14:51:07Z. --- **Correction to what I wrote here an hour ago, and it is about my instrument rather than the code: MSVC DID report this, and my check filtered it out.** **I wrote that "MSVC at /W4 reports neither C4715 nor C4716 for this shape". That is false. Reproduced just now on the original commit of this branch (`37a825340`, before the fix):** ``` cmake --build runtime/build-ninja --target gta6rt_d3d12_com d3d12_vulkan_device.cpp(17807) : warning C4715: 'rt::d3d12::`anonymous namespace'::build_compute_pipeline': not all control paths return a value build exit status: 0 lines containing ": error": 0 ``` **So the compiler said exactly where and what, at `/W4`, on the first build.** **My command grepped the output for `: error`** - and once for `C4716`, which is a different code - **so the one line that named the defect was thrown away by the filter I wrote to look for it.** **Why this correction matters more than the defect:** **I reported "the compiler stayed silent" as a finding about MSVC**, and it was **a finding about my grep**. **The instrument worked; I read the wrong dial.** **Had I trusted the tool and not my filter, the defect would have been caught before the pull request, and the reviewer agent would have had nothing to find.** **What the fix does not change:** the commit before this one stands - the `return out;` is restored and the statements are indented with their block. **Only the story about why it slipped through changes.** **And the general form, which is the third time today this shape has bitten me:** **a filter that looks for one kind of evidence cannot tell you what it discarded.** **`grep ': error'` on a compiler's output must be `grep 'error\|warning C4715\|warning C4716'`, or better, no grep at all until the build's own summary is read.** Written with an AI assistant.
MoonEyes commented 2026-11-30 16:00:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T16:00:07Z.


Verified: CI, no-game-data, Windows runtime, Linux GPU tools, viewer and semantic checks are green after the reviewer-found return fix. Ready for merge.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7283956180 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2634#issuecomment-7283956180). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-30T16:00:07Z. --- Verified: CI, no-game-data, Windows runtime, Linux GPU tools, viewer and semantic checks are green after the reviewer-found return fix. Ready for merge.
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!2634
No description provided.