On a device with VK_EXT_shader_float8 (shaderFloat8), 8-bit floats now widen through the
device's own Float8E4M3EXT and Float8E5M2EXT types: air.convert's f8e4m3fn and f8e5m2 sources,
simdgroup-matrix fp8 cells and matmul2d's fp8 elements all go through one decode, which bitcasts
each lane to fp8 and converts it with OpFConvert. That's the device's native form (owner rule 1).
IEEE-like f8e4m3 has no device encoding and keeps the integer decode, as do devices without
shaderFloat8. A tensor format widened natively records PrecisionNote::NativeFloat8
(native-float8): the device's e4m3 reads 0x7F and 0xFF as NaN where Metal reads a number, and
its e5m2 NaNs carry other bits. The float8 products refusal is removed.
The translator's output changes (SEMANTICS), the precision-note codec gains NativeFloat8
(ARTIFACT_FORMAT), and the runtime enables shaderFloat8 (RUNTIME). The golden tables and the
compile census are re-blessed at the next pin.
Verified by the change's own runs: 993 of 994 touched tests (24812), the one failure fixed and
rerun 59/59 (24835); matmul2d fp8 on nvidia-rtx50-linux declares Float8EXT and records the note,
and on MoltenVK, RADV and lavapipe gives exact words with neither; lints green (24813, 24814).
RTX 5080 against the M3 Max rows (24815, 18 fp8 cases): 4 equal, 14 differ only in NaN words,
each row carrying NativeNanEncoding and NativeFloat8 and the runtime announcing
metal2vulkan-degrade-native-float8.
ash_interop::tests::every_feature_has_a_source reads every VkFeature from a fake device that
lists every extension; it lacked VK_EXT_shader_float8, so ShaderFloat8 had no source (24812). The
RTX 50 profiles' 8 opened validation contexts now chain VkPhysicalDeviceShaderFloat8FeaturesEXT
(one member more each), blessed by bless_opened_chains on msi (24812).
Owner rule 1: where a device has a native 8-bit float type, its conversion is the only form.
VK_EXT_shader_float8's shaderFloat8 (the SPIR-V capability Float8EXT, SPV_EXT_float8) is now a
VkFeature the device enables and the profile reads (leaf.float8); the SPIR-V IR has
Type::Float8 { encoding } (OpTypeFloat 8 with its FPEncoding, from the regenerated grammar items),
and the interpreter reads OCP's E4M3 and E5M2.
The shared decode, narrow::fp8_to_f32, widens through the device's type where the layout names
one (Fp8Layout::on): each u32 lane bitcast to four 8-bit floats, the low byte's widened by
OpFConvert, so no 8-bit integer type is needed. f8e4m3fn and a tensor's e4m3 take Float8E4M3EXT,
f8e5m2 and a tensor's e5m2 Float8E5M2EXT; the IEEE-like f8e4m3 has no device encoding and keeps
the integer decode. Every site takes it: air.convert's 8-bit float sources, simdgroup-matrix fp8
cells, and matmul2d, whose expansion now widens each element by an air.convert of the tensor's
format (Fp8::TensorE4M3, Fp8::TensorE5M2: Metal's reading, qualified on the M3 Max, e4m3 with no
specials, e5m2's NaNs 0x7FC00000; never parsed from a name, built by Out::air_call). A device
without shaderFloat8 decodes with integers, as before.
Where a tensor's element widens natively the stage records PrecisionNote::NativeFloat8
(native-float8): the device's e4m3 reads 0x7F and 0xFF as NaN where Metal reads 480 and -480,
and an e5m2 NaN's bits are the device's. Validation classes it Unbounded; the conformance suite
lists it among the native notes; FAST-PATHS.md has its device-gap row and API.md its catalogue
entry. The other formats record none: Metal on Apple M3 does not compile them.
The refusal of a matmul2d of 8-bit floats on such a device (Entry::float8_products, the select
check) goes. REFUSALS.md and api_signatures.tsv regenerated.
Tests: matmul2d's fp8 fused sums on the RTX 50 profile (Float8EXT declared, the note recorded,
e4m3 NaN sums) beside MoltenVK, RADV and lavapipe (neither); air.convert widenings on the RTX 50
profile and lavapipe; simdgroup-matrix fp8 cells on the RTX 50 profile too. Not yet built here:
the build and these tests run next on the cluster.
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.
A memory block the runtime makes ahead of need no longer takes the device's last allocation
slots from a caller's allocation. An allocation made ahead is admitted only where one more still
leaves the margin, checked in the same step as the count; it never waits at the limit and never
counts as refused. A making counts as work ahead unless a placement waits for it, and the
give-back thread now also frees blocks made ahead and not yet added that no call waits for
(Memory::give_back_ahead), counted in blocks_ahead_unused and memory_frees.kept_for_room. Before,
a speculative make-ahead could pass the margin check while live allocations were low, take the
last slot, and leave a caller's buffer refused at the limit with no block ever given back. That
changes runtime behaviour.
Verified by the change's own runs on lavapipe: the new forced test
blocks_ahead::an_allocation_at_the_limit_takes_back_the_blocks_made_ahead passes (24845, 1 buffer
of a room of 1, 1 block given back) and fails without the fix every time (24844, 0 of 1); the
guest-RAM test that failed 4 of 4 passes (24825, 3 of 3); clippy default and --cfg m2v_gpu,
runtime lib 1514/1514 and rustdoc green (24826).
A guest's buffer at the device's allocation limit was refused while blocks the runtime had
made ahead of any object held allocations: on lavapipe,
tests::host_ram_device::an_allocation_at_the_limit_waits_for_the_untaken_chunks_to_go_back
failed 4 of 4 (2 buffers made of a room of 3, then TOO_MANY_OBJECTS at 5 of 5). A probe of every
vkAllocateMemory by site and thread showed the cause. After the give-back of the untaken
chunks left 2 live, the speculative making of the images' pool passed the margin check at 3
live, and its zero-initialized allocation was still under way when the guest's third buffer was
refused. keep_room's making for the encodings' pool took the other slot: a creation call's wait
counted as "wanted", so it bypassed the margin. The pooled blocks made ahead were never given
back at the limit; only the host-RAM chunks were.
- allocations.rs: an Ahead mark on the thread admits an allocation only where one more leaves
the margin, in one step with the count (no check-then-allocate), and it never waits at the
limit or counts as refused. It marks the give-back due.
- memory/ready.rs: a making is the runtime's work ahead unless a placement waits for it
(Waits::Placement against Waits::Room). keep_pool_room's own making is marked ahead too.
- The give-back's thread also frees the blocks made ahead and not yet added that no call waits
for (Memory::give_back_ahead). Their makings are stopped and joined; a making under way is
ahead, so it never waits at the limit and takes no memory lock. The frees count as
blocks_ahead_unused and memory_frees.kept_for_room.
- Tests: allocations::tests::an_allocation_ahead_takes_the_room_past_the_margin_alone_and_is_given_back,
and blocks_ahead::an_allocation_at_the_limit_takes_back_the_blocks_made_ahead. The second forces
the order: blocks made ahead are held, and the limit leaves no room ahead even once they go.
Without the fix it fails every time.
Verified on lavapipe (msi):
- blocks_ahead's forced test passes: 1 buffer of a room of 1, with 1 block made ahead given
back. On development without the fix (negative control) it fails every time: 0 of 1.
- The test that failed 4 of 4, host_ram_device's
an_allocation_at_the_limit_waits_for_the_untaken_chunks_to_go_back, passes: 3 buffers of a
room of 3, with 2 waits for the give-back.
- So do the rest of host_ram_device, blocks_ahead, posted_frees and allocations' unit tests
(46 of 47; the 47th is the forced test, since fixed).
- Clippy (default and m2v_gpu), the runtime lib suite (1514 of 1514) and rustdoc are green.
device_recovery_exportable compared the inode of a dma-buf export taken before a recovery with
one taken after it. On an RTX 3090 the two inodes differ. The recovery exports the block again
from the lost VkDevice, and NVIDIA's driver answers a new dma-buf to each export. Vulkan does not
say that two exports of one memory answer one file, so the inode check relied on undocumented
behaviour.
What the runtime documents is that the other API's imports still reach the carried buffer's
memory. The test now checks that instead. For each handle type, a second VkDevice imports the
export taken before the recovery. After the recovery it fills the memory and releases it to the
family the runtime acquires from (VK_QUEUE_FAMILY_EXTERNAL for an opaque descriptor,
VK_QUEUE_FAMILY_FOREIGN_EXT for a dma-buf). After Buffer::external_write_done, a copy of the
buffer and a copy of the texture over it both read the import's bytes. The allocation size,
offset and memory type are still compared; the inode is not.
The test does not check the other direction, the import reading what the runtime wrote. The
runtime releases nothing to the other API, and Vulkan leaves the contents undefined for an
entity that takes ownership without a release (External Resource Sharing). The module docs say
the same.
tests/exported_memory.rs's Writer now takes the handle type. For a dma-buf it enables
VK_EXT_external_memory_dma_buf and VK_EXT_queue_family_foreign. It imports as a memory type that
vkGetMemoryFdPropertiesKHR answers, preferring the exported one. The import is dedicated where
the allocation is, where the device imports only so, or where the buffer requires it; a
dedicated buffer spans the allocation (VUID-VkMemoryDedicatedAllocateInfo-buffer-02965).
Verified: the lib test binary under --cfg m2v_gpu at this change, each test in its own process,
passed device_recovery_exportable (OpaqueFd and DmaBuf both printing "the import before the
recovery wrote the carried buffer", allocation (67108864, 0, type) the same before and after) and
both exported_memory tests on an RTX 3090 and an RTX 2080 (NVIDIA 620.70.06) and a Radeon 780M
(RADV, Mesa 26.2.6).
The census at the pin-66 tip (m3-max-24777): 2369 cases over 21 profiles, 48614 compiled, 1135
refused, 0 failed, 18 differences, 0 regressions. The slowest compile took 3.0 s and the largest
worker 232 MiB, inside the 20 s and 500 MiB ceilings.
The golden tables at the pin-66 tip (m3-max-24776): 73 golden hash rows move under unchanged
keys and 4 are new, from the translator changes since pin 65 (half division and square root at
16 bits, SEMANTICS_VERSION 2080; whole grids on the partial-threadgroups variant, 2081; the fp8
matmul fixtures). The engine fixture expectations gain the tns_mm_fp8 and tns_coop_fp8 rows, and
tns_mm_fp8 gains its printout. Test data only.
The intermittent SIGSEGV (lavapipe, a full runtime suite, m3-max-24602)
was the test's own: its spinning kernel stores its count into the no-copy
buffer's bytes once it sees the raised word, and the test freed those
bytes (a heap allocation) right after it dropped the device's handle,
which does not wait for work in flight. The command buffer still held the
buffer, so the bytes had to stay mapped until it completed
(HostMemory::new's contract). The core (systemd-coredump on msi, gdb):
the process faulted in exit's frees at glibc's unlink check, the free
chunk at the test's 64 KiB-aligned allocation holding 0x0010fb16 in its
link, the kernel's count (1,112,854 loads).
The test now waits for the command buffer before the bytes go. Its
host bytes are pages of their own, unmapped at drop, and the word is
raised 200 ms late on a thread of its own, so a test that let the bytes
go first faults at the kernel's store every time rather than corrupting
the heap now and then.
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.
Device::host_pages_texture_placement, a runtime extension, answers where a texture over a
no-copy buffer of host pages imported by pointer or as dma-bufs would lie, before any buffer,
import or image is made; another backing is refused (Problem::HostPagesBacking). The buffer's
own placement query and the image-making path now ask the same image-free answers first and
make no image where those answers refuse every plan. The answers are unchanged, but the work
the runtime does to reach them changes, so this bumps the runtime's version.
Verified by the change's own runs on lavapipe (24747): both new tests pass over 8 shapes with
shader-read and unknown usage, by pointer, under the Shadow policy and as dma-bufs, each
pre-import answer equal to the buffer's, refusals included, with no image made by a pre-import
ask; texture_placement_device 2/2; runtime suite 2461/2462, the one failure the guest-RAM test
that fails without the change. clippy plain and --cfg m2v_gpu (24748, 24749), --cfg m2v_cpu_icd
(24722), rustdoc (24748). Not run on a real GPU.
What: Buffer::texture_placement, TexturePlacement::InPlace, InPlaceRefusal and route.rs say
what the query answers before it makes images and what host_pages_texture_placement answers
before the buffer; docs/API.md, docs/HOWTO.md and the runtime README name the new query. The
test compares both calls' results, refusals included (a plane past the buffer's length is
refused as PastBuffer by both, not answered PastLength), and asks rows of 8 bytes too.
Why: lavapipe m3-max-24732: every shape both queries decide answered alike (CheckFailed by
pointer, Unchecked over dma-bufs, InPlace elsewhere), but the past-length shape is a refusal
of both calls, which the test unwrapped.
Verified: pending the lavapipe run.
What: tests/host_pages_placement.rs reads ObjectChurn::vk_images_made_this_thread (the
WorkCounts field it named does not exist); api_signatures.tsv blessed for
Device::host_pages_texture_placement and Problem::HostPagesBacking; docs/REFUSALS.md
regenerated.
Why: the test did not compile (m3-max-24729); the public surface changed.
Verified: pending the lavapipe run.
What: a runtime extension, Device::host_pages_texture_placement(backing, descriptor, plane,
start, length), answers where a texture new_texture_with_iosurface_plane makes would lie over a
no-copy buffer of length bytes from host address start whose pages the device imports by
pointer or as dma-bufs, before any such buffer, import or image is made. It shares the making's
steps rather than copying them:
- make_texture_over's checks that read the buffer only for its length, options and detached
state are shape_over (OverFacts, Shape, ShapeKind), which both the making and the new query
call;
- the route is host_route over a HostLie (route_over_pages beside route_over_buffer, with
levels_or_past shared), and placement_over takes the buffer's texels or the pages (Bytes);
- the image in place is decided by in_place_unmade, the same image-free answer the buffer's
query now asks first; where only an image or the import decides, the answer is InPlace;
- kept_in, past_kept and owns_padding are the rules Texels used inline, now shared.
Another backing is refused (Invalid, Problem::HostPagesBacking), and a length the no-copy
buffer refuses as it does (Nil, BufferLength).
A test (tests/host_pages_placement.rs) asks a spread of shapes before and after the buffer, by
pointer, under the Shadow policy, and as dma-bufs where udmabuf opens: equal where the answer
is not InPlace, an image- or import-decided answer after where it is, and no VkImage made by
the pre-import query.
Why: reims's verdicts lane asks the placement of guest pages before it maps them.
Verified: pending the lavapipe run.
The shape checks that read a buffer only for its length, options and detached state become
shape_over, which make_texture_over calls; the route is placement_over over the buffer's texels
or pages not yet imported (Bytes), in texture/route.rs. Problem::HostPagesBacking refuses a
placement asked of pages for a backing other than an import by pointer or as a dma-buf. This is
the groundwork the next commit's Device::host_pages_texture_placement uses; that commit carries
the description, the test and its evidence.
What: Buffer::texture_placement's answer for an image in place now asks first what the device
answers without making an image (Device::in_place_unmade): rows that share bytes, and for
every plan the making would try, the checks its image steps run before vkCreateImage (the
linear tiling's features and the host-allocation format query and limits, then the
DRM_FORMAT_MOD_LINEAR checks; over dma-bufs, dma_buf_unmade). Where those refuse every plan,
the answer is that refusal and no image is made; else the query makes and releases its images
as before. The making's image steps call the same check functions (external_linear,
pitched_unmade, dma_buf_unmade, neither), split out of external_linear_image, pitched_image
and dma_buf_image_unbound, so the rules have one copy. The wider plans take how the texels lie
(HostLie, Texels::host_lie) in place of the texels, and unplaced dispatches by one memory
function (in_place_memory).
Why: the coming host_pages_texture_placement answers before any import and must make no image;
it shares this decision.
Verified: pending a build and the placement tests.
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.
The last merge pass now writes a merged execution's first draw as 0 vertices x 0 instances when
the total holds no whole chunk, in place of a chunk's 2^31 - 2 vertices x 0 instances. The vertex
variant reads the chunk from the scratch's header, not from the draw, so no other answer changes.
The trail GPU-form tests now also print their command buffer's GPU time. Changing the draw a
merged execution records changes runtime behaviour.
Verified by the change's own runs: on the RTX 2080 (24755) the 4-command trail test's command
buffer takes 0.526 ms against 0.707 ms before; the indexed 8162-command test is unchanged at
18.6 ms, so the zero-instance draw was not the RTX 3090's slow frame. 50 bind::replay tests and
clippy pass (24757).
The last merge pass wrote the first draw as a chunk's 2^31 - 2 vertices in no instance whenever
the total was below a chunk. It now writes no vertex in no instance there. The vertex variant
reads the chunk from the header, not from the draw, so nothing else reads the change.
Measured on the 2080 (NVIDIA 620.70.06, m3-max-24755): the 4-command trail test's command buffer
went from 0.707 to 0.526 ms of GPU time. The 8162-command indexed one stayed at 18.6 ms, so a
zero-instance chunk is not what costs that one. The interpreter's merge tests (50 bind::replay
tests) and clippy pass (m3-max-24757). The trail tests' expected lines now read the first draw as
0 vertices x 0.
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.
A device recovery now carries every kind of object the runtime's API makes that holds state on the
lost generation:
- An indirect command buffer keeps its records where they lie in the runtime's own pages. In
pooled memory they are lost, so every command is reset. The programs its commands run are made
again.
- A visible function table keeps its entries, in place or written again from a host copy.
- An argument encoder follows its device (ArgumentEncoder::device now returns the generation by
value).
The lost generation's live-buffers table now closes at its rest (LiveBuffers::close in
keep_nothing), so the lost VkDevice no longer lives on after a recovery. Both change runtime
behaviour.
Verified by the change's own runs: lavapipe 42/42 recovery, indirect-command-buffer and
released-program tests (24660, rebased tip 24743); with close made a no-op both new tests fail at
the live-VkDevice count (24669); the every-kind test fails on the product before the carry
(24481). GPU: 780M 42/42 (24687), Iris Xe 42/42 (24686), RTX 3090 41/42 (24685), the one failure
an existing one development shares (24704, the DmaBuf re-export test). function_tables and
argument_buffers lanes 28/28 on all three. clippy clean in every configuration (24661).
What: a device's recovery now carries the three kinds a program makes that it left the lost
generation's, so each is the same object on the new VkDevice, as Metal keeps its objects:
- An indirect command buffer (`indirect_command_buffer/carry.rs`). Its records' storage and its
slots past them are buffers of the runtime's own whose `contents` pointer no program holds,
carried as such (`Buffer::carry_runtime`): in the runtime's own pages, the same pages and the
records as they are; in pooled host-visible memory, new memory, the records lost with the
VkDevice (vkspec 5.2.3), written again as a new buffer's: its header, every command reset.
The program each command's state runs is the state's program there (made by the state's
carry, after it), or a released state's made again there, as are the programs it keeps for
GPU-written records (`released_programs.rs`); its kept chunk recordings go; the new
generation's keepers list it where the GPU may write it. Its records ID, address,
gpuResourceID, uniqueIdentifier and label are the line's and stay.
- A visible function table (`function_table/carry.rs`), after its pipeline state: its words
buffer carried the same way; where it went to new memory, the words written again from a
host copy the table now keeps of what the CPU wrote (`TableShared::writes`), so its entries
call what they called; listed among the new generation's tables. A table whose state stays
the lost generation's stays with it.
- An argument encoder: it holds no Vulkan object, so its device becomes a `LineDevice`, the
handle carried; `ArgumentEncoder::device` answers the generation handle by value (it answered
a borrow).
The registry keeps both buffer kinds weakly (`Carry::indirect_command_buffer`,
`Carry::function_table`), the recovery carries them after the pipeline states, and its notice
counts them (`", and N indirect command buffers, M of them whose records were lost (every
command reset)"`, `", and N visible function tables with their entries"`). The docs of what a
recovery carries and leaves say so: `RuntimeGap::MadeBeforeRecovery`,
`Degradation::DeviceRecovered`, docs/API.md, the runtime's README, `device/carry.rs`.
Why: after a 3090 recovery, `resetCommandsInBuffer:withRange:` on an indirect command buffer
made before it was refused (`MadeBeforeRecovery`) thousands of times and every later command
buffer of the pass failed, where Metal's buffer goes on. The whole class at once: every kind a
program can make, each with its carry status, was listed for the change (none other was left
uncarried that holds only what the program could make again; sparse heaps and textures and
pooled `Shared` buffers stay left, as documented).
Test: `device_recovery_every_kind::every_kind_of_object_made_before_a_recovery_serves_after_it`
makes one of each kind (a queue, a `Private` buffer, a heap and a placed buffer, a texture, an
event, a shared event, a fence, a sampler state, a depth/stencil state, a library and function,
a compute and a drawing state, an address pool, a rasterization rate map, a binary archive, a
dynamic library, an indirect command buffer of dispatches executed before and one of draws, an
argument encoder, a visible function table called before), recovers, uses each on the next
generation by command buffers that complete (the indirect buffers reset by a blit and encoded
again, the table called and set, the encoder writing), and ends with the lost VkDevice gone
while all live. Helpers made `pub(super)` in the pipelines and states recovery tests.
Verified, at the change on a0b85d89d4: the every-kind test passes on lavapipe (msi, nextest, one process a
test, with the 41 other recovery, indirect-command-buffer and released-program tests), on the
Radeon 780M (RADV) and the Iris Xe (ANV), 42 of 42 each, and the RTX 3090 (41 of 42: the exportable test's
DmaBuf re-export inode, which development fails the same way there). Its negative control, the
product's sources at bfcd63c5e2 and the test kept, fails at the notice's count of the indirect
command buffers (lavapipe). The validation lanes `function_tables` and `argument_buffers`
(the argument encoder's device): 28 of 28 on the 780M, the Iris Xe and the 3090. Clippy of
the runtime, validation and conformance (all targets and features, --cfg m2v_gpu and
m2v_gpu_hazards): no message. The API signatures check passes (`ArgumentEncoder::device`
blessed); docs/REFUSALS.md is unchanged.
What: at a lost generation's rest (`DeviceShared::keep_nothing`), its table of the live buffers
and the table's spare go (`LiveBuffers::close`), before its recycler closes, so their buffers
park there and go with it. The table's lifetime rule says so (`live_buffers.rs`: its module docs
and `Inner::current`, `Inner::spare`), and `keep_nothing` lists it among the device-level objects
of work.
Why: the table's upload buffer (and the spare), buffers of the runtime's own on the generation,
hold it "only while a listed buffer lives, which holds it too". A recovery breaks that rule: it
carries the listed buffers on, and they stop holding the lost generation, but no command buffer
runs there again to make the next change that would drop the table. So once any command buffer
had made the table (an indirect command buffer's execution, which resolves its records'
addresses through it), the lost `DeviceShared` kept two strong holds (the upload buffer's handle
and its pages') for the life of the process, its `VkDevice` and driver memory with it, after the
program let go of everything. Development had it before this change (a diagnostic on lavapipe:
"1 tables made", live VkDevices 2 before and after the program's release of everything; the
generation came to rest).
Test: `device_recovery_live_table::a_lost_generation_s_live_buffers_table_goes_at_its_rest`.
An indirect execution makes the table (`WorkCounts::live_tables_uploaded` rises: the path ran),
the buffer and its state go, the three buffers live past a marked loss (not a parked
generation); the live VkDevices fall to 1 while they live, and stay 1 once they go. Its helpers
(the indirect state, buffer, command and execution) serve the every-kind test next.
Verified, at the change on a0b85d89d4 (with the carry after it): on lavapipe (msi, nextest, one process a
test) this test and the 41 other recovery, indirect-command-buffer and released-program tests
pass; its negative control (`close` made a no-op) fails it at the live count with the buffers
alive (after the test's 60 s wait), and the every-kind test at its end. On the GPUs, one
process a test: the Radeon 780M (RADV) and the Iris Xe (ANV) pass it with the 41 others; the RTX 3090
passes it, and fails one other, the exportable test, as development does there (its DmaBuf
re-export's inode). Clippy of the runtime, validation and conformance (all targets and
features, --cfg m2v_gpu and m2v_gpu_hazards): no message.
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.
With METAL2VULKAN_LOG_PIPELINES on, a compute VkPipeline's making now logs a line as it starts,
before vkCreateComputePipelines: the kernel, its SPIR-V hash and words and its specialization.
With METAL2VULKAN_DUMP_PIPELINES set, its module is written then, not after. A making that never
returns (a driver compile that runs for tens of minutes) is the start line without its made
line, and its module is on disk, where before neither the line nor the module appeared until the
driver returned. Default-off diagnostics; no product path changes.
The made line no longer writes the module (the start did). The compute log test checks that the
start line, with the same module hash, comes before the made line.
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.
A kernel whose base module holds COUNTED_WORDS (65,536) SPIR-V words or more now runs its whole
grids, uniform dispatchThreads and dispatchThreadgroups, on its partial-threadgroups variant with
every thread live, where its ragged grids of the same form run on that variant. A large kernel
then needs one VkPipeline per threadgroup size for all three kinds of dispatch, and its creation
no longer makes the predicted plain region no dispatch would take. Where the variant is refused,
the dispatch takes the plain pipeline. Smaller kernels are unchanged. The answers are the same
(words equal the split's and Metal's), so this is not a speed-for-accuracy choice and takes no
switch; the measured GPU cost of the variant on uniform grids (0.997-1.020 of the plain form, XTX
24567) is stated at compute::partial_direct and in docs/API.md.
The binder lays a whole grid on a partial plan out as the same regions without the NONUNIFORM
flag, and a dispatchThreadgroups's regions with MultiRegion 1 (SEMANTICS). The runtime picks the
variant (ComputePipelineState::whole_on_partial) and counts it in
WorkCounts::whole_dispatches_on_partial_variants (RUNTIME). Two public translator accessors,
CompiledFunction::observes_threadgroup_partition and observes_partition_through_simdgroups_alone,
expose facts the compile already decides.
Verified by the change's own runs: lints green in every configuration (24640, 24641); translator
tests 5/5 (24667), whole Threads and Threadgroups grids on the partial plan equal to the split's
and Metal's words with one specialization per threadgroup size on 5 profiles; lavapipe 3/3
(24642), a large kernel making 1 VkPipeline over 2 whole dispatchThreads, 1 dispatchThreadgroups
and 1 ragged grid (counter 3) and a small kernel the 2 it made before (counter 0). The XTX run
(24690) is pending.
A kernel that observes its threadgroup partition runs its ragged dispatchThreads grids on its
partial-threadgroups variant, one VkPipeline of the call's threadgroup size (MultiRegion 1),
while its whole grids took the plain pipeline (MultiRegion 0): two driver compiles of the same
module. On a guest's run on an RX 7900 XTX the plain one, for a kernel of 2,415,531 words, was
26.9 s of a 39.8 s warm pass.
Now a kernel whose base module holds compile_memory::COUNTED_WORDS (65,536) SPIR-V words or more
runs every direct dispatch of a threadgroup size on that variant, every thread live, where its
ragged grids of the same form run there (it observes its partition, and for a one-row grid in
one-row threadgroups otherwise than through its simdgroups alone, whose such grids run flat).
Where the variant is refused it falls back to the plain pipeline as before. Smaller kernels keep
the plain pipeline. Both forms give the same answers, so there is no switch and no FAST-PATHS
row.
- Binder: on a partial-threadgroups plan, a whole Threads grid takes the same L-sized regions
per group-count chunk, unflagged (no NONUNIFORM), and a Threadgroups dispatch's regions have
MultiRegion 1, so one specialization of a threadgroup size runs all of them.
- Translator API: CompiledFunction::observes_threadgroup_partition and
observes_partition_through_simdgroups_alone state the two partition facts the compile already
decides, so the runtime can decide at creation which form a kernel's ragged grids take.
- Runtime: compute::partial_direct takes whole grids and dispatchThreadgroups of such a kernel
(ComputePipelineState::whole_on_partial). WorkCounts::whole_dispatches_on_partial_variants
counts each such dispatch. A creation's predicted region is not made for such a kernel's
predicted dispatch, which would run on the variant, not the base.
- GPU cost, measured once on the XTX (RADV) with the probe on steelbrain/uniform-partial-probe:
1,048,576 threads in 64, partial/plain 0.997 to 1.020 over four straight-line kernels, words
equal. Stated at partial_direct and in docs/API.md's dispatch-regions paragraph.
Tests: engine_partial_threadgroups's whole_grids_run_on_the_partial_plan_with_every_thread_live
(whole Threads and Threadgroups dispatches on the partial plan give the split's and Metal's
words, and every grid of a threadgroup size takes one specialization, on the CPU interpreter);
the runtime's a_large_kernel_s_whole_grids_run_on_its_partial_variant (a large kernel makes one
VkPipeline over whole grids of both forms and a ragged one, counting 3 whole dispatches, with the
plain pipeline's words; a small kernel makes the plain pipeline's and the variant's, counting 0).
heap_trimmed makes its two large makings at two threadgroup sizes, since its whole and ragged
grids now share one.
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.
The GPU form of a merged render execution (bind/replay/merged.rs) now computes its counts as two
u32 words, low first, with the corners as an OpUMulExtended product and the sums carried by hand;
the only u64 values it computes are addresses. On an RTX 3090 a guest's merged first draw came
out at 2^33 above its true total and hung the GPU. The runtime's merge kernels' SPIR-V changes,
and so do the counts a merged draw reads on such a device. That changes runtime behaviour.
Verified by the change's own runs: the_merge_passes_compute_no_u64_but_addresses fails with
merged.rs from before the fix and passes with it (24675); clippy and rustdoc clean (24675); 50
bind::replay tests pass on um790, the interpreter merge tests among them (24638). Not yet
verified on the device that hung: that is reims's RTX 3090 rerun.
A guest's render executions merged on an RTX 3090 (NVIDIA 620.70.06) drew their first merged
draw over 4 chunks of 2^31 - 2 vertices, seconds of vertex work, and the GPU hung (Xid 109).
The encoder trail's GPU-form readback showed both executions' totals at exactly 2^33 above the
sum of their commands' corners (321039 and 2184 corners, with second draws of 321047 and 2192
vertices), and a total no sum of whole triangles makes. The arguments, ranges, status words and
second draws were otherwise right. So the u64 count itself came out wrong in the passes, as the
u64 division did before on an RTX 5080 laptop GPU (615.71.09).
The passes now hold every count as its two u32 words, low first, as the prefix and the block
sums already lay out a u64. A command's corners are the OpUMulExtended product of its whole
vertices and its instances. A sum adds the low words and carries into the high ones. The last
pass takes the total's words directly to the u32 division it already ran. A u64 the passes
compute is an address alone. The layout is unchanged, so the vertex variant reads the prefix as
before.
Tests:
- the_merge_passes_compute_no_u64_but_addresses (replacing the division-only check): a u64 in
either pass is built only by OpIAdd, OpIMul, OpUConvert of a u32, a constant or a push
constant load, and used only to build another or as a pointer. Before the change it fails, on
the u64 compare, select, shift, conversion, load and store.
- The interpreter's merge tests (saturation and the VERTICES fault among them) hold the same
answers.
- The trail's GPU-form test gains an indexed case of the guest's shape: 8162 commands, the first
86 through a range read from a buffer, 90 blocks of 91. Its first merged draw must hold no
instance.
Verified:
- On the 2080 and the 3090 (620.70.06), the indexed case's synthetic shape ran right before the
change too (total 22446 corners, no block sum with a high word; the 3090 run skipped the draw).
Its scratch sat below 4 GiB of device address there, so neither device reproduced the guest's
high word, and the hanging device's proof is the guest rerun.
The trail's GPU-form test gains an indexed case of the compositor's shape: 8162 commands, the
first 86 of them run through a range a buffer holds, merged over 90 blocks; its first merged draw
must hold no instance.
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.
A usage shadow of a depth or stencil texture made over a surface's plane, or of a view of one,
now copies only the aspect the plane holds, one aspect per region as Vulkan copies
(VUID-VkBufferImageCopy-aspectMask-00212, which the validation layer reported). The other aspect,
which no copy writes, starts at zero, as the texture's own shadow does. The X32_Stencil8 view's
shadow also took its aspect from the view's format (stencil), so it copied the plane's depth bytes
into the stencil. It now takes the unit of the texture made over the plane
(Texture::surface_plane_unit). Which bytes a shadow holds changes runtime behaviour.
Verified by the change's own runs on lavapipe (24672): one usage shadow, the depths are the
plane's, the stencil reads 0, and the validation layer reports nothing. With usage_shadow.rs
reverted, every second texel's depth is wrong and the test fails. A test-only hook
(sampled_costs_forced) makes if_free answer "not free" to force the shadow. clippy --cfg m2v_gpu
passes (24673); runtime suite 2454/2455, the one failure an intermittent guest-RAM test that also
fails without the change (24657).
What: a usage shadow of a view of a depth or stencil texture over a surface's plane copies the
aspect the plane holds, the unit of the texture made over the plane
(`Texture::surface_plane_unit`), not the unit of the view's own format.
Why: an `X32_Stencil8` view of a `Depth32Float_Stencil8` texture over a plane took the
stencil as its unit, so its usage shadow copied the plane's depth bytes into the stencil
(lavapipe, m3-max-24657: the view's stencil reads were not 0). The plane holds the depth.
Verified: pending the lavapipe run of
tests::surface_depth_usage_shadow at this commit.
What: the depths the kernel read are `seen`, not `read`, which shadowed the
helper the stencil read then called.
Why: the test did not compile (E0618).
Verified: the jobs that follow.
What: texture/usage_shadow.rs's shadow of a texture's bytes copies only the
aspect a surface's plane holds (copy_plan::surface_depth_unit) for a depth or
stencil texture over a plane, and starts the image ZeroUnpatterned so its
other aspect reads 0, as the texture's own shadow does
(Device::storage_over_buffer). Every other usage shadow is as before.
Why: it copied DEPTH|STENCIL in one region from the bytes, against
VUID-VkBufferImageCopy-aspectMask-00212, and the plane holds no stencil.
Verified: tests::surface_depth_usage_shadow on lavapipe (job in the report).
What: tests::surface_depth_usage_shadow makes a Private Depth32Float_Stencil8
texture over a surface plane without ShaderRead, on a device where a test
hook (DeviceShared::sampled_costs_forced, read by Device::if_free) makes
SAMPLED cost every image that lacks it, so the texture's shadow lacks it and a
kernel's depth read binds a usage shadow of the bytes. It asserts one usage
shadow was made, the depths read are the plane's, the X32_Stencil8 view reads
0, and the validation layer reports nothing.
Why: that usage shadow copies both aspects from the bytes in one region,
which VUID-VkBufferImageCopy-aspectMask-00212 forbids (one aspect a region),
and the plane holds the depth alone.
Verified: fails without the next commit's fix on lavapipe (job in the
report).
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.
By default (ManagedCopyInPolicy::AtSubmission), a Managed buffer's didModifyRange range is now
copied by the GPU from the import or the runtime's own mirror into the device copy as the
submission runs. There is no CPU copy and no staging. The old commit-time snapshot stays as
ManagedCopyInPolicy::AtCommit, selected by DevicePolicy::exact_answers(): the Macs disagree (the
5300M doesn't read a write made after the commit, the UHD 630 does), so the default takes the
cheaper answer (owner rule 11-07), with its bound in FAST-PATHS. Staging that remains (uncovered
pages, copied imports, AtCommit) is host-cached system memory, never BAR, sized so the recycler
reuses it. That changes runtime behaviour.
Verified by the change's own runs (managed_copy_in_bench, 32 MiB commits): RTX 3090 eGPU commit
190 ms -> 0.04 ms, completion 194 -> 17.5 ms, 0.17 -> 1.9 GB/s (24627); RX 7900 XTX commit 6.0 ->
0.03 ms (24636); unified memory copies nothing (lavapipe, 24602). managed_copy_device 28/28 and
device_copies 8/8 on both GPUs in both settings; clippy and rustdoc green (24603, 24577, 24578).
What: docs/FAST-PATHS.md's managed_copy_in row gives the copy-in bench's
medians on the RTX 3090 (eGPU) and the RX 7900 XTX: the commit call and the
wall time to completion of 32 MiB commits under both values.
Why: a ledger row states the cost of its accurate form.
Verified: jobs 24627 (3090) and 24636 (XTX), two rounds each, both values.
What: the named-rounds tests' readable() and the lane test's step-4 answers
test ManagedCopyInPolicy by equality instead of matching its variants.
Why: the enum is non_exhaustive, so a match outside its crate needs a
wildcard; the tests did not compile (E0004).
Verified: the jobs that follow.
What: DevicePolicy gains managed_copy_in (ManagedCopyInPolicy, a runtime
choice no profile carries). Under the default, AtSubmission, a commit that
takes a did_modify_range's range has the GPU copy it from the host copy (the
import of the caller's pages, or the runtime's own host-cached memory) into the
device copy as the submission runs (Buffer::upload), with no CPU copy and no
staging. Pages no import maps are still staged by the CPU at the commit. Under
AtCommit, which exact_answers() selects, the commit copies the range on the
CPU as the host copy holds it then (the RV2145 snapshot, Buffer::upload_now,
now upload_at_commit). Staging buffers of both directions are now Shared in
the default CPU cache mode, host-cached system memory, never the device-local
(BAR) memory a write-combined buffer prefers without unified memory, and of
power-of-two lengths (64 KiB at least), so a like-sized later copy takes a
buffer the recycler parked rather than new memory.
The ledger gets its row (the bound: a CPU write after the commit, before the
GPU runs the command buffer, may be read), and managed.rs, managed_copy.rs,
API.md's accepted difference, the runtime README, FAST-PATHS' costs bullet and
the conformance crate's Policy::Exact say so. tests::fast_paths names the
choice and checks it keys no profile and that exact_answers() takes AtCommit.
The named-rounds race tests take the policy: by default each round reads, in
each byte, its own byte or one the CPU wrote to its buffer after its commit
(0xee, a later round's), never an earlier round's; under AtCommit only its
own; three AtCommit tests join the three default ones. The lane test's step 4
reads either oracle's answer by default and the 5300M's under AtCommit
(exact_answers_take_a_did_modify_range_at_the_commit).
Why: a compute benchmark's commits spent most of their time in this copy on a
discrete GPU (a CPU memcpy into write-combined staging in BAR across an eGPU
link, fresh 32 MiB chunks each time). The oracles differ on the bytes after
the commit (5300M A,B,B,A,B; UHD 630 A,B,B,B,B), so the cheaper answer is the
default and the snapshot stays behind the switch (AGENTS.md rule 1).
Verified: jobs in the report (lint both cfgs, the translator's fast_paths, the
runtime suite on lavapipe, managed_copy_device and the lane test on the RTX
3090 and the RX 7900 XTX, and the copy-in bench there before and after).
What: managed_copy_in_bench sets options.policy.exact_answers(), a method of
the policy value, in place of a call of it without one.
Why: the bench did not compile.
Verified: built in the following change's jobs.
What: tests::managed_copy_device gains managed_copy_in_bench (ignored, run in
release): did_modify_range of 256 KiB, 4 MiB and 32 MiB, written by the CPU
before each of 40 commits of a command buffer that reads the range's last
bytes, over the runtime's own Managed buffer and one over the caller's pages
through their import, on the default device and on one of
DevicePolicy::exact_answers(). It prints (MANAGED-COPY-IN) the median and
largest commit call, the median wall time to completion, the range over it in
GB/s, and the bytes copied in and the buffers parked, taken again and evicted.
And a_did_modify_range_on_unified_memory_copies_nothing: on a device with
unified memory both kinds of Managed buffer copy and stage nothing at a
did_modify_range, and the next command buffer reads the CPU's write.
Why: the copy-in at commit is most of a measured compute workload's gap on a
discrete GPU; the bench measures it before and after its change at the same
code, and the check holds the no-copy answer on unified memory.
Verified: built and run in the jobs of the following change (it has no
behaviour of its own).
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.
On a device where an unstored DontCare load stays the driver's DONT_CARE (no UnstoredClearNoSlower
under the Driver policy), the runtime's own attachment images (depth/stencil scratch, stand-ins,
backings, fetch scratches, colour twins) now start zeroed, so such a load never reads a released
texture's texels. Devices that clear those loads pay nothing. That changes runtime behaviour.
Verified by the change's own runs: on lavapipe the new test fails without the fix and passes with
it, runtime suite 2454/2454 (24582); Iris 25/25 (24584); clippy and rustdoc 24552 and 24553. The
class's other routes were read and none can be read by a program.