Tests: pin direct DXIL bitstream, compact, and lowering invariants #2355

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

@⁠safesearch77 on GitHub · 2026-11-25 16:27 UTC · original
safesearch77:tests/dxil-bitstream-lowering-invariants → main · +278 −2 · 4 files · 1 commits · open

Add six pure-CPU unit tests across existing Direct DXIL *_tests.rs modules (bitreader_tests.rs, compact_tests.rs, robustness_tests.rs, reusing graphics_tests::part) pinning bitstream serialisation, compact block-class planning and auto-nesting, split-Wave64 whole-live exchange elision, 64-bit integer compare lowering, and POPS ROV flag inference.

No runtime files are modified (*_tests.rs only), and every test runs purely in memory without requiring a GPU or dxcompiler.dll.

What is in it

  • crates/xcl/src/gpu/dxil/bitreader_tests.rs:
    • phis_encode_signed_relative_ids_and_prune_unreachable_predecessors: verifies FUNC_CODE_INST_PHI signed-VBR forward (-1 -> 3) and backward (+1 -> 2) relative value IDs across loop back-edges, and verifies unreachable predecessor blocks and their incoming phi edges are omitted from FUNC_CODE_DECLAREBLOCKS and FUNC_CODE_INST_PHI.
    • alloca_explicit_type_bit_and_unused_symbol_elision: verifies FUNC_CODE_INST_ALLOCA sets the LLVM 3.7 explicit-type bit (1 << 6) alongside log2(align) + 1 with distinct pointee types (i32 vs i64), and verifies unreferenced globals and unreferenced external dx.op declarations are elided from MODULE_CODE_GLOBALVAR, MODULE_CODE_FUNCTION, and BLOCK_VALUE_SYMTAB.
  • crates/xcl/src/gpu/dxil/compact_tests.rs:
    • plan_splits_getpc_static_samplers_and_loop_headers: verifies compact::plan splits byte-identical blocks when s_getpc_b64 sits at distinct PCs, when static_samplers binds distinct constant S# words (while merging matching S# words), or when only one copy is a natural loop header spending VAR_BUDGET, plus checks packed Plan::words().
    • auto_nest_threshold_switches_at_512_classes_in_emitted_ir: verifies compact::emit_with_nest(..., Nest::Auto) emits a single flat switch at 511 classes (AUTO_NEST_MIN_CLASSES - 1) and transitions at 512 classes (AUTO_NEST_MIN_CLASSES) to two-level dispatch (1 outer switch + 16 inner switches of 32 targets).
  • crates/xcl/src/gpu/dxil/robustness_tests.rs & crates/xcl/src/gpu/dxil/graphics_tests.rs:
    • Widen graphics::tests::part to pub(in crate::gpu::dxil) so robustness_tests reuses it without duplicating container parsing.
    • split_wave64_whole_live_elides_exchange_barriers_for_lane_local_masks: verifies split-Wave64 compute lowering keeps only the xcl_wt wave counter (1 addrspace-3 global, 4 TGSM bytes, 1 barrier) when VCC is read per-lane (v_cndmask_b32), while allocating xcl_x64_s (2 addrspace-3 globals, 12 TGSM bytes, 3 barriers) when VCC is read as a scalar SGPR (s_mov_b32), and verifies 64-bit integer compares (v_cmp_lt_i64) do not set D3D_SHADER_REQUIRES_INT64_OPS (0x8000) in SFI0.
    • pops_pixel_shader_gates_rov_sfi0_flag_on_surviving_uav_handles: verifies pixel-shader D3D_SHADER_REQUIRES_ROVS (0x1000 in SFI0) under HEAP_WINDOWS is set iff POPS (src_pops_exiting_wave_id) is used and an IsROV heap UAV annotateHandle survives dead-code elimination.

Tested

  • Linux x86_64 host native unit test execution (rustc --edition 2021 --test harness over gpu::dxil on commit b2da28c, base 0829441): 34 passed; 0 failed (bitreader_tests: 6 passed, compact_tests: 10 passed, robustness_tests: 10 passed, graphics::tests: 8 passed).
  • Offline cross-target check: cargo check --offline --target x86_64-pc-windows-gnu --workspace --tests (0 errors, 0 new warnings).
  • python3 scripts/pr_check.py --local (description ok, *_tests.rs-only diff).

Not tested

  • Full Windows cargo test --workspace -- --test-threads=4 GPU suite (authored and executed on a Linux CPU host without a D3D12 GPU or dxcompiler.dll; all 6 added tests are pure-CPU unit tests that run on the standard no-GPU Windows CI runner).
  • Retail title / GPU runs (test-only *_tests.rs change; no runtime code modified).

AI use

  • Authored with Antigravity (Gemini 4 Carbon) and reviewed with Claude Opus 5.5: audited Direct DXIL bitstream/compact/lowering invariants against open PRs, wrote and ran the six unit tests on host CPU, and verified cargo check --workspace --tests and scripts/pr_check.py --local.
**@⁠safesearch77** on GitHub · 2026-11-25 16:27 UTC · [original](https://github.com/xcl-dev/xcl/pull/2355) `safesearch77:tests/dxil-bitstream-lowering-invariants` → `main` · +278 −2 · 4 files · 1 commits · open Add six pure-CPU unit tests across existing Direct DXIL `*_tests.rs` modules (`bitreader_tests.rs`, `compact_tests.rs`, `robustness_tests.rs`, reusing `graphics_tests::part`) pinning bitstream serialisation, compact block-class planning and auto-nesting, split-Wave64 whole-live exchange elision, 64-bit integer compare lowering, and POPS ROV flag inference. No runtime files are modified (`*_tests.rs` only), and every test runs purely in memory without requiring a GPU or `dxcompiler.dll`. **What is in it** - `crates/xcl/src/gpu/dxil/bitreader_tests.rs`: - `phis_encode_signed_relative_ids_and_prune_unreachable_predecessors`: verifies `FUNC_CODE_INST_PHI` signed-VBR forward (`-1 -> 3`) and backward (`+1 -> 2`) relative value IDs across loop back-edges, and verifies unreachable predecessor blocks and their incoming phi edges are omitted from `FUNC_CODE_DECLAREBLOCKS` and `FUNC_CODE_INST_PHI`. - `alloca_explicit_type_bit_and_unused_symbol_elision`: verifies `FUNC_CODE_INST_ALLOCA` sets the LLVM 3.7 explicit-type bit (`1 << 6`) alongside `log2(align) + 1` with distinct pointee types (`i32` vs `i64`), and verifies unreferenced globals and unreferenced external `dx.op` declarations are elided from `MODULE_CODE_GLOBALVAR`, `MODULE_CODE_FUNCTION`, and `BLOCK_VALUE_SYMTAB`. - `crates/xcl/src/gpu/dxil/compact_tests.rs`: - `plan_splits_getpc_static_samplers_and_loop_headers`: verifies `compact::plan` splits byte-identical blocks when `s_getpc_b64` sits at distinct PCs, when `static_samplers` binds distinct constant `S#` words (while merging matching `S#` words), or when only one copy is a natural loop header spending `VAR_BUDGET`, plus checks packed `Plan::words()`. - `auto_nest_threshold_switches_at_512_classes_in_emitted_ir`: verifies `compact::emit_with_nest(..., Nest::Auto)` emits a single flat switch at `511` classes (`AUTO_NEST_MIN_CLASSES - 1`) and transitions at `512` classes (`AUTO_NEST_MIN_CLASSES`) to two-level dispatch (`1` outer switch + `16` inner switches of `32` targets). - `crates/xcl/src/gpu/dxil/robustness_tests.rs` & `crates/xcl/src/gpu/dxil/graphics_tests.rs`: - Widen `graphics::tests::part` to `pub(in crate::gpu::dxil)` so `robustness_tests` reuses it without duplicating container parsing. - `split_wave64_whole_live_elides_exchange_barriers_for_lane_local_masks`: verifies split-Wave64 compute lowering keeps only the `xcl_wt` wave counter (`1` addrspace-3 global, `4` TGSM bytes, `1` barrier) when `VCC` is read per-lane (`v_cndmask_b32`), while allocating `xcl_x64_s` (`2` addrspace-3 globals, `12` TGSM bytes, `3` barriers) when `VCC` is read as a scalar SGPR (`s_mov_b32`), and verifies 64-bit integer compares (`v_cmp_lt_i64`) do not set `D3D_SHADER_REQUIRES_INT64_OPS` (`0x8000`) in `SFI0`. - `pops_pixel_shader_gates_rov_sfi0_flag_on_surviving_uav_handles`: verifies pixel-shader `D3D_SHADER_REQUIRES_ROVS` (`0x1000` in `SFI0`) under `HEAP_WINDOWS` is set iff POPS (`src_pops_exiting_wave_id`) is used and an `IsROV` heap UAV `annotateHandle` survives dead-code elimination. **Tested** - Linux x86_64 host native unit test execution (`rustc --edition 2021 --test` harness over `gpu::dxil` on commit `b2da28c`, base `0829441`): `34 passed; 0 failed` (`bitreader_tests`: `6 passed`, `compact_tests`: `10 passed`, `robustness_tests`: `10 passed`, `graphics::tests`: `8 passed`). - Offline cross-target check: `cargo check --offline --target x86_64-pc-windows-gnu --workspace --tests` (`0` errors, `0` new warnings). - `python3 scripts/pr_check.py --local` (`description ok`, `*_tests.rs`-only diff). **Not tested** - Full Windows `cargo test --workspace -- --test-threads=4` GPU suite (authored and executed on a Linux CPU host without a D3D12 GPU or `dxcompiler.dll`; all 6 added tests are pure-CPU unit tests that run on the standard no-GPU Windows CI runner). - Retail title / GPU runs (test-only `*_tests.rs` change; no runtime code modified). **AI use** - Authored with Antigravity (Gemini 4 Carbon) and reviewed with Claude Opus 5.5: audited Direct DXIL bitstream/compact/lowering invariants against open PRs, wrote and ran the six unit tests on host CPU, and verified `cargo check --workspace --tests` and `scripts/pr_check.py --local`.
Add six pure-CPU unit tests across bitreader_tests, compact_tests, and
robustness_tests (reusing graphics_tests::part) covering phi relative
value encoding and unreachable predecessor pruning, alloca explicit-type
records and unused symbol elision, compact class splitting and
Nest::Auto 512-class dispatch, split-Wave64 whole-live TGSM/barrier
elision, 64-bit integer compare SFI0 flags, and POPS ROV inference.

Assisted-by: Antigravity (Gemini 4 Carbon)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:28:44 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 18:37 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 18:37 UTC · [original](https://github.com/xcl-dev/xcl/pull/2355#issuecomment-7171167215) 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

@⁠SlopTart on GitHub · 2026-11-25 19:05 UTC · original

Tested: current PR head merged onto current origin/main (clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target x86_64-pc-windows-gnu run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).
gpu_ suite, cold cache: 143 passed / 4 failed. The fourth failure besides the baseline trio is gpu_geometry_wave32_prefix_count_over_a_mask, which passes 3/3 solo at --test-threads=1 on this tree and passes in-suite on other trees; order-dependent flake family, not attributable to this PR. The tests this PR pins all ran inside the suite and passed.

Not tested: retail titles (no title data on this lane, counts only).

AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.

**@⁠SlopTart** on GitHub · 2026-11-25 19:05 UTC · [original](https://github.com/xcl-dev/xcl/pull/2355#issuecomment-7171817771) **Tested**: current PR head merged onto current `origin/main` (clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target `x86_64-pc-windows-gnu` run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29). `gpu_` suite, cold cache: 143 passed / 4 failed. The fourth failure besides the baseline trio is `gpu_geometry_wave32_prefix_count_over_a_mask`, which passes 3/3 solo at `--test-threads=1` on this tree and passes in-suite on other trees; order-dependent flake family, not attributable to this PR. The tests this PR pins all ran inside the suite and passed. **Not tested**: retail titles (no title data on this lane, counts only). **AI use**: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
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/2355/head:github-bot/gh-2355'
git switch 'github-bot/gh-2355'

Merge

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