perf(shader): reuse packed f16 operand lanes #5811
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5811"
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 boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-14T11:55:52Z.
What
packedFloat16emits the packed f16 operand selection and lane extraction once to form a native f16x2 add/multiply. When it emits the exact NaN/overflow repair path, it recomputes the same selected low/high halves for those operands. Cache each half lazily during the translation and reuse it for the result and repair logic. This avoids duplicate IR for extraction,OP_SEL, absolute value, and negate handling. The instruction result and existing repair rules are unchanged.This is the smaller follow-up suggested in the review of closed #5057 after the guarded repair path showed no Palworld gain and grew the SPIR-V module. It makes no title-level performance claim. It depends on #4072, which changes the same packed-f16 translation function.
Tested
git diff --checkpassed.Checklist
main; no other open PR implements this reuseNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T13:39:10Z.
Checked the diff:
sourceLaneBitsonly memoizeslaneBitsper (source, half) within onepackedFloat16call. The emitted operations and bit rules are unchanged, and straight-line IR means the cached value dominates every use. Ran build + ctest for the AGC driver (including PackedFloat16Native, PackedAlu, Float16MinMaxBits, Fp16Overflow, Float16FmaRounding, Dx10Clamp); all pass. The only failure isagc_driver_tessellation, which also fails on main. The diff applies cleanly on main, so the #4072 dependency isn't needed. Merging once the full build is green.