Commit Graph
5190 Commits
Author SHA1 Message Date
Anees Iqbal ae413fd7e9 Half sqrt at 16 bits: its bound belongs to NativeTranscendentals, which it records
On a device whose float functions are not Metal's, a half sqrt is the
device's instruction for Metal's function and records
NativeTranscendentals (function_notes), not DeviceArithmetic. The 16-bit
Sqrt's bound moves to that note's doc and its catalogue entry; the
division test asserts NativeDivision and NativeTranscendentals, as the
Iris Xe profile records (job 24519: [NativeTranscendentals,
NativeDivision, NativeNanEncoding]).
2026-11-12 23:20:51 -08:00
Anees Iqbal 502650252b Half hold: an undefined value's f32 stays undefined, not its twin's widening
A use of an undefined f32 value that is no exact half (a float2 built by
inserting coordinates into an undefined vector) read the widening of its
16-bit twin: hnq's fragment shader had six OpFConvert of an OpUndef.
The f32 undefined value is kept for those uses instead; the twin is the
16-bit undefined value as before.

Test: engine_half_hold's division kernel builds a float vector on an
undefined one and asserts an f32 OpUndef stays and no undefined value is
widened (Iris Xe, RADV).
2026-11-12 23:20:51 -08:00
Anees Iqbal ab56a1c88e Half division and square root at 16 bits under the 16-bit float controls
Rule 1: where the module computes half in 16 bits under the 16-bit float
controls (QuantizeForm::Controlled), the device's native form of a half
division and square root is its 16-bit OpFDiv and Sqrt, so those are the
only form there; elsewhere the float instruction rounded to half stays.

- divide::native: a half quotient under the controls narrows its operands
  (exact, they are halves), scales a divisor past 2^14 by 2^-2 and a
  denormal one by 2^10 into Vulkan's range for the 16-bit OpFDiv
  ([2^-14, 2^14], 2.5 half ulp), divides at 16 bits and widens. The
  scaling is exact but where the quotient rounds to zero or overflows
  anyway.
- math::float_fn: a half sqrt under the controls is the 16-bit Sqrt
  between exact conversions (Vulkan: inherited from 1 / InverseSqrt).
- narrow::computes_in_16_bits counts 16-bit FDiv and Sqrt, so the entry
  declares the controls (denormals kept, IEEE zeros, infinities, NaNs).
- ops: float_ty and f16_splat, shared with f16_binary.
- NativeDivision and DeviceArithmetic state the 16-bit bounds; docs/API.md,
  docs/FAST-PATHS.md, the narrow and half_hold module docs follow.
- Test: engine_half_hold's half_division_and_sqrt_are_16_bit_under_the_
  float_controls (Iris Xe and RADV: 16-bit FDiv x2 and Sqrt, none at 32,
  no exact narrowing, the exact answers on the interpreter, L3, the notes;
  lavapipe: the float forms, the same answers).

Verification: in the following potluck runs (FConvert count on hnq,
the half engine tests, spirv-val, clippy, the suite).
2026-11-12 23:20:51 -08:00
Anees Iqbal bf59ee08f4 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 23:17:53 -08:00
Anees Iqbal 62dfb5cec3 String literals whose line continuations were lost join their lines again
A run of spaces inside a string literal, where a line once ended in `\`, printed the next line's
indentation into the text. Swept every .rs file's string literals (non-raw) once for a run of
four or more spaces between two non-space characters, and for literals whose line ends without a
continuation; the latter were all intended multi-line text (LLVM IR, SQL, data tables, usage).

Restored (each run became ` \` and the next line's indentation, 28 runs):
- product messages: render_state.rs (SampleDepthClamp's text), degradation.rs
  (YCbCrFilterNotExact's text), two_planes.rs (a blit's why-not), device/create.rs (the dropped
  instance layers' line);
- tests and suites: render_sibling_work.rs, shadow_standing_device.rs, image_standing.rs (2),
  conformance texture_views.rs (2) and rate_map_sweeps.rs (3), validation plan_resources.rs and
  parallel_encodes.rs (2);
- conformance times.rs: a wrapped line after an explicit `\n`, its two-space indent kept;
- engine_refused_families.rs: one space in an LLVM IR line's `ptr addrspace(1)`.

The degradation texts change in whitespace alone; docs/API.md's catalogue names the kinds, not
these texts, and still matches. Left as written: aligned columns and indentation after `\n`
(kernel_textures.rs, renders.rs, argument_buffers.rs, degradation_catalogue.rs, the
conformance stability, verdict and cost reports, the tab table of dma_buf_leak_probe.rs, usage
texts). cargo fmt.
2026-11-12 23:16:47 -08:00
Anees Iqbal c1835b7e0b Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 23:11:04 -08:00
Anees Iqbal 8dda227927 RUNTIME_VERSION 2200: a new buffer's zeros are one fill on every device
A new buffer's first-move zeros are now one vkCmdFillBuffer on unified-memory devices too,
instead of copies from the device's zero buffer, one region per 4 MiB. Nothing structural needed
the copy there any more. That changes runtime behaviour.

Verified by the change's own runs, zeroing 17,899,520 bytes (GPU timestamps, median of 20): 780M
fill 0.532 ms against copies 0.748 ms; Iris fill 0.517 against 0.527 ms (24390). The first-use lane
passes on the Iris (24379) and 780M (24380), "its zeros 1 fills"; clippy 24359.
2026-11-12 23:10:26 -08:00
Anees Iqbal c72bbdb125 A new buffer's zeros are one fill on every device, unified memory too
What: `FirstFill::zeros` set a new buffer's word-aligned zeros with one
`vkCmdFillBuffer` only on a device without unified memory; a device that
shares the host's memory copied the device's zeros instead. It now fills on
every device (copies stay for a range whose ends are not multiples of 4).
The first-use lane's `a_new_private_buffer_reads_zero_through_its_first_fill`
asserts exactly one fill (`WorkCounts::new_buffer_zero_fills`) on every
device; it asserted none on unified memory. The docs of `zeros`,
`first_move.rs`, `word_fill.rs` and `new_buffer_zero_fills` say so.

Why: the copy read the zeros as well as it wrote the range, which costs on
unified memory too. Measured on one blit zeroing 17,899,520 bytes, GPU time
by timestamps, median of 20 (a diagnostic branch, not committed):
- Radeon 780M (RADV, Mesa 26.2.6): fill 0.532 ms, copies 0.748 ms; the
  command buffer's wall time 1.556 vs 1.900 ms.
- Iris Xe (ANV, Mesa 26.2.6): fill 0.517 ms, copies 0.527 ms; wall time
  0.948 vs 1.070 ms.
The discrete numbers already in the doc (RX 7900 XTX) are unchanged.

Verified (at the same change on bfcd63c5e2): the first-use lane on the Iris
Xe and the 780M (11 passed each, "its zeros 1 fills" on both); clippy over
the workspace, all targets and features, green. Not FAST-PATHS material: no
accuracy is traded.
2026-11-12 23:09:52 -08:00
Anees Iqbal 2eb43d2483 The warm pass's unread-record warning joins its continued lines; the posted import free's deallocator timing documented
warm/pass.rs: say_unread's format string had lost its line continuations, so the warning printed
runs of spaces ("it is          not warmed"); each line now ends in `\`, as written.

free_thread.rs (What is posted) and host_memory.rs (The deallocator): where a completed command
buffer's release lets go of a no-copy import last and its deallocator waits for the free, the
free and the deallocator run on the free thread, possibly after the command buffer's waiters
returned (about 16 ms at most on an RTX 2080, m3-max-24385): Metal ties the deallocator to the
buffer's deallocation, not to a wait for the command buffer.

Docs and a message text only; cargo fmt.
2026-11-12 23:09:36 -08:00
Anees Iqbal 5a51abe484 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 23:07:56 -08:00
Anees Iqbal 7e82dd697a RUNTIME_VERSION 2199: runtime images whose parts no copy writes start at zero
Three runtime-made images could start holding a released texture's texels in a part no copy
writes, where a program could read them: a surface depth's storage shadow's other aspect (read
through an X32Stencil8 view), the later levels of a tiled texture over a Private buffer in a
format generate_mipmaps refuses, and a surface depth pass image's stencil under an unstored
DontCare load. All three now start zeroed. That changes runtime behaviour.

Verified by the change's own runs: on lavapipe both new tests fail without the fix and pass with
it, runtime suite 2447/2447 (24470); Iris 24/24 with it and the tiled test failing without it
(24525); clippy and rustdoc 24473 and 24474.
2026-11-12 23:07:16 -08:00
Anees Iqbal a6b9980002 Count a shadow started at zero by its start, not the removed flag
What: storage_over_buffer counts WorkCounts::shadows_zeroed where its
image started otherwise than as its memory lies (start.is_some()), the
flag the previous commit replaced.

Why: the previous commit left one use of the removed `apart`, which
clippy (jobs 24443, 24444) reported as E0425.

Verified: rebuilt in the jobs that follow.
2026-11-12 23:06:41 -08:00
Anees Iqbal b8257d9c10 Runtime images whose parts no copy writes start at zero, never as their memory lies
What:
- Device::storage_over_buffer: a surface depth or stencil texture's
  shadow whose copies leave an aspect out starts ZeroUnpatterned in every
  storage mode (Metal reads 0 there); a tiled texture of more than one
  level starts Start::Zero, as a new texture of its storage mode does.
  Before, both went through new_image, which starts a Private image held.
- surface_depth.rs pass_image (the twin and an X32_Stencil8 view's
  private image) starts ZeroUnpatterned: no copy writes its stencil.
- Docs: storage_over_buffer's comment, surface_depth.rs module docs and
  FAST-PATHS.md's tiled later levels gap say what they now read.

Why: a Private image's memory may hold a released texture's texels, of
another process sharing the device (a recycled image). A kernel reads the
shadow's stencil through an X32_Stencil8 view, blits and samples read a
tiled texture's kept later levels, and a pass's DontCare stencil load the
driver leaves reads the twin's.

Verified: tests/unwritten_parts.rs (previous commit) fails without this
and passes with it; runs follow.
2026-11-12 23:06:41 -08:00
Anees Iqbal 576cf81f4f Test that runtime images whose parts no copy writes never read a released texture's texels
What: tests/unwritten_parts.rs, two device tests over recycled images.
- A Private Depth32Float_Stencil8 texture over a surface plane: two such
  textures pass with their stencil cleared to 0xA5 and are released, and
  two more take the four parked images (their shadows and pass twins). A
  kernel's read of each X32_Stencil8 view must read 0, and a DontCare,
  unstored pass that draws where the stencil is 0xA5 must draw nothing.
- A Private RGBX8Unorm tiled texture of two levels over a Private buffer,
  whose second level the take leaves (LaterLevels::Kept): its second
  level written by a blit, released, and another made over another
  buffer takes the image; its second level must read what a new
  texture's does.

Why: the shadow's other aspect, a tiled texture's kept later levels and
the surface depth twin start as their memory lies for Private storage,
while no copy writes them: a program can read another process's texels
there. The fix follows.

Verified: written to fail without the fix (lavapipe run follows).
2026-11-12 23:06:41 -08:00
Anees Iqbal 9437ea2517 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 23:05:00 -08:00
Anees Iqbal ab8bd0c700 RUNTIME_VERSION 2198: a completed command buffer's last host-import frees go to the free thread
The host-pointer imports a completed command buffer frees last are now posted to the device's
paced free thread instead of being freed back to back on the completion handler thread, where a
burst held the scheduler's submits (on NVIDIA up to 29 ms a free, bursts of 173). The import's
deallocator and keep-alive still run after its vkFreeMemory, a full queue or teardown frees in
place, and a program's own release still frees in the release. That changes runtime behaviour.

Verified by the change's own runs: lint 24371. 2080 A/B in one process (24385): pings beside a
round of 64 MiB x4 frees 0.168 / 3.21 ms (median / p99) posted against 2.264 / 6.44 ms in place;
512 KiB x32 0.143 / 0.65 against 0.193 / 1.04 ms. A deallocator may now run up to about 16 ms
after wait_until_completed returns.
2026-11-12 23:04:21 -08:00
Anees Iqbal 52fb9edac3 The completion leg measures the frees posted and in place in one process, alternating
A loaded host made a before-and-after pair of 2080 runs incomparable (the first bench's own 64 MiB
frees took 2.1 ms in one and 44 ms in the other). The leg's rounds now alternate between the
release's posting and the in-place free it replaced (free_thread::FREES_IN_PLACE, a device-test
stand-in, never a product switch), so both forms meet the same host, and print per form.

Verified: in the 2080 job that ran it.
2026-11-12 23:03:45 -08:00
Anees Iqbal 41b5430f6a A completed command buffer's release posts the host imports it frees last to the free thread
On NVIDIA each vkFreeMemory holds the device's other vkQueueSubmits while it runs, and a
completed command buffer that let go of no-copy buffers' imports last freed them on the thread
that runs the next completed handlers, back to back and unpaced. Now, inside a completed command
buffer's release (free_thread::AtCompletion), an import whose free a deallocator or a keep-alive
waits for is posted to the device's free thread, which paces it as it paces a block's free; the
deallocator and keep-alive run there after the free, possibly after the command buffer's waiters
returned. The queue stays bounded at 64: a post that finds it full, the teardown begun or no
thread frees in place. An import nothing waits for is freed in place, before the waiters return,
as the caller may unmap its pages once they did. A program's own release still frees in the
release. No switch, nothing by vendor.

The paths: HostImport::drop (a pin's last hold at completion), and rebind's Retained, a command
buffer's hold of a releasable import's objects (Imported::let_go_at_completion). The posted
objects hold the device through holder handles (device/holds.rs), so the program's last drop on a
program thread waits for them, and the thread frees them unpaced once the holds stopped. Where the
program's last drop ran on a runtime thread, a posted import can hold the device's last share:
the teardown then runs on the free thread, which frees what is still queued in place of waiting
for itself and ends unjoined.

Counted: WorkCounts::host_import_frees_posted; memory_frees_paced counts their pacing.
docs/FAST-PATHS.md's known gap on NVIDIA's frees is updated, and the Deallocator doc names the
free thread.

Verified: tests::completion_import_frees (posted with a deallocator, in place with none, and the
teardown on the free thread), the runtime suite and lavapipe device tests in the check job, and
the 2080 bench before and after.
2026-11-12 23:03:45 -08:00
Anees Iqbal f27fe52e9d The import free hold bench's completion leg: imports a completed command buffer frees
A leg beside the free-hold bench's own: the same pinger, beside rounds of 32 no-copy buffers of
512 KiB and of four of 64 MiB whose command buffer's completion lets go of their pages last (each
copied from once, then released while the command buffer is in flight), each deallocator noting
when it ran. Printed per size: the frees' runs, how long after the wait the last deallocator ran,
and the pings beside a round against the quiet ones, with the free thread's counts. The bench's
device, pinger and device name are shared helpers now.

Verified: built in the 2080 job that ran it (the numbers go with the change that follows).
2026-11-12 23:03:45 -08:00
Anees Iqbal 126a6fe5b6 The GPU form's text: its two continued lines joined as written, and the note's hold on its scratch documented 2026-11-12 23:03:45 -08:00
Anees Iqbal a86b8aadfa The GPU form's arguments read as arrays of four words 2026-11-12 23:03:45 -08:00
Anees Iqbal 177ef10860 The GPU-form trail test executes commands a blit's copy wrote, which take the GPU form 2026-11-12 23:03:45 -08:00
Anees Iqbal c97c811f03 Named: drop an unused method 2026-11-12 23:03:44 -08:00
Anees Iqbal 55849c9934 A resource state encoder's trail name is a Named too 2026-11-12 23:03:44 -08:00
Anees Iqbal e108fbcbb7 The trail's part forms: iterate the recorded parts through their list 2026-11-12 23:03:44 -08:00
Anees Iqbal bbf86acd0e The encoder trail names each execution's GPU form, and its line reads the form's scratch while pending
The 3090 hang's rerun (its trail line, read in place) named a pass whose two executions of
indirect commands, both through ranges a buffer holds, carried no host-step note: commit recorded
them for good in their merged GPU form (render/executions/gpu.rs), where the trail noted nothing,
so the line could not tell what the GPU read.

encoder_trail.rs:
- GpuForm: an execution's GPU form, its shape (recorded at commit or by its host step, merged or a
  draw per command, indexed, primitive type, the commands its preprocess runs over and from where,
  and the range buffer's offset), with its scratch region, layout and the command buffer's status
  words.
- Named: a part's (and a batch's) trail text with the GPU forms its executions took; the line's
  front batch is described with each form's scratch read now: the range the GPU copied, the
  merged draw's two VkDrawIndirectCommands, the commands whose arguments draw, their vertices or
  indices times instances and the most of them (its index entry where indexed), and the status
  words. The last-completed batch keeps its text alone.
- Step carries forms through a host step; commit's recording of each segment runs under a Step of
  its own (CommandBuffer::noting_forms), whose forms alone it keeps, joined to the part that holds
  the segment (State::trail_forms).

upload.rs: Upload::glimpse, volatile u32 reads of a region of the host-coherent chunk mapping,
read-only, no lock, no wait. completion.rs: the line's names are taken under the pending lock and
formatted (and the scratch read) after it. Off, nothing changes: no note is made.

Test: tests::trail_gpu_forms (device): four CPU-written triangle commands through a range buffer
of [1, 2], recorded at commit merged; after completion the form reads the range 1+2, the merged
draws [2147483646 x 0; 48 x 1 from vertex 2^31], 2 drawing arguments (7x2, 12x3), the most
command 2's, no fault.
2026-11-12 23:03:44 -08:00
Anees Iqbal 5009abbc40 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 22:59:10 -08:00
Anees Iqbal 01d290ce6e SEMANTICS_VERSION 2079, RUNTIME_VERSION 2197: matmul2d of 8-bit floats into float
matmul2d now translates e4m3 and e5m2 products into a float destination in the shape qualified on
the M3 Max (32x32x32, static k, one simdgroup), decoding each byte exactly. Anything outside that
shape keeps a typed refusal. On a device with its own 8-bit float type (VK_EXT_shader_float8), it's
refused NotImplemented until the native conversion is built, so no device emulates where a native
form exists (owner rule 1). VK_EXT_shader_float8 is enabled where listed. That changes the
translation (SEMANTICS) and the device enables (RUNTIME).

Verified by the change's own runs: 261/261 touched tests (24411, 24435); lint 24487 and 24492.
Lavapipe against the 18 M3 cases: 11 Match, and 7 e5m2 Mismatch that differ only in NaN words
(Metal 0x7fc00000 against llvmpipe's 0xffc00000), classified Unbounded{NativeNanEncoding}.
Census rows 327-330 go from refused at the type check to the linked-function endpoint.
2026-11-12 22:58:29 -08:00
Anees Iqbal 9689f5934b matmul2d of 8-bit floats: refused where the device has its own 8-bit float type
Owner rule 1: where a device has a native 8-bit float type, its conversion is the only
form. VK_EXT_shader_float8 (whose shaderFloat8, the SPIR-V capability Float8EXT, Vulkan
requires of every device that lists it) is the vocabulary's ExtShaderFloat8, enabled where
the device lists it. The matmul2d expansion records whether a lowered run reads 8-bit float
elements (Entry::float8_products, from the run's operand types), and selection refuses such
an entry, Unsupported{Tensors, NotImplemented}, where the extension is enabled: the
conversion through the device's type is not built yet. Elsewhere the integer decode stays
the form. Of the committed profiles, nvidia-rtx50-linux and nvidia-rtx5080-laptop list it;
their 8 opened validation contexts each enable it (opened_chains.txt blessed). REFUSALS.md
and api_signatures.tsv regenerated.

Verified on msi (m3-max-24411, m3-max-24435): 261 of 261 touched tests (matmul2d, tensor
ops, the device vocabulary and enables, requirements, the codec, ash interop, the signature
table) pass, among them fp8_products_are_refused_where_the_device_has_its_own_8_bit_floats
(both RTX 50 profiles refuse e4m3 and e5m2; RADV and lavapipe translate and validate) and
the fused-sum tests on MoltenVK, RADV and lavapipe.
2026-11-12 22:57:49 -08:00
Anees Iqbal 7c83d0cdc0 engine_matmul2d: 8-bit float products are Metal's sequential fused sums
tns_mm_fp8's 14 variants (e4m3 and e5m2; B transposed or not; multiply or
multiply_accumulate; A or B staged in threadgroup memory) on MoltenVK, RADV
and lavapipe profiles: random finite bytes, each decoded exactly with its
subnormals (e4m3 0x7F as 480, measured), summed by fma in k order from C or
+0.
2026-11-12 22:57:49 -08:00
Anees Iqbal 8a572683ab matmul2d: 8-bit float products into float, as qualified on the M3 Max
The lowering of tns_mm_fp8's measurements: e4m3 and e5m2 inputs into float are modeled
types; an 8-bit element reads as the float of its value through integer arithmetic on its
byte (e4m3 without NaN, 0x7F and 0xFF as +-480; an e5m2 NaN as 0x7FC00000), and the sums
are the existing fused sums, as for the other input types. A product of 8-bit floats beyond
the measured 32 x 32 x 32 on one simdgroup, with relaxed precision, a transposed left input
or a cooperative input, stays a typed refusal (Unsupported{Tensors, NotImplemented}), and a
tensor with scale factors keeps its refusal.

Verified with the next commit's engine tests (m3-max-24353).
2026-11-12 22:57:49 -08:00
Anees Iqbal 25542eee62 Metal observations: the 18 tns_mm_fp8 cases, qualified on the M3 Max (macOS 27.0.1)
corpus-metal qualified all 18 (m3-max-23924). Read against a model: the destination of an
8-bit product places its elements as the measured destination layout does (4 of 4); every
byte of both formats decodes exactly, subnormals kept, in A and in B; e4m3 has no NaN (0x7F
and 0xFF read as +-480); e5m2's infinities are infinities and its NaNs give the quiet NaN
0x7FC00000; and the sums are Metal's sequential fused sums from C (multiply_accumulate) or
+0 (multiply), k ascending, over the pair, C-position and random tiles of all 14 variants.
2026-11-12 22:57:49 -08:00
Anees Iqbal 44d03e1562 Authored cases: matmul2d of 8-bit floats into float, and its destination's layout
18 cases over the owned fixture tns_mm_fp8: 14 of tns_mm_fp8 (e4m3 and e5m2, 32 x 32 x 32,
B transposed or not, multiply and multiply_accumulate, A and B in device memory or one of
them in threadgroup memory), each over seven tiles (an A and a B decode table of every
finite byte, special values, diagonal pairs, C positions, two random tiles), and 4 of
tns_coop_fp8 (the destination's layout for e4m3 and e5m2, B transposed or not).

Installed with corpus-case-check --install (m3-max-23915).
2026-11-12 22:57:49 -08:00
Anees Iqbal bfe7851144 tns_mm_fp8 fixture: matmul2d of 8-bit floats into float, and its destination's layout
An owned MSL fixture built for macOS 27 (the _v2 runs), over one descriptor: 32 x 32 x 32
on one simdgroup, metal_fp8_e4m3_format and metal_fp8_e5m2_format A and B into a
cooperative float destination, B transposed or not, multiply and multiply_accumulate, A and
B in device memory or one of them in threadgroup memory (tns_mm_fp8). tns_coop_fp8 records
where such a product's destination places its elements, as tns_coop_left does.

Compiled with scripts/regen-air-fixtures (metal 32023.922, SDK 27.2).
2026-11-12 22:57:49 -08:00
Anees Iqbal 5775423a6d Re-bless the golden tables at f9528cb605
Half values held at 16 bits (SEMANTICS_VERSION 2078) change the SPIR-V of the half-computing
golden kernels: 99 rows move under unchanged keys. The engine inventory and printouts did not
change (m3-max-24483).
2026-11-12 22:51:55 -08:00
Anees Iqbal f9528cb605 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 22:49:04 -08:00
Anees Iqbal 41bd685869 SEMANTICS_VERSION 2078, RUNTIME_VERSION 2196: half values held at 16 bits; multisample ShaderWrite images list their views
Under the 16-bit float controls, a module that computes half in 16 bits now holds its exact halves
as f16 values, with f16 variables and 16-bit arithmetic, instead of widening each one to f32 and
narrowing it back. That's the device's native half form (owner rule 1), and it changes the
translated SPIR-V (SEMANTICS). Dot and mix keep their existing NativeDot and NativeMix notes, now
with the 16-bit bounds. A multisample keeps-uncompressed image that takes no storage usage now
lists its views, as the same texture without ShaderWrite does, so ANV clears it to any colour
fast. That changes how the runtime makes images (RUNTIME). The golden tables move with the half
form; they are re-blessed on development.

Verified by the changes' own runs: hnq_half_layer_composite on the Iris profile goes from 633 to
68 OpFConvert, spirv-val passes (24364); half engine tests 84/84 (24388); metal2vulkan 3524/3525,
the one failure being golden_hashes before the bless; clippy and rustdoc green (24418); release
translation time and memory unchanged on um790 (24445). Multisample: runtime lib 1512/1512 and
clippy green (24437). The Iris clear measure (24451) is pending.
2026-11-12 22:48:20 -08:00
Anees Iqbal 0688c09fbf Multisample plan: test the layout's sample count, not a flag constant the type lacks
Verification: job 24415 (msi) failed to compile 699c21094b at this line
(no SampleCountFlags::TYPE_1); the lint and tests follow.
2026-11-12 22:47:33 -08:00
Anees Iqbal 835f33c154 A multisample ShaderWrite texture's image lists its views, so ANV clears it fast
A colour texture Metal keeps uncompressed (ShaderWrite, no PixelFormatView)
whose image takes no storage usage was planned as a mutable image of any
format. For a multisample one (the device stores no samples) that serves
nothing Metal answers: its heap size and alignment, the reach of its clears
and what it reads before a write are the runtime's model of Metal's
compression (texture/heap_tiled.rs, clear_reach.rs), not the image's, and ANV
keeps such an image's MCS whatever its view formats (format-agnostic). But
ANV clears a multisample image without a complete view list to its default
value only (anv_image.c), so a non-default clear is a slow clear: an Iris
walk did 588 SLOW_COLOR_CLEARs of a 4x RGBA8Unorm ShaderRead | ShaderWrite |
RenderTarget texture at a 0.203 ms median, 126 ms over the walk. Such an
image now lists its views as the texture without ShaderWrite does
(multisample keyed on its sample count and usage, every device). A
single-sample one keeps the any-format image. On MoltenVK the image's Metal
texture takes PixelFormatView only where a listed format is not its own or
its sRGB twin (MVKImage.mm's needsReinterpretation), so it may now be
compressed there, which is its memory alone.

tests::image_plan::a_multisample_shader_write_image_lists_its_views: on every
committed profile and pixel format, a 4x ShaderWrite colour texture whose
image takes no storage usage plans as the ShaderRead | RenderTarget one
(listed views, never any-format), the Iris Xe's 4x RGBA8Unorm included.

Verification: not yet run (the runtime's plan tests and lint follow, then
one Iris clear measure).
2026-11-12 22:47:32 -08:00
Anees Iqbal 6410b3be28 Half holding: clippy's redundant guard; the shape tests read the 16-bit form
rounded_operands matches its operations in the pattern (clippy's
redundant_guard). Under the 16-bit float controls the module now holds its
halves at 16 bits, so two shape tests count what that leaves:
engine_arith's half chain is one widening (the float sum of halves it
narrows is the 16-bit sum, the chain reads its 16-bit results) with no
barred rounding; engine_native_half's controlled kernels narrow only at
their roundings, each decorated, and widen their result once.

Verification: job 24377 (msi) ran clippy (the redundant guard, fixed here)
and the half engine tests: 82 of 84 passed, the two failures being these
shape counts (20 conversions expected, 1 found; 5 expected, 3 found).
2026-11-12 22:47:26 -08:00
Anees Iqbal 158f9788b5 Half holding: the dot and mix bounds are NativeDot's and NativeMix's, a test, the docs
A half dot or mix already records NativeDot or NativeMix on every device,
so the DeviceArithmetic scan the previous commit added in compile.rs is
removed, and those two notes' docs (artifact.rs, docs/API.md's catalogue)
and docs/FAST-PATHS.md's device-gap row now state the 16-bit form and its
bound: a 16-bit dot of n lanes within (3n - 1) * 2^-11 * sum |a_i b_i| +
(3n - 1) * 2^-25 of Metal's chain (2n - 1 correctly rounded 16-bit
roundings beside Metal's n), a 16-bit mix within 2^-8 of its two terms plus
2^-22. narrow.rs's module docs, lower/arith's dot and mix comment, and
docs/ARCHITECTURE.md (the tidy stage and the spirv/ map) name the pass.

tests::engine_half_hold: a kernel of half min, max, clamp, dot, mix, a
loop-carried half and a thread array of half; on the Iris Xe and RADV
profiles it narrows no exact half, its four input roundings are its only
narrowings and its result's its only widening, its dot, mix and bounds are
16-bit instructions, no float variable stays 32-bit, it answers 33.25 on
the interpreter, passes L3 and records NativeDot and NativeMix; on lavapipe
(Converted) nothing is held and it answers the same.

Verification: not yet run (the build and tests follow).
2026-11-12 22:47:26 -08:00
Anees Iqbal 081fea3239 Half values held at 16 bits where the module computes half in 16 bits
Under the 16-bit float controls (QuantizeForm::Controlled), a module that
computes half in 16 bits held every other half value widened in an f32: each
16-bit + - * sat between conversion pairs, and min, max, clamp, select, mix,
dot, the demotion variables and the thread arrays read and wrote the f32. The
device's native form of half arithmetic there is its 16-bit instruction (rule
1), so a new IR pass, spirv::half_hold, runs after emission and the dead-code
pass:

- an f32 scalar or vector is an exact half where it widens a 16-bit float, is
  a constant of halves, an undefined value, a load of a held variable, the
  member an extract takes from its construct, or a move or exact operation
  (select, composite moves, shuffle, negate, abs, min, max, clamp, sign,
  floor, ceil, trunc, round) of exact halves; each gets a 16-bit twin
  computed by the same instruction, and a narrowing of one is its twin;
- a Function or Private variable of f32 scalars, vectors or arrays of them,
  reached only by loads and stores (through access chains or not) of exact
  halves, holds the 16-bit type;
- an f32 sum, difference, product, product by a scalar, dot product or mix
  of exact halves whose every use narrows it is the 16-bit instruction; the
  first four answer the same half (f32 carries 2p + 2 bits, correctly
  rounded under the controls), a dot product and a mix are within the
  device's bounds and pipeline/compile.rs records DeviceArithmetic for them;
- comparisons, NaN and infinity tests and conversions to integers of exact
  halves read the twins.

Verification: none yet in this commit; the build, the hnq FConvert count,
the half engine tests and the golden tables follow.
2026-11-12 22:47:26 -08:00
Anees Iqbal be1e8bb311 Re-bless the authored compile census at 6019f4e510
The census at the pin-65 tip (m3-max-24421): 2351 cases, 48292 compiled, 1079 refused, 0 failed,
0 differences, 0 regressions. Only the product fingerprint moved. The golden tables at the same
tip (m3-max-24420) needed no change.
2026-11-12 22:36:03 -08:00
Anees Iqbal 6019f4e510 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 22:31:05 -08:00
Anees Iqbal c35df96940 The memory log's lines state glibc's heap and the process's heap trims
A default-off diagnostic (METAL2VULKAN_LOG_MEMORY). Where the process's
allocator is glibc's (Linux, the GNU environment), each line of the memory
log now ends with glibc's heap at that moment, every arena's, as mallinfo2
states it (bytes in use, bytes free, what its arenas hold, what it mapped
apart) and the malloc_trim calls the process's large makings made so far
(a process-wide count beside WorkCounts::heap_trims). A resident set that
grows and stays then reads, in one run, as free heap glibc keeps, heap in
use, or memory malloc did not map. Elsewhere the lines are unchanged.

Test: the_memory_log_states_glibcs_heap_where_it_is_the_allocator.
2026-11-12 22:29:54 -08:00
Anees Iqbal 0bdd04f9cd Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 22:29:34 -08:00
Anees Iqbal 32759c0a9a SEMANTICS_VERSION 2077, ARTIFACT_FORMAT_VERSION 515, RUNTIME_VERSION 2195: four-copy fan-out tier
A rate-mapped draw whose triangles reach at most four region pairs now fans out through a
four-copy draw variant, chosen from the probe's measured triangle span (never by device). Other
draws keep the sixteen-copy variant, and the commit's settle begins both. The translator's link
and codec gain the tier (SEMANTICS, ARTIFACT_FORMAT), and the runtime picks it (RUNTIME). Counted:
WorkCounts::rate_map_fanned_few_draws.

Verified by the change's own runs: clippy and tests 24351 (0 messages, 20 passed). 780M warm
29.7/30.8 against 36.8/34.5 ms (24369), cold 40.2/43.9 against 61.9/62.7. Iris holds at 47.7/40.0
(24317) and the 3090 at 28.6/6.1 (24316). rate_mapped_fan_out draws 6 of few copies, 0 made at
the step, on all three.
2026-11-12 22:28:53 -08:00
Anees Iqbal 47ee9f4806 Fan a rate-mapped draw out through four copies where its triangles reach at most four regions
A host step's fanned-out draw went through one geometry-stage variant that
declares the output of the most copies (up to 16) for every triangle, though
most draws' triangles touch only a few regions. The declared output size is
what the 780M's geometry stage pays for.

- The translator: RegionFanOut::DrawFew, the draw variant whose loop emits
  at most FEW_COPIES (4) copies and whose geometry stage declares 3 x 4
  output vertices; its codec name and compile-key word (" region_fan_out
  few"); the link and engine tests cover the three modes.
- The probe: each draw's words grow to 1 + 2 x PROBE_COUNT_WORDS (65): its
  flag, the 32 count lanes, and 32 wide lanes, where a triangle whose
  widened pair count exceeds FEW_COPIES stores 1 (picked by PrimitiveId
  mod 32, as the counts are). The host reduces them to (flag, copies, wide).
- The runtime: a fanned-out draw no triangle of which is wide draws
  through DrawFew, else through Draw; commit's settle begins the three
  variants (probe, few, most). Counted:
  WorkCounts::rate_map_fanned_few_draws.
- The pieces lane prints the count. The runtime test's 8 commands add one
  whose triangle covers four tiles a side (more regions than four, no more
  than the most copies), drawn through the most copies, and assert the
  other 6 fanned-out draws took four; the pixels are still the encoder's
  region-by-region draws'.
- docs/FAST-PATHS.md: the fan-out row names the variant and its count, and
  its cost cell carries the numbers below. bind/fan_out.rs: FEW_COPIES's
  numbers.

Verified, release binaries, runtime_lane::rate_mapped_pieces and
tests::rate_mapped_fan_out, the command buffer's GPU time, cold then warm:
- Radeon 780M (Mesa 26.2.6), m3-max-24369, this change plus a scratch
  switch (never landed) drawing every fanned draw through the most copies,
  interleaved in one job: 4 copies 40.2/29.7 and 43.9/30.8 ms; the most
  copies 61.9/36.8 and 62.7/34.5 ms. Warm about 5.4 ms (15%) less.
  64 of 64 draws of four copies.
- Iris Xe (Mesa 26.2.6), m3-max-24317: 47.7 ms cold, 40.0 ms warm (40.5
  warm through the most copies in an earlier run); 64 of 64 of four copies.
- RTX 3090 (NVIDIA 620.70.06), m3-max-24316: 28.6 ms cold, 6.1 ms warm
  (6.2 ms before); 64 of 64 of four copies.
- tests::rate_mapped_fan_out on all three: 3 passed, 6 drawn of few
  copies, the fan-out's pipelines 3 ready plus waited, 0 made at the step.
The Iris and 3090 runs are of the same change at base 9c30ffd263; the
780M's at bfcd63c5e2. Clippy (translator, runtime, validation,
conformance, --cfg m2v_gpu and m2v_gpu_hazards, all features) and the
translator's fan_out and api_surface tests: m3-max-24351, at bfcd63c5e2,
0 messages, 20 passed. signatures.py --check passes; REFUSALS.md
unchanged.
2026-11-12 22:28:15 -08:00
Anees Iqbal 716db41c5d Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 22:21:01 -08:00
Anees Iqbal 75ada11883 RUNTIME_VERSION 2194: a kept draw is kept under the outside state as its steps began
A draw is now kept under the outside state another thread may change (no-copy moves, sampler
slots, rebinds, the host alias version) as of the start of its steps, not as of its keeping. So a
change landing meanwhile, such as the in-place check making a no-copy buffer over host pages,
makes the next draw take every step instead of replaying a draw kept under a state it never read.
In debug this panicked "a draw again kept no draw" (draw_again.rs:994). That changes runtime
behaviour.

Verified by the change's own runs on lavapipe: the forced repro panics without the fix at
draw_again.rs:994 and passes with it (24375); draw_again, lone_fetch and pass_end_tiles 44/44
(24375); runtime suite 2443/2443 (24363); clippy 24376 and 24340.
2026-11-12 22:20:22 -08:00