Skip to content

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

Merged
MoonEyes merged 2 commits into
ProjectLeonida:mainfrom
fiestorra:diag/pipeline-slow-line-source
Nov 30, 2026
Merged

MoonEyes merged 2 commits into
ProjectLeonida:mainfrom
fiestorra:diag/pipeline-slow-line-source

Conversation

@fiestorra

@fiestorra fiestorra commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

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
fiestorra force-pushed the diag/pipeline-slow-line-source branch 3 times, most recently from 55108e1 to 37a8253 Compare November 30, 2026 13:54
…as written

The slow-pipeline line reported 	ook N s to build for a timer that starts before the journal file is read
and before the shared cache is asked, so it named a compile for what could be a cache lookup. Chasing a compile
cost from it is chasing the wrong number: a run with 16 such lines had compiled exactly one pipeline.

The line now names the source (a compile, the shared cache, or the pipeline's own journal file) and carries the
hit the journal reported, whether its cache was seeded from a file, and whether the file was written afterwards.
That is what turned three contradictory readings of the same log into one, on an RTX 4090 with a warm journal:
23 slow lines, all hit 0, seeded 0, written 1 - first-sight pipelines, each compiled once and journaled.
…ines

The slow-pipeline line replaced the fprintf but also removed the function's
return out; - the body then fell off the end of a non-void function. MSVC at /W4
reports neither C4715 nor C4716 for this shape and the build stays green, so the
caller would have read an uninitialised ComputeBuild; the test suite does not
distinguish the two, which is why the earlier build-based check missed it.
Restored, and the new statements dedented to the block they belong to.
@fiestorra
fiestorra force-pushed the diag/pipeline-slow-line-source branch from 37a8253 to e3af360 Compare November 30, 2026 14:35
@fiestorra

Copy link
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
Collaborator

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.

@MoonEyes
MoonEyes merged commit c38c9e6 into ProjectLeonida:main Nov 30, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants