Direct DXIL: reject image_gather4h/8h instead of translating as 2x2 Gather #2050
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2060"
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?
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-25T02:22:45Z.
Brings direct DXIL
Lw::mimg(crates/xcl/src/gpu/dxil/lower_image.rs) into parity with merged PR #437 (recomp/emit.rs) by rejectingIMAGE_GATHER4H,IMAGE_GATHER4H_PCK, andIMAGE_GATHER8H_PCKwithimage_gather4hinstead of silently miscompiling them as 2x2dx.op.textureGatheror falling through to non-sampling MIMG. Part of #1269.image_gather4h,image_gather4h_pck, andimage_gather8h_pckfetch a horizontal row of texels rather than a 2x2Gatherfootprint. Previously,Lw::mimgmatchedbase.starts_with("gather4"), causingIMAGE_GATHER4HandIMAGE_GATHER4H_PCKto emit 2x2dx.op.textureGathercalls (whileIMAGE_GATHER8H_PCKfell through to non-sampling MIMG).What is in it
crates/xcl/src/gpu/dxil/lower_image.rs:base.starts_with("gather4h") || base.starts_with("gather8h")at the top ofLw::mimgwitherr(d, "image_gather4h"), matchingrecomp/emit.rs(#437).direct_image_gather4h_and_8h_are_rejectedverifying all three instructions are rejected withimage_gather4hacross wave32 compute, wave64 compute, and pixel shaders, while standardIMAGE_GATHER4still translates and passes DXIL validation.Tested
0ef1bc386), DXC 1.9.2609.5 (01b62ad4), release build.direct_image_gather4h_and_8h_are_rejectedfails before the fix (IMAGE_GATHER4H wave64=false must be rejected: silently translated to DXBC).cargo test --release -p xcl --lib gpu::dxil::lower_image::heap_bounds_tests -- --nocapture: 3 passed, 0 failed, 0 ignored.cargo test --release -p xcl --lib image_gather4h_is_unsupported -- --nocapture: 1 passed, 0 failed, 0 ignored.cargo build --release --workspace+cargo test --release --workspace -- --test-threads=4: 1147 passed, 0 failed, 46 ignored across 20 test binaries.SKIPPEDGPU/runtime tests on this adapter (25 lines):no wave64subcases acrossgpu::recomp::lower::tests(4),gpu::recomp::lower_dxil::tests(14), andgpu::recomp::tests(2)#1426refusals (V_MUL_F16,V_PK_MUL_F16,V_CVT_F16_F32) ingpu::recomp::lower_dxil::testsshaders::tests::pso_measurement_compiles_an_exact_synthetic_record: cannot disable the driver cache (Windows Developer Mode is required)heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windowsRegression run
scripts/smoke.ps1onmain(5ce558f82a48c51d527f6035234dacbd29db3f05) and on this PR's head commit (1933324629a73931a2a52dbf4fff5bf3472a1412):Not tested
image_gather4h/image_gather8hhorizontal row fetches (this PR rejects them in direct DXIL for parity with HLSL#437).--release).AI use
Lw::mimgagainst HLSL#437, implemented the rejection check, unit test, and PR description; all tests and paired 60s smoke runs were executed and verified locally on RTX 4060 hardware.Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T02:43:35Z.
PR #2060 ordinary compatibility verification
Verified the open head
1933324629a73931a2a52dbf4fff5bf3472a1412before and after testing. The assigned detached checkout was clean. GitHub showed zero conversation comments, submitted reviews, and inline review threads. PR #2060Tested
Windows 11 Enterprise Evaluation 26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 with driver 32.0.101.9175, Rust 1.100.0 (
0ef1bc386,x86_64-pc-windows-msvc), DXC and DXIL 1.9.2609.5. These tests execute on the CPU.The unoptimized Cargo test profile used two build jobs,
CARGO_INCREMENTAL=0,CARGO_PROFILE_DEV_DEBUG=0, andCARGO_PROFILE_TEST_DEBUG=0. The run setCARGO_TARGET_DIR=L:/XclTooling/pr1844-71f2ceb-t3-737e5ee5/target,TEMP=TMP=L:/XclTooling/pr2060,XCL_ADAPTER=A770, andXCL_DXC_DIR=%LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64for the test process.IMAGE_GATHER4H,IMAGE_GATHER4H_PCK, andIMAGE_GATHER8H_PCKacross wave32 compute, wave64 compute, and pixel translation. Each error containedimage_gather4h. The standardIMAGE_GATHER4control translated and passed the DXC validator. The log confirmed DXC and DXIL 1.9.2609.5 and recorded zero validation skips.<lowercase opcode>: image_gather4hdiagnostic keys.prebuild.log,direct.log, andhlsl.logalongside this report.Not tested
GPU execution, retail title smoke testing, the full workspace suite, and the pre-fix revision.
AI use
T3 Code / Codex (gpt-6.2-sol) verified the PR head, ran the two CPU tests, and wrote this report.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T04:55:10Z.
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!
Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-25T14:49:25Z.
amd-win test report for head
1933324629a73931a2a52dbf4fff5bf3472a1412Setup
main06c9f5505f63f10c5ec49ef932d75b2c28177324(merge commitdb1626790d66bce3423abe19951332eea4beaecc; it merged without conflicts). That is not the PR head itself, so the smoke block below names the merge commit.Tests
cargo build --workspacethencargo test --workspace --no-fail-fast -- --test-threads=4: 1265 passed, 1 failed, 46 ignored, 7SKIPPEDlines (f16/f32 per-lane form, no heap windows)gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(seed 722:res[30]GPU 0x1 vs CPU 0x7fffffff). It fails the same way onmain(1264 passed, 1 failed, 46 ignored), so it is not caused by this PR.gpu::dxil::lower_image::heap_bounds_tests::direct_image_gather4h_and_8h_are_rejectedpasses.Regression run (60 s, same title, networking off;
mainfirst, then the merge)Exit code 0x0 on both. The full
xcl-smokeblocks are not pasted because of the merge-commit caveat above.Not tested
image_gather4h/8h, so the smoke run only shows no regression on the code paths it does reach.AI use: this run and report were done by Claude Code (Claude Sonnet 5.5).
Imported from ivall/xcl. Originally posted by upipibi on 2026-11-25T17:26:26Z.
NVIDIA test report for
1933324(head as is, base5ce558f), for #1607's NVIDIA list. RTX 3070 8 GB (Ampere, 32-lane waves), driver 616.56, Windows 11, debug, aftercargo build --workspace:cargo test --workspace --no-fail-fast -- --test-threads=4 --skip hle::xaudio2: 1138 passed, 0 failed, 46 ignored. The end-to-end title tests pass.main0829441on the same machine, same command: 1263 passed, 0 failed, 46 ignored (the PR's base is older, so it has fewer tests).hle::xaudio2, because its tests fail or hang on this machine onmaintoo. The PR doesn't touch it.no wave64on this card, 3 f16/f32 forms the per-lane path refuses, 1 no heap windows, and 1 PSO measurement that needs Developer Mode to turn the driver cache off.AI-assisted (Claude Code, Claude Opus 5.5). Synthetic tests only; no title run.
Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-27T18:36:15Z.
merge-check
base:
6089122a1chead:
1933324629merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1462 passed, 4 failed, 47 ignored; failing:
gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0to_3(CreateComputePipelineStateE_OUTOFMEMORY). They fail the same way on this machine without this PR (five suite runs today on branches based onmainf9a0cb80) and pass with #1919 merged, so they are not this PR's. The newdirect_image_gather4h_and_8h_are_rejectedpasses. 25SKIPPEDlines (no wave64, no heap windows, three recompiler forms refused as unsupported).review: no blocking finding; whole diff read (
gpu/dxil/lower_image.rs, +30/-0). One thing whoever merges should know: this is a rejection with no working fallback. The HLSL path already refuses the same instructions (recomp/emit.rs, tested byimage_gather4h_is_unsupported), so a shader withimage_gather4h,image_gather4h_pckorimage_gather8h_pckgoes from a direct-DXIL translation that reads the wrong texels (a 2x2 Gather) to unsupported on both paths. That matches the description and the HLSL behaviour; I did not check what a title shows when such a pipeline is missing, or whether any title uses these instructions. The check runs before thegather4prefix handling, sogather4,gather4_cand the rest are not affected (the test's control case covers plainimage_gather4). The control callsvalidate::validatewithout thevalidator_supported()guard other tests use, so it may fail on a host without the DXIL validator; it passes here.build.rshashesgpu/dxil, so cached translations made with the old behaviour are not reused.performance: reasoned, not measured. Two prefix checks per image instruction at translation time; no frame time or memory. A shader that uses these instructions no longer builds on the direct path. I did not run a title on the merge result.
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (driver 617.42, 32-lane waves), Ryzen 7 9800X3D, 32 GB RAM, Windows 11 Pro 26300, rustc 1.100.0, debug. Claude Code with Claude Fable 5.2 ran the merge, build and suite on my machine and wrote this; a Claude Opus 5.5 subagent reviewed the diff and Fable read it in full as well.
Imported from ivall/xcl. Originally posted by throny on 2026-11-27T20:01:16Z.
merge-check claim
head:
1933324629Imported from ivall/xcl. Originally posted by throny on 2026-11-27T20:17:14Z.
merge-check
base:
6089122ahead:
1933324629merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1466 passed, 0 failed, 47 ignored (26 SKIPPED lines); base alone: 1465 passed, 0 failed, 47 ignored
review: none blocking. The check sits before the gather4 prefix parsing, so the other gather forms are unaffected; it matches the rejection the HLSL path already has. The test fails without the change. Note from the thread: a shader using these instructions goes from wrong texels to unsupported, with no fallback.
performance: it changes a translator source: a one-time re-translate for every tester; no runtime cost (reasoned).
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).