GPU: zero pipeline library description padding #1689
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1690"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-24T20:46:56Z.
Rebased onto upstream
70564aeand reduced to the part that is still needed.Why: upstream commit
9c58a1cnow gives a mesh pipeline's topology explicitly, so mesh pipelines load from the library again. The two later commits here (per-kind refusal tracking and the in-flight store recheck) are therefore obsolete and were dropped; thanks @andrewpozdnakov7-jpg for the race fix, it was correct for the old state.What remains: the pipeline library compares raw description bytes, padding included. This zeroes the padding in the descriptions read from the title's stream, in the built depth-stencil description and in the mesh stream before handover. Authorship of the remaining commit stays with Pablo Barros.
Validation on
70564ae+ this commit:read_states_carry_no_paddingandstream_subobjects_carry_no_padding— passed.-D warningsandcargo xtask policy— passed.draw::tests::a_texture_written_in_one_format_reads_in_another_through_a_placed_viewfails on this machine, but it fails identically on plainorigin/main, so it is unrelated.Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T20:57:04Z.
Review: APPROVED
Verified locally merged onto
origin/main(Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC):cargo test -p victory-gpu— 53 passed, 0 failed (1 ignored) on both RTX 5090 hardware andVICTORY_D3D12_WARP=1(includingread_states_carry_no_padding,stream_subobjects_carry_no_padding, andkinds_are_told_apart)cargo clippy -p victory-gpu --all-targets— 0 warningscargo xtask policy— okClean zeroing of pipeline library description padding and per-kind refusal tracking. Looks good.
AI-assisted (Gemini 4 Neon).
[PR #1690] GPU: zero pipeline library description padding and stop storing a kind the host refusesto [PR #1690] GPU: zero pipeline library description paddingImported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T21:42:14Z.
Review: COMMENTED
Static review only: Windows-only code (D3D12/windows_sys/Win32) — nothing compiles or runs on macOS; source review of the diff.
Pipeline library description padding is zeroed and the stored 'kind' is dropped: zero_padding writes over documented padding ranges (blend 8 ranges, depth 1, stream 4), padding_of extracts bytes for tests, and read_states_carry_no_padding/stream_subobjects_carry_no_padding assert it. Padding bytes in PSO descs are a classic source of non-deterministic pipeline cache keys — good hygiene fix.
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-24T21:29:30Z.
A worker can miss in the library, compile outside its mutex, then reach
StorePipelineafter another worker has disabled that kind. I added a recheck under the library mutex immediately before storing. The worker still returns the compiled PSO.634ecc3 is one commit directly on
1cd223804cb5edd393e8997ce64c510c9503baf2. The regression synchronizes two workers, injects the reload refusal, and uses a real WARP pipeline library for the stores. The PR head stored two entries in 10/10 runs. With the recheck, only the initial probe entry was stored in 10/10 runs. The full GPU suite passed 57 tests with one ignored. Strict GPU Clippy andcargo xtask policypassed.Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-24T21:40:40Z.
Applied as �6487b7 on top of the PR, with your authorship preserved. Locally: cargo test -p victory-gpu 54 passed, 0 failed, 1 ignored (including the new regression), clippy -D warnings and cargo xtask policy clean.
The recheck under the library mutex before StorePipeline closes exactly the window between the miss and the store; thanks for the repro and the 10/10 before/after counts.
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-24T21:45:08Z.
A warm library can already contain a name whose descriptor differs from the current pipeline. In that case both the load and the duplicate-name store fail. At
06487b74b8dc8209c45d2653c7f23c0af3821d3athis also set the verdict for the whole kind toNO, even though the first successful store and reload were still untested.4a53788 is directly on
06487b7. It leaves the verdict pending when the store fails. The WARP test puts a real compute PSO in the library under an occupied name and requests a different shader under that name. Before the change the kind was disabled in 10/10 runs. After it, a fresh name could be stored and loaded in 10/10 runs. The GPU suite passed 58 tests with one ignored. Strict GPU Clippy andcargo xtask policypassed.Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-24T21:47:37Z.
Rebased onto
70564aeand reduced to the padding fix only: upstream9c58a1cnow supplies the mesh topology, so the library loads mesh pipelines and the per-kind refusal / in-flight store commits (including your 634ecc3) are no longer needed. The padding zeroing is still required because the library compares raw bytes. See the updated PR body.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T03:34:05Z.
Automated triage for the maintainers.
Needs work. The blend (3 bytes per target) and depth-stencil (2 bytes) padding ranges in
pipeline/host.rsare right. Two points:stream_paddingmisses the 4 bytes afterStream::blend(4 + 328 = 332, aligned to 336). The blend and depth descriptions are also moved intoStreamafter zeroing, which the PR's own comment says may rewrite padding.To change the verdict: add a WARP test that stores a pipeline built from junk-padded descriptions and shows
LoadGraphicsPipeline/LoadPipelinefailing before this change and succeeding after it, cover the blend tail, and drop the unrelated line re-wrapping inmesh_pipeline. CI passes.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-25T08:37:42Z.
Closing this: I could not substantiate the premise, and on a closer look it does not hold for our own path either.
make::key, which hashesGraphicsState::describe().describeformats the fields ({:?}of each struct plus explicit components), so padding bytes never reach the key; two states that differ only in padding already hash the same.CreateGraphicsPipelineStateandCreatePipelineLibrary/StorePipelinedo not read padding; the library is loaded by name, not by comparing descriptions, so "an entry stored with other padding bytes never loads" has no mechanism behind it.stream_paddingmisses the four bytes after the blend subobject (4 + 328→ 336), and the tests only compare the zeroed ranges with themselves.If a fixture exists that shows a load failing because of padding — a WARP pipeline library stored with junk in a field's padding and loaded with zeros — reopen with that and I will do the narrow fix. The
sample_mask/mesh rewrap in this branch is unrelated and should not ride along either.Pull request closed