startup: translate VOP3 NEG on an inline-integer or literal float source (follow-up to #2529) #2555
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2563"
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 R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-25T21:08:28Z.
Follow-up to #2529 (claim). Part of #1723.
#2529 refuses NEG on an inline-integer (0..64) or literal source of any VOP3 instruction, because the printed text loses the distinction. This translates it for float-typed source slots instead:
VEC_F:v_fma_f32,v_mul_f32,v_med3_f32,v_add_f32, ...) and ofv_cmp(x)_*_f32. For the class compares, only src0; the mask slot is excluded.neginto an immediate (AMDGPUAsmParser::applyInputFPModifiers); the RDNA 2 ISA lists VOP3 NEG as a float input modifier. Inline 1 gives0x80000001, literal0x5gives0x80000005, inline 0 gives0x80000000. The word is read from the encoding, as #2529's check does, not from the printed text, and emitted as an exact bit pattern throughF(). RDNA hardware behaviour of NEG on these immediate sources is not measured; the WARP and NVIDIA readback only checks the HLSL against this model.v_cndmask_b32_e64keeps its own handling.Tests (Windows 11, Python 3.14, DXC from the Windows SDK 10.0.26100), on main
9bef64eplus this commit:python -B tests/startup_gfx2hlsl_neg_check.py(new): ok. The emitted word forv_fma_f32,v_mul_f32andv_med3_f32with NEG on inline 0, inline 1, inline 64 and a literal.... dispatch <dxc> <offscreen_check> warpandhardware: ok, on WARP (Microsoft Basic Render Driver) and an NVIDIA GeForce RTX 5080. Each form is compared with a CPU reference built from the encoded words. The twov_mul_f32results that are subnormal may flush to signed zero; the others are compared bit-exactly, including-0.0for inline 0.tests/startup_gfx2hlsl_refusals_check.py: ok. Float slots now translate; integer slots, the class mask slot and NEG with ABS still refuse.startup_gfx2hlsl_bit_alu_check,startup_gfx2hlsl_mad_check,startup_gfx2hlsl_operand_count_check,startup_gfx2hlsl_handler_arity_check,startup_translator_check,startup_gfx2hlsl_f32_nan_check,startup_gfx2hlsl_f32_lg_check,startup_gfx2hlsl_cvt_alu_check,startup_gfx2hlsl_compute_checkandstartup_gfx2hlsl_int_med3_check.Mutation checks, run by hand. Each one fails at least one of the checks above:
Measured on a local capture (counts only, inputs private; requests re-keyed with
shader_cache_rekey.pyfor the current revision): at main9bef64e, 176 pipelines translate (85 graphics, 91 compute), and the #2529 refusal was the first refusal for about 1,400 requests. With this change none stop there, and 179 translate (87 graphics, 92 compute). The rest now stop at refusals that were already there behind it:src_sccins_mov_b32(818), anexeczVCC definition (341),v_readfirstlane_b32proofs (284) and|vN|onv_cndmask_b32_e64(217).AI-assisted.