Files
metal2vulkan/crates
Anees Iqbal 617ebd26d6 RUNTIME 2391: the rate map's route-counts kernel is made ahead on the pool, never on the encoding thread
The encoder's end built the route-counts kernel inline (owned_kernel): a VkPipeline made on the
encoding thread behind a program turn of the pipeline budget, which can wait behind the pool's
makings. On the PHOENIX (RADV, release, probe m3-max-33749) end_encoding took 0.83 to 0.90 ms with
the kernel built there, against 0.22 to 0.27 ms with it made before.

A pass's first draw the GPU routes now begins the kernel on the device's pool, once per device
(Device::begin_route_counts_kernel, holder RouteCountsKernel). The encoder takes it as it ends
only where it is made, without waiting (Device::route_counts_kernel, a try_lock). An instance
whose kernel is not made by then runs no steps: its draws' counts keep what the CPU wrote
(fan-out 0, region-copy MAX_SEGMENTS), so each draws its region-copy route, as a draw whose other
routes did not record does. rate_map_gpu_routed_draws now counts an instance's marked draws as its
steps are planned, so routed equals fanned plus copied whether or not the steps ran. The device
tests' hold array takes its length from the last holder (it had three places, so the kernel's
pool piece indexed past it under the GPU cfgs).

Test: rate_mapped_route_kernel holds the pool while a frame's routed draws begin the kernel and
asserts the encoder made no kernel, routed none, drew every draw by its region-copy route (2897
red, 16 region-copy draws), and that once the kernel is made the same draws are fanned out over
the same pixels ([16, 16, 0]).

Verified at 7ed2805004: m3-max-33791 clippy (runtime, all targets, all features), runtime unit
tests 79/79, lavapipe rate_map device tests 25/25 (depth_equal 0 red in every leg), and the
negative control (the kernel made inline again: the new test fails, 1 kernel made in the held
frame); m3-max-33818 clippy under m2v_cpu_icd and m2v_gpu. PHOENIX (m3-max-33813, release, two
runs): cold end_encoding 204 / 182 us (166 / 158 us with the kernel made before; 826-896 us
before this change), the kernel made on the pool in the cold frame (0.30 ms, off the encoding
thread), the second frame routing 64/64; cold through commit 6.0 / 5.8 ms against 5.8 / 5.2 ms
premade.
2026-11-15 15:04:06 -08:00
..