Skip to content

Direct DXIL: XCL_DXIL_DIFF=1 draws the graphics tests through both backends - #1935

Draft
mastrr9 wants to merge 1 commit into
xcl-dev:mainfrom
mastrr9:feat/dxil-diff-graphics-mode
Draft

mastrr9 wants to merge 1 commit into
xcl-dev:mainfrom
mastrr9:feat/dxil-diff-graphics-mode

Conversation

@mastrr9

@mastrr9 mastrr9 commented Nov 24, 2026

Copy link
Copy Markdown

With XCL_DXIL_DIFF=1, the GPU tests that translate console VS / PS code (and the mesh-mode first pass) draw a second time with the direct DXIL translations and compare render targets and live mesh records bit for bit. With the variable unset nothing extra is translated or drawn. It uses the same switch as the kernel half but does not depend on it; the two merge cleanly in either order.

Draft: the head commit has not been built or tested yet.

What is in it

  • gpu/recomp/diff_graphics.rs: direct translation of the stages, comparison, report, with tests
  • gpu/recomp/mod.rs: the module line
  • gpu/recomp/tests.rs: one check / check_mesh call before each covered draw (12 added lines)

Tested
These runs are from before the final rebase, on a combined branch (376f968, based on main 689f2db; it holds this change, the other half of the differential mode, and six direct-translator parity fixes), not on this PR's head commit.

  • Windows 11 x64, NVIDIA GeForce RTX 5080 16 GB, cargo test debug build. Driver, CPU and Rust versions were not recorded.
  • cargo test -p xcl --lib recomp::diff_graphics -- --nocapture --test-threads=1: 10 passed, 0 failed.
  • XCL_DXIL_DIFF=1 (with XCL_DXIL_DIFF_TABLE, XCL_DIRECT_DXIL unset), cargo test -p xcl --lib recomp:: -- --test-threads=1: 285 tests ran, 279 passed, 6 reported HLSL / direct mismatches. Not all of the 285 run both backends (some only translate). The combined tree had direct-translator fixes that this PR does not, so this PR alone may report differently.
  • On this 32-lane GPU, three of the mismatches were wave64 VS / PS tests (spill slots and a reduction), among them gpu_wave64_ps_spill_slots and gpu_wave64_vs_spill_slots_and_identity with 256 of 256 pixels different. The direct translator has no upper-lane form for these, the gap Shaders: XCL_DIRECT_DXIL=all ignores split_wave64 / upper_lanes for wave64 VS/PS (poisoning split=1 cache), and XCL_DXIL_NO_OPT bypasses cache_allowed() #1895 describes on the runtime route. This mode calls the translator itself, so a routing fix such as Shaders: guard wave64 graphics direct DXIL #1913 would not by itself clear them: expect those tests to fail in this mode on such GPUs until the translator handles or refuses these programs.

Regression run
Not run: there are no xcl-smoke blocks for this change.

Not tested

  • The head commit (rebased onto main f5136a6) has not been built or tested: it was rebased on macOS, with no Rust toolchain.
  • cargo test --workspace was not run for this change on its own.
  • AMD and Intel GPUs; release build.

AI use

  • Code and tests: written by Claude Opus 5.5 in an agent session (Duet) with no Windows or GPU.
  • RTX 5080 test runs above: a Claude Sonnet 5.5 agent.
  • Overlap check, rebase and this description: Claude Code, Claude Sonnet 5.5.

…ckends

Phase 7 of the direct DXIL spec (default-on for covered shaders) needs proof
that the direct translator draws what the HLSL + DXC path draws. The GPU
tests that translate console VS / PS code now, with XCL_DXIL_DIFF=1, draw a
second time with the direct translations of the same code and compare the
render targets bit for bit (recomp::diff_graphics):

* draw_console_views (and with it draw_console), gpu_graphics_vs_ps_draw and
  gpu_ps_p0_reads_flat_integer_selectors: VS + PS;
* gpu_rect_list_corners: VS + PS around the HLSL rect-list GS, first corner
  order;
* gpu_mesh_mode_two_passes: the mesh-mode first pass, pixels and the part of
  the records the pass-through mesh shader reads (counts, live vertices and
  primitives).

A stage the direct translator refuses keeps the HLSL container (one stderr
line per stage and reason), so the suite runs unchanged in diff mode; a
failure of the translator itself (validation, builder error, panic) fails
the test. A mismatch fails the test with the number of differing pixels and
the first eight as (x, y): HLSL / direct. Unset, check / check_mesh return
at once: no translation, no extra draw.

Unit tests cover the report (count, first eight, bitwise -0.0 / NaN, size
mismatch, dwords), the live-record mask, refusal vs translator failure and
the unset path; a synthetic VS / PS pair translates directly (skipped
without DXC, whose validator the translator runs), and on a GPU draws the
same through both backends.
@upipibi

upipibi commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Ran on NVIDIA: RTX 3070 8 GB (split wave64), driver 616.56, Windows 11, debug, e7cc810 merged onto main 20cf130. XCL_DXIL_DIFF=1 over gpu::dxil::graphics and the gpu_ps / gpu_vs recomp tests: 25 passed, 1 differs. gpu_ps_image_sample_offset_implicit_lod_between_mips: 48 of 256 pixels, e.g. (0, 0) HLSL 26.0 vs direct 25.75.

That is the case #1940 fixes (an implicit-LOD image_sample_o offsets each blended mip by its own texels). With #1940 (54269d7) merged in as well, the same differential run of that test passes. So on this machine the graphics differences on main come down to that one fix. Kernel-side results for #1934 are on that PR.

AI-assisted (Claude Code). Synthetic tests only.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

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.

3 participants