Repository navigation
Conversation
|
Reviewed and benchmarked Code review
Verification & same-machine
|
|
Solid rewrite: the contiguous-prefix detection (take_while on the x pattern) yields the compile-time run width N, columns are precomputed once in N-byte units, and the row-pair trick for narrow runs keeps writes to nearby tiled addresses together. The unreachable! on run width is safe per the GFX10 pattern shape. One coverage question: do the texture tests (or a fixture elsewhere) round-trip tile/detile across the swizzle modes and mip tails? The tail-run + second-row edge cases in walk_runs are exactly the spots where a copy could silently misalign. |
|
Independent WARP/CPU verification of Review: Only Results (CPU):
Negative control (mutating the PR head):
So the new odd-size and cross-block cases catch breakage in the new fast path. Method: no physical GPU. AI disclosure: this verification was done by Claude Code / Claude Sonnet 5.5. |
|
Automated triage for the maintainers. This reworks This is a recommendation for a maintainer to look, not an approval. Generated by Claude Code |
Adapt Marvisak/VIctory#2736 (d33104738a) to the macOS branch. Includes the offset oracle and deterministic copy-error regression tests. Co-authored-by: brainbudt <32467201+brainbudt@users.noreply.github.com>
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified against origin/main (63bcca4):
- GFX10 tiled texture copy speedup passes all 47
victory-formatsunit tests (includingaddresses_are_a_bijection_and_copies_round_trip,layouts_match_addrlib, andlayouts_share_identical_swizzle_tables). cargo clippy -p victory-formats --all-targets -- -D warnings: 0 warnings.cargo xtask policy: 192 files ok.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
|
NVIDIA full-suite run, to go with the reports above by fuzeofficlal, oni-swr, since none of them names a GPU run. Tested exact head Tested
Not tested
AI use
|
…e copies up to 2.4x
fuzeofficlal
left a comment
There was a problem hiding this comment.
The contiguous run widths (4, 8, 16, and 32 bytes in crates/victory-formats/src/texture.rs:705-761) cover all currently addressable MICRO patterns and element sizes (1..=16 B), every full-run column() offset and pattern[1][1] second-row delta is an exact multiple of N, row pairs stay within a block height (both y and tail.y are even), 3D slab alignment holds since slice == 0 for Tex3d, narrow/odd tails fall back cleanly to span(), and all validation checks precede writes in both directions. Verified address equivalence across 60 layouts / 717 subresources / 999,986 element addresses (including 231 tail and 88 bytes < N subresources) with zero mismatches.
Local verification at d3310473 (and merged onto origin/main at 8a82b503): xtask policy (184 files ok), cargo clippy -p victory-formats --all-targets (default and --all-features, 0 warnings), and cargo test -p victory-formats (debug and --release: 39 passed, 0 failed, 6 ignored; merged onto origin/main: 47 passed, 0 failed, 6 ignored) all passed. Release detile_throughput on a Ryzen 9 9950X vs origin/main (63bcca43) improved across all 14 cases by 1.43x–4.35x (e.g., BC7 64KB_D detile 8,278.7 -> 16,452.3 MB/s, BC7 64KB_S tile 12,000.7 -> 21,391.2 MB/s, RGBA8 64KB_D detile 9,937.6 -> 43,266.9 MB/s, RGBA8 4KB_S tile 13,255.4 -> 52,662.9 MB/s, RGBA8 3D 4KB_S tile 7,311.3 -> 18,624.0 MB/s). Approving.
|
I measured the odd-pitch case separately on Apple M1. Adding 37 bytes to each linear row and 19 bytes between depth slices still gave a speedup in both directions, including on a 3D volume with an odd depth.
I compared The table uses median base/PR ratios from 12 alternating release pairs on macOS 14.7, Rust 1.98.1. |
Desamodeth
left a comment
There was a problem hiding this comment.
I compared #2026 (1ec3877) and this PR (d331047) against main (63bcca4) on the same Ryzen 7 9800X3D. I would prioritize #2736 for its performance in both copy directions. One exception worth preserving in future benchmarks is detiling a rotating set of 1080p surfaces: #2026 was faster there in both processes.
Median µs per complete subresource copy on Windows x64. Columns are main / #2026 / #2736, first process:
| Synthetic layout | Detile | Tile |
|---|---|---|
| 1920×1080 RGBA8, 64KB_D | 328 / 273 / 186 | 402 / 712 / 184 |
| Same, rotating 8 input/output pairs | 675 / 442 / 460 | 572 / 723 / 369 |
| 4096² BC7, 64KB_D | 436 / 372 / 344 | 413 / 366 / 347 |
| Same, rotating 4 pairs | 1131 / 770 / 752 | 769 / 696 / 709 |
| 128×128×64 RGBA8 volume, 4KB_S | 341 / 233 / 143 | 669 / 741 / 248 |
The second process reversed the version order. The 1080p tile slowdown on #2026 repeated (380 / 741 / 188 µs), as did its advantage over #2736 for rotating 1080p detile (696 / 448 / 484 µs). The rotating BC7 detile ranking between the two PRs flipped; that case does not give a dependable winner. The linear 1080p control was within 2% across versions in each process.
Each version's actual texture.rs was compiled as a separate optimized Rust 1.98.1 MSVC library. The module on #2736's older base is byte-identical to current main. Same buffers for all three versions, all six orders, two warm-up batches and twelve measured batches. Before timing I compared each direction independently against buffers built with main's per-element Layout::offset, including padding, an untouched array slice and a small mip. The module's active tests passed on all three. CPU copies only; no game frame or GPU measurement. Coordination. AI-assisted with Codex.
Layout::detileandLayout::tilepreviously inspected every column to build a run list and visited each row and depth slice independently, revisiting tiled blocks on adjacent rows and volume slices.What changed
detile_throughputbenchmark and extend copy tests against per-elementLayout::offsetacross all addressable swizzles, element sizes, padding, odd dimensions, mip tails, array slices, 3D slabs, and error precedence.Benchmark (
detile_throughput, median of 5 release runs on Apple M4, MB/s)64KB_D64KB_S64KB_D64KB_D4KB_S64KB_D4KB_SVerification
cargo test --release -p victory-formats texture(17 tests) andcargo clippy -p victory-formats --all-targets -- -D warningspassed.cargo test --release -p victory-formats detile_throughput -- --ignored --nocapture.Created with gpt-6.2-astra in Codex (orchestrated with Gemini 4 Neon in T3 Code).