Tiling: use fixed-width copies for short runs of wide elements #1728

Closed
bradyyie wants to merge 2 commits from upstream-pr/1738 into main
bradyyie commented 2026-11-24 20:04:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bradyyie on 2026-11-24T20:04:36Z.


Stacked on #1512 (part of #1511). Only 59bc9ee is new. For an 8- or 16-byte element, a short contiguous run can be just one or two elements. At those widths, a fixed-size copy per element beat the variable-size run loop.

What is in it

  • tiling.rs: specialize 8-byte elements for runs of one or two and 16-byte elements for runs of one. Longer runs keep #1512's copy path.

Tested

  • Ryzen 5 5600X, RTX 2070 (610.88), Windows 11 build 26200, rustc 1.100.0, release.
  • Samply flame graphs, the retail title, one 75 s run per build, 20:A, stock pacing. In profile seconds 65–75, game-host stacks containing detile_level accounted for 19.48% of sampled thread CPU delta on #1512 (fddfa26), 12.30% here. Asset traffic differed between runs. The earlier PIX timing capture identified the streaming interval; the CPU comparison is from samply.
  • Fixed-work benchmark, mode 5 / mode 25, 513×509 elements. Median of seven alternating batches of six conversions. 8 bytes: 1.20× / 1.17× faster than #1512. 16 bytes: 1.53× / 1.43×. Smaller widths ranged from 0.93× to 1.06×. Compared bytes at seven mip levels with full and truncated inputs.
  • cargo test --release --workspace --locked -- --test-threads=4: 752 passed, 0 failed, 41 ignored. Two GPU tests reported SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.

Regression run

xcl-smoke v1
commit: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0
gpu: NVIDIA GeForce RTX 2070
title: A popular game
seconds: 75
exit: 0x0
frames shown: 1479 (PresentX 1479)
presents per 2 s (last 3): 1 4 9
device removals: 0
crashes: 0
peak commit: 25022 MB
xcl-smoke v1
commit: 59bc9eebdac509181118ac5bd7f281a832d0ddf9
gpu: NVIDIA GeForce RTX 2070
title: A popular game
seconds: 75
exit: 0x0
frames shown: 1491 (PresentX 1491)
presents per 2 s (last 3): 0 5 6
device removals: 0
crashes: 0
peak commit: 24695 MB

Not tested

  • AMD and Intel GPUs. No demonstrated improvement in time to finish loading.

AI use
OpenCode, GPT-6.2 Astra: implementation, benchmarks, test runs and PR text.

<!-- greyfinch-sync:ivall/xcl:issue:5479440197 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1738). Originally posted by [bradyyie](https://github.com/bradyyie) on 2026-11-24T20:04:36Z. --- Stacked on #1512 (part of #1511). Only `59bc9ee` is new. For an 8- or 16-byte element, a short contiguous run can be just one or two elements. At those widths, a fixed-size copy per element beat the variable-size run loop. **What is in it** - `tiling.rs`: specialize 8-byte elements for runs of one or two and 16-byte elements for runs of one. Longer runs keep #1512's copy path. **Tested** - Ryzen 5 5600X, RTX 2070 (610.88), Windows 11 build 26200, rustc 1.100.0, release. - [Samply flame graphs](https://gist.github.com/bradyyie/d417c2952db456917877dccbbbba81d5), the retail title, one 75 s run per build, `20:A`, stock pacing. In profile seconds 65–75, game-host stacks containing `detile_level` accounted for 19.48% of sampled thread CPU delta on #1512 (`fddfa26`), 12.30% here. Asset traffic differed between runs. The earlier PIX timing capture identified the streaming interval; the CPU comparison is from samply. - Fixed-work benchmark, mode 5 / mode 25, 513×509 elements. Median of seven alternating batches of six conversions. **8 bytes:** 1.20× / 1.17× faster than #1512. **16 bytes:** 1.53× / 1.43×. Smaller widths ranged from 0.93× to 1.06×. Compared bytes at seven mip levels with full and truncated inputs. - `cargo test --release --workspace --locked -- --test-threads=4`: 752 passed, 0 failed, 41 ignored. Two GPU tests reported `SKIPPED` (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. **Regression run** ``` xcl-smoke v1 commit: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0 gpu: NVIDIA GeForce RTX 2070 title: A popular game seconds: 75 exit: 0x0 frames shown: 1479 (PresentX 1479) presents per 2 s (last 3): 1 4 9 device removals: 0 crashes: 0 peak commit: 25022 MB ``` ``` xcl-smoke v1 commit: 59bc9eebdac509181118ac5bd7f281a832d0ddf9 gpu: NVIDIA GeForce RTX 2070 title: A popular game seconds: 75 exit: 0x0 frames shown: 1491 (PresentX 1491) presents per 2 s (last 3): 0 5 6 device removals: 0 crashes: 0 peak commit: 24695 MB ``` **Not tested** - AMD and Intel GPUs. No demonstrated improvement in time to finish loading. **AI use** OpenCode, GPT-6.2 Astra: implementation, benchmarks, test runs and PR text.
futurepro62 commented 2026-11-24 21:29:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T21:15:45Z.


Full-suite run, since this PR has no test report yet. Tested exact head 59bc9ee (on its base 930e8b4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip pso_measurement_compiles_an_exact_synthetic_record: 752 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: detile_level_runs_match_elements.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored, no skips.
  • Two tests were skipped with --skip on NVIDIA. Both fail on main 7f7e768 too, not because of this PR: under XCL_REQUIRE_GPU=mesh, runner::skip_test turns their skips into failures. heap_window_out_of_memory_falls_back_to_the_switch_form skips when XCL_HEAP_WINDOWS is unset (#1651), and shaders::tests::pso_measurement_compiles_an_exact_synthetic_record skips because Developer Mode is off on this PC (it cannot disable the driver cache). The AMD run does not set XCL_REQUIRE_GPU, so there both just print SKIPPED.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:ivall/xcl:comment:7144694653 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1738#issuecomment-7144694653). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-24T21:15:45Z. --- Full-suite run, since this PR has no test report yet. Tested exact head `59bc9ee` (on its base `930e8b4`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip pso_measurement_compiles_an_exact_synthetic_record`: **752 passed, 0 failed, 41 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - The new tests ran and passed: `detile_level_runs_match_elements`. - Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4`: **752 passed, 0 failed, 41 ignored**, no skips. - Two tests were skipped with `--skip` on NVIDIA. Both fail on main `7f7e768` too, not because of this PR: under `XCL_REQUIRE_GPU=mesh`, `runner::skip_test` turns their skips into failures. `heap_window_out_of_memory_falls_back_to_the_switch_form` skips when `XCL_HEAP_WINDOWS` is unset (#1651), and `shaders::tests::pso_measurement_compiles_an_exact_synthetic_record` skips because Developer Mode is off on this PC (it cannot disable the driver cache). The AMD run does not set `XCL_REQUIRE_GPU`, so there both just print SKIPPED. **Not tested** - a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
DavidM1911 commented 2026-11-24 23:08:29 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T22:44:03Z.


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

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

Thanks!

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

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T04:04:12Z.


PR #1738 — Windows / Arc A770 verification

Tested clean detached head 59bc9eebdac509181118ac5bd7f281a832d0ddf9. The diff changes only crates/xcl/src/gpu/tiling.rs.

STOR-WINLAB | Windows 11 Enterprise Evaluation x64, build 26200 | AMD Ryzen 7 3800X | Intel Arc A770, driver 32.0.101.9175 | DXC 1.9.2609.5 | rustc 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc). Cargo used unoptimized dev and test profiles with debug info and incremental compilation disabled.

Tested

  • cargo build --workspace and cargo test --workspace --no-run both exited 0 outside the Arc lock. Cargo built 18 test executables.
  • With XCL_ADAPTER=NONE_CPU_ONLY, cargo test -p xcl --lib gpu::tiling::tests:: outside the lock gave 15 passed, 0 failed, 0 ignored, and 0 SKIPPED lines. The detile tests compare output bytes to element-by-element reads across supported swizzles, 1–16-byte elements (including the fixed-width 8- and 16-byte cases), pipe configurations, mip levels and tails. They exercise full and truncated sources, zero-fill for unreadable elements, and base swizzle offsets.
  • Under Invoke-ArcTest.ps1 with XCL_ADAPTER=A770 and RUST_TEST_NOCAPTURE=1, cargo test --workspace --no-fail-fast -- --test-threads=4 exited 101. The 19 result lines (18 executables and 1 doc-test target) report 736 passed, 16 failed, 41 ignored, and 0 filtered out. All 15 tiling tests also passed in this run.

Workspace failures and skips

  • The recompiler had 11 CreateComputePipelineState errors (0x80070057) and 4 output mismatches (fused overflow, mip sampling, f16 high-half preservation, and a wave reduction). The synthetic title failed the RSSetDepthBiasX check, drawing blue where green was expected.
  • The log has 5 exact SKIPPED lines. Two cite missing wave64, one cites tiled resources tier below 2, and two cite missing D3D12 debug-layer support. These five appear in the harness pass count and supply no coverage.

Not tested

Matched main baseline, retail-title smoke run, retail samples (XCL_SAMPLE_* unset), performance, and other GPU vendors.

AI use

T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr1738-suite.log and published.

<!-- greyfinch-sync:ivall/xcl:comment:7152500153 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1738#issuecomment-7152500153). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-25T04:04:12Z. --- # PR #1738 — Windows / Arc A770 verification Tested clean detached head `59bc9eebdac509181118ac5bd7f281a832d0ddf9`. The diff changes only `crates/xcl/src/gpu/tiling.rs`. STOR-WINLAB | Windows 11 Enterprise Evaluation x64, build 26200 | AMD Ryzen 7 3800X | Intel Arc A770, driver 32.0.101.9175 | DXC 1.9.2609.5 | rustc 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc). Cargo used unoptimized dev and test profiles with debug info and incremental compilation disabled. **Tested** - `cargo build --workspace` and `cargo test --workspace --no-run` both exited 0 outside the Arc lock. Cargo built 18 test executables. - With `XCL_ADAPTER=NONE_CPU_ONLY`, `cargo test -p xcl --lib gpu::tiling::tests::` outside the lock gave 15 passed, 0 failed, 0 ignored, and 0 `SKIPPED` lines. The detile tests compare output bytes to element-by-element reads across supported swizzles, 1–16-byte elements (including the fixed-width 8- and 16-byte cases), pipe configurations, mip levels and tails. They exercise full and truncated sources, zero-fill for unreadable elements, and base swizzle offsets. - Under `Invoke-ArcTest.ps1` with `XCL_ADAPTER=A770` and `RUST_TEST_NOCAPTURE=1`, `cargo test --workspace --no-fail-fast -- --test-threads=4` exited 101. The 19 result lines (18 executables and 1 doc-test target) report 736 passed, 16 failed, 41 ignored, and 0 filtered out. All 15 tiling tests also passed in this run. **Workspace failures and skips** - The recompiler had 11 `CreateComputePipelineState` errors (0x80070057) and 4 output mismatches (fused overflow, mip sampling, f16 high-half preservation, and a wave reduction). The synthetic title failed the `RSSetDepthBiasX` check, drawing blue where green was expected. - The log has 5 exact `SKIPPED ` lines. Two cite missing wave64, one cites tiled resources tier below 2, and two cite missing D3D12 debug-layer support. These five appear in the harness pass count and supply no coverage. **Not tested** Matched `main` baseline, retail-title smoke run, retail samples (`XCL_SAMPLE_*` unset), performance, and other GPU vendors. **AI use** T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against `pr1738-suite.log` and published.
Foniass commented 2026-12-01 06:38:12 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:38:12Z.


Triage (#1607) – head 59bc9ee

The diff is #1512's change line for line: Layout::run, the run loop in detile_level and the detile_level_runs_match_elements test. On top of it, a copy_elements! fast path for 8 and 16 B elements.
Main already has this: 95f12a0 ("process 2D texture tiling in contiguous block runs") added Layout::run (up to 16 B runs, same alignment and swizzle conditions) and detile_2d, which copies whole runs and falls back to elements for a truncated source; it covers tiling too. The branch conflicts with that code.
Recommendation: close (superseded by main commit 95f12a0).

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:7303098959 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1738#issuecomment-7303098959). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T06:38:12Z. --- **Triage (#1607)** – head 59bc9ee The diff is #1512's change line for line: `Layout::run`, the run loop in `detile_level` and the `detile_level_runs_match_elements` test. On top of it, a `copy_elements!` fast path for 8 and 16 B elements. Main already has this: 95f12a0 ("process 2D texture tiling in contiguous block runs") added `Layout::run` (up to 16 B runs, same alignment and swizzle conditions) and `detile_2d`, which copies whole runs and falls back to elements for a truncated source; it covers tiling too. The branch conflicts with that code. Recommendation: close (superseded by main commit 95f12a0). 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:47:32 +00:00 (Migrated from github.com)

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


Closing as superseded: this change is already on main (95f12a04). main tiling.rs detiles/tiles 2D levels in contiguous runs (Layout::run up to 16 B, copy_runs:: for 1/2/4/8/16 B) with tests; independent and broader implementation

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:7311653038 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1738#issuecomment-7311653038). Originally posted by [throny](https://github.com/throny) on 2026-12-01T12:47:32Z. --- Closing as superseded: this change is already on `main` (95f12a04). main tiling.rs detiles/tiles 2D levels in contiguous runs (Layout::run up to 16 B, copy_runs::<N> for 1/2/4/8/16 B) with tests; independent and broader implementation 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!1728
No description provided.