2f44dda930a11b3bff86cc2f683d649300bd7178
697
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
8de3a6023b |
Regenerate REFUSALS.md and the API signatures for RasterizedVoidVertex and open_gl_mode_enabled
(cherry picked from commit a479dc65fc8840b739a35c2e94b15dc4cdf81afa) |
||
|
|
fe494f10cd |
Run a one-row threadgroup of a lockstep-only kernel on its own pipeline
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) |
||
|
|
5e4e9bc60c |
Make a byval argument's copy at its call, so the inliner takes the call
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) |
||
|
|
f87e50df30 |
Cap a kernel's threadgroup at its required work-group size (air.work_group_size)
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)
|
||
|
|
c0965318a6 |
Decode an argument passed by value (air.constant) as a constant buffer of its own size
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)
|
||
|
|
93d2fc8b95 |
Link a kernel of OpenCL mode as Metal links it: hidden buffers and work-item reads
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)
|
||
|
|
803648acd8 |
Make a texture buffer over a buffer whose texels run past its length, those texels in a tail
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
|
||
|
|
76f46963b6 |
Driver facts: RADV on the RX 7900 XTX decodes BC1 to BC3 as Metal does
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) |
||
|
|
6a31655071 |
Guest RAM on a listed device: no making or copy waits for a long chunk's import
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) |
||
|
|
9ee7323e76 |
Make a 2D texture over a buffer whose texels run past its length, those texels in a tail
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
|
||
|
|
96482aadbf |
Re-derive the conformance coverage document for argb8-targets-destination-alpha's rows
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. |
||
|
|
48ba1d9856 |
Guest RAM on a device that pays per listed import: few long chunks, none ahead, idle ones released
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) |
||
|
|
32c15dd1b8 |
Follow a texel call's status word through member insertions and extractions
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)
|
||
|
|
2984f58ae6 |
Admit an ARGB8Unorm attachment's input attachment for the function's own blend over it
On a device that orders fetch through rasterization-order input
attachments (lavapipe),
|
||
|
|
3a34b49814 |
Leave copies-only formats to format-footprints in the texture table, and refuse their fills
Two tests from the afb4e8cc2b copies-only change, which never had a whole
suite pass:
- textures' the_table_is_exactly_the_formats_whose_texels_are_metals_bytes
wanted a texture-round-trip case for ARGB8Unorm_sRGB and the other formats
now held for copies alone, since byte_format answers their R16_UINT or
R32_UINT. format_footprints already records the same host round trip of
each of them (fresh read, replaceRegion: over BEFORE, read back), beside
the footprints and texture types Metal answers. So the table's predicate
leaves them to that family.
- blit_fill's every_texture_format_has_a_fill_unit found no fill unit for
them. A fill of such a texture reached
internal("a fill of a format the runtime makes no texture of"). Metal's
fills of these formats are not measured, so a fill is now refused
Unsupported(Format, NotImplemented), named by its format, as their sparse
textures are. fill_texture's doc and docs/REFUSALS.md (the new blit_fill.rs
site, regenerated) say so, and the test excepts the copies-only formats.
Found by m3-max-4172 and m3-max-4304 (ms01).
The previous commit's message (ee5ba4cbab) says
candidates_are_known_formats already skips copies-only formats. The test
that does is direct_formats_round_trip.
(cherry picked from commit 9a22813ff057ffd81cce438c7a49652798f67bf7)
|
||
|
|
a0eda5a037 |
State which integer operations are folded for an OpenCL kernel's immediates
The API guide said an integer operation on a narrow width is folded over constants; SCCP folds ctpop, bitreverse and bswap alone (94d75b4fad), and a narrow min or max is refused. (cherry picked from commit 12cc0037e02e018d5196e3c6145ceb88bdcdc593) |
||
|
|
d2f766e88e |
Fold only the integer bit operations in SCCP
Folding llvm.umin and the other two-operand integer intrinsics over constants made seven engine_arith tests fail (job m3-max-4310). Their kernels take an opaque integer as llvm.umin(C, -1), so a NaN or denormal pattern reaches the device without float arithmetic. OpenCL C's mem_fence needs only llvm.bitreverse. SCCP now folds ctpop, bitreverse and bswap, and leaves the rest to run where they did, so no module outside the OpenCL shapes changes. (cherry picked from commit 94d75b4fad376c3138a467893adaa42dedf65a75) |
||
|
|
89d8e46d26 |
Bind an intrinsic's immediates from the call sites of the function passing them on
Metal's compiler leaves OpenCL C's barrier(flags) and mem_fence(flags) out of line: an internal
function passes its parameter on as air.wg.barrier's flags, and mem_fence computes
air.atomic.fence's flags from it through llvm.bitreverse.i2. Every call site passes a constant.
Decode refused the call (Intrinsic(ImmediateNotConstant)), and so every OpenCL kernel that
synchronizes was refused.
Decode now keeps such a call as Callee::Unbound, with the family its declaration names
(intrinsics::Template). Once inlining has made the parameter the call site's constant, SCCP's
edit binds it in the same rebuild, with no pass of its own. SCCP also folds the integer llvm.*
operations (min/max, ctpop, bitreverse, bswap) over constants. LlvmIntrinsic::NarrowInt decodes
those operations on widths no SPIR-V type has (i2), so the fence's flags fold. An immediate still
not constant after canonicalization is refused at the call, in post_check, with the inlined
entry's function location. A NarrowInt that survives is refused as Lowering(Arith).
Tests:
- canon::tests::unbound_immediates: each call site binds its own flags; binding meters no more
work than the constant twin (264 vs 265 units) and prints the same module; the i2 fence binds
after folding; flags read from a buffer are refused at the call.
- intrinsics::tests: the narrow-width decode.
- runtime tests::opencl_kernels: a barrier and a fence out of line compute what the M3 and the
Intel UHD 630 compute.
Verified on the same changes at base
|
||
|
|
e2aa48a1dd |
Bless the API signatures for RuntimeFact::RotatedInputBlend and regenerate the refusal surface for rows2's sites
The argb8 commits (413c737777, 75e73605c7) add the RuntimeFact variant RotatedInputBlend and move a Format refusal's sites; neither generated file was refreshed on the branch. Verified: signatures.py --check passes after the bless; refusal_surface.py regenerates with this change only. |
||
|
|
f15f3b3738 |
Blend ARGB8Unorm in the shader where no Vulkan state on its rotated image gives Metal's blend
An ARGB8Unorm attachment is an R8G8B8A8_UNORM image holding Metal's alpha, red, green and blue in its red, green, blue and alpha. A blend whose factors read Metal's destination alpha in a colour factor (or the saturated source alpha, the blend colour's red, green or blue, or different colour and alpha operations) has no Vulkan factor on that image, and the pipeline was refused NotImplemented(Format) on every device, where plain Metal makes and runs it. Metal blends the format as RGBA8Unorm with its channels rotated (recorded by argb8-targets-destination-alpha). So the fragment function now computes Metal's 8-bit unorm blend (extended_range::Blend::unorm8, the model the storage form already uses for RGBA8Unorm) over the texel rotated into Metal's order: - where the device orders fetch through the pixel interlock alone (MoltenVK, RADV, ANV, NVIDIA), in the interlocked storage form: StorageView::rotated rotates each texel read and written, the storage form now takes the RotatedView emulation, and unorm8_format includes ARGB8Unorm; - where it orders fetch through rasterization-order input attachments (lavapipe, SwiftShader), over the input attachment: a new RotatedInputBlend plan and RuntimeFact::RotatedInputBlend, the blended value written through the rotated output, link giving no Vulkan blend; - on a device with neither ordering, the pipeline is refused FramebufferFetch needing either one (fetch::unordered_extended_fetch). The routing predicate is color_writes::shader_rotated_blend (rotated_blend refuses the blend NotImplemented(Format), and no factor reads the second source). Second-source factors stay refused. The device's conversion of the result is noted (DeviceColorConversion); a module stating no math is noted as other unorm8 storage blends are. SEMANTICS_VERSION 1985 and ARTIFACT_FORMAT_VERSION 491 are provisional (a new RuntimeFact variant changes the encoding): renumber at landing if taken. Verified: none yet; build, tests and the conformance case follow. (cherry picked from commit 413c7377771fc524b7d974747b25062260ea5646) |
||
|
|
b5fa3a8067 |
Bless the API signatures and re-derive the coverage doc on the rebased tree
On development
|
||
|
|
1fcaa5aa58 |
Read an executed indirect command's unstrided buffer at stride 2^32-1, as Metal does
An executed indirect command's kernel or vertex buffer set without an
attribute stride (the plain setter, or the stride form at
MTLAttributeStrideStatic), on an indirect command buffer that supports
dynamic attribute strides, under a layout of
MTLBufferLayoutStrideDynamic, was refused
NotImplemented(RuntimeGap::IndirectCommandUnstridedBuffer): plain Metal
reads it at the record's 32-bit stride word, 2^32-1 (measured on an M3
Max under macOS 27.0.1 with markers at bytes 2^32-1 and 2^32 of a buffer
past 4 GiB, compute and render alike; the stride form at 0xFFFFFFFF read
the same), which the 32-bit fetch could not place. The pulled fetch now
places a displacement past 32 bits (its reach check,
|
||
|
|
50c03d4b54 |
Make a mesh render pipeline of maxVertexAmplificationCount above 1, and refuse its amplified draws
Metal makes a mesh render pipeline of maxVertexAmplificationCount 2 and answers its limits as the plain pipeline's (the mesh-limits-amplification-2 recording, M3 Max); the translator refused it at creation, NotImplemented(VertexAmplification). Now it is made, without multiview (a mesh pipeline draws no amplification as a view, so graphics_requirements asks no multiview of it), and a draw of one amplification, Metal's default, draws as a pipeline without amplification does. The refusal moves to the draw of more than one: the binder refuses a mesh pipeline's multiview route and its one-at-a-time route alike NotImplemented(VertexAmplification) (the second was MeshShading). No exact form is built: multiview may run the task stage once a view where Metal runs the object function once a draw, and a draw per amplification reruns it and needs the mesh function to add a view mapping's offsets. Test: engine_mesh's an_amplified_mesh_pipeline_draws_one_amplification (made on every committed profile, no multiview requirement, a draw at count 1, both routes at count 2 refused); the creation table's amp-2 row now expects the pipeline. docs/FAST-PATHS.md's known gap and docs/REFUSALS.md follow. Not yet run. (cherry picked from commit fe4aa26ba199c3bc8aedff48543623d09489122a) |
||
|
|
51b8007dd9 |
Docs for the formats held for copies alone
docs/FAST-PATHS.md's known gap of the 26 footprint formats now says which twenty are held for copies alone and what stays refused (reads, writes, renders, views, texel buffers' reads, sparse textures), and why the four RGB10A8_2P formats stay unheld: Metal lays them out in two planes, as RGB10A8_2P_XR10, whose blits between textures move both, and one bytes image of the texel's word would not hold the second plane. (The previous commit's message said Metal's blits of RGB10A8_2P move two planes; that is RGB10A8_2P_XR10's measurement, not theirs.) docs/API.md gains the accepted difference of seven of them, whose host copies plain Metal leaves as no-ops at 16x16 under ShaderRead (the format-footprints-padded-wide-channels recording), where the runtime moves the bytes, as for the padded 10-bit formats Metal keeps compressed. docs/REFUSALS.md re-derived (the sparse refusal's new site). (cherry picked from commit 8b4a0783997511a3ffcda495f3887749da56ca4a) |
||
|
|
4df5d48abe |
Ledger: drop the 8 RADV rows that rows3's two fixes settled
rows3 ( |
||
|
|
c418a1f55b |
device-texel-conversion: state RADV's nearest-sample flush of a denormal float texel
PrecisionNote::DeviceTexelConversion's recorded bound named NVIDIA's gathers, which flush a 32-bit float texel's denormal to a zero of its sign, and answered Metal's value for every other class. On RADV (Mesa 26.2.6, both the RX 7900 XTX and the Radeon 780M on 2026-11-07), denormal-word-fetches differed at its four nearest-sample sites alone: each differing word is a denormal against the zero of its sign (largest difference 0x7FFFFF, a whole mantissa), and none of its gather sites differs. So the device's samples flush and its gathers keep. That is the device's native answer (rule 1), announced for the case as device-texel-conversion, and the note's documentation now says so, in artifact.rs and in docs/API.md's catalogue entry. The case's module doc records the RADV reading beside its runtime_lane one. Doc comments only: no product path changes. artifact.rs is outside the runtime sources pin, and degradation.rs is not touched. Verified: the replays m3-max-4102 and 4108 (the four lines, identical on both GPUs), and the driver version read with vulkaninfo (m3-max-4201). (cherry picked from commit 7fc262b99f7ab4b080e9efb506021908fa9121e4) |
||
|
|
9ab152f477 |
Ledger: RADV's remaining families, 295 rule-1 rows (275 RADV, 20 NAVI31)
The rest of the RADV ledger round: every line the whole RADV replays read as unlisted, on the RX 7900 XTX (m3-max-4102, 306 lines) and the Radeon 780M (m3-max-4108, 281 lines, each identical to an XTX line), except the 10 lines the case declarations of b5c45c23cf settle and pass-bytes-srgb-decode-all-bytes' one line, which amdperf owns. Each row names the native note the RADV run announced for its case at that site (the case block's "the device's native notes this case announced" line, or a case-declared notice that fired), and states the device's own answer with RADV's first differing element and largest difference: - 275 rows read "RADV": the 780M holds each of them with the same answer, so a RADV row holds on both of the consumer's AMD GPUs. - 20 rows read "NAVI31": ycbcr-gathers-* and ycbcr-minify-band-*, where the XTX's memory is not the host's and the slot binds a converted image. The 780M, which reads the planes in place, does not diverge there. Families with a text of their own: - sampler-r-address-modes and sampler-border-colours: one lane, r the negative smallest subnormal, which Metal reads as layer 0 and the device reads below it. - sampler-axis-mode-triples: the device's weight in whole 1/256 steps. - denormal-word-fetches: the device's nearest samples flush a denormal and its gathers keep it. - BC1 to BC3 sRGB: the sRGB decode moves, since the 780M's block decode is measured to be Metal's. BC4 and BC5: the device's decode. - a2c-*: the device's coverage at alpha 0.5 is samples 0 and 2, and its resolve rounds a tie down, as device-rounded-resolve records for RADV. - texture-fills, nearest-sample-positions, sample-positions-default-*, math-frexp-ilogb-half, the pass-bytes tanh and encode sites, and blend-interaction-format-*. The other rows take another venue's venue-neutral text, after the first differing element and the largest difference were substituted and the text was read against RADV's answer. docs/CONFORMANCE-COVERAGE.md re-derived (scripts/conformance-coverage). Proof: the whole RADV replay on both GPUs at this branch's tip. (cherry picked from commit 2e0f7f2baf5f72200580b2092005e49645eca4be) |
||
|
|
1b5c55ed02 |
Linux exit: wait for the runtime's work within the bound, then run the earlier exit handlers
On Linux with glibc the exit hook waited for nothing: with another thread's section or a CPU device's work in flight it wrote the at-once notice and called _exit, so every exit handler registered before the runtime's last registration was skipped. QEMU registers its exit notifiers (usb-host's re-attach of host USB devices to their drivers, tap's downscript, the pidfile unlink) and its terminal restore before the device exists; a quit in that window left a user's host USB devices detached. Metal's exit runs those handlers. The hook now waits there as on macOS: for the sections in progress at most BOUND (2 s), at most MAKING_BOUND (60 s, with its notice) while a pipeline's making is in progress, then for a CPU device's work within what is left; once they ended it returns and the earlier handlers run. Only past the bound does it end the process at once with the exit's status (the notice now names the bounds), which keeps a driver deadlocked inside a submission (the GPU-assisted validation layer's) from holding the exit and keeps destructors from running beside the driver's work. After the hook returns no call of the runtime's is in flight: a section publishes its calls' results before it ends, and none starts once the guard closed. What may still call the driver is the program's own threads (their race, as before) and the driver's own threads (Mesa's thread queues, which its own exit handler joins after the hook): the module docs say so. Tests: an_exit_runs_the_handlers_before_the_hook_once_the_work_ended (a section, and a CPU device's work, ending 100 ms into the exit: the handler registered before the hook runs, no notice), which fails where the hook waits for nothing; a_busy_exit_past_the_bound_ends_at_once_ with_its_status (stuck section or CPU work: the exit's status, the notice, after 2 s and within 3 s); the_at_once_notice_names_the_bounds. The exits lane expects the wait on Linux as on macOS. Docs: exit_guard.rs, pool.rs, shader_cache/worker.rs, docs/API.md's accepted difference. (cherry picked from commit ec4b802fce26f18920ba0586eeadf32fe694816e) |
||
|
|
231a7d86f7 |
Put a DontCare colour's kept texels behind DontCareColorPolicy::Kept
The owner's rule 1 keeps the fast form of every speed-for-accuracy choice the
default. A colour attachment of a texture's own image stored DontCare now
stores as the driver stores it by default (DONT_CARE where the driver is
measured to keep one of Metal's answers or to store as Metal's own, else
STORE), announced dont-care-store, and renders through the pooled backing
that keeps its earlier texels only under the new opt-in switch
DevicePolicy::dont_care_colors = DontCareColorPolicy::Kept, which
DevicePolicy::exact_answers() selects.
- metal2vulkan: the new public field DevicePolicy::dont_care_colors and enum
DontCareColorPolicy { Driver (default), Kept }. Its docs give each form,
its cost and Metal's documentation ("You need to assume that GPU discarded
the texture's contents"). The runtime alone reads it, so no profile carries
it (tests::fast_paths checks that no fingerprint moves).
- runtime: kept_bytes::settle takes the backing only under Kept. The docs of
kept_bytes, render_target, attachment_stand_in, degradation and
WorkCounts::kept_texels_passes, which counts only the Kept form's passes,
now say which policy they describe.
- docs/FAST-PATHS.md: the choice moves from "Costs of matching Metal" into the
table, as a row with its default, its switch, its bound and its measured
cost. docs/API.md's dont-care-store entry and the Render passes accepted
difference name the policy.
- Tests of both settings. dont_care_stores' default-policy tests are back to
their earlier form (each texel one of Metal's two answers, announced where
the driver does not store as Metal's own) and assert that no pass took a
backing. The new exact_answers_keep_a_dont_care_color_s_earlier_texels_on_
every_driver runs under Kept: the single-sample cases, both barriers and the
two 4x colours keep their texels exactly and are counted.
deferred_calls's refused-end test is back to its DontCare form.
clear_reach gains lane_with.
- conformance: the Policy::Exact doc lists queue_sharing and dont_care_colors.
The colour case's dont-care-store comment says what each policy gives.
- The known-gaps ledger keeps the eight pass-sequence-color-actions rows
removed. It is held against `conformance replay`, which takes the exact
policy, as the BGRA10_XR compressed-blit rows already are.
- The API signatures are blessed and docs/CONFORMANCE-COVERAGE.md is
re-derived (its ledger table had kept the rows that both families removed).
REFUSALS.md does not change.
Verified: cargo fmt only. The Linux clippy, rustdoc, suites and lavapipe
replays under both policies follow as potluck jobs.
(cherry picked from commit ec3479464c0f72ab5443223a28e23e84ec23e78d)
|
||
|
|
8d8db05c06 |
Record what a bit-24 no-copy buffer's dropping copy costs off macOS
On the RTX 5080 Laptop GPU, commit to completion, median of 300 (the scratch example rows3_cost, b5080 entry rows3-t2 in batch m3-max-3848): beside a live 16 MiB copy whose pages carry no log, a 256-byte fill into a writable 16 MiB no-copy buffer took 1.5 ms (49 us beside a 64 KiB copy), and the same fill into the copy 2.6 ms; into a 64 KiB copy 53 us. Before the page-at-a-time restore (rows3-t1, same batch) the fill into the 16 MiB copy took 13.1 ms. The known gap in docs/FAST-PATHS.md now says so; one code span there is rewrapped onto one line. (cherry picked from commit 3c595e52ada9f9088a86e8077ab6a536c43c204f) |
||
|
|
75137702ab |
Record what a DontCare colour's kept texels cost
Family A's change came in be0b42bc67/568dd0d59b (a DontCare colour of a
texture's own image keeps its texels through a pooled backing) and
18b42a54bc/e3b68145f3 (drop the pass-sequence-color-actions rows). Their
subjects say WIP and they have no body, so this is their body:
What: kept_bytes::settle now also renders a colour attachment of a
texture's own image stored DontCare (not memoryless, resolving nothing,
not over a buffer) through a backing its queue keeps for the
attachment's shape (attachment_stand_in::pooled_backing, which now takes
whether it copies, Cause::KeptTexels), into which a Load copies the
texels first; the backing is stored DONT_CARE and nothing is copied back.
Not where the pass hands the store to a driver whose DONT_CARE is
Metal's own (MoltenVK), nor the viewed/executes/taken passes, nor where
a format makes no stand-in. No dont-care-store is announced for it, as
the texture keeps Metal's answer; WorkCounts::kept_texels_passes counts
each such pass.
Why: Metal's documentation leaves a DontCare store's contents open ("You
need to assume that GPU discarded the texture's contents"); what the M3
Max leaves, measured by pass-sequence-color-actions over eight runs, is
the attachment's texels from before the pass. Vulkan's DONT_CARE leaves
them undefined, and llvmpipe and the RTX 5080 left the pass's clear and
draw (8 ledger rows). STORE_OP_NONE does not keep the texels of a pass
that writes, so no store op alone matches; the backing does at the cost
below.
Verified:
- lavapipe: pass-sequence-color-actions every plane equal to Metal's
(m3-max-3621, m3-max-3768, m3-max-3807 at the rebased tip); the whole
lavapipe set matches the ledger exactly (3768: 1156 rows; 3807: 1137);
the touched lane tests pass under m2v_cpu_icd (48 at the tip, 3807),
among them dont_care_stores'
a_dont_care_color_keeps_its_earlier_texels_on_every_driver, which
counts kept_texels_passes.
- MoltenVK on the M3 Max: the case announced, its planes exact
(m3-max-3743, m3-max-3822); 46 lane tests pass under m2v_gpu.
- Negative control (keeps_texels forced false, steelbrain/rows3-negctl,
m3-max-3729): the 4 llvmpipe rows come back.
- Costs (this commit, docs/FAST-PATHS.md): the scratch example
rows3_cost on the RTX 5080 (b5080 t entries rows3-t1, rows3-t2, batch
m3-max-3848) and lavapipe (m3-max-3765, m3-max-3782).
(cherry picked from commit b0197dcf1103f2794723a2cf520f20d698a7b2fd)
|
||
|
|
3eb84d76c6 |
Off macOS, drop the GPU's writes to bit-24 no-copy memory through a copy
Metal drops what a shader or the blit engine writes into no-copy memory made with its private option bit 24: the write completes with no error, a later command of the same command buffer may read it back, and neither a later command buffer nor the CPU sees it (probes/readonly_gpu_writes.m, an M3 Max under macOS 27.0.1; the owner's ruling of 10-23: drop, never refuse, on every driver). macOS imports the pages through a read-only view of them. Elsewhere the import was of the caller's own pages, so the GPU's writes reached the pages, the CPU and later command buffers (host-page-writes-kernel-store-read-only and host-page-writes-visibility-read-only diverged on llvmpipe and the RTX 5080), announced as private-resource-option. No import can keep the writes out there: Linux drivers pin imported pages for writing, and ANV lost the device and RADV failed every submission over read-only imported pages. So off macOS such a buffer, heap or rebind is made over a copy of the pages whose GPU writes are dropped, the mechanism copied.rs already has for pages the process maps read-only: each commit copies in what the CPU changed, later commands of the batch read the GPU's writes, and the batch's completion puts every byte the GPU changed back, writing nothing to the pages. The gate is not asked (nothing is imported), the copy joins no other buffer over the bytes, and a rebind whose bytes moved in their page is now a copy laid out at the old offset rather than refused. - buffer_descriptor.rs: buffer_over_host_memory makes the copy (CopiedFor::ReadOnly) where drops_writes and the system maps no read-only view; the rebind path copies the same way (read_only_copy); copied_buffer takes why it copies, and passes read_only to CopiedBuffers::add and drops_writes to the buffer's HostCell. no_copy_options moves here from degradation.rs and no longer announces private-resource-option off macOS (that notice stays for a heap of the runtime's memory and an indirect command buffer). - copied.rs: add() takes read_only, which drops the copy's GPU writes whatever the pages' protection. - buffer.rs: BufferParts carries drops_writes into host_lie. - New: CopiedBecause::ReadOnly, WorkCounts::copied_read_only_memory. - Docs: read_only_view.rs, copied.rs, capabilities.rs (the answer stays no off macOS), values.rs, host_backing.rs, interop.rs, host_aliases.rs, error.rs (RebindTextures is macOS-only now), degradation.rs, docs/API.md (private-resource-option, copied-host-pages), docs/HOWTO.md and the docs/FAST-PATHS.md known gap: off macOS a command buffer committed while the writer is in flight still reads its writes, and a render pass's store-out into the copy completes where Metal's faults. - Tests: degrade_notices' bit-24 lane tests assert the writes are dropped on every driver and count the copies (3 and 1 off macOS, 0 on it) and the kinds (copied-host-pages off macOS, none on it); copied_surfaces' dropping buffer is a copy of its own off macOS. - host-page-writes read-only rows declare copied-host-pages in place of private-resource-option; their 8 ledger rows are removed. - api_signatures.tsv blessed for the new field. Verified: see the replay and lane-test jobs named in the branch report (lavapipe, the RTX 5080 through b5080, MoltenVK on the M3). (cherry picked from commit 1f24b1f035d61f093ecf2c76fae4b9c2e4b541d9) |
||
|
|
f085d298cb |
Regenerate REFUSALS.md for kept_bytes::settle's second Render site
kept_bytes::settle now matches NotImplemented(Render) from the pooled backing of a DontCare colour (it keeps the pass in place there), which the refusal surface reads as a second site of gap::Render. Regenerated with python3 scripts/refusal-surface/refusal_surface.py; no refusal changed. (cherry picked from commit 8ca3ed766dc2d022ace03a294694d78b03faf7a9) |
||
|
|
e08ad161e6 |
WIP: a DontCare color of a texture's own image keeps its texels through a pooled backing
(cherry picked from commit 568dd0d59b0ae6b30a6308a2f7587cfe7c4a41dd) |
||
|
|
c0d0511d68 |
Ledger: RADV's half-output-blends, pixel-downscales, half NaN, pixel-samplers and vertex-format families, 201 rule-1 rows
From the same whole RADV replay (m3-max-4016 at
|
||
|
|
ff6d387aa7 |
Ledger: RADV's extended-swizzles family, 193 rule-1 rows
The whole RADV replay (RX 7900 XTX, RADV NAVI31, Mesa 26.2.6; potluck
job m3-max-4016 at
|
||
|
|
fde4ef5bb3 |
Ledger: RADV's sRGB decode beyond the read-write tier, four rule-1 rows naming srgb-texel-decode
The whole RADV replay (AMD Radeon RX 7900 XTX, RADV NAVI31, Mesa
26.2.6; potluck job m3-max-4016 at
|
||
|
|
b64908f468 |
Ledger: the RTX 5080's own YCbCr conversion and filter, twenty rule-1 rows for ycbcr-gathers and ycbcr-minify
The 5080 replay of the two-plane YCbCr cases (potluck b5080 entry
replay-replay-nv-ycbcr-072438 at
|
||
|
|
c36bf38d91 |
Scheduler: wake after a committing thread's pass only where it submitted alone a batch that may group
The wake that ends a committing thread's pass ( |
||
|
|
f118559e73 |
Binary archives: add mesh pipelines, and load a metallib as an empty archive
Two of the conformance ledger's every-venue rows, both of the runtime's archive surface. binary-archive-mesh-adder: BinaryArchive had three of Metal's four pipeline adders. add_mesh_render_pipeline_functions (addMeshRenderPipelineFunctionsWithDescriptor:error:) makes the state as new_mesh_render_pipeline_state does with the default options, answering its error, and keeps the descriptor's archive key (metal_key::mesh). A mesh creation compiles its pipeline whole and looks in no archive, so the add keeps no compiled artifact. Under FAIL_ON_BINARY_ARCHIVE_MISS a mesh creation, which every listed archive missed before, now hits an archive holding its key (binary_archive::mesh_missing). Which fields Metal keys a mesh pipeline by is not measured, so the key holds every field of the descriptor: a creation hits only an add of an equal descriptor, where Metal's hits too, and one differing in a field Metal does not key misses here where Metal's may hit, as the add's and new_mesh_render_pipeline_state's docs say. binary-archive-sources: Metal takes a metallib as an archive (the case's M3 Max recording); container::read refused it as no archive of ours. A file that parses as a metallib (Library::from_metallib, container tags alone) now loads as an archive holding nothing: its lookups miss and it serializes as one nothing was added to. What Metal's archive of a metallib holds is not measured; new_binary_archive's doc says so. The suite's runtime side answers the mesh add through the new call. The ledger's two rows go; api_signatures.tsv gains the method, and METAL-COVERAGE (coverage.tsv) marks the call implemented. Tests: unit tests the_mesh_key_holds_every_field_and_a_lookup_names_the_mesh_function and a_metallib_loads_as_an_archive_holding_nothing; lane test a_mesh_add_is_found_by_its_own_descriptor_and_a_metallib_loads_as_an_ empty_archive (hit, miss before the add and for another color format, the add's error, serialize and reload, the metallib's miss and nothing to serialize). Verified by those tests and a whole lavapipe conformance replay (see the tip report). (cherry picked from commit adadb73f7c2063341e1dbe54fe887a5ceddf86b7) |
||
|
|
0d368fbfe7 |
Draw a split depth/stencil resolve's drawn aspect into its own texture
Metal resolves separate Depth32Float and Stencil8 textures with the depth filter Min or Max beside the stencil filter Sample0, each into its own resolve texture. On a device with no MIN or MAX depth resolve mode (lavapipe) the runtime draws the picked depth after the pass, but a split resolve (aspects resolving into different textures) refused any drawn aspect NotImplemented(DepthStencilResolve): the draws wrote the first step's scratch image, whose copy takes that step's aspect alone. Now a split resolve draws its drawn aspect into that aspect's own resolve texture (or a scratch image copied there, Destination::attach), held as the resolve's drawn_into, which drawn_target prefers; the other aspect resolves in its subpass step as before. Both aspects drawn, each into its own texture, stays refused. The image separate textures render through is made sampled where such a resolve may be drawn (resolve::may_draw, which shares the filter-to-mode choice with depth_stencil through aspect_modes), since the draws read its samples. The ledger's two llvmpipe rows of resolve-stencil-under-depth-filters (Sample0 under Min and Max) go. The lane test split_depth_and_stencil_resolves_are_metals now expects every case but both-aspects-drawn to be built and to hold Metal's answers; before this change sep_min, sep_max, two_min, two_max and slices_max were refused on lavapipe. Verified on lavapipe: the lane test and the conformance replay (see the tip report). (cherry picked from commit c2b4cbc80bf7f8f209d02ecbd5e5aec186b04d96) |
||
|
|
9b1a531a25 |
Re-derive the conformance coverage document for attribute-stride-vertex-buffer
python3 -I scripts/conformance-coverage/coverage.py: one more case module and recording, and setVertexBuffer:offset:attributeStride:atIndex: on the render encoder now exercised by the Metal leg (812 of the reachable). (cherry picked from commit dce4bd753c2e298f3b1cbb84b5c808d2cabb85b1) |
||
|
|
e39a0cab5c |
Conformance: a tile state's thread limit follows its dispatch's device-gap ruling
tile-simd-blur-columns and -rows on llvmpipe compared the tile state's maxTotalThreadsPerThreadgroup, Metal's 1024 against the runtime's 960, as a divergence of ours, while the same case's 32x32 dispatch, refused typed with Feature::LocalSize and a Capability::Limit, already read as the device's gap (a_dispatch_the_device_cannot_take_is_the_devices_gap). 960 is lavapipe's: its emulated 32-lane simdgroups hold 960 threads of the blur's pipeline, and the runtime reports the device's lower limit by contract (pipeline/tile.rs). Now the tile_threadgroups family, where the device refused a dispatch Metal ran of the state as its gap and the state's descriptor states no limit, states the state's maxTotalThreadsPerThreadgroup site as that gap (Sites::device_gap), and the comparison reads a value site our side stated so as a DeviceGap instead of a divergence (compare.rs, before any allowance, as a refused site's gap). A state whose answer matches Metal's records nothing; an unstated difference still diverges. Metal's side never states one: its failures carry no lacks. The two llvmpipe ledger rows go; the cases now read lacks-feature there. Test: a_getter_our_side_states_is_the_devices_limit_is_the_ venues_gap holds both directions (stated reads lacks-feature, the same answer unstated reads divergent, a stated site matching Metal exact). Verified by the conformance unit tests and a whole lavapipe replay (see the tip report). (cherry picked from commit ffa0411fb87a3dc61ca14a5418b16a60e06c3fa2) |
||
|
|
ff870f6403 |
Scheduler: a committing thread's pass ends by waking the scheduler's thread, as a commit does
Since a committing thread's batch went alone on a grouping driver ( |
||
|
|
027bb2e682 |
A compute state's static threadgroup length is the kernel's own, as Metal reports it
ComputePipelineMetalInfo::static_threadgroup_memory_length answered, on a device that emulates simdgroups, the declared arena plus the scratch of the most threads (32768 on lavapipe for compute-threadgroup-simd- scratch, whose kernel declares 24 KiB), and elsewhere the kernel's static part plus a predicated walk's vote word. Both additions are ours: Metal's staticThreadgroupMemoryLength is the static part of the kernel's own layout (KernelFacts::static_threadgroup_bytes), and the getter now answers exactly that. The planner keeps counting the scratch and the vote word in each dispatch's total (bind::plan::compute: the arena from RuntimeFact::SimdgroupEmulation, the vote beside it, the scratch rule per region), so a dispatch whose threadgroup lengths fit beside the reported length but not beside the scratch is refused ThreadgroupMemorySize, the device's gap, where before the inflated getter kept a well-behaved client from asking. The emulated tests check both: region_k reports 0, a Metal client's remainder beside it is refused at the most threads, and a region that fits beside the arena and the scratch runs; barrier_k reports its own 31 KiB. The compute-threadgroup-simd-scratch llvmpipe row goes. The runtime getter's doc names the refusal. SEMANTICS_VERSION 1980 -> 1982 (1981 is rows2's). Verified: runs next (targeted translator tests, lavapipe replay). (cherry picked from commit dd3d0a893bf900fbf11cb885f5fb9a7b7cfd9055) |
||
|
|
6126e8a237 |
FAST-PATHS: the Grouped row's figures for a batch a committing thread submits alone
Measured in job m3-max-3640 (homelab-gem10-1, exclusive, release test binaries of the fix's tip and of the form before it, alternating, two rounds each): tests::completion_latency::runtime_commit_to_submission and runtime_completion_latency on RADV (RX 7900 XTX, Mesa 26.2.6, whose submission check finds merges: 520 batches submitted at commit at the tip, 1 before) and on lavapipe (whose check finds none: the two forms alike). The plain commits interleaved with commit_and_submit ones saw the scheduler thread wake later at the tip, in three of four rows; the row states it. (cherry picked from commit d94a28e714c46ca24fe764700ee5017c2041c297) |
||
|
|
4d4e103471 |
commit_and_submit: on a grouping driver, submit a batch alone where the group would go at once
On lavapipe (and on every Mesa driver, whose queues merge a submission that signals nothing into the next), commit_and_submit's committing thread never submitted anything: tests::commit_and_submit printed "0 of 40 handlers on the caller; passes at commit 40, batches 0", and six of its tests failed (lines 126, 217, 284, 427, 535, 624), with deferred_calls.rs:1106 (the check and handler ran on the scheduler's thread, not the lowering thread). Under the default CompletionPolicy::Grouped there, every batch "may wait in a group" (group::groups), and scheduler::plain refused any such batch to a thread other than the scheduler's, so each commit went to the scheduler's thread, a wake and a pass away: the extension did nothing on the drivers it was made for (the runtime README states it submits the ready command buffers needing no host step and no storage-form switch; only the method's doc said "no group"). A pass that holds a batch in the group sends the group at its end unless two or more earlier submissions of its VkQueue are not seen complete (Group::keeps). So where at most one runs, a committing thread now submits such a batch alone (CommandBufferShared::goes_alone_at_commit, read from the queue's timeline without its lock, as keeps reads it): it reaches the GPU no later than through the scheduler, and the wake and pass are saved. Where two or more run, it is left to the scheduler's thread, which holds it in the group with the commits that join it, as before. submit_batch takes `alone`, which a thread other than the scheduler's passes, so such a batch never joins the group. A thread about to block keeps leaving groupable batches to the scheduler. Docs: commit_and_submit's doc, the scheduler module doc, the runtime README and the Grouped row of docs/FAST-PATHS.md (its switch and forms unchanged). Verified on lavapipe (layer 1.4.363) by the commit_and_submit and deferred_calls tests and the grouped-submission lane at this commit and with plain()'s change reverted, in one job (see the report for the job id). (cherry picked from commit 25a43729192f80d5fc2ca3af42ef4c14596ae1f0) |
||
|
|
def2c7f1d7 |
Re-derive the conformance coverage document after the ledger removals
python3 -I scripts/conformance-coverage/coverage.py: the ledger count falls from 2619 to 2605 (the four attribute-stride rows, the three slice-past used-size rows and the seven move rows), the slice-past row's note follows the ledger, and the sparse families count the allowGPUOptimizedContents call the move rows now make. Found by tests::the_conformance_coverage_document_is_what_the_sources_derive failing at fcfdf2bcb1 (job m3-max-3620, the only failure of 1,019). (cherry picked from commit cc6e6740161cc876cfdf2f8ccc008088de24970b) |
||
|
|
d158a960dd |
Read the sparse move rows through uncompressed textures
The move family's rows (inside-the-level, past-the-destination's-row, clipped-source) read a tile a move rebound as 0 in 3,968 of its 4,096 words on Metal and whole on ours. probes/sparse_move_compression.m (job m3-max-3570, an M3 Max under macOS 27.0.1, five descriptors, two runs each, one outcome) shows that is lossless compression's: under the case's own descriptor (ShaderRead, allowGPUOptimizedContents YES) a moved tile kept its word in 128 texels, the first 4 by 2 of each 16 by 16 block, and with allowGPUOptimizedContents off, ShaderWrite or PixelFormatView usage both moved tiles read whole. Controls: untouched tiles whole, moved-from tiles zero, every command buffer completed, usedSize unchanged. A move is documented to move the tile's mapping, and the rows read which tiles it moved, so they now make both textures with allowGPUOptimizedContents off: - SparseTextureSpec gains gpu_optimized (Metal's default, true) and unoptimized(); both sides forward it to their descriptor. An unoptimized texture adds a byte to its fingerprint and a site suffix where the default adds none, so every other sparse case's recording keeps its fingerprint. - moved() builds its two textures unoptimized; the four move rows' recordings are re-taken on the M3 in the next commit. - docs/API.md's accepted differences gain the compressed case: Metal's moved tile may read only part of its texels, ours reads all of them under every descriptor; the runtime does not reproduce the loss. - The probe's header records its results. (cherry picked from commit b3f8f28dbf18ce6756587702dd012ebd282c4f3a) |
||
|
|
08ca74da22 |
Charge a sparse heap for a mapping update of a slice past the texture's
Plain Metal takes a sparse mapping update whose slice is past the texture's own (its API validation refuses it) and charges its heap's usedSize exactly what the same region on an in-bounds slice costs: one page a tile of the region clipped to the level's tiles, idempotent per tile, given back on an unmap of that tile, never below where it stood (probes/sparse_indirect_usedsize.m and sparse_mapping_past_the_bounds.m on the M3 Max, macOS 27.0.1, both selectors). Ours counted nothing, so sparse-mapping-a-slice-past-the-textures read 65,536 where Metal read 81,920 at used-size/2, /3 and /4. UnitGrid::clipped_region now names such a region's units at the slice (past_slices tells them apart); sparse/bind.rs's apply takes and gives back their heap room into SparseState::charged and binds nothing for them, and undo reverts them with the rest. The move keeps the slice bound (clipped_size), as measured. The texels plain Metal's page reaches (read/4: a 16 by 16 block of slice 0's tile (0, 0) reads its unwritten pattern) are not mirrored, on the owner's call via the orchestrator: an accepted difference in docs/API.md section 10 (Vulkan binds nothing past an image's layers, VUID-VkSparseImageMemoryBindInfo-subresource-01723, and the address is not derivable), which the remaining ledger row now names. Removes the three used-size rows of known-gaps.tsv. tests::sparse holds the counts against Metal's readings row by row (every row now equal). (cherry picked from commit 636522137c717715521cdda950fbb7213e00089f) |