Tiling: detile_level copies contiguous runs (16 B in swizzled modes) in one go #1502

Closed
oishigeso wants to merge 1 commit from upstream-pr/1512 into main
oishigeso commented 2026-11-24 17:10:02 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by oishigeso on 2026-11-24T17:10:02Z.


Part 1 of 2 for #1511. detile_level copied a texture one element at a time. Within a swizzled mode's 16-byte micro-tile run, and along a row in the linear and thin modes, consecutive elements are consecutive in both layouts, so it now copies those runs in one go.

What is in it

  • crates/xcl/src/gpu/tiling.rs: detile_level copies runs; the same offsets as before (Layout::offset_z)

Tested

  • AMD Radeon RX 6700 XT (driver 32.0.21030.2001), Ryzen 5 3600, Windows 10 Pro 19045, rustc 1.100.0, release
  • RGBA8 2048×2048 on the console pipe config: 22 ms → 10 ms; BC (8 / 16 B elements) ~10 % faster
  • cargo test -p xcl --lib detile -- --test-threads=1: 7 passed, 0 failed on the stack with part 2. Six of them are at this PR's head (detile_level_runs_match_elements, new, and detile_level_matches_element_by_element, linear_levels_detile_by_rows_as_by_elements, tile_then_detile_round_trips_with_partial_blocks, a_batch_detiled_on_several_threads_matches_one_thread, retail_ttpf_textures_detile_with_their_mip_chains); gpu_detile_matches_the_cpu comes with #1513. Run before the rebase onto 930e8b4, which had no conflicts

Regression run

main:

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: AMD Radeon RX 6700 XT
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 373 (PresentX 374)
presents per 2 s (last 3): 0 28 60
device removals: 0
crashes: 0
peak commit: 19259 MB

PR (this PR's head commit; the title is run through a folder named RetailTitle):

xcl-smoke v1
commit: fddfa2675a3ffc722a7a0dcf2ed8da1938b97713
gpu: AMD Radeon RX 6700 XT
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 579 (PresentX 579)
presents per 2 s (last 3): 59 60 60
device removals: 0
crashes: 0
peak commit: 18876 MB

Not tested

  • NVIDIA, Intel; Linux / Wine

AI use

  • Claude Code (Claude Opus 5.5) wrote the change, its test and this description, and ran the tests and runs above on my PC at my direction.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5476827634 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1512). Originally posted by [oishigeso](https://github.com/oishigeso) on 2026-11-24T17:10:02Z. --- Part 1 of 2 for #1511. `detile_level` copied a texture one element at a time. Within a swizzled mode's 16-byte micro-tile run, and along a row in the linear and thin modes, consecutive elements are consecutive in both layouts, so it now copies those runs in one go. **What is in it** - `crates/xcl/src/gpu/tiling.rs`: `detile_level` copies runs; the same offsets as before (`Layout::offset_z`) **Tested** - AMD Radeon RX 6700 XT (driver 32.0.21030.2001), Ryzen 5 3600, Windows 10 Pro 19045, rustc 1.100.0, release - RGBA8 2048×2048 on the console pipe config: 22 ms → 10 ms; BC (8 / 16 B elements) ~10 % faster - `cargo test -p xcl --lib detile -- --test-threads=1`: 7 passed, 0 failed on the stack with part 2. Six of them are at this PR's head (`detile_level_runs_match_elements`, new, and `detile_level_matches_element_by_element`, `linear_levels_detile_by_rows_as_by_elements`, `tile_then_detile_round_trips_with_partial_blocks`, `a_batch_detiled_on_several_threads_matches_one_thread`, `retail_ttpf_textures_detile_with_their_mip_chains`); `gpu_detile_matches_the_cpu` comes with #1513. Run before the rebase onto 930e8b4, which had no conflicts **Regression run** main: ``` xcl-smoke v1 commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56 gpu: AMD Radeon RX 6700 XT title: RetailTitle seconds: 60 exit: 0x0 frames shown: 373 (PresentX 374) presents per 2 s (last 3): 0 28 60 device removals: 0 crashes: 0 peak commit: 19259 MB ``` PR (this PR's head commit; the title is run through a folder named RetailTitle): ``` xcl-smoke v1 commit: fddfa2675a3ffc722a7a0dcf2ed8da1938b97713 gpu: AMD Radeon RX 6700 XT title: RetailTitle seconds: 60 exit: 0x0 frames shown: 579 (PresentX 579) presents per 2 s (last 3): 59 60 60 device removals: 0 crashes: 0 peak commit: 18876 MB ``` **Not tested** - NVIDIA, Intel; Linux / Wine **AI use** - Claude Code (Claude Opus 5.5) wrote the change, its test and this description, and ran the tests and runs above on my PC at my direction. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
gut0to commented 2026-11-24 18:51:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gut0to on 2026-11-24T18:51:47Z.

Review: COMMENTED


The focused detile tests are useful. CONTRIBUTING.md also requires the full workspace suite to run on a GPU, with pass/fail/ignored counts and skipped-test names. This description reports only the focused cargo test -p xcl --lib detile run. Please add the full-suite result before merge. AI-assisted review; I checked the Tested section against the guide.

<!-- greyfinch-sync:ivall/xcl:review:6045366151 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1512#pullrequestreview-6045366151). Originally posted by [gut0to](https://github.com/gut0to) on 2026-11-24T18:51:47Z. **Review:** COMMENTED --- The focused detile tests are useful. CONTRIBUTING.md also requires the full workspace suite to run on a GPU, with pass/fail/ignored counts and skipped-test names. This description reports only the focused `cargo test -p xcl --lib detile` run. Please add the full-suite result before merge. AI-assisted review; I checked the Tested section against the guide.
DavidM1911 commented 2026-11-24 19:07:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T18:53:48Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7141303931 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1512#issuecomment-7141303931). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T18:53:48Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
JJAutoCompare commented 2026-11-25 01:11:00 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T00:59:42Z.


Tested

I ran the CPU tiling unit suite on clean PR head fddfa2675a3ffc722a7a0dcf2ed8da1938b97713 and verified that SHA against the open PR after the run.

cargo test -p xcl --lib gpu::tiling::tests:: -- --test-threads=1 --nocapture
  • 15 passed, 0 failed, 0 ignored, 0 skipped, with 714 tests filtered out. Cargo exited 0 and emitted no SKIPPED lines.
  • detile_level_runs_match_elements, detile_level_matches_element_by_element, and linear_levels_detile_by_rows_as_by_elements passed. They compare against element-by-element output for contiguous swizzled copies, mip tails, truncated inputs, and padded linear rows.
  • Windows 11 Enterprise Evaluation 25H2 (build 26200.9974), AMD Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175. Rust 1.100.0 (x86_64-pc-windows-msvc), Cargo 1.100.0, default unoptimized test profile. DXC 1.9.2609.5 configured through XCL_DXC_DIR=%LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64. CARGO_BUILD_JOBS=2, CARGO_INCREMENTAL=0, and XCL_ADAPTER=A770 were set. Cargo target and TEMP/TMP were isolated on L:/XclTooling.

Not tested

GPU execution, the full workspace suite, retail-title smoke runs, and performance.

AI use

Codex (gpt-6.2-sol) ran the tests, verified the SHA, and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7149098117 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1512#issuecomment-7149098117). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-25T00:59:42Z. --- **Tested** I ran the CPU tiling unit suite on clean PR head `fddfa2675a3ffc722a7a0dcf2ed8da1938b97713` and verified that SHA against the open PR after the run. ```powershell cargo test -p xcl --lib gpu::tiling::tests:: -- --test-threads=1 --nocapture ``` - **15 passed, 0 failed, 0 ignored, 0 skipped**, with 714 tests filtered out. Cargo exited 0 and emitted no `SKIPPED` lines. - `detile_level_runs_match_elements`, `detile_level_matches_element_by_element`, and `linear_levels_detile_by_rows_as_by_elements` passed. They compare against element-by-element output for contiguous swizzled copies, mip tails, truncated inputs, and padded linear rows. - Windows 11 Enterprise Evaluation 25H2 (build 26200.9974), AMD Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175. Rust 1.100.0 (`x86_64-pc-windows-msvc`), Cargo 1.100.0, default unoptimized test profile. DXC 1.9.2609.5 configured through `XCL_DXC_DIR=%LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64`. `CARGO_BUILD_JOBS=2`, `CARGO_INCREMENTAL=0`, and `XCL_ADAPTER=A770` were set. Cargo target and TEMP/TMP were isolated on `L:/XclTooling`. **Not tested** GPU execution, the full workspace suite, retail-title smoke runs, and performance. **AI use** Codex (`gpt-6.2-sol`) ran the tests, verified the SHA, and wrote this report.
Foniass commented 2026-12-01 05:57:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:57:50Z.


Triage (#1607) – head fddfa26

Main commit 95f12a04 (D3D12.X: process 2D texture tiling in contiguous block runs) replaced the per-element loop in Chain::detile_level that this PR edits: 2D levels now go through Layout::detile_2d, which copies the largest contiguous run of x neighbours (Layout::run_elems, shortened by base_xor) and keeps element-wise bounds checks for a truncated source. main also has the equivalent test (detile_level_matches_element_by_element with a base swizzle and a short source).
#1738 and #1513 are stacked on this PR and would need rebasing onto main's detile_2d.
Recommendation: close (superseded by main commit 95f12a04).

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:7302326299 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1512#issuecomment-7302326299). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T05:57:50Z. --- **Triage (#1607)** – head fddfa26 Main commit 95f12a04 (D3D12.X: process 2D texture tiling in contiguous block runs) replaced the per-element loop in Chain::detile_level that this PR edits: 2D levels now go through Layout::detile_2d, which copies the largest contiguous run of x neighbours (Layout::run_elems, shortened by base_xor) and keeps element-wise bounds checks for a truncated source. main also has the equivalent test (detile_level_matches_element_by_element with a base swizzle and a short source). #1738 and #1513 are stacked on this PR and would need rebasing onto main's detile_2d. Recommendation: close (superseded by main commit 95f12a04). AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
throny commented 2026-12-01 12:46:29 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-12-01T12:46:29Z.


Closing as superseded: this change is already on main (95f12a04). main tiling.rs detile_2d copies contiguous runs via effective_run (95f12a04) and has detile_level_matches_element_by_element test; same optimisation and test as the PR

Two independent checks found this: Foniass's close list on #1607 and ours against current main. If something here is still missing on main, say so and reopen it, or ask and I will.

AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.

<!-- greyfinch-sync:ivall/xcl:comment:7311626859 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1512#issuecomment-7311626859). Originally posted by [throny](https://github.com/throny) on 2026-12-01T12:46:29Z. --- Closing as superseded: this change is already on `main` (95f12a04). main tiling.rs detile_2d copies contiguous runs via effective_run (95f12a04) and has detile_level_matches_element_by_element test; same optimisation and test as the PR Two independent checks found this: Foniass's close list on #1607 and ours against current `main`. If something here is still missing on `main`, say so and reopen it, or ask and I will. AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.

Pull request closed

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!1502
No description provided.