Direct DXIL: convert integer PS inputs to float in v_interp_p2_* #2102
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2112"
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-25T04:52:28Z.
What is in it
Matches the HLSL recompiler (
recomp/emit.rs) for integer pixel-shader inputs in the direct DXIL translator'sLw::interp_gfx()(crates/xcl/src/gpu/dxil/lower_gfx.rs):GfxCtx::ps_infromVec<(Sig, bool)>toVec<(Sig, u32)>to preserve each PS input's DXBCcomponent_type(matchingGfxCtx::targets).Lw::interp_gfx():v_interp_p2_f32andv_interp_p2_f16, convertsUINT(component_type == 1) viaCastOp::UIToFPandSINT(component_type == 2) viaCastOp::SIToFPtof32before bitcasting toi32(v_interp_p2_f32) or converting viaself.to_f16(v_interp_p2_f16). Previously,interp_gfxignored the input type and returned raw integer bits (asuint(i)instead ofasuint((float)i)forp2_f32, and bitcast integer bits as float beforeto_f16forp2_f16).bitcast(no int-to-float cast) forv_interp_mov_f32, preserving raw integer selector bits as in#249.gpu::dxil::lower_gfx::tests:ps_interp_p2_converts_int_inputs_and_mov_keeps_raw_bits: CPU test validating DXIL and checking disassembled IR acrossUINT(1),SINT(2), andF32(3) inputs forv_interp_p2_f32,v_interp_p2_f16(both lo and hiOP_SEL[3]), andv_interp_mov_f32.gpu_ps_interp_int_component_types_match_hlsl: GPU draw test (guarded bygraphics::tests::draw_ready()) verifying direct DXIL matches HLSL and exact expected pixel values ([5.0, -3.0, 1.0, -2.5]forp2_f32+mov_f32,[7.0, -4.0, 7.0, -4.0]forp2_f16lo + hi).Part of #1269
Tested
Environment: Windows 11 Home 26200, Intel Core i5-11400F, 32 GB RAM, NVIDIA GeForce RTX 4060 8 GB (driver 621.14, wave32), Rust 1.100.0, DXC
1.9.2609.5(01b62ad4).cargo test -j 4 -p xcl --lib gpu::dxil::lower_gfx::tests::ps_interp_p2_converts_int_inputs_and_mov_keeps_raw_bits -- --nocapture): 0 passed, 1 failed (p2_f32 uintemitted rawbitcast i32 to floatwithoutuitofp i32).cargo test --release -p xcl --lib gpu::dxil::lower_gfx::tests -- --nocapture): 2 passed, 0 failed (dxil 1.9.2609.5validation + IR checks + GPU draw parity vs HLSL).XCL_ADAPTER="Microsoft Basic Render Driver"): 2 passed, 0 failed (ps_interp_p2_converts_int_inputs_and_mov_keeps_raw_bitsran and passed;gpu_ps_interp_int_component_types_match_hlslcleanly skipped viadraw_ready()withSKIPPED ...: no GPU).cargo build --release --workspaceandcargo test --release --workspace -- --test-threads=4 --nocapture): 1,156 passed, 0 failed, 46 ignored across 21 test binaries (1100inxcllib,56across the remaining 20 binaries), with 27SKIPPEDlines on this RTX 4060:no wave64(RTX 4060 is wave32-only)per-lane form: refused(wave32 f16 arithmetic, f16 packed, f32 conversions)no d3d12SDKLayers.dll/no D3D12 debug layercannot disable the driver cache(Windows Developer Mode not enabled)no heap windowsRegression run
Paired 60 s runs via
scripts/smoke.ps1on cleanorigin/main(6987e496) and clean PR head (36e1c899):Main (
6987e496c35653f9ccc9dbdc1f1d342734306811):PR (
36e1c89959d237dc7ea753a42d6c6edaebc1471b):Not tested
no wave64skips on RTX 4060), D3D12 debug layer tests (2 skips withoutd3d12SDKLayers.dll), driver cache disable toggle (1 skip without Windows Developer Mode), and heap-window OOM fallback (1 skip withoutXCL_HEAP_WINDOWS).title: 29640639, and direct DXIL graphics mode (XCL_DIRECT_DXIL=all) on a retail title shader usingv_interp_p2_*on integer ISG1 attributes.AI use
Google Antigravity (Gemini 4 Neon) wrote the
interp_gfxfix, regression tests, and this PR description. All pre-fix/post-fix CPU and GPU tests, WARP skip checks, full release workspace tests, paired 60 s smoke runs, andscripts/pr_check.py --localvalidation were run locally on this machine.Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T05:00:14Z.
Tested
Both focused fixtures passed on STOR-WINLAB at
36e1c89959d237dc7ea753a42d6c6edaebc1471b. PR #2112 was open at that SHA before and after the run. The checkout was clean and detached both times. xcl-dev/xcl #2112p2_f32for UINT, SINT, and F32,p2_f16low and high halves for UINT and SINT plus the low half for F32, andmov_f32for UINT, SINT, and F32.p2_f32plus raw-bitmov_f32produced[5.0, -3.0, 1.0, -2.5].p2_f16with UINT in the low half and SINT in the high half produced[7.0, -4.0, 7.0, -4.0].0.Intel Arc A770 driver
32.0.101.9175, Ryzen 7 3800X, Windows 11 Enterprise Evaluation x64 build26200.9974, Rust and Cargo1.100.0(x86_64-pc-windows-msvc), DXC/DXIL1.9.2609.5. The unoptimized build used two jobs, with incremental compilation and debug info disabled.Not tested — Full workspace suite, retail-title smoke runs, other adapters, or native wave64 execution.
AI use — T3 Code / Codex (
gpt-6.2-sol) ran the checked-in fixtures and prepared this report.Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-25T05:24:41Z.
Tested:
gpu_ps_interp_int_component_types_match_hlslpasses on an AMD D3D12 driver and on an RTX 3060 (adds to the Arc A770 run above).gpu::filter: 586 passed, 2 failed, 22 ignored. The 2 failures are the AMD fuzz seeds 722 and 1599 tracked in #2115, which fail the same way onmain.Head
36e1c89applied onmain6020a33,cargo test -p xcl --lib -- gpu:: --test-threads=4withXCL_ADAPTERset to each card.Not tested: native wave64 pixel shaders (the new test does not ask for them), retail runs.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T06:02:48Z.
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 JoaoPauluu on 2026-11-25T06:12:02Z.
A run with vkd3d-proton as the host D3D12. The DXIL goes through dxil-spirv and then the NVIDIA Vulkan driver, not the native-Windows path: this PR's 2 new tests pass, none skipped.
Tested
x86_64-pc-windows-gnu.36e1c89as it is (merge base withmain6987e49), no uncommitted changes. The lib test binary runs under Wine, one test per process.gpu_ps_interp_int_component_types_match_hlsl: okps_interp_p2_converts_int_inputs_and_mov_keeps_raw_bits: okNot tested
AI use
Imported from ivall/xcl. Originally posted by throny on 2026-11-28T14:40:48Z.
merge-check claim
head:
36e1c89959Imported from ivall/xcl. Originally posted by throny on 2026-11-28T14:53:38Z.
merge-check
base:
b937fbabhead:
36e1c89959merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2142 passed, 1 failed, 48 ignored (26 SKIPPED lines). The one failure is gpu::dxil::msaa_tests::direct_msaa_loads_precede_get_dimensions, which main itself has at
b937fbab(#3093); base alone: 2140 passed, 1 failed, 48 ignored.review: no finding; all hunks read. The pixel-input helper is used in three places and all three are updated; the fallback arm only ever sees a float. The conversion matches what the HLSL path already does for integer inputs. Not verified by anyone: that console hardware converts an integer attribute this way. The test's dependencies exist on main.
performance: one integer-to-float conversion per integer pixel input, on the direct-DXIL path only (opt-in with XCL_DIRECT_DXIL); testers who use that path re-translate once.
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).
Imported from ivall/xcl. Originally posted by saintwolf on 2026-11-30T02:45:15Z.
merge-check claim
head:
36e1c89959Imported from ivall/xcl. Originally posted by relativespace2K on 2026-11-30T02:48:21Z.
merge-check
base:
53e85fb1head:
36e1c89959merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2790 passed, 6 failed, 49 ignored; failing: gpu::dxil::compact_tests::gpu_compact_form_with_micro_blocks_and_literal_table_runs_as_the_plain_form, gpu::recomp::pso::shader_cache_tests::console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk, hle::d3d12x::standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline, ram_budget::tests::windows_takes_a_working_set_maximum_and_lifts_it, and two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs (in
--test gpu_two_pass_cache_e2e, so 5 failing tests give 6 failures). The same five fail on base53e85fb1alone (2788 passed, 6 failed, 49 ignored there), so none comes from this PR; its two new tests passed, and the second one is not among the SKIPPED lines, so the draw really ran on the RX 6800 XT. 13 SKIPPED lines, all environmental: no D3D12 debug layer / d3d12SDKLayers.dll, no heap windows, no GPU_UPLOAD, per-lane f16/f32 forms refused.review: no blocking finding; one file, every hunk read. The pixel input table now carries the ISG1 component type instead of a "is float" bit, and the interpolation helpers read it back:
UINTbecomesuitofp,SINTbecomessitofp, anything else is left alone, which is exactly the split the title's signature declares.v_interp_p2_f32and bothv_interp_p2_f16halves convert before the write, whilev_interp_mov_f32keeps the raw bits — that is the right line to draw, because a mov exports the attribute unchanged and the HLSL path does the same. The first test asserts the cast appears in the disassembled DXIL IR for the two integer types and is absent forf32across f32 and f16, low and high half, which catches the conversion without needing a GPU; the second compares a full draw against the HLSL+DXC path for a UINT and a SINT attribute, so both halves are pinned. No duplicate: nothing else changesv_interp_p2_*; #2114 and #2201 are about other interpolation cases.performance: one conversion per interpolated integer component at translation time; at run time the DXC output already folds it, and float inputs take no extra instruction.
verdict: safe to merge
hardware / tool and model: AMD Radeon RX 6800 XT 16 GB (RDNA2, wave64), driver 32.0.21045.29003; Ryzen 5 5600, 32 GB RAM; Windows 10 IoT Enterprise LTSC 2024, 10.0.26100 build 26100.9974; Rust 1.100.0; DXC 1.9.2602.17; debug build. DeepSeek Harness coding agent, model DeepSeek V4.1 Flash.
Imported from ivall/xcl. Originally posted by saintwolf on 2026-11-30T02:51:06Z.
merge-check
base:
53e85fb124head:
36e1c89959merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2794 passed, 1 failed, 49 ignored; SKIPPED: 30 (22 no wave64, 3 per-lane #1426 refused, 2 no heap windows, 2 no xgameruntime.dll, 1 cannot disable the driver cache 0x887A002D); failing: hle::d3d12x::standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline (also fails on base
53e85fb1alone)review: none (read the full +185/-12 diff in crates/xcl/src/gpu/dxil/lower_gfx.rs: preserves DXBC component_type in GfxCtx::ps_in and converts UINT (1 -> UIToFP) and SINT (2 -> SIToFP) to f32 in v_interp_p2_f32 and v_interp_p2_f16 while keeping raw bitcast in v_interp_mov_f32, matching the HLSL recompiler; both ps_interp_p2_converts_int_inputs_and_mov_keeps_raw_bits and gpu_ps_interp_int_component_types_match_hlsl passed on RTX 4070 SUPER; no duplicates found; not tested: retail smoke on this machine)
performance: one int-to-float cast per integer PS input on the opt-in direct-DXIL path (XCL_DIRECT_DXIL); shader caches re-translate once for direct-DXIL users
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 4070 SUPER (32.0.16.2140), AMD Ryzen 7 7800X3D, Windows 11 Pro 26300, rustc 1.100.0, debug / Antigravity (Gemini 4 Hydrogen)
Imported from ivall/xcl. Originally posted by saintwolf on 2026-11-30T02:51:27Z.
@relativespace2K Please stop claiming PRs which have already been claimed!!! You're wasting yours and other people's tokens