Skip to content

Direct DXIL: sign-extend i1 to i64 through i32 - #1974

Draft
luckyteagirl wants to merge 1 commit into
xcl-dev:mainfrom
luckyteagirl:codex/dxil-i1-sext
Draft

luckyteagirl wants to merge 1 commit into
xcl-dev:mainfrom
luckyteagirl:codex/dxil-i1-sext

Conversation

@luckyteagirl

@luckyteagirl luckyteagirl commented Nov 25, 2026 •

Copy link
Copy Markdown

On the Radeon RX 6800M with Windows driver 30.0.13002.13003, a direct sext i1 to i64 produces 0x00000000ffffffff for a true bit. The expected value is 0xffffffffffffffff. This changes that cast to two sign extensions through i32. The direct-DXIL source hash from #1947 keys the translated cache, so the rebased change needs no manual translator-version bump. The problem was exposed by direct-DXIL fuzz seed 540 after the separate i64 min/max fix in #1946.

What is in it

  • module.rs: route only SExt from i1 to i64 through i32; leave other casts unchanged.
  • ops_tests.rs: check both 32-bit words of the result and an arithmetic shift for 32 lanes on the GPU.

Tested

  • Exact head 848ac65b9a2061c01f4fc7574ab3a156fce5abc6 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: cargo test --locked -p xcl --lib -j 2 gpu::dxil::ops_tests::i1_to_i64_sign_extension_and_shift_match_cpu -- --exact --test-threads=1 --nocapture passed, 1 passed, 0 failed, 0 ignored, no explicit skip.
  • 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 993 passed, 162 failed, 46 ignored across the completed binaries. All 162 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 these failures are reported without attributing them to this PR.
  • An earlier isolated seed-540 run on a diagnostic tree combining Direct DXIL: lower i64 min/max as compare/select #1946 and this fix had zero mismatching GPU results, versus 21 mismatches before this fix. That evidence is tied to the earlier tree, not the rebased head.
  • 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 6,984 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: 848ac65b9a2061c01f4fc7574ab3a156fce5abc6
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: 6984 MB

Not tested

  • The short title runs logged zero draws and used default HLSL/DXC routing, so they do not exercise this direct-DXIL cast. The focused GPU test covers the changed cast path.
  • Other adapters and drivers, longer title sessions, and a full-suite comparison on this new main commit.

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.

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.

1 participant