Every buffer allocation swept the retired buffers first, with a kernel
call for each fence and release under the lock all allocating threads
take, so the command stream chunks of a render pass waited behind other
threads' sweeps. An allocation the cache serves now makes no kernel
call, and a sweep at a fence observation is skipped while another
thread sweeps.
The Metal runtime hands each family of pipelines a VkPipelineCache of its
own, and Turnip looked for a compiled shader only in the cache it was
handed. The same stages under another cache were compiled again:
CoreAnimation's generic fragment shader three times, once per colour
format, about 4 s of CPU each on a cold cache.
Every shader Turnip makes is now also kept in the device's own cache, and a
lookup that misses the handed cache looks there before compiling.
Host, the built driver, the generic stages under three fresh caches:
1620, 1706 and 1714 ms before; 1661, 0 and 0 ms after. On sheng
(macOS 27.3): 4825, 92 and 7 ms.
Turnip marked its device lost when the kernel's count of ended submissions
changed. The Metal runtime then refused every object made before, and the
render server stayed broken although the GPU had restarted. The kernel ends
only the submission that hung; Turnip now leaves the device in use and
counts the restarts (tu_darwin_restarts).
Seen on sheng (macOS 27.3): two GPU restarts with a guilty job in one run,
the render server kept its process and went on drawing.
A fragment shader could fill the whole pipeline's const space with pushed
UBO ranges and its preamble. Any const of the vertex stage then made the
pipeline link the fragment shader's safe_constlen variant, which reads its
uniforms from memory. The fragment limit now leaves the other stages the
share a safe variant would leave them.
CoreAnimation's generic fragment shader with its vertex shader, compiled by
the built driver on the host: const length 412 instead of 512, so the
pipeline links the regular variant (22082 instructions, 4243 stalls)
instead of the safe one (28587 instructions, 8369 stalls).
Also updates Adreno740 (GPU stays usable after a process's address space
fails) and AdrenoMetal (fragment program names in the log).
A submission of more indirect buffers than one kernel submission takes
is cut at the last command buffer start within reach, so no command
stream continues under the kernel's thread selection. Cuts inside a
stream are counted.
The translator pin moves to upstream 555b13d5 and the bridge's patch
list to the series restated over it.
Run on hardware: three runs with apps opened and ended and display
sleeps, the window server kept its device and nothing hung.
GMEM holds drawn colour in shader order. With the identity swap on the
memory side a GMEM pass stored drawn BGRA8 colour with red and blue
exchanged and loaded memory into tile memory in memory order, so a
framebuffer fetch of loaded colour read it exchanged (colour order
self-test). Loads and stores (event blit, 2D and 3D) now apply the
image's own swap on the memory side; the tile side stays the identity.
The lock screen in GMEM and in the default mode matched system memory
rendering in every tile (0.0 % exchanged, from 0.1 % and 88.1 %).
Record each distinct transfer between tile memory and memory, the first
passes with their attachments and event blit loads and stores, from the
render server only (SHENG_GPU_TRACE). sheng-tum=g or s selects GMEM or
system memory for every pass, and tu_sheng_set_thread_render_mode the
mode of one thread's passes for the colour order self-test.
With TU_DEBUG=sysmem every pass rendered in system memory, and the
3048x2032 pass with RGBA16F and R32F transient attachments wrote and read
them in DRAM (329 of 9835 full-screen passes over 8.33 ms in
untagged-102cb4a069) and backed them with up to 96 MiB each. A pass whose
transient attachment has no memory yet now renders in GMEM; other passes
keep system memory. Also pin the refusal trace event.
turnip-gmem-mutable-swap.patch moves GMEM loads and stores with the identity swap on the memory side and adds the render pass and submission rings; unixnu --os 17|26|27 selects the OS profile and its output directory.
fdl6_layout aligned an explicit linear layout's pitch to 16 pixels for
the 16x4 GMEM store, so an IOSurface whose rows are 24384 bytes (3048
RGBA16Float texels) could not be imported in place. An explicit layout
now takes the hardware's 64-byte alignment, and a linear host or
explicit-layout attachment whose size is not whole tile blocks renders
in SYSMEM, which reads and writes its texels alone. Bridge patch 0021.
The darwin backend now offers lazily allocated memory, as the msm
backend does with a settable GPU address: a sparse VMA reserves the
range and a BO is made there only when a pass needs the bytes. A pass
with such an attachment that has no memory yet renders in GMEM, where
the attachment lives in tile memory alone; the autotuner chose SYSMEM
for passes of few draws and so made the memory for good.
Core Animation's render server holds its intermediate targets as
memoryless textures: untagged-feaf29203 had twelve 3048x2032 RGBA16F
ones, 758 MiB, each memory of its own. On the host the same Liquid
Glass scene no longer allocates the 48 MiB attachment.
The translator pin moves to upstream development 624bab39 (the
inexact-math work) and records its branch; check-metal2vulkan-pin.py
checks the pin against the branch the record names. Bridge patch 0018
rounds heap texture sizes to their alignment. Adreno740 takes user BOs
from system memory, with no fixed pool.
- pin metal2vulkan at upstream 0dfdbcd5 with the rebased 16-patch series;
scripts/check-metal2vulkan-pin.py proves with git alone that the
checkout is upstream plus exactly those patches
- Turnip's pipeline cache UUID comes from its compiler source
(-Dtu-build-id), the same for the host and the tablet build
- scripts/make-pipeline-cache.py runs the render server's priming over
every library of the OS image on the host through the tablet's
compiler and packs the cache
Source-driver and source-storage builds, the arm64e PAC rewrite for the Rust bridge, the IOAccelerator base ABI of 24A446, the bridge with mimalloc and link-time optimisation, the plugin with the prime list, addon options for a prime list, a pipeline pack and cache export, wallpaper overlay and seed changes, and payload, kernel and userdata steps for the new profile.
Turnip asked a dedicated allocation of every image made for external
memory, so an image over a no-copy buffer's host pages could not be
bound inside the buffer's import and each such texture fell back to a
shadow image copied in and out per pass. Ask it only for handle types
that carry per-image metadata, as the host-allocation format query
already reports.
Both audits need hardware and emulator evidence of the original kernelcache that is not in any repository. Their recorded results (AES method addresses, accelerator base class layout) ship with the scripts and are used when the evidence is absent. They belong to the kernelcache pinned in board.toml.
Bring the current NativeAdreno, NativeMetal, AdrenoFirmware, AdrenoPM4,
AirNir and ArmSmmu4K sources, the Mesa pipeline-cache and builtin-shader
patches, and the Turnip host cache tools.