GPU diagnostics: count texture data without row padding #2528

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

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 15:21 UTC · original
andrewpozdnakov7-jpg:codex1/probe-texture-rows → main · +58 −5 · 1 files · 3 commits · open

The diagnostic probe reads the first slice of a 1D or 3D UAV texture after a dispatch. Its dword count and sample values came from pitched rows, so padding changed the denominator and could appear in the sample.

Count the unpadded bytes of each row and stop the mapped span at the last texel. A final partial dword is zero-extended. D3D12 footprint row size and pitch

The same synthetic test uses a 2 × 2 R32 layout with 256-byte row pitch, three nonzero values, and sentinel bytes in the padding. The original counting logic from 67e8ae1401 reports 127 of 128 dwords set. ca477f2 reports 3 of 4 and returns all four texels in order. It also passes the unpadded final-row and partial-dword cases.

Windows/WARP serial GPU suite passed with 199 passed and 1 ignored under both D3D12 debug flag settings. Strict GPU Clippy in both modes and the asset policy passed. AI-assisted. The change affects diagnostic statistics.

Coordination claim

Please preserve the Git author when reapplying the change. If you fold the code or test into another commit, please add this trailer.

Co-authored-by: andrewpozdnakov7-jpg [email protected]

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 15:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/2528) `andrewpozdnakov7-jpg:codex1/probe-texture-rows` → `main` · +58 −5 · 1 files · 3 commits · open The diagnostic probe reads the first slice of a 1D or 3D UAV texture after a dispatch. Its dword count and sample values came from pitched rows, so padding changed the denominator and could appear in the sample. Count the unpadded bytes of each row and stop the mapped span at the last texel. A final partial dword is zero-extended. [D3D12 footprint row size and pitch](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-getcopyablefootprints) The same synthetic test uses a 2 × 2 R32 layout with 256-byte row pitch, three nonzero values, and sentinel bytes in the padding. The original counting logic from 67e8ae1401df112248aed36d0024483181b718b7 reports 127 of 128 dwords set. ca477f2 reports 3 of 4 and returns all four texels in order. It also passes the unpadded final-row and partial-dword cases. Windows/WARP serial GPU suite passed with 199 passed and 1 ignored under both D3D12 debug flag settings. Strict GPU Clippy in both modes and the asset policy passed. AI-assisted. The change affects diagnostic statistics. [Coordination claim](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633) Please preserve the Git author when reapplying the change. If you fold the code or test into another commit, please add this trailer. Co-authored-by: andrewpozdnakov7-jpg <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:08:20 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 16:15 UTC · original · edited 2026-11-26 00:24 UTC

Automated triage for the maintainers.

Merge candidate. Re-reviewed after the rebase (0e48cc8, merges cleanly into current main). The diagnostics probe for 1D/3D UAV textures after a dispatch (State::probe_written in crates/victory-gpu/src/draw.rs) now reads from the footprint's offset and stops at the last texel. written_texture_words counts only each row's unpadded bytes and zero-extends a final partial dword, so row padding no longer inflates the dword count or appears in the sample. The span length (rows - 1) * pitch + row_bytes is bounded by the readback footprint, and element handles block-compressed rows. The change is diagnostics-only (behind feature = "diagnostics"), and the unit test covers padded rows, an unpadded final row and a partial dword. CI: check passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 16:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/2528#issuecomment-7167723670) · edited 2026-11-26 00:24 UTC <!-- victory-triage v1 head=0e48cc8cf3a372986c74e6c25263d4470f49aabe verdict=merge-candidate at=2026-11-26T00:24:00Z --> Automated triage for the maintainers. **Merge candidate.** Re-reviewed after the rebase (`0e48cc8`, merges cleanly into current `main`). The diagnostics probe for 1D/3D UAV textures after a dispatch (`State::probe_written` in `crates/victory-gpu/src/draw.rs`) now reads from the footprint's offset and stops at the last texel. `written_texture_words` counts only each row's unpadded bytes and zero-extends a final partial dword, so row padding no longer inflates the dword count or appears in the sample. The span length `(rows - 1) * pitch + row_bytes` is bounded by the readback footprint, and `element` handles block-compressed rows. The change is diagnostics-only (behind `feature = "diagnostics"`), and the unit test covers padded rows, an unpadded final row and a partial dword. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 16:45 UTC · original

Updated the branch for 67e8ae1401. The same native Windows test gets 127 of 128 nonzero dwords from the old counting logic and 3 of 4 after the patch. The test checks all four texels, the unpadded final row and a partial dword. Serial Windows/WARP GPU suite 199 passed and 1 ignored in both debug flag settings. Strict GPU Clippy in both modes and policy passed.

Updated commit

If you fold the change or test into another commit, please preserve the Git author or add this trailer.

