The padded-texture work packet. A texture over a buffer whose image would hold bytes that are not its texels is drawn through a shadow image with exact copies, since a render pass or a layout transition may write those bytes. Then the shadow's cost is cut, exactly: no copies for a pass that reaches no tile, a copy back bounded by the draws' scissors, and cost lines that show each part. Shadow a texture over a buffer whose image would hold bytes that are not its texels: A texture over a buffer is a linear (or DRM_FORMAT_MOD_LINEAR) image over the buffer's bytes only where every byte of the image's subresources is one of its texels: its rows lie one after another (or it has one), its slices likewise, and its last subresource ends at its texels' last byte or before. Anything else is the shadow, whose copies address the buffer's texels alone. The Metal texture over an MTLBuffer (MoltenVK) is exempt: every write through it is Metal's own. Why: Vulkan lets a render pass's load and store operations "read and write back any memory locations within the image subresource bound for that attachment" (renderpass.adoc, Load and Store Operations), and VkSubresourceLayout's size "includes any extra memory that is required based on rowPitch", so the bytes between padded rows lie inside the subresource. Metal leaves them as the program writes them. No query promises otherwise, so no image may alias padded rows. Bytes past every subresource stay allowed: Memory Aliasing bounds the bytes a write through an image affects to "those overlapped by the image subresources that were written". Measured on lavapipe (Mesa 26.2.4 llvmpipe, gem10) at the round's base: pitched_surfaces' 657x128/5312 RGBA16Float tile took lavapipe's own linear image (its pitch 660 texels rounded to 64 bytes is the lane's 5312), and a clear-blend-store pass rewrote 13 padding bytes in 13 rows (row 3 byte 5265 0x7c -> 0x7e: texels 657..659 of its 4-texel blocks read and written back, signaling NaNs quieted). The reliance predates1cf79a9617(own linear images whose pitch equals bytesPerRow, the dma-buf explicit planes);1cf79a9617made it every padded surface on ANV and NVIDIA's wider pitches. How: linear_plan's padding() and texels_alone(), used by alias_image (before any image is made), aliases() (now given the subresource's size), host_alias_unbound (the own linear image's fit and the pitched image's), the dma-buf alias (before the pages' source is asked, counted as a fallback; its plane's size checked for textures over buffers, not heaps') and the rebind (the alias kind keeps the texels' layout). Importer::makes_modifier_images, a duplicate of makes_dma_buf_images, is folded into it. RUNTIME_VERSION 1188. Tests: the aliases unit test covers padded rows, slices apart, a one-row pitch, a subresource past the texels and a whole-array report. pitched_surfaces checks the pages after every step (now naming the changed bytes outside the texels), asserts padded rows are never aliased off MoltenVK, adds a load-blend-DontCare step, packed layouts of 510 and 126 rows and of 200, and a fragment function's writes over six layouts (shader read/write usage). no_copy_textures asserts padded rows shadow off MoltenVK (it asserted ANV's pitched image); dma_buf_imports' 60-texel case now shadows. Docs: API.md (the extension paragraph and the shadowed-texture entry), ShadowedTexture's rustdoc, HOWTO.md section 6, Texture::vk_image, dma_buf.rs, and a known-gap entry in FAST-PATHS.md with ANV's cost (making the browser tile ~135 us as a shadow vs ~41 us as a pitched image, 1cf79a9617's numbers). Verified on lavapipe (gem10, release, --cfg m2v_cpu_icd, LP_NUM_THREADS=1): runtime_lane's pitched_surfaces, no_copy_textures, buffer_texture_blits, dma_buf_imports, linear_attachments, buffer_textures, buffer_texture_order, buffer_texture_renders, dont_care_stores, kept_buffer_bytes, rotated_textures, and tests::linear_plan / degradation: 137 of 140 passed; a_half_float_tile passes (it failed at the base), every padded layout is shadowed, 300x200/1200 is a pitched image. The three failures: the runtime-sources pin (written here), and the two packed odd-height layouts, 658x126/5264 (rows 126..127 past the texture rewritten) and 1308x510/5232 (SIGSEGV, rows 510..511 written past the mapping): a lavapipe defect of explicit DRM_FORMAT_MOD_LINEAR planes, handled in the next part. GPU lanes (ANV, RADV, NVIDIA, MoltenVK) not run yet. Make no explicit-plane modifier image of an odd height where lavapipe renders rows past it: RuntimeDriverDefect::ExplicitPlaneRowsPastHeight: a DRM_FORMAT_MOD_LINEAR image whose one plane the caller lays out (VkImageDrmFormatModifierExplicitCreateInfoEXT) is rendered in blocks of 4 rows, its rows past its height up to a multiple of 4 written past its subresource and past its memory requirements. On a driver with the defect (lavapipe, MESA_LLVMPIPE, every release until a probe finds one clean) neither host_pitched_image nor the dma-buf image (textures over buffers and heaps' textures alike) is made of a height that is no multiple of 4: the texture takes its shadow, announced as shadowed-texture with the defect named. The trigger is structural (the image's height); the driver's own linear images are untouched, as they report the rounded rows in their subresource (the previous part's texels_alone then shadows them). Why: a write past an image's own memory is a spec violation no query reveals. Measured on lavapipe (Mesa 26.2.4, llvmpipe LLVM 23.1.1 256 bits, gem10, release, LP_NUM_THREADS=1) at the previous commit, pitched_surfaces' packed odd-height layouts, each a pitched image (pitched host images 1): 658x126/5264 RGBA16Float, a load-blend-store pass rewrote 21 bytes of rows 126..127 past the texture (signaling NaNs quieted); 1308x510/5232 BGRA8Unorm, the same pass wrote rows 510..511 past the no-copy buffer's mapping and the process took SIGSEGV. lavapipe 26.0.8 is unprobed. How: Device::explicit_plane_rows (dma_buf.rs), asked by host_pitched_image and dma_buf_image_unbound after their format checks. The registry entry and its test, the variant's rustdoc, ShadowedTexture's rustdoc and API.md's shadowed-texture entry. No refusal is added, so docs/REFUSALS.md has no row for it (refusal_surface.py --check passes); the api_surface table names the enum, not its variants. RUNTIME_VERSION 1189. Verified: see the landing run (lavapipe, the pitched_surfaces odd-height layouts shadowed and passing). Record that an image over host-pointer pages keeps its bytes past its first move only by drivers: A known gap in docs/FAST-PATHS.md, and a lane check that turns a driver that drops the bytes into a visible failure. No behaviour changes (no RUNTIME_VERSION bump): whether every texture over pointer-imported pages becomes a shadow is the owner's call. The gap: an image of host allocations must start UNDEFINED (VUID-VkImageCreateInfo-pNext-01443), and a transition from UNDEFINED "will cause the contents of the image's memory to be undefined" (resources.adoc, VkImageLayout). Memory imported from a host pointer "shares ownership of the memory between the host and the Vulkan implementation", with host access synchronized as for any memory (memory.adoc, VkImportMemoryHostPointerInfoEXT), so the external-memory acquire from VK_QUEUE_FAMILY_EXTERNAL/FOREIGN is not blessed for it. sync2's ignored-layout barrier keeps contents but leaves the image UNDEFINED, invalid to use as GENERAL. Paths that rely on the drivers: host_linear_image, host_pitched_image, and metal_alias_image (VkImportMetalTextureInfoEXT says nothing of contents). Spec-backed: dma-buf images, acquired from VK_QUEUE_FAMILY_FOREIGN_EXT in GENERAL (the external memory chapter's ownership transfer and its note that the UNDEFINED initial layout is a placeholder), and the runtime's own linear images, made PREINITIALIZED. The check: pitched_surfaces::a_texture_s_first_use_reads_the_bytes_it_was_made_over makes a texture over each layout and reads it first through its image (a fragment function's read) before anything else touches the pages: the read must be the pages' texels and the pages unchanged. Verified: see the landing run (lavapipe). Expect a shadow wherever no linear image holds a texture's texels alone: The runtime aliases a texture over an ordinary buffer with a linear image only where the image's subresource holds the texture's texels and nothing else (linear_plan::texels_alone): no padding between rows, the driver's row pitch Metal's, and no subresource bytes past the last texel. The lanes' expectation helper, buffer_texture_blits::linear_rows_differ, compared only the driver's row pitch, so on lavapipe, whose linear 64x2 RGBA8Uint at a 256-byte pitch reports a 1024-byte subresource (its height rounded up to 4 rows) while the texels end at 512, resource_ids expected no shadow and failed with "announced past []: [ShadowedTexture, UnnamedShadowedTexture]". The helper now applies the same rule: rows with bytes between them, a subresource offset other than 0, a row pitch other than the buffer's, or a subresource size past (height - 1) * row + width * texel. It takes the texel size, which every caller knows. The callers' expectations move the same way: resource_ids' 64-texel rows (the size rule), buffer_texture_blits' 4x4 textures at 32-byte rows and the IOSurface planes at 9, 20 and 40 bytes, and view_reinterpretation's rows 16 bytes past their texels (the padding rule, which shadows them on every device). Verified on gem10's lavapipe (Mesa 26.2.4, --cfg m2v_cpu_icd, LP_NUM_THREADS=1, release): the focused filter over pitched_surfaces, no_copy_textures, buffer_texture_blits, dma_buf_imports, linear_attachments, buffer_textures, buffer_texture_order, buffer_texture_renders, dont_care_stores, kept_buffer_bytes, rotated_textures, resource_ids, view_reinterpretation and the runtime's linear_plan, degradation and driver_defects tests: 186 of 187 pass, resource_ids' a_buffer_under_a_texture_goes_at_its_release_whatever_keeps_the_image among them; the one failure is the runtime-sources pin, which moves with this work (below). Test-only: no runtime source changes. Name the layout transitions as what may write a padded texture's padding: A texture over a buffer whose rows (or slices) lie with bytes between them is a shadow off MoltenVK, since an image over those rows would hold the bytes between them in its subresource. The shadowed-texture notice gave one reason for every such texture: Vulkan lets a render pass's load and store operations write those bytes back. That cannot apply to a texture without RenderTarget usage, which never becomes an attachment, and ms01's A/B saw read-only padded textures shadowed under that reason. For such a texture the basis is the layout-transition rule (the Synchronization chapter's Image Layout Transitions): "Image layout transitions may perform read and write accesses on all memory bound to the image subresource range", and "If the old layout is VK_IMAGE_LAYOUT_UNDEFINED, the contents of that range may be discarded". Every image takes one transition before any use: its first move into GENERAL, from UNDEFINED for imports (VUID-VkImageCreateInfo-pNext-01443) or PREINITIALIZED for ordinary buffers. No descriptor or copy takes an image in either layout, and host image copy's transition is a transition too. So no transition-free path exists for a read-only linear image, and the shadow stays. After the first move every runtime image rests in GENERAL, so no later barrier transitions it; copies and shader accesses touch texels alone (the Memory Model: "A memory operation must not affect memory at a memory location not within its set of memory locations"). linear_plan::padding now takes whether the texture renders (RenderTarget usage). Its reason names the layout transitions, its first move among them, and for a render target also the render pass's load and store operations. The doc comment quotes both texts. The ShadowedTexture rustdoc, docs/API.md's catalogue entry, docs/HOWTO.md, docs/FAST-PATHS.md's known gap, and the dma_buf.rs and linear_plan.rs module docs say the same. Tests: - tests::linear_plan::a_padded_texture_s_shadow_names_what_may_write_its_padding checks both reasons' exact text. - The lane test pitched_surfaces::a_padded_texture_s_shadow_names_what_may_write_its_padding makes the browser's 1307x512/5248 tile over an ordinary buffer, which shadows on every device, MoltenVK included. It runs a fresh device per usage (ShaderRead; RenderTarget | ShaderRead) and checks the shadowed-texture notice's reason. RUNTIME_VERSION 1190 (fleet/round's 1189 + 1). The runtime-sources pin is recomputed at this tree. Verified on gem10's lavapipe (Mesa 26.2.4, llvmpipe LLVM 23.1.1, --cfg m2v_cpu_icd, LP_NUM_THREADS=1, release). The focused filter (pitched_surfaces, no_copy_textures, buffer_texture_blits, dma_buf_imports, linear_attachments, buffer_textures, buffer_texture_order, buffer_texture_renders, dont_care_stores, kept_buffer_bytes, rotated_textures, resource_ids, view_reinterpretation, and the runtime's linear_plan, degradation and driver_defects tests) ran 189 tests. 188 passed, both new tests among them, printing: - ShaderRead: "its rows lie 5248 bytes apart, 5228 bytes of texels each: an image over them holds the bytes between them, which Vulkan lets its layout transitions read and write, its first move from the layout it is made in among them" - RenderTarget: "... which Vulkan lets its layout transitions read and write, and a render pass's load and store operations write back" The one failure was the runtime-sources pin before this commit set it (860ca881...). Clippy with all features (no cfg) is clean. Take the surface texture cost frame apart, per part and per texture: surface_texture_costs measures a browser-like frame: five surface textures over new no-copy buffers, each loaded and stored by a pass that draws nothing, then each blitted into a private texture. On ANV, ms01 measured commit-to-completion rising by about 2.8 ms a frame where four of them became shadows. That number alone cannot say where the time goes: the shadows' copies in and back, their making and release, or work beside them. It also cannot say why the packed 1024x512/4096 tile, which stays the driver's own linear image in both forms, took longer to make. The new ignored measurement surface_texture_cost_parts (run by name, release, as the others) runs the frame over anonymous pages in parts: - Empty: the textures made and released around an empty command buffer. - PassesStored: Load/Store passes, i.e. a shadow's copy in and copy back. - PassesNotStored: Load/DontCare passes, a copy in only. - PassesDrawn: Load passes that blend a rectangle and store, as a browser's passes draw. - Blits: the blits alone, which read a texture over a buffer as its bytes. - Both: the original frame. It runs over every layout, then over the packed layouts alone, so no shadow is made beside them. Per set and part it prints (SURFTEX-PART): the forms; each texture's making median and p90; the frame's release, encoding, commit-to-completion and process CPU time; and the per-frame work counts. frame() takes the part, and surface_texture_costs passes Part::Both, so its own output is unchanged. Test-only. It compiles at fleet/base as well (it names nothing newer), so the same measurement runs on the earlier form. Checked with clippy --cfg m2v_gpu, all targets and features, -D warnings, on gem10. Copy no shadow in or back for an attachment a pass that reaches no tile loads: A texture over a buffer whose image would hold bytes that are not its texels is a shadow: an image of its own that encoders copy the texels into before use and back after a write. A render pass copied its shadowed color attachment in before the pass and back after it whenever it loaded and stored it, even where the pass reached no tile: no draw call, or draw calls that draw nothing (clear_reach::PassReach::Nothing). Such a pass changes no texel: - Metal loads and stores only the tiles a draw reaches (PassReach's EVs). - Vulkan's load and store write back what they read: "Load operations only update values within the defined render area", and store operations alike. So the copies moved a texture's every texel twice for nothing. On ANV, surface_texture_costs' frame (whose passes draw nothing) paid that for four padded surfaces since they became shadows. attachment_shadows now takes no use of such an attachment: a color attachment of a pass that reaches no tile, that loads it (Load, also a DontCare load the pass loads), stores it Store or DontCare, resolves nothing, and has no stand-in or planes, where the shadow is a plain image of a buffer's bytes (ShadowTarget::Image, writes kept). No copy in, nothing dirty, no copy back. Rotated, converted and image shadows keep their copies. The pass still renders into the shadow image, whose attachment uses order it as before. Every later use copies in again, since the shadow was never marked current. New public counter WorkCounts::shadow_copies: copies between a shadowed texture's truth and its shadow that encoders planned (in, back, keep and merge). It is counted where EncoderCore plans them and at each of the three end-of-encoder finishes. Lane test pitched_surfaces::a_pass_that_draws_nothing_copies_no_shadow: the browser's 1307x512/5248 tile over an ordinary buffer (a shadow on every device). Load/Store and Load/DontCare passes that draw nothing plan 0 copies and leave every byte of the buffer. A pass that blends a rectangle plans 2 (in and back). Without this change, the expected counts for the two empty passes are 2 and 1. This shrinks surface_texture_costs' frame, whose passes draw nothing, not a browser's, whose passes draw. surface_texture_cost_parts' PassesDrawn part measures that apart. RUNTIME_VERSION and the runtime-sources pin move with this work (below). Verified on gem10's lavapipe (Mesa 26.2.4, --cfg m2v_cpu_icd, LP_NUM_THREADS=1, release): the earlier focused filter plus the runtime's shadow tests ran 200 tests, 199 passed, the new test among them. The one failure was the pin. clippy -D warnings, all targets and features, is clean with no cfg and with --cfg m2v_gpu. Copy back only the texels inside a pass's draws' scissors: A shadowed texture's copy back after a render pass moved every texel from the shadow image to the buffer. On ANV that write-back is the shadow's cost: ms01's surface_texture_cost_parts put a stored shadow at about 0.8 ms of commit-to-completion a frame (1307x512 BGRA8). A pass that loads a color attachment changes no texel outside its draws' scissors: - "Samples with coordinates outside the scissor rectangle at the corresponding ViewportIndex will have their coverage set to 0" (the Fragment Operations chapter's Scissor Test). - "Load operations only update values within the defined render area" and "Store operations only update values within the defined render area" (the Render Pass chapter), writing back what they read. - Each Vulkan scissor is Metal's rectangle clipped to the pixels its viewport overlaps (render_state.rs's implicit scissor), so Metal's draw writes no pixel past it either. The image's other texels are what the last copy in left, which the buffer still holds, and a write of the bytes another way leaves the image stale, so they need no copy back. How: - ShadowUse gains an area: where a command writes through the texture, where it bounds that. render.rs passes the bounds of the pass's DrawnArea (its draws' Vulkan scissors) for a pass whose draws reach tiles, unless a reach clear runs before the pass, together with which color attachments the encoder set to Load, read before the DontCare loads and reach clears change any. attachment_shadows gives that area to a loaded color attachment with no resolve, stand-in or planes that is the whole of a one-level, one-slice texture. - join and ShadowSync::after keep the rectangle bounding the writes since the last copy back, or none where one does not bound them. copy_back puts it on the ShadowCopy. - record() cuts the one region of a ShadowTarget::Image without staging to it, by part_of: the buffer offset moved to the rectangle's first texel at the region's row length, clamped to the image. ShadowTarget::Image now carries its texel size (none for a heap's depth or stencil shadow, which takes no area). - Copies in still move every texel. New public counter WorkCounts::shadow_texels_copied_back: the texels copies back of buffers' textures' images move. Tests: - tests::shadow::a_copy_back_covers_only_where_the_commands_wrote: areas through ShadowSync and join. - tests::shadow::a_part_of_a_region_starts_at_its_first_texel: the region arithmetic, clamping, empty parts and tight rows. - Lane pitched_surfaces::a_pass_copies_back_only_the_texels_its_scissors_reach: the browser's 1307x512/5248 tile over an ordinary buffer (a shadow on every device), blended under a 300x200 scissor, moves 60000 texels back. The buffer then holds a private texture's blend inside the scissor and every other byte as it was. Unscissored, the pass moves all 669184. docs/FAST-PATHS.md's known gaps record the race the bound leaves: Metal stores only the 32x32 tiles a primitive touches (reims-vgpu's padding probe, M3 Max, macOS 27.0.1). A concurrent CPU write to an undrawn texel in an untouched tile inside the scissors can be undone here, where Metal keeps it. No copy reaches the bytes between rows. The batch's version commit moves RUNTIME_VERSION; the runtime-sources pin follows it. Verified on gem10's lavapipe (Mesa 26.2.4, --cfg m2v_cpu_icd, LP_NUM_THREADS=1, release). The shadow lanes (the previous part's list, plus scissors and capture_reach where they exist) and the runtime's shadow, shadow_stencil, linear_plan, degradation and driver_defects tests ran 319 tests, and 318 passed, the three new ones among them. The one failure was the runtime-sources pin. clippy -D warnings, all targets and features, --cfg m2v_gpu, is clean. Measure a scissored drawn pass and a shadow's copies alone: Two additions to the surface texture cost measurements, both ignored and run by name in release builds. surface_texture_cost_parts gains PassesScissored: the drawn pass (Load, a rectangle blended over the left half, Store) under a scissor of the left half, as a browser's pass redrawing a damaged part of a tile draws. With the previous part, its shadows copy back only the scissored half. PassesDrawn's default scissor covers the whole tile, so its copy back moves every texel. shadow_copy_costs times each copy alone in its own command buffer, committed and waited for, on the browser's 1307x512 BGRA8 tile at 5248-byte rows: - a private texture made as a shadow is (render target and shader read) into a no-copy buffer over anonymous pages: a copy back's way; - the pages into the texture: a copy in's way; - the texture into a private buffer and into a Shared buffer; - a private buffer into the pages, and back. It prints SURFTEX-COPY lines with commit-to-completion medians and p90s. These tell the image's tiling (detiling) from the pages' memory (writes into imported host memory) as the cause of ANV's copy back. Test-only. clippy -D warnings with --cfg m2v_gpu, all targets and features, is clean on gem10. Print a frame's shadow copies and the texels its copies back move in the surface cost lines: What: the surface texture cost lines' per-frame work counts (SURFTEX-COST, SURFTEX-PART) now end with the shadow copies the encoders planned and the texels their copies back moved, both per frame. Why: a change to how a shadow's image is made or copied must leave the copies and the texels they move as they were; the cost lines then show it beside the times, in the same run. Verified: test-only; built and run with the measurements on Linux hosts in the next steps (no build on the Mac). Wrap the surface texture costs' SURFTEX-QUERY sentence at 100 columns: The commit that added a frame's shadow copies to the cost lines left the module doc's SURFTEX-QUERY sentence on one 154-column line; the tree wraps doc comments at 100. Doc only. Verified: awk finds no line of the file over 100 columns but the ignored-tests sentence (110), which predates that commit; cargo fmt --all leaves the tree unchanged. Versions: RUNTIME_VERSION 1202 -> 1203. RUNTIME_VERSION moves: padded textures over buffers are drawn through shadows, and the shadows' copies change. crates/metal2vulkan-validation/runtime-sources.sha256 holds 52d6ce1648b67055d046e043e6d1cd126e0a8315d04a922261df93ad0a25f734, the hash of this tree's runtime inputs (runtime-pin.py, which reproduces build.rs's). Version numbers quoted above are the values the work's branch built with. Each part's Verified lines name the tree it ran at.
30 KiB
Fast paths: the accuracy ledger
An accuracy note is logged, never fatal. The work keeps running; only what Metal itself refuses ends it.
Each row of the first table is one place where the default trades exactness against Metal for
speed: pipeline-creation ("making") time or GPU time, mostly off Apple's GPUs. The fast form is the
default, the accurate form stays behind its switch, and both are kept. This file is a ledger, not a
journal: rows are edited in place, with no history. A change that adds, removes or changes a fast
default, its bound or its switch updates its row in the same commit. The test tests::fast_paths
fails when a DevicePolicy accuracy choice, one of its values, or a precision note a fast default
records is missing here, or when this file names a policy value that no longer exists.
Every switch is a field of DevicePolicy (the runtime's DeviceOptions::policy). On MoltenVK on
an Apple GPU, whose sampler and float functions are Metal's own, most rows do not apply. Each
difference is recorded in the pipeline's artifact as a PrecisionNote and announced as
metal2vulkan-degrade-<code> when the runtime makes the pipeline state; each note's rustdoc and
docs/API.md section 9 state its bound.
Fast defaults
Costs are measured on the RTX 5080 Laptop GPU (NVIDIA 615.71.09) with scripts/making-bench:
cold, the command queue made first, the driver's disk cache off; the making of the state's
pipeline, then GPU time per draw, the default against the accurate form alone. The workloads are
three consumer pipelines: A2X (a2x-s4, a2x-s96), Xgc14 (xgc14-bgra8) and Xgc15
(xgc15-rgba8). The switches were measured at master e4b1bdf5e, half
rounding at master 1ee783c77, whose default output is the same;
a cell that names another source took its numbers there.
| What it is | Default (fast) | Accurate switch | Recorded bound (note, code) | Cost of the accurate form (5080) |
|---|---|---|---|---|
| Samples, gathers and depth comparisons go to the device's own sampler: its filter, footprint, level, anisotropy, sRGB decode and comparison. | sampling = SamplingPolicy::NativeDevice |
sampling = SamplingPolicy::Exact: Metal's sampler emulated by fetches, a pipeline per bound sampler state |
Linear filter within one code (1/255) on the measured devices, sRGB within 1.83; levels, anisotropy, cubes, 3D, gathers and comparisons unmeasured. DeviceSampling (device-sampling) |
Not measured on today's master. At the switch (maths and texel conversions still exact): Xgc15 making 24.2-24.8 s exact against 12.5-13.9 s native |
A texel's float value is the device's conversion of its codes; a half result is the device's float texel rounded to nearest even. |
texel_conversion = TexelConversionPolicy::Device |
texel_conversion = TexelConversionPolicy::Exact: Metal's conversion by the bound format's class of every read; a sample's or gather's also with sampling = SamplingPolicy::Exact (under native sampling the device's sampler decodes it) |
One f32 ulp for 8- and 16-bit codes, 0.18 of a code for 5- and 6-bit packed channels; half within one ulp; NaN bits the device's. DeviceTexelConversion (device-texel-conversion), HalfTexelConversion (half-texel-conversion, also recorded for heap textures and unmeasured formats) |
Exact reads (the same reads): Xgc14 0.88-0.89 → 0.90-0.93 s, GPU 0.039 → 0.046 ms; Xgc15 0.65-0.66 → 0.68 s, 0.090 → 0.094 ms; A2X unchanged (no affected read). Samples: with the sampling row |
The maths library (sin, exp, log, pow, atan2...), divisions and Metal's fast reciprocal, and a fused multiply-add without OpFmaKHR are the device's instructions, not routines of Metal's answers. |
float_maths = FloatMathsPolicy::Native |
float_maths = FloatMathsPolicy::Exact |
Vulkan's precision table (Sin 2^-11 absolute in [-π, π], Exp 3 + 2·|x| ulp, Atan 4096 ulp) against Metal's 4-6 ulp; division 2.5 ulp; fma one half ulp (a float one may round twice). NativeTranscendentals (native-transcendentals), NativeDivision (native-division), NativeFma (native-fma) |
A2X 1.00-1.02 → 4.61-4.67 s, GPU 0.098 → 0.194 ms; Xgc14 0.88-0.89 → 3.55-3.58 s, 0.039 → 0.095-0.099 ms; Xgc15 0.65-0.66 → 1.94-2.00 s, 0.090 → 0.176 ms |
A NaN result's bits are the device's (no select of Metal's NaN), and fmin, fmax, min3, max3, clamp and saturate are the device's NMin, NMax and NClamp. |
nan_and_min_max = NanMinMaxPolicy::Native |
nan_and_min_max = NanMinMaxPolicy::Exact |
A NaN where Metal answers one, its bits the device's; the operand Metal picks but at two NaNs, +0 against -0, and f32 denormals. NativeNanEncoding (native-nan-encoding), NativeMinMax (native-min-max) |
A2X 1.00-1.02 → 1.85-1.88 s, GPU 0.098 → 0.116 ms; Xgc14 0.88-0.89 → 1.59-1.63 s, 0.039 → 0.048 ms; Xgc15 0.65-0.66 → 1.25-1.28 s, 0.090 → 0.102 ms |
dot, mix and fast::sqrt are the device's OpDot, FMix and Sqrt, not Metal's fused chain, its two fused multiply-adds and x · rsqrt(x). |
rounding_order = RoundingOrderPolicy::Native |
rounding_order = RoundingOrderPolicy::Exact |
float dot of n lanes within (3n − 1)·2^-24·Σ|aᵢbᵢ|, mix within 2^-21 of its two terms, fast::sqrt 4.5 ulp. NativeDot (native-dot), NativeMix (native-mix), NativeTranscendentals (native-transcendentals) |
A2X 1.00-1.02 → 1.03-1.06 s, GPU 0.098 → 0.101 ms; Xgc14 0.88-0.89 → 0.97-1.02 s, 0.039 → 0.041 ms; Xgc15 0.65-0.66 → 0.73 s, 0.090 → 0.088 ms |
A half result computed in float rounds through the device's conversion to 16 bits (three instructions), or its OpQuantizeToF16 without shaderFloat16, not Metal's rounding in integer arithmetic (about twenty). |
half_rounding = HalfRoundingPolicy::Native |
half_rounding = HalfRoundingPolicy::Exact |
One half ulp; 65504 where Metal answers infinity on a device rounding toward zero; a half denormal may flush; NaN bits and a zero's sign the device's. Or no rounding at all, measured: NVIDIA (RTX 3090, 615.71.09) drops the conversion pair, and lavapipe does in arithmetic on Mesa 26.2.4 with LLVM 23.1.1 and for a loaded texel on Mesa 26.0.8 with LLVM 21.1.8, whose arithmetic measured rounded, so the result keeps float precision, its differences compounding across operations, and a value past half's range stays finite until a half store saturates it to infinity; RADV and ANV take their quantize, measured to be Metal's (exact, no note); the RTX 5080 Laptop GPU (615.71.09) rounds, measured: 8192 of 8192 narrowed sums are Metal's. NativeHalfConversion (native-half-conversion), NativeHalfQuantize (native-half-quantize) |
A2X 0.99-1.04 → 7.19-7.21 s, GPU 0.098-0.100 → 0.139-0.140 ms (+40%); Xgc14 0.86-0.87 → 0.87-0.92 s, Xgc15 0.63-0.66 → 0.69-0.70 s, GPU unchanged (RTX 5080). Rounding natively by OpQuantizeToF16 instead, which the RTX 3090 and lavapipe honour (Metal's answer on every operand tested), was measured and declined: A2X 1.3 s → 18-22 s, GPU 0.14 → 1.5 ms on an RTX 3090 |
A half read from its bits (a load, a reinterpretation, a texel's bits) outside every loop is widened by the device (UnpackHalf2x16), not decoded exactly. |
half_rounding = HalfRoundingPolicy::Native |
half_rounding = HalfRoundingPolicy::Exact (with the row above) |
A half denormal may read as zero where the device flushes them; NaN payload the device's. NativeHalfConversion (native-half-conversion) |
Not measured alone on today's master. At its merge: A2X 1.04-1.07 s with it against 1.27-1.28 s with the exact decode; Xgc unchanged |
The half conversion converts the value itself (no NoContraction barrier), so the device's compiler may fold it into the instruction computing the value, rounding once. |
half_rounding = HalfRoundingPolicy::Native |
half_rounding = HalfRoundingPolicy::Exact (with the rows above) |
The row above's: on NVIDIA (RTX 3090), and on lavapipe for a loaded texel (Mesa 26.0.8), the pair is dropped whether or not the barrier stands, so the barrier does not restore the rounding there. NativeHalfConversion (native-half-conversion) |
At its merge: A2X 0.99-1.02 s without the barrier against 1.00-1.05 s with it; Xgc within a round's spread |
A half texel's NaN is the rounding's own NaN, not the texel's bits (the keep's four instructions a texel are left out). |
half_rounding = HalfRoundingPolicy::Native and nan_and_min_max = NanMinMaxPolicy::Native |
nan_and_min_max = NanMinMaxPolicy::Exact (the keep under native half rounding, master ecd39568bb); half_rounding = HalfRoundingPolicy::Exact also keeps it, at that row's cost. The same switch also gives Metal's full rule: 0x7e00 for every NaN but a one-texel read, nearest sample or gather of a 16-bit float texture, by the slot's format class read as data, a heap handle's class index and a runtime sampler's filter. A gather with a half result fetches its four texels where the class is a half-float one, since NVIDIA's gather hands back every NaN as 0x7fffffff. Not yet exact: a cube gather, bicubic and emulated linear, fetched or compared samples. Possible, not built: the runtime sampler's filter read as push data rather than specialized, which would spare the remake below. Measured on the RTX 5080: under the switch no half lane of the runtime lane's texel reads, samples and gathers differs from Metal's (1,469 differ by default). Under the switch DeviceNanEncoding is still announced; the consumer logs notes, so no device fact is built to drop it |
NaN bits the device's (0x7FFF on the RTX 5080), where Metal hands back a 16-bit float texel's own bits on a read, nearest sample or gather, and 0x7e00 for a 32-bit or small float texel's NaN and a linear sample's. NativeHalfConversion (native-half-conversion); the read also records DeviceNanEncoding (device-nan-encoding) |
Measured on top of the NaN switch's own row (its probe with the keep, c0a814a13, against its probe without, 3e8a01c54): A2X 341,299 → 347,519 words, 1.82-1.86 → 1.81-1.87 s, GPU 0.115-0.117 → 0.115-0.116 ms, within noise; Xgc14 and Xgc15 read no half texel (words unchanged). The full rule (its probe a5c642ebe against the same tip without it, 851650c81): A2X 347,519 → 372,429 words (+7.2%), creation 1.85-1.88 → 1.99-2.04 s; where a linear runtime sampler is bound at the draw the sampler word's filter is now specialized, so the first draw remakes (1.94-1.96 s) and its GPU time rises 0.115-0.117 → 0.124-0.125 ms; with a nearest sampler GPU 0.115-0.116 → 0.115-0.117 ms; Xgc14 and Xgc15 words unchanged. On the RTX 3090 the same pair: A2X creation 2.91-3.06 → 3.17-3.23 s, the first draw's remake 3.0 s and its GPU time 0.17-0.18 → 0.79-1.15 ms, with a nearest sampler 0.17-0.18 ms both |
A fragment function without fast math returns a half color to a blended attachment: the device blends in its own arithmetic and rounds once, where Metal blends a 16-bit float attachment in half arithmetic (each factor, product and sum rounded to half). |
half_blend = HalfBlendPolicy::Device |
half_blend = HalfBlendPolicy::Exact: the function computes Metal's blend in the interlocked storage form, for a half4 output into R16Float, RG16Float or RGBA16Float where that form is exact for the pipeline (RADV, ANV, NVIDIA, MoltenVK); elsewhere, and for lavapipe, 32-bit float, 8-bit, a module naming no math mode or a blend of the second source, the device's blend and its note stay |
2.5 half ulps at the largest operand on NVIDIA (the blend color and one minus it), two on RADV, ANV and lavapipe (16-bit float); two float ulps (32-bit float, one on NVIDIA); one or two codes (8-bit, extended range); MoltenVK stores Metal's bytes. Measured with and without the factors' magnitudes at 0bcc0163e5. HalfOutputPrecision (half-output-precision) |
A probe at 924fc11603 (a half4 over a 1920x1080 RGBA16Float target, One / OneMinusSourceAlpha): making 11.1 → 24.0 ms; GPU 25 → 82 us one draw, 506 → 2291 us 32 overlapping draws (the interlock orders them). RTX 3090 (the same draw at 50a065eb98): making 12.9 → 27.4 ms; GPU 45 → 115 us one draw, 648 → 3268 us 32 overlapping draws |
A computed half or float color blended into an extended-range attachment (BGR10_XR, BGRA10_XR, RGB10A8_2P_XR10) rounds the blend's source as a loaded one; Metal's compiler rounds it by how it computed it. Every device. |
The in-shader blend's loaded rounding (no switch) | Not built yet: Metal's rounding per shape is probed, not modelled | One code. ExtendedRangeBlendSource (extended-range-blend-source), ExtendedRangeFloatBlendSource (extended-range-float-blend-source) |
Not measured |
| A bicubic sample of an 8- or 16-bit normalized texture sums its taps exactly and rounds half up; Metal truncates its row terms, row sums and column terms first. Every device. | The exact sum (no switch) | Not built yet: Metal's datapath is pinned (17.75M lanes measured, no miss); its emitter is not written | One grid step (1/4080 at 8 bits) within about 2^-21 of a tie. BicubicFilterArithmetic (bicubic-filter-arithmetic) |
Not measured (Metal's form is expected no larger) |
A bicubic sample of an extended-range texture (BGR10_XR, BGRA10_XR, RGB10A8_2P_XR10 and their sRGB twins) sums its taps' steps exactly, rounds half up and clamps into the format's decoded endpoints; within 0.014 of a grid step of a rounding tie Metal may round the other way. Every device. |
The exact sum (no switch) | None known: no model of Metal's datapath tried fits; 3,317,760 lanes measured on the M3 Max (macOS 26.7) | One grid step (1/8160 a color lane, 1/8192 an sRGB color lane, 1/4080 alpha), 4,050 of the lanes measured, each within 0.014 of a step of a tie. BicubicFilterArithmetic (bicubic-filter-arithmetic) |
No accurate form |
All at once: DevicePolicy::exact_answers() sets every switch above but sampling's (validation
adds sampling = SamplingPolicy::Exact). Against master 1ee783c77 it cost A2X 0.99-1.04 → 17.5 s, GPU 0.098 → 0.267 ms; Xgc14 0.86-0.87 →
4.95-5.01 s, 0.039 → 0.105-0.110 ms; Xgc15 0.63-0.66 → 3.06-3.15 s, 0.090 → 0.194-0.197 ms.
Speed choices that change no answer (the roll pass's floor; a specialization measured free) are not rows.
Not speed choices: device gaps
No switch gives Metal's answer here: the device lacks what an exact form needs, or no exact form is known. The rest of the differences are docs/API.md section 9's precision notes.
| What it is | Why there is no switch | Note, code |
|---|---|---|
f32 denormals in operations left to the device (a remainder, a double conversion, dot's fused sum, a function no routine computes): Metal reads them as zero. |
Vulkan lets each device keep or flush them. + - *, comparisons, fma, sqrt, rsqrt, floor, ceil and divisions read them as Metal on every device. |
DeviceDenormals (device-denormals) |
| A denormal 32-bit float texel the device's sample or gather reads as zero (RADV's gathers and nearest samples, NVIDIA's gathers, ANV's nearest samples), where the module cannot fetch the texels itself. | The device's filter decides; no fetch form reaches filtered, cube, heap or runtime-sampler samples. | DeviceTexelDenormals (device-texel-denormals) |
Depth values outside [0, 1] stored clamped (RADV, ANV) on a device without VK_EXT_depth_range_unrestricted. |
Vulkan leaves them undefined without the extension: enable it. | RestrictedDepthRange (restricted-depth-range) |
Signed zeros, infinities and NaNs where the device lacks SignedZeroInfNanPreserve at the operation's width. |
A device capability. | DeviceSignedZeroInfNan (device-signed-zero-inf-nan) |
NVIDIA's interpolation rounds an exactly representable varying one f32 ulp toward zero. |
The exact path needs Metal's interpolation formula, which is not measured. | DeviceInterpolation (device-interpolation) |
A fast-math function's half color into a blend: within three half ulps (16-bit float) or two float ulps (32-bit float). |
Metal's compiler regroups the blend per pipeline; no form the function and the blend state decide is Metal's. | HalfOutputFastMathBlend (half-output-fast-math-blend) |
| Float simdgroup reductions sum in the device's association order. | Apple's order is not modelled. | ReductionOrder (reduction-order) |
Accuracy switches whose default is Metal's
unorm8_linear_filter = Unorm8LinearFilterPolicy::Exact(the default) keeps Metal's filter for an 8-bit unsigned normalized texture's linear sample where Metal's sampler is emulated (sampling = SamplingPolicy::Exact).unorm8_linear_filter = Unorm8LinearFilterPolicy::DeviceWithinOneCodehands it to a device measured within one code (DeviceUnorm8LinearFilter,device-unorm8-linear-filter): it bought no GPU time on the consumer's fragments and cost module size and making time.framebuffer_fetch = FramebufferFetchPolicy::RequireOrdered(the default) refuses a framebuffer fetch without rasterization-order attachment access;framebuffer_fetch = FramebufferFetchPolicy::AcceptUnorderedaccepts it unordered (UnorderedFramebufferFetch,unordered-framebuffer-fetch). A coverage choice, not a speed one.pointer_domain,handle_domain,containmentandisolationchoose how resources resolve and how guests are contained, not an answer of Metal's arithmetic or sampling.
Known gaps
Open differences from Metal that no note announces yet, and runtime costs still above the driver's. Each is open work.
- Tininess before rounding. Metal flushes a
floatresult whose exact value lies below2^-126even where rounding would reach2^-126:fma(2^-126, -2^-126, 2^-126)is0on Metal and on MoltenVK,2^-126on RADV, ANV, NVIDIA and lavapipe. An exact form needs a scaled check on everyfloatmultiply andfma; it is not built. - A fragment sample's bias within the device's limit. Off MoltenVK the shader forms Metal's
bias,
clamp(floor(half(bias) · 64) / 64, -32, 31.984375), but the device's own level arithmetic applies it, unannounced. - Simdgroup barriers in divergent code stay where they are, as SPIR-V defines them (they wait for their tangle). No case compares them with Metal.
- Private memory past 16 KiB a thread on a device not measured. A thread's private memory (its
allocas, a call stack among them, and constants held asPrivatevariables) is scratch memory the driver backs, and Vulkan states no limit on it. Past a driver's capacity the answers are wrong or the GPU hangs, with no error: the Radeon 780M and the RX 7900 XTX (RADV) answered wrongly at 128 KiB over 4096 threads and the Iris Xe (ANV) at 48 KiB; the RTX 5080 Laptop GPU hung at 48 KiB and the RTX 3090 at 192 KiB (Xid 109). So the amount is measured per device by the validation laneruntime_lane::private_memory, never probed when a device opens, anddevice::function_storagekeys it on the driver, vendor and device ID. Measured: the Radeon 780M and the RX 7900 XTX (96 KiB each), the Iris Xe of Raptor Lake-P and the UHD 770 of Raptor Lake-S (32 KiB each, the Intel venue's lower value), the RTX 5080 Laptop GPU (32 KiB), the RTX 3090 (128 KiB), the M3 Max and the M4 under MoltenVK (192 KiB) and lavapipe (48 KiB). Every other device takes the floor of 16 KiB a thread: a stage that keeps private memory recordsFunctionStorageAssumed(function-storage-assumed), and one that needs more is refused (Unsupported{PrivateMemory}, orUnsupported{Recursion}for a call stack), where MoltenVK on the M3 Max holds 192 KiB. Measuring a device and adding its row lifts it. The scratch costs device memory in proportion: on the RTX 3090 a dispatch of a 128 KiB stage took about 4 GiB (4.2 GiB at its peak, about 31 MiB for each KiB a thread holds). - Commit to completion. A command buffer takes longer from commit to completion through the
runtime than a bare driver submission: on a quiet Radeon 780M (RADV) an empty command buffer took
51.6 µs against a bare barrier's 45.1 µs. On MoltenVK most of the rest is the two GPU timestamps
each timed command buffer writes: on an M4 a bare barrier took 14.7 µs alone and 167.8 µs with
them.
DeviceOptions::gpu_times_from_host(off by default, announced) answers GPU times from the host clock and spares them. - A commit can wait for the driver's submission. Where the device's scheduler is free (no host
step or submission check pending),
commitsubmits the command buffer's ready batches itself, on the committing thread, so that no thread wake lies on their path (scheduler/mod.rs). AvkQueueSubmitthe driver holds then holdscommit, where Metal'scommitreturns at once. On the RTX 5080 Laptop GPU (NVIDIA 615.71.09), beside about 20 other processes opening devices and running work on it, 1 or 2 of the 1,800 commits of a run of the runtime's completion test took 58 to 226 ms, none handed to another thread. The committing thread slept in the driver meanwhile (3.5 to 7.6 ms on the CPU, none of it waiting to run). Mostly the GPU ran the command buffer's work within 0.1 ms of the call's start, and the one committed before it was seen complete 0.1 ms after its own commit (its completed handler ran then); once, the work started only as the call returned. Handing each commit's submission to the scheduler thread, or doing so once a device's submission has stalled, would return at once; it is not built. - A view of another format without
PixelFormatViewusage is a shadow image whose texels are copied at each use (shadowed-texture-view): about 50 to 95 µs a command buffer for a 64x64 texture, measured on the M3 Max and M4 (MoltenVK) and the Radeon 780M. Making the texture withPixelFormatViewusage avoids it. - A pass that loads a texture over a buffer and does not store it renders through an image its
texture keeps, the buffer's texels copied into it first (
dont-care-stand-in), so that the buffer keeps its bytes as Metal's does. In the frame-cost benchmark's window server frame (67 passes, 50 of them over a 512x512BGRA8Unorm_sRGBlayer that is a texture over aSharedbuffer), loading the layer and storing itDontCaretakes about 0.5 ms more of the encoding thread a frame and 0.6 ms more through the GPU's completion than rendering it in place on the Iris Xe (ANV), some 10 µs a pass each; on a busy Radeon 780M (RADV) a pass's end takes 8 to 18 µs more. A pass that clears the layer and stores itDontCarecosts no more (on ANV, 1.1 ms of the encoding thread and 2.7 ms through completion less a frame, as nothing is copied back), and one that stores it renders in place at no added cost. Where MoltenVK runs the pass as one unbroken instance, Metal keeps the bytes at no cost. - A texture over a buffer whose rows lie with bytes between them (a guest browser's padded
surfaces, an array whose slices are rounded up to 128 bytes) is a shadow on every device but
MoltenVK (
shadowed-texture), its texels copied in before each use and back after each write. An image over those rows would hold the bytes between them in its subresource, where Metal leaves them as the program writes them, and Vulkan lets two kinds of operation write them: the image's layout transitions "may perform read and write accesses on all memory bound to the image subresource range", and every image takes one, its first move from the layout it is made in, before any use (so a texture that only reads is a shadow too); and a render pass's load and store operations "read and write back any memory locations within the image subresource bound for that attachment" (lavapipe writes back those its 4-texel blocks reach, a signaling NaN's bits quieted). No query of the device's promises otherwise. On ANV (Mesa 26.2.4) making the browser's 1307x512 tile took about 135 µs as a shadow against 41 µs as an image at its row pitch. Packed rows (bytes_per_rowthe texels' bytes) avoid it where the device lays an image's rows there. - A shadow's copy back after a pass that draws covers every texel inside the draws' scissors, where Metal's store writes back only the 32x32 tiles a draw's primitives touch (reims-vgpu's padding probe on an M3 Max, macOS 27.0.1: a tile with geometry stores its undrawn texels back, a tile without stores nothing, and the bytes between rows are never written). Without a CPU write to the texture's texels during the pass, both leave the same bytes. With one, to an undrawn texel in a tile no primitive touches but inside the scissors, the copy back can undo it where Metal keeps it: the host does not know which tiles the primitives touch. A pass that reaches no tile copies nothing back, and no copy reaches the bytes between rows.
- A texture's image over pages imported by their pointer keeps their bytes past its first
move only because the drivers do. Vulkan makes an image of host allocations start in
UNDEFINED(VUID-VkImageCreateInfo-pNext-01443), and a move fromUNDEFINED"will cause the contents of the image's memory to be undefined"; memory imported from a host pointer "shares ownership of the memory between the host and the Vulkan implementation", host access as to any memory, so no queue-family acquire from outside keeps them either. That holds for the driver's own linear image for host allocations (texture.rs'shost_linear_image), theDRM_FORMAT_MOD_LINEARimage at Metal's row pitch (host_pitched_image), and, on MoltenVK, the image of a Metal texture over the import'sMTLBuffer(metal_alias_image; Vulkan says nothing of such an image's contents). lavapipe (Mesa 26.2.4) keeps the bytes (runtime_lane::pitched_surfaces::a_texture_s_first_use_reads_the_bytes_it_was_made_over, a first use that reads through the image, fails where a driver drops them). Spec-backed: an image over a dma-buf of its own pages, which its first move acquires fromVK_QUEUE_FAMILY_FOREIGN_EXTinGENERAL(the external memory chapter: "acquire exclusive ownership in the destination instance or API", theUNDEFINEDinitial layout "a placeholder"), and a linear image of the runtime's own memory, madePREINITIALIZED. The exact form, a shadow of every texture over such pages (on ANV a tile's making about 135 µs against 41 µs, and a copy in and back at each use), is the owner's call. - A cold pipeline making on NVIDIA grows with a module's sampling sites. NVIDIA's compiler (615.71.09) takes about 1 s for macOS 26's largest CoreAnimation fragment (210,033 words) on the RTX 5080 Laptop GPU, made once per cold cache (the first boot, and after an update changes the cache key); states that share the module then take 13 to 16 ms, and a warm cache 2 ms. The time follows the number of sampling sites: the module inlines a few sampling helpers five or six times each. Keeping one copy of each helper would cut it; it is not built.
- An intrinsic declaration from macOS 12's and 13's Metal compiler. The consumer's macOS 12
and 13.7.8 guests have Contacts' compute kernels refused with
InvalidInput(Intrinsic(SignatureMismatch))at a bitstream position in a function body (blocks[8, 12]). The consumer reports guests 11, 14, 15 and 26 clean (unverified here). Decode raises it (intrinsics::bind, from the call decode inbitcode/function.rs) for anair.*orllvm.*declaration whose own function type fits none of the operand formsintrinsics::classifyderives from its name (DeclClass::Mismatch). It is not a call at a type other than its declaration's: decode binds a call to an intrinsic only when the two types are equal (pointee types erased), andcanon::post_checkrefuses any other at a function location. AIR 2.5 (Metal compiler 31001.723) declares an indirect command's kernel and vertex buffer setters,air.set_kernel_buffer_compute_commandandair.set_vertex_buffer_render_command, without thei64attribute stride before the buffer index. Decode takes that form as MSL's plain setter, which today's compiler spells with a stride of all ones (the pipeline's own), and encodes the same record. Of the seven private corpus rows that declare those setters, one translates on every committed profile that runs GPU-encoded commands, and six are refused withUnsupported(ArgumentBufferObjects)(not implemented), as other compilers' builds of the same functions are. One private corpus row is refused withSignatureMismatchon every committed profile, AIR 2.5 as well: a kernel declaresair.intersect.triangle_datawith six trailingi32settings where decode's form has nine (the curve settings among them), and ray tracing is out of scope. Whether the consumer's Contacts kernels are the setters, and so translate, is unverified. - A direct call whose arguments do not line up with its callee's parameters is refused with
InvalidInput(Canon(CallTypeMismatch))(canon::post_check): a call to a defined function at a function type other than the definition's, its arguments differing from the parameters in number or type beyond pointee types. LLVM leaves such a call undefined, and what Metal runs for it is whatever Apple's back end makes of the mismatch, which nothing documents, so no exact form exists. Its likely source (unverified) is two structures of one name that differ between the translation units a library links, with one instance of a function taking the structure by value kept for both. Four private corpus rows, one fragment function from Metal compilers 32023.622 to 32023.886, are refused this way on every committed profile. - A loop that Apple's MSL compiler folds into 33-bit arithmetic fails to make on MoltenVK.
Apple's MSL front end (Metal compiler 32023.921) can rewrite a loop that sums its counter
(
1 + 2 + ... + n) into a closed form computed in 33-bit integers (zext i32toi33,mul i33,lshr i33). Where that form lands in the kernel's constant program, the M3 Max's back end (applegpu_g15s) cannot legalize the 33-bit zero extension ("unable to legalize instruction ... (s33)", inagc.main.constant_program). Metal's compiler service then ends, and MoltenVK fails the pipeline's making (VK_ERROR_INITIALIZATION_FAILED,XPC_ERROR_CONNECTION_INTERRUPTED). The runtime returns that failure: a dispatch's command buffer completes withCommandBufferError::PipelineCreation, and an indirect command's commit returnsError::Vulkan. Hand-written MSL of the same loop fails the same way on Metal. The AIR Metal compiles directly gets no such rewrite, and runs. Measured on the committed caseauthored-four-iteration-loop: offline withxcrun metalandmetal-tt -arch applegpu_g15s, and in the runtime lane on an M3 Max with macOS 26.7. No form of the loop is known that avoids the rewrite for every such loop, so it is not built.