From 7fb7d64310bad025b7c9d9d319ba27db1ffff1e2 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Sat, 21 Nov 2026 23:44:18 -0800 Subject: [PATCH] rt README: the AMD kernel driver's compaction inside a Shared make, a known gap of memory blocks What: one row in "Known gaps of memory blocks". On amdgpu a Shared allocation's make gathers its pages inside the driver's create, under the reservation of the device's page tables that every submit, import, map and close on the device also takes; with the host's free memory low the kernel compacts first and those calls wait behind it. The row names what the runtime does not do and why: it keeps one unit length on every device (a shorter unit moves makes onto the take path) and keeps no memory to avoid the call. Why: the 780M block-make stall is recorded at rung 4 of the workaround ladder; the 2 MiB unit was ruled out (it moves the time, it does not remove it, and puts makes on the consumer's take path on every device), and a kernel draft for the maintainers is rung 3. Evidence: - Standalone program, Radeon 780M (RADV, Mesa 26.2.6, Linux 7.3.3), job m3-max-66343: free memory 303 to 318 MiB before each set of makes, 8,257 MiB of resident shared memory, about 21 GiB of page cache; 55 makes of 16 MiB met 5.16 and 6.91 compaction stalls a make in its two passes, and the longest submit held behind a make was 13.87 ms (12.26 ms in the other pass). - Guest walk on a Radeon 780M, rt at 4e9aad67d5, job m3-max-66278: the long 16 MiB makes met 5 to 18 compaction stalls each, and 8 of the 9 submits of 5.3 to 22.6 ms waited behind a make. Verified: docs only, checked by a compile job of this commit (fmt, workspace Rustdoc -D warnings, scripts/api-docs). --- crates/metal2vulkan-runtime/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md index e8c6c6e8b..486874187 100644 --- a/crates/metal2vulkan-runtime/README.md +++ b/crates/metal2vulkan-runtime/README.md @@ -1112,6 +1112,18 @@ the Direct3D 11 texture's payload until it is freed. rt's Shared units are the driver's own memory on every device, so these holds are what the consumer sees beside each one made or freed. +- On the AMD kernel driver (amdgpu) a Shared allocation's make gathers its pages inside the + driver's create, under the reservation of the device's page tables, which every submit, import, + map and close on the device also takes. With the host's free memory low the kernel compacts + memory first, and those calls wait behind it. On a Radeon 780M (RADV of Mesa 26.2.6, Linux + 7.3.3), with the host's free memory at 303 to 318 MiB before each set of makes, beside 8 GiB of + resident shared memory and 21 GiB of page cache, 16 MiB makes met 5.2 and 6.9 compaction stalls + each on average in two passes, and the longest submit held behind one took 13.87 ms (a + standalone program, job m3-max-66343). In a guest walk on a 780M (rt at 4e9aad67d5, job + m3-max-66278) the long 16 MiB makes met 5 to 18 compaction stalls each, and 8 of the 9 submits + of 5.3 to 22.6 ms waited behind a make. The runtime keeps its one unit length on every device, + since a shorter unit would move makes onto the take path (a take longer than a unit allocates + on the caller's thread), and it keeps no memory to avoid the call. - On a full discrete card a Private block the consumer takes goes to another memory type, host memory where the card has no other device-local type, and the kernels that read a Managed buffer's device copy placed there read it across the host link: