Commit Graph

5 Commits

Author SHA1 Message Date
0ea717560a Declare only descriptor broadcast subgroup capability 2026-11-23 00:45:21 +05:30
0e5e539c42 Work around Mesa ANV descriptor index compiler crash 2026-11-22 23:52:48 +05:30
2782aa7a6a perf(translator): defer descriptor index load to hit block in desc_probe
In `desc_probe` (`%desc_lookup_fn`), the bindless index word at `base + 9`
was loaded from the `%desc_map` storage buffer before the conditional branch
`OpBranchConditional %match %dl_hit %dl_next`.

On every non-matching slot probed as well as on 8-probe misses, this issued
an unnecessary global storage buffer load that was immediately discarded.
Moving the index load into `%dl_hit` eliminates up to 8 storage buffer reads
per miss and 1 read per non-matching collision slot, reducing memory traffic
and register pressure.

Mirrored the same deferred load structure in `runtime/test/vk_descriptor_bench.cpp`.
Added `test_desc_probe_defers_index_load_to_hit_block` to `tests/test_desc_cache.py`.
2026-11-22 18:00:09 +06:00
14daa27523 Tests: cover desc_cache_ok (no caching inside an instruction's own construct) 2026-11-21 18:46:15 +00:00
74e188c8a0 Translator: cache descriptor lookups per basic block
Each image instruction called %desc_lookup_fn for its T# and S#, so a shader sampling the same texture
many times in a block called it many times. The call count is what the driver's compile time follows
(ShadowRenderTiledCascades: 1550 static calls on main). desc_lookup_sgpr remembers the result per
(first SGPR, dwords) for the rest of the basic block.

- store_reg drops the entries overlapping the SGPR it writes; every write to %sgpr goes through it
  (64-bit writes are two calls), apart from the function prologue, which runs before any block.
- translate() clears the cache when a basic block starts.
- Only lookups at the top level of the block are remembered (desc_cache_ok): an id made inside an op's
  selection construct would not dominate the code after its merge.
- image_load passes its image index to image_load_typed instead of looking the T# up a second time.
- tests/test_desc_cache.py counts the calls.
2026-11-21 15:19:09 -03:00