Skip to content

GPU: a refused pipeline says what the debug layer answered - #2471

Closed
HoLa-Lee wants to merge 1 commit into
Marvisak:mainfrom
HoLa-Lee:gpu/log-refused-pipeline-reason
Closed

HoLa-Lee wants to merge 1 commit into
Marvisak:mainfrom
HoLa-Lee:gpu/log-refused-pipeline-reason

Conversation

@HoLa-Lee

@HoLa-Lee HoLa-Lee commented Nov 25, 2026 •

Copy link
Copy Markdown

What was wrong with the first form of this

Host::log_messages already writes every stored message to the log as its own D3D12: ... warning before clearing the queue — it only returns the first error. So the answer was in the log, on a line after the refusal it explains. My first description said it was thrown away; it was not, and the patch now also drops a stray UTF-8 byte order mark it had added to line 1 of the file.

What this does

All three places that refuse a pipeline (compute, mesh and graphics) call log_messages and drop the return value. This binds it and puts the first error in the refusal line itself, so the reason comes before the line that says a pipeline was refused:

ust let messages = host.log_messages(); tracing::warn!(error = %e, ?shaders, ?messages, "host pipeline refused");

Diff is the three call sites (6 lines changed); no behaviour beyond which line the text appears on.

Why it is worth it

In some cases that line is the whole diagnosis. On this machine, with the debug layer installed, the software rasteriser refused 458 compute pipelines in a single boot of a title, and every one of them said:

ID3D12Device::CreateComputeShader: Shader wants wave lane count of 64 but maximum wave lane count for device is 4. To check for support, check device caps via the CheckFeatureSupport() API

which turns "that world drops 1,935 draws a frame on WARP" into one sentence.

How it was checked

cargo check -p victory-gpu --profile diag --features diagnostics on the rebased branch, and by the run the message above comes from. Independent runs on this PR (RTX 5070 Ti: 144 passed / 2 pre-existing #1744 failures; WARP: 146 passed; clippy clean; asset policy 182 files ok; RTX 4060: 141 passed / 2 pre-existing) were reported in the comments below.

@DenRakEiw DenRakEiw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified against origin/main (940d32f) on Windows 11 + NVIDIA GeForce RTX 5090:

  • Logging the D3D12 debug layer message when a pipeline creation is refused is clean and minimal.
  • cargo test -p victory-gpu pipeline::host::tests: 2/2 passed.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: 0 warnings.
  • cargo xtask policy: 183 files ok.

AI-assisted (Gemini 4 Neon).

@Bj0rnis

Bj0rnis commented Nov 25, 2026

Copy link
Copy Markdown

Independent Windows 11 hardware + WARP verification of #2471 at 12c2263c (clean git merge-tree with origin/main 940d32f6, Rust 1.98.1 MSVC):

Not tested: live game workload / reproducing a refused pipeline with VICTORY_D3D12_DEBUG=1.

AI-assisted test run and summary.

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A refused pipeline says what the debug layer said (+7). Small, precise. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Merge candidate. In crates/victory-gpu/src/pipeline/host.rs, the three places that refuse a pipeline (compute, mesh, graphics) now call Host::log_messages before the warning. They put its return value, the debug layer's first error, into the "host pipeline refused" line. Behaviour is otherwise unchanged: log_messages still logs every stored message as its own D3D12: ... line.

Both points from the last review are fixed:

  • the stray UTF-8 byte order mark is gone, so the diff is the three call sites only;
  • the description now says the message was already in the log on a separate line.

Optional nit: the field is named messages, but it holds only the first error (Option<String>). A name like debug_error would read more accurately.

CI: no check runs on this head; the workflow needs a maintainer's approval. Contributors report RTX 5070 Ti, WARP and RTX 4060 runs with only the known #1744 failures.


Generated by Claude Code

@Vedoxdev123

Copy link
Copy Markdown

Tested on Windows with AMD Ryzen 5 5600X + NVIDIA GeForce RTX 4060:

cargo test -p victory-gpu --lib -> 141 passed; 2 failed; 2 ignored

All tests in this branch pass on RTX 4060; the only 2 failures are the known 1,000,000 view heap cap tests (dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views from #1744).

…e refusal

`Host::log_messages` already writes every stored message to the log as its own
`D3D12: ...` warning before clearing the queue; it only returns the first
error. So the answer was in the log, but on a line after the refusal it
explains. All three places that refuse a pipeline (compute, mesh and graphics)
call it and drop the return value; this binds it and puts the first error in the
refusal line itself:

    let messages = host.log_messages();
    tracing::warn!(error = %e, ?shaders, ?messages, "host pipeline refused");

No behaviour changes beyond which line the text appears on.

That line is the whole diagnosis in some cases. On this machine, with the debug
layer installed, the software rasteriser refused 458 compute pipelines in a
single boot of a title, and every one of them said:

    ID3D12Device::CreateComputeShader: Shader wants wave lane count of 64 but
    maximum wave lane count for device is 4. To check for support, check device
    caps via the CheckFeatureSupport() API

which turns "that world drops 1,935 draws a frame on WARP" into one sentence.

Checked with `cargo check -p victory-gpu --profile diag --features diagnostics`
and by the run the message above comes from.
@Marvisak

Copy link
Copy Markdown
Owner

Automated triage for the maintainers, second look (a review against current main, with builds and tests where they could change the verdict).

Closing because it can attribute a message to the wrong pipeline. Host::log_messages already logs every stored debug-layer message as its own warning. The info queue is device-wide and several pipeline workers refuse pipelines at the same time, so the first error one worker drains may belong to another worker's pipeline.

If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

@Marvisak Marvisak closed this Nov 25, 2026
@HoLa-Lee

Copy link
Copy Markdown
Author

Understood, and agreed - closing it is right.

Host::log_messages already logs every stored message as its own D3D12: … warning, so the debug layer's reason for a refusal is in the log either way; the only thing this PR added was putting the first drained message on the refusal's own line, and with the queue being device-wide and several workers refusing at once, that message can belong to another pipeline. Attribution was the whole point of the change, so without it there is nothing left worth merging.

Evidence that the separate lines are enough, from this machine: with VICTORY_D3D12_DEBUG=1 the refusal of a mesh/pixel pipeline was named exactly, without this PR -

ID3D12Device::CreateGraphicsPipelineState: The render target format at slot 2 is format
  (R8_UINT). This format does not support blending. ...

The messages naming nit is moot now. Thanks for the careful second look - the misattribution case is real and I had not considered the workers running at the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants