GPU: clear final mesh pipeline-stream padding after typed moves #1739

Open
github-bot wants to merge 3 commits from github-bot/gh-1739 into main AGit
Owner

@⁠jaschinski97-ops on GitHub · 2026-11-24 21:40 UTC · original
jaschinski97-ops:fix/upstream-final-pipeline-padding → main · +172 −17 · 1 files · 3 commits · open

Clear mesh pipeline-stream padding at its final address, after all typed moves and immediately before passing the stream to D3D12. This includes the trailing Blend subobject bytes and nested Blend/Depth padding; clearing a typed source description cannot guarantee the final padding.

Updated against upstream main 940d32f. This began as a follow-up to the padding analysis in #1690, but main now fixes mesh library loading itself. The final diff changes only pipeline/host.rs and preserves main's LoadPipeline path and topology subobject. #1041 was also checked: its earlier typed-source cleanup does not guarantee final stream bytes. Coordination: PR #1739 in #1633.

  • Move the mesh stream type into module scope for layout checks.

  • Clear individual outer and nested padding ranges through raw writes; do not form byte slices across other possibly uninitialized padding.

  • End the samples padding at its subobject boundary, before the newly added topology field.

  • Poison known final padding with 0xAA in the regression test, then verify it is zero and fields remain intact. Topology type/value are asserted separately, so an overbroad range would fail.

Validation: Windows 11, RTX 3080 driver 32.0.16.2140; Rust 1.98.1 Windows GNU.

  • Regression against the earlier cleaner fails at bytes 396..400. All three final main-940d32f host-state tests pass, including final padding and the two upstream input-offset tests.

  • GPU Clippy, all targets/all features, warnings denied: passed. Asset policy passed. Independent review of final byte ranges and topology preservation: no blocking findings.

This makes final descriptor padding deterministic; no game execution, FPS improvement or complete hardware compatibility is claimed. No game data was used.

AI-assisted with Codex: a separate agent implemented the original fix; coordinator adapted it to current main, followed by independent review. GitHub Actions passes on head 8433d20 (Windows MSVC).

Combined local validation (main 940d32f + all three contributions, integration cfa116d):

  • cargo clippy --locked --workspace --all-targets --all-features -- -D warnings: passed.

  • cargo test --locked --workspace --all-features --no-fail-fast -- --test-threads=1: completed unfiltered; six tests fail. Shader suite: 271 passed, 3 failed, 3 ignored. GPU suite: 145 passed, 2 failed, 2 ignored. The five GPU/shader failures were independently reproduced on bare main 940d32f. The sixth is loads_binds_and_calls_probe: its unchanged fixture passes MSVC /DELAYLOAD to the local GNU linker, which rejects it.

  • The baseline failures are dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views, a_heap_buffer_read_by_element_takes_the_views_stride, a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, and gathers_at_a_level_match_the_hardware. The full local workspace run is therefore explicitly not reported as passing.

  • New regression tests and the repository asset policy pass. All three PRs also pass GitHub's Windows MSVC CI. Green CI does not substitute for the separately reported RTX readback evidence.

Refresh against main 67e8ae1 (2026-11-25)

Current-main refresh: head 9a795f4 merges main 67e8ae1401df112248aed36d0024483181b718b7 without changing the cleanup. All 3 pipeline host-state tests pass, including final padding, input offsets and topology preservation. Combined workspace Clippy, all targets/all features with warnings denied, passes. GitHub Windows MSVC CI: https://github.com/Marvisak/VIctory/actions/runs/45652459605 (passed on this head).

Independent measurement caveat: the app-local WARP 1.0.22 test did not reproduce padding-induced library misses with the debug layer off; the field-change control was rejected, and explicit triangle topology was necessary. This PR preserves that topology and makes final padding deterministic. The report does not establish the original debug-layer condition from #1683, and this PR does not claim a measured cache-hit or performance improvement. The external measurement was not rerun locally, and its code has not been copied.

Coordination bookkeeping: the earlier claim label was incorrect; see the correction.

**@⁠jaschinski97-ops** on GitHub · 2026-11-24 21:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/1739) `jaschinski97-ops:fix/upstream-final-pipeline-padding` → `main` · +172 −17 · 1 files · 3 commits · open Clear mesh pipeline-stream padding at its final address, after all typed moves and immediately before passing the stream to D3D12. This includes the trailing Blend subobject bytes and nested Blend/Depth padding; clearing a typed source description cannot guarantee the final padding. Updated against upstream main 940d32f. This began as a follow-up to the padding analysis in #1690, but main now fixes mesh library loading itself. The final diff changes only pipeline/host.rs and preserves main's LoadPipeline path and topology subobject. #1041 was also checked: its earlier typed-source cleanup does not guarantee final stream bytes. Coordination: PR #1739 in #1633. - Move the mesh stream type into module scope for layout checks. - Clear individual outer and nested padding ranges through raw writes; do not form byte slices across other possibly uninitialized padding. - End the samples padding at its subobject boundary, before the newly added topology field. - Poison known final padding with 0xAA in the regression test, then verify it is zero and fields remain intact. Topology type/value are asserted separately, so an overbroad range would fail. Validation: Windows 11, RTX 3080 driver 32.0.16.2140; Rust 1.98.1 Windows GNU. - Regression against the earlier cleaner fails at bytes 396..400. All three final main-940d32f host-state tests pass, including final padding and the two upstream input-offset tests. - GPU Clippy, all targets/all features, warnings denied: passed. Asset policy passed. Independent review of final byte ranges and topology preservation: no blocking findings. This makes final descriptor padding deterministic; no game execution, FPS improvement or complete hardware compatibility is claimed. No game data was used. AI-assisted with Codex: a separate agent implemented the original fix; coordinator adapted it to current main, followed by independent review. GitHub Actions passes on head 8433d20 (Windows MSVC). Combined local validation (main 940d32f + all three contributions, integration cfa116d): - `cargo clippy --locked --workspace --all-targets --all-features -- -D warnings`: passed. - `cargo test --locked --workspace --all-features --no-fail-fast -- --test-threads=1`: completed unfiltered; six tests fail. Shader suite: 271 passed, 3 failed, 3 ignored. GPU suite: 145 passed, 2 failed, 2 ignored. The five GPU/shader failures were independently reproduced on bare main 940d32f. The sixth is `loads_binds_and_calls_probe`: its unchanged fixture passes MSVC `/DELAYLOAD` to the local GNU linker, which rejects it. - The baseline failures are `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views`, `a_heap_buffer_read_by_element_takes_the_views_stride`, `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`, and `gathers_at_a_level_match_the_hardware`. The full local workspace run is therefore explicitly not reported as passing. - New regression tests and the repository asset policy pass. All three PRs also pass GitHub's Windows MSVC CI. Green CI does not substitute for the separately reported RTX readback evidence. ### Refresh against main 67e8ae1 (2026-11-25) Current-main refresh: head `9a795f4` merges main `67e8ae1401df112248aed36d0024483181b718b7` without changing the cleanup. All 3 pipeline host-state tests pass, including final padding, input offsets and topology preservation. Combined workspace Clippy, all targets/all features with warnings denied, passes. GitHub Windows MSVC CI: https://github.com/Marvisak/VIctory/actions/runs/45652459605 (passed on this head). Independent measurement caveat: [the app-local WARP 1.0.22 test](https://git.gtahub.st/github/Marvisak--VIctory/pulls/1739) did not reproduce padding-induced library misses with the debug layer off; the field-change control was rejected, and explicit triangle topology was necessary. This PR preserves that topology and makes final padding deterministic. The report does not establish the original debug-layer condition from #1683, and this PR does not claim a measured cache-hit or performance improvement. The external measurement was not rerun locally, and its code has not been copied. Coordination bookkeeping: the earlier claim label was incorrect; see the [correction](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:43:22 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:35 UTC · original · edited 2026-11-25 22:17 UTC

Automated triage for the maintainers.

Needs rebase. This PR no longer merges cleanly into main (conflict in crates/victory-gpu/src/pipeline/host.rs). It will be reviewed again once it is rebased.

From the earlier needs-work note, still open: evidence that padding bytes cause a pipeline-library cache miss on a real driver (or with the #1683 debug-layer setup); the WARP comparison in this thread found none.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/1739#issuecomment-7149725871) · edited 2026-11-25 22:17 UTC <!-- victory-triage v1 head=9a795f4a4ee4582b3f65c24fc63a2e81a715f8dc verdict=needs-rebase at=2026-11-25T22:20:40Z --> Automated triage for the maintainers. **Needs rebase.** This PR no longer merges cleanly into `main` (conflict in `crates/victory-gpu/src/pipeline/host.rs`). It will be reviewed again once it is rebased. From the earlier needs-work note, still open: evidence that padding bytes cause a pipeline-library cache miss on a real driver (or with the #1683 debug-layer setup); the WARP comparison in this thread found none. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠jaschinski97-ops on GitHub · 2026-11-25 10:57 UTC · original

Rebase status: current head 8433d20 includes main 940d32f, merges cleanly, and passes Windows MSVC CI. The earlier needs-rebase triage refers to 9c7ca2c. The current diff changes only pipeline/host.rs and preserves upstream mesh library loading and the topology subobject.

The final-storage poisoning test and both upstream input-layout regressions pass locally. Independent integration review also checked the samples padding ends before topology and that both topology fields remain intact. The local NVIDIA heap baseline failures are separately documented in the description. Thank you for the independent RTX 5090/WARP review.

**@⁠jaschinski97-ops** on GitHub · 2026-11-25 10:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/1739#issuecomment-7160391748) Rebase status: current head 8433d20 includes main 940d32f, merges cleanly, and passes Windows MSVC CI. The earlier needs-rebase triage refers to 9c7ca2c. The current diff changes only pipeline/host.rs and preserves upstream mesh library loading and the topology subobject. The final-storage poisoning test and both upstream input-layout regressions pass locally. Independent integration review also checked the samples padding ends before topology and that both topology fields remain intact. The local NVIDIA heap baseline failures are separately documented in the description. Thank you for the independent RTX 5090/WARP review.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 14:22 UTC · original

I ran a padding-only comparison for the review on head 8433d20, using synthetic shaders on app-local WARP 1.0.22 and D3D12 Agility 1.620.2. The fixture stored the PSOs with zeroed padding, serialized and reopened the library, then changed one group of padding bytes at a time to 0xaa in the final descriptions while keeping the fields unchanged.

Change at load Mesh LoadPipeline Classic LoadGraphicsPipeline
Same description Loaded Loaded
Outer mesh-stream padding only Loaded —
Blend padding only Loaded Loaded
Depth-stencil padding only Loaded Loaded
SampleMask changed (field-change control) E_INVALIDARG E_INVALIDARG

A separate mesh PSO created and stored without an explicit primitive-topology subobject failed to reload even with zeroed padding and the same description. The corresponding stream with explicit triangle topology loaded. On this runtime, explicit topology mattered and I did not reproduce a padding-induced cache miss for either API, including the classic path discussed in #2439.

These are WARP results with the debug layer off. A separate attempt to enable the debug layer returned DXGI_ERROR_SDK_COMPONENT_MISSING, so the original debug-layer configuration in #1683 still needs an independent run.

If this test is reused, please retain the Git author when cherry-picking or rebasing. If it is folded into another commit, please add Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

AI-assisted with Codex. Synthetic shaders only.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 14:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/1739#issuecomment-7165175998) I ran a padding-only comparison for the review on head `8433d20`, using synthetic shaders on app-local WARP 1.0.22 and D3D12 Agility 1.620.2. The fixture stored the PSOs with zeroed padding, serialized and reopened the library, then changed one group of padding bytes at a time to `0xaa` in the final descriptions while keeping the fields unchanged. | Change at load | Mesh `LoadPipeline` | Classic `LoadGraphicsPipeline` | | --- | --- | --- | | Same description | Loaded | Loaded | | Outer mesh-stream padding only | Loaded | — | | Blend padding only | Loaded | Loaded | | Depth-stencil padding only | Loaded | Loaded | | `SampleMask` changed (field-change control) | `E_INVALIDARG` | `E_INVALIDARG` | A separate mesh PSO created and stored without an explicit primitive-topology subobject failed to reload even with zeroed padding and the same description. The corresponding stream with explicit triangle topology loaded. On this runtime, explicit topology mattered and I did not reproduce a padding-induced cache miss for either API, including the classic path discussed in #2439. These are WARP results with the debug layer off. A separate attempt to enable the debug layer returned `DXGI_ERROR_SDK_COMPONENT_MISSING`, so the original debug-layer configuration in #1683 still needs an independent run. If this test is reused, please retain the Git author when cherry-picking or rebasing. If it is folded into another commit, please add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`. AI-assisted with Codex. Synthetic shaders only.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/pipeline/host.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1739'
git switch 'github-bot/gh-1739'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1739'
git switch 'github-bot/gh-1739'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1739'
git switch 'main'
git merge --squash 'github-bot/gh-1739'
git switch 'main'
git merge --ff-only 'github-bot/gh-1739'
git switch 'main'
git merge 'github-bot/gh-1739'
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!1739
No description provided.