Skip to content

Direct DXIL: lower i64 min/max as compare/select - #1946

Open
luckyteagirl wants to merge 1 commit into
xcl-dev:mainfrom
luckyteagirl:codex/dxil-i64-ops
Open

luckyteagirl wants to merge 1 commit into
xcl-dev:mainfrom
luckyteagirl:codex/dxil-i64-ops

Conversation

@luckyteagirl

@luckyteagirl luckyteagirl commented Nov 24, 2026 •

Copy link
Copy Markdown

Follow-up to #1679. On the Radeon RX 6800M with Windows driver 30.0.13002.13003, each dx.op.binary.i64 signed or unsigned min/max variant suspended the D3D12 device during pipeline creation (0x887A0005). This lowers those four forms to i64 comparisons and select. The direct-DXIL source hash from #1947 keys the translated cache, so the rebased change needs no manual translator-version bump.

What is in it

  • ops.rs: use signed or unsigned i64 comparison and select for IMax, IMin, UMax, and UMin; other binary operations keep their current path.
  • ops_tests.rs: compare both output words against CPU signed and unsigned min/max across 32 lanes, including equal high words with different low words.

Tested

  • Exact head f90626676934293a7c3c35cccd77c06299bce32d on main cbc296ab65a2661a61e3e2da109134bcd5319f60. Windows 11 build 26200, Ryzen 9 5980HX, AMD Radeon RX 6800M driver 30.0.13002.13003, Rust 1.99.0 MSVC, DXC/DXIL 1.9.2609.5.
  • XCL_ADAPTER=6800M, XCL_REQUIRE_GPU=1, XCL_DIRECT_DXIL=1: the focused gpu::dxil::ops_tests::int64_bit_ops_match_cpu test passed (1 passed, 0 failed, 0 ignored, no explicit skip). The whole gpu::dxil::ops_tests group passed 20/20 with --test-threads=1 and no explicit skips.
  • Before the original change, each i64 variant reproduced device removal in standalone GPU tests, and full fuzz seed 1599 failed at PSO creation. On the earlier pre-rebase head, all four standalone cases and seed 1599 passed with zero mismatching GPU results. Those baseline comparisons were not repeated on this new main commit.
  • cargo build --locked --workspace -j 2, cargo build --locked --release -p xcl -j 2, and git diff --check origin/main...HEAD: passed.
  • cargo test --locked --workspace --no-fail-fast -j 2 -- --test-threads=4 --show-output completed with 998 passed, 156 failed, 46 ignored across the completed binaries. All 156 named failures were gpu:: tests after the RX 6800M device was suspended (0x887A0005). Nine explicit SKIPPED messages included no GPU/device, unavailable D3D12 debug layer, no reserved cube with mips, and no heap windows. I did not run an equivalent full-suite baseline on this new main commit, so the failures are reported without attributing them to this PR.
  • A locally owned title completed paired 7-second scripts/smoke.ps1 runs on the RX 6800M. Each revision showed one frame, with no crash or device removal. Peak process commit was 6,911 MB on main and 7,063 MB on the PR.

Regression run

main:

xcl-smoke v1
commit: cbc296ab65a2661a61e3e2da109134bcd5319f60
gpu: AMD Radeon RX 6800M
title: 2ef5fd64
seconds: 7
exit: 0x0
frames shown: 1 (PresentX 1)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 6911 MB

PR head:

xcl-smoke v1
commit: f90626676934293a7c3c35cccd77c06299bce32d
gpu: AMD Radeon RX 6800M
title: 2ef5fd64
seconds: 7
exit: 0x0
frames shown: 1 (PresentX 1)
presents per 2 s (last 3): 0 0 1
device removals: 0
crashes: 0
peak commit: 7063 MB

Not tested

  • The short title runs logged zero draws and used default HLSL/DXC routing, so they do not exercise the changed direct-DXIL i64 lowering. The focused GPU tests cover that path.
  • Other adapters and drivers, longer title sessions, a full-suite comparison on this new main commit, and a combined post-rebase run with the separate Direct DXIL: sign-extend i1 to i64 through i32 #1974 sign-extension fix.

AI use

OpenAI Codex (GPT-6, exact variant not exposed in this session) isolated and implemented the fix, rebased it, ran the tests and smoke comparisons, reviewed the logs, and drafted this description.

@upipibi

upipibi commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Checked on an RTX 3070 (Ampere, driver 616.56, Windows 11, debug build):

  • At b527347, dxil::/bvh:: units pass (121 passed). The gpu_ tests pass with XCL_DIRECT_DXIL=0 and 1 (110 passed each, same as main).
  • For the separate 64-bit arithmetic-shift mismatch you hit at fuzz seed 540: FUZZ_SEED=540 cargo test -p xcl --lib -- debug_seed --ignored on main 80f4819 reports GPU run: 0 mismatching results here (357 instructions, gpu_safe true). It doesn't reproduce on NVIDIA, so it looks like the RX 6800M driver rather than the translator's lowering.

This PR also bumps TRANSLATOR_VERSION 7→8, as #1950 and #1952 do. Whichever merges later needs the next number.

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!

@fallow64

Copy link
Copy Markdown

Confirmed on AMD RX 6750 XT, driver 32.0.21045.5002, Windows 11 build 26200, exact head f9062667.

int64_bit_ops_match_cpu: 1 passed, 0 failed, no skips.

Stacked after #1974, this also clears the seed-783 i64 IMax mismatch.

Not tested: full suite or retail title.

AI use: OpenAI Codex (GPT-5) ran and analyzed the test; I reviewed the result.

Thank you!

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

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants