Recompiler: float16 interpolants packed two per dword reach the PS per half #2513
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!2513
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2513"
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?
@MacieGx on GitHub · 2026-11-25 21:14 UTC · original
MacieGx:recomp/f16-packed-interpolants→main· +494 −47 · 10 files · 2 commits · openA retail title (#505) packs its float16 interpolants: two components per dword and up to two signature registers per
exp param/v_interp attrN. XCL refused the FSSM tables of such programs (PS input table, VS / mesh output table), fell back to "the N-th register", and so every attribute after a pair read its neighbour's register, plain ones included; a packed dword went raw into one register, and the PS converted it as one float. This PR reads the packing from the tables and unpacks it on both sides, in both translators (HLSL and direct DXIL).Part of #505.
The console layout, as this PR reads it:
v_interp_p2_f16(SRC0 bit 8 = the high half);.xyregister, dwords 2-3 after.xyz/.xyzw;[6, reg, mask, attr, 0, reg2, packed reg, flags]: flag 8 = float16, flag 16 = byte 5 names the second register; a record that repeats its own register pairs with the next float16 register no other record names;[6, reg, param, reg, 0, 1 | 3](1 = float16, 3 = more than one dword): the table does not name the second register, so it is the next float16 register that starts no param of its own.Evidence, from the programs dumped from a run of the title (no game data in this PR): the
exp paramenable masks of all 383 packed params in 442 mesh shaders are exactly the predicted dwords; everyv_interp_p2_f16(dword, half) of 376 of the 378 packed PS attribute reads in 362 pixel shaders is a declared component (the other 2 read one half past a.xyregister). Programs without a table, and tables without float16 records, are translated as before, except that a mesh program with a table now takes its params' registers from it, as a VS already did.What is in it
Recompiler: a PS reads float16 attributes packed two per dword per half: the PS input table parses the float16 / pair flags and each (dword, half) maps to its element and component (f16_registers,ps_attribute_f16,ps_f16_slotincrates/xcl/src/gpu/recomp/mod.rs); the PS reads that component as a float with the attribute's own interpolation mode (recomp/emit.rs,dxil/lower_gfx.rs). Tests:attribute_tests::f16_packed_attributes(recomp/mod.rs),dxil::core_tests::f16_packed_attributes_interpolate_per_half(dxil/core_tests.rs).Recompiler: VS / mesh exports unpack float16 params packed two per dword: the VS / MS output table parses float16 params (OutParam,MsInterface::params,out_param_registers,out_param_elementsinrecomp/mod.rs); VS and mesh exports write each half as a float to its own component (recomp/emit.rs,dxil/lower_gfx.rs,dxil/lower_mem.rs,dxil/lower.rs,dxil/kernel.rs); the newMsInterfacefield inhle/d3d12x/real.rsandrecomp/heap_window_tests.rs. Tests:attribute_tests::f16_packed_params,recomp::tests::gpu_mesh_f16_packed_params(recomp/tests.rs), and the VS side off16_packed_attributes_interpolate_per_half.494 lines added, 47 removed, about 300 of the added lines tests. The two commits are one feature (the PS side alone still reads raw packed dwords from the VS / MS), split by side so each builds and passes on its own.
Tested
cargo build --release --workspaceat each commit: OK.cargo test --release -p xcl --lib -- --test-threads=4 gpu::: 698 passed, 4 failed, 22 ignored (the 4 arefuzz_validate_and_gpu_0..3, below); its two new tests pass.cargo test --release -p xcl --lib f16_packed: 4 passed, 0 failed;gpu_mesh_f16_packed_paramsran on the GPU, not skipped).cargo test --release --workspace --no-fail-fast -- --test-threads=4: 1423 passed, 4 failed, 46 ignored. The 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3(CreateComputePipelineStateE_OUTOFMEMORY); they fail the same way onmain6d12f58on this machine, and alone.no wave64on this adapter:dispatch_chain_native_wave64_builds_whole,lower::tests::{a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu},lower_dxil::tests::{a_per_lane_2d_or_3d_group_runs_on_the_gpu, const_and_null_mask_operands_agree_with_hlsl_on_the_gpu, f64_programs_on_the_gpu, integer_programs_on_the_gpu, mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu},gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware;f16_programs_on_the_gpu/f32_programs_on_the_gpu: their wave64 cases (no wave64) and three wave32 per-lane cases refused (#1426 semantics);heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows;pso_measurement_compiles_an_exact_synthetic_record: cannot disable the driver cache (needs Developer Mode).Relation to #1975 / #1976
.xyregister); a PS record that repeats its register pairs with the next unnamed float16 register (#1976 read the same register's.zw); mesh programs pair by their output table (#1975 guessed without it); programs without a table are left as today (#1975 paired 16-bit elements greedily in any title).7296038without conflicts. #1976's head2e7debdconflicts indxil/kernel.rs/dxil/lower.rs(neighbouring lines of the mesh setup), and its testdirect_dxil_mixed_fp16_interp_preserves_half_across_ssa_phibuilds aPsAttrwithout the fields added here; #2112 conflicts indxil/lower_gfx.rs. Whichever lands second needs a small rebase.Regression run
this PR:
Not tested
HANDOFF.md's description of the FSSM records (PS0, 0, register, 1 flat / 2 interpolated; VSkind, register, param) does not cover the float16 flags read here; not edited.AI use
main, split it into the two commits, ran the tests and wrote this description.🤖 Generated with Claude Code
@DavidM1911 on GitHub · 2026-11-25 21:32 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!
@DarkPanda69 on GitHub · 2026-11-25 21:36 UTC · original
AMD wave64 and debug-build run (both listed as untested), plus an RTX 3060: all 4 new tests pass on both cards, with and without the direct translator, and nothing else changes.
Head
3bc8758applied onmain6d12f58, debug build, Windows 11 Pro 26200, card chosen withXCL_ADAPTER,cargo test -p xcl --lib -- gpu:: --test-threads=4onmainand with the PR:gpu_mesh_f16_packed_paramsok; it translates withwave64: trueand no split, so on this card it runs native wave64. 702 passed, 2 failed, 6 SKIPPED (the same asmain). The 2 failures are the AMD fuzz seeds tracked in #2115, the same onmain.gpu_mesh_f16_packed_paramsok; 704 passed, 0 failed, 24 SKIPPED (the same asmain).XCL_DIRECT_DXIL=1, the only result changes againstmain, on both cards, are the newf16_packed_attributes_interpolate_per_half,f16_packed_attributes,f16_packed_paramsandgpu_mesh_f16_packed_params, all ok. No existing test changes.Not tested: the title, Intel, release build.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@emirduran707 on GitHub · 2026-11-25 21:56 UTC · original
Independent AMD RDNA4 (native wave64) test report on exact head
3bc875816e45550c3aaa6d44da3b3922b82d18e3(clean detached checkout, no local changes).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17; tests debug, smoke release.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1425 passed, 2 failed, 46 ignored; 8 SKIPPED (6 inlower_dxil::tests::{f16,f32}_programs_on_the_gpurefused by per-lane form;heap_window_out_of_memory_falls_back_to_the_switch_form;pso_measurement_compiles_an_exact_synthetic_record). All native wave64 GPU tests ran and passed.gpu::dxil::core_tests::f16_packed_attributes_interpolate_per_half.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1seed 722 andfuzz_validate_and_gpu_3seed 1599) are pre-existing on unmodifiedmainon this GPU.Regression run (60 s retail-title smoke,
XCL_NETWORK=0, release)(Matched
main68a284abaseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)Not tested
AI use
@SlopTart on GitHub · 2026-11-25 22:33 UTC · original
Tested: current PR head merged onto current
origin/main(clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo targetx86_64-pc-windows-gnurun under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).gpu_suite (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.Targeted run of the packed-f16 interpolant tests (
f16_packedfamily): 4 passed.Not tested: retail titles (no title data on this lane, counts only).
AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
@itsSio on GitHub · 2026-11-26 04:22 UTC · original
Independent dual-PC NVIDIA full-workspace test report on clean head
3bc875816e45550c3aaa6d44da3b3922b82d18e3.Tested
32.0.16.1088), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11 Pro build 26200,rustc 1.97.0(stable-x86_64-pc-windows-msvc), DXC1.9.2609.5, debug build (XCL_ADAPTER=NVIDIA)cargo build --workspace: exit 0cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1427 passed, 0 failed, 46 ignored (dxil::core_tests::f16_packed_attributes_interpolate_per_half,recomp::attribute_tests::f16_packed_attributes,recomp::attribute_tests::f16_packed_params, and GPUrecomp::tests::gpu_mesh_f16_packed_paramsall pass)SKIPPED: 26 (wave64-only GPU tests,#1426wave32 f16/cvt refusals,heap_window_out_of_memory_falls_back_to_the_switch_form,pso_measurement_compiles_an_exact_synthetic_record)32.0.16.1088), AMD Ryzen 5 5600X, 16 GB RAM, Windows 11 Pro build 26200,rustc 1.99.1(stable-x86_64-pc-windows-msvc), Windows SDK 10.0.26100 DXC1.8.2502.11, debug build (XCL_ADAPTER=NVIDIA)cargo build --workspace: exit 0cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1427 passed, 0 failed, 46 ignored (all 4 f16 attribute/GPU tests pass)SKIPPED: 29 (same 26 as Machine 1 plus 3 requiringd3d12SDKLayers.dll)Not tested
scripts/smoke.ps1runs--release)AI use
Ran via Samaritan:
@luckyteagirl on GitHub · 2026-11-26 07:27 UTC · original · reviewed
gpu/recomp/mod.rs:500:ps_f16_slotfalls back to any element at the register when its mask excludes the requested half. That makes an absent packed component read the PC producer's value instead of zero. The newf16_packed_attributes_interpolate_per_halffixture already requestsTEXCOORD1.wand expects zero, but its PC VS writes zero there, so it cannot distinguish the paths.On the exact head
3bc875816e45550c3aaa6d44da3b3922b82d18e3, I changed only that fixture's PC VSTEXCOORD1.wfrom0.0to0.75(and put the direct PS pair first for a second run), leaving the expected zero unchanged. WithXCL_ADAPTER=6800M,XCL_REQUIRE_GPU=1, the focused test failed in both separate runs:PC VS + HLSL PSandPC VS + direct PSeach returned0.75for the absent component at pixel (0,0), expected0.0(exit 101, 1 failed/1,327 filtered each). The HLSL path indexes component 3 and direct DXIL loads that column. Could the lookup returnNonefor an undeclared half and retain the strengthened fixture so both translators take their zero path?This is a focused modified-fixture GPU result, not a retail-title run or full-suite result. AI-assisted review with Codex.
@MacieGx on GitHub · 2026-11-26 12:18 UTC · original
@raylitebull since you deferred the float16 part of #1975 to this PR: its
CIrun (and those of #1385, #2229, #2246, #2753 from the same fork) is waiting for workflow approval (action_required), so the requiredBuild and testcheck never ran. Could you approve the runs when you have a moment? Details in #1833.AI use: Claude Code (Claude Opus 5.5).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.