Textures: detile and tile levels a block at a time, in runs of x neighbours #901
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!901
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-901"
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?
@mastrr9 on GitHub · 2026-11-24 08:00 UTC · original
mastrr9:perf/tiling-block-runs→main· +538 −41 · 2 files · 1 commits · openSpeeds up CPU-side console texture detiling and tiling (
detile_level,tile_level,detile_volume,tile_volumeincrates/xcl/src/gpu/tiling.rs):memcpyand row-wide walks with a single block-by-block walk that splits x/y/z offsets, uses fixed-size element copies, and copies aligned runs of up to 16 B of x-neighbours at once (falling back element-by-element where swizzle bits overlap).#[ignore]benchmark harness (crates/xcl/tests/tiling_perf.rs).Tested
617.42/32.0.16.1742), Windows 11 Pro 25H2 (26200.9974),rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC debug, DXC Windows SDK10.0.26100.0,d3d12SDKLayers.dllinstalled8b521d5d5a9a88cf299e26d0c81520a948eef4f3(HEAD2e88e656a3e1f9096d9c06e2d8314657510c716ehas an identical tree; only commit author metadata was updated after GitHub account rename)cargo build --workspace: clean (no new warnings; only pre-existingfetch_updatedeprecation warning)cargo test --workspace -- --test-threads=4: 718 passed, 0 failed, 42 ignored (extra ignored item is the manual benchmark intests/tiling_perf.rs)SKIPPEDGPU tests:gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64Regression run
Smoke run by @Toons29 in comment below: #901
Contributed by a community tester; the PR author did not run it. Both blocks are pasted as posted.
main:
PR:
Tester's setup and limits: AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.Tester's AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; the tester checked the blocks before posting.Not tested
AI use
Detiling still cost a bounds-checked, runtime-length copy (a memcpy call) per element, and tile_level, detile_volume and tile_volume recomputed the whole element_at_z (two divisions, six table lookups) for every element. Rows were walked across the whole level, so on a 3840-wide surface the rows of blocks 64 KB (or 4 KB) apart fall in the same cache sets and evict each other before the next rows use the rest of their lines. All four now share one walk: the x part of the offset once per level, the y part once per row, z once per depth slice. Copies are specialised by element size (1 to 16 B), and in every mode the lowest address bits are x bits, so an aligned group of 2 to 16 x neighbours lies in consecutive bytes: it is one fixed-size copy of up to 16 B, in every row whose y / z / base swizzle bits leave those bits alone (otherwise element by element). The level is walked block by block. Output is byte-identical: bytes past the end of the source still read as 0 per element, and tiling into a slice too short (or from a linear one too short) falls back to the old row-major order so it panics having written the same elements. Tests: the old element-by-element functions kept as reference models, compared on every mode (linear too), element size and 10 pipe configs, sizes around the block, mips with tails, base swizzles (unaligned and past the block), array slices, 3D thick / thin / linear, truncated sources, odd origins and pitches, and short destinations and linear buffers. Measured (Linux harness, release, median of 6 alternating runs each, 4 shared cores): RGBA8 3840x2160 64KB_D detile_level 34.3 -> 11.2 ms (3.1x) tile_level 126.2 -> 10.4 ms (12.1x) RGBA8 3840x2160 4KB_S detile_level 34.3 -> 11.1 ms (3.1x) RGBA8 3840x2160 R_X (SX) detile_level 35.5 -> 10.9 ms (3.2x) BC7 3840x2160 64KB_D detile_level 2.18 -> 1.38 ms (1.6x) tile_level 11.2 -> 1.06 ms (10.6x) BC7 4096x4096, 13 mips detile_level 7.33 -> 3.99 ms (1.8x) RGBA8 256x256x64 4KB_S detile_volume 72.1 -> 10.4 ms (7.0x) thick tile_volume 59.0 -> 6.5 ms (9.0x) A memcpy of the same bytes into a new Vec takes 4.1 ms (RGBA8) and 0.69 ms (BC7) on the same machine. Assisted-by: Claude Code (Claude Opus 5.5)@SlopTart on GitHub · 2026-11-24 09:34 UTC · original
Linux / AMD RDNA3 datapoint.
Merged state: head
2e88e65onto main09940bb, clean merge.Full suite,
cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 712 passed, 7 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows. detile/tile run tests green.Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.
Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross
x86_64-pc-windows-gnu,XCL_NETWORK=0, release profile,--test-threads=4. My Linux rows: #42 / #718.AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
@Toons29 on GitHub · 2026-11-25 03:07 UTC · original
Regression run of
2e88e656on the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon4178e888, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 100 % of
main's frames, 100 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; I checked the blocks before posting.@JJAutoCompare on GitHub · 2026-11-25 05:50 UTC · original
Empirical test report (
2e88e656)Hardware / environment
2e88e656a3e1f9096d9c06e2d8314657510c716ein a clean detached worktree on Windows x64, build 26200. AMD64 Family 23 Model 113 Stepping 0 with 12 logical processors.rustc 1.100.0 (0ef1bc386 2026-11-09)and DXC1.9.2609.5 (01b62ad47). Both focused runs usedXCL_ADAPTER=NONE_CPU_ONLYandRUST_TEST_NOCAPTURE=1. They ran outsideInvoke-ArcTest.ps1with zero Arc GPU mutex hold.Commands and results
cargo test --workspace --no-runexited 0 and compiled the workspace test executables.cargo test -p xcl --lib gpu::tiling::tests:: -- --nocaptureexited 0 with 17 passed, 0 failed, 0 ignored, 0 skipped, and 681 filtered out. The harness finished in 27.78 s.cargo test --release -p xcl --test tiling_perf -- --ignored --nocaptureexited 0 with 1 opt-in benchmark passed, 0 failed, 0 ignored, and 0 skipped.Observed behavior
Not tested
The full GPU workspace suite, game smoke runs, and a performance comparison against
mainwere omitted.AI use
Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against
pr901-focused.logand published.@DavidM1911 on GitHub · 2026-11-25 09:41 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
github-bot referenced this pull request2026-11-26 08:59:16 +00:00
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.