Textures: detile and tile levels a block at a time, in runs of x neighbours #895

Open
mastrr9 wants to merge 1 commit from upstream-pr/901 into main
mastrr9 commented 2026-11-24 08:00:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by mastrr9 on 2026-11-24T08:00:05Z.


Speeds up CPU-side console texture detiling and tiling (detile_level, tile_level, detile_volume, tile_volume in crates/xcl/src/gpu/tiling.rs):

  • Replaces per-element bounds-checked runtime-length memcpy and 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).
  • Produces byte-identical output across all tiling modes and adds comprehensive equivalence tests plus a manual #[ignore] benchmark harness (crates/xcl/tests/tiling_perf.rs).

Tested

  • Hardware/OS: NVIDIA RTX 5080 (driver 617.42 / 32.0.16.1742), Windows 11 Pro 25H2 (26200.9974), rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC debug, DXC Windows SDK 10.0.26100.0, d3d12SDKLayers.dll installed
  • Commit tested: 8b521d5d5a9a88cf299e26d0c81520a948eef4f3 (HEAD 2e88e656a3e1f9096d9c06e2d8314657510c716e has an identical tree; only commit author metadata was updated after GitHub account rename)
  • cargo build --workspace: clean (no new warnings; only pre-existing fetch_update deprecation warning)
  • cargo test --workspace -- --test-threads=4: 718 passed, 0 failed, 42 ignored (extra ignored item is the manual benchmark in tests/tiling_perf.rs)
  • SKIPPED GPU tests: gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64, gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64

Regression run
Smoke run by @Toons29 in comment below: https://github.com/xcl-dev/xcl/pull/901#issuecomment-7151613298
Contributed by a community tester; the PR author did not run it. Both blocks are pasted as posted.

main:

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14831 MB

PR:

xcl-smoke v1
commit: 2e88e656a3e1f9096d9c06e2d8314657510c716e
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1621 (PresentX 1621)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14807 MB

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

  • No retail title was available to the author; whether the community regression run above reaches the code this PR changes is not known.

AI use

  • Authored with Claude Code (Claude Opus 5.5); reviewed, audited, and verified on native Windows/RTX 5080 hardware with Antigravity (Gemini 4 Neon + Claude Sonnet 5.5).
  • Claude Code (Claude Sonnet 5.5) added the community regression run to this description and updated the lines that it made out of date or that the PR check requires.
<!-- greyfinch-sync:ivall/xcl:issue:5468330941 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/901). Originally posted by [mastrr9](https://github.com/mastrr9) on 2026-11-24T08:00:05Z. --- Speeds up CPU-side console texture detiling and tiling (`detile_level`, `tile_level`, `detile_volume`, `tile_volume` in `crates/xcl/src/gpu/tiling.rs`): - Replaces per-element bounds-checked runtime-length `memcpy` and 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). - Produces byte-identical output across all tiling modes and adds comprehensive equivalence tests plus a manual `#[ignore]` benchmark harness (`crates/xcl/tests/tiling_perf.rs`). **Tested** - Hardware/OS: NVIDIA RTX 5080 (driver `617.42` / `32.0.16.1742`), Windows 11 Pro 25H2 (`26200.9974`), `rustc 1.100.0 (0ef1bc386 2026-11-09)` MSVC debug, DXC Windows SDK `10.0.26100.0`, `d3d12SDKLayers.dll` installed - Commit tested: `8b521d5d5a9a88cf299e26d0c81520a948eef4f3` (HEAD `2e88e656a3e1f9096d9c06e2d8314657510c716e` has an identical tree; only commit author metadata was updated after GitHub account rename) - `cargo build --workspace`: clean (no new warnings; only pre-existing `fetch_update` deprecation warning) - `cargo test --workspace -- --test-threads=4`: **718 passed, 0 failed, 42 ignored** (extra ignored item is the manual benchmark in `tests/tiling_perf.rs`) - `SKIPPED` GPU tests: `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64`, `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64` **Regression run** Smoke run by @Toons29 in comment below: https://github.com/xcl-dev/xcl/pull/901#issuecomment-7151613298 Contributed by a community tester; the PR author did not run it. Both blocks are pasted as posted. main: ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14831 MB ``` PR: ``` xcl-smoke v1 commit: 2e88e656a3e1f9096d9c06e2d8314657510c716e gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1621 (PresentX 1621) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14807 MB ``` 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** - No retail title was available to the author; whether the community regression run above reaches the code this PR changes is not known. **AI use** - Authored with Claude Code (Claude Opus 5.5); reviewed, audited, and verified on native Windows/RTX 5080 hardware with Antigravity (Gemini 4 Neon + Claude Sonnet 5.5). - Claude Code (Claude Sonnet 5.5) added the community regression run to this description and updated the lines that it made out of date or that the PR check requires.
SlopTart commented 2026-11-24 10:04:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-24T09:34:27Z.


Linux / AMD RDNA3 datapoint.

Merged state: head 2e88e65 onto main 09940bb, 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.

<!-- greyfinch-sync:ivall/xcl:comment:7127600416 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/901#issuecomment-7127600416). Originally posted by [SlopTart](https://github.com/SlopTart) on 2026-11-24T09:34:27Z. --- Linux / AMD RDNA3 datapoint. **Merged state:** head `2e88e65` onto main `09940bb`, 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 commented 2026-11-25 04:10:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Toons29 on 2026-11-25T03:07:31Z.


Regression run of 2e88e656 on the retail title, for this PR's Regression run section. Both blocks are from scripts/smoke.ps1 as printed, not edited: main on 4178e888, this PR on its head commit with no uncommitted changes, same title and time.

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14831 MB
xcl-smoke v1
commit: 2e88e656a3e1f9096d9c06e2d8314657510c716e
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1621 (PresentX 1621)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14807 MB

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.

<!-- greyfinch-sync:ivall/xcl:comment:7151613298 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/901#issuecomment-7151613298). Originally posted by [Toons29](https://github.com/Toons29) on 2026-11-25T03:07:31Z. --- Regression run of `2e88e656` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `4178e888`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14831 MB ``` ``` xcl-smoke v1 commit: 2e88e656a3e1f9096d9c06e2d8314657510c716e gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1621 (PresentX 1621) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14807 MB ``` 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 commented 2026-11-25 06:05:59 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T05:50:38Z.


Empirical test report (2e88e656)

Hardware / environment

  • Commit 2e88e656a3e1f9096d9c06e2d8314657510c716e in 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 DXC 1.9.2609.5 (01b62ad47). Both focused runs used XCL_ADAPTER=NONE_CPU_ONLY and RUST_TEST_NOCAPTURE=1. They ran outside Invoke-ArcTest.ps1 with zero Arc GPU mutex hold.

Commands and results

  • cargo test --workspace --no-run exited 0 and compiled the workspace test executables.
  • cargo test -p xcl --lib gpu::tiling::tests:: -- --nocapture exited 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 --nocapture exited 0 with 1 opt-in benchmark passed, 0 failed, 0 ignored, and 0 skipped.

Observed behavior

  • The new 2D and 3D tests matched the element-by-element reference byte for byte on the cases exercised, including mip tails, array slices, swizzles, and truncated sources.
  • The short-slice test matched the reference's panic behavior and the bytes written before a panic. The expected caught panics appear in the uncaptured output.
  • The release benchmark completed all eight cases. Head-only median samples in ms were 23.90 detile / 11.72 tile for RGBA8 3840x2160 64KB_D and 14.36 detile / 11.83 tile for RGBA8 256x256x64 4KB_S thick.

Not tested

The full GPU workspace suite, game smoke runs, and a performance comparison against main were 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.log and published.

<!-- greyfinch-sync:ivall/xcl:comment:7154191749 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/901#issuecomment-7154191749). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-25T05:50:38Z. --- ### Empirical test report (2e88e656) **Hardware / environment** - Commit `2e88e656a3e1f9096d9c06e2d8314657510c716e` in 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 DXC `1.9.2609.5 (01b62ad47)`. Both focused runs used `XCL_ADAPTER=NONE_CPU_ONLY` and `RUST_TEST_NOCAPTURE=1`. They ran outside `Invoke-ArcTest.ps1` with zero Arc GPU mutex hold. **Commands and results** - `cargo test --workspace --no-run` exited 0 and compiled the workspace test executables. - `cargo test -p xcl --lib gpu::tiling::tests:: -- --nocapture` exited 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 --nocapture` exited 0 with 1 opt-in benchmark passed, 0 failed, 0 ignored, and 0 skipped. **Observed behavior** - The new 2D and 3D tests matched the element-by-element reference byte for byte on the cases exercised, including mip tails, array slices, swizzles, and truncated sources. - The short-slice test matched the reference's panic behavior and the bytes written before a panic. The expected caught panics appear in the uncaptured output. - The release benchmark completed all eight cases. Head-only median samples in ms were 23.90 detile / 11.72 tile for RGBA8 3840x2160 64KB_D and 14.36 detile / 11.83 tile for RGBA8 256x256x64 4KB_S thick. **Not tested** The full GPU workspace suite, game smoke runs, and a performance comparison against `main` were 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.log` and published.
DavidM1911 commented 2026-11-25 10:10:34 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T09:41:52Z.


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!

<!-- greyfinch-sync:ivall/xcl:comment:7158679814 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/901#issuecomment-7158679814). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T09:41:52Z. --- 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-actions[bot] commented 2026-11-28 20:19:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T20:19:25Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7245201629 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/901#issuecomment-7245201629). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T20:19:25Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 04:27:24 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:27:24Z.


Triage (#1607) – head 2e88e65

Main commit 95f12a04 ("D3D12.X: process 2D texture tiling in contiguous block runs") already walks 2D levels a block at a time and copies runs of x neighbours in detile_level / tile_level, so the 2D part of this PR overlaps with it and will conflict. detile_volume / tile_volume on main are still element by element, so the 3D walk is new. Open PRs #1512 and #1738 also copy contiguous runs, in detile_level only.
A rebase could keep main's 2D code and narrow this PR to the volume path and its equivalence tests.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7300752958 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/901#issuecomment-7300752958). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T04:27:24Z. --- **Triage (#1607)** – head 2e88e65 Main commit 95f12a04 ("D3D12.X: process 2D texture tiling in contiguous block runs") already walks 2D levels a block at a time and copies runs of x neighbours in `detile_level` / `tile_level`, so the 2D part of this PR overlaps with it and will conflict. `detile_volume` / `tile_volume` on main are still element by element, so the 3D walk is new. Open PRs #1512 and #1738 also copy contiguous runs, in `detile_level` only. A rebase could keep main's 2D code and narrow this PR to the volume path and its equivalence tests. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/901:upstream-pr/901'
git switch 'upstream-pr/901'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/901'
git switch 'upstream-pr/901'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/901'
git switch 'upstream-pr/901'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/901'
git switch 'main'
git merge --squash 'upstream-pr/901'
git switch 'main'
git merge --ff-only 'upstream-pr/901'
git switch 'main'
git merge 'upstream-pr/901'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
xcl-dev/xcl!895
No description provided.