From 9b1546d3f8ccfb7ffc8a9adb5d8666fe4702f991 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Wed, 11 Nov 2026 20:58:43 -0800 Subject: [PATCH] Pooled bound: the doc records what aliasing textures cost as shadows and as images Measured with runtime_lane::aliased_surfaces::aliased_surface_costs (release, --cfg m2v_gpu or m2v_cpu_icd), before the pooled bound's change (23c0a7e552) and after it (990cfbacb6 and 19b62892ac): - Radeon 780M (RADV PHOENIX, gem10): m3-max-18769 before, m3-max-18831 after. - Iris Xe (ANV RPL-P, ms01): m3-max-18707 before, m3-max-18726 after. - lavapipe (msi): m3-max-18608 before, m3-max-18677 after. 36 live textures over one Private surface: 28.22 / 32.80 / 119.08 ms a frame with 869 MB copied in and 290 MB back, 5211 MB of shadows, before; 0.22 / 1.40 / 1.48 ms, no copies, one shadow and 35 images at Metal's pitch, after. Four made each frame and dropped: 26.67 / 28.37 / 102.05 ms with four 145 MB shadows made a frame before; 0.18 / 0.83 / 1.28 ms with none after. The GPU was not held exclusively, so the times are a shared GPU's. --- crates/metal2vulkan-runtime/src/in_place.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/metal2vulkan-runtime/src/in_place.rs b/crates/metal2vulkan-runtime/src/in_place.rs index 2567a3db5..5b1bebd73 100644 --- a/crates/metal2vulkan-runtime/src/in_place.rs +++ b/crates/metal2vulkan-runtime/src/in_place.rs @@ -692,8 +692,14 @@ pub(crate) enum ShadowCause { /// over takes the image at any size (`texture_spans.rs`), and the first texture's shadow moves to /// its image once another texture is made over its bytes. Measured with a guest's surface, 36 /// textures (25 `BGRA8Unorm`, 11 `R32Uint`) of 6016x6016 at rows of 24,576 bytes over one -/// `Private` buffer, a kernel writing a 1024-texel square of two of them and reading a 256-texel -/// square of four others each frame (`runtime_lane::aliased_surfaces::aliased_surface_costs`). +/// `Private` buffer, a kernel writing a 1024x1024-texel square of two of them and reading a +/// 256x256-texel square of four others each frame +/// (`runtime_lane::aliased_surfaces::aliased_surface_costs`): with each texture a shadow of its +/// own (5211 MB of them), a frame copied 869 MB in and 290 MB back and took 28.22 ms of GPU time +/// on a Radeon 780M (RADV), 32.80 ms on an Iris Xe (ANV) and 119.08 ms on lavapipe; with one +/// shadow and 35 images at Metal's pitch, it copied nothing and took 0.22, 1.40 and 1.48 ms. With +/// four textures made each frame and dropped after it, four shadows (579 MB) were made a frame, +/// at 26.67, 28.37 and 102.05 ms a frame; with the images, none, at 0.18, 0.83 and 1.28 ms. pub(crate) const POOLED_PITCHED_BYTES: u64 = 48 << 10; /// Why the device makes no image in place over a texture's texels.