Co-authored-by: andrewpozdnakov7-jpg [email protected]

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 16:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/2528#issuecomment-7168498216) Updated the branch for 67e8ae1401df112248aed36d0024483181b718b7. The same native Windows test gets 127 of 128 nonzero dwords from the old counting logic and 3 of 4 after the patch. The test checks all four texels, the unpadded final row and a partial dword. Serial Windows/WARP GPU suite 199 passed and 1 ignored in both debug flag settings. Strict GPU Clippy in both modes and policy passed. [Updated commit](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/ca477f2e1fdd57cedc53bf70ca1c174057393fc6) If you fold the change or test into another commit, please preserve the Git author or add this trailer. Co-authored-by: andrewpozdnakov7-jpg <[email protected]>
Author
Owner

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

I resolved the test-module conflict with #1778 and kept both fixtures in 0e48cc8.

The same synthetic 256-byte-pitch fixture run with the unchanged counting logic in f3578e3 counts 127 of 128 dwords set. The update counts 3 of 4 without including row padding, preserves the four sample values, and passes the short final-row and partial-dword controls. The upstream sampler-heap test also passes.

Both serial Windows/WARP GPU suites passed with 244 tests and one ignored. GPU Clippy with and without diagnostics and asset policy passed.

Please retain the Git author when carrying the fix or tests. If folded into another commit, please add this trailer.

Co-authored-by: andrewpozdnakov7-jpg [email protected]

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 22:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/2528#issuecomment-7176409901) I resolved the test-module conflict with #1778 and kept both fixtures in [0e48cc8](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/0e48cc8cf3a372986c74e6c25263d4470f49aabe). The same synthetic 256-byte-pitch fixture run with the unchanged counting logic in `f3578e3` counts 127 of 128 dwords set. The update counts 3 of 4 without including row padding, preserves the four sample values, and passes the short final-row and partial-dword controls. The upstream sampler-heap test also passes. Both serial Windows/WARP GPU suites passed with 244 tests and one ignored. GPU Clippy with and without diagnostics and asset policy passed. Please retain the Git author when carrying the fix or tests. If folded into another commit, please add this trailer. Co-authored-by: andrewpozdnakov7-jpg <[email protected]>
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 00:35 UTC · original

Code review and hardware + WARP verification at head 0e48cc8cf3a3 merged cleanly onto main (63bcca43c6a0):

  • Code review: Scoped cleanly to #[cfg(feature = "diagnostics")] probe_written in crates/victory-gpu/src/draw.rs. Computing rows = Height.div_ceil(block) and row_bytes = Width.div_ceil(block) * element via resource::element handles both 4x4 block-compressed and uncompressed formats, and sizing the mapped slice to (rows - 1) * pitch + row_bytes removes 256-byte row-pitch padding noise and avoids reading past the end of subresource 0's readback buffer. written_texture_words slices each row to row[..row_bytes], zero-pads partial trailing <4-byte rows without bleeding across rows, and safely returns None for formats not covered by resource::element.
  • Verified (Windows 11, NVIDIA RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1, Rust 1.98.1):
    • cargo xtask policy: 191 files ok
    • cargo clippy --locked -p victory-gpu --tests -- -D warnings (default + --features diagnostics): 0 warnings
    • Default draw::tests (VICTORY_D3D12_DEBUG=1): 20/20 passed
    • RTX 5090 (--features diagnostics, VICTORY_D3D12_DEBUG=1, draw::tests): 21/21 passed (including written_texture_probe_counts_texels_without_row_padding)
    • WARP (--features diagnostics, VICTORY_D3D12_DEBUG=1, draw::tests): 21/21 passed

Looks clean and ready to merge.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 00:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/2528#issuecomment-7178923063) Code review and hardware + WARP verification at head `0e48cc8cf3a3` merged cleanly onto `main` (`63bcca43c6a0`): - **Code review**: Scoped cleanly to `#[cfg(feature = "diagnostics")]` `probe_written` in `crates/victory-gpu/src/draw.rs`. Computing `rows = Height.div_ceil(block)` and `row_bytes = Width.div_ceil(block) * element` via `resource::element` handles both 4x4 block-compressed and uncompressed formats, and sizing the mapped slice to `(rows - 1) * pitch + row_bytes` removes 256-byte row-pitch padding noise and avoids reading past the end of subresource 0's readback buffer. `written_texture_words` slices each row to `row[..row_bytes]`, zero-pads partial trailing `<4`-byte rows without bleeding across rows, and safely returns `None` for formats not covered by `resource::element`. - **Verified (Windows 11, NVIDIA RTX 5090 + WARP, `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok` - `cargo clippy --locked -p victory-gpu --tests -- -D warnings` (default + `--features diagnostics`): 0 warnings - Default `draw::tests` (`VICTORY_D3D12_DEBUG=1`): 20/20 passed - RTX 5090 (`--features diagnostics`, `VICTORY_D3D12_DEBUG=1`, `draw::tests`): 21/21 passed (including `written_texture_probe_counts_texels_without_row_padding`) - WARP (`--features diagnostics`, `VICTORY_D3D12_DEBUG=1`, `draw::tests`): 21/21 passed Looks clean and ready to merge.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/2528/head:github-bot/gh-2528'
git switch 'github-bot/gh-2528'

Merge

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