From 953d696ecbfbebc3d3f6728c273207d773fbf8df Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Fri, 20 Nov 2026 05:39:11 -0800 Subject: [PATCH] rt test: the push window's 24- and 30-buffer kernels push 22 addresses below their tail 0cd2ad765d places each floor push with its tail 24 bytes above its other fields. A kernel whose bounds go to its block also pushes that block's address, so its window holds the region and 22 buffer addresses below the zero tail word, not 24: the 24-buffer kernel now rings its last 2 addresses with the zero range's address and its 24 bounds (2, 25), and the 30-buffer kernel 8 addresses with its 31 check fields (8, 31). The lavapipe leg of development's checks at 5aacf738f7 (m3-max-58439) failed on the old (0, 23) with (2, 25). The kernels' block and push counts are unchanged: both rang one block a dispatch before. The test's name, its docs and the rt README's push-window line now say what the placement gives. Checked by the compile job named in the hand-off. --- crates/metal2vulkan-rt/README.md | 7 +++--- .../metal2vulkan-rt/src/tests/push_window.rs | 25 ++++++++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/crates/metal2vulkan-rt/README.md b/crates/metal2vulkan-rt/README.md index 6c0eebd83..27b20ef28 100644 --- a/crates/metal2vulkan-rt/README.md +++ b/crates/metal2vulkan-rt/README.md @@ -1879,9 +1879,10 @@ while the driver's exit handler waited on a lock, with every runtime thread alre on a Radeon 780M; `dispatch_chain` 3.0% slower on the RTX 3090; `bind_2000` 25.4% slower in GPU time on the RTX 3090 with host time level; the other eight harness rows level on all three cards (jobs m3-max-58429, m3-max-58430, m3-max-58431). Fields past the window go to a 16-byte - aligned block in the parameter ring, whose address is a field in the window: a kernel with more - than 24 buffers. `Counters::metrics`' `ring_writes` counts each block and each `set_bytes` - copy. + aligned block in the parameter ring, whose address is a field in the window. A kernel whose + buffers' bounds do not all fit beside its addresses rings one: one of 12 buffers pushes all of + its fields, and one of 24 or 30 pushes 22 addresses beside the block's. `Counters::metrics`' + `ring_writes` counts each block and each `set_bytes` copy. `set_bytes` copies its bytes into the ring at the call, as Metal copies them. The ring is 2 MiB blocks of the floor's ring memory type (device-local, host-visible, coherent), split into 64 KiB chunks that a command buffer takes as it records and gives back when it retires; a block diff --git a/crates/metal2vulkan-rt/src/tests/push_window.rs b/crates/metal2vulkan-rt/src/tests/push_window.rs index 0eab0136f..c95fa3c6e 100644 --- a/crates/metal2vulkan-rt/src/tests/push_window.rs +++ b/crates/metal2vulkan-rt/src/tests/push_window.rs @@ -4,11 +4,12 @@ //! buffer's bounds (its bytes before the bind offset and its length, 8 bytes), which come last in //! the order, so they are the first to go to a parameter block. A kernel of 12 buffers (232 //! bytes) pushes them all and writes nothing into the parameter ring, and its dispatches after -//! the first push nothing, their bytes held. One of 24 buffers pushes its block's address, every -//! buffer's address, the zero range's and one buffer's bounds, and the other 23 bounds go to a -//! block; one of 30 pushes 26 addresses, and the other 4, the zero range's and the 30 bounds go -//! to a block. Each of those two writes one block a dispatch, whose -//! new address each dispatch pushes. All answer the fold of their inputs. +//! the first push nothing, their bytes held. One of 24 buffers pushes its block's address, the +//! region, 22 buffers' addresses and the zero tail word 24 bytes above them (`docs/API.md` section +//! 5), and the other 2 addresses, the zero range's and the 24 bounds go to a block; one of 30 +//! pushes the same 22 addresses, and the other 8, the zero range's and the 30 bounds go to a +//! block. Each of those two writes one block a dispatch, whose new address each dispatch pushes. +//! All answer the fold of their inputs. //! //! `llvm-as` assembles the kernels; without it the test skips visibly. @@ -82,18 +83,18 @@ define void @wide({}) {{\nentry:\n{body} %out = getelementptr inbounds i32, ptr } /// The kernel of 12 buffers writes nothing into the ring, and pushes once for its three - /// dispatches of the same bindings; the kernel of 24 pushes every address and has only check - /// fields in its block, and the kernel of 30 has 4 addresses there too; each of those writes - /// one block a dispatch, whose new address each dispatch pushes. Each answers the fold of its - /// inputs. + /// dispatches of the same bindings; the kernels of 24 and 30 push 22 addresses below their + /// tail and have the other 2 and 8 in their block with every check field; each of those + /// writes one block a dispatch, whose new address each dispatch pushes. Each answers the fold + /// of its inputs. #[test] - fn every_device_pushes_24_buffer_addresses_and_rings_30() { + fn every_device_pushes_12_buffers_and_rings_24_and_30() { // Each kernel's buffers, its addresses and check fields in the block, its blocks a // dispatch, and its pushes over the dispatches. for (buffers, (addresses, checks), blocks, pushes) in [ (12u32, (0usize, 0usize), 0u64, 1u64), - (24, (0, 23), 1, DISPATCHES), - (30, (4, 31), 1, DISPATCHES), + (24, (2, 25), 1, DISPATCHES), + (30, (8, 31), 1, DISPATCHES), ] { let bitcode = match llvm_assemble_text(&kernel(buffers)) { Ok(bitcode) => bitcode,