Direct DXIL: sign-extend i1 to i64 through i32 #1974
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1974
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1974/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@luckyteagirl on GitHub · 2026-11-25 00:12 UTC · original
luckyteagirl:codex/dxil-i1-sext→main· +74 −0 · 2 files · 2 commits · merged 2026-11-25 18:15 UTCOn the Radeon RX 6800M with Windows driver
30.0.13002.13003, directsext i1toi64produces0x00000000fffffffffor a true bit; the expected result is0xffffffffffffffff. This routes that cast throughi32. A review follow-up checks existing type IDs so unrelated sign extensions do not intern unusedi1ori64types. The direct-DXIL source hash from #1947 keys the translation cache, so no manual translator-version bump is needed. The fault was exposed by direct-DXIL fuzz seed 540 after the separate i64 min/max fix in #1946.What is in it
crates/xcl/src/gpu/dxil/module.rs: sign-extend onlyi1toi64throughi32, and avoid creating type IDs merely to check the cast. The follow-up commit was supplied by @ettehn and retains their Git authorship.crates/xcl/src/gpu/dxil/module.rstests: verify unrelated casts do not intern extra integer types and the affected cast still emits two extensions.crates/xcl/src/gpu/dxil/ops_tests.rs: compare both result words and an arithmetic shift on the GPU.Tested
Exact clean head
248c1cecc27dbcfd0dbc225a8eab9915c755fccbrebased on current main426a5a745db4d5e4b037449ede0b70cb342f5192. Windows 11 build 26200, Ryzen 9 5980HX, Radeon RX 6800M driver30.0.13002.13003, Rust 1.99.0 MSVC, DXC/DXIL 1.9.2609.5.XCL_ADAPTER=6800M,XCL_REQUIRE_GPU=wave64,XCL_DIRECT_DXIL=1:cargo test --locked -p xcl --lib -j 2 sign_extension -- --test-threads=1 --show-output3 passed, 0 failed, 0 ignored, no SKIPPED lines. This includes the GPU fixture.cargo build --locked --workspace -j 2,cargo build --release --locked -p xcl -j 2, andgit diff --check upstream/main...HEADpassed. Cargo targets were separate for main and the PR.Paired
cargo test --locked --workspace --no-fail-fast -- --test-threads=4on the same RX 6800M:XCL_DIRECT_DXIL=0XCL_DIRECT_DXIL=1All existing failure names are identical on base and PR. The only added failure name is the new GPU fixture when run in the broad suite after the RX 6800M device was suspended (
CreateComputePipelineState,0x887A0005); that fixture passes in isolation. The broad suite is not green on this driver.An earlier isolated seed-540 diagnostic combining #1946 and this fix had zero mismatching GPU results, versus 21 mismatches before the fix. That evidence belongs to the earlier tree, not this head.
Regression run
Same locally owned title, release builds, fresh separate XCL data and DXIL caches, networking off, 12 seconds each. Neither run hit the external memory guard.
Main:
PR head:
Not tested
AI use
OpenAI Codex (GPT-6; exact variant not exposed) implemented the original fix, reviewed and cherry-picked @ettehn's authored follow-up, rebased the branch, ran the paired checks and smoke comparison, and drafted this description.
@DavidM1911 on GitHub · 2026-11-25 03:19 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!
@fallow64 on GitHub · 2026-11-25 04:03 UTC · original
Confirmed on AMD RX 6750 XT, driver
32.0.21045.5002, Windows 11 build 26200, exact head848ac65b.i1_to_i64_sign_extension_and_shift_match_cpu: 1 passed, 0 failed, no skips.Base
cbc296areproducibly fails fuzz seed 540 (7, expected6); this PR clears seed 540.Not tested: full suite or retail title.
AI use: OpenAI Codex (GPT-5) ran and analyzed the test; I reviewed the result.
Thank you!
@ettehn on GitHub · 2026-11-25 09:29 UTC · original · edited 2026-11-25 09:32 UTC
Two narrow Windows checks on
848ac65b.Module::castcurrently calls the type-creatingi1()/i64()accessors to test the signature. A module-only regression confirmed that an unrelatedsext i32 → i64interns an unusedi1;sext i1 → i16has the analogous issue withi64. Checking the already-interned type IDs/width instead passed both checks, while the affected cast still emitted the two-step sequence.trunc i32 → i1andzext i1 → i32returned[0, 1, 1, 1]for[0, 1, 2, 0x80000000];and i32 ..., 1before truncation gave the expected[0, 1, 0, 0]. There is nosextanywhere in that second module. This is a separate WARP observation; the AMD hardware results above address the original cast issue.Eight-input WARP control. The raw
trunc i32 → i1also sends nonzero even inputs down the true arm when consumed by a conditional branch. A separate(x & 1) != 0in the same validated shader returned the correct low bit for all eight inputs. There is nosextin the module. In main568e7db, I only found emission of the i1-destination truncation in the fuzz generator; the runtime lowering calls go to i32. This is evidence about the software test backend and does not require a runtime change for #1974.AI use — OpenAI Codex (GPT-6) wrote the local checks and ran them.
@alexdeliu on GitHub · 2026-11-25 10:44 UTC · original
Test report for
848ac65, on the RDNA2 GPU this fix is for plus an RDNA4 control. Applied on #2170's head2fe270d(onmain568e7db); #2170 adds seed 540's reduced shapes toamd_reduced_seeds.Tested
cargo test -p xcl --lib gpu::dxil::fuzz_tests::amd_reduced_seeds -- --ignored --nocapture:540 sext i1 -> i64,540 sext i1 -> i64 -> ashr 63 - (-7)and full seed 540 PASS with this PR. Without it they FAIL (res[64] = 0x0, CPU 0xffffffff). Full seeds 722 and 1599 pass, as without it.cargo test -p xcl --lib sext(this PR's test): 1 passed.This matches @luckyteagirl's RX 6800M result on #2170, so the cast is wrong on RDNA2 in general, not only on one part or driver.
Not tested: NVIDIA and Intel, the whole suite with this PR, a retail title.
AI use: Claude Code (Claude Opus 5.5) ran these tests and wrote this report.
@raylitebull on GitHub · 2026-11-25 10:46 UTC · original
Diff review on
848ac65looks good (TypeOf->i64viai32sign-extension incrates/xcl/src/gpu/dxil/module.rsplusi1_to_i64_sign_extension_and_shift_match_cpuinops_tests.rs), and CI is green.Two quick items before merge:
@ettehn's nit: avoid interning an unusedi1type insidetype_of(v)when checking whethervisTy(i1).i1_to_i64_sign_extension_and_shift_match_cpupasses on NVIDIA hardware on the current head.@ettehn on GitHub · 2026-11-25 10:51 UTC · original
NVIDIA confirmation for item 2 in the merge checklist. On exact, clean head
848ac65b9a2061c01f4fc7574ab3a156fce5abc6,i1_to_i64_sign_extension_and_shift_match_cpupassed on the RTX 5070 Ti Laptop GPU: 1 passed, 0 failed, 0 ignored, noSKIPPEDlines, 0.47 s for the test run. The fixture compares the four output words for all 32 lanes.Windows 11
26200.9974, NVIDIA driver621.24, DXC/DXIL1.8.2502.11, Rust1.97.1MSVC, debug.XCL_ADAPTER=0,XCL_REQUIRE_GPU=1.cargo test --offline --locked -j 2 -p xcl --lib gpu::dxil::ops_tests::i1_to_i64_sign_extension_and_shift_match_cpu -- --exact --test-threads=1 --nocaptureOnly the focused test ran on this head. AI use — OpenAI Codex (GPT-6.2 Sol) ran the test and wrote this report.
@ettehn on GitHub · 2026-11-25 11:17 UTC · original · edited 2026-11-25 11:19 UTC
For item 1 in the merge checklist, bd22b54 is a cherry-pickable follow-up on
848ac65. It checks the existing types before emitting the cast, so unrelated sign extensions do not intern extra integer types.Windows CPU-only A/B:
cargo test --locked -p xcl --lib gpu::dxil::module::tests::sign_extension -- --test-threads=1. With the same tests and848ac65’s original cast implementation, 1 passed and 1 failed (extrai1). With the follow-up, 2 passed and 0 failed or ignored, including the check thati1 → i64still emits two casts throughi32.NVIDIA follow-up on clean
bd22b54, RTX 5070 Ti Laptop GPU:cargo test --offline --locked -p xcl --lib gpu::dxil::ops_tests::i1_to_i64_sign_extension_and_shift_match_cpu -- --exact --test-threads=1 --nocapturegave 1 passed, 0 failed, 0 ignored, no skips (0.41 s). WARP skipped the same test because it lacks wave32. This run covered the focused regression only.AI use: OpenAI Codex (GPT-6.2 Sol) assisted with the follow-up and verification.
@thehollowedone on GitHub · 2026-11-25 11:45 UTC · original
Independent NVIDIA check on 248c1ce. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), Rust 1.99.1 MSVC, debug.
cargo build --offline --locked --workspacepassed.cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --nocapturereported 1,246 passed, 0 failed, 46 ignored, with 25 runtime skip notices included in Cargo's pass count.With
XCL_ADAPTER=3080 Ti,XCL_DIRECT_DXIL=1andXCL_REQUIRE_GPU=wave32:cargo test --offline --locked -p xcl --lib sign_extension -- --test-threads=1 --nocapturepassed all three tests. The two module tests verified that unrelated casts add no extra types and the affected cast emits two extensions. The GPU test matched all four output words for all 32 lanes.cargo test --offline --locked -p xcl --lib gpu::dxil::fuzz_tests::amd_reduced_seeds -- --ignored --exact --nocapture --test-threads=1passed the two reduced seed 540 shapes and the full seed with zero mismatching dwords. The seven other diagnostic cases passed too.Zero skips in both focused runs. This is NVIDIA regression coverage. AI-assisted. Codex (GPT-6, exact variant unavailable) ran the tests and drafted this report.
@jennydeth on GitHub · 2026-11-25 14:15 UTC · original
NVIDIA run on the rebased head (listed under Not tested).
Setup: RTX 3060 12 GB (32-lane waves, driver 32.0.16.2101), Ryzen 5 5600X, 32 GB RAM, Windows 11 build 26300, Rust 1.100.0, DXC 1.9.2609.5, debug build. Head
248c1ce.Result: cargo test --workspace -- --test-threads=4: 1246 passed, 0 failed, 46 ignored. SKIPPED: 18 GPU tests for no wave64 (expected on this card); the per-lane refused cases; heap windows; driver cache; 2 debug-layer tests (no d3d12SDKLayers.dll).
AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
@jennydeth on GitHub · 2026-11-25 14:22 UTC · original
NVIDIA run on the rebased head (listed under Not tested).
Setup: RTX 3060 12 GB (32-lane waves, driver 32.0.16.2101), Ryzen 5 5600X, 32 GB RAM, Windows 11 build 26300, Rust 1.100.0, DXC 1.9.2609.5, debug build. Head
248c1ce.Result: cargo test --workspace -- --test-threads=4: 1246 passed, 0 failed, 46 ignored. SKIPPED: 18 GPU tests for no wave64 (expected on this card); the per-lane refused cases; heap windows; driver cache; 2 debug-layer tests (no d3d12SDKLayers.dll).
AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
@DavidM1911 on GitHub · 2026-11-26 06:51 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin