From 749daae1d9e005e75b86f8b162f42279c5e41d89 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Wed, 4 Nov 2026 23:21:37 -0800 Subject: [PATCH] Say a texture's image of any storage mode may overflow past device-local memory Every texture's image is placed in Private memory (image_plan.rs), so a Shared or Managed texture's image overflows as a Private one does; the notice's declaration, the catalogue entry, the runtime README and the lane's site note now say so. Verified: nothing (docs and comments only). (cherry picked from commit ec5b5a70fdea000eb9a7d5ab84e5aaad02fffed4) --- crates/metal2vulkan-runtime/README.md | 6 +++--- .../metal2vulkan-runtime/src/degradation.rs | 5 +++-- .../src/runtime_lane/degrade_notices.rs | 4 ++-- docs/API.md | 19 ++++++++++--------- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md index 6135d9178..ae247e702 100644 --- a/crates/metal2vulkan-runtime/README.md +++ b/crates/metal2vulkan-runtime/README.md @@ -259,9 +259,9 @@ the runtime made. unified memory a `Managed` buffer has two copies, as on a Mac with a discrete GPU (`did_modify_range` and a blit's `synchronize_resource` move the bytes), and a `Shared` resource lies in host-cached system memory (announced once, `shared-in-system-memory`). -- **Past device-local memory.** Where no device-local memory type a `Private` buffer, heap or - texture (or a `Managed` buffer's own bytes, without unified memory) takes has room, it lies in - system memory, as Metal makes such resources past a discrete GPU's memory rather than refusing +- **Past device-local memory.** Where no device-local memory type a `Private` buffer or heap, a + texture's image or (without unified memory) a `Managed` buffer's own bytes takes has room, it + lies in system memory, as Metal makes such resources past a discrete GPU's memory rather than refusing them (announced once, `device-memory-overflow`; counted in `WorkCounts::device_memory_overflows`). Where the device lists `VK_EXT_pageable_device_local_memory`, the runtime enables it and the driver may page memory out diff --git a/crates/metal2vulkan-runtime/src/degradation.rs b/crates/metal2vulkan-runtime/src/degradation.rs index 048dc682a..8304e922f 100644 --- a/crates/metal2vulkan-runtime/src/degradation.rs +++ b/crates/metal2vulkan-runtime/src/degradation.rs @@ -902,8 +902,9 @@ degradations! { resource: coalesced accesses at the bus's speed, and scattered writes far slower \ (4-byte stores 12 bytes apart at 0.08 GB/s on an RTX 3090, where device-local \ memory takes them at 850 GB/s)"; - /// A `Private` buffer, heap or texture the program makes, or a `Managed` buffer's own bytes - /// on a device without unified memory (`managed.rs`), lies in system memory: no + /// A buffer or heap of `Private` storage the program makes, a `Managed` buffer's own bytes + /// on a device without unified memory (`managed.rs`), or a texture's image, of any storage + /// mode (`image_plan.rs` places each in `Private` memory), lies in system memory: no /// device-local memory type the resource takes had room for it, and it takes a type that /// is not device-local (`memory.rs`'s `overflow_candidates`), as Metal makes such a /// resource past a discrete GPU's memory rather than refuse it. Each such placement is diff --git a/crates/metal2vulkan-validation/src/runtime_lane/degrade_notices.rs b/crates/metal2vulkan-validation/src/runtime_lane/degrade_notices.rs index 9bca296ea..6bc9e0350 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/degrade_notices.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/degrade_notices.rs @@ -803,8 +803,8 @@ const STILL_MAKING: [Degradation; 3] = [ /// failed by the runtime's test hook. const COPIED_PAGES: [Degradation; 1] = [Degradation::CopiedHostPages]; -/// The kind a `Private` buffer, heap or texture the program makes, or a `Managed` buffer's own -/// bytes without unified memory, takes where no device-local memory type it takes has room for +/// The kind a `Private` buffer or heap the program makes, a texture's image, or a `Managed` +/// buffer's own bytes without unified memory, takes where no device-local memory type it takes has room for /// it, so that it lies in system memory. Only a device without unified memory whose device-local /// heap is full meets it, which no lane fills (a GPU hazard). The runtime's own test /// `resources_past_device_local_memory_are_made_used_and_read_back` takes its site, under diff --git a/docs/API.md b/docs/API.md index e3281f575..4d35e8cb9 100644 --- a/docs/API.md +++ b/docs/API.md @@ -2000,15 +2000,16 @@ bound. it across the bus, as a discrete Mac's GPU does a shared resource: coalesced accesses at the bus's speed, and scattered writes far slower (4-byte stores 12 bytes apart at 0.08 GB/s on an RTX 3090, where device-local memory takes them at 850 GB/s). -- `metal2vulkan-degrade-device-memory-overflow` (performance). `DeviceMemoryOverflow`: A `Private` - buffer, heap or texture the program makes, or a `Managed` buffer's own bytes on a device without - unified memory, lies in system memory: no device-local memory type the resource takes had room - for it, so it takes one that is not device-local, as Metal makes such a resource past a discrete - GPU's memory rather than refuse it. `WorkCounts::device_memory_overflows` counts each such - placement. A driver that pages device-local memory (`VK_EXT_pageable_device_local_memory`, which - the runtime enables where listed with its feature) may page memory out to make room instead, and - then nothing overflows. Cost: the GPU reads and writes it across the bus, at the bus's speed, for - as long as it lives; resources made once device-local memory has room again lie there. +- `metal2vulkan-degrade-device-memory-overflow` (performance). `DeviceMemoryOverflow`: A buffer or + heap of `Private` storage the program makes, a `Managed` buffer's own bytes on a device without + unified memory, or a texture's image, of any storage mode, lies in system memory: no + device-local memory type the resource takes had room for it, so it takes one that is not + device-local, as Metal makes such a resource past a discrete GPU's memory rather than refuse it. + `WorkCounts::device_memory_overflows` counts each such placement. A driver that pages + device-local memory (`VK_EXT_pageable_device_local_memory`, which the runtime enables where + listed with its feature) may page memory out to make room instead, and then nothing overflows. + Cost: the GPU reads and writes it across the bus, at the bus's speed, for as long as it lives; + resources made once device-local memory has room again lie there. - `metal2vulkan-degrade-device-filtered-mipmaps` (precision). `DeviceFilteredMipmaps`: `generate_mipmaps` of a filtered format (an integer format's texels are picked as plain Metal picks them): each level is the device's linear filter of the one above at the scaled texel