GPU: zero pipeline stream padding before library comparison #3508

Open
github-bot wants to merge 1 commit from github-bot/gh-3508 into main AGit
Owner

@⁠tharun-37 on GitHub · 2026-11-27 11:25 UTC · original
tharun-37:gpu/pipeline-stream-padding → main · +510 −21 · 1 files · 1 commits · open

Refs #1683.

The pipeline library compares the whole description it is given, including bytes no subobject field reads. A stream built from the same state could therefore differ from the pipeline already stored under the same name, and a later load was refused.

This zeroes those unread bytes on the final stream, immediately before it is handed to LoadPipeline or CreatePipelineState. It covers the gaps after subobject types, the tails of subobjects, the padding inside blend, depth-stencil and input-layout descriptions, and the mesh and vertex stream forms. It does not change the descriptions held in GraphicsState, so it is complementary to #2439.

Two regression tests poison the computed padding with 0xaa, zero it, and check byte-for-byte that every padding byte was cleared and every field byte was left alone.

Verification:

  • cargo test -p victory-gpu --lib: the two new tests pass; the suite has the same three pre-existing adapter-specific failures as main, and one ignored test.
  • cargo clippy -p victory-gpu --all-targets -- -A clippy::undocumented_unsafe_blocks -D warnings and the same with --features diagnostics: clean.
  • git diff --check: clean.

AI assistance (OpenCode) was used to draft the change and its tests; I reviewed the layout calculations and verified them locally.

**@⁠tharun-37** on GitHub · 2026-11-27 11:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/3508) `tharun-37:gpu/pipeline-stream-padding` → `main` · +510 −21 · 1 files · 1 commits · open Refs #1683. The pipeline library compares the whole description it is given, including bytes no subobject field reads. A stream built from the same state could therefore differ from the pipeline already stored under the same name, and a later load was refused. This zeroes those unread bytes on the final stream, immediately before it is handed to `LoadPipeline` or `CreatePipelineState`. It covers the gaps after subobject types, the tails of subobjects, the padding inside blend, depth-stencil and input-layout descriptions, and the mesh and vertex stream forms. It does not change the descriptions held in `GraphicsState`, so it is complementary to #2439. Two regression tests poison the computed padding with `0xaa`, zero it, and check byte-for-byte that every padding byte was cleared and every field byte was left alone. Verification: - `cargo test -p victory-gpu --lib`: the two new tests pass; the suite has the same three pre-existing adapter-specific failures as `main`, and one ignored test. - `cargo clippy -p victory-gpu --all-targets -- -A clippy::undocumented_unsafe_blocks -D warnings` and the same with `--features diagnostics`: clean. - `git diff --check`: clean. AI assistance (OpenCode) was used to draft the change and its tests; I reviewed the layout calculations and verified them locally.
The pipeline library compares description bytes, padding included. Zero the unread bytes of the final stream just before creation or storage so a stored pipeline and a later identical one match. Cover mesh and vertex streams, and add regression tests.

Refs #1683
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 11:26:09 +00:00
Author
Owner

@⁠oni-swr on GitHub · 2026-11-27 11:46 UTC · original

WARP/CPU verification of #3508 (head 50043815624c873cdd2cd731546643820987a187, base 63bcca43c6a00a758510398fa43096ce7e4f7df0 = merge base = main tip). No physical GPU used. Claim on #1633.

Environment: Windows 11 Pro 10.0.26200, WARP d3d10warp.dll 10.0.26100.9818, rustc 1.98.1, VICTORY_WARP=1 + VICTORY_D3D12_WARP=1, dxil.dll from Windows SDK 10.0.26100.0 (VICTORY_DXIL). Command: cargo test -p victory-gpu --lib --locked --features diagnostics -j 4 -- --test-threads=1 (the diagnostics feature is needed, otherwise the WARP variable is ignored).

victory-gpu lib passed failed ignored
base 63bcca4 246 0 1
head 50043815 248 0 1

New tests, both pass: pipeline::host::tests::mesh_stream_padding_is_zeroed_without_touching_fields and vertex_stream_padding_is_zeroed_without_touching_fields. No new failure. I saw no failures on this lane at either commit (the PR text mentions three pre-existing adapter-specific failures; none showed up with WARP here), so there are no flakes to separate out.

Findings:

  • The diff matches the description: only host.rs; padding is zeroed on the final stream right before LoadPipeline/CreatePipelineState; GraphicsState is untouched. The two tests check byte by byte that padding is cleared and field bytes are unchanged, for the mesh and the vertex stream forms.
  • Not covered by anything I ran: the tests do not create or load a pipeline through a library, so the actual symptom (a stored pipeline refused on a later load) is not exercised on WARP. The check is layout-level only.
  • Minor: zero_padding, raw and raw_mut build a &[u8]/&mut [u8] over bytes that include uninitialised padding, which is strictly not allowed for u8; ptr::write_bytes on the padding ranges would avoid it. Part of the diff is rustfmt reflow of stream_pipeline unrelated to the change.

Numbers are WARP/CPU only; no real-GPU effect measured.

AI use: Claude Code (Claude Sonnet 5.5). No game files, dumps, install paths, shader names or hashes were used.

**@⁠oni-swr** on GitHub · 2026-11-27 11:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/3508#issuecomment-7217458893) WARP/CPU verification of #3508 (head `50043815624c873cdd2cd731546643820987a187`, base `63bcca43c6a00a758510398fa43096ce7e4f7df0` = merge base = main tip). No physical GPU used. Claim on #1633. **Environment:** Windows 11 Pro 10.0.26200, WARP `d3d10warp.dll` 10.0.26100.9818, rustc 1.98.1, `VICTORY_WARP=1` + `VICTORY_D3D12_WARP=1`, `dxil.dll` from Windows SDK 10.0.26100.0 (`VICTORY_DXIL`). Command: `cargo test -p victory-gpu --lib --locked --features diagnostics -j 4 -- --test-threads=1` (the `diagnostics` feature is needed, otherwise the WARP variable is ignored). | victory-gpu lib | passed | failed | ignored | |---|---|---|---| | base 63bcca4 | 246 | 0 | 1 | | head 50043815 | 248 | 0 | 1 | New tests, both pass: `pipeline::host::tests::mesh_stream_padding_is_zeroed_without_touching_fields` and `vertex_stream_padding_is_zeroed_without_touching_fields`. No new failure. I saw no failures on this lane at either commit (the PR text mentions three pre-existing adapter-specific failures; none showed up with WARP here), so there are no flakes to separate out. **Findings:** - The diff matches the description: only `host.rs`; padding is zeroed on the final stream right before `LoadPipeline`/`CreatePipelineState`; `GraphicsState` is untouched. The two tests check byte by byte that padding is cleared and field bytes are unchanged, for the mesh and the vertex stream forms. - Not covered by anything I ran: the tests do not create or load a pipeline through a library, so the actual symptom (a stored pipeline refused on a later load) is not exercised on WARP. The check is layout-level only. - Minor: `zero_padding`, `raw` and `raw_mut` build a `&[u8]`/`&mut [u8]` over bytes that include uninitialised padding, which is strictly not allowed for `u8`; `ptr::write_bytes` on the padding ranges would avoid it. Part of the diff is rustfmt reflow of `stream_pipeline` unrelated to the change. Numbers are WARP/CPU only; no real-GPU effect measured. AI use: Claude Code (Claude Sonnet 5.5). No game files, dumps, install paths, shader names or hashes were used.
Author
Owner

@⁠passerbyyhx on GitHub · 2026-11-27 18:56 UTC · original

Windows synthetic verification at 50043815624c873cdd2cd731546643820987a187.

I exercised two real D3D12 pipeline-library streams in independent processes on RTX 4090 Laptop (621.14) and WARP. One used a depth-bounds vertex pipeline (62 padding bytes), the other a mesh pipeline (46). Each adapter ran 14 processes including the comparison paths.

Both streams stored cold and loaded warm across processes after changing the filler from AA to BB through the normalized path. Changing the sample mask gave a real miss and a successful fallback creation. A raw-stream bypass with the same padding change also hit on both drivers, as did a fixed reader opening the old raw library. These data verify canonicalization and cold/warm interoperability; the padding-only miss did not reproduce on either configuration.

Reproducible fixture. GTA-VI-3/EIGHT-20261127. AI-assisted with Codex.

**@⁠passerbyyhx** on GitHub · 2026-11-27 18:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/3508#issuecomment-7226033289) Windows synthetic verification at `50043815624c873cdd2cd731546643820987a187`. I exercised two real D3D12 pipeline-library streams in independent processes on RTX 4090 Laptop (621.14) and WARP. One used a depth-bounds vertex pipeline (62 padding bytes), the other a mesh pipeline (46). Each adapter ran 14 processes including the comparison paths. Both streams stored cold and loaded warm across processes after changing the filler from AA to BB through the normalized path. Changing the sample mask gave a real miss and a successful fallback creation. A raw-stream bypass with the same padding change **also hit** on both drivers, as did a fixed reader opening the old raw library. These data verify canonicalization and cold/warm interoperability; the padding-only miss did not reproduce on either configuration. [Reproducible fixture](https://github.com/passerbyyhx/VIctory/commit/9808b0cde00aed52b773eb7784877ad39672d78a). GTA-VI-3/EIGHT-20261127. AI-assisted with Codex.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3508/head:github-bot/gh-3508'
git switch 'github-bot/gh-3508'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3508'
git switch 'github-bot/gh-3508'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3508'
git switch 'github-bot/gh-3508'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3508'
git switch 'main'
git merge --squash 'github-bot/gh-3508'
git switch 'main'
git merge --ff-only 'github-bot/gh-3508'
git switch 'main'
git merge 'github-bot/gh-3508'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!3508
No description provided.