Skip to content

Tests: implicit-LOD sample offset test uses s_wqm and the host's LOD - #982

Open
vakaobr wants to merge 1 commit into
xcl-dev:mainfrom
vakaobr:tests/sample-offset-wqm-host-lod
Open

vakaobr wants to merge 1 commit into
xcl-dev:mainfrom
vakaobr:tests/sample-offset-wqm-host-lod

Conversation

@vakaobr

@vakaobr vakaobr commented Nov 24, 2026 •

Copy link
Copy Markdown

gpu_ps_image_sample_offset_implicit_lod_between_mips fails on Apple's D3DMetal (macOS, CrossOver) for two reasons, neither in the code it tests. Part of #258.

  1. The program has no s_wqm, which a console shader runs before an implicit-LOD sample. On D3DMetal, quads along a diagonal of the test's triangle have helper lanes. Their u / v stay 0, so 30 pixels read mip 3 (300 where 30.25 is expected). A plain HLSL Sample with the same offset, texture and triangle has no such pixels.
  2. The expected values assume a host LOD of exactly 0.25. A plain HLSL CalculateLevelOfDetail on D3DMetal returns 0.2421875 for every pixel, so even correct sampling misses the 0.02 tolerance (25.22 where 26 is expected).

What is in it

  • crates/xcl/src/gpu/recomp/tests.rs: the program starts with S_WQM_B64 exec, exec, and the expected values blend the two mips by the host's own LOD, read by a plain HLSL draw of the same triangle, texture and sampler. The tolerance and the per-mip texel check are unchanged. The test also asserts that the host LOD lies between mips 0 and 1.

Tested

Regression run

Test-only change in tests.rs: no xcl-smoke blocks.

Not tested

  • Windows GPUs by me (see the independent runs above), and Intel GPUs by anyone.
  • The release build.

AI use

  • Claude Code with Claude Opus 5.5 found the two causes with probe shaders, wrote the change, ran the tests and mutations on the Mac, and wrote this description.

gpu_ps_image_sample_offset_implicit_lod_between_mips failed on D3DMetal
(macOS, CrossOver) for two reasons outside the code it tests:

- Its program had no s_wqm, which a console shader runs before an
  implicit-LOD sample. On D3DMetal, quads along a diagonal of the test's
  triangle have helper lanes; their u / v stayed 0 and 30 pixels read
  mip 3. A plain HLSL Sample with the same offset has no such pixels.
- The expected values assumed a host LOD of exactly 0.25. D3DMetal's
  CalculateLevelOfDetail returns 0.2421875 for every pixel.

The program now starts with s_wqm, and the expected values blend the
two mips by the host's own LOD, read by a plain HLSL draw of the same
triangle, texture and sampler. The tolerance and the per-mip texel
check are unchanged: moving mip 1 by mip 0's offset still fails the
test, and so does leaving s_wqm out. (xcl-dev#258)

Assisted-by: Claude Code (Claude Opus 5.5)
@Diskuss

Diskuss commented Nov 24, 2026

Copy link
Copy Markdown

Tested on AMD Radeon RX 9070 XT (RDNA4) at 3a6f95a690dfd0ab7aa7d90bd5655cb7be07d821

AMD Radeon RX 9070 XT (RDNA4), driver 32.0.32015.7029; Ryzen 7 5700X3D; 32 GB RAM; Windows 11 Pro build 26300.9974; Rust 1.100.0; DXC 1.9.2602.17; debug build.

Tested (PR head as-is; it is 0 commits behind main 9aec53d, so no merge was needed):

Not tested: retail title / scripts/smoke.ps1 (no game files), release build.

Report written by Claude Code (Claude Sonnet 5.5) from a real run on this machine.

@LANgmas

LANgmas commented Nov 24, 2026

Copy link
Copy Markdown

Independent validation — NVIDIA RTX 3050 Laptop (Windows D3D12)

Tested PR head: 3a6f95a690dfd0ab7aa7d90bd5655cb7be07d821
PR base: 9aec53d
Tested in isolated worktrees at the exact baseline and PR revisions.

Hardware / environment

  • NVIDIA RTX 3050 Laptop GPU, 3962 MiB VRAM
  • NVIDIA driver 617.14
  • D3D12 Feature Level 12_2
  • WaveLaneCountMin / WaveLaneCountMax: 32 / 32
  • DXC 1.9.2602.17
  • Windows SDK 10.0.26100.0
  • Windows, debug build

Focused A/B test — PASS
Test:
gpu_ps_image_sample_offset_implicit_lod_between_mips

Baseline (9aec53d, before this PR):

  • Passed on the real NVIDIA D3D12 adapter (1.63s).
  • The hardcoded host LOD assumption of 0.25 holds on this adapter/driver.

PR head (3a6f95a):

  • Passed on the real NVIDIA D3D12 adapter (1.69s).
  • The s_wqm and host-measured-LOD version introduces no regression on this NVIDIA configuration.

The D3DMetal-specific LOD deviation reported by the author (0.2421875) was not observed on this NVIDIA adapter. This report therefore does not reproduce the original D3DMetal failure; it independently checks that the PR's cross-backend test changes remain correct on NVIDIA D3D12.

Full official test wrapper — PASS
Command: .\scripts\test.ps1
Result: 724 passed, 0 failed, 41 ignored, across 17 test binaries. Exit code 0.
The wrapper reported 2 GPU tests skipped because this adapter does not support native wave64.
One existing upstream fetch_update deprecation warning was observed. No panic or device-removal event occurred.

Skip and sample-data limitations

  • Native-wave64-only test: full early skip.
  • Geometry wave64 test: wave32 portion executed; native-wave64 reference portion skipped.
  • Three additional hidden skips were observed with --nocapture: two debug-layer-dependent tests and one reserved-cubemap adapter capability test.
  • All XCL_SAMPLE_* variables were unset. Approximately 28 sample-gated tests returned early rather than exercising their full game-data paths. This is an estimate from source gates and observed runtimes, not a per-test exhaustive audit.
  • The 41 ignored tests are separate.

Not tested

  • Native wave64 hardware.
  • Retail game or sample-data workloads.
  • Release configuration.
  • The PR after integration with the current upstream main.
  • Gameplay performance or retail game playability.
    At validation time, the PR base (9aec53d) was approximately 13 commits behind current upstream main (384f7f7). This report describes the exact PR head/base tested, not merge-time validation against current main.

Interpretation
On this NVIDIA RTX 3050 configuration, the baseline test already passed, and the PR-head test also passed. The original D3DMetal-specific failure was not reproduced here. These results provide an independent NVIDIA D3D12 cross-backend check and show no regression on this adapter; they do not validate the original D3DMetal behavior or retail-game compatibility.

AI use
Devin (SWE-2 Max) assisted with test execution and result reconciliation. The contributor reviewed the results and authorized this report.

@mikebuckets171

Copy link
Copy Markdown

Verified on a second Apple silicon host, on the gnullvm target: the test fails on the base with the LOD-shaped value you describe, and passes at this head.

Host: MacBook Pro M5 Pro (48 GB), macOS 27.2.1, CrossOver 26 with D3DMetal (adapter reports "AMD Compatibility Mode"), Rosetta 2, Rust 1.100.0, x86_64-pc-windows-gnullvm with LLVM-MinGW 20261117 (clang 23.1.6), --release --locked, test binary run under Wine, one test per process (--exact <full test path> --nocapture --test-threads=1). Base 9aec53d, head 3a6f95a.

  • 9aec53d: FAILED - panicked at crates/xcl/src/gpu/recomp/tests.rs:2060:13: pixel (0,0) = 25.21875, expected 26, test result: FAILED. 0 passed; 1 failed, exit 0x65, 0.53 s.
  • 3a6f95a: ok. 1 passed; 0 failed in 0.50 s, exit 0x0.

The failing value sits below the expected 26, which is the shape an implicit LOD a little under the 0.25 the test assumes produces (the description measured 0.2421875 on its host). I did not read this host's LOD directly, so treat that as consistent with your diagnosis rather than an independent confirmation of the number. What is confirmed here is the pair that matters for merging: the test as written does not hold on this host, and at your head it passes. Which of your two changes - adding s_wqm, or reading the host's LOD - carries the fix on this host I did not separate.

Worth noting for anyone reading the #258 threads together: with #983's head (ab7ce43) on the same base, this test still fails with the identical message at tests.rs:2080 (the line the atomics patch shifts), so the two PRs are genuinely independent - #983 does not touch it, and #982 does not touch the atomics tests. Both verified in one tree, base 9aec53d.

Not tested here: Windows (no Windows machine on this bench), and this PR's CI job has not run on GitHub - as with my own PRs here, a head from a fork shows only the PR checks description job until a maintainer approves a workflow run.

Host: macOS 27.2.1 (Apple silicon, M5 Pro), CrossOver 26, D3DMetal; local inference unloaded and the bottle's wineserver stopped for each run. AI use: GPT-6 Luna built both trees, ran the test and drafted this comment; the values and line numbers are from those runs.

@shortside

Copy link
Copy Markdown

Test report from a second Mac, head 3a6f95a against its merge base 9aec53d.

Tested

  • MacBook Pro M5 Pro, macOS 27.2.1, Rosetta 2; CrossOver 26.3 (Wine 11.0), Windows 10 bottle, D3DMetal; DXC 1.9.2609. Cross-built for x86_64-pc-windows-msvc with clang-cl / lld-link 23.1.6 and an xwin SDK 10.0.26100, Rust 1.100.0, debug. The lib test binary run under Wine, one test per process (--exact --nocapture, 60 s cap).
  • gpu_ps_image_sample_offset_implicit_lod_between_mips: base failed (pixel (0,0) = 25.21875, expected 26 on this host); head passed.

Not tested

  • Windows and other GPUs (whether the changed expectation still holds there), the rest of the suite.

AI use

  • Claude Code with Claude Fable 5.2 built both commits, ran the tests and wrote this report.

@DavidM1911

Copy link
Copy Markdown
Contributor

Independent verification, merged onto current main 384f7f7 locally (clean merge).

Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug; DXC 1.8.2502.11.

  • cargo test -p xcl --lib implicit: 2 passed, 0 failed — gpu_ps_image_sample_offset_implicit_lod_between_mips passes on real hardware with the s_wqm fix and host-LOD expectation.

AI use: test runs by Devin (Cognition, SWE-2); no code changes.

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

Labels

off-goal Does not bear on the current goal (world loading); waits until it is reached

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants