Repository navigation
Conversation
A retail title's world pixel shaders (xcl-dev#505; 173 of its 362) pack their float16 interpolants: two components per dword (component c of a register in dword c / 2, the even one in the low half) and up to two signature registers per attribute, the second after the dwords the first one's components take (1 for .xy, 2 for .xyz / .xyzw). The PS reads each half with v_interp_p2_f16, SRC0 bit 8 choosing the high one. XCL refused the PS input table of such programs (records [6, reg, mask, attr, 0, reg2, packed reg, flags]: flag 8 = float16, flag 16 = byte 5 names the second register, byte 6 below byte 1 from the first pair on), so every attribute, plain ones included, fell back to "the N-th register" and the ones after a pair read their neighbour. The PS also converted the raw packed dword as a float, ignored the high bit and declared the float16 inputs nointerpolation. Now the table parses, each (dword, half) of a packed attribute maps to its element and component (f16_registers, ps_f16_slot; a record that repeats its own register pairs it with the next float16 register no other attribute names), and the PS reads that component as a float, interpolated with the attribute's own mode. Both translators (HLSL and direct DXIL). The layout was checked on the title's dumped programs: every v_interp_p2_f16 (dword, half) of 376 of 378 packed attributes in 362 PS is a declared component (2 read one past a .xy register). Not covered here: the VS / mesh side still exports the packed dwords raw (the next commit), so the GPU test feeds the PS from a PC VS that hands over each component as a float. xcl-dev#1975 / xcl-dev#1976 parsed the same records with a fixed layout - the second register always in dwords 2-3, a repeated register paired with itself - which does not match the title's programs after a .xy register; both have since dropped their float16 part in favour of this change. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The other half of the previous commit: the VS and mesh (NGG) programs that feed those pixel shaders export their float16 interpolants packed the same way - two components per dword, up to two signature registers per exp param. XCL refused the output table of such programs (records [6, reg, param, reg, 0, 1 | 3]: 1 = float16, 3 = more than one dword) and fell back to "the N-th register", so every param after a pair went to its neighbour's register; a packed param went raw into its first register alone. A mesh program never used its table at all. Now the table parses for VS and mesh programs (MsInterface::params) and a packed param is unpacked where it is exported: each half goes as a float to its own component of its own element, in the VS outputs and in the mesh record, in both translators. The table does not name the second register of a pair: the float16 registers pair up in order, so it is the next one no other param starts with (f16_registers). Checked on the title's dumped programs: the enable mask of every exp param of 383 packed params in 442 MS is exactly the predicted dwords. A mesh program with a table now takes its params' registers from it, float16 or not, as a VS already did; without one nothing changes. xcl-dev#1975 unpacked the same params with the second register always in dwords 2-3 and paired a mesh program's registers without its table; it has since dropped that part in favour of this change. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
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
Not tested: the title, Intel, release build. |
|
Independent AMD RDNA4 (native wave64) test report on exact head Tested
Regression run (60 s retail-title smoke, (Matched Not tested
AI use
|
|
Tested: current PR head merged onto current
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. |
After DCE removes unused components from a multi-dword rawBufferLoad (e.g. a 4-dword load whose y/z/w extracts were dead), narrowing the contiguous DXIL mask (15/7/3 -> 1/3/7) based on the highest live ExtractValue index (< 4, never touching loads whose residency status index 4 or whole struct escapes) reduces memory traffic and avoids trailing OOB byte reads. Also supplies early_depth: false in the cherry-picked #2513 f16 PS interface test initializer. Assisted-by: Antigravity (Gemini 4 Neon High)
After DCE removes unused components from a multi-dword rawBufferLoad (e.g. a 4-dword load whose y/z/w extracts were dead), narrowing the contiguous DXIL mask (15/7/3 -> 1/3/7) based on the highest live ExtractValue index (< 4, never touching loads whose residency status index 4 or whole struct escapes) reduces memory traffic and avoids trailing OOB byte reads. Also supplies early_depth: false in the cherry-picked xcl-dev#2513 f16 PS interface test initializer. Assisted-by: Antigravity (Gemini 4 Neon High)
|
Independent dual-PC NVIDIA full-workspace test report on clean head Tested
Not tested
AI use
|
luckyteagirl
left a comment
There was a problem hiding this comment.
gpu/recomp/mod.rs:500: ps_f16_slot falls 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 new f16_packed_attributes_interpolate_per_half fixture already requests TEXCOORD1.w and 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 VS TEXCOORD1.w from 0.0 to 0.75 (and put the direct PS pair first for a second run), leaving the expected zero unchanged. With XCL_ADAPTER=6800M, XCL_REQUIRE_GPU=1, the focused test failed in both separate runs: PC VS + HLSL PS and PC VS + direct PS each returned 0.75 for the absent component at pixel (0,0), expected 0.0 (exit 101, 1 failed/1,327 filtered each). The HLSL path indexes component 3 and direct DXIL loads that column. Could the lookup return None for 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.
A 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 (gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #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 (recomp/dxil: straddling 16-bit LDS, XCL_SHADER_LOOP_LIMIT, and safe MS barriers #1976 read the same register's.zw); mesh programs pair by their output table (recomp/dxil: CFG v_interp modes, bounded movrel/M0[7:0], and MS barrier guard #1975 guessed without it); programs without a table are left as today (recomp/dxil: CFG v_interp modes, bounded movrel/M0[7:0], and MS barrier guard #1975 paired 16-bit elements greedily in any title).7296038without conflicts. recomp/dxil: straddling 16-bit LDS, XCL_SHADER_LOOP_LIMIT, and safe MS barriers #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; Direct DXIL: convert integer PS inputs to float in v_interp_p2_* #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