Commit Graph
3751 Commits
Author SHA1 Message Date
Anees Iqbal 7102a9b1b1 tests::export_dedication: a buffer of the picture's size and one of the check's, failures gathered
What: for each handle type the test makes two exportable buffers, of a 4K NV12 picture's bytes and
of the in-place check's (in_place_check::BUFFER_BYTES, now pub(crate)), asks the device's
dedication answers at each length, and gathers every failed hold (a dedicated allocation where the
device requires none, or the reverse; a texture over shared memory that is not in place or made a
shadow), so every buffer's allocation, placement and the check's notes print before it fails. The
texels' read still fails at once.

Why: on the RTX 3090 (NVIDIA 620.70.06, gem10, job m3-max-14662) the driver prefers no dedicated
allocation for an exportable buffer of the picture's 12,441,600 bytes either, so the test's
dedication hold could not fail there; it prefers one for the check's 40 MiB buffer, which is what
left the exported-fd class unchecked under the old rule. A buffer of that length makes the hold
bite where the driver's preference does.

Verified: the control (this tree with exported_memory.rs as of 789abcbd07) and the fix run on the
3090, the 780M and the 5080 in the jobs after this commit. cargo fmt --all.
2026-11-11 03:56:01 -08:00
Anees Iqbal a91b296bf5 tests::export_dedication: the exportable buffer is a 4K NV12 picture's size
What: the test's exportable buffer, and the buffer whose dedication it asks the device about, are
LENGTH bytes (3840 x 2160 x 3 / 2, the consumer's decoded frame) instead of 1 MiB; the texture
still lies over its first SIDE rows.

Why: the driver's preference follows the size. On the RTX 3090 (NVIDIA 620.70.06, gem10, job
m3-max-14627) the 1 MiB buffer was preferred no dedicated allocation, so at the pre-fix commit
789abcbd07 the test's own buffer lay in a shared block and only the in-place check's 40 MiB
buffer (dedicated, so the class unchecked and the texture Shadow(Unchecked { Reads, OnLines }))
failed it. The dedication assertion was vacuous there; at the consumer's size it is asked of the
buffer the consumer makes.

Verified: the control (this tree with exported_memory.rs as of 789abcbd07) and the fix run on the
3090 and the 5080 in the jobs after this commit. cargo fmt --all.
2026-11-11 03:56:01 -08:00
Anees Iqbal 5a8a1fd0c2 tests::export_dedication: print the device's answers through Display, so each is read
What: Dedication loses its derived Debug and prints through a Display impl that names each answer
(exportable, dedicated only, prefers dedicated, requires dedicated); the EXPORT-DEDICATION line
uses it.

Why: under --cfg m2v_cpu_icd (and m2v_gpu) the lib test build warned that `prefers` is never read
(dead_code ignores derived Debug impls; job m3-max-14523 on ms01), and warnings are errors in CI.
`prefers` is the answer the measurement is for (NVIDIA prefers a dedicated allocation where it
requires none), so it stays, read where it is printed.

Verified: the builds and clippy in the three configurations run in the jobs after this commit.
cargo fmt --all.
2026-11-11 03:56:01 -08:00
Anees Iqbal fcd4dfdc36 HOWTO section 7: what an opaque file descriptor's import names, in a shared block or not
What: docs/HOWTO.md section 7 says how CUDA and another VkDevice import export_memory_fd's
descriptor: ExportedMemory's allocation_size as the import's size, the dedicated flag only where
`dedicated`, the buffer at `offset` for `length` bytes, and that a buffer outside a dedicated
allocation lies at an offset in a block other exportable buffers share, which the import reaches
whole.

Why: the previous commits keep an exportable buffer out of a dedicated allocation where the
driver only prefers one, so on NVIDIA its export now answers dedicated false, a non-zero offset and
the block's size where it answered dedicated true, offset 0 (or the aligned byte's lead) and the
buffer's own size. ExportedMemory and Buffer::export_memory_fd already carried those fields and
said so; the guide showed only the dma-buf import. No API change.

Verified: docs only. cargo fmt --all.
2026-11-11 03:56:01 -08:00
Anees Iqbal abd65c6bdf In-place check: CHECK_VERSION 18, so an exported-fd verdict kept from a dedicated allocation is measured again
What: in_place::CHECK_VERSION goes from 17 to 18.

Why: the check's exported-fd class makes its buffer through exportable_buffer, as the product
does. Before the previous commit, on a driver that only prefers a dedicated allocation for an
exportable buffer (NVIDIA), that buffer was its own dedicated allocation, no image binds there
(VUID-vkBindImageMemory-memory-10926), and exported_pages answered Unmade::lasting: the class was
recorded unchecked for a cause that lasts for the driver's identity, in the record the shader
cache's directory keeps, named by the driver and CHECK_VERSION and not by RUNTIME_VERSION. A device
of the same driver reading that record runs no check of the class again, so every texture over an
exportable buffer would stay a ShadowCause::Unchecked shadow on a host that ran the old runtime
(the consumer's RTX 5080 Laptop, 615.71.09), whatever the fix. With the new version the old record
is never read (its name and the version it holds differ; tests::in_place's record tests hold
that), and the check measures the class over the buffer in its shared block.

Verified: the change is the constant alone; the record tests run with the runtime's touched tests
in the jobs after this commit. cargo fmt --all.
2026-11-11 03:56:01 -08:00
Anees Iqbal d203c0b5f4 Runtime: an exportable buffer takes a dedicated allocation only where the device needs one
What: exportable_buffer's buffer is its own dedicated allocation where the device exports
such memory only so (DEDICATED_ONLY) or requires one (requiresDedicatedAllocation); a
driver's preference (prefersDedicatedAllocation) alone no longer makes one, so the buffer
lies in the block exportable buffers of its handle type share. Docs: exported_memory.rs
(module and Device::new_exportable_buffer), memory.rs (module, NoImage::Dedicated),
texture.rs, the runtime README and docs/HOWTO.md section 7 say the same.

Why: no image may be bound to a dedicated allocation (VUID-vkBindImageMemory-memory-10926)
and a texture over an exportable buffer is an image in its memory, so on NVIDIA (reims's
RTX 5080 Laptop, 615.71.09) every texture over the consumer's exportable caches was a
shadow, ShadowCause::Unchecked (2862 of 4112 IOSurface-plane shadows; 12.4 MB copied in per
plane use, 30 MB back per composite). The owner's rule: a texture over exported memory stays
in place even if slower; a shadow only where in place is impossible.

Verification pending (parked for the 780M regression): tests::export_dedication on the
3090 at c63787840b (the measurement and negative control) and at this commit; clippy and
the 5080 entry still to run. cargo fmt --all.
2026-11-11 03:56:00 -08:00
Anees Iqbal 21876fd551 Tests: an exportable buffer's dedication and the texture over it, per handle type
What: tests::export_dedication asks the device, apart from the runtime, what it answers of
exporting a buffer's memory of the runtime's usage (exportable, DEDICATED_ONLY,
prefersDedicatedAllocation, requiresDedicatedAllocation) and of a linear R8_UNORM image made
for the handle type, prints both (EXPORT-DEDICATION), then makes an exportable Shared buffer
of each handle type the device exports and a texture over it, and prints the allocation and
the texture's placement once the in-place check answered, with the check's notes. It holds
that the buffer is dedicated exactly where the device requires it, and that where its memory
is shared and the image needs no dedicated allocation the texture lies in place with no
shadow.

Why: reims's RTX 5080 (NVIDIA 615.71.09) makes every texture over an exportable buffer a
shadow (ShadowCause::Unchecked, 'the device's check made no image over the runtime's memory
exported as opaque file descriptors'): exported_memory.rs gives the buffer a dedicated
allocation where the driver only prefers one, and no image may be bound there
(VUID-vkBindImageMemory-memory-10926). This commit is the repro and measurement; the fix
follows. Runs on potluck after this commit. cargo fmt --all.
2026-11-11 03:56:00 -08:00
Anees Iqbal de15678626 RUNTIME_VERSION 2023: no-copy buffers take the dma-buf route without the host-pointer extension
12a8a907bc..02a64274c5: on a device without VK_EXT_external_memory_host, a no-copy
buffer or guest RAM with a dma-buf source is imported as its dma-bufs instead of
refused; supportsResourceDetachBacking answers whether the device makes no-copy
buffers at all; Linux bit-24 memory is no longer refused for lack of an import
route. A run of an unchanged artifact can answer otherwise, so cached runtime
results are stale.

Version only; cargo fmt.
2026-11-11 03:35:43 -08:00
Anees Iqbal 1cdfd0edbd 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-11 03:35:36 -08:00
Anees Iqbal 02a64274c5 Pages with no route of their own may still lie in a guest RAM's chunk
On a device that imports no host pointer, an object over a guest RAM the device uses
(HostMemory::with_runs) with no dma-buf source of its own was refused by host_window before its
runs were routed to the RAM's chunk, so tests::host_ram_dma_buf::
without_pointer_imports_a_ram_s_chunks_are_its_dma_bufs failed on the Radeon 780M (RADV) and on
lavapipe (jobs m3-max-14705 and m3-max-14707): "HostMemory needs ExtExternalMemoryHost" at the
object, after the RAM was taken.

host_window no longer refuses; HostWindow::no_route is the refusal of pages with no route of their
own (not their pointer, no usable source, no copy), the same as before: naming
VK_EXT_external_memory_host on a device without it, not_importable elsewhere. A no-copy buffer,
heap or rebind with no runs is refused with it at once, as before; one with runs is refused with it
only where its pages lie in no chunk and an import of its own is needed. On a device that imports
pointers, by_pointer holds wherever the import alignment covers the range, so nothing changes
there; only where it does not (an alignment past the host page) may such an object now bind in a
chunk instead of being refused.

Docs: the no-copy buffer and heap refusals and HOWTO section 6 say a chunk-bound object needs no
source of its own.
2026-11-11 03:34:56 -08:00
Anees Iqbal 713b955ccf Device tests: no-copy buffers and guest RAM on a device made without VK_EXT_external_memory_host
tests::no_pointer_import makes the cfg's device with VK_EXT_external_memory_host withheld
(DeviceOptions::withheld_extensions), as a driver that lists none is, and checks, where the
physical device lists the dma-buf route (asked of the driver, not of the importer):
- a no-copy buffer over a sealed memfd mapped shared, 256 bytes into a page, whose memory has a
  udmabuf source, is made over imports of its dma-bufs (HostBacking::ImportedAsDmaBuf,
  WorkCounts::dma_buf_imports) with no pointer imported (host_pointer_imports_made) and the source
  called once; the GPU reads the file's bytes, its fill lands in the file's pages (the bytes around
  as they were), and it reads the CPU's later writes;
- a no-copy buffer and heap over memory with no source are refused, naming the extension, with no
  copy made and no pointer imported (where no route is listed, so is the sourced buffer).
tests::host_ram_dma_buf::without_pointer_imports_a_ram_s_chunks_are_its_dma_bufs: on that device a
RAM with no source is refused, naming the extension; one with a source is taken, its chunk the
source's dma-buf (host_ram_dma_buf_imports), no pointer import tried
(host_ram_pointer_imports_failed), the object over it in the RAM (HostBacking::InHostRam), read and
filled by the GPU in the file's pages.

host_residency's udmabuf_openable and Ram::source become pub(super) for them.

At the base (the previous commit's parent) the sourced buffer and the sourced RAM are refused with
"HostMemory needs ExtExternalMemoryHost", so the first and third tests fail there; job ids in the
branch's report.
2026-11-11 03:34:56 -08:00
Anees Iqbal 12a8a907bc No-copy buffers on a device without VK_EXT_external_memory_host take the dma-buf route
On a driver that lists no VK_EXT_external_memory_host but imports dma-bufs (Honeykrisp on Asahi, as
the consumer reported: a macOS guest's newBufferWithDescriptor answered nil, "HostMemory needs
ExtExternalMemoryHost", 704 times in one boot), every no-copy buffer, heap and guest RAM was
refused: Importer::new refused before the dma-buf route was looked at, and the importer held the
host-pointer extension's functions unconditionally.

The importer now holds the pointer import as an option (host_memory.rs's PointerImport: its
functions, page and minImportedHostPointerAlignment, and memory_types). Importer::new refuses only
where the device imports neither pointers nor dma-bufs (the pointer's refusal, naming the
extension, as before); a device with dma-bufs alone gets an importer whose pointer refusal stands
for every pointer (Importer::pointer_import). Every pointer-import site takes a PointerImport, so a
device without one never makes a host-allocation object: buffer_descriptor.rs (import_by_pointer,
import_pointer, import_pointer_again, import_backing), host_shared_pointers.rs (false there),
fresh_pages.rs and the page-buffer blocks (none there), the submission checks (unchecked there),
host_ram.rs's chunk import by pointer. The unit an import's pages round out to is
Importer::unit: the host page and the import alignment where the device imports pointers, the host
page alone where it imports dma-bufs. Every device that imports pointers keeps the same calls.

On a device that imports no pointer:
- a no-copy buffer, heap or rebind over memory with a source is bound in imports of its dma-bufs;
  memory with none is refused, naming VK_EXT_external_memory_host (host_window), as it was;
- memory of Metal's private option bit 24 that the runtime copies anyway (no read-only view on
  Linux) is no longer refused for lack of an import route, on any device;
- a guest RAM with a source is taken and listed (its chunks its dma-bufs, imported on demand), the
  pointer never tried; one with no source is refused, naming the extension, as it was;
- supportsResourceDetachBacking answers whether the device makes no-copy buffers (it has an
  importer), not whether it lists the extension.

Docs: the runtime README, HOWTO section 6 and the RAM copies' refusal, RUNTIME-PORTING, the
module docs of host_memory.rs, dma_buf.rs and host_ram.rs, HostBacking::ImportedAsDmaBuf, and the
refusal lists of the no-copy buffer, heap, RAM and RAM copy calls. docs/REFUSALS.md regenerated
(the HostMemory refusal's sites: PointerImport's and no_pointer_refusal).

Verified: the next commit's device tests (RADV on the Radeon 780M, lavapipe), which fail at the
base with the refusal; job ids in the branch's report.
2026-11-11 03:34:56 -08:00
Anees Iqbal 521f778bf6 A read-only device buffer may be a constant-space pointer
Apple's compiler declares a by-value kernel argument it passes as a constant pointer as an
`air.buffer` with `air.read` and `air.address_space 1` (a one-byte `char`): a Core Image kernel of
macOS 13.7's frameworks (AIR 2.5) declares its parameter block so, and the ABI check refused the
library with RoleTypeMismatch (the buffer's declared space against its pointer's). Metal takes the
shape: on the M3 Max (macOS 27.0.1, job m3-max-14624) our own kernel over `constant Params *p`,
its node rewritten to `device` read (with and without the `char` description) and reassembled with
metal-as, made a compute pipeline and wrote the same 32 floats as the kernel as Metal's compiler
wrote it.

abi::check's role_type now also accepts an `air.buffer` declared read-only in `device` space on a
`constant` pointer (read_through_constant). The buffer keeps its declared space and access, so the
planner binds it as a read-only device buffer; the entry's loads are through its pointer. A
writable buffer, or a `constant` buffer on a `device` pointer, is still a mismatch.

Tests: the ABI unit test of both the accepted and the still-refused forms; an engine test that
compiles our kernel with either node on lavapipe, moltenvk-m3, the 780M's RADV and the Vulkan 1.2
floor and passes L3; and a runtime device test that runs both forms and compares them with the
M3 Max's 32 floats. SEMANTICS_VERSION 2025: a refused input now translates.
2026-11-11 03:13:47 -08:00
Anees Iqbal e9d402a179 The two dispatches past 2^32 threads: their own wait, and they run alone
PR #15's a_flat_dispatch_switches_to_its_64_bit_count_at_the_workgroup_that_passes_2_32
timed out on lavapipe in round 6898863f3f (lvp 2/4, ms01, i9-13900H 20 threads,
job m3-max-14477): its command buffer passed the lane's 60 s WAIT beside the rest
of a parallel runtime lane. Each of the two such dispatches runs all 4.3 billion
threads, so a CPU device spends every thread on it: alone on lavapipe (llvmpipe,
LLVM 23.1.4) on a 16-thread Ryzen 7 7840HS they completed in 24.9 s and 23.7 s
(job m3-max-14623). A runner with fewer threads takes proportionally longer.

complete_within() takes the wait; edges_counted_once waits PAST_2_32_WAIT (600 s,
inside nextest's 20-minute terminate-after), and .config/nextest.toml runs both
tests alone (threads-required = num-test-threads), as the object-grid lane does.
A GPU completes them well inside a second; their assertions are unchanged.

Test only; the runtime-sources pin is unchanged. cargo fmt.
2026-11-11 03:02:00 -08:00
Anees Iqbal bba03354b8 RUNTIME_VERSION 2022: four runtime messages said once per device and kind
b39d22516f says heap-texture-refused, twin-decode-failed, late-reservation and
queue-limits-reached once per device and kind and counts each later one in
WorkCounts (the owner's rule, 11-11: a degradation, fallback or refusal is
logged once per kind, then counted). A run of an unchanged artifact now records
fewer messages, so cached runtime results are stale.

Version only; cargo fmt.
2026-11-11 02:49:39 -08:00
Anees Iqbal 9ba25c3437 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-11 02:49:32 -08:00
Anees Iqbal 320a0ded3a told_once, heap_refused_notice: ETC2RGB8, and no second lock inside an assertion
The pixel format is PixelFormat::ETC2RGB8; and an assertion whose message
locked the sink's list again while its condition held the lock would wait
on itself where it failed: each reads the list once.
2026-11-11 02:45:22 -08:00
Anees Iqbal b39d22516f Four runtime messages are said once per device and kind, each later one counted
What: metal2vulkan-heap-texture-refused (Info, a placement heap's texture not
made at an offset inside it), metal2vulkan-twin-decode-failed (Error, a decoded
twin's failed CPU decode), metal2vulkan-late-reservation (Warning, an ignored
late reserve_resource_ids call) and metal2vulkan-queue-limits-reached (Info,
each placement or queue-sharing read the queue limits changed, at device
creation, per queue made and per report) were said at every occurrence. They
now go through the degradations' once-per-device record: Announced keeps a
bit per kind of a closed vocabulary of messages that are no degradation
(degradation::Told), and Device::tell says a kind's first message on the device
(through its sink, else stderr) and counts each later one, without making its
text, in the kind's new WorkCounts field: heap_texture_refused_withheld,
twin_decode_failed_withheld, late_reservation_withheld,
queue_limits_reached_withheld. Device::inform_once is the informational form.
Every refusal and answer is as before; only the messages' rate changes.

Why: the owner's rule (11-11): a degradation, fallback or refusal message is
logged once per kind and device, later occurrences counted, never logged per
call. reims's sweep at ef7af82fe4 found these four firing per occurrence.

Tests: tests::told_once (each kind said once and its later one counted on
one device, said again on another; a second late reservation counted, not
said); tests::heap_refused_notice (the second refusal on a device counted, not
named; another device names its own first); tests::queue_limits_device (the
first case met is sent, every later one counted; a second read of the sharing
counts one more). api_signatures.tsv takes the four fields; the docs of the
four messages (texture.rs, resource_ids.rs, DeviceOptions::queue_limits, the
runtime README, docs/API.md) say the rate.

Verified: see the branch's report.
2026-11-11 02:45:22 -08:00
Anees Iqbal 4fc5f5b6e4 Expect grouped batches only where the device groups: merges and does not relay
runtime_lane::grouped_submissions expected grouped vkQueueSubmit calls wherever the
device's merge check held. The runtime holds batches in a group only where the check
held and the queue's failures are not relayed (command_buffer/group.rs `groups`: a
relayed batch takes a fence of its own, device/relay.rs). MoltenVK's queues are
relayed (DriverFact::QueueFailuresReportedByMessenger), so it never groups. On the
M3 Max lane, beside the lane's other tests, the merge check answered Holds (42.5 us
in one call of 4 against 87.9 us apart), and the checked run asserted a group that
the device cannot make: "0 grouped calls", 8 calls in all, "the driver merges: true".
Where the check answered Fails the same test took its plain branch and passed, so
the verdict alone decided pass or fail.

The tests now read the expectation from both facts (`groups`: `merges` and not
`commit_work::relays`); the printed line says whether the device groups. The tests
that assume the merge check (DeviceOptions::assume_submissions_merge) still assert
that the check held as assumed.

Verify: runtime_lane::grouped_submissions:: on lavapipe and PHOENIX (merges, no
relay: groups asserted) and on the M3 Max (relayed: the plain branch asserted).
2026-11-11 02:44:05 -08:00
Anees Iqbal 88ed42fc2a queue_order: the taken-up rounds begin once the device's submission checks answered
What: checked_commits_during_submissions_are_taken_up_promptly settles the
device's submission checks (Device::settle_submit_checks) before its rounds,
records each round's submission-check calls (WorkCounts::submit_check_calls,
none expected), and prints the round of the most own time with its numbers.

Why: on the RTX 5080 beside the validation lane (b5080 entry
bugs-a-item4-queue-order-012550 at 60efb70925), 40 of 40 runs passed and the
old bound's quantity (the later kernel after the earlier one's end) passed
40 ms in 20 of them, the driver's vkQueueSubmit time reaching 292 ms; but one
run's own time reached 36.7 ms, near PROMPTLY's 40. A lane device has a fresh
shader cache, so its submission checks run as it is made, on its first VkQueue,
which the rounds' command queue shares under the lane's queue limits: they hold
that VkQueue's lock for their own calls (not counted in batch_submit_nanos), and
on NVIDIA their imports and releases hold back every other thread's submission
(submit_check.rs). The failing round of the round at 7d7085f9d0 was round 2,
early, as such an overlap would be. Waiting for the checks' answer leaves the
rounds the scheduler's thread alone.

Verified: see the branch's report (5080 through b5080, gem10).
2026-11-11 02:44:04 -08:00
Anees Iqbal 246ce0755c queue_order: a checked commit's taking is timed at its submission handler, the driver's time apart
What: checked_commits_during_submissions_are_taken_up_promptly times when the
scheduler's thread took each of the two command buffers committed while it
waited for the VkQueue by their submission handlers (which run on that thread
once it took the batch: after its vkQueueSubmit returned, or as it held it for
one call with later ones), noting the host time and WorkCounts::batch_submit_nanos
there. The thread's own time is that time after the VkQueue's release less the
driver's time in between, for both; the sleeps are read once the later one is
taken. The kernel starts, the later one's start after the earlier one's end,
and the submissions are printed, not bounded.

Why: the round at 7d7085f9d0 failed it on the RTX 5080 Laptop GPU beside the
validation lane (msi, m3-max-13901, partition 1/2): round 2's later command
buffer started its kernel 63.4 ms after the earlier one's kernel ended, over
PROMPTLY's 40 ms, while the batches' vkQueueSubmit calls spent 71.5 ms in the
driver from the earlier one's check until the round completed, and no sleep
ended at its limit. The later one's bound began at the earlier one's kernel
end and assumed the earlier one's vkQueueSubmit had returned by then; NVIDIA's
call can return long after the GPU ran the work (or the later call block before
it starts), so the driver's time was counted as the thread's. The handler's
time and the counter read there leave neither the GPU's nor the driver's time
in the bound, and a wait of the thread's own (a sleep to its limit after the
check) still counts.

Verified: see the branch's report (5080 through b5080, gem10).
2026-11-11 02:44:04 -08:00
Anees Iqbal d0f48812c0 Golden printout of the rounding fixture, recorded under the pinned LLVM 21
tests::air_input::engine_fixtures_match_their_golden_printout compares every engine fixture with
its golden; the rounding fixture had none. Recorded by bless_engine_goldens on um790 (job
m3-max-14555) from the bitcode LLVM 21.1.8's llvm-as (Homebrew llvm@21) assembles from the
committed kernel_convert_rounding_modes.ll (sha256 bf1592327ce7...), fed to the test through
METAL2VULKAN_LLVM_AS by a scratch wrapper that answered only that file (one hit) and sent every
other fixture to the node's LLVM 23; only this fixture's file is kept.
2026-11-11 02:42:05 -08:00
Anees Iqbal 56bd9e3d63 Metal and MoltenVK observations of convert-rounding-forms-the-m3-compiles
corpus-metal qualified the case on the M3 Max (apple-m3-max-macos27.0.1, output 30dbaaab) and
corpus-moltenvk's candidate matched it (apple-m3-max-moltenvk), job m3-max-14441.
2026-11-11 02:42:05 -08:00
Anees Iqbal 9ed37b1d45 Case convert-rounding-forms-the-m3-compiles over kernel_convert_rounding_apple_gpu
64 threads, an integer and a float word each, through the 13 suffixed forms the M3 Max compiles
and answers as the conversion their types name (the guest's two refused forms among them),
compared exactly. Installed by corpus-case-check (job m3-max-14432): case id 48fb69561824.
2026-11-11 02:42:05 -08:00
Anees Iqbal 5d27d79c86 Rounding fixture companions: regenerated without fast math, with the narrowed M3 kernel
scripts/regen-air-fixtures/regen-air-fixtures.sh kernel_convert_rounding_modes on the M3 Max
(Apple metal 32023.922, macOS SDK 27.2, LLVM 21) in job m3-max-14415; TOOLCHAIN unchanged.
2026-11-11 02:42:05 -08:00
Anees Iqbal 3811e1c184 air.convert's rounding and .sat suffixes: the conversion the types name, as x86 Metal answers
The exact emulation of the directed roundings, the integer .sat clamp, float-to-int pre-rounding,
the RoundingModeRTE plan and PrecisionNote::NativeConversionRounding are removed; they stay in
history at 540011dd49. The parser accepts the suffix and the lowering is the plain conversion:
Metal's compilers disagree on the suffixes, and the owner's 11-07 rule takes the cheapest answer
inside the envelope where real Macs disagree.

Measured per form, 64 threads of the fixture's edge values, one kernel per intrinsic (probes
m3-max-14380 Radeon Pro 5300M and m3-max-14381 UHD Graphics 630, macOS 26.7.1; m3-max-14382 M3
Max, macOS 27.0.1):

  form                         M3 Max                 5300M            630            now
  float->int .rte              nearest even           truncates        no pipeline    truncates
  float->half .rtz/.rtp/.rtn   .rtz as named,         nearest even     as named       nearest even
                               no pipeline rtp/rtn
  float->int .sat              unsigned keeps a       8-bit not        no pipeline    clamps
                               negative's wrap, long  clamped, long
                               of inf is 0            clamped to int
  int->float/half any mode     .rte nearest even,     nearest even     nearest even   nearest even
                               no pipeline directed
  int->int .sat                no pipeline            wraps            wraps          wraps
  float->int .rtp/.rtn         no pipeline            truncates        no pipeline    truncates

The last three rows are no difference: every Mac that creates the pipeline answers the plain
conversion. OpenCL on all three GPUs (not Metal) answers the exact IEEE roundings. The M3's
compiler service exits (XPC_ERROR_CONNECTION_INTERRUPTED) on the forms it does not compile.

- metal2vulkan-air: Convert::parse takes `.<rte|rtz|rtp|rtn>` and then `.sat` (to an integer
  only), between numbers; the module doc carries the measurement. Test: every suffix parses to
  its plain form.
- Engine test: 24 forms with every rounding (and .sat to an integer) compile on lavapipe and on
  moltenvk-m3 without shaderInt64 to the plain conversion's module words and notes, and pass L3.
- Fixture: kernel_convert_rounding_apple_gpu now calls only the forms the M3 compiles and
  answers plainly, for a case qualified there.
- docs/API.md accepted differences: the table above.
- SEMANTICS_VERSION 2024 (development is at 2023); ARTIFACT_FORMAT_VERSION back to 500, with no
  codec change.

Verified: not yet run (dispatched next).
2026-11-11 02:42:04 -08:00
Anees Iqbal 0653416d97 Rounding fixture: an M3-compilable kernel, no fast math; the four cases withdrawn
Apple's M3 Max (macOS 27.0.1) creates no pipeline for any of the fixture's four kernels: its
compiler service exits (XPC_ERROR_CONNECTION_INTERRUPTED) on every directed int-to-float and
int-to-half form, float to half by rtp and rtn, float to int by rtp and rtn, and every integer
.sat form, one kernel per intrinsic (probe m3-max-14296). A Radeon Pro 5300M under macOS 26.7.1
creates every one (m3-max-14293). So the four cases could never be qualified on the reference
Metal and are withdrawn; the kernels stay for the engine tests and translation.

kernel_convert_rounding_apple_gpu calls only the 22 forms the M3 compiles (the guest's two refused
forms among them), over integer and float inputs, for a case the M3 can qualify. The source
compiles without fast math (metal-fast-math: off), so NaN, infinity and signed-zero operands and
infinite half results are defined questions. Companions regenerated next.
2026-11-11 02:41:52 -08:00
Anees Iqbal d4f3285585 Engine test inputs: 3.3 instead of an approximation of pi
clippy's approx_constant denies 3.14159 as an approximate PI.

Verified: job m3-max-14128 (homelab-um790-xtx-1) at 37e8650472: clippy failed on exactly these two
literals in all three configurations; the engine tests passed (6756 results of 106 conversions on
lavapipe and moltenvk-m3 without shaderInt64; RTE declared on 14 committed profiles, noted on 5),
and with Directed::of sabotaged to map rtz/rtp/rtn to nearest even the exactness test failed
(f.f32.s.i32.rtz of 0x1000003 gave 0x4b800002 for 0x4b800001).
2026-11-11 02:41:51 -08:00
Anees Iqbal 5ecf83aa3e Engine test of the air.convert roundings prints what it checked
Evidence that the path ran (llvm-as present, every conversion compiled and compared): the number
of results checked and of profiles that declared RoundingModeRTE or recorded the note.

Verified: the touched suites passed at e4bbaf5a37 (job m3-max-14108, homelab-um790-xtx-1):
metal2vulkan-air convert 3/3, metal2vulkan arith/rounding/engine 279/279, validation comparison
10/10.
2026-11-11 02:41:51 -08:00
Anees Iqbal 0c2fca85df Four authored cases over the air.convert rounding fixture
convert-rounding-int-to-float-every-mode, convert-rounding-float-to-int-every-mode,
convert-rounding-int-to-int-saturating and convert-rounding-float-to-half-every-mode: 32 threads
each over kernel_convert_rounding_modes.ll's four kernels, inputs chosen where the roundings answer
apart (ties, values past each range, NaN, infinities, zeros, half and float denormals), compared
exactly.

Verified: corpus-case-check --install accepted all four (job m3-max-14100, m3-max, no GPU):
case ids ff0be7db96e9, 116f107ca214, 070bb9c6a5ea, 1bc464c0bf10. Metal qualification follows.
2026-11-11 02:41:51 -08:00
Anees Iqbal 2bc702f4b4 air.convert roundings: drop the double paths AIR cannot name; fix the tests' first run
air.convert names no double (the AIR element types stop at f32), so the directed double
narrowings, the double results and the 64-bit RTE width were unreachable: removed. The nearest-even
plan is now a flag for a float result, and narrow::rte_modes decides 32 bits and the widths the
device's independence ties to it. The engine test reads the interpreter's buffers directly, pins
the RTE widths of the venue profiles (lavapipe and RADV 32, ANV 16/32/64, MoltenVK and the floor
none) and the parse test names a float narrowing instead of a double one.

Verified: the first test job (m3-max-14044, homelab-ms01-1) failed on the double case in the parse
test and a compile error in the engine test; both fixed here, rerun next.
2026-11-11 02:41:51 -08:00
Anees Iqbal cd634b862e Engine test of air.convert with a rounding: every rounding exact on the interpreter, RTE declared or noted
Each conversion form Apple's OpenCL compiler emits with a rounding (int to float and half, float
to int with and without .sat, int to int .sat, float to half and half to float) compiles alone on
lavapipe (64-bit integers) and on moltenvk-m3 without shaderInt64 (the wide path), passes L3, and
on the CPU interpreter answers the exact IEEE result of its rounding for each edge input,
computed in integer arithmetic. A control test shows the inputs tell each directed rounding from
nearest even where the form can round, so a lowering that left one to the device's conversion
would fail. On every committed profile an int to float .rte declares RoundingModeRTE where
narrow::rte_modes allows it and records NativeConversionRounding where not; a form that cannot
round and a directed one declare and record neither.

Verified: not yet run (dispatched next).
2026-11-11 02:41:51 -08:00
Anees Iqbal 9f4590f124 air.convert with a rounding suffix: parse it and lower each form
Apple's OpenCL compiler spells every convert_* it emits as an air.convert with a
rounding after the types (.rte, .rtz, .rtp, .rtn) and, to an integer, .sat after it
(convert_float4_rte(uchar4) is air.convert.f.v4f32.u.v4i8.rte, convert_int_sat(float)
is air.convert.s.i32.f.f32.rtz.sat; the forms are read from the OpenCL runtime library
the macOS 27.2 Metal toolchain ships). Convert::parse took exactly four tokens, so each
such name was an unknown intrinsic and the pipeline was refused.

- metal2vulkan-air: Convert gains `rounding: Option<ConvertRounding>` and `saturate`;
  a rounding is accepted between numbers only (no bool, no 8-bit float) and .sat only
  after one, to an integer. Static folding leaves the saturating and the directed forms
  alone.
- Lowering (lower/arith/rounding.rs):
  - float to integer: RoundEven / Ceil / Floor first (rte / rtp / rtn; rtz is the
    conversion's own truncation), then the saturating conversion every air.convert to an
    integer takes; the NaN test reads the operand itself. Denormal notes as rint / ceil /
    floor take them.
  - integer to integer: plain; .sat clamps to the range both types share (SClamp/SMax/SMin
    of the sign extension, masked, or UMin; pairs on the wide path).
  - integer to float and float to narrower float, nearest even: the plain conversion. Where
    it can round to f32/f64 the entry declares RoundingModeRTE for the width and the widths
    the device's independence ties to it (narrow::rte_modes); a device that cannot declare
    them records the new PrecisionNote::NativeConversionRounding.
  - toward zero or an infinity: no Vulkan conversion rounds so per instruction, so the
    result is computed exactly by integer arithmetic: the magnitude's dropped bits with an
    increment where the lane rounds away (f32, f64 from 64-bit, the wide path through its
    sticky 32-bit fold), f32 to half on the bits (normal, overflow, subnormal, inf, NaN),
    double to float by stepping the device's faithful conversion, double to half through
    the round-to-odd f32. A conversion that cannot round is the plain one.
- PrecisionNote::NativeConversionRounding (native-conversion-rounding): codec, runtime
  Degradation, comparison table (unbounded), fast_paths ledger class, docs/API.md.
- SEMANTICS_VERSION 2021, ARTIFACT_FORMAT_VERSION 501 (the codec gains the note);
  api_signatures and the air api_surface blessed.
- Fixture kernel_convert_rounding_modes (owned MSL, air-rename to 64 suffixed intrinsics).

Unverified at this commit: build and tests follow in potluck jobs.
2026-11-11 02:41:50 -08:00
Anees Iqbal 01a95a1932 Test that a rerouted draw draws through its own scissor rectangle
PR #13 (merged as cfe05d0655) made render/reroute.rs's Held keep the
encoder's scissor rectangles beside EncoderState, so a draw recorded again
into a new render pass instance draws through the rectangles it was drawn
through. Nothing tested it.

The device test (tests/rerouted_scissors.rs, under m2v_gpu / m2v_cpu_icd)
draws into a BGRA10_XR color the pass clears: a first draw writes white
through a small scissor rectangle, the rectangle is set to the render area,
and a second draw blends into the color with the blend color 0.5 as both
factors. That blend starts the color's half shadow, which records the first
draw again into an instance in the current one's place. The target must
hold 1.0 (code 894) inside the first rectangle and 0.5 (639) elsewhere; a
first draw recorded through the encoder's latest rectangle leaves 1.0
everywhere.

Evidence that the reroute ran: the blending pass leaves exactly one more
instance unrun than the same pass whose second draw writes
(WorkCounts::unrun_instances_ended), and no
extended-range-blends-stored-codes is announced. A device whose pass holds
no shadow, or that refuses the blending state as FramebufferFetch, prints
SKIPPED.

Verified: see the agent report (lavapipe and a Linux GPU, with the fix and
with reroute.rs's three lines reverted on a scratch commit).
2026-11-11 02:24:30 -08:00
Anees Iqbal 9fa75c4dae Re-bless the authored compile census at 6898863f3f
Its product fingerprint follows the runtime-sources pin at 6898863f3f (dv-m3e).
2026-11-11 02:20:54 -08:00
Anees Iqbal 37b8ea5e6f Re-bless the golden tables at 6898863f3f
What moved since d0f0419800's bless. Blessed on the M3 (dv-m3e).
2026-11-11 02:20:54 -08:00
Anees Iqbal 6d11feee4b 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-11 01:59:40 -08:00
Anees Iqbal aa6f681536 host_ab percall gate: one bound for heap textures again, the per-path table removed
6d67245284 held heap_texture_256's allocations per path, keyed on the count of the tiled route
for the M3 Max. The M3 Max moved neither path's count (its image lies as Metal's tiles, on the
direct route), so its run failed there; and the 5080's extra allocations were not its path's
but redundant work on it, removed by the commit before this one. With that, the M3 Max's bound
of 17.25 is expected to hold on each venue measured, and HELD_ON_PATH holds nothing: removed.

Kept from 6d67245284: the gate notes every breach and fails after the last group, naming them
all, so a call over its bound leaves no group after it unmeasured; and the name check of every
row's count before any group runs.

HELD's docs say what a heap texture's allocations were measured as: 16.25 on the M3 Max (two of
them its mutexes' first locks, which std allocates on macOS), 14.25 under lavapipe; the 5080's
15.25 is the expected figure after the commit before, to be measured.
2026-11-11 01:58:53 -08:00
Anees Iqbal e2c12da913 Linear heap images: their view formats are read in place, not collected each texture
On a device whose optimal image takes none of a Shared heap's memory types (the RTX 5080), a
heap texture's image is linear, and heap_image asks linear_lack whether the linear tiling has
every feature the optimal one has, in the image's format and each it is viewed as. viewed_formats
collected those formats into a new Vec at every texture; for a mutable-format plan without a list
the collect grew its buffer three times, four allocations a texture, for a list read once.

viewed_formats now returns an iterator over the plan's list or the device's table, filtered in
place, with no list made. Its two callers (tiling_lack and the DRM modifier plan in dma_buf.rs)
chain it as before; the formats and their order are unchanged.

Found by an allocation probe (not committed) of host_ab percall's heap_texture_256 on the 5080:
19.25 allocations a call, 4.00 of them at linear_plan.rs viewed_formats' collect under
linear_lack, against 14.25 under lavapipe, whose optimal image takes the heap's memory. To be
measured after this commit: the 5080's heap_texture_256 allocs (expected 15.25).
2026-11-11 01:58:53 -08:00
Anees Iqbal 8d157704c1 host_ab percall gate: heap textures held per path, and every group measured before the verdict
On the 5080 the per-call gate stopped at heap_texture_256 (allocs 19.25 a call, held to 17.25),
so no row after it was measured there. The 17.25 is the M3 Max's tiled route
(texture/heap_tiled.rs, counted as heap_textures_tiled); NVIDIA makes the heap texture as the
driver's own image bound in the heap's memory (texture/heap.rs, counted as
heap_texture_untiled_layouts), a different path with its own allocations.

- HELD_ON_PATH holds a count per path: a row applies where its mark (a count the path moves)
  moved, whatever the device, and a group with such rows fails where it moved none of the marks.
  heap_texture_256's allocs move there: 17.25 on the tiled path, 19.25 on the untiled one (the
  5080's measurement).
- The gate collects every breach and fails after the last group, naming them all, so one call
  over its bound no longer leaves the groups after it unmeasured.
- check_held checks HELD_ON_PATH's marks and counts by name as it does HELD's.

Not yet run: the 5080 (b5080 entry, previous percall.rs as the control), the M3 Max and
lavapipe percall runs, and the lint configurations. Their results go in the report.
2026-11-11 01:58:53 -08:00
Anees Iqbal 6898863f3f Re-bless the golden tables at d0f0419800
The helper fences' four moltenvk-m3 cells (SEMANTICS_VERSION 2022) and
whatever else moved since 9b046a7cf8. Blessed on the M3 (dv-m3d).
2026-11-11 01:51:58 -08:00
Anees Iqbal da929c8a96 Re-bless the cost records at d0f0419800
A whole-set cost --runs 8 --write on the M3 Max, then --alone over the cases it
changed: images' blocks at 64 MiB (device_memory_allocated of the cases that
read 68 MiB) and what else moved since 9b046a7cf8 (dv-m3d).
2026-11-11 01:51:58 -08:00
Anees Iqbal d3bb7628a9 Re-bless the authored compile census at d0f0419800
Its product fingerprint follows development's versions at d0f0419800 (dv-m3d).
2026-11-11 01:51:57 -08:00
Anees Iqbal d98dd8a227 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-11 01:50:08 -08:00
Anees Iqbal 984e49e455 Pass log: an execution's replay encoder notes nothing
The replay encoder of a render-command execution (render/executions.rs) is a RenderLowering of
its own and took no pass_notes, so the runtime did not build. It is no pass of the program's:
the executing encoder's line names the pass.

Verified: cargo fmt; the build runs on potluck after this commit.
2026-11-11 01:49:25 -08:00
Anees Iqbal 1032d39bd6 Pass log: a pass a frame repeats with other counts prints no line again
The pass log told its lines apart by their whole text, its draw-call and resident counts
included, so a pass a frame repeats with one draw more printed again and the 256-line bound
could fill before the pass that matters ran. A line is now keyed by the pass without those
counts; the line still prints them.

Verified: cargo fmt; tests::pass_log runs on potluck after this commit.
2026-11-11 01:49:25 -08:00
Anees Iqbal 5a21f6d3f3 METAL2VULKAN_LOG_PASSES: a default-off log of the render passes that name a watched texture
A diagnostic to find which pass draws the white at a widget's glass edges in the 27.0.1 guest:
the runtime sees every pass's attachments, which the consumer's own logs cannot name.

The switch's value is the textures to watch, a comma-separated list of FORMAT:WIDTHxHEIGHT
(the format as the notices print it or as Metal names it, `*` for any format or size). At the end
of each render encoder that renders into a watched texture, binds one to its fragment stage or
makes one resident, the device logs one line (id name metal2vulkan-passes, Info): the render area,
its Vulkan render pass instances and draw calls, each attachment (format, size, object ID, label,
whether it took its storage form, level, slice, load and store actions as the pass ends, its
stand-in and cause), the depth/stencil aspects' actions, the pipeline states its draws drew with,
the textures bound to the fragment stage at a draw, the watched resident textures with their
stages, and what it watched. A line the same as one printed before is not printed again; a process
prints at most 256. Off (unset, empty or 0, or a value it cannot read, said once on stderr), an
encoder notes nothing; no behaviour reads it.

- crates/metal2vulkan/src/env_vars.rs: the registry row and `log_passes()`, the raw value.
- crates/metal2vulkan-runtime/src/pass_log.rs: the filter, the notes, the line and its bound.
- render.rs: an encoder's notes, made where the log is on, noted at each draw call, logged at
  the pass's end once its store actions are settled.
- texture.rs: `Texture::took_storage_form`, which the line names.
- docs/API.md and the artifact test's list of the runtime's variables name it.

Verified: cargo fmt; the build, clippy and the tests run on potluck after this commit
(tests::pass_log: the filter's parse and refusals, an entry's match, the once-and-bound rule).
2026-11-11 01:49:25 -08:00
Anees Iqbal fc261c9f31 host_image_room: fill past two blocks of images at the one block size
The host-transfer image test (399e8d6d17) landed after the 64 MiB image
blocks (653060d6ee) and still named IMAGE_BLOCK_SLACK, which those removed:
the runtime's tests no longer compiled under m2v_cpu_icd or m2v_gpu
(round d0f0419800, lvp 2/4, gem10, job m3-max-14294, E0432). A block of
images is BLOCK_BYTES now, so two blocks past the heap are 2 * BLOCK_BYTES.

Test only; the runtime-sources pin is unchanged. Verified: cargo fmt; the
CPU-ICD and GPU builds are the next round's.
2026-11-11 01:48:19 -08:00
Anees Iqbal faa1b6ec7f Flat dispatch lane: one command queue for all four grids
PR #15's a_ragged_direct_dispatch_runs_each_thread_once_on_the_flat_variant
made a command queue for each of its four grids. On the RTX 5080 Laptop
(one VkQueue in the family, a plan of 14 queues) the second shared VkQueue 0
and the runtime announced metal2vulkan-queue-limits-reached, which the lane's
layer claim fails on (round d0f0419800, msi, job m3-max-14216, 5080 lane 1/2).
The queue limits are not what the test tests: one queue serves every grid.

Test only. Verified: cargo fmt; the 5080 run is the next round's 5080 lane.
2026-11-11 01:44:42 -08:00
Anees Iqbal e831b50ad6 FAST-PATHS: drop the 64 MiB image blocks' scroll claim the confirming block overturned
653060d6ee's row said 64 MiB image blocks matched the build before the 68 MiB
ones in a macOS guest's page scroll on a Hawk Point 780M, from reims's first
block (4 + 4 boots). Its mirrored second block (m3-max-14080) overturns that:
pooled over 8 + 8 boots, pin 36 with 64 MiB image blocks has 14 rAF gaps of
100 ms or more against pin 30's 8, with twice the ready thread's direct
compaction for the same block count. The row now says what the size choice is
and costs, and no scroll figure; the scroll regression is open and worked
apart. Docs only.
2026-11-11 01:43:37 -08:00