d3d12x: accelerate sparse UMA window chunk scanning #1058

Open
github-bot wants to merge 1 commit from github-bot/gh-1058 into main AGit
Owner

@⁠UnkwnDev on GitHub · 2026-11-24 11:03 UTC · original
UnkwnDev:arc-uma-scan → main · +28 −14 · 1 files · 1 commits · open

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.
**@⁠UnkwnDev** on GitHub · 2026-11-24 11:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/1058) `UnkwnDev:arc-uma-scan` → `main` · +28 −14 · 1 files · 1 commits · open 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:42:10 +00:00
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-24 14:16 UTC · original · edited 2026-11-24 14:30 UTC

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.
**@⁠futurepro62** on GitHub · 2026-11-24 14:16 UTC · [original](https://github.com/xcl-dev/xcl/pull/1058#issuecomment-7134124300) · edited 2026-11-24 14:30 UTC 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.
Author
Owner

@⁠thaqiart139-alt on GitHub · 2026-11-24 22:49 UTC · original

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.
**@⁠thaqiart139-alt** on GitHub · 2026-11-24 22:49 UTC · [original](https://github.com/xcl-dev/xcl/pull/1058#issuecomment-7146678842) 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.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 09:04 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!

**@⁠DavidM1911** on GitHub · 2026-11-25 09:04 UTC · [original](https://github.com/xcl-dev/xcl/pull/1058#issuecomment-7157844732) 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!
Author
Owner

@⁠xpatfussy69x on GitHub · 2026-11-25 11:43 UTC · original

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.
**@⁠xpatfussy69x** on GitHub · 2026-11-25 11:43 UTC · [original](https://github.com/xcl-dev/xcl/pull/1058#issuecomment-7161412729) 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.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1058/head:github-bot/gh-1058'
git switch 'github-bot/gh-1058'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1058'
git switch 'github-bot/gh-1058'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1058'
git switch 'github-bot/gh-1058'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1058'
git switch 'main'
git merge --squash 'github-bot/gh-1058'
git switch 'main'
git merge --ff-only 'github-bot/gh-1058'
git switch 'main'
git merge 'github-bot/gh-1058'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.