On RADV, a texture placed in a no-copy heap over dma-buf pages never reached the dma-buf image
path (runtime_lane::dma_buf_imports: four tests counted (0, 0) images and fallbacks where they
expect (1, 0) or (0, 1), on the Radeon 780M, jobs 4456 runs 1 and 2). Two causes:
- heap_plan makes a texture whose optimal image does not fit Metal's answer a shadow of the
tiles Metal lays it in uncompressed (HeapLayout::Uncompressed) where Metal keeps it losslessly
compressed, and host_heap_plan returned that shadow at once for any Tiled route, so the image
over the pages (a DRM_FORMAT_MOD_LINEAR image over a dma-buf of its own pages, or a linear
image over pointer pages) was never asked. Metal's bytes of such a texture are no layout of
its texels, so the driver's rows serve it as well as those tiles do, with no copy: now that
image where it serves, and the uncompressed tiles in a copied heap or where none serves. A
texture Metal tiles keeps the shadow of Metal's tiles, as before.
- dma_buf_heap_plan held the natural image's memory alignment to the heap's answer (Metal's 128
bytes, finer than RADV's 256-byte plane rule). The image's import is its own, bound at its
start, so no heap offset is held to it; its plane offset is the texels' offset in their first
page, which the driver takes or refuses as the texture is made (the shadow, counted and
announced, where it refuses), as dma_buf.rs documents. NaturalLayout's unread alignment goes.
Both routes announce heap-texture-lossless-layout per texture, as before. The tests that failed
are the four dma_buf_imports heap texture tests; the evidence is their run on RADV after this.
(cherry picked from commit 28555cdec39555657339d74bef72298b9d84e2ca)
860 recording(s) whose bounds moved: cost --check at fa07d59e81 read
read-write-tier-round-trip-uint's functions_translated and
stage_entries_specialized at 1 against 2 in the whole set's order (2 alone),
the new buffer-tails cases that sort before it translating its kernel first.
Measured on the M3 (s37-pl.sh rebless: cost --runs 8 --write over the whole
set, then cost --runs 8 --alone --write over the changed cases).
(cherry picked from commit e87334fe58c2f01915f9720463f9a950e0ea90c4)
The runtime-sources pin re-derived for clmode's tips 1-4 (bind/dispatch.rs,
bind/plan.rs, bind/plan/compute.rs, the runtime's pipeline module and warm
codec are pinned). SEMANTICS_VERSION 1991 and ARTIFACT_FORMAT_VERSION 493
come with the tips.
The inputs encoding writes open_cl_mode only where it is set, as it does every input added
after the first three; the test's projection of the derived Debug now drops its default too.
Found by m3-max-4781 (the one failure of 5187).
(cherry picked from commit eaf9f64dce040be9d03f178326ddf3cccd1c9ce4)
The vk flags type has no Not (E0600, msi job m3-max-4766); difference is
its set subtraction. Also names the byval pass's per-type plan CopyPlan,
which shadowed the Copy trait.
(cherry picked from commit 14f113d6b2db5bd71eda3ba85dabc595eb157c4e)
OpenCL C's scale kernel (if (i < n) b[i] *= k) uses no simdgroup
operation, yet on the RTX 5080 a dispatch in threadgroups of 16 paid a
second compile on emulated simdgroups and its degrade notice. The
lockstep pass orders b[i]'s read and write: two threads of a simdgroup
share their grid position's x where the threadgroup is narrower than 32
and taller than one row. The pair stands where only some threads run, so
its barrier is a subgroup barrier (a tangle barrier under maximal
reconvergence), which pins the kernel to the Direct tier's whole 32-lane
subgroups, and a 16-thread region was a partial simdgroup for the
emulated variant. In a threadgroup of one row no two threads of a
simdgroup share an x, so no pair meets and no barrier is needed.
- The lockstep analysis runs its pairs a second time where each
simdgroup lies within one row (a position's x then differs by 1 to 31
between two threads, as an index does), only where a subgroup barrier
keeps a 32-lane tier; Lockstep::rows records that none conflicts.
- Lowering takes the inserted simdgroup barriers' class after selection,
so it knows whether they are the kernel's only simdgroup semantics;
then, on a flattened tier, the kernel records RuntimeFact::RowLockstep.
- The binder runs a one-row region of such a kernel on the planned
pipeline whatever its width, that region without
REQUIRE_FULL_SUBGROUPS where it is not whole subgroups. A partial
region of two rows still takes the emulated variant.
Tests: the binder's rules (one row of 1, 16, 48 threads planned and
unflagged, 32 and 64 flagged, a 100-thread grid's edge, two-row partial
regions on the variant, no fact no exception); and on the RTX 5080
profile the scale shape keeps Direct, records RowLockstep and plans 1,
16 and 48 threads on its one pipeline, while b[gid >> 1] and a kernel
reading its lane do not.
(cherry picked from commit a6c76c206d4438e3948b05464cef7d65fd63d5ab)
A byval(T) parameter is the callee's own copy of the T its argument
points to, made at the call. Apple's OpenCL compiler passes a struct
kernel argument so: __entry_st copies the value from its constant buffer
into an alloca and calls st with that pointer byval. The inliner refused
every byval call (DirectCall), so a struct passed by value did not
compile (msi job m3-max-4674: the engine's by-value reflection test).
canon::byval::explicit now runs before pointer erasure: each call that
passes a thread-memory argument byval gets an alloca T and an
llvm.memcpy of T's bytes from the argument just before the call, passes
the copy as a plain pointer, and the attribute leaves the call and every
function's parameters. An argument outside thread memory, or a T
without a size, leaves the module as it was, and the call stays
refused, typed.
Tests: a byval argument is copied at its call and inlined; one outside
thread memory stays DirectCall at the call, naming the callee.
(cherry picked from commit 85844bd545602fa1bc14cb410e6e0b89b3a8c696)
The literal names every field, so it missed the new one (E0063, gem10
job m3-max-4637).
(cherry picked from commit f1891b98a95ca4a968283d90c450dee66ea44a1b)
OpenCL C's reqd_work_group_size(x, y, z) reaches the AIR as a trailing
kernel attribute, !{"air.work_group_size", i32 x, i32 y, i32 z}, which
the decoder refused as an unknown stage attribute. It is now
Stage::Kernel's work_group_size (each dimension at least 1, stated once,
kernels only), carried in KernelFacts, and caps the pipeline's
maxTotalThreadsPerThreadgroup, Metal's answer and the device's, at
x * y * z: the M3 Max answers 64 for (64, 1, 1) and 1024 without, and
runs the kernel in threadgroups of 64 and of 32 (job m3-max-4483). No
refusal is added: a descriptor maximum beside it is unmeasured.
Tests: the ABI decode (size, zero, twice, a vertex function); the
engine's maxima of a kernel with and without it on the M3 profile; and
the runtime device test of wg in groups of 64 and 32.
(cherry picked from commit b9fc38d7abef4bab73ad0821efa30560f136d997)
Apple's OpenCL compiler writes each scalar, vector or struct kernel
parameter as an air.constant node: a location, an optional
air.struct_type_info, the type size and alignment, the type and argument
names, and no access or address space. The entry loads the value from a
constant-space pointer, so the role is a read-only constant buffer
holding exactly its bytes, as a constant T& reference is (buffer_size is
the type size). Only a kernel takes one. Reflection then answers as the
M3 Max does in OpenCL mode: float k Float 4/4, struct {float; int} Struct
8/4, 3 past its index.
Tests: the ABI decode of the node (role, layout, refused keys, missing
size, device pointer, vertex stage); the engine reflection of a float and
a struct by value; and on the runtime device tests scale (by bytes and by
buffers at offsets), st and items with d passed by value, against the M3
Max's answers (job m3-max-4483).
(cherry picked from commit ee4ebc233112c297bbb9680535d0fffab4fb153e)
The OpenCL work-item expansion pushed a Call where InstKind::Call takes a
Box<Call>, which failed to build (gem10 job m3-max-4627).
(cherry picked from commit 2f537dcdc94760cbb274dec66d99715b4b6dd351)
A compute pipeline Metal makes with openCLModeEnabled (Apple SPI) from a kernel of Apple's
OpenCL compiler (`__entry_<name>` of a library of sourceLanguage 1) binds three hidden buffers
ahead of the kernel's own and reads OpenCL C's work-item functions from the dispatch. Metal
refuses a plain pipeline of such a kernel ("Internal compiler error"). Measured on the M3 Max
(macOS 27.0.1, jobs m3-max-4483 and m3-max-4504): its reflection lists the kernel's arguments,
each buffer 3 past its index and __local memory at its own, then __global_offset_and_num_dims
(index 0, read-only uint), __printf_buffer (1, read-write char) and
__image_order_data_type_table (2, read-only uint), all used; get_global_id adds buffer 0's offset
to the grid position, get_global_offset and get_work_dim read buffer 0, and the other work-item
functions are the global built-ins of their names.
- ComputePipelineDescriptor::open_cl_mode_enabled, carried into LoweringInputs::open_cl_mode
(part of the key) and SpecRequest::open_cl_mode; the stage-entry cache keys on it.
- air.get_global_offset.i32 and air.get_work_dim.i32 decode as AirIntrinsic::WorkItem.
- canon::opencl, after SCCP and before the global built-ins: appends the three buffers, makes
get_global_id(c) the lane plus the offset word, the offset and dimension count loads from
buffer 0, a dimension past 2 OpenCL's 0 or 1, and a dimension the kernel reads from its data a
select over the three lanes; canon::opencl::entry moves the buffer-indexed arguments 3 on and
adds the buffers' bindings, which the reflection's unspecialized path uses too.
- Without the mode the kernel compiles as Metal AIR and lowering refuses a WorkItem read
(Unsupported, Lowering(Dispatch)).
- RuntimeFact::OpenClMode records the mode; a Compiled kernel of the other mode is
InvalidDescriptor(OpenClMode). The runtime compiles its variants under the descriptor's mode,
and its warm record carries the field (RECORD_FORMAT 5).
- SEMANTICS_VERSION 1991, ARTIFACT_FORMAT_VERSION 493 (a fact tag added).
Tests: canon::tests::opencl (indices, hidden buffers, the reads' rewrite), the translator's
engine_opencl_mode (the M3's reflection, slot writes, key, the mode check), and the runtime's
opencl_mode device tests (add, lsum, cmul and every work-item function against the M3's values).
(cherry picked from commit e2fdc7b4309c2c239cf1227d0a4c6c54552c1be0)
Their recordings carried no cost bounds or timing, so every_case_carries_a_cost_recording
and every_case_carries_its_timing failed at 4245524561. Measured on
the M3 (conformance cost --runs 8 --write, cost --alone --write and times --runs 8 --write,
named cases only).
(cherry picked from commit 5cc698d661af88b23df3e952927e5d21f291e4a4)
The suite's tests ask every case for a cost and a timing record
(every_case_carries_a_cost_recording, every_case_carries_its_timing);
the case came in with its Metal answers alone.
Job m3-max-4739 at f0a3390160 (the case's tip, now development's
803648acd8): conformance cost --runs 8 --write, cost --runs 8 --alone
--write and times --runs 8 --write of the one case on the Apple M3 Max
(MoltenVK; times both legs, our leg unmeasured as it announces the
staged-texture-buffer notice). The recording's Metal answers are
unchanged; data only.
(cherry picked from commit 792747fccdc7ebf5b5453f91f983336b0fc0fe57)
Its product fingerprint follows development's versions at fa07d59e81. Blessed on the
M3 (s37-pl.sh censusbless --bless, dv-m3).
(cherry picked from commit 42455245616b61c194cfc5f5f717469072f47bac)
The runtime-sources pin re-derived for replay-24 (buffer_texture.rs,
shadow.rs, shadow_merge.rs, linear_plan.rs, error.rs and degradation.rs
are pinned).
What. Buffer::new_texture of a texture buffer whose texels run past
the buffer's length (inside Metal's allocation rule) is made instead
of returning NotImplemented(TexelsPastBufferLength), as a 2D texture
or array already is. Its texels inside the length are the buffer's
bytes; those past it lie in a tail of its own, a zeroed Shared buffer
the runtime owns, laid out from the functions' first byte (the offset
rounded down to 16, as Metal's kernels read a texture buffer).
- GPU: the texture buffer takes the staged form (StagedTextureBuffer,
announced): its bindings view the tail as their staging buffer. The
copy in takes the bytes inside the length from the buffer (none
where the texels lie wholly past it), the copy back gives only those
bytes back, and a Shared buffer's merge copies the current part from
and to the buffer and the tail apart (staged_bytes, which now names
a texture buffer's staging buffer as well as an image's, and
record_out, which copies the staging buffer's every byte).
- CPU and blits: as for 2D, each row split at the length
(Texels::past, whose rebase is now the tail's base, tail_base).
Only an IOSurface plane past its surface stays
NotImplemented(TexelsPastBufferLength); the gap's doc, its reach in
scripts/refusal-surface/reach.tsv, the StagedTextureBuffer catalogue
entry and docs/API.md's accepted difference say so.
Why. Plain Metal makes these: reims-vgpu's tbprobe on both x86 oracle
Macs (jobs m3-max-4019, 4046, 4152) and the M3 Max probe
(probes/texture_buffer_past_length.m, job m3-max-4617), whose paths
read and write the bytes past the length as one memory, as a 2D
texture's. The tail gives the 20000-byte buffer's answer for every
shape, as the 2D tail does.
Tests.
- tests/buffer_tail_device.rs: a texture buffer of 64 R32Uint texels
from 3968 of a 4096-byte buffer (32 past) and from 4096 (all past):
as made, after a kernel's write across the length (ob1_texel_buffer)
and after replace_region past it, a kernel, get_bytes and a blit
read alike; the buffer's words inside the length are written, every
other word and 16 buffers around it keep theirs.
- linear_plan unit rows: texture buffers past the length made.
- runtime_lane::buffer_textures: the texture buffer at 3968 is made.
- Conformance: buffer-tails-texture-buffer, 1024 R32Uint texels from
16384 of a 20000-byte buffer (904 inside): ob1_texel_buffer reads
and writes, getBytes, replaceRegion, blits from and into it, the
buffer's bytes; recorded on the M3 Max (3 runs, one outcome, every
site the model's answer).
Verified:
- M3 Max, macOS 27.0.1: the probe (m3-max-4617) and the recording
(m3-max-4640): buffer-tails-texture-buffer is made, announcing only
the staged-texture-buffer notice, and the 2D tail cases still are.
- gem10 (m3-max-4635): clippy of the runtime (all targets, all
features) and of runtime and validation under --cfg m2v_cpu_icd;
the runtime's unit tests (70 of 70); the runtime lane on lavapipe
(172 of 172, the new texture-buffer test among them); the
buffer_textures, texel_swizzles and degrade_notices validation lanes
(27 of 27).
- gem10 (m3-max-4662): rustdoc of runtime and conformance; the
conformance unit tests over the tails, refusal, catalogue and
accepted-difference rows (20 of 20); a lavapipe replay of the six
buffer-texture cases, all six announced as the ledger expects.
Clippy there named the shape test's two constant assertions, now
const blocks; clippy of runtime and conformance and those unit
tests again on this tree: m3-max-4688.
- Negative control (m3-max-4662): the runtime's sources at 5020e74ebb
with these tests and cases fail the new device test with
NotImplemented(TexelsPastBufferLength), and the replay refuses
buffer-tails-texture-buffer at case/texture.
(cherry picked from commit f0a3390160064eabb820fbdc4f83822e0492fb5f)
probes/texture_buffer_past_length.m makes a texture buffer of 64
RGBA8Unorm texels over a plain Shared MTLBuffer
(newTextureWithDescriptor:offset:bytesPerRow: of a
MTLTextureTypeTextureBuffer descriptor) in five shapes: inside a
4096-byte buffer (offset 3840), half past it (3968), half past it at
an offset off 16 bytes (3976), wholly past it (4096), and 24 texels
past a 20000-byte buffer (19840, allocatedSize 32768). One shape and
one path a process: a kernel's read(), a blit into a buffer, getBytes,
and the writes (a kernel's write(), a blit from a buffer,
replaceRegion) of the texels past the length followed by every read.
Each word names the byte it came from, the target's or one of 128
neighbours'.
Measured on an Apple M3 Max under macOS 27.0.1, plain Metal (job
m3-max-4617): every shape is made; inside the length every path reads
the buffer's bytes; past a 4096-byte buffer's length every read path
reads the buffer allocated next (gpuAddress + 4096), every write
changes it, and every path reads the write back; past the 20000-byte
buffer's length, inside its allocation, every path reads zero and then
what was written, and no other buffer changes. At the offset off 16
the kernel reads and writes from the offset rounded down and blits and
getBytes from the offset, as inside the length. The same as a 2D
texture's (texels_past_buffer_length.m). The header records it.
(cherry picked from commit ccc262fe8cb99c80df78bff9315fec11cdfc3394)
The XTX's BC1 to BC3 texels, unorm and sRGB, read as Metal's decode in
the runtime lane `compressed_decode::bc1_to_bc5_texels_read_the_device_s_decode`:
0 of 4096 channels off for each of the six formats (RADV, Mesa 26.2.6,
job m3-max-4261 on homelab-gem10's XTX, MESA_VK_DEVICE_SELECT 1002:744c!),
the 780M's reading exactly. Its BC4 and BC5 read as the 780M's do
too (BC4 snorm 10 channels up to 1.6/255, BC5 snorm 44 up to 1.726/255),
so `ChannelBlockDecodeIsMetals` stays off for both.
So `ColorBlockDecodeIsMetals` gains a RADV row on the XTX (0x744c, the
new AMD_RX_7900_XTX), and a BC1 to BC3 texture there no longer announces
`compressed-texel-decode`. The notice's doc, docs/API.md's catalogue,
docs/FAST-PATHS.md's row and the fact's measurement doc name the XTX.
The 12 RADV ledger rows of bc1/bc2/bc3-rgba-srgb now state that the block
decode is measured to be Metal's on both GPUs, so the sRGB decode is
what differs.
Test: `a_radv_gpu_no_row_names_takes_radv_s_driver_wide_fact_alone`
presented the 780M under the XTX's deviceID as a GPU no row names; it
now expects the XTX's two facts (the driver-wide zero fetch and BC1 to
BC3's decode) there and the driver-wide fact alone under 0x1114, at
another release too.
Pinned files change (driver_facts.rs, degradation.rs): the runtime pin
and RUNTIME_VERSION are the orchestrator's.
(cherry picked from commit 18101735f400ebe243e775a67b7d8da19ea2ad5a)
submit_per_ram_chunk printed kernelEndTime - kernelStartTime of each gather as
"ms on the GPU". It is the time the device's scheduler took to submit the
command buffer's work to Vulkan. Say so.
Verified: cargo fmt; the probe's text only.
(cherry picked from commit d7ad9d8a5ef8418d8d82b953ca3d7c9e59b8cdd4)
submit_per_ram_chunk now prints the first object's making time beside the median and slowest,
measures commits right after the objects were made (their run imports live), then, once the
device's thread imported the chunks, makes one more object per 64 MiB (in the chunks), waits
for the first objects' run imports to be released while idle, uses them again (bound in the
chunks) and measures with the chunks live. After the idle release it times three gathers:
16 runs of 512 KiB in a released chunk (their runs imported alone), the same once the chunk is
imported again, and one run at each 64 MiB (more ranges in a chunk than a copy imports alone).
(cherry picked from commit 8d0843f821babc8feffeffbaa228e067dab3696a)
On a device where each listed import costs every submission (RADV with a dma-buf source), a
guest RAM's chunks are a few long dma-bufs (2.7 GiB on the Radeon 780M and RX 7900 XTX), and
the first object over a chunk not imported imported it on its own thread: 660 to 692 ms, at
the first object over each chunk and again at a released chunk's next use. A copy over such a
chunk (copy_from_host_ram, copy_to_host_ram) did the same on the encoding thread.
Now the chunk's import is off the caller's path:
- On a listed device the device's thread (listed_chunks, in place of release_idle) imports each
chunk an object or copy asked for (ChunkSlot::asked, RamOnDevice::next_asked), and still
releases idle chunks. The object, and every object over the chunk until the import is done,
is bound in an import of its own run alone (RamOnDevice::run_alone), as on a device that
imports ahead; those after lie in the chunk.
- A buffer's (not a heap's) run import is releasable as a no-copy buffer's own import is
(host_residency.rs, AgainFrom::RamRun): released while idle, its address never handed out,
and at its next blit bound in the chunk's import where that is made and lays the bytes as the
run's did, else in its run's own import again; never the chunk's import nor a wait for one.
This holds on every device whose objects take run imports.
- A copy over a chunk not imported imports each of its ranges of that chunk alone (ranges less
than 2 MiB apart joined, at most copy::MOST_ALONE = 16), held by its command buffer, while the
device's thread imports the chunk (RamOnDevice::for_copy); more ranges than that, or where an
object's run would not be imported alone, the chunk as before.
Tests: the listed device test now checks the first object's run import, the thread's import of
the asked chunk, the holders in the chunk, the runs' release while idle and the rebind in the
chunk at the next blit, the chunks' release, and a copy over a released chunk taking its run
alone. The AHEAD copy window test expects the copy past the window to import its page alone.
Unit tests: next_asked's choice, alone_ranges' joins.
Docs: host_ram.rs, host_residency.rs, host_ram/copy.rs module docs, use_host_ram,
HostMemory::with_runs, WorkCounts::run_imports_live, FAST-PATHS.md, HOWTO.md.
(cherry picked from commit f80468eb4afac1e30f14fd99e1af06b67622a1a1)
steelbrain/replay-23 (2698f616a0, e483e17c6c): Buffer::new_texture and
new_linear_texture make a 2D texture or 2D array whose texels run past the
buffer's length, as Metal does (reims, oracle m3-max-4298; the M3, 4337),
instead of refusing it NotImplemented(TexelsPastBufferLength), which ended a
consumer's host under Policy::Dies. Inside the length the texels are the
buffer's bytes; past it they lie in a zeroed Shared tail per texture, held
as a shadow (ShadowedTexture announced): a texture over two allocations can't
be one image in place. A texture buffer or IOSurface plane past its length
stays refused. docs/API.md records the accepted difference: Metal's read of
the next allocation over a 4096-byte buffer is not reproduced. The
runtime-sources pin is recomputed.
Verified by its author: buffer-tails-kernels and buffer-tails-blits recorded
on the M3 (m3-max-4492) and replayed announced with every value exact on
MoltenVK (4508) and lavapipe (4509, 4580); 4 new lavapipe device tests plus
135 buffer-texture, shadow and blit device tests 139/139 and
runtime_lane::buffer_textures 7/7 (4509); the negative control (sources at
0e2c70f08f) fails all four at new_texture and refuses both cases; clippy and
rustdoc pass (4565, 4580).
What. Buffer::new_texture and new_linear_texture of a 2D texture or a
2D array whose texels run past the buffer's length (inside Metal's
allocation rule, past which Metal answers nil and so does the plan)
are made instead of returning NotImplemented(TexelsPastBufferLength).
The texels inside the length are the buffer's bytes, exactly as
before; those past it lie in a tail of the texture's own: a zeroed
Shared buffer the runtime owns (Texels::tail), laid out from the
texels' first byte, and no other allocation's memory.
- GPU: such a texture is kept as a shadow image (ShadowedTexture is
announced). The tail is the shadow's staging buffer; its copy in
takes the bytes inside the length from the buffer, its copy back
(staging rows clipped by inside_rows) writes only those bytes back
to the buffer, and a Shared buffer's merge copies the current part
from and to the buffer and the tail apart (shadow_merge.rs).
- CPU: getBytes and replaceRegion split each row at the length
(past_runs, write_past).
- Blits: copies that name the texture's bytes split their rows at
each side's length (RowsCopy::split) and copy the part past it
from or to the tail; a copy with an ordinary texture goes through a
scratch buffer of the encoder; synchronizeResource covers the bytes
inside the length; the extended-range rewrite announces its note
rather than binding the buffer's words past the length.
Texture buffers and IOSurface planes past the length stay
NotImplemented(TexelsPastBufferLength), whose doc now says so.
Why. Plain Metal makes these textures: reims-vgpu's oracle on the
AMD 5300M and the UHD 630 (4096-byte buffer, 64x16 and 64x17 at rows
of 256, offsets 0, 256 and 2048) and the M3 Max probe
(probes/texels_past_buffer_length.m, job m3-max-4337) for the same
shapes. Under Policy::Dies the refusal ended the consumer's host. The
M3 Max's paths agree that the bytes past the length are one memory:
the next allocation's over a 4096-byte buffer, the allocation's own
zeros over a 20000-byte one, read and written alike by every path.
The tail is the second answer for every shape; docs/API.md's accepted
differences records that the runtime never reads or writes another
allocation there.
Tests.
- tests/buffer_tail_device.rs (m2v_gpu / m2v_cpu_icd): 64x17 over
4096 bytes, 64x16 at 2048, 64x80 over 20000 bytes (row 78 across
the length), 64x1 wholly past, a Private buffer's, and a 2D array
whose second slice is past the length; each path (kernel, blit,
CPU) reads what each other path wrote, the buffer keeps its bytes,
and 16 buffers around it keep theirs.
- Unit tests: linear_plan expectations (2D and array past the length
made, texture buffers refused), RowsCopy::split, inside_rows.
- Conformance: buffer-tails-kernels (scout_read_u / scout_write_u,
getBytes, replaceRegion, the buffer's bytes) and buffer-tails-blits
(blits from a buffer across the length and from a texture past it,
a copy out into a texture, blit and getBytes reads), RGBA8Uint
16x256 at offset 4096 over 20000 bytes, recorded on the M3 Max
(3 runs, one outcome, every value the model's).
- The runtime_lane assertion that a 2D array past the length is
refused now asserts it is made.
REFUSALS.md and CONFORMANCE-COVERAGE.md regenerated.
Verified:
- M3 Max, macOS 27.0.1: probe m3-max-4337 (the shapes above); record
m3-max-4492 (both cases, 3 runs, one outcome each, every site the
model's answer); replay on MoltenVK m3-max-4508: buffer-tails-* and
the four buffer-texture(s)-* cases announced (every value exact).
- gem10, lavapipe (LLVM 23.1.4, 256 bits), m3-max-4509: unit 71/71
(linear_plan, buffer_texture, blit_plan, tail); device tests under
m2v_cpu_icd 139/139 (the four buffer_tail_device tests and every
buffer_texture, shadow and blit test); runtime_lane::buffer_textures
7/7; conformance replay of the same six cases: all announced.
- Negative control, same job: the runtime's sources at 0e2c70f08f with
these tests: the four device tests fail at Buffer::new_texture with
NotImplemented(TexelsPastBufferLength), and both conformance cases
are refused with it (case/texture, case/work).
- m3-max-4565: clippy -D warnings (runtime and conformance; runtime
and validation under m2v_cpu_icd), rustdoc -D warnings, unit
rows_split, buffer_tails, refusal and api_surface tests.
(cherry picked from commit e483e17c6c4d087a50a95cda297cf291934bee54)
probes/texels_past_buffer_length.m makes a 2D RGBA8Unorm texture over a
plain Shared MTLBuffer (newTextureWithDescriptor:offset:bytesPerRow:,
rows of 256 bytes) in five shapes, four over 4096 bytes (inside it,
one row past, offset 256, offset 2048) and one over 20000 bytes
(allocatedSize 32768), and asks one path per process what the texels
past the length are: a kernel's read() and sample(), a blit into a
buffer, getBytes, and the writes (a kernel's write(), a blit from a
buffer, replaceRegion) followed by every read. Each word names the
byte it came from, the target's or one of 128 neighbour buffers', and
the probe counts the words every write changed.
Measured on an Apple M3 Max under macOS 27.0.1, plain Metal (job
m3-max-4337): every shape is made; inside the length every path reads
the buffer's bytes; past the length of the 4096-byte buffer every read
path reads the buffer allocated next (gpuAddress + 4096) and every
write changes it and is read back by every path; past the 20000-byte
buffer's length, inside its allocation, every path reads zero and then
what was written, and no other buffer changes. The header records it.
A write of no rows (the in16 shape) is skipped rather than encoded as
a blit of height 0, which ended the process.
(cherry picked from commit 2698f616a0b23f1ff968452ce450e27fa49cdcc8)
6d7223a048 replaced the case's refused row with a lavapipe texel row and did
not re-derive the document. Verified: scripts/conformance-coverage/coverage.py
writes this; the ledger holds 3295 rows.
The case's `*` refused row (case/pipeline/argb8) waited on a pipeline
the runtime refused NotImplemented(Format) at color 0. Since the
fragment function computes Metal's 8-bit unorm blend over the texel
where no Vulkan factor gives the state on the rotated image
(f15f3b3738, the rank fix 971298dd98, and on input-attachment devices
2984f58ae6 with 284fdf5f92), it is made and runs. The replays at
f987bdc54b (development 284fdf5f92's tree) said so on both venues run:
- Apple M3 Max, MoltenVK (m3-max-4506): announced, the case's
fetch-through-scratch notice its allowance names, every texel as
Metal's; the only mismatch the stale `*` row. The runtime lane beside
it (m3-max-4560, rotated_targets) read 0 of 65,536 tie-heavy texels'
bytes differing from the RGBA8Unorm target's rotated.
- llvmpipe (m3-max-4488): case/texels/argb8 30 elements differ (U8), the
largest difference 1, beside the stale `*` row; every other case of
the argb8, fetch-ordered, rotated and blend-interaction families as
the ledger holds them.
The `*` row goes; llvmpipe gains its argb8 texel row, the device's own
arithmetic and conversion of the shader's blend (the notes the case
announces); the RGBA8Unorm rows of llvmpipe, NVIDIA and RADV keep their
counts, their notes no longer citing the `*` row. NVIDIA, RADV and ANV
have not replayed the case since it is made: their argb8 texel sites
are unmeasured, for development's batch to replay.
(cherry picked from commit 6d7223a048c73f39d248975839e617f392ce0714)
The M3 cost check at 023ed62d8c (m3-max-4391) failed on cases that now
make what they used to refuse, whose records lacked those counts:
argb8-targets-destination-alpha (its record said "no measurement:
stopped at pipeline/argb8"; 80 counts now gated), the three
format-footprints cases held for copies alone (host_texel_copies,
images_started_on_the_host, new_buffer_bytes_cleared,
requirement_images_made, requirement_limits_asked) and
mesh-limits-amplification-2 (linked_use_questions_asked, and its
pipelines-per-state ratio, 0 over 1). The stage-in reach key (13c22c1502)
also moves four attribute-stride compute cases: a dispatch whose element
can reach 2^32 bytes takes the variant with the check, beside the one
without it for the stride-4 control, so attribute-stride-buffer makes 2
variant pipelines over its 1 state where it made 1
(dispatch_pipelines_pooled and variant_pipelines_made 1 -> 2), as the
key's design gives a mixed-reach case; the other three reuse those
pipelines in the whole set (0 made) and make 2 alone.
m3-max-4506 at f987bdc54b (development 284fdf5f92's tree), debug build,
Apple M3 Max: `cost --runs 8 --write` over the whole set (1230 cases,
1229 measured; format-footprints-two-plane-ten-bit stops at its refused
RGB10A8_2P texture as before), then `cost --runs 8 --alone --write` of
these nine. The contrast: 28 count readings differ between the whole set
and alone (argb8-targets-destination-alpha 13, e.g. command_buffers_begun
8 vs 9 and argument_samplers_taken 0 vs 2; attribute-stride-inline-bytes
4; attribute-stride-plural-buffers 3; format-footprints-plain-stragglers
1), each left to the selection rather than bounded. A whole-set
`cost --runs 8 --check` afterwards exited 0: "0 load-bearing or reach
difference(s) between the records and this measurement". Only these
nine records are committed; the run's rewrites of the rest are not.
(cherry picked from commit aab0c7de8f9e76d07a334d05f7b31929631211b3)
steelbrain/perdraw-5 (3dd6b4aafb, 201aab3a6a): EncoderCore::note_reaching and
note_draw change the kept uses at the fresh uses' positions alone, in one
pass, and InstanceShadows::add changes its last-uses list in place. The
runtime-sources pin is recomputed.
Verified by its author (release, base 284fdf5f92 alternated with the tip, 3
rounds): instructions per draw 8854 -> 8746 on the RTX 5080 (entry
perdraw-perdraw-ab-2-102301) and 8246 -> 8168 on the M3 (m3-max-4523), every
shape; ns per draw within noise on the 5080, -5.6% to -9.5% on the M3.
Clippy on the runtime and the touched tests 7/7 (ms01, m3-max-4503); 26/26
lavapipe device tests with the new debug assertions.
InstanceShadows::add skipped the uses equal to the last draw's at their
place, then copied every use of the draw over the last draw's list. It now
changes the list at the positions whose use differs (adding those past it in
order, and cutting it to the draw's count), so a draw that changes one use
clones one.
Verified: the new test an_instance_gathers_the_uses_each_draw_changed draws
seven use lists that change some uses, grow, shrink and empty, checks that
each draw's uses are kept whole as the last, and that the instance gathers
what one gathering of all their uses gathers (ranges and image spans).
(cherry picked from commit 201aab3a6ae6a831a57aa89caf10f9337ae2ba64)
A command noted apart (EncoderCore::note_reaching and note_draw) compared its
uses with the last command's to find the fresh ones (NotedApart::fresh and
fresh_draw), recorded those, then copied all of its uses over the kept ones
(note and note_draw). A draw rebound with one buffer offset moved, the shape
the consumer's draws.10k takes at every draw, so cloned every use twice.
NotedApart::note_fresh and note_draw_fresh now do both in one step: they find
the fresh uses and their positions, hand the fresh ones to the caller's
record, and change the kept uses at those positions alone (those past the
kept ones are added in order; with nothing found, every use is copied as
before). What the part records is unchanged: the same fresh uses, in the same
order. The fresh, fresh_draw, note and note_draw methods go; their tests
observe the fresh uses through the record they hand on.
Verified: the new test a_command_noted_after_another_keeps_its_uses_changed_in_place
notes seven commands that change uses at some positions, grow and shrink,
and checks the fresh uses against a positional diff and that each command,
and no other, is held after it is noted. Builds with debug assertions check
that the kept uses equal the command's after each in-place change.
(cherry picked from commit 3dd6b4aafb1e5a837066878d017803fc3c5fdc4c)
steelbrain/amdperf-4 (af93012496..bb6425a766): on a device that pays per
listed dma-buf at each submission, a host RAM is imported as a few long
chunks, none ahead of use, and an idle chunk is released (its window starts
at 2 s and doubles per release up to 64 s). The runtime-sources pin is
recomputed.
Verified by its author (release, --exclusive, submit_per_ram_chunk over an
8 GiB memfd RAM): the 780M (m3-max-4338) holds 3 chunks with p50 16.2/16.3 us
per submission against 133 dma-bufs and 91.5/94.4 us with every RAM forced
ahead (development's path); the XTX (4339) 3 chunks at 16.1/15.9 us against
133-134 at 90.7/94.8 us; every chunk released after the idle wait. host_ram
device tests 47/47 twice on the 780M (4456); clippy plain, m2v_gpu and rustdoc
(4145, 4235).
Known at landing, fixed forward by its author: the first object over a chunk
not yet imported blocks while the chunk imports (660-692 ms per 2.7 GiB
chunk), and so do copy_from_host_ram/copy_to_host_ram; and
runtime_lane::dma_buf_imports fails 4 of 17 on the 780M at check_images
(heap textures over dma-buf pages not reaching the dma-buf image path),
expected to be on the base already, unverified.
clippy (--cfg m2v_gpu) refused vec![a..b] as a single-range vec (gem10 job 4113).
Verified: the next gem10 check runs clippy in that configuration.
(cherry picked from commit 0363c7bf3606797bf7505e382386c06340b6c5f2)
Where the device imports dma-bufs, the RAM has a source and the device's held imports add to the
cost of every submission (RADV), each listed import costs every submission: an 8 GiB RAM as 128
dma-bufs of 64 MiB raised a submission's median from 14 us to 60-88 us on the 780M (probe
submit_per_ram_dma_buf, job 3904), as 3 of 2730 MiB to 16 us.
There (Plan::listed) a chunk is as long as one dma-buf of the source holds
(HostRam::with_largest_dma_buf, new: udmabuf's size_limit_mb) and maxMemoryAllocationSize,
maxBufferSize and maxStorageBufferRange take, in whole 64 MiB (listed_chunk_bytes). No thread
imports ahead and no run is imported alone; the device's thread instead releases a chunk only its
slot holds once it stayed so for its window (2 s, doubled per release up to 64 s, as a no-copy
buffer's idle import), counted by the new WorkCounts::host_ram_chunks_released.
Tests: listed_chunk_bytes and long chunk_spans unit tests; a device test
(where_each_listed_import_costs_a_submission_...) of one long chunk, none ahead, kept while held,
released once idle and imported again; the probe submit_per_ram_chunk (8 GiB memfd RAM, an
object over each 64 MiB). Docs: host_ram.rs, with_runs, HOWTO section 6, FAST-PATHS idle-release
row, api_signatures.
Not built yet: the next commits fix forward what the build finds.
(cherry picked from commit e313ddd4201e87a76490a36eb394281d6961dbc9)
So that every import is resident when the commits start however long the
making took (the residency thread releases an import idle for 2 s), and the
line after says whether they stayed so.
(cherry picked from commit f6090087a2b21cba05d6cd9ed045303bca7ad8b5)
A probe for the guest RAM finding: an 8 GiB memfd's pages held as no-copy
buffers over dma-bufs of 64 MiB (the runtime's guest RAM chunks), 512 MiB and
2.67 GiB, against none, each phase's imports used once before 300 waited
commits so that all are resident, and the residency counts printed after them.
(cherry picked from commit af9301249669cd6db3a04a11acdc4c7bbea867d5)
5cf7146404 read f.facts at pipeline/link/graphics.rs, where fs is the
fragment's StageInterface, which has no facts (E0609): the facts live on
the FunctionArtifact. development's metal2vulkan lib and lib test did
not compile (m3-max-4430, m3-max-4462).
link.rs now collects the colors whose blend the fragment states as
RuntimeFact::RotatedInputBlend, beside fetch::input_blends, from the
FunctionArtifact it already holds, and graphics_state takes them with
input_blends; the input attachment check admits a rotated attachment's
input attachment where that set names its color, as 5cf7146404 meant.
(cherry picked from commit f987bdc54be459b8303e87bc7ac9fbd9fed1de39)
Clippy denies the slice in lower/ (indexing_slicing; job m3-max-4319, all three configurations).
(cherry picked from commit cc10767b132d8064b10e15257ad31c4eabc27567)
llvm-as rejected the nested carrier joined with resident()'s and-xor spelling, which defines %n
too (residency_of_status_words_is_lowered, job m3-max-4316).
(cherry picked from commit b8eb13d92003a2ce159905ed9016164f715d64eb)
The texture-aggregates change (bb664f60be) changes translation. Its branch
took 1988; development had reached 1989 (the stage-in reach key) before it
landed, so it takes 1990.
(cherry picked from commit ea041657be, version renumbered at landing)
A device test (m2v_gpu, m2v_cpu_icd): a texture buffer's texel read, its channels rearranged and
written back into the read's own { <4 x float>, i8 } with insertvalue and taken out again, as
the GL code generator writes it. Two shapes: a zyxw swizzle, and three reads combined, the
second's and third's x placed in the first's y and z. Each stores the texels the IR computes.
(cherry picked from commit 396be8bf36cebde65e2bfc322dd84e5a8c681d2a)
Apple's GL code generator writes a texture read it swizzles back into the read's own
{ <4 x float>, i8 } with insertvalue and takes the texel out again. The status analysis knew a
carrier only as the call or a whole copy (phi, select, freeze), so any insertvalue exposed the
word and every GL texture-buffer shader on the 5080 guest was refused as
Unsupported(Lowering(Texture), NotImplemented).
A carrier is now a value plus the member path at which it holds a call's word: [1] in the call's
own result, empty in the word itself. Copies keep the path. An insertvalue into a carrier carries
it unless it overwrites the word's member, and an insertvalue of a carrier carries it below the
member it writes. An extractvalue shortens the path, observes nothing when it takes another
member, and takes the word at its own member. A word re-inserted whole demands no bits there:
they are demanded where it is taken again. Every other use of a carrier (a store, a call, a
return) still exposes the word and is refused. This holds for every call the analysis already
followed: read, sample, sample_grad and gather, compare forms included, on every texture type.
Tests (engine_texture_tail): four new carrier forms. The texel reinserted, a {T, i8} rebuilt
from its members, a read nested in a larger aggregate, and a select of a read and its rewritten
copy. Each, and a word overwritten, compiles on every profile with the texel only taken, with
Metal's texels on the interpreter. Each carries resident() to a lowered residency read, plain
and sparse. Each refuses the whole word taken after it, as does a read stored whole.
(cherry picked from commit bb664f60be54c6e443cc13a619760542663ba5bc)
steelbrain/perdraw-4 (10 commits, to 8d237c7bf3): argument table stamps from
a per-thread block; the encoder keeps what a key's use takes from HostAliases;
a render encoder's attachments' memory worked out once per layout version;
the bind memo keeps where a bound buffer over host pages lies; a rebound
vertex buffer whose offset alone moved reuses its space; draw_costs gains
--heap, --threads and Linux perf counters. (ee82777c55 and 899a9eb79b do not
build alone; every commit from 3e04691a77 on does.) The runtime-sources pin
is recomputed.
Verified by its author on the RTX 5080 (t batch, job m3-max-4427, release,
base alternated with tip, 3 rounds of --runs 5), per draw: 10k 465 -> 416 ns;
10k --heap 461 -> 402 ns; 10k --heap --threads 3 653 -> 433 ns (-34%);
host_alias_lookups per draw 1.000 -> ~0. On ms01 (4399): clippy on the
runtime and the touched tests 23/23. At this landing the signature table
check passes and the refusal surface and coverage re-derive with no change.
The attachment memo commit (1a6da446ee) added RenderLowering::attached, which the lowering an
execution of render commands makes (render/executions.rs) did not set (E0063, M3 job m3-max-4390).
(cherry picked from commit 8d237c7bf38f4996469c74b58789133ea9864fcf)
Every draw rebound wrote its changed buffer slots' descriptors again (binding::rebind_into), each
reading where its buffer lies (Buffer::space): for a buffer over host pages, the pages' lock and a
clone and drop of the pages' Arc (and on Linux the held import's), and for one placed in a no-copy
heap, the heap's own buffer's, which every encoder of the device reads. The consumer binds each
draws.10k draw's bytes in a heap over the guest's RAM, so every draw of every encoding thread
locked and wrote that one cell: HostCell::lying was 2.9% of the graphics threads' samples on the
RTX 5080 host, Buffer::at_for 1.0%.
The bind memo an encoder takes (binding::BindMemo) keeps where up to four buffers over host pages
lay (buffer::KeptSpaces), by their cell's address held weakly, read under the process's count of
no-copy buffers' moves: a buffer lies where it lay until one moves (HostCell::replace counts each
move under the cell's lock), and its import, once read for a binding, stays imported. A slot
descriptor of such a buffer, or of one placed in such a heap, is read from there with no lock and
no write another thread reads.
Verified: in builds with debug assertions every kept answer is compared with the cell's own; the
runtime suites; no_copy_lies_read and cycles a draw in the perdraw report.
(cherry picked from commit c98cda26a4c6669c77201a04c1bc3b63df845cb3)