Reuse column offsets for aligned XOR texture rows #551
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
hle
input
INTEL
lighting
linux-proton
memory
MULDER
needs-info
needs-logs
needs-rebase
NVIDIA
performance
post-merge
pr-diagnostics
pr-docs
pre-merge
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
relevance
high
relevance
low
relevance
medium
relevance
very-high
rendering
report
roadmap-proposal
saves
series-s
shaders
startup
status
blocked-by-rework
status
needs-test-report
status
needs-triage
status
ready-for-review
status
stale
status
superseded
status
wip
tools
ui
upstream
wontfix
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
TrustNo1/Darner!551
Loading…
Reference in a new issue
No description provided.
Delete branch "holoslicer/Darner:perf/xor-texture-row-runs"
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?
Contributor role (optional)
Fluxer ID
1577921940104949761. Please grant the Contributor role when this merges.What it changes
An XOR-tiled row with four-byte elements can have contiguous groups of four elements. The CPU detiler recomputes each group's column address on every row. For an aligned 2D 64KB_D_X mip with whole groups, compute the column offsets once and reuse them for fixed 16-byte copies. The row and slice still contribute their own XOR bits. Temporary storage is bounded at 8 KiB. Ineligible shapes, allocation failure and reverse tiling use the existing walker.
How it was tested
c8258f9and candidatebab2d973. Core i7-12700K, Windows x64 and Rust 1.98.1. Each 32 MiB group converted eight distinct 1024×1024 RGBA8 images through the publicLayout::detileAPI. Six processes per revision. Every output was checked against an independently generated linear image outside the timed section.cargo test --locked -p darner-formats --lib texture::on this commit. The padded-row regression checks array slices, both pipe configurations, every mip, a partial right edge, BC7 and an oversized row. It verifies untouched padding as well as every output element.b5be4d4predating this change. A freshly built official main and this revision each passed the scratch test in isolation. On the first full rerun of the identical GPU test executable, both original failures passed and the page-epoch assertion failed. That assertion passed alone. A fresh complete run of that same binary then passed all 1,823 tests with 81 ignored. All other workspace targets passed in the original run.Reproduce the six-layout workload
Save the Rust source below as
crates/darner-formats/examples/profile_texture_rows.rsin each checkout. Runcargo run --locked --profile fast -p darner-formats --example profile_texture_rows -- 0, then repeat with starting offsets 1 through 5. Pin each process to the same logical CPU and alternate which revision runs first. CPU layout construction, source generation and byte checks occur outside the measured interval. Each logged group contains 32 MiB.Checklist
Checked for overlap
crates/darner-formats/src/texture.rs. No open PR touched that file at the time of the check.WIP: [pr-performance][rendering] Reuse column offsets for aligned XOR texture rowsto [pr-performance][rendering] Reuse column offsets for aligned XOR texture rowsIndependent CPU-only run of the six-layout example from this PR, comparing
c8258f9andbab2d973on a Ryzen 7 5800X, Linux x86_64, rustc 1.98.1. I used thefastprofile, one pinned logical CPU, six alternating process pairs and 15 measured 32 MiB groups per layout per process. All byte checks passed, andcargo test --locked --offline -p darner-formats --lib texture::passed 38 tests on each commit.64KB_D_X64KB_D64KB_D_XFor the targeted layout, three of six paired process medians improved. The median paired reduction was 0.45%. A separate instrumented build using the same profile confirmed that all eight RGBA8 XOR images in a group took the new row path. The timings above are from uninstrumented builds.
The byte-for-byte result held on this setup. I did not reproduce the large Windows/Intel speedup on this Linux/AMD run. No gameplay or GPU timing was measured.
Analysis reviewed with Codex and Claude Code.
Tested
bab2d97vsorigin/main(c8258f9) via unattended 90 sscripts/bench.ps1runs (same switches, identicaldiagprofile without--features diagnostics, warm cache, RTX 5070 Ti 16 GB, Series X, 1080p->1440p DLSS Quality, DLSS MFG 3x, RT off,DARNER_RDNA_FLOAT=2,DARNER_SAMPLED_MARKS=0):origin/main(c8258f9)bab2d97)4500-7000 drawsbandcargo test --locked -p darner-formatspassed 95/95 (7ignored). Note on variance: the PR #551 run had a somewhat lighter draw mix (median6,304vs6,905draws/frame onmain), though within the matched4500-7000draw band FPS was cleanly higher with zero visual issues or crashes (single A/B pair; not a full ABBA).Follow-up on the same Ryzen 7 5800X. I repeated the six-layout CPU harness at
c8258f9andbab2d973with rustc 1.98.1, thefastprofile, and thex86_64-pc-windows-msvctarget running under Wine 11.23. The six pairs alternated order on one pinned logical CPU. Each process checked all output bytes and measured 15 groups of 32 MiB for each layout.64KB_D_X64KB_D_X64KB_D_XcontrolThe time columns are medians of the per-process medians. All six Windows-target pairs improved for the eligible RGBA8 layout (49.30–51.87%). This reproduces a large effect on AMD with the Windows build. The experiment varies the compilation target and runtime together. I inspected the generated LLVM IR for both targets and confirmed the candidate emits its separate offset-table loop alongside the existing fallback. The timing comparison is scoped to the CPU copy.
I also ran a streamed single-slice mip regression on both commits. It used the exact
bytes_from(level)prefix, both pipe configurations, padded rows, and an independent per-element reference viaLayout::offset. Both passed, including rejection of a prefix one byte shorter. On the candidate I also checked that the row helper took the eligible 4096-element case and qualifying mip-tail rows. These runs used synthetic inputs. Reviewed and tested with Claude Code and Codex.[pr-performance][rendering] Reuse column offsets for aligned XOR texture rowsto Reuse column offsets for aligned XOR texture rowsTest needed — commit
bab2d973; what to check: An XOR-tiled row with four-byte elements can have contiguous groups of four elements. The CPU detiler recomputes each group's column address on every row. For an aligned 2D 64KB_D_X mip with whole groups, compute the column offsets once and reuse them for fixed 16-byte copies. The row and slice still contribute their own XOR bits. Temporary storage is bounded at 8 KiB. Ineligible shapes, allocation failure and reverse tiling use the existing walker.Evidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture.
Reply
testingto take this run; it's free again after 24 h with no results.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.