d3d12x: accelerate sparse UMA window chunk scanning #1051

Open
UnkwnDev wants to merge 1 commit from upstream-pr/1058 into main
UnkwnDev commented 2026-11-24 11:03:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by UnkwnDev on 2026-11-24T11:03:33Z.


This pull request accelerates the sparse UMA window chunk scanner:

In crates/xcl/src/hle/d3d12x/sparse.rs, scan_page and read_chunk_words scanned 64-byte chunks with scalar 64-bit integer arithmetic and unaligned reads. We optimize read_chunk_words with an aligned pointer cast for page-aligned allocations, enabling 256-bit vector loads. In scan_page, we add an 8-word zero reduction test so unchanged zero chunks across mapped sparse windows bypass the 5-multiplication hash computation entirely, eliminating CPU sync latency during command list execution.

Originally part of #985, split into its own single-purpose PR per CONTRIBUTING.md.

Tested

  • Hardware: Intel Arc A770 (16GB, Driver 32.0.101.9175), AMD Ryzen 5 7500F, 32 GB RAM, Windows 11 Pro, MSVC 14.44.35207
  • Full workspace test suite: cargo test --workspace (672 passed, 0 failed, 21 ignored in lib; 13/13 console_dlls_e2e passed; 3/3 console_shaders passed; 1/1 disasm_e2e passed; 3/3 e2e passed; 1/1 sparse_reinit passed; 1/1 texture_states passed; 6/6 xg_oracle passed)
  • hle::d3d12x::sparse::tests: 13 passed, 0 failed, 1 ignored, verifying scan_page_lazy_alloc_and_coalesce and dirty chunk detection.

Regression run
main (e74dda2):

xcl-smoke v1
commit: e74dda2d4b5c28a81cfa971d14bc417a6be966aa
gpu: AMD Radeon RX 9070 XT
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1660 (PresentX 1660)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14862 MB

PR (dbcaee7):

xcl-smoke v1
commit: dbcaee766a1d9e0d9c1f9894c63eaf29dc843046
gpu: AMD Radeon RX 9070 XT
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1665 (PresentX 1665)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14860 MB

Not tested

  • RDNA3 / older RDNA1 GPUs, Linux/Wine

AI use

  • Claude Code and Antigravity assisted in profiling sparse chunk scan overhead and validating 8-word reduction behavior.
<!-- greyfinch-sync:ivall/xcl:issue:5470912319 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1058). Originally posted by [UnkwnDev](https://github.com/UnkwnDev) on 2026-11-24T11:03:33Z. --- This pull request accelerates the sparse UMA window chunk scanner: In `crates/xcl/src/hle/d3d12x/sparse.rs`, `scan_page` and `read_chunk_words` scanned 64-byte chunks with scalar 64-bit integer arithmetic and unaligned reads. We optimize `read_chunk_words` with an aligned pointer cast for page-aligned allocations, enabling 256-bit vector loads. In `scan_page`, we add an 8-word zero reduction test so unchanged zero chunks across mapped sparse windows bypass the 5-multiplication hash computation entirely, eliminating CPU sync latency during command list execution. Originally part of #985, split into its own single-purpose PR per CONTRIBUTING.md. **Tested** - Hardware: Intel Arc A770 (16GB, Driver 32.0.101.9175), AMD Ryzen 5 7500F, 32 GB RAM, Windows 11 Pro, MSVC 14.44.35207 - Full workspace test suite: `cargo test --workspace` (672 passed, 0 failed, 21 ignored in lib; 13/13 console_dlls_e2e passed; 3/3 console_shaders passed; 1/1 disasm_e2e passed; 3/3 e2e passed; 1/1 sparse_reinit passed; 1/1 texture_states passed; 6/6 xg_oracle passed) - `hle::d3d12x::sparse::tests`: 13 passed, 0 failed, 1 ignored, verifying `scan_page_lazy_alloc_and_coalesce` and dirty chunk detection. **Regression run** `main` (`e74dda2`): ``` xcl-smoke v1 commit: e74dda2d4b5c28a81cfa971d14bc417a6be966aa gpu: AMD Radeon RX 9070 XT title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1660 (PresentX 1660) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14862 MB ``` PR (`dbcaee7`): ``` xcl-smoke v1 commit: dbcaee766a1d9e0d9c1f9894c63eaf29dc843046 gpu: AMD Radeon RX 9070 XT title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1665 (PresentX 1665) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14860 MB ``` **Not tested** - RDNA3 / older RDNA1 GPUs, Linux/Wine **AI use** - Claude Code and Antigravity assisted in profiling sparse chunk scan overhead and validating 8-word reduction behavior.
futurepro62 commented 2026-11-24 15:05:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T14:16:58Z.


Full-suite run, since this PR has no test report yet. Tested exact head dbcaee7 (on its base e74dda2).

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, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 727 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • No new #[test] functions in the diff.
  • Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 727 passed, 0 failed, 41 ignored, no skips.

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:7134124300 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1058#issuecomment-7134124300). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-24T14:16:58Z. --- Full-suite run, since this PR has no test report yet. Tested exact head `dbcaee7` (on its base `e74dda2`). **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, debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4`: **727 passed, 0 failed, 41 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - No new `#[test]` functions in the diff. - Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4`: **727 passed, 0 failed, 41 ignored**, no skips. **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.
thaqiart139-alt commented 2026-11-24 23:08:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thaqiart139-alt on 2026-11-24T22:49:04Z.


Test report for this PR's head dbcaee7, merged into main 689f2db (no conflicts), on AMD RDNA2 with native 64-lane waves and on a 32-lane NVIDIA card.

Tested

  • GPUs: AMD Radeon(TM) Graphics, the RDNA2 iGPU of a Ryzen 7 7800X3D (native wave64, driver 32.0.21045.29003), and NVIDIA GeForce RTX 5070 (driver 32.0.16.2101), chosen with XCL_ADAPTER.
  • System: 32 GB, Windows 11 Home build 26300, Rust 1.100.0, debug, DXC 1.9.2602.17.
  • cargo test --workspace --no-fail-fast -- --test-threads=4:
main 689f2db with this PR
RTX 5070 971 passed, 4 failed, 45 ignored 971 passed, 4 failed, 45 ignored
Radeon iGPU 974 passed, 1 failed, 45 ignored 974 passed, 1 failed, 45 ignored
  • This PR adds no failure. The failures are the same on main, from #1679's new fuzz tests, and both are already reported on #1679:
    • RTX 5070: fuzz_validate_and_gpu_0 to _3 (CreateComputePipelineState: 0x8007000E)
    • iGPU: fuzz_validate_and_gpu_1 (seed 540: res[833] = 0x7, CPU 0x6)
  • This is an NVIDIA run and an RDNA2 run. hle::d3d12x::sparse::tests, including scan_page_lazy_alloc_and_coalesce, passed on both GPUs (14 passed, 1 ignored).
SKIPPED tests (the same on main and with this PR)
  • RTX 5070:
    • no wave64:
      • gpu::recomp::lower::tests: a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu
      • gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu, and the wave64 cases of its f16 / f32 / f64 / integer_programs_on_the_gpu
      • gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware
    • the wave32 per-lane cases of lower_dxil's f16 arithmetic, f16 packed and f32 conversions: refused ("its #1426 semantics differ from the console's")
    • heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows)
    • pso_measurement_compiles_an_exact_synthetic_record (Windows Developer Mode is off)
  • Radeon iGPU:
    • no mesh shaders: gpu::dxil::geometry_tests::gpu_geometry_direct_records, emitted_ms_primitive_attribute_reaches_the_pixel_shader, emitted_ms_ps_draw_a_triangle, gpu_geometry_mode_es_gs_strip, gpu_geometry_mode_es_gs_strip_with_branches, gpu_mesh_mode_two_passes
    • the wave32 and wave64 per-lane cases of lower_dxil's f16 arithmetic, f16 packed and f32 conversions: refused, as above
    • heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows)
    • pso_measurement_compiles_an_exact_synthetic_record (Developer Mode is off)

Not tested

  • a title run, RDNA1 / RDNA3; other GPUs; Linux / Wine.

AI use

  • Claude Code (Claude Opus 5.5) ran the builds and tests and wrote this report.
<!-- greyfinch-sync:ivall/xcl:comment:7146678842 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1058#issuecomment-7146678842). Originally posted by [thaqiart139-alt](https://github.com/thaqiart139-alt) on 2026-11-24T22:49:04Z. --- Test report for this PR's head `dbcaee7`, merged into `main` `689f2db` (no conflicts), on AMD RDNA2 with native 64-lane waves and on a 32-lane NVIDIA card. **Tested** - GPUs: AMD Radeon(TM) Graphics, the RDNA2 iGPU of a Ryzen 7 7800X3D (native wave64, driver 32.0.21045.29003), and NVIDIA GeForce RTX 5070 (driver 32.0.16.2101), chosen with `XCL_ADAPTER`. - System: 32 GB, Windows 11 Home build 26300, Rust 1.100.0, debug, DXC 1.9.2602.17. - `cargo test --workspace --no-fail-fast -- --test-threads=4`: | | `main` `689f2db` | with this PR | |---|---|---| | RTX 5070 | 971 passed, 4 failed, 45 ignored | 971 passed, 4 failed, 45 ignored | | Radeon iGPU | 974 passed, 1 failed, 45 ignored | 974 passed, 1 failed, 45 ignored | - This PR adds no failure. The failures are the same on `main`, from #1679's new fuzz tests, and both are already reported on #1679: - RTX 5070: `fuzz_validate_and_gpu_0` to `_3` (`CreateComputePipelineState`: `0x8007000E`) - iGPU: `fuzz_validate_and_gpu_1` (`seed 540: res[833] = 0x7, CPU 0x6`) - This is an NVIDIA run and an RDNA2 run. `hle::d3d12x::sparse::tests`, including `scan_page_lazy_alloc_and_coalesce`, passed on both GPUs (14 passed, 1 ignored). <details><summary>SKIPPED tests (the same on <code>main</code> and with this PR)</summary> - **RTX 5070:** - no wave64: - `gpu::recomp::lower::tests`: `a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu`, `coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu`, `cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu`, `the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu` - `gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu`, and the wave64 cases of its `f16` / `f32` / `f64` / `integer_programs_on_the_gpu` - `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` - the wave32 per-lane cases of `lower_dxil`'s f16 arithmetic, f16 packed and f32 conversions: refused ("its #1426 semantics differ from the console's") - `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows) - `pso_measurement_compiles_an_exact_synthetic_record` (Windows Developer Mode is off) - **Radeon iGPU:** - no mesh shaders: `gpu::dxil::geometry_tests::gpu_geometry_direct_records`, `emitted_ms_primitive_attribute_reaches_the_pixel_shader`, `emitted_ms_ps_draw_a_triangle`, `gpu_geometry_mode_es_gs_strip`, `gpu_geometry_mode_es_gs_strip_with_branches`, `gpu_mesh_mode_two_passes` - the wave32 and wave64 per-lane cases of `lower_dxil`'s f16 arithmetic, f16 packed and f32 conversions: refused, as above - `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows) - `pso_measurement_compiles_an_exact_synthetic_record` (Developer Mode is off) </details> **Not tested** - a title run, RDNA1 / RDNA3; other GPUs; Linux / Wine. **AI use** - Claude Code (Claude Opus 5.5) ran the builds and tests and wrote this report.
DavidM1911 commented 2026-11-25 09:08:25 +00:00 (Migrated from github.com)

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


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:7157844732 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1058#issuecomment-7157844732). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T09:04:43Z. --- 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!
xpatfussy69x commented 2026-11-25 12:06:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by xpatfussy69x on 2026-11-25T11:43:19Z.


Test report for head dbcaee7 as pushed (not merged onto current main) – NVIDIA, wave32.

Tested

  • NVIDIA GeForce RTX 3060 12 GB (Ampere, 32-lane waves only), driver 32.0.16.2124; AMD Ryzen 5 7500F; 32 GB RAM; Windows NT 10.0.26300; Rust 1.100.0 (stable-x86_64-pc-windows-msvc); debug; DXC 1.9.2609.5
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4): 727 passed, 0 failed, 41 ignored
  • SKIPPED GPU tests on this adapter: 2 (no wave64)
  • this PR's tests: none added; the existing sparse / memory-window GPU tests (gpu_memory_windows_above_4_gib, gpu_memory_windows_reject_out_of_uma_aliasing, gpu_sparse_vram_descriptors_buffers_and_xmem, gpu::uma tests) pass
  • no XCL_SAMPLE_* data set (game-data tests not run)

Not tested

  • a smoke run on a title; AMD / native wave64; release build; the head merged onto current main; any timing of the scan (no benchmark run)

AI use

  • Claude (Claude Opus 5.5) wrote the script that ran the suite on my PC, read the log and wrote and posted this report with my approval; the run is mine.
<!-- greyfinch-sync:ivall/xcl:comment:7161412729 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1058#issuecomment-7161412729). Originally posted by [xpatfussy69x](https://github.com/xpatfussy69x) on 2026-11-25T11:43:19Z. --- Test report for head `dbcaee7` as pushed (not merged onto current `main`) – NVIDIA, wave32. **Tested** - NVIDIA GeForce RTX 3060 12 GB (Ampere, 32-lane waves only), driver 32.0.16.2124; AMD Ryzen 5 7500F; 32 GB RAM; Windows NT 10.0.26300; Rust 1.100.0 (stable-x86_64-pc-windows-msvc); debug; DXC 1.9.2609.5 - `.\scripts\test.ps1` (`cargo build --workspace` + `cargo test --workspace -- --test-threads=4`): 727 passed, 0 failed, 41 ignored - SKIPPED GPU tests on this adapter: 2 (no wave64) - this PR's tests: none added; the existing sparse / memory-window GPU tests (`gpu_memory_windows_above_4_gib`, `gpu_memory_windows_reject_out_of_uma_aliasing`, `gpu_sparse_vram_descriptors_buffers_and_xmem`, `gpu::uma` tests) pass - no `XCL_SAMPLE_*` data set (game-data tests not run) **Not tested** - a smoke run on a title; AMD / native wave64; release build; the head merged onto current `main`; any timing of the scan (no benchmark run) **AI use** - Claude (Claude Opus 5.5) wrote the script that ran the suite on my PC, read the log and wrote and posted this report with my approval; the run is mine.
BBareth commented 2026-11-30 10:10:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by BBareth on 2026-11-30T10:10:31Z.


merge-check claim
head: dbcaee766a

<!-- greyfinch-sync:ivall/xcl:comment:7275231188 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1058#issuecomment-7275231188). Originally posted by [BBareth](https://github.com/BBareth) on 2026-11-30T10:10:31Z. --- merge-check claim head: dbcaee766a1d9e0d9c1f9894c63eaf29dc843046
BBareth commented 2026-11-30 10:22:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by BBareth on 2026-11-30T10:22:39Z.


merge-check
base: 9dfbe3ea66
head: dbcaee766a
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2885 passed, 1 failed, 51 ignored; failing: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16, which fails on the base alone too (base: 2885 passed, 1 failed, 51 ignored, 28 SKIPPED lines). 28 SKIPPED lines, as on the base. The sparse tests passed, among them scan_page_plans_without_publishing_and_coalesces.
review: no blocking finding; one file, every hunk read, and the merge result read too, since the PR was written against a much older sparse.rs (git places the three hunks correctly in today's scan_page). (1) read_chunk_words reads an 8-byte-aligned chunk through one [u64; 8] load and keeps the unaligned byte-wise path otherwise; the two agree on little-endian x64, the only target. (2) In the pass over a page with sent hashes, an all-zero chunk whose sent hash is ZERO_HASH is skipped before hashing; in the tail pass of a never-sent page, an all-zero chunk is skipped before hashing. Both are the decisions the hash comparison made before (ZERO_HASH is the hash of eight zero words), reached earlier. No new test; the existing scan tests cover the result, not the speed.
performance: CPU only, in the direction of less work per chunk (an OR of eight words in place of the hash for zero chunks). The PR gives no timing and I did not measure one; its smoke blocks show unchanged presents and commit.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 621.24 (32.0.16.2124); i7-12700K; Windows 11 26200. Claude Code, Claude Fable 5.2 read the diff, ran the build and the suite and wrote this check.

<!-- greyfinch-sync:ivall/xcl:comment:7275505943 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1058#issuecomment-7275505943). Originally posted by [BBareth](https://github.com/BBareth) on 2026-11-30T10:22:39Z. --- merge-check base: 9dfbe3ea6653a9c76ef3ea0d66187a4b5407483b head: dbcaee766a1d9e0d9c1f9894c63eaf29dc843046 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2885 passed, 1 failed, 51 ignored; failing: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16, which fails on the base alone too (base: 2885 passed, 1 failed, 51 ignored, 28 SKIPPED lines). 28 SKIPPED lines, as on the base. The sparse tests passed, among them `scan_page_plans_without_publishing_and_coalesces`. review: no blocking finding; one file, every hunk read, and the merge result read too, since the PR was written against a much older `sparse.rs` (git places the three hunks correctly in today's `scan_page`). (1) `read_chunk_words` reads an 8-byte-aligned chunk through one `[u64; 8]` load and keeps the unaligned byte-wise path otherwise; the two agree on little-endian x64, the only target. (2) In the pass over a page with sent hashes, an all-zero chunk whose sent hash is `ZERO_HASH` is skipped before hashing; in the tail pass of a never-sent page, an all-zero chunk is skipped before hashing. Both are the decisions the hash comparison made before (`ZERO_HASH` is the hash of eight zero words), reached earlier. No new test; the existing scan tests cover the result, not the speed. performance: CPU only, in the direction of less work per chunk (an OR of eight words in place of the hash for zero chunks). The PR gives no timing and I did not measure one; its smoke blocks show unchanged presents and commit. verdict: safe to merge hardware / tool and model: RTX 5070 Ti 16 GB, driver 621.24 (32.0.16.2124); i7-12700K; Windows 11 26200. Claude Code, Claude Fable 5.2 read the diff, ran the build and the suite and wrote this check.
Elytes commented 2026-11-30 11:47:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Elytes on 2026-11-30T11:47:05Z.


Measured on a retail title (RTX 5090, 60 s runs, base 9dfbe3e vs this PR merged, scripted input, two pairs): the chunk scan this PR changes takes the same time with and without it ("sparse windows timing: chunk scan" at 2048 submits, same 1586 MB uploaded: 53 ms on base, 51 / 53 ms with the PR). On this title the scan is about 53 ms per minute, under a tenth of the sparse-window time (write-watch is ~576 ms), so the change has no visible effect here. No regression either: frames, peak commit, device removals and crashes as on base. Behaviour is unchanged (the dirty runs are the same), so it is safe, but it does not show the gain the description claims.

AI use: Claude Code (Claude Opus 5.5) ran the builds, runs and log comparison and drafted this.

<!-- greyfinch-sync:ivall/xcl:comment:7277520853 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1058#issuecomment-7277520853). Originally posted by [Elytes](https://github.com/Elytes) on 2026-11-30T11:47:05Z. --- Measured on a retail title (RTX 5090, 60 s runs, base 9dfbe3e vs this PR merged, scripted input, two pairs): the chunk scan this PR changes takes the same time with and without it ("sparse windows timing: chunk scan" at 2048 submits, same 1586 MB uploaded: 53 ms on base, 51 / 53 ms with the PR). On this title the scan is about 53 ms per minute, under a tenth of the sparse-window time (write-watch is ~576 ms), so the change has no visible effect here. No regression either: frames, peak commit, device removals and crashes as on base. Behaviour is unchanged (the dirty runs are the same), so it is safe, but it does not show the gain the description claims. AI use: Claude Code (Claude Opus 5.5) ran the builds, runs and log comparison and drafted this.
tiagonleal commented 2026-11-30 12:12:27 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-30T12:12:27Z.


merge-check
base: 9dfbe3ea66
head: dbcaee766a
merge: clean
build: cargo build --workspace -> ok (also cargo build --release -p xcl)
tests: cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4 -> 2885 passed, 1 failed, 51 ignored; SKIPPED: 24 lines, the same as on the base; failing: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16, which fails the same way on the base alone (2885 passed, 1 failed, 51 ignored; #3513 fixes it). The PR adds no test.
review: whole diff read (+28/-14, sparse.rs), and the three hunks checked where git placed them in today's scan_page. The result is the same as before for every input. (1) read_chunk_words reads an 8-byte-aligned chunk with one [u64; 8] load and keeps the byte-wise little-endian path otherwise; on x86-64, the only target, both give the same words. A chunk is a fixed-size slice from chunks_exact, so there is no partial last chunk to handle and a page cannot wrap. (2) In the pass over a page with sent hashes, an all-zero chunk whose sent hash is ZERO_HASH is skipped before hashing. Before, it was hashed to ZERO_HASH (ZERO_HASH is hash_words([0; 8])), found equal to the sent hash and skipped, so the outcome is the same. A zero chunk whose sent hash is something else still goes through the hash and is sent, as before. (3) In the tail pass of a page with no sent hashes, an all-zero chunk is skipped before hashing, and the h2 == ZERO_HASH check stays for a non-zero chunk that hashes to it, so the same chunks are skipped. Which chunks are sent and in which runs does not change; only the hash of zero chunks is saved.
performance: scripts/smoke.ps1, 60 s of a retail title, release, after one warm-up run of the base: 1668 frames and 17308 MB peak commit against 1649 frames and 17417 MB on the base (warm-up: 1609, 17266 MB). No device removal, no crash. The "sparse windows timing" line at about 51 s, at the same point in each run (13406 mapped tiles): chunk scan 30 ms with the PR, 57 ms on the base and 32 ms in the base's warm-up run. The two base runs differ as much as base and PR do, so this does not show a speed-up; it shows no regression.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB (617.42, wave32), Ryzen 7 9800X3D, 32 GB, Windows 11 26300, rustc 1.100.0 / Claude Code (Claude Opus 5.5 ran the build, suite and smoke, reviewed the diff against the merged source and wrote this)

  • Tiago
<!-- greyfinch-sync:ivall/xcl:comment:7278107950 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1058#issuecomment-7278107950). Originally posted by [tiagonleal](https://github.com/tiagonleal) on 2026-11-30T12:12:27Z. --- merge-check base: 9dfbe3ea6653a9c76ef3ea0d66187a4b5407483b head: dbcaee766a1d9e0d9c1f9894c63eaf29dc843046 merge: clean build: cargo build --workspace -> ok (also `cargo build --release -p xcl`) tests: cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4 -> 2885 passed, 1 failed, 51 ignored; SKIPPED: 24 lines, the same as on the base; failing: `gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16`, which fails the same way on the base alone (2885 passed, 1 failed, 51 ignored; #3513 fixes it). The PR adds no test. review: whole diff read (+28/-14, `sparse.rs`), and the three hunks checked where git placed them in today's `scan_page`. The result is the same as before for every input. (1) `read_chunk_words` reads an 8-byte-aligned chunk with one `[u64; 8]` load and keeps the byte-wise little-endian path otherwise; on x86-64, the only target, both give the same words. A chunk is a fixed-size slice from `chunks_exact`, so there is no partial last chunk to handle and a page cannot wrap. (2) In the pass over a page with sent hashes, an all-zero chunk whose sent hash is `ZERO_HASH` is skipped before hashing. Before, it was hashed to `ZERO_HASH` (`ZERO_HASH` is `hash_words([0; 8])`), found equal to the sent hash and skipped, so the outcome is the same. A zero chunk whose sent hash is something else still goes through the hash and is sent, as before. (3) In the tail pass of a page with no sent hashes, an all-zero chunk is skipped before hashing, and the `h2 == ZERO_HASH` check stays for a non-zero chunk that hashes to it, so the same chunks are skipped. Which chunks are sent and in which runs does not change; only the hash of zero chunks is saved. performance: `scripts/smoke.ps1`, 60 s of a retail title, release, after one warm-up run of the base: 1668 frames and 17308 MB peak commit against 1649 frames and 17417 MB on the base (warm-up: 1609, 17266 MB). No device removal, no crash. The "sparse windows timing" line at about 51 s, at the same point in each run (13406 mapped tiles): chunk scan 30 ms with the PR, 57 ms on the base and 32 ms in the base's warm-up run. The two base runs differ as much as base and PR do, so this does not show a speed-up; it shows no regression. verdict: safe to merge hardware / tool and model: RTX 5070 Ti 16 GB (617.42, wave32), Ryzen 7 9800X3D, 32 GB, Windows 11 26300, rustc 1.100.0 / Claude Code (Claude Opus 5.5 ran the build, suite and smoke, reviewed the diff against the merged source and wrote this) - Tiago
Foniass commented 2026-12-01 04:43:09 +00:00 (Migrated from github.com)

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


Triage (#1607) – head dbcaee7

No open or merged PR makes the same change (#985, which this was split out of, is now only about DP4a). Main's scan_page has since lost the sent update and takes &Option<...>, but the PR still merges cleanly onto it and the merged function keeps the zero shortcuts.
The two shortcuts in sparse.rs:scan_page keep the old results: an all-zero chunk hashes to ZERO_HASH, so skipping it when sent[k] == ZERO_HASH (first loop) or unconditionally (second loop, where zero chunks were already skipped) changes nothing. The aligned fast path in read_chunk_words reads native-endian words where the slow path uses from_le_bytes; this is the same only on little-endian targets, which is all XCL builds for. No problems found in the diff.
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:7301026943 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1058#issuecomment-7301026943). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T04:43:09Z. --- **Triage (#1607)** – head dbcaee7 No open or merged PR makes the same change (#985, which this was split out of, is now only about DP4a). Main's `scan_page` has since lost the `sent` update and takes `&Option<...>`, but the PR still merges cleanly onto it and the merged function keeps the zero shortcuts. The two shortcuts in `sparse.rs:scan_page` keep the old results: an all-zero chunk hashes to `ZERO_HASH`, so skipping it when `sent[k] == ZERO_HASH` (first loop) or unconditionally (second loop, where zero chunks were already skipped) changes nothing. The aligned fast path in `read_chunk_words` reads native-endian words where the slow path uses `from_le_bytes`; this is the same only on little-endian targets, which is all XCL builds for. No problems found in the diff. 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/1058:upstream-pr/1058'
git switch 'upstream-pr/1058'

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/1058'
git switch 'upstream-pr/1058'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1058'
git switch 'upstream-pr/1058'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1058'
git switch 'main'
git merge --squash 'upstream-pr/1058'
git switch 'main'
git merge --ff-only 'upstream-pr/1058'
git switch 'main'
git merge 'upstream-pr/1058'
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!1051
No description provided.