perf(shader): bound image table keys from findLSB, induction and unsigned clamps #17863
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/17863"
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 edubox on 2026-11-09T18:42:26Z.
What
Bound image-table key enumeration when the key expression is a
findLSB/findMSBof a 32-bit mask, a bounded induction value, or an unsigned clamp.FindILsb32andFindUMsb32can only produce0..31for a valid table key; their no-bit sentinel (0xffffffff) is outside every table domain, so capping those keys at 31 keeps the same outside-snapshot behavior while avoiding the 65536-key fallback.IAdd32/Phiupper bounds andReadFirstLaneunwrapping letMatchKeyDomaindiscover scalar key domains in the same expressions.UMin32andUMax32bound the key through an unsigned clamp:UMin32(x, n)can only return at mostn, so the enumeration stops atn + 1keys even when the rest of the expression is an unbounded product or induction. This is what bounds Planet Zoo's tables, whose key ismin(i * 0xb0, 0x5fff): the key goes from the 65536-key fallback to 24576 keys.This is generic: any shader whose image-table index is a bitmask LSB, a bounded induction value or an unsigned clamp benefits, not only one title.
Tested
agc_shader_memory_tests: passed, including a newv_min_u32clamp case that enumerates exactly 65 of 128 records.agc_driver_image_table_tests: passed.agc_driver_image_table_reuse_tests: passed.tools/check_conventions.py --base origin/main: passed.tools/pr_overlap.py --branch perf/image-table-key-bounds --jobs 32: no overlap with open pull requests.[capture]plan-lookup-plus-materialize stage dropped from about 8-11 s to about 0.7-1.2 s per 10 s window; table snapshots began to be reused (hundreds per window). Warm-run steady presents rose from about 88 to about 110-200 per 10 s in the later phase. Development run, not a formal same-save A/B.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository