upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/vulkan_aftermath.cpp
diff options
context:
space:
mode:
authorbobcatchris <83428450+bobcatchris@users.noreply.github.com>2026-11-30 08:21:36 -0600
committerbobcatchris <83428450+bobcatchris@users.noreply.github.com>2026-11-30 08:21:36 -0600
commit88d0dbf9c13aa0bd9f796f4813152030fc42a280 (patch)
tree92d9a6105a8b7a0a44ec3d8cfa17f8e28fab7410 /runtime/src/vulkan_aftermath.cpp
parentf44904d21cb64c7c2121905f49ff50f6cd2b132d (diff)
leonida-shader: index what uses each descriptor load instead of scanning all descriptors (D3D12-SHADER-LOWER-LOAD-USES)
`Lower::descriptor_data` (a scalar load of a descriptor that the code also reads as numbers) asked what uses the load by walking every resource descriptor of the program and building the `Vec` of each one's leaves with `Source::leaves`, once for the load and again for every other load of the same address (`twin`); `descriptor_data` and `unused_descriptor_kind` did the same over the samplers' descriptors to leave a sampler's load alone. In the eleven pixel programs that take longest to lower (some 800 descriptors each) nine tenths of the samples of the translating thread were in those walks and the allocations they made. `Lower::load_uses` builds, on the first call, a map from each load to the descriptors that take it as a leaf of their source (the first leaf of each descriptor that is the load, in the descriptors' order, as the scan found it) and `Lower::is_sampler_load` the set of loads a sampler's source is. `Source::for_each_leaf` visits the leaves in the order `leaves` lists them without building the vector. - the_index_of_load_uses_answers_as_the_scan_did keeps the scans as they were and compares them with the indexes for every instruction site of four of the waterfall programs of `resource::tests` and for made-up descriptors of every kind of source (a load two leaves of one descriptor name, one two descriptors name, a sampler's load, leaves that are no load's dwords). With the one-per-descriptor check left out it fails. - each_leaf_of_a_source_is_those_leaves_lists_in_order compares `for_each_leaf` with `leaves` on a source nesting every kind. Output unchanged: `leonida translate` over the whole archive, the DXIL of all 25,689 emitted programs (15,799 distinct) hashes the same as before in every run of both builds. Full archive, Ryzen 7 7800X3D (16 threads), --release, alternating, system heap: 64.1/63.7/64.3 s wall and 884/884/ 886 CPU-seconds -> 54.2/53.7/53.5 s and 735/734/732; with mimalloc (the game's build): 44.9/44.8 s and 628/629 -> 43.1/42.5 s and 596/596. The eleven pixel programs alone: 7.5/7.3 CPU-seconds -> 1.4/1.2. AI-assisted: Claude Sonnet 5.5 Co-authored-by: Cursor <cursoragent@cursor.com>
Diffstat (limited to 'runtime/src/vulkan_aftermath.cpp')
0 files changed, 0 insertions, 0 deletions