Skip to content

DXIL: lower window_at address carry in 32-bit without i64 - #2180

Merged
ivall merged 1 commit into
xcl-dev:mainfrom
O5-7:dxil/window-at-32bit-carry
Nov 25, 2026
Merged

ivall merged 1 commit into
xcl-dev:mainfrom
O5-7:dxil/window-at-32bit-carry

Conversation

@O5-7

@O5-7 O5-7 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Part of #2088
Part of #1269

What is in it

  • Workstream 5 (crates/xcl/src/gpu/dxil/lower_window.rs): replace 64-bit pack64 / i64 arithmetic in Lw::window_at with scalar 32-bit carry propagation (�dd + icmp ult + zext i1 -> i32, plus icmp ult lo, neg_k borrow for negative signed constants), umul_wide for non-constant Ea::Mul, and compile-time filtering of constant-zero terms, eliminating i64 operations and Feature::Int64Ops from multi-window direct-DXIL address selection.
  • Note on carry lowering choice: an intermediate prototype using dx.op.binaryWithCarryOrBorrow.i32 (uaddc) emitted 5 IR ops + %dx.types.i32c + 2 extractvalues per term, bloating synthetic multi-window DXIL by +8.8% (59,544 -> 64,804 B) and regressing cold NVIDIA
    256 compile time (62.5 -> 66.1 ms), so scalar �dd + icmp ult was used instead.
  • Add IR/validator test window_at_lowers_to_32bit_carry_without_int64 in crates/xcl/src/gpu/dxil/core_tests.rs and GPU parity test gpu_window_at_32bit_carry_edge_cases in crates/xcl/src/gpu/recomp/tests.rs.

Tested

  • Hardware / toolchain: NVIDIA GeForce RTX 5080 16 GB (driver 32.0.15.9579), AMD Ryzen 7 9700X, 32 GB RAM, Windows 11 Pro 10.0.26100,
    ustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.8.2502.11 (D:\Windows Kits\10\bin\10.0.26100.0\x64).
  • cargo test -p xcl window_at -- --nocapture (default HLSL): 2 passed, 0 failed, 0 ignored.
  • cargo test -p xcl window_at -- --nocapture (XCL_DIRECT_DXIL=1): 2 passed, 0 failed, 0 ignored.
  • cargo test -p xcl memory_windows -- --nocapture (XCL_DIRECT_DXIL=1): 6 passed, 0 failed, 0 ignored.
  • cargo test --workspace -- --test-threads=4: 1156 passed, 0 failed, 46 ignored.
  • Controlled cold NVIDIA CreateComputePipelineState A/B (--release, ID3D12Device9::ShaderCacheControl implicit D3D + driver cache DISABLE -> cache_disabled=true, 5 cold runs per workload, mem_windows=4, wave64=false, synthetic multi-window compute shaders mixing GLOBAL_LOAD_DWORD, BUFFER_LOAD_DWORD, and S_LOAD_DWORD):

64 (64 non-zero-offset ops): main 16,628 B DXIL / 3,139 us translate / 35.794 ms driver median ([34.352, 35.398, 35.794, 36.526, 39.086]) vs PR 16,692 B DXIL / 3,109 us translate / 34.559 ms driver median ([34.282, 34.307, 34.559, 35.444, 38.208], -3.4%).

256 (256 non-zero-offset ops): main 59,544 B DXIL / 10,025 us translate / 63.274 ms driver median ([61.960, 62.059, 63.274, 63.811, 64.571]) vs PR 59,616 B DXIL / 9,894 us translate / 60.896 ms driver median ([59.495, 59.516, 60.896, 61.232, 62.632], -3.8%).

256_realistic (256 mixed zero-offset + offset/indexed ops): main 44,876 B DXIL / 7,953 us translate / 49.202 ms driver median ([48.611, 49.175, 49.202, 49.812, 52.087]) vs PR 44,788 B DXIL (-88 B) / 7,366 us translate (-7.4%) / 47.703 ms driver median ([46.657, 47.320, 47.703, 47.740, 47.769], -3.0%).

Regression run
xcl-smoke v1 commit: cbc296ab65a2661a61e3e2da109134bcd5319f60 gpu: NVIDIA GeForce RTX 5080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1686 (PresentX 1686) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14083 MB
xcl-smoke v1 commit: 547886ca0e4b74b6338d970301894a543a21b249 gpu: NVIDIA GeForce RTX 5080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1686 (PresentX 1686) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14071 MB

Not tested

  • Cold retail title startup milestone timing with XCL_DIRECT_DXIL=1 on real multi-window compute shaders was not measured (synthetic multi-window compute corpus and live retail smoke test were measured instead).

AI use

  • Antigravity (Gemini 4 Neon) implemented the 32-bit window_at lowering, wrote the IR and GPU parity tests, ran the cold ShaderCacheControl(DISABLE) NVIDIA A/B measurements, ran the workspace tests and smoke run, and drafted the PR body.

Propagate 64-bit effective address carries in Lw::window_at using scalar
32-bit add + icmp ult + zext (and icmp ult lo, -k for negative signed
constants), umul_wide for non-constant Ea::Mul, and compile-time
filtering of constant-zero terms, eliminating i64 ops and
Feature::Int64Ops from multi-window direct-DXIL address selection.

Part of xcl-dev#2088
Part of xcl-dev#1269

Assisted-by: Antigravity (Gemini 4 Neon)
@bielfreedom

Copy link
Copy Markdown

AMD RDNA4 numbers for #2180: direct DXIL −2.1 %, AMD driver time unchanged (+1.2 %, within noise), and the tests pass on both paths.

Setup

  • GPU: RX 9070 XT 16 GB (RDNA4, native wave64), AMD driver 32.0.32029.2010.
  • CPU and memory: Ryzen 7 7700, 32 GB RAM, Windows 11, release.
  • Builds:
    • base 568e7db;
    • this PR at 547886c.
  • Both builds carry a local patch that only logs per-program DXIL size and per-CreateComputePipelineState time.

Method

  • XCL_DIRECT_DXIL=1, XCL_HEAP_WINDOWS=0, 4 windows, XCL_PIPELINE_THREADS=1.
  • XCL_PSO_DISK_CACHE=0, with a fresh exe name per phase (the AMD driver cache is keyed on it).
  • Programs: the same 24 retail compute programs as my A14 rows, 6 to 917 KB of direct DXIL.
  • 2 rounds, interleaved.
base 568e7db #2180
driver, sum of 24 (r1 / r2) 198.2 / 198.2 s 201.6 / 200.5 s (+1.2 %)
total direct DXIL 6.852 MB 6.705 MB (−2.1 %)
driver-phase peak private 4.16 GB 4.15 GB
  • Every program's DXIL changed; 21 of the 24 shrank by 0.8–2.8 %. The four ~0.8–0.9 MB programs shrank 2.6–2.8 % and built at ×0.99 to ×1.04.
  • 0 refused.
  • Two mid-size programs moved further in opposite directions: 86 KB ×1.84 and 121 KB ×0.67. Both are under 1 s and cancel out in the sum, so I read them as per-program noise.

Tests on this card (XCL_REQUIRE_GPU=1, XCL_ADAPTER=9070)

  • cargo test --release -p xcl --lib -- window_at memory_windows --test-threads=1: 8 passed, 0 failed with XCL_DIRECT_DXIL unset, and 8 passed, 0 failed with XCL_DIRECT_DXIL=1.
  • No SKIPPED notices in either run. That includes window_at_lowers_to_32bit_carry_without_int64 and gpu_window_at_32bit_carry_edge_cases.

Read: on the AMD compiler, dropping the i64 address arithmetic makes the containers smaller but doesn't change build time on these programs. Any gain would be at run time, which this doesn't measure.

Not tested: dispatch GPU time, XCL_HEAP_WINDOWS=1, a title run.

AI use: Claude Code (Claude Opus 5.5) ran the measurement and tests and wrote this. Account owner away; counts and timings only, no game data.

@luckyteagirl

Copy link
Copy Markdown
Contributor

Independent RX 6800M check on exact head 547886ca0e4b74b6338d970301894a543a21b249 (base 568e7db7729c8fa6c8f0f4b32d798faaf11462bb). The worktree was clean after diagnostics.

Environment: Windows 11 build 26200; Ryzen 9 5980HX; Radeon RX 6800M (RDNA2), driver 30.0.13002.13003; Rust 1.99.0 MSVC; DXC/DXIL 1.9.2609.5. I used XCL_ADAPTER=6800M, XCL_REQUIRE_GPU=wave64, and the matching XCL_DXC_DIR. I also retried with a temporary Windows high-performance GPU preference for the test executable.

Focused results (cargo test --locked -p xcl --lib -j 2 <filter> -- --test-threads=1 --show-output):

  • window_at_lowers_to_32bit_carry_without_int64, XCL_DIRECT_DXIL=1: 1 passed, 0 failed, 0 ignored; no SKIPPED marker.
  • gpu_window_at_32bit_carry_edge_cases, XCL_DIRECT_DXIL=1: process terminated with 0xc0000005 / STATUS_ACCESS_VIOLATION before an assertion or test result. The same new test also crashed with XCL_DIRECT_DXIL=0 and with the high-performance GPU preference.
  • Control: the pre-existing gpu_memory_windows_above_4_gib test also terminated with 0xc0000005 under direct DXIL on this machine. Thus the new GPU-test crash is not sufficient evidence of a regression in this PR's address lowering.

Temporary local diagnostic prints showed the new test completed UMA allocation, HLSL and direct DXIL compilation, two OpenExistingHeapFromAddress / CreatePlacedResource calls, pipeline creation, four window UAV descriptors, and SetDescriptorHeaps. The process then died before the print immediately after SetComputeRootSignature in run_in_region. The older control test stopped at the same boundary. I removed all diagnostic edits and verified the checkout returned to the exact clean PR head.

Scope: The IR/validator portion passed. GPU output parity and the performance claim remain unverified on this RX 6800M because of the shared runner crash. I did not run a full suite or retail-title smoke for this PR.

AI use: OpenAI Codex ran and compared the focused tests, instrumented the local runner to locate the crash, restored those edits, checked the exact revision, and prepared this report.

@itsSio

itsSio commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Tested

Independent Windows check at clean head 547886ca0e4b74b6338d970301894a543a21b249, no local merge or patches. Windows 11 Pro 26200 and x64 MSVC on both systems, unoptimized dev/test with debug info off. Both cargo build --workspace --locked and cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --nocapture exited 0.

GPU / driver CPU, RAM, toolchain Passed / failed / ignored Runtime SKIPPED
RTX 5080 / 32.0.16.1088 Ryzen 7 9800X3D, 32 GiB; Rust 1.97.0, DXC/DXIL 1.9.2609.5 1156 / 0 / 46 25
RTX 2080 SUPER / 32.0.16.1088 Ryzen 5 5600X, 16 GiB; Rust 1.99.1, DXC/DXIL 1.8.2502.11 1156 / 0 / 46 27

Both logged 20 native-wave64 skips, three per-lane f16/f32 refusals, one unavailable driver-cache control and one unavailable heap-windows case. The RTX 2080 SUPER also had two missing-D3D12-debug-layer skips (test_title_draws_with_a_root_signature_under_the_debug_layer, uploads_start_from_each_subresources_state). The workspace used default shader options.

With XCL_DIRECT_DXIL=1, cargo test -p xcl --lib --locked window_at -- --test-threads=1 --nocapture gave 2 / 0 / 0 and the same command with memory_windows gave 6 / 0 / 0 on each of the RTX 2080 SUPER, RTX 5080 and Radeon RDNA2 iGPU (32.0.21043.5001, Ryzen 7 system). No runtime skips in these six invocations. The window_at filter includes the DXIL validator check and the GPU check for window-boundary carry, borrow and out-of-range results.

Not tested

Retail smoke or shader samples, full AMD workspace, Intel or RADV, compilation speed and gameplay performance.

AI use

Ran via Samaritan:

  • OpenCode with OpenAI GPT-6.2 Sol (openai/gpt-6.2-sol): planned and ran both Windows verifications, checked raw logs and wrote this report. No subagents contributed to this verification.

@ivall
ivall merged commit 16d6793 into xcl-dev:main Nov 25, 2026
2 checks passed
@ivall

ivall commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Merged as 16d6793, thank you.

Tested on AMD RDNA4 (native wave64), Windows, DXC 1.8.2502.11, debug: 426a5a7 + this + ea088a5 (an image_get_resinfo fix), cargo test --workspace --no-fail-fast -- --test-threads=4: 1243 passed, 2 failed, 46 ignored, 7 SKIPPED; XCL_DIRECT_DXIL=all cargo test -p xcl --lib gpu::: 629 passed, 2 failed, 22 ignored. The two failures are fuzz_validate_and_gpu_1 and _3 (#2115), on main too. gpu_window_at_32bit_carry_edge_cases ran on the card and passed.

In the title, in a tree with #2029, #1782 and the #2080 stack besides: one run of 421 s with XCL_DIRECT_DXIL=1, no device removal, no crash, closed by hand.

AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this on the maintainer's behalf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants