Author SHA1 Message Date
Anees Iqbal 08848fd8a5 Runtime: a content's later cell lookup is later_cell, apart from its field
`Cells` had a field and a method both named `later`, so an intra-doc
link to `Cells::later` named either. The method that finds or enters a
key's cell is now `later_cell`; `Cells::later` names the map alone.
No behaviour change; verified by the merge check's build, clippy and
private-doc steps at this commit.
2026-12-05 00:28:25 -08:00
Anees Iqbal 6789748f41 Runtime: a content's later pipelines are cells, made outside the map's lock
A render content's `VkPipeline`s made by the first draw that takes them
(the line and point class's where the descriptor names neither, and those
under other raster states) sat in one map, `Cells::later`, whose lock
`found` held across the driver's create. A draw of one content that needed
any other of those pipelines (another class, another raster state) waited
behind that create, and its wait was counted nowhere; a draw that needed
the same one waited on the lock and counted nothing either.

The map now holds a cell per key, the `Main` cell the content's main
pipelines already use: `Cells::later` finds or enters a key's cell under
the lock and returns it, and the make runs on the cell with the map's lock
released. A draw that meets another thread's make of the same key waits
on that cell's condition and is a first-use wait at the key's own site
(lines, points, raster); `Main::pipeline` now takes the site, the main
cells passing `Unfinished` as before. A make that fails keeps nothing and
wakes its waiters, which make it themselves, as a main cell's do, so no
waiter is left on a failed cell. The words twin's later pipelines, made
beside the plain one, use the same cells through `make_ahead`. The map
stays bounded at 15 keys; a cell of a failed make stays empty under its
key.

Docs: the line, point and raster first-use wait metrics count a draw that
waited for another thread's make in flight; the runtime README says a draw
needing another of the content's pipelines waits for no make but its own.

Tests: `later_cells`' two device tests (red at the commit before) and a
device-free `main_cells` test of a waiter whose make in flight fails.
2026-12-05 00:28:25 -08:00
Anees Iqbal b4a35c31ae Tests: a draw of one later class during another thread's make of a second
A render content's `VkPipeline`s made by the first draw that takes them
(the line and point class's where the descriptor names neither, those
under other raster states) sit in one map whose lock `found` holds across
the driver's create. Two device tests show what that costs:

- a draw of points on one thread while another thread's draw of lines is
  making the line class's pipeline must make its own and return, the make
  of lines holding until it has (for at most 10 s, so a draw held behind it
  fails the test rather than hangs it);
- a draw of lines that meets another thread's make of the line class in
  flight must wait for that make and take its pipeline, counted as a
  first-use wait of the line class, as the make's own draw is.

A test-only entry, `RenderCompiled::pipeline_during`, runs the draw's own
lookup with a hook inside its make, and the thread-local `WAITING` tells a
test when a call begins to wait for a make of a `Main` cell in flight.

Both fail at this commit: the draw of points waits behind the lock until
the make of lines gives up, and the second draw of lines blocks on the same
lock, so it never waits on a cell and counts nothing.
2026-12-05 00:28:25 -08:00
Anees Iqbal f2461b26de Runtime docs: a guest session's line-class pipelines on a 780M, in place of the older heaviest figure
The known gap on a second topology class under RADV (no
dynamicPrimitiveTopologyUnrestricted) gave 225 ms as the heaviest second
compile measured on a 780M. A guest's session start compiles one far heavier:
the consumer's two diagnostic boots on the Radeon 780M with cold caches
(88012 at ea428bca8b plus the diagnostic prints, 88093 at cc13a21eb9 plus the
same prints) each made 4 second pipelines, all of the line class (topology 1,
the default raster state), 1,170.8 and 1,204.4 ms in all, the heaviest
1,165.8 and 1,197.6 ms and the other three under 10 ms each; the 4 lines
first-use waits matched them (1,171.3 and 1,204.8 ms). Counts from the
consumer's grep over each whole boot, classes and counts only. The gap now
states that figure, with no job or app named.
2026-12-05 00:17:53 -08:00
Anees Iqbal 9860c14142 Runtime docs: a 4:2:2 linear sample's GPU time on the RTX 3090 with the decode as it is now
The 4:2:2 bullet lost its GPU-time figure when the decode shrank, since the
figure measured the decode before it. The committed timing test
time_a_linear_sample_of_a_1080p_frame (c08da02d8c) measured it again: a
linear sample through a runtime sampler (both decode arms, sixteen fetches)
at each texel of a 1920 by 1080 frame took 90.5 to 90.7 µs on an RTX 3090,
against 81.1 to 81.6 µs for the same kernel over RGBA8Unorm: 1.11 to 1.12
times, 3 rounds, each the median of 9 (job m3-max-88105, NVIDIA 620.70.06,
P0 throughout). The README states it as about 91 µs against 81 µs, 1.12
times.
2026-12-04 23:54:59 -08:00
Anees Iqbal c08da02d8c Tests: time a linear sample of a 1080p 4:2:2 frame beside RGBA8Unorm's
The runtime README's 4:2:2 paragraph lost its GPU-time figure when the decode shrank (clamp-to-edge
taps, each footprint row's pairs fetched once): the figure measured the earlier sixteen-fetch decode
with a probe that was never committed. This is that probe as a committed test, so the figure has a
source.

tests::chroma_time's time_a_linear_sample_of_a_1080p_frame, #[ignore]d and run with --run-ignored
only (it prints GPU times and asserts nothing of time, as mesh_costs_print_per_card does):
- xr_samples' xr_sample_runtime (a linear clamp-to-edge sampler state at slot 0) and
  xr_sample_constexpr (its constexpr linear clamp-to-edge sampler) sample each texel's centre of a
  1920 by 1080 frame, one thread a texel, over a GBGR422 texture over a Private buffer at 3,840 bytes
  a row and an RGBA8Unorm one at 7,680, positions and outputs in Private buffers;
- each dispatch is a command buffer of its own, timed by its GPU start and end; a round takes the
  median of nine of each kernel over each texture, the four taking turns; unmeasured rounds run for
  a second first (an NVIDIA card raises its clocks under load), then three rounds print each
  kernel's two medians, their ratio and each texture's form (in place or the copy's cause);
- it asserts the decode ran (chroma_contents +2, chroma_launches = every GBGR422 dispatch, none for
  RGBA8Unorm) and that every value written is finite and within [0, 1] (the outputs start as NaNs).

chroma_pairs' buffer_of, byte and GROUP are now pub(crate) for it.

Verification follows this commit: a run on lavapipe and one on the RTX 3090.
2026-12-04 23:49:30 -08:00
Anees Iqbal b0c9c9f0c9 Runtime docs: a 4:2:2 preview's first open with the decode as it is now
The known gap on the first bind of a 4:2:2 texture held placeholders for the
consumer's proof boot, and figures from the decode before the per-site
shrink. It now states the current figures only:
- the 40-site inline content (251 to 256 ms cold, 0.4 ms warm on the
  Radeon 780M, beside the state's own 78 to 83 ms) and one site (4.0 ms);
- a camera preview's first open with the driver's shader cache empty: frames
  held about a second (989 ms at the 99th percentile), the content's
  translation 111 ms and its pipeline 870 ms; a second open in the same
  session waits for nothing.
The rolled-shape sentence and the older figures go: the rolled shape (217 to
223 ms) is below the inline figure, and its slowdown against the older
decode is recorded in the bug list. The handle line no longer names a job.

Evidence: the consumer's boot m3-max-88093 at cc13a21eb9 plus the diagnostic
prints (build m3-max-88086), on the same Radeon 780M as boot 88012, with
fresh rt and Mesa caches: unfinished-pipeline waits 2 in 878.6 ms (1448.8 in
88012), the preview state's create 870.0 ms (1437.9), take-to-show p99
988.7 ms (1595.5), fragment 58,866 instructions and 737 fetches (80,978 and
821), translate 110.7 ms (149.0), 0 refusals, the picture right; the second
open made nothing and waited for nothing (p99 2.2 ms).
2026-12-04 23:46:13 -08:00
Anees Iqbal 2ffb83a4f1 Pin AE bless: the golden hashes after firstopen
The bless at cc13a21eb9 (job m3-max-88077, BLESS_JOBS=4) moved only the
semantics line, 2396 to 2397, after firstopen's SEMANTICS_VERSION bump: no
cell changed, since no golden fixture lowers a 4:2:2 decode.
2026-12-04 23:37:14 -08:00
Anees Iqbal cc13a21eb9 Translator: a 4:2:2 row's fetches are named, not indexed
Clippy's indexing_slicing (denied in the tree) refused lower::texture::chroma::row's slices of
its fetched bytes and its store into the texels' array (merge check job m3-max-88057). The six
fetches are now three pairs of named texels, and the two texels are made by one closure. The
instructions are emitted in the same order as before, so the module is unchanged.
2026-12-04 23:08:59 -08:00
Anees Iqbal 88d60a299c Runtime docs: the first 4:2:2 bind's content make, with the 780M's figures, and the decode's fetches
The runtime README's 4:2:2 paragraph now states the decode as the translator writes it:
- a row's two taps share six fetches, so a linear sample or a gather reads twelve texels;
- a constexpr sampler's sample holds its filter's decode alone, and any other sampler's holds both
  decodes behind the filter branch, sixteen fetches;
- every tap clamps to the edge, citing MTLPixelFormat.h for both formats.
The paragraph's 135 µs RTX 3090 figure measured the earlier sixteen-fetch decode and is removed
until it is measured again.

A new known gap states that the first draw or dispatch binding a 4:2:2 texture at a state's slot
makes that state's content and waits for it, where Metal makes none, with the Radeon 780M's
figures (RADV, Mesa 26.2.6):
- 40 decoded sites in line: 251 to 256 ms cold, 0.4 ms warm (job m3-max-88049; a probe build that
  writes no loop, the shape of the guest's 41 sites);
- the same sites where the translator writes them as a loop: 217 to 223 ms against 156 to 159 ms
  before the rows shared their fetches (job m3-max-88041);
- one site: 4.0 ms cold;
- the camera preview's first open before the change (1,508 ms cold, about 145 ms warm), and
  placeholders for the consumer's boot after it.
Handle re-makes: 0 seen in the consumer's session (boot 88012).
2026-12-04 23:06:43 -08:00
Anees Iqbal 269ba10df0 Translator: a 4:2:2 decode clamps its taps to the edge, fetches each row once, and holds a constexpr sampler's filter alone
A camera preview's state re-made for a 4:2:2 texture at its fragment slot (41 decoded sample sites)
took 1438 ms to create on the Radeon 780M against 437 ms for its own content (boot 88012): each
site decoded 20 fetches behind the branch on its sampler's word, with every address mode's
arithmetic at each tap, about 1,111 instructions a site.

- Addressing: the decode clamps every tap to the edge, whatever the sampler states. Metal's
  MTLPixelFormat.h says of both GBGR422 and BGRG422 "When sampling, ClampToEdge is the only usable
  wrap mode". The other modes' arithmetic (the word's per-tap remainders, mirrors and border
  texel, its position by mode and offset rule) is gone from the decode; a bicubic sample's taps
  clamp too.
- Rows: a linear footprint's or a gather's two taps of a row share six fetches (the first tap's
  pair and the pairs on either side of it; lower::texture::chroma::row), each texel's codes
  converted once, each texel's arithmetic and values as before: 12 fetches for the 2x2 where 16
  were.
- Static filter: a constexpr sampler's magnification filter is known in the translator, so its
  sample holds that filter's body alone, with no branch; a runtime, argument buffer's or constexpr
  array's sampler keeps both bodies behind the branch on its word. The coordinates' pixel flag is
  likewise read here for a constexpr sampler.
- One position per axis, shared by both bodies.

Values are unchanged for ClampToEdge: the same codes, integer arithmetic, correctly rounded values
and FMix order. SEMANTICS_VERSION 2397.

Verified: tests::engine_chroma_pairs::a_four_two_two_decode_fetches_each_footprint_row_once, red at
the previous commit; the device and conformance values and the 780M's make time follow in this
lane's report.
2026-12-04 23:06:43 -08:00
Anees Iqbal 8e73a338c1 Translator: a test that a 4:2:2 decode fetches each footprint row once (red)
What the decode adds at each site, over the module lowered without it, on every committed profile:
a sample through a runtime sampler 16 fetches (its linear body's 12, two rows of six shared fetches,
and its nearest body's 4) and one selection; a gather 12; a read 4; a sample through a constexpr
sampler its own filter's body alone (12 magnifying linearly, 4 nearest) with no selection; and no
integer remainder at any site, the taps clamping to the edge whatever the sampler states. Today a
sample decodes 20 fetches behind a branch even through a constexpr sampler, a gather 16, and each
tap carries every address mode's arithmetic. It replaces the size probe, printing every row's sizes
and grd_half_many_samples' 40 sites of fragment texture 3.
2026-12-04 23:06:43 -08:00
Anees Iqbal ebd7ab2a35 Tests: a 40-site 4:2:2 content beside the one-site one
grd_half_many_samples (40 runtime-sampler samples of fragment texture 3, the slot the camera boot's
state decodes) joins the module size probe (with samples, selections and loops) and the driver's
make time, for the shape of the camera boot's 41 decoded sample sites.
2026-12-04 23:06:42 -08:00
Anees Iqbal 401a1a150e Tests: the size of each 4:2:2 module and the driver's make of a 4:2:2 render content
A translator test prints each module a 4:2:2 decode lowers beside its plain module (instructions,
texel fetches, words), and a device test prints the driver's make of dl_runtime's plain content and
of its content lowered for a 4:2:2 texture at fragment texture 0. They measure the first-open stall of a
4:2:2 preview: the runtime README's figures for it come from them.
2026-12-04 23:06:42 -08:00
Anees Iqbal 38392496f7 Pin AD bless: the golden hashes after specwide
The bless at 79698bdd67 (job m3-max-88022, BLESS_JOBS=4) moved only the
semantics line, 2395 to 2396, after specwide's SEMANTICS_VERSION bump: no
cell changed. encodetime (e2964480ba) changes no translation, so the table
holds at this tip.
2026-12-04 23:05:56 -08:00
Anees Iqbal e2964480ba Runtime docs: Metrics::translations_at_encode lists the 4:2:2 content among its makes
The count's doc named five kinds of make at encode and left out the content a compute or render
state makes for the 4:2:2 textures a dispatch or draw reaches, which Metrics::chroma_contents
counts and which the same make at encode also counts and times (render_pipeline_state and
PipelineInner::variant call Counters::translation_at_encode for it). It now names six. The
runtime README's known gap of makes at encode names that make and the depth range twin too,
and the new total translation_at_encode_nanos beside the count and the longest.
2026-12-04 22:51:26 -08:00
Anees Iqbal 487ed9584f Runtime: the unattached-colours device test prints its make at encode's time
The test asserts Metrics::translation_at_encode_nanos; printing the device's total after the one
make at encode gives each run's cost of that make (a translation and its pipelines' compiles on the
encoding thread) beside the pass/fail.
2026-12-04 22:51:25 -08:00
Anees Iqbal f2f9bee818 Runtime: a make at encode adds its time to Metrics::translation_at_encode_nanos (green)
Counters::translation_at_encode, which every make at encode calls with its nanoseconds of
host_time (the render content and its depth range twin, the compute content of a dispatch's
bindings, and a dispatch's partial-threadgroups variant on emulated SIMD groups), now sums them
beside the count and the maximum. Turns the unattached-colours device test of the previous commit
green.
2026-12-04 22:51:25 -08:00
Anees Iqbal 56f890f59a Runtime: Metrics::translation_at_encode_nanos, the total time of makes at encode, and its test (red)
Metrics kept a count of the translations made at encode and the longest one's time, but no total,
so a consumer could not say what those makes cost over a frame or a boot: a maximum does not
take the difference of two reads. This adds the field, read from its own atomic, with its doc
comment, and the signature table's row. The atomic is not charged yet, so the test fails here.

The test is the unattached-colours device test, which makes one render content at encode on
every device: the device's total is 0 after the matching draws (a fresh device, no make at
encode), rises at the first lacking pass's make and not at the second's reuse, and ends at least
the longest make's time. Expected red: the first lacking pass's total does not rise.
2026-12-04 22:51:25 -08:00
Anees Iqbal 79698bdd67 Lowering: a speculative load through a wide pointer is checked against its slot
canon marks a load speculative where it runs in lanes the program did not run it in: each load
of a branch arm it speculates (a constant reference's, at offset 0) and each constant-reference
load the hoist moves. Lowering checks such a load at any offset against its slot's buffer, but
only on the static-root path. Where a phi, select or pointer cell joins the reference's pointer
with one loaded from memory, the reference is a wide pointer, and every access through a wide
pointer went unchecked: a speculated arm's load read the reference's first bytes in every lane
of the branch's block, through a binding the program never read there, past its end where the
guest bound it shorter than the load.

The fix: the dynamic family selects a speculative load through a wide pointer, of a leaf or of a
pointer, as DynStrategy::SpeculativeLoad: the static-root access of the one slot the pointer's
root set names, at the pointer's fixed offset, marked speculative, so note_variable gives the
slot its SlotBounds, the zero range is placed, and emit::prepare checks the load and reads zero
outside, as for a static-root speculative load. The slot still joins the dynamic plan's slots
(plan_entry), so it keeps the device address every wide-reached slot has, on a bound-form device
too. A speculative load through a wide pointer of another root set or of an offset not fixed is an
invariant violation: canon marks no such load. Its census name is the static-root load's it
emits (access.load.psb.checked, or access.dynamic.load_pointer.psb for a pointer).

Which fix, and why this one: (a) lowering checks the load, against (b) speculate.rs leaving such
an arm unflattened. (a) is the smaller structural change: about 90 lines in the dynamic family,
all reusing the static-root check, and it moves only the loads the bug names. (b) cannot see
width: a wide pointer is lowering's decision (the memory plan's dynamic component), so canon
would have to over-approximate with const_hoist's shared-pointer walk, which also unflattens
arms whose loads go through narrow joined pointers and are checked today, giving their group
operations the AIR's lanes where Metal speculates them (rule 1), or carry the memory plan's
provenance into canon.

const_hoist's module docs no longer say lowering checks a wide pointer's access nowhere.
SEMANTICS_VERSION 2396.

Verified: engine_hoist_contain's two wide-pointer tests fail at f4a0f4e628 (lavapipe's address
form and every committed profile, jobs m3-max-87967 and m3-max-87970): no SlotBounds for k's slot,
and the interpreter's OutOfBounds trap in the short-binding case of both forms (word: 4 bytes read
from a 2-byte binding; pointer: the second word of an 8-byte load past a 4-byte one), while the
whole, unbound and flag-on cases pass. The green run with this commit is named in the lane's
report.
2026-12-04 22:42:05 -08:00
Anees Iqbal 0dcd3230e8 Red: a speculated arm's load through a wide pointer reads outside a short binding
engine_hoist_contain gains a third kernel, `wide`, in two forms: a short arm beside a
quad_broadcast_first, which canon's arm speculation runs in every lane of the branch's block,
loads `k`, a constant reference (a 4-byte word, or an 8-byte pointer whose address the arm
truncates), where a select joins k's pointer with one loaded from memory. That select makes k a
wide pointer, so the arm's speculative load goes through the wide-pointer family, which checks no
access: the load reads k's first bytes in every lane whatever k's binding.

Two tests:
- a_speculated_arms_load_through_a_wide_pointer_is_checked: on every committed profile under the
  identity domains, with and without the bound form's query, k's slot reads its SlotBounds and
  the module the zero range, and the arm's load is not a wide-pointer load (one
  access.dynamic.load, the select's own, and no access.dynamic.load_pointer.wide).
- a_speculated_arms_load_through_a_wide_pointer_reads_nothing_outside_a_short_binding: on the CPU
  interpreter (lavapipe's address form), with the arm's condition off and k bound half as long as
  its load where its mapping ends, the load must not trap; with k whole or unbound, and with the
  condition on, out holds the program's words.

Expected red at this commit: no SlotBounds for k's slot, and the interpreter's OutOfBounds trap
at k's address in the short case of both forms. The unbound case is a control: the nil buffer's
64 KiB holds the load.
2026-12-04 22:42:05 -08:00
Anees Iqbal 43b9dc279e Conformance: the 4:2:2 linear-sample rows list the cards' digest beside llvmpipe's
Pin AC's short round failed every card's replay on the two 4:2:2 linear-sample
rows (chroma-pair-texel-linear-samples-gbgr422 and -bgrg422). Their venue is *,
and their answer was the digest llvmpipe and KosmicKrisp on an Apple M3 Max give.
The RTX 5080 Laptop GPU, RX 7900 XTX, Iris Xe and RTX 3090 all give one other
digest per format (70c2266e... for GBGR422, 3f65b2f3... for BGRG422), so each
card read the row as both unlisted and no longer held.

The gap is the same on every venue: PrecisionNote::BicubicFilterArithmetic,
the decode's own filter arithmetic in f32. Its value differs by a property no
venue description states, so each row keeps venue * and lists both answers
with the ledger's separator, as known_gaps.rs allows. The gap text names the
run each answer came from. A third digest still fails as a new gap.

Verified: the four replays' proposed rows (jobs m3-max-87952, 87957, 87958,
87961) give the same two digests; the coverage document regenerates unchanged.
The replays of this commit follow.
2026-12-04 22:16:37 -08:00
Anees Iqbal 2ae06af340 Docs: pin AC's source comments state the Mac and OS a measurement ran on, not its job
The published crates' doc comments on EntryPoint::mismatched_component_counts (metal2vulkan-air
abi) and LoweringInputs::widened_varyings (metal2vulkan pipeline::lower_inputs) named lab jobs; so
did the module docs of the conformance cases chroma_pairs and one_level_filters and of the runtime
tests chroma_pairs and mismatched_varyings, all added in pin AC's range. Each now names the Apple
M3 Max and macOS 27.0.1 alone, as a8cec25600 did for docs/API.md. The paragraphs are rewrapped at
100 columns; the conformance ledger's reason column keeps its job ids. No code changes, and no file
here is a runtime-sources input (pin-compute.py gives the committed 870c1824... at this tree).
2026-12-04 21:59:03 -08:00
Anees Iqbal ea428bca8b Pin AC bless: the golden hashes after varyflag, levelrule, yuv422 and the watchdog
The golden table re-blessed at ae78d6c14f (pin AC's stack on pin AB' cb574b06fa), on the Apple M3
Max, job m3-max-87911 (inventory, golden, printouts, linkhalf and chains each exit 0):
- the semantics line moves 2394 -> 2395, yuv422's number;
- no cell moves and no row is added, the metal-as fixtures included: a 4:2:2 texture's decode
  lives only in a content re-lowered for its bindings, so no default module changes.
2026-12-04 21:55:45 -08:00
Anees Iqbal ae78d6c14f Validation: the worker watchdog charges compressed and swapped memory, not resident memory alone
The worker memory watchdog summed each process-group member's resident size: VmRSS on Linux,
proc_pid_rusage's ri_resident_size on macOS. Under memory pressure the system takes a worker's
pages out of its resident set (macOS's compressor; Linux's swap, to a disk or to compressed RAM
such as zram), so a group holding more than the 500-MiB ceiling could pass it unseen. On CI's
macOS job at 9e7034c214, worker_memory_watchdog_enforces_aggregate_limit ran into its 20-s
deadline: its two 256-MiB children (one written byte a page, nearly all zero) never summed to the
limit. That is the product ceiling going soft under pressure, not only a test problem.

What a member is charged (process_charged_bytes) is now:
- macOS: the larger of ri_resident_size and ri_phys_footprint, from the same proc_pid_rusage call.
  The SDK's sys/resource.h declares both in rusage_info_v2 with no comment; footprint(1) defines
  the ledger: "phys_footprint - the current value of the kernel ledger tracking the amount of
  dirty memory owned by a process", Dirty "includes "(Swapped)" memory, ... and memory written to
  implicitly, such as zero-filled", and (Swapped) is "A subset of Dirty memory that has been
  compressed or swapped to storage by the kernel". The footprint leaves out clean file-backed
  pages the resident size counts, so the larger of the two never trips later than before.
- Linux: VmRSS + VmSwap from the same /proc/<pid>/status read (status_charged_bytes). The member
  rules of process/linux.rs are unchanged: a member before its exec that shares its parent's
  memory is charged nothing, a copy-on-write one is counted (an overcount, never an undercount),
  and every other member is charged its own VmRSS and VmSwap, read after its flags.

Names that would lie are renamed: worker_resident_bytes -> worker_charged_bytes,
member_resident_bytes -> member_charged_bytes (both platforms). process_resident_bytes keeps
the resident size alone for own_resident_bytes, whose figure (corpus-triage's parent_rss_bytes,
the supervisor-heap test) stays resident memory; its doc no longer says it is read as workers'
are. The stop's message says "process-group memory budget". Docs that called the sampled figure
RSS (worker.rs, compile.rs, alloc.rs, audit.rs, budgets.rs, translation_audit.rs,
authored_compile.rs, corpus-pipeline.rs, corpus-triage's usage, docs/HOWTO.md's recipe) now say
memory; report keys (peak_*_rss_bytes, peak_resident_bytes) keep their names.

A stop at the ceiling is a recorded `failed oom` row of the engine census and of the
specialization lane's attempts, and its detail is the stop's message, so the measure can change
a recorded row: ENGINE_CENSUS_VERSION 8 -> 9 and SPECIALIZATION_AUDIT_VERSION 6 -> 7, as both
were bumped when the member charging last changed (engine 5, specialization 2). The authored
compile census records no worker stop (failures are never cached), so its version stays.

The fixture is unchanged: it now trips on its zero-filled pages wherever the system compresses or
swaps them.

Verified: a_members_swapped_memory_is_charged failed at the parent commit (lavapipe-free CPU
job m3-max-87876: left 307200000, right 563200000; 19 other worker::process tests passed). The
macOS arm is unchecked before the push (no Mac job); it stands on libc 0.2.189 and 0.2.191's
rusage_info_v2 (pub ri_phys_footprint: u64, beside the ri_resident_size this code already read)
and on CI's macOS job.
2026-12-04 21:24:00 -08:00
Anees Iqbal a0c8c1c88b Validation: a test that the worker watchdog charges a Linux member its swapped memory (red)
The worker memory watchdog sums each process-group member's VmRSS on Linux
(process_resident_bytes) and ri_resident_size on macOS. Under memory pressure
the kernel takes pages out of the resident set (swapped out on Linux, to a disk
or to compressed RAM such as zram; compressed on macOS), so a worker holding
more than the 500-MiB ceiling can pass it unseen: on CI's macOS job,
worker_memory_watchdog_enforces_aggregate_limit ran into its 20-s deadline
with two 256-MiB children that the limit never stopped.

This commit draws the status read's charge out as status_charged_bytes,
unchanged (VmRSS alone), and adds a_members_swapped_memory_is_charged: a
synthetic /proc/<pid>/status with VmRSS 300000 kB and VmSwap 250000 kB must be
charged 550000 kB. It fails here; the next commit charges VmSwap.
2026-12-04 21:24:00 -08:00
Anees Iqbal 4e24418619 Conformance: Metal's timings of the four 4:2:2 sampling cases
conformance times --runs 8 --write over chroma-pair-texel-gathers-gbgr422, -gathers-bgrg422,
-linear-samples-gbgr422 and -linear-samples-bgrg422 on the Apple M3 Max, macOS 27.0.1, job
m3-max-87887. The run adds times to the four recordings and changes no answer: 508 lines added,
none removed. times::every_case_carries_its_timing failed without them (conformance suite job
m3-max-87880, 1062 of 1064 passed with the textures guard); this commit closes it. Coverage
regenerated.
2026-12-04 21:23:52 -08:00
Anees Iqbal 10ef459cd0 Conformance: the textures table's guard leaves the 4:2:2 formats to chroma_pairs
With GBGR422 and BGRG422 held as their bytes in R8G8_UNORM, the translator's byte format of each
is a 2-byte texel, so the guard asked the textures round-trip table for them
(cases::textures::tests::the_table_is_exactly_the_formats_whose_texels_are_metals_bytes failed,
conformance suite job m3-max-87880). Their host round trips are chroma_pairs' copy cases', on and
off the 2-texel pairs, so the guard sets them aside as it sets aside the copies-only formats.
2026-12-04 21:23:52 -08:00
Anees Iqbal ffec1a43ab Runtime README: the 4:2:2 content's cost, measured once
The planner's one timing for the known gap (job m3-max-87867, an RTX 3090 at P0, 620.70.06): a
linear sample at a quarter point of each texel of a 1920 by 1080 frame through fpv_swz_sample,
three alternating rounds of 24 command buffers, the median GPU span of each round's last 20:
GBGR422 over a Private buffer in place 135,424 / 135,232 / 135,360 ns, RGBA8Unorm over a Private
buffer in place 80,544 / 80,576 / 80,512 ns, ratio 1.68. The content's make at the first dispatch,
the translation at encode, took 4,746,194 ns there (Metrics::translation_at_encode_max_nanos),
within the translator's bounded lowering as a state's make is, far inside the 20 s ceiling. The
timing test is a carried patch, not committed.
2026-12-04 21:23:52 -08:00
Anees Iqbal d73a21686c Ledger: the 4:2:2 linear-sample rows are every venue's
KosmicKrisp on an Apple M3 Max (job m3-max-87863, the pre-push replay at 4d09c9ed97) answers both
linear-sample sites with the digest llvmpipe gives (job m3-max-87851): the decode's filter is the
shader's arithmetic, so the rows' venue widens to *. Those two were the replay's only unexpected
lines. Coverage regenerated: no change.
2026-12-04 21:23:51 -08:00
Anees Iqbal 5fc261de14 Conformance: the 4:2:2 fills declare the texture's static note
texture-fills-240 and -241 make a GBGR422 and a BGRG422 texture, whose static note
(bicubic-filter-arithmetic, Texture::precision_note) the rt side announces; the replay at
bff946134f (job m3-max-87842, llvmpipe in the image) read it as undeclared at their notices site.
Every other row that run held was as the ledger lists. Coverage regenerated: no change.
2026-12-04 21:23:51 -08:00
Anees Iqbal 8f90cd52ec Versions: ARTIFACT_FORMAT_VERSION 618, the number the orchestrator assigned
The held push's varyflag takes 617; this branch's artifact codec carries
StageInterface::handle_float_images and the two 4:2:2 lowering inputs.
2026-12-04 21:23:51 -08:00
Anees Iqbal 4b4d8f5e77 Ledger: the 4:2:2 rows follow the lavapipe replay; coverage regenerated
From the replay in the lavapipe image (job m3-max-87827) and the commits since:
- heap-sizes-422's 20 rows go: each site now matches Metal under the accepted difference of the
  device's own heap sizes.
- chroma-pair-texel-reads, -samples and -gathers (both formats) go: reads were announced
  (device-texel-conversion, a native note), and the sampling cases now declare the notices the rt
  side announces.
- chroma-pair-texel-linear-samples-* are divergent rows on llvmpipe: the decode's own filter
  arithmetic, the texture's static note BicubicFilterArithmetic, as ruled.
- chroma-pair-copies-* name Gap::ChromaPairsUse of CloseRows at the 30-byte-row blit (step 37).
- texture-fills-240 and -241 now reach the rt side's fillTexture, Unavailable as every other
  fill row.

The replay at this commit checks the rows.
2026-12-04 21:23:51 -08:00
Anees Iqbal 97f1de6040 Versions: RUNTIME_VERSION 2580 with the runtime sources re-pinned; SEMANTICS_VERSION 2395
The changed behaviour of a run: GBGR422 and BGRG422 map to R8G8_UNORM with
FormatEmulation::ChromaPairs (metal/format/mod.rs, a pinned runtime input) instead of the
Decoded RGBA8 twin, so RUNTIME_VERSION moves with the hash (870c1824..., by pin-compute.py, which
gives development's committed pin at 9e7034c214). The guard failed at 27104ce862 (job
m3-max-87839). SEMANTICS_VERSION takes 2395, after 2392 (pin AB') and varyflag's 2393 and 2394.

Also: the ChromaPairsUse basis names CloseRows without a link, so REFUSALS.md carries no bracket.
2026-12-04 21:23:50 -08:00
Anees Iqbal 4edb790b23 Runtime: a 4:2:2 texture states its static note; a copy of its rows closer than the region's is a gap
The lavapipe conformance replay (job m3-max-87827, in the image) named what changed once 4:2:2
textures are made:

- A linear or bicubic sample of a 4:2:2 texture filters the texels the lowered content decodes,
  in the shader's arithmetic. The texture now states PrecisionNote::BicubicFilterArithmetic as
  its static note (Texture::precision_note, as a block-compressed texture states its own), fixed
  by the format, so the note is announced where the texture is made and not only in the content
  lowered at the first dispatch.
- Metal takes a blit between a buffer and a 4:2:2 texture whose buffer rows are closer together
  than the region's rows are long (chroma-pair-copies, rows 30 bytes apart for a 32-byte row, an
  Apple M3 Max). The runtime refused it as no layout Metal takes. It is now
  Gap::ChromaPairsUse { cause: ChromaPairsGap::CloseRows }: one Vulkan copy region takes no row
  stride below its width (VUID-VkBufferImageCopy-bufferRowLength-09101), and one region a row
  would build it with no extra copy, which the README's known gap says. Planner's ruling: a gap
  in this pin, built when a guest meets it.
- The conformance cases declare the notices the rt side announces for them:
  bicubic-filter-arithmetic for every 4:2:2 case, and pixel-sampler-scaling for the sampling and
  gathering ones, through the fixture's runtime sampler slot.

REFUSALS.md and the API signatures regenerated.
2026-12-04 21:23:50 -08:00
Anees Iqbal e5d5698dc3 Conformance: the 4:2:2 case's docs name its private helpers without links
Rustdoc with -D warnings refused the public module doc's links to the private hashed and
linear_positions (job m3-max-87829).
2026-12-04 21:23:50 -08:00
Anees Iqbal bbacaa9a7f Runtime tests: the 4:2:2 device test prints its bound and address dispatches
Which buffer form the device took for the decoding kernels (rule 2's bound buffers or their
addresses) goes beside the chroma counters in each card's lines.
2026-12-04 21:23:50 -08:00
Anees Iqbal cfa1a825c7 Runtime tests: the 4:2:2 refusal test grants its read texture's index
Index 2 was not granted (job m3-max-87820, llvmpipe); the test now grants it per device, as the
read, sample and gather test grants its own.
2026-12-04 21:23:50 -08:00
Anees Iqbal c23c3ca34e Runtime tests: the 4:2:2 refusal test gives its read texture an index
A texture shaders read takes an index; the test made its plain 4:2:2 texture without one and met
Refusal::TextureIndex before the view it asks (job m3-max-87817, llvmpipe).
2026-12-04 21:23:49 -08:00
Anees Iqbal c4a205f9e5 Runtime: a 4:2:2 texture's unbuilt use is its own gap before the format query
A texture of GBGR422 or BGRG422 asked with render-target usage met the format query first, which
offers the bytes' R8G8 image no render-target use on any device, and answered Gap::TextureFormat
instead of Gap::ChromaPairsUse { cause: RenderTarget }. The use is now asked first, keyed by the
format as Metal's 4:2:2 rules are.

Found by the device test every_device_refuses_what_metal_refuses_of_four_two_two_textures on
llvmpipe (job m3-max-87813), whose read, sample and gather test passed there (chroma_contents +6,
chroma_launches +80).
2026-12-04 21:23:49 -08:00
Anees Iqbal 0558bb7979 Runtime: the test literals take handle_float_images; the 4:2:2 known gap and note docs say what is true now
The Draws and Interface literals of tests/indirect.rs and tests/compute.rs
missed the new field (job m3-max-87802, E0063). The README's 4:2:2 known gap
now states the content lowered for the texture, its counters and costs, and
the refusals and gaps; PrecisionNote::BicubicFilterArithmetic's doc and its
docs/API.md entry name a 4:2:2 texture's linear sample.
2026-12-04 21:23:49 -08:00
Anees Iqbal 6fe743aa73 Runtime: 4:2:2 textures are made, decoded by contents lowered for them, and refused as Metal refuses
A GBGR422 or BGRG422 texture is made (FormatEmulation::ChromaPairs, its image
R8G8_UNORM of the bytes), over a buffer as any 2D texture. Only a content
lowered for it reads its texels as Metal's:

- KernelKey carries a Chroma: the texture slots bound to a 4:2:2 texture per
  stage, and whether a stage may reach one through a handle while one lives
  (PipelineInterface::handle_float_images and Gauges::chroma_textures).
- A dispatch picks the kernel state's content for it beside the sRGB and word
  variants (ComputePipelineState::variant), a draw the state's content for its
  draws (RenderPipelineState::for_draws); both are made at the first need,
  counted in Metrics::translations_at_encode and Metrics::chroma_contents, and
  kept in the device's map of contents (LRU, KERNEL_ENTRIES), whose
  fill-past-capacity test is tests/kernel_map.rs's
  the_map_holds_its_cap_and_forgets_the_least_recently_used. A draw or
  dispatch on one counts in Metrics::chroma_launches. A state without either
  runs its own module as before.
- Refusal::ChromaPairs (metal-measured, Metal's own asserts): a type other
  than 2D (texture buffers included), an odd width, more than one level, a
  view.
- Gap::ChromaPairsUse: ShaderWrite (and unknown) usage, RenderTarget usage, a
  swizzle at the make, and a function compiled outside the runtime bound to
  one or reaching one through a handle (the consumer never hands the runtime
  such a kernel).
- Buffer::new_texture's doc states that Metal refuses a linear 4:2:2 texture
  and why the runtime takes one.

The device test now asserts the six kernel states' contents, the 80
dispatches on them and the live gauge, and a second device test the
refusals and gaps. docs/REFUSALS.md and basis.rs regenerated (the
TextureSwizzle row's site list was stale at the base and is current now);
the API signature table blessed. Not yet built.
2026-12-04 21:23:49 -08:00
Anees Iqbal af7d2e1632 Translator: the plan carries which slots and handles decode 4:2:2 bytes
The emission context has no lowering inputs: selection records
LoweringInputs::chroma_pairs in each texture slot's plan (SlotPlan::chroma) and
chroma_handles beside heap_extended (AccessPlan::heap_chroma), which the
decode reads. Fixes the E0609 errors of job m3-max-87777.
2026-12-04 21:23:49 -08:00
Anees Iqbal afec47efc2 Translator: a 4:2:2 texture is decoded only by a function lowered for its bindings
The specialization-constant gate weighed every float 2D sampling stage with the
dead decode arms (spirv::roll::weights counts every block), which moves the
roll, the kernels' helper path and the render stages' bound for pipelines that
never see a 4:2:2 texture. The decode is now a lowering input, as srgb_storage
and word_bound_buffers are:

- LoweringInputs::chroma_pairs names the texture slots bound to a GBGR422 or
  BGRG422 texture: each read, sample and gather of a float 2D sampled image
  there takes Metal's decoded texels alone, the order read from the slot's word.
- LoweringInputs::chroma_handles: each heap handle carries the 4:2:2 marks and
  each access through a handle branches on them.
- Without either nothing of the decode is emitted, so a function's module is
  the one it was. SpecKey::ChromaPairs is gone.
- StageInterface and PipelineInterface::handle_float_images state whether a
  function reaches a float colour image through a handle (the plan's
  heap_extended), which the runtime reads to choose the handles content.
- BicubicFilterArithmetic is recorded only where the input names the site's
  texture and the sampler may magnify linearly.
- The clippy errors of job m3-max-87748 are gone (the unused READ_WORDS, the
  indexed lanes).

ARTIFACT_FORMAT_VERSION 617 for the interface field. The API signature table
is blessed. New tests in src/tests/engine_chroma_pairs.rs: a slot named in
chroma_pairs decodes and validates on every committed profile and records the
note only for the linear-capable sample; a slot the kernel does not declare
and chroma_handles on a function without handles leave the module word for
word; a4_heap_sample under chroma_handles validates and differs. Not yet run.
2026-12-04 21:23:48 -08:00
Anees Iqbal 496be31c3b Translator: the 4:2:2 sample arm borrows its builder once at a time
Build fixes for 920324aeba (job m3-max-87745 failed its clippy on two borrows): border_bits takes the
context mutably, and the nearest arm makes its footprint before the decode.
2026-12-04 21:23:48 -08:00
Anees Iqbal 95f1391bb4 Translator: 4:2:2 textures held as their bytes, decoded under SpecKey::ChromaPairs (first build)
GBGR422 and BGRG422 are held as R8G8_UNORM at full width (FormatEmulation::ChromaPairs), two bytes
a texel, which copies move unchanged. Every float 2D sampled image's read, sample, gather, pixel
fetch and bicubic sample keeps the device's access and, where the stage's new
SpecKey::ChromaPairs holds and the texture's word names a 4:2:2 format, a branch computes Metal's
answer from the decoded texels (lower::texture::chroma, lower::sampler::chroma). A heap handle
carries the format's marks in place of its word bits under the same constant. SEMANTICS_VERSION
2395 (its final number in pin AC).

Not yet built: this commit is the first build's input; fixes follow forward.
2026-12-04 21:23:48 -08:00
Anees Iqbal c9f973f88e Conformance: the Apple M3 Max's recordings of the 4:2:2 linear samples and gathers
The four cases 0a26c673d9 added, recorded on the Apple M3 Max under macOS 27.0.1 (26A434), three
runs each with one outcome (job m3-max-87684 at 0a26c673d9):

- chroma-pair-texel-linear-samples-{gbgr422,bgrg422};
- chroma-pair-texel-gathers-{gbgr422,bgrg422}.

The job's tree showed only these four files new, so the four texel recordings taken before stay
current.
2026-12-04 21:23:48 -08:00
Anees Iqbal fe29e9f4a6 Runtime tests: 4:2:2 textures over a surface buffer, refused today
A device test of what the consumer's camera frames need: GBGR422 and BGRG422 textures made with
Buffer::new_texture over buffers laid out as 'yuvs' and '2vuy' surfaces (64x8 over Shared and
Private buffers at rows 128 and 192 bytes apart, and 640x480 at 1280 over a Private buffer, the
consumer's frame), each made in the form texture_copy_cause answers and the 640x480 one in place;
every texel read and nearest-sampled at its centre as Metal's decode (jobs m3-max-87650 and
m3-max-87653: own luma, chroma (3c + n + 2) >> 2 of its pair and the pair on its side, each code
c / 255 correctly rounded), each component gathered at every footprint corner, and linear samples
at the corners and a quarter between texels within f32 rounding of the decoded texels' mean.

It fails today at the texture's make, Gap::TextureFormat, on every device: the red half of the
4:2:2 form that follows.
2026-12-04 21:23:47 -08:00
Anees Iqbal 0d406e1fd8 Conformance: 4:2:2 linear samples and gathers, refused on rt today
chroma_pairs gains two accesses of each 4:2:2 format, so the form that makes these textures is held
to Metal's filtered and gathered answers as well as its reads and nearest samples:

- chroma-pair-texel-linear-samples-{gbgr422,bgrg422}: sample() through a linear clamp-to-edge
  sampler at 552 positions (a quarter past each texel toward its right neighbour, the corner of
  each 2 by 2 footprint, the centres of rows 0 and 7, and u at 0, 1, -0.25 and 1.25 in rows 0 and
  15);
- chroma-pair-texel-gathers-{gbgr422,bgrg422}: gather() of each component through the nearest
  clamp-to-edge sampler at the corner of each 2 by 2 footprint, 256 positions, one dispatch and
  site a component.

Both read a texture of hashed bytes, whose neighbouring pairs' chroma do not all differ by
multiples of 4, so Metal's (3c + n + 2) >> 2 rounding shows; the step pattern the read and the
nearest sample recordings were taken over gives 3c + n a multiple of 4 at every texel
(the_hashed_texture_shows_the_decode_rounding). The accesses of one entry keep their recorded call
order and inputs, so the four existing texel recordings stay current.

The four cases are refused on rt at every venue today (Gap::TextureFormat at the texture's make),
the ledger's rows say so; their Metal recordings follow from the M3.
2026-12-04 21:23:47 -08:00
Anees Iqbal 8e895593e1 Docs: NVIDIA's free holds say only what was measured; the unsourced per-MiB figure goes
The runtime's README (Known gaps of memory blocks), memory.rs's IDLE_AGE_NANOS doc and
counters.rs's Metrics::submissions_during_frees doc each said that freeing host-visible memory
takes about 1.1 ms per MiB on the NVIDIA cards measured in Thunderbolt enclosures (the README also:
about 0.5 ms per 16 MiB on an internal card, and that the free holds any submit for its length).
The only record of those figures is 0280c19285's message, with no job on file. They go. The README
line now says a driver may hold a submit for a free's length and points to the measured NVIDIA rows
below it; the two doc comments keep only "a driver may hold".

The hold paragraph opened with "NVIDIA's Linux driver holds a submit ...", stated for every NVIDIA
driver. Its evidence is an RTX 3090 under 620.70.06 (rtsweep's standalone program, 9e250379d3 and
ef875741cc, and the consumer's walk m3-max-57463, 028a764c68) and an RTX 2080. It now names the
cards measured.

The paragraph's walk sentence keeps its figures (frees of imported blocks, 0.4 to 2.9 ms each and
52 in one second, held four submits for 5.2 to 6.9 ms). The walk's raw log is gone, but its derived
table is on file: the consumer's take-site table for m3-max-57463 (rt 2233c8962d, an RTX 3090,
336 s, allocate, free and submit timers on rt's own clock), sent to us on 11-20 and kept in the
consumer's session record. Its line reads: "73.5 s, four submits of 5.2-6.9 ms: 3-5 block-own
vkFreeMemory each, 0.4-2.9 ms apiece, on m2v-blocks. 97-100%. By stamp these are guest-memory
import frees, 52 in that second."

The per-claim source audit was lane uniarm's (its commit e2e4ae1bb7 on the parked
steelbrain/uniarm-landing, whose doc-comment hunks this takes unchanged). No code changes; the
README text names no job.
2026-12-04 21:23:47 -08:00
Anees Iqbal 51d2a509b5 Conformance: Metal's timings of the one-level filter cases
`conformance times --runs 8 --write` over sampler-one-level-filters-level and -bias on the Apple
M3 Max, macOS 27.0.1, job m3-max-87764. The run adds times to the two recordings and changes no
answer: 254 lines added, none removed. times::every_case_carries_its_timing failed without them
(conformance suite job m3-max-87753, 1061 of 1062 passed); this commit closes it.
coverage.py --check still reads "as derived".
2026-12-04 21:23:47 -08:00
Anees Iqbal 4568d32fc6 Conformance: the Apple M3 Max's recordings of the one-level filter cases
sampler-one-level-filters-level and -bias, recorded on the Apple M3 Max, macOS 27.0.1, job
m3-max-87749 (3 runs, one outcome each). Every lane of every cell reads one filter. Under the
clamp [0, FLT_MAX] the magnifying filter takes -2, -0.5 and 0 and the minifying filter takes
1/64 and up. lodMinClamp 1 gives the minifying filter at every level, and lodMaxClamp 0 the
magnifying filter at every level. This holds for all three mip filters, both (min, mag) pairs,
level() and a kernel's bias(). So Metal reads the choice after the sampler's clamp and before
the clamp into the texture's one level, as 87718 showed for samplers without a mip filter. The
case's doc holds the table. level.rs's one-level paragraph now names the cases' facts, which
settle the sampler-clamp side.

docs/CONFORMANCE-COVERAGE.md regenerated by scripts/conformance-coverage/coverage.py; --check
reads "as derived". level.rs stays comment-only; pin-compute.py still prints the committed
runtime-sources hash.
2026-12-04 21:23:46 -08:00
Anees Iqbal 6aa64832f5 Conformance: which filter a sampler of two filters reads on a texture of one level
Two cases, sampler-one-level-filters-level (unv_runtime_levels' unv_rpos2d, level()) and
sampler-one-level-filters-bias (mip_level_sampling's mip_bias_kernel, a kernel's bias()), over
a 16 x 4 R32Float texture of one level whose texels are distinct. Each samples a quarter of a
texel past every texel's centre (60 positions) at the nine levels of the Metal probe job
m3-max-87718 (-2, -0.5, 0, 1/64, 1/4, 1/2, 1, 2, 5), through the runtime sampler in 18 rows:
every mip filter x the two (min, mag) pairs whose filters differ x three clamps (Metal's
defaults, lodMinClamp 1, lodMaxClamp 0). A nearest sample there is the texel and a linear one
the texel plus 1/4, exact in float, so every lane names the filter that read it.

This is the evidence that the device's own sampler path, which takes Vulkan's choice (λ after
[minLod, maxLod], before the view's levels), matches Metal on a one-level texture. The test
the_recorded_filters_are_chosen_before_the_texture_levels_clamp holds every recorded lane to the
rule level.rs now states, and counts the lanes where the old reading (the choice after the
texture's levels clamp) names the other filter. Recordings follow from the M3.
2026-12-04 21:23:46 -08:00
Anees Iqbal e52085541e Docs: Metal chooses between a sampler's two filters before the clamp into the texture's levels
level.rs stated Metal's rule as "every sampler magnifies where L + q is 0", with L + q taken after
the clamp into the texture's levels, and left a texture of one level unmeasured. A Metal probe of
the Apple M3 Max on macOS 27.0.1 (job m3-max-87718) measured it: a 16 x 4 rgba8Unorm texture of
one level, through runtime samplers without a mip filter whose filters differ (min nearest / mag
linear and the reverse), at level() and a kernel's bias() of -2, -0.5, 0, 1/64, 1/4, 1/2, 1, 2 and
5, 60 positions each, takes the magnification filter at -2, -0.5 and 0 and the minification
filter at every level from 1/64 up. The stated rule would have magnified at every level. So the
choice reads the level after the half rounding and the sampler's clamp, before the clamp into
the texture's levels. On a texture of more than one level the two readings agree, so the 2,230-
level probes the module cites still hold.

Comment-only. No code takes this choice where the module reads texels itself: an extended-range
sample's constexpr sampler with differing filters is refused, and a runtime word with mixed
filters reads nearest (extended's open gap). The device path follows Vulkan's rule (λ after the
sampler's [minLod, maxLod], before the view's levels), which the device paragraph now says matches
Metal's choice. No translation changes, so SEMANTICS_VERSION stays. level.rs is not a
runtime-sources input: pin-compute.py on this tree prints the committed e8f7cd09...6798, so
the pin does not move.
2026-12-04 21:23:46 -08:00
Anees Iqbal e7f9a98fbf Varyflag step 2 bless: the golden hashes at semantics 2394
The golden table re-blessed at 6495aabffd (varyflag step 2 rebased on step 1's 47c09be7ae), on
the Apple M3 Max, job m3-max-87793 (inventory, golden, printouts, linkhalf and chains each exit 0):
- the semantics line moves 2393 -> 2394, step 2's own number (2392 at that bless, renumbered
  when the stack moved onto pin AB');
- no cell moves and no row is added.
2026-12-04 21:23:46 -08:00
Anees Iqbal a8cec25600 Docs: the widened-varying accepted difference states the Mac and OS, not the job
scripts/api-docs (ci-gaps leg m3-max-87688 at ae5f9bcd2f) refuses a lab job id in docs/API.md's
prose: the measurement is stated by its card and OS (Apple M3 Max, macOS 27.0.1 26A434); the
job, m3-max-87586, stays in the commit messages.
2026-12-04 21:23:46 -08:00
Anees Iqbal c0b1616a36 Tests: the agx draw test reads its texels through as_chunks
clippy under --cfg m2v_gpu and --cfg m2v_cpu_icd (job m3-max-87679 at ae5f9bcd2f) refused
chunks_exact with a constant size in mismatched_varyings (clippy::chunks_exact_with_const_size,
-D warnings). The texels are read as words, then as four-word arrays, both by as_chunks.

Verified by the rerun of both clippy configurations and the lavapipe run of the test in
the job named in the READY message.
2026-12-04 21:23:45 -08:00
Anees Iqbal 87484e206a Pipeline: LoweringInputs::widened_varyings serializes as pairs
serde_round_trips::lower_inputs failed at 5ab16afb13 (job m3-max-87672, on the
translator suite's focused run): JSON refuses a map whose keys are VaryingKey ("key
must be a string"). The field takes serde_pairs, with its default, as extended_range
and storage_images do.

Verified by the same job's rerun in the suites job named in the READY message.
2026-12-04 21:23:45 -08:00
Anees Iqbal 255f758265 Pipeline: behind the agx flag a wider fragment input reads its vertex output's lanes, then zeros
The planner's ruling for the wide case of agx.allow_mismatched_component_counts: Metal
makes a render pipeline whose fragment function reads a varying at more components
than its flagged vertex function writes, and leaves the lanes past the output's
undefined (M3 Max, macOS 27.0.1, job m3-max-87586: 150 such lanes read 147 distinct
values, none written). One form on every device, decided at pipeline make by structure:

- LoweringInputs::widened_varyings (new public field, serde default): the user varyings
  a flagged vertex function writes at fewer lanes than the pipeline's fragment function
  reads, with the count it reads, of the same AIR scalar type. compile_render_pipeline
  and render_variant_key derive it from the two Function stages' specialized entries
  (compile.rs widened_varyings: return-struct field types against fragment-input
  parameter types), only where the vertex entry carries the flag; a Compiled stage on
  either side gives none. render_pipeline compiles the vertex stage, and only where its
  StageIo carries the flag and the set is not empty compiles it again under the set;
  render_variant_key hands it to the vertex inputs, so a runtime's stage-by-stage
  compile under the keys widens too, and the pipeline key matches.
- Planning declares such an output at the read count (StageIo outputs list it so, so
  link matches equal types) and marks its object in StageIoPlan::widened; store writes
  the value's lanes then a constant 0 per extra lane (OpCompositeConstruct). Colour
  outputs, whose declared components may differ from their form for other reasons, are
  never marked.
- The key appends the set only when set: every other function keeps its key.
- Link is unchanged: a wider input behind a vertex function compiled alone stays
  Unsupported{UnmatchedVarying, NotImplemented}, as does a mesh producer; flag 0 or
  absent stays Metal's link error.

Docs: docs/API.md accepted differences gains the line (Metal undefined, we give zeros;
no precision note, per the ruling); the UnmatchedVarying, StageIo and link docs say
where the gap now remains; reach.tsv's line likewise; REFUSALS.md regenerated; the API
signature table blessed (LoweringInputs.widened_varyings); the inputs-encoding and serde
round-trip tests cover the field. SEMANTICS_VERSION stays at 2394 (the narrow
form's bump).

Tests: the red tests of 3f0fa825f4 (jobs m3-max-87655 lavapipe + translator, m3-max-87661
RTX 5080) go green in the jobs named in the READY message.
2026-12-04 21:23:45 -08:00
Anees Iqbal 3b921fc5eb Tests: behind the agx flag a wider fragment input reads zeros past its vertex output (red)
The planner's ruling for the wide case of agx.allow_mismatched_component_counts: Metal
makes the pipeline and leaves the lanes past the vertex output's undefined (M3 Max,
macOS 27.0.1, job m3-max-87586: 150 such lanes read 147 distinct values), so the vertex
function declares the output at the count the fragment function reads, decided at
pipeline make from the two entries, and writes 0 in every lane past its own.

Two tests, red until that form lands:

- engine_converter_module_flags: on lavapipe's profile, compile_render_pipeline of a
  flagged vertex function writing 1 to 3 lanes behind a fragment function reading 2 to
  4 (float perspective, no-perspective, flat; uint and int flat) compiles; every stage
  passes L3; the vertex Output and fragment Input at the varying's Location have the
  input's count; the stored composite carries a constant 0 for each lane past the
  output's; the pipeline's key is render_pipeline_key's. Flag 0 stays Metal's link
  error.
- metal2vulkan-runtime mismatched_varyings (device cfg): the same classes drawn into a
  32-bit target of the class on every device: the output's lanes exact, 0 past them,
  the fragment's sentinel past the input's; the narrow rows (4 to 2, 3 to 1) read the
  output's first lanes.

Red expected: the wide rows fail with Unsupported{UnmatchedVarying, NotImplemented}.
2026-12-04 21:23:45 -08:00
Anees Iqbal cb3cc03b6d Link: behind the agx flag a narrower fragment input reads its vertex output's first lanes
Metal makes a render pipeline whose fragment function reads a user varying at
fewer components than the vertex function writes when the vertex module states
agx.allow_mismatched_component_counts as 1, and the input reads the output's
first lanes (Apple M3 Max, macOS 27.0.1, job m3-max-87586: 90 rows of float
under perspective, center_no_perspective and flat, uint and int flat). Link
answered it Unsupported{UnmatchedVarying, NotImplemented}.

Link now matches such an input to its output (reads_first_lanes: the same
class, fewer components, a vertex function of
StageIo::mismatched_component_counts, a description stating maintenance4), so
the input takes the output's location and component. Vulkan matches an input
of fewer components there under maintenance4 (spec 19.1.3; without it
VUID-RuntimeSpirv-maintenance4-06817 forbids it), which the runtime's floor
requires and enables: one form on every device, no query. A description without
maintenance4 keeps the gap, as do a wider input and any mismatch behind a mesh
function. No module changes: the fragment's input keeps its own width.

Docs: the varyings module docs, StageIo::mismatched_component_counts and
Feature::UnmatchedVarying say so. SEMANTICS_VERSION 2394 (a refusal becomes a
link).
2026-12-04 21:23:44 -08:00
Anees Iqbal ca796ca5ff Tests: behind the agx flag a narrower fragment input links at its output (red)
The draw probe (Apple M3 Max, macOS 27.0.1, job m3-max-87586) measured that a
fragment input narrower than its vertex output reads the output's first lanes
when the vertex module states agx.allow_mismatched_component_counts as 1, for
float under perspective, center_no_perspective and flat interpolation and for
uint and int flat. Vulkan matches exactly that under maintenance4 (spec 19.1.3,
Interface Matching: "if the maintenance4 feature is enabled, they are declared
as OpTypeVector variables, and the output has a Component Count value higher
than that of the input but the same Component Type"; without it
VUID-RuntimeSpirv-maintenance4-06817 forbids it). The runtime's floor requires
and enables maintenance4 (Vulkan 1.3), so this is one form on every device.

The tests:
- link: a narrower vector or scalar input, float or uint, smooth or flat,
  beside matched varyings, takes its output's location and component; a
  description without maintenance4 answers the gap; a wider input stays the
  gap, a mesh producer's either way, and no flag stays Metal's link error;
- engine, over text modules on lavapipe's profile: for each class and
  interpolation, 4 to 2, 4 to 1 and 3 to 2 lanes link, both relocated modules
  pass L3 (spirv-val under the profile's settings, maintenance4 among them),
  and the input's Location is the output's, past a second varying.

Red: link still answers the narrower input with the gap.
2026-12-04 21:23:44 -08:00
Anees Iqbal 2753ea3fbf Varyflag step 1 bless: the golden hashes at semantics 2393
The golden table re-blessed at 39e5964c2a (varyflag step 1 rebased on 9e7034c214), on the Apple
M3 Max, job m3-max-87716 (inventory, golden, printouts, linkhalf and chains each exit 0):
- the semantics line moves 2392 -> 2393, step 1's own number (2391 at that bless, renumbered
  when the stack moved onto pin AB', whose PR 30 and fix-forwards took 2391 and 2392);
- no cell moves and no row is added.
2026-12-04 21:23:44 -08:00
Anees Iqbal 6770dcf8f0 AIR docs: the agx flag's draw probe, flag 0 included
The draw probe (Apple M3 Max, macOS 27.0.1, job m3-max-87586; 720 render
pipelines, one draw each, a pixel read back) measured what 87508 left open:
- flag 0 refuses every count mismatch, as no flag does (180 each); 1 makes all
  180;
- under 1, a narrower fragment input reads the vertex output's first lanes
  (90 rows: float under perspective, center_no_perspective and flat, uint and
  int flat, a second varying absent, after or before);
- a wider input reads the output's lanes, and past them no constant: 150 lanes
  read 147 distinct values, none of them 0, 1 or a value either varying wrote.
EntryPoint::mismatched_component_counts's doc now states these facts. Docs only.
2026-12-04 21:23:44 -08:00
Anees Iqbal be3823ca5f AIR docs: the agx flag's measured refusals name what the probe ran
Job m3-max-87508 ran each vertex and fragment module with the agx flag at 1
(alone or beside irc.version_*) and with no flag at all; it never ran a module
stating 0. The field's doc, and the commit messages of 7285b878a1 and
02b5d3d1a4, said the pipeline is refused at 0: unmeasured. The doc now says
the refusals measured (no flag on the vertex module, whatever the fragment's)
and that 0 is read as no flag, which is not measured. The decoder is unchanged.
2026-12-04 21:23:44 -08:00
Anees Iqbal 7d47114ace Link: a component-count mismatch behind the agx flag is our gap, not Metal's link error
Metal makes a render pipeline whose fragment function reads a user varying at
another component count than the vertex function writes when the vertex
function's module states agx.allow_mismatched_component_counts as 1 (Apple M3
Max, macOS 27.0.1, job m3-max-87508; float4 written and float2 read, and float2
written and float4 read; refused at 0, with no flag, and with the flag on the
fragment module alone; irc.version_* changed nothing). Link answered every such
pipeline Unsupported{UnmatchedVarying, NotRepresentable}, Metal's link error,
for a pipeline Metal makes.

- AIR: module_flags returns whether the agx flag is 1, and the decoder sets
  EntryPoint::mismatched_component_counts on each vertex (post-tessellation
  included) and mesh function the module defines; fragment, kernel and object
  functions never carry it. The flag's docs state the probe's facts.
- Lowering copies it to StageIo::mismatched_component_counts.
- Link (varyings, mesh_fragment): a fragment input whose type differs from
  its producer's output in component count alone (same numeric class and source
  width), behind a producer carrying the flag, is
  Unsupported{UnmatchedVarying, NotImplemented}; everything else stays
  NotRepresentable. A mesh producer is not probed yet, so it stays the typed gap.
- Feature::UnmatchedVarying's doc says both; reach.tsv marks it rare;
  docs/REFUSALS.md regenerated (it also drops TextureSwizzle's four translator
  sites, which a49e4a61c4 and its neighbours removed without a regeneration).
- SEMANTICS_VERSION 2393 (a refusal's class and an interface fact change;
  2392 is PR 30's and its fix-forwards', pin AB').

Verified: the red tests of 7285b878a1 (red in job m3-max-87576) pass here;
the green job is named in the lane's report.
2026-12-04 21:23:43 -08:00
Anees Iqbal 50f744c6c5 Tests: the two translator test entries name the agx field
The red commit's EntryPoint field left two test literals in the translator
crate without it (memory plan and simd uniformity tests); the red job
m3-max-87574 stopped at the build on them.
2026-12-04 21:23:43 -08:00
Anees Iqbal 2ed6b9387b Tests: a component-count mismatch behind the agx flag is our gap (red)
Metal makes a render pipeline whose fragment function reads a user varying at
another component count than the vertex function writes when the vertex
function's module states agx.allow_mismatched_component_counts as 1 (Apple M3
Max, macOS 27.0.1, job m3-max-87508: float4 written and float2 read, and float2
written and float4 read; refused at 0, with no flag, and with the flag on the
fragment module alone). Link refuses it as Metal's link error
(Unsupported{UnmatchedVarying, NotRepresentable}).

This adds the fact's two fields, set nowhere yet, and the tests that hold the
label:
- EntryPoint::mismatched_component_counts (AIR): the decoder test expects it on
  the module's vertex and mesh functions under 1, nowhere else, and nowhere
  under 0 or no flag.
- StageIo::mismatched_component_counts, encoded (ARTIFACT_FORMAT_VERSION 617).
- A link test: a flagged vertex or mesh producer writing wider or narrower than
  the fragment input expects NotImplemented; an unflagged one, the flag on the
  fragment alone, another numeric class or an unwritten key stay the link error.
- An engine test over text modules compiled on lavapipe's profile: the vertex
  module's flag reaches the stage interface and the link answers as above; the
  same count links.

Red: these three fail at this commit (the field is never set, link answers
NotRepresentable).
2026-12-04 21:23:43 -08:00
Anees Iqbal cb574b06fa Pin AB' bless: the golden hashes after PR 30 and its fix-forwards
The golden table re-blessed at b991ca5474 (PR 30's head 6d9f774d63, its fix-forwards and SEMANTICS
2392), on the Apple M3 Max, job m3-max-87900 (inventory, golden, printouts, linkhalf and chains each
exit 0):
- the semantics line moves 2390 -> 2392 (PR 30's 2391 and the fix-forwards' 2392);
- no cell moves and no row is added: no committed fixture declares a memory intrinsic in the older
  form.
2026-12-04 21:23:04 -08:00
Anees Iqbal b991ca5474 Cache: SEMANTICS_VERSION 2392, PR 30's fix-forwards
A legacy memory intrinsic's alignment that is not a power of two (or above 2^32) is now refused
as a malformed record, not ImmediateNotConstant (f32b143935), and a legacy call whose volatile flag
is not a constant now meets the verifier the current form meets instead of failing decode's verify
(3e311ec8ac). Both change what decode answers for a module, so cached answers keyed by the old
version must not be reused.
2026-12-04 21:18:05 -08:00
Anees Iqbal 3e311ec8ac Verifier: an unbound legacy memory intrinsic call is one operand short of its declaration
Decode upgrades a call of the older LLVM's llvm.memcpy, llvm.memmove or llvm.memset (an i32
alignment before the volatile flag) by removing the alignment operand. Where the volatile flag is
not a constant in the function that makes the call, decode keeps the upgraded call
Callee::Unbound with its template, as it keeps a current-form call (bitcode/function.rs). The
verifier's legacy arm took only Callee::Llvm, so such a call failed Verify(OperandType) in the
Module::new that decode runs (bitcode/decoded.rs), refusing the whole module. The arm now also
takes Callee::Unbound { template: Template::Llvm(Memset | Memcpy | Memmove) }, under the same
conditions: not variadic, one operand short, and a five-parameter declaration whose fourth
parameter is i32 and fifth i1.

What such a call then meets, read on the current form's path (not run): canonicalization's SCCP
binds an Unbound call with Template::bind over its four operands and the current signature
(canon/sccp.rs), so where inlining makes the flag a constant the call becomes Callee::Llvm, the
form the PR already verifies and translates; where the flag stays a kernel parameter or a value
the run computes, the post-check refuses it at the call in the inlined entry as
InvalidInput(Intrinsic(ImmediateNotConstant)) (canon/mod.rs), the refusal a current-form call
with that flag meets (docs/API.md, OpenCL C kernels).

Makes a_legacy_memory_intrinsic_with_an_unbound_volatile_flag_verifies pass (expected; not run:
the brief holds every build and test until PR 30 merges). No SEMANTICS_VERSION bump here: PR 30's
2391 covers its decode change, of which this is part. Checked: cargo fmt clean.
2026-12-04 21:17:50 -08:00
Anees Iqbal a5a4c0f839 Tests: a legacy memory intrinsic whose volatile flag is not a constant verifies unbound
New test a_legacy_memory_intrinsic_with_an_unbound_volatile_flag_verifies: a kernel
@k(ptr addrspace(1) %p, i1 %v) calls the older LLVM's llvm.memcpy.p1i8.p1i8.i64, declared
void (ptr, ptr, i64, i32, i1), as memcpy(%p, %p, 400, i32 16, %v). It expects decode to upgrade
the call (four operands, align 16 on both pointers), keep it Callee::Unbound with the template
Llvm(Memcpy), as a current-form call whose flag is not a constant is kept, and the module to
verify (verify_module_level, the Module::new that decode runs).

At ace196acec the verifier takes a call one operand short of the legacy declaration only when its
callee is Callee::Llvm, so this one, whose flag is a parameter, fails Verify(OperandType), and
the whole module is refused at decode. Expected to fail here; the next commit makes it pass.

legacy_copy_module gains LegacyAlign::VolatileParameter(bytes): a constant alignment, and the
volatile flag the kernel's second parameter, an i1. The other variants build the same module as
before.

Not run: the brief holds every build and test until PR 30 merges. Checked: cargo fmt clean.
2026-12-04 21:17:49 -08:00
Anees Iqbal f32b143935 Translator: a legacy memory intrinsic's alignment that is not a power of two is a malformed record
Decode upgrades a call of the older LLVM's llvm.memcpy, llvm.memmove or llvm.memset (an i32
alignment before the volatile flag) by moving the alignment to the pointers' align. A constant
alignment that is not a power of two (or is above 2^32) was refused as
Intrinsic(ImmediateNotConstant), whose own doc says the operand is not a constant. It is now
Bitcode(MalformedRecord { block: FUNCTION_BLOCK, code: FUNC_CALL }), the decoder's answer to an
align attribute of such a value (attrs.rs). An alignment that is not a constant stays
Intrinsic(ImmediateNotConstant) at the call.

How: upgrade_legacy_memory returns a crate-private LegacyAlignmentError, Intrinsic(e) for the
immediate read's error and Malformed for a value Align::from_bytes refuses; the call's decode maps
Malformed to the CALL record's malformed-record error and Intrinsic(e) to the input error at the
record, as before. No public type changes; the outcome class is InvalidInput either way.

Makes a_legacy_memory_intrinsic_s_alignment_must_be_a_constant_power_of_two pass (expected; not
run: the brief holds every build and test until PR 30 merges). No SEMANTICS_VERSION bump here:
PR 30's 2391 covers the decode change, and only the error kind of an input refused either way
changes. Checked: cargo fmt clean.
2026-12-04 21:17:49 -08:00
Anees Iqbal 50b914e42b Tests: a legacy memory intrinsic's alignment that is not a power of two is a malformed record
a_legacy_memory_intrinsic_s_alignment_must_be_a_constant_power_of_two now expects a constant
alignment of 24 on the older LLVM's llvm.memcpy declaration to fail decode as
Bitcode(MalformedRecord { block: FUNCTION_BLOCK, code: FUNC_CALL }), and an alignment that is the
kernel's i32 parameter to fail as ImmediateNotConstant, as before.

Why: IntrinsicError::ImmediateNotConstant says "An operand that must be an immediate is not a
constant", and 24 is a constant. The decoder's precedent for a value that is not a power of two
where an alignment must be one is the align attribute's: MalformedRecord (attrs.rs).

Expected to fail at ace196acec, which reports both alignments as ImmediateNotConstant; the next
commit makes it pass. Not run: the brief holds every build and test until PR 30 merges.
Checked: cargo fmt clean.
2026-12-04 21:17:49 -08:00
Jacob McSwain 6d9f774d63 Translator: accept memory intrinsics declared with an alignment operand
Modules from older LLVM-based Metal frontends couldn't be translated. They declare llvm.memcpy,
llvm.memmove and llvm.memset with an i32 alignment before the volatile flag, and that declaration
was refused as Intrinsic(DeclaredSignatureMismatch).

The declarations involved:
- llvm.memcpy and llvm.memmove: void (ptr, ptr, i64, i32 align, i1 volatile)
- llvm.memset: void (ptr, i8, i64, i32 align, i1 volatile)
- seen in typed-pointer bitcode from metalfe-32023.35

What changes: decode upgrades such a call the way LLVM's own reader does (UpgradeIntrinsicCall): the
alignment operand is removed, and its value becomes the align of the pointer operands. In detail:
- the removed operand's attributes go with it, and later attributes move down one place;
- the alignment replaces any align the call states, and an alignment of 0 removes it
  (setDestAlignment, setSourceAlignment);
- a non-constant alignment, or one that is not a power of two, is refused as ImmediateNotConstant;
- the verifier accepts the one-short call only when the declaration has exactly that legacy form.

No public API changes.

Evidence:
- On 466 real libraries from one metalfe-32023.35 game, all refused before: 66 now translate (48
  render or compute functions, plus 18 kernels given a stage-input descriptor). Each is
  byte-identical to the translation of the same library after llvm-dis upgrades it with LLVM's
  reader. The other 400 stop at an unrelated later refusal (Lowering(StageIo)), the same on both
  forms.
- New tests: a_legacy_memory_intrinsic_states_its_alignment_on_its_pointers,
  a_legacy_memory_intrinsic_s_alignment_must_be_a_constant_power_of_two,
  a_legacy_memory_intrinsic_s_attributes_move_with_its_operands,
  a_memory_intrinsic_call_one_short_only_of_the_legacy_declaration. Undoing each part of the change
  on its own makes at least one of them fail.
- Linking a legacy-form module with a current-form one is not tested.

Version: SEMANTICS_VERSION becomes 2391, because inputs refused before can now compile.

Golden table: unchanged; this change adds no fixture.

Not run: the GPU device tests, the Windows clippy legs and the CI matrix.
2026-12-04 21:52:27 -06:00
Anees Iqbal 9e7034c214 Pin AB bless: the golden hashes after PR 29
The golden table re-blessed at 3c3d214397 (PR 29's head 8f117956ef and its docs fix-forward), on
the Apple M3 Max, job m3-max-87637 (inventory, golden and printouts each exit 0):
- the semantics line moves 2389 -> 2390, PR 29's own number;
- one row is added, the new fixture vertex_stack_return_aggregate.ll (stack_return_vertex), the
  same hash on every profile.
No existing cell moves, as the PR's reading predicted: no committed fixture loads or stores a
whole aggregate in thread memory.
2026-12-04 19:40:00 -08:00
Anees Iqbal 3c3d214397 Docs: PR 29's comments say what is true now and keep to 100 columns
The fix-forward of PR 29's reading (lane pr29read; docs only, no code):
- engine_stack_return_aggregate.rs says it compiles on one profile, `nvidia-rtx50-linux`, and
  that its expectations row holds the fixture to `ok` on every committed profile, as the
  converter-flags engine test does since d3316d621e.
- canon/aggregates.rs's module doc drops "left whole, it was refused" (history); the refusal a
  whole access of a larger aggregate meets is named where the doc says lowering refuses it.
- The PR's new comment lines over 100 columns are wrapped: aggregates.rs's opening paragraph,
  canon/mod.rs's pass list and its call-site comment, and tests/aggregates.rs's module doc.

Checked: cargo fmt --all makes no change; the comment lines the PR added are at most 100
columns.
2026-12-04 19:24:23 -08:00
Jacob McSwain 8f117956ef Translator: split whole-struct stack loads and stores into members
Vertex functions that build their return value on the stack couldn't be translated. A whole struct
stored to or loaded from an alloca reached lowering, which handles only scalars and vectors there,
and was refused as Lowering(Access) AccessType.

The shape involved, seen in modules Apple's Metal shader converter wrote:
- a store of zeroinitializer to an alloca of the return struct;
- stores to its members;
- one load of the whole struct.

What changes: the split that already turns a whole-aggregate access of device, constant and
threadgroup memory into its members' accesses now covers stack memory too. Still kept whole, and
refused by lowering as before:
- a volatile access;
- an aggregate that holds a pointer;
- an aggregate with more members than the split takes.

No public API changes.

Evidence:
- a_stack_aggregate_is_split checks the member stores and loads, their alignments and byte offsets,
  the two insertvalues, and that no whole-struct access is left.
- what_is_not_split_stays_whole gains the three stack cases above.
- The new fixture compiles, links and validates.
- a_stack_aggregate_is_split and a_return_value_built_in_a_stack_slot_compiles fail without this
  change.
- No release-mode timing was taken; the split adds a bounded walk per whole stack access.

Version: SEMANTICS_VERSION 2389 -> 2390, because inputs refused before can now compile.

Golden table: left for the bless on development; golden_hashes_match_the_table lists the new
fixture's cells. The fixture's expectations row is included.

Not run: the GPU device tests, the Windows clippy legs and the CI matrix.
2026-12-04 21:22:16 -06:00
Anees Iqbal f0c64c3b1d Tests: the API tests' slot helper lives in the serde module that alone calls it
CI run 47469915099 at 69664cbc1a failed "Clippy under each feature alone" on both
legs: with no feature, `slot` in pipeline/api_tests.rs is never used (dead_code under
-D warnings). a49e4a61c4 removed its last caller outside `serde_round_trips`, and the
merge check runs clippy only with all features, so nothing caught it before the push.

The helper and the three `sym` types it names move into `serde_round_trips`, where
every caller is. The empty `bind_serde_round_trips` module goes with it: it holds
nothing.

Checked: cargo fmt clean. The per-feature clippy (metal2vulkan none, serde, ash,
cli; metal2vulkan-air none, serde) runs on this commit as its own leg.
2026-12-04 19:01:03 -08:00
Anees Iqbal 69664cbc1a Pin AA' bless: the golden hashes after PR 28 and the hoist containment
PR 28 (74e4ad9d3a) added the owned fixture kernel_converter_module_flags, whose cells the
contribution left for this bless, and the hoist containment (7a066a4b80) checks a load the
translator makes where the program did not run it in the address form, which moves that form's
cells. golden_hashes.tsv gains the fixture's row and 23 rows move, re-blessed on macOS (M3 Max,
job m3-max-87519, BLESS_JOBS=4); after the bless the job's golden, inventory, printouts, linkhalf
and chains checks report 0. Data only: no source changes.
2026-12-04 18:34:36 -08:00
Anees Iqbal 08ce42bf68 Cache: SEMANTICS_VERSION 2389, the containment's own number after the rebase onto d3316d621e
7a066a4b80 (a load made where the program did not run it is checked in the address form) bumped
SEMANTICS_VERSION from 2387 to 2388. Rebased onto d3316d621e, whose development already says
2388 (1c685f0524, the hoist's number after PR 28 took 2387), the same textual change merged
without a conflict, so the containment shared the hoist's number. A cache written at the hoist
alone holds unchecked entry loads in the address form; 2389 keys the checked ones apart.

Verified: the version line diffed against d3316d621e at staging (2388 at the base, 2389 here);
the touched suites at this tip run in the CPU job named at landing.
2026-12-04 18:28:49 -08:00
Anees Iqbal cf69f7cd7a Tests: a speculated arm's constant-reference load is checked in the address form
engine_hoist_contain gains a second kernel: a short arm beside a quad_broadcast_first, which
Metal's backend speculates, reads k, a 4-byte constant reference, behind a store to out that
keeps the hoist away. canon's arm speculation runs that load in every lane of the branch's block
and marks it speculative (99bcd849f6); the test asks that on every identity profile the address
form reads k's SlotBounds and the zero range, and loads it through a selected address. At
8f8617ca5d, where speculate marked nothing, the load is at a constant offset and unchecked, so
the test is expected to fail there (not run at the base).

Evidence for 99bcd849f6 and this branch, recorded here as that commit is already reported:
- Consumer use of InstKind (the public field InstKind::Load::speculative): the consumer's
  checkout at development 985ecd39f0 and its 27 steelbrain/* tips younger than a day,
  git grep -w -F InstKind and git grep -F metal2vulkan_air::ir over *.rs: 0 code hits.
- The three guest kernels the hoist was timed on: their SPIR-V is equal at 8f8617ca5d and at
  960999d529 on all 10 committed RADV, ANV and NVIDIA profiles (job m3-max-87433, release
  command line), and equal to the hoist lane's measured tip build, so the hoist's gains on the
  RX 7900 XTX, the Iris Xe and the RTX 3090 are expected (same SPIR-V as the measured build on
  the bound-form profile). It differs only on the address-form profiles (lavapipe,
  gate-lavapipe-x86_64, moltenvk-m3), where the hoisted load is now checked.
- Golden table at 960999d529 (job m3-max-87441, every changed cell listed): 60 cells move, all
  on the five address-form profiles, none on a RADV, ANV or NVIDIA profile.
- Authored-compile census at 960999d529 (job m3-max-87432): 2390 cases, 0 differences,
  0 regressions, 0 failed, 0 table rows changed; slowest compile 1120 ms.
2026-12-04 18:28:29 -08:00
Anees Iqbal fabf409a81 Tests: the word-bound hoist case counts only device-address loads
On a profile with the bound form, flag's slot is a storage view, so the module has one
device-address load (extra's, selected), not two. Job m3-max-87420 at 99bcd849f6 failed only this
count on amd-780m-hawkpoint-radv ([1, 0] against [1, 1]); its bounds and zero-range assertions
held, as did every other engine_hoist_contain, engine_identity_contain, engine_bound_buffers and
engine_word_phases test and the api_signatures table.
2026-12-04 18:28:29 -08:00
Anees Iqbal 7a066a4b80 Canon and lowering: a load made where the program did not run it is checked in the address form
The constant-reference hoist makes a kernel's load of a constant T& at a fixed offset in its entry
block, so every thread of every dispatch reads it where the program read it only behind a
branch. Metal requires the reference's binding only where the program reads it, so an app may
leave it unbound, or bound shorter than the object, while that branch is not taken. In the
bound form the pipeline's robust buffer access contains the read (a null descriptor or a short
range reads zero), but where the slot is reached by its device address an access at a constant
offset was never checked: a short binding was read past its end by every thread, and an unbound
one past the nil buffer's 64 KiB under a larger object, a GPU fault where a mapping ends.

The mark: InstKind::Load gains `speculative`, false for every decoded load. const_hoist sets it
on each load it moves; speculate sets it on each load of an arm it flattens (a constant
reference's, at offset 0, run in every lane of the branch's block: the same window, narrower);
aggregates carries it to a split load's members. Lowering reads it: a speculative load's slots
are noted as reached at a variable offset (SlotBounds and, for a device-address read, the zero
range), and emit::prepare checks it against the slot's buffer whatever its offset, reading zero
outside, as an access at a run-time offset is. The bound form is unchanged: a bound slot drops
its bounds and its view is not checked in the shader. Covered: a device without the bound form's
queries, a slot bound below its argument's alignment on one with them, and every render stage.

const_hoist also leaves a reference whose pointer another root may share (the parameter or an
address step from it as a phi, select or insert operand, a stored value or the result): such a
pointer may meet one loaded from memory, and lowering then reaches the reference by a device
address no check bounds.

Docs: const_hoist's and speculate's module docs, canon's list, ARCHITECTURE.md, API.md sections
1 and 5, the runtime README's bounds paragraphs and push layout, PushField::SlotBounds. The
public signature table is re-blessed for InstKind::Load (no consumer use of InstKind: zero hits
in the consumer's development and its day-old steelbrain/* tips). SEMANTICS_VERSION 2388.

Tests: engine_hoist_contain (red at the base in jobs m3-max-87402 and m3-max-87403: no
SlotBounds for the hoisted load's slot on any identity profile or for a word-bound slot on a
bound-form profile, and the interpreter traps OutOfBounds at EXTRA+98304 and NIL+98304 with the
flag off); constant_hoist's loads are speculative where moved and a shared reference keeps its
loads; speculate's arm load is speculative where speculated and not where kept.
2026-12-04 18:28:29 -08:00
Anees Iqbal 59c23554a5 Red: the hoisted load's interpreter test reports every binding case
The case loop stopped at the first trap, so the red showed only the short binding. Each case now
runs and every failing one is named, so the base shows the unbound case (an object over the nil
buffer's 64 KiB) as well.

Verified at the base in job m3-max-87402 on the parent commit: the short case traps OutOfBounds
at the hoisted load.
2026-12-04 18:28:29 -08:00
Anees Iqbal 1712d580c8 Red: a hoisted constant-reference load reads outside a short or unbound binding in the address form
The constant-reference hoist makes a kernel's plain load of a constant T& at a fixed offset in its
entry block, so every thread of every dispatch reads it where the program read it only behind a
branch. Where the slot is reached by its device address, a load at a constant offset is never
checked against the slot's bounds, so a binding shorter than the object, or an unbound one (the
runtime's 64 KiB nil buffer) under an object over 64 KiB, is read past its end by every thread.

engine_hoist_contain's kernel reads extra (a 128 KiB constant reference) at byte 98304 only
under a flag from another buffer. The new tests ask that, in the address form, the hoisted load
read its slot's bounds and go through an address selected toward the zero range on every
identity profile; that a slot bound below its argument's alignment on a bound-form profile do
the same, and a bound view stay unchecked; and that on the CPU interpreter, with the flag off,
extra bound 16 bytes long or unbound reads nothing outside (no trap) and out keeps its words.

Expected red at the base: the three assertions on the check fail, and the interpreter traps
OutOfBounds at the hoisted load for the short and unbound cases.
2026-12-04 18:28:29 -08:00
Anees Iqbal d3316d621e Tests: the converter-flags engine test says it runs on one profile
PR 28's engine test compiles its fixture on nvidia-rtx50-linux alone, while its row in
public_fixture_expectations_engine.tsv holds it to ok on all 15 committed profiles. The module
doc now says which test covers what. Documentation only; no behaviour changes.
2026-12-04 18:13:53 -08:00
Anees Iqbal 1c685f0524 Cache: SEMANTICS_VERSION 2388, the hoist's own number after PR 28 took 2387
PR 28 (74e4ad9d3a, the converter's module flags, merged on GitHub by fast-forward) bumped
SEMANTICS_VERSION from 2386 to 2387. The constant-reference hoist (062b71cf63, rebased onto the
PR head) made the same textual change, 2386 to 2387, so the rebase merged the two without a
conflict and both changes shared one number. A cache written under the PR alone and one written
with the hoist must not match, so the hoist's translation takes 2388.

Verified: the rebased development differs from its pre-rebase tip (8f8617ca5d, kept as
steelbrain/dev-before-pr28) by exactly the PR's diff less its version line (6 files, +115/-3).
2026-12-04 18:13:13 -08:00
Anees Iqbal ffa4d3891d Pin AA bless: the golden hashes after the constant-reference hoist
The hoist (494bf5f743) moves a kernel's constant-reference loads into its entry block, so the SPIR-V of
the kernels it reaches changes. 11 rows of golden_hashes.tsv move, re-blessed on macOS (M3 Max, job
m3-max-87341, BLESS_JOBS=4); after the bless the job's golden, inventory, printouts, linkhalf and chains
checks report 0. Data only: no source changes.
2026-12-04 18:12:44 -08:00
Anees Iqbal 062b71cf63 Canon: a kernel's constant-reference loads are made in its entry block, ahead of its bounds branch
A kernel often reads a constant T& parameter only behind its bounds branch
(if (gid >= n) return; out[gid] = in[gid] * scale;). canon::const_hoist
moves each such load into the entry block, its value reaching its uses by
dominance, where all of these hold, each read from the body's structure and
the entry's ABI:

- a plain load (not volatile, not atomic) of an integer, a float or a vector
  of them; a pointer's or an aggregate's load stays;
- its address is a parameter the ABI binds as a constant-space buffer with a
  stated air.buffer_size and no function-constant predicate (a constant T&),
  or that parameter plus GEPs at constant, non-negative indices and bitcasts,
  which move with it; the bytes read lie inside [0, air.buffer_size). The
  address is then one address for every thread, and each form contains it at
  the entry as where it stood: the same slot, a bound storage view under its
  robust buffer access, or a device address at a constant offset, which no
  check clamps in either place. A constant T* (no size), an offset past the
  object and an offset the run computes stay;
- no instruction on any path from the function's start to the load may write
  device memory or order another thread's writes before it: a store or
  memory intrinsic whose destination is not thread or threadgroup memory, an
  atomic or atomic load of any space, a fence or barrier, a texture write,
  or any call but arithmetic, conversions, group operations, built-in reads
  and texture reads and queries. A forward reach from every writing block
  marks the blocks a write may precede; a load's own block counts up to it.

Where it lives: a new canon pass beside speculate, not inside it.
speculate.rs is a fidelity pass: it gives Metal's measured if-conversion of
group operations, keyed by Metal's budgets, and its moves change what a
program observes. This one changes nothing a program observes and its rule
is soundness alone (no write before, the access contained), so it has no
place in speculate's measured decisions; it shares rewrite::BodyEdit's moves
with it. It runs after aggregates::expand, so an aggregate load of a
reference, split into its members' loads, moves too, and before the
OpenCL hidden buffers and the program-scope bindings add parameters. Kernels
only: the measured kernels are compute kernels.

The planner's measurement (the audit seat's lab pass, which moved every load
at a constant parameter itself) on the compute benchmark's guest kernels FM
copy, FM vertical and Fluid's pressure step, GPU time of 20 dispatches, arms
alternated, output digests equal in every pair: the RTX 3090 -3.6%, -0.1%,
-9.5%; the RX 7900 XTX -7.3%, -0.7%, -12.2%; the Iris Xe +0.4%, 0.0%,
0.0%. On the Iris, ANV sinks the loads back into the branches: FM copy's
compiled code goes from 134 to 132 instructions (1026 to 912 cycles), its 8
SENDs unchanged (read from INTEL_DEBUG=cs, not from Mesa's source).

SEMANTICS_VERSION 2386 -> 2387: a kernel whose constant-reference loads move
translates to other words.

Verified: pending the green job.
2026-12-04 18:12:44 -08:00
Anees Iqbal 236541d678 Red: a kernel's constant-reference loads behind its bounds branch, made in its entry block
canon/tests/constant_hoist.rs builds the bounds-branch shape of the three
compute kernels the hoist was measured on, synthetic and ours:
kernel k(device float* out, constant uint& n, constant float& scale,
constant P& p, uint gid) { if (gid >= n) return; out[gid] = float(gid) *
scale + p.bias; }, and specializes it.

- Positive: the loads of scale (the parameter itself) and p.bias (a GEP at
  byte 4 of the 8-byte object) are made in the entry block beside n's, and
  the store stays behind the branch. Red today: both loads stay behind it.
- Refusals, each keeping its load behind the branch: a store to out before
  the loads; an AIR atomic add before them; a callee that stores to out and
  then reads scale (inlined); p.bias read at an offset the branch's block
  computes ((&p.first)[gid & 1]); scale as a constant float* (no
  air.buffer_size); p.bias read at byte 8, past p's 8 bytes. These pass
  today (nothing moves); each goes red with its guard removed.

Verified: pending the red job.
2026-12-04 18:12:44 -08:00
Anees Iqbal 53a3321828 Runtime tests: an import's pages hold the pending work's bytes after its release, and nothing later
Extends every_device_imports_host_memory_and_releases_it_after_the_free: the fill of the import's
second half is committed held for a shared event's value, and the buffer and then the block, the
consumer's last handles of the import, drop while it is pending. The release must not have run 20 ms
later; once the event's value lets the fill run, the release runs, the gauges come back, and the
pages hold what the fill wrote (the first half the host's bytes). The test then writes the pages
again as their owner, commits a later command buffer, waits for the device to go idle, and checks
the pages hold its own bytes: nothing of the runtime wrote them after the release. Before, the test
waited for the fill and read the pages while the import was still held.
2026-12-04 18:12:44 -08:00
Anees Iqbal 2ada87ed21 Runtime: a failed wait for a batch is made again, so no restore write-back runs after the make returns
A texture made in place over host memory's import (integrated or CPU devices) restores the
import's bytes with a save, a move home and a write-back in one batch of the runtime's own, and the
make waits for that batch through Done::wait. Done::wait returned any result of vkWaitSemaphores
other than VK_TIMEOUT as an Error::Vulkan. Where that result was VK_ERROR_OUT_OF_HOST_MEMORY,
VK_ERROR_OUT_OF_DEVICE_MEMORY or VK_ERROR_UNKNOWN on a live device, the make returned Err while the
batch, and with it the write-back of the saved bytes, was still pending: the import's pages were
written after the caller saw the make fail, and may have released or reused them.

Vulkan's words: vkWaitSemaphores lists those results as failures and says nothing of the wait's
condition with them (only that with a loss the call "must return in finite time with either
VK_SUCCESS or VK_ERROR_DEVICE_LOST"); a failed call leaves every submitted batch pending, executing
as the queue runs it, whatever the host's wait returned. Only a loss ends what is pending: "for the
purpose of determining whether a command buffer is in the pending state ... a return value of
VK_ERROR_DEVICE_LOST is equivalent to VK_SUCCESS" (Lost Device).

So Done::wait now makes such a call again through complete::wait_through, as the device's idle wait
and an import's bind wait already do, until it succeeds or the device is lost, and returns Err only
at a loss, as its doc already said. Every caller of Done::wait gets that: the restoring make's
drain and batch waits, the upload room and staging span waits, a surface making's wait, and a
texture read's staging wait (whose span went back while its copy could still write it). A lasting
failure on a live device waits as long as it lasts. The README's restore paragraph says the make's
wait returns only once the batch completed or the device is lost.

The tests' stand-in for a failed wait (Core::fail_waits, inside wait_through) now reaches
Done::wait. New device test failed_waits::a_failed_restore_wait_is_made_again: with a Busy gate
holding the device's queue, a make in place whose batch wait fails at its first call must not
return while the gate holds the batch, then returns the texture in place once it opens, counted as
one restoring make with its two restore copies, and the pages hold the host's bytes.
2026-12-04 18:12:44 -08:00
Anees Iqbal 5e9855565a Validation: runtime-sources re-pinned after the swizzled_storage removal
crates/metal2vulkan/src/device/mechanism.rs moved in fddfdd2ce1, so the
runtime-sources fingerprint moves with it. The validation suite at the
lane's tip (job m3-max-87020) failed only this guard and printed the new
hash; pin-compute over development's tree gives the same value.
2026-12-04 18:12:44 -08:00
Anees Iqbal 1aa297d251 Docs: stale resident-table and ResourcePresence history says what is true now
- crates/metal2vulkan-runtime/src/error.rs: both RuntimeFact causes
  (the draw's and the kernel's) gave "ResourcePresence" as an example
  fact name; that fact no longer exists. The example is now "FlatGrid"
  (RuntimeFact::name of RuntimeFact::FlatGrid, which neither the
  kernel's nor the draw's fact match in the runtime names). The
  kernel's cause also named "a resource's presence or a sampler's
  coordinates" as facts the runtime does not name; neither is a
  RuntimeFact now, so the examples go.
- crates/metal2vulkan/src/tests/engine_extended_range/levels.rs: the
  module doc and the 3D test's doc told of development's resident-table
  tests and "the one form, as development's default policy did". They
  now say what holds: the conformance probe extended_linear_mip_blends
  measures Metal's mip filters, and the identity domains refuse such a
  sample with its texture argument.
- crates/metal2vulkan-validation/src/executor_contract/out_of_bounds/
  tests.rs: the identity-domains containment test's doc ended with a
  sentence on the resident table and the handle table, which the test
  no longer runs; it goes.

Searches: git grep -n 'ResourcePresence\|resident-table' over crates and
docs -> 0 hits after (3 before, all these sites).
refusal_surface.py --check passes.

Correction to 6d3a51f4fe's body: open_cl_1d_images at f6fc9cf282 is
8 hits in crates/metal2vulkan-air and 3 in crates/metal2vulkan, not 7
and 4. The total, 11, was right.
2026-12-04 18:12:44 -08:00
Anees Iqbal 050fb088af AIR: Entry.open_cl_1d_images goes; nothing reads it
Entry.open_cl_1d_images held the texture indices of an OpenCL-mode
kernel's 1D images. No caller in this tree read it: metal2vulkan's two
readers were test literals setting it to the default, and
pipeline::compile's bound_entry dropped canon::opencl::entry's set
(`let (ep, _) = ...`). Deleted:
- the field, and its binding in canon::specialize;
- the set canon::opencl::entry built, along with the AbiInt match that
  filled it; entry now returns the EntryPoint alone, and its retyping
  of each 1D image to the 2D texture Apple's OpenCL binds is unchanged;
- the BTreeSet imports of opencl.rs and tests/opencl.rs;
- the two test literals.
opencl_1d_images_take_their_2d_textures_types now checks, in place of
the set, that without the mode each image keeps its own 1D type: the
names bound_texture leaves at indices 1 to 3.

Searches:
- this tree at f6fc9cf282: git grep -n open_cl_1d_images -> 11 hits
  (crates/metal2vulkan-air 7, crates/metal2vulkan 4 with the signatures
  table); 0 after.
- reims-vgpu c16328ee3d (and cc1f47b30b): git grep -n open_cl_1d_images
  -> 0 hits.

The signatures table is blessed: exactly one record removed
(metal2vulkan-air::Entry.open_cl_1d_images).

Correction to 141dabb1e8's body: its swizzled_storage count at
f6fc9cf282 is 33 hits, not 32 (crates/metal2vulkan/src/cache/mod.rs has
5, not 4).
2026-12-04 18:12:43 -08:00
Anees Iqbal a49e4a61c4 Translator: the swizzled_storage variant goes; the runtime never asks for it
LoweringInputs::swizzled_storage and VariantKey::swizzled_storage have
no setter outside the translator's own tests. Since the identity domains
refuse any slot whose SlotPlan::swizzle is set
(IdentityCause::TextureState), a slot of the variant could only lead to
a refusal or to nothing. Nothing else reads the swizzle any more: the
emit side went in 6a08124f54.

Deleted with it:
- the cache key's "swizzled-storage" block;
- lower::texture::swizzled_storage and ::swizzles;
- SlotPlan::swizzle (identity_lowered now tests offset_base alone);
- the NotImplemented(TextureSwizzle) refusals of the variant's ulong,
  short-lane and imageblock-slice accesses (Feature::TextureSwizzle
  stays: bind/heap.rs refuses with it);
- the bicubic and packed-normalized sampling arms that read the
  variant, and the read path's storage_swizzle alpha term;
- the public RuntimeFact::TextureSwizzle, which only swizzles()
  produced, with its codec entry, mechanism, identity_unsourced arm and
  name. The mechanism test's variant index 35 now holds PrivateList and
  the covered range is 0..55.
Tests: tests/engine_swizzled_storage.rs goes (its reference rules
checked only its own helpers once the emit side was gone), and
engine_extended_range/bicubic.rs loses its swizzled cases. Docs fixed:
LoweringInputs, VariantKey, the sampler select and extended module
docs, IdentityCause::TextureState's examples, and the runtime README's
identity refusal list (TextureSwizzle no longer named).

No compile with empty inputs changes: every deleted arm was gated on
the set. The RuntimeFact encoding loses a variant; the
ARTIFACT_FORMAT_VERSION bump to 616 in 9cc7dd223a on this branch covers
it.

Searches:
- this tree at f6fc9cf282: git grep -n swizzled_storage in
  crates/metal2vulkan{,-runtime,-air,-validation,-harness,-devtools}
  and docs, fixture names (rrp_swizzled_storage) and the conformance
  case module aside -> 32 hits, all in crates/metal2vulkan; 0 after
  (crates/metal2vulkan-runtime: 0 before).
- reims-vgpu c16328ee3d (and cc1f47b30b): git grep -n swizzled_storage
  -> 0 hits; git grep -n RuntimeFact -> 0 hits.

The signatures table is blessed: exactly 3 records removed
(VariantKey.swizzled_storage, LoweringInputs.swizzled_storage,
RuntimeFact::TextureSwizzle). refusal_surface.py --check passes, so
docs/REFUSALS.md does not change.
2026-12-04 18:12:43 -08:00
Anees Iqbal ab351430d3 Translator: SpecConstant.unread_bits and the spec_bits analysis go; nothing reads them
StageSpec.unread_bits and the public SpecConstant.unread_bits were set
and never read. spirv::spec_bits::mark_unread computed them on every
compiled module, and link::specialize intersected them per key. Nothing
read the result: not the runtime (crates/metal2vulkan-runtime has no
hit), not the validation or conformance crates, and not the consumer.

Deleted:
- both fields, with their codec entries (cache/codec.rs);
- link::specialize's unread map and its doc sentence;
- compile.rs's mark_unread call;
- spirv/spec_bits.rs (the demanded-bits pass, 299 lines);
- its test module tests/engine_spec_bits.rs (149 lines);
- api_tests.rs's literal field.
engine_skeleton's expected StageSpecs are now plain StageSpec::new.
The SPIR-V a compile emits does not change: the pass only wrote the
interface fields.

ARTIFACT_FORMAT_VERSION goes from 615 to 616: StageInterface and
SpecializationLayout lose a field from their encoding.

Searches:
- this tree at f6fc9cf282: git grep -n unread_bits -> 13 hits, all in
  crates/metal2vulkan (the fields, codec, link, spec_bits, three tests,
  the signatures table); 0 after.
- reims-vgpu c16328ee3d (and cc1f47b30b): git grep -n unread_bits -> 0
  hits.
- reims-vgpu c16328ee3d: git grep -n spec_bits -> 3 hits, all in
  crates/reims-vgpu-c/link-order.txt (a link order list of symbol
  names; its doc says a function removed since is skipped and costs
  only the order's speed).

The signatures table is blessed: exactly one record removed
(SpecConstant.unread_bits). The proof jobs at the branch tip carry the
suites and clippy.
2026-12-04 18:12:43 -08:00
Anees Iqbal 53e2f370d8 CI: qualify the committed object and mesh cases on lavapipe
The engine's candidate now draws object and mesh cases through the
runtime's mesh pipeline, so the Linux qualification step runs the 13
committed mesh and object cases that draw on lavapipe against their
Metal rows. Two committed cases stay out: the object function's
threadgroup memory (3ff818075803), which the runtime refuses at the
state's make and the candidate meets as mesh_threadgroup_memory, and
the mesh function that numbers its primitive from its payload
(d2c517d1426d), whose mesh function aborts lavapipe's LLVM ("Cannot
emit physreg copy instruction").

Verified: the 13 cases matched Metal on lavapipe through corpus-vulkan
at c1bdd1e491 (job m3-max-86906); this commit's script run follows.
2026-12-04 18:12:43 -08:00
Anees Iqbal 27c7d07d06 Validation tests: the mesh threadgroup test's store takes its root by value
Clippy's needless_borrows_for_generic_args under --cfg m2v_gpu and --cfg m2v_cpu_icd (job
m3-max-86887).
2026-12-04 18:12:43 -08:00
Anees Iqbal 6f963fa297 Validation: an object case's threadgroup memory is the source's requirement alone
The previous commit also raised mesh_threadgroup_memory from a case's authored threadgroup_memory
(executor_contract::case_requirements). The mesh case's mapping refuses the case's literal
families (require_case_families), so the authored compile census's preparation, which sets the
requirement aside to compile the case, was refused too (the lavapipe validation suite, job
m3-max-86881: the_census_compiles_the_mesh_pipelines, engine_case_families_follow_the_case_literals
and the engine_mesh threadgroup test failed). The function's reflection alone raises it
(mesh_threadgroup_memory_requirement), as it raised the requirement this one narrows.
2026-12-04 18:12:43 -08:00
Anees Iqbal 7cb4195db7 Validation: the engine's candidate draws object and mesh cases through the runtime
The runtime makes and draws mesh render pipeline states (Device::new_mesh_render_pipeline_state,
the render encoder's set_object_*, set_mesh_* and draw_mesh_* calls), so the engine's candidate
now draws an object or mesh case as the Metal oracle draws it, instead of refusing every one as
mesh_render_pipeline. candidate::platform::runtime_mesh makes one mesh render pipeline state of
the oracle's descriptor (MeshTemplate::descriptor: the case's own function and the partners its
draw names from the row's library, the generated stages of an observation or object launch from
the companion's, its color formats or the 1x1 R8Unorm sink without rasterization), makes and
binds the own stage's buffers, argument-buffer members, textures and samplers through that
stage's setters (runtime_render's Stages, which now binds a stage of either pipeline kind and
selects a stage's output for both), makes each color target a Shared 2D texture of one sample
written from the case's bytes (Targets::of_colors), draws once (draw_mesh_threadgroups or
draw_mesh_threads), and reads the output back. A threadgroup within Metal's maximum and past the
state's on the device (Limit::MeshThreadgroupThreads) records not_enabled, as a sample count the
device makes no texture of does.

One vocabulary: mesh_render_pipeline is retired, and the one shape the runtime refuses keeps a
requirement of its own, mesh_threadgroup_memory (Limit::Runtime): an object or mesh function that
declares a [[threadgroup(n)]] argument (its reflected threadgroup buffer), and a case that authors
an object function's threadgroup_memory. Its doc names the runtime's refusal it mirrors, in the
runtime README's words: "An object or mesh function with a [[threadgroup(n)]] argument is refused
at the creation (Gap::RenderPipeline), as setObjectThreadgroupMemoryLength:atIndex: and its mesh
form are not built". The authored compile census still prepares such a case to compile it
(prepare_compile), so no compile cell changes. Classification, the case checker, the executor,
the triage, census, executor-contract, requirement and compile-census tests, the validation
README, docs/VALIDATION.md and the runtime README's sentence about validation's mesh cases follow.

Versions: the structural-triage analyzer v87 (rows' requirements change). ENGINE_EXECUTOR_ABI is
not bumped: no recorded row observes the change, as the executor refused every object and mesh
case before any device and stored no row of one. SEMANTICS_VERSION is untouched: translation
output does not change. The authored compile census version is untouched: no cell changes.

Venue: lavapipe lists VK_EXT_mesh_shader with taskShader, meshShader and multiDrawIndirect, the
runtime's mesh set, so lavapipe draws mesh pipelines and is the device test's venue.
2026-12-04 18:12:43 -08:00
Anees Iqbal 97a5f5732a Validation tests: the owned object and mesh fixtures drawn by the engine's candidate
A device test (candidate::tests::engine_mesh, under m2v_cpu_icd and m2v_gpu on Linux) admits each
owned object and mesh fixture of mesh_cases for the engine's candidate, prepares it and runs it as
a run of the candidate does (run_prepared, now pub(crate)), and holds the output to the words
Metal drew for it: a mesh grid through its fragment partner, an object case through its mesh and
fragment partners, a mesh function's device write without rasterization, a mesh grid through the
generated observer, an object case's launch through the generated mesh function, and the payload
a generated object function writes (payload_order on a GPU only, as its fixture states). The
fixtures now compile for the Linux device tests too.

At this commit the test fails: the candidate refuses every object and mesh case before it maps
(mesh_render_pipeline). The next commit makes the candidate draw them through the runtime.
Verified: the red run is named in the lane's report.
2026-12-04 18:12:43 -08:00
Anees Iqbal 37ab640c30 Docs and a test: a required constant left without a value is undefined, and the imageblock case is refused
Metal makes a function and its pipeline state from a specialization that leaves a required
function constant without a value, and runs it (the probe undefined_function_constant_values.m,
cases set0 and ib/*, the Apple M3 Max under macOS 27.0.1, job m3-max-86943), though Apple's
MTLFunctionConstant.required page says such a constant needs a value. What a program computes
from it is undefined, and the translation does not emulate Metal's answers, which follow no one
rule (the probe's kib, kib2 and derived reads against its gate kernel kg).

docs/API.md's "Function constants" says so, and names the case seen: a kernel whose explicit
imageblock argument is gated on a bool derived from the constant, and whose body still reaches the
imageblock on the way taken, is refused Unsupported{Imageblocks} with ImageblockCause::Missing.
The runtime README's known gaps of pipeline states records the same refusal of a state
(Error::Translation): the runtime compiles the consumer's specialized FunctionDescriptor as given
and does not consult FunctionDescriptor::needs_specialization, so a guest's specialization that
leaves the constant out reaches it.

engine_undefined_imageblock_gate pins today's answers for the probe's kib shape (its slice write
left out), on every profile that takes threadgroup memory: without a value for the constant,
Unsupported{Imageblocks} with ImageblockCause::Missing; with 0 or 0xffffffff, the kernel compiles.

Behaviour is unchanged, so no SEMANTICS_VERSION bump.
2026-12-04 18:12:42 -08:00
Anees Iqbal d650736ff7 Probe undefined_function_constant_values: required constants left out, and an imageblock gated on one
Apple's MTLFunctionConstant.required page says a required constant needs a value to specialize
the function. The probe now answers what Metal does when a specialization leaves one out, and
what it does with a kernel whose explicit imageblock argument is gated on a bool derived from one.

- A function Metal does not make prints the error's domain and code with its text.
- Cases ib/<kernel>/<how>: kib and kib2 gate an explicit imageblock on a bool derived from a
  required uint constant (index 40), kib branching on the bool and kib2 on its negation; each is
  made with no value, with 0 and with 0xffffffff, dispatched once, and its imageblock length,
  buffer words and two texels printed. Case ib-source prints their library's source for xcrun
  metal.

WHAT IT MEASURED, in the header: on the Apple M3 Max under macOS 27.0.1 (build 26A434), job
m3-max-86943, set0 (six required constants left out) makes the function and the state and
completes; kib with no value runs its buffer way with no imageblock (length 0), kib2 with no
value runs its imageblock way (length 1024) and its slice writes the expected texels. No case
errors, so no domain or code was printed.
2026-12-04 18:12:42 -08:00
Anees Iqbal 5787ca04d1 Validation: runtime-sources re-pinned after the translator's dead-code removal
bind/heap.rs, bind/state.rs and metal/format/mod.rs changed in the deadcode landing
(aa623881f4, 6a08124f54 replayed); pin-compute.py over the 50 listed modules (69 inputs) at this
tree gives d545bf4f7314, as the lane's validation job m3-max-86923 reported at its tip.
2026-12-04 18:12:42 -08:00
Anees Iqbal 8df73ca6dd Translator: pipeline::compile calls opencl::entry and specialized without the lines set
20030f2954 removed the open_cl_lines set from canon::opencl::entry and
from StageEntries::specialized's key, but three callers in
pipeline/compile.rs still passed it: bound_entry passed an empty set to
opencl::entry, and the render-stage and fragment lookups passed
(false, &BTreeSet::new()) where specialized now takes the bool alone.
They now pass `first` alone and `false`. bound_entry's comment loses
"whatever a variant binds": no variant binds a 1D image as a line now.

Verified: clippy job m3-max-86910 at e9ed4d85e4 reported exactly these
three errors (E0061 at compile.rs:704, E0308 at 1385 and 1624); the
rerun at this commit is the next clippy job.
2026-12-04 18:12:42 -08:00
Anees Iqbal 495b52603c AIR: canon::opencl_1d drops the Idx import of_params read
of_params, deleted one commit back with the open_cl_lines variant, was the import's only user
(a.index()); clippy's unused-imports failed metal2vulkan-air at 20030f2954 (job m3-max-86909).

That commit's body names 37 hits for git grep -n open_cl_lines -- crates docs at 9db78abe7d;
the count is 53 (the same files), 0 after.
2026-12-04 18:12:42 -08:00
Anees Iqbal a7166b2ded Translator: the open_cl_lines variant goes; the runtime never asks for it
LoweringInputs::open_cl_lines, VariantKey::open_cl_lines and metal2vulkan-air's
SpecRequest::open_cl_lines named the 1D images of a kernel of OpenCL mode that a 1D texture is
bound for, which then kept their 1D type and operations. metal2vulkan-runtime never asks for
that variant: it refuses a 1D texture bound for such a kernel (Gap::OpenClLineTexture, the
encoder's check of interface.open_cl_mode), since no reading of one is documented Metal, and
nothing else in the tree sets the field.

Consumer search: reims-vgpu cc1f47b30b (its development, read only): git grep -n open_cl_lines
-> 0 hits (its only OpenCL hits are its own open_cl_mode fields and the
RGFX_COMPUTE_PIPELINE_OPENCL_MODE flag). Its generated link-order.txt names
VariantKey::lowering_inputs' closures, not the field.

Deleted:
- metal2vulkan-air: SpecRequest::open_cl_lines; canon::opencl::entry's lines argument (every 1D
  image of the kernel now takes its 2D texture's type); canon::opencl_1d's kept parameters
  (site, of_params, kept_params), so expand rewrites every 1D operation it lists; the doc lines
  that named the variant. Entry::open_cl_1d_images stays: its doc drops the variant.
- metal2vulkan: LoweringInputs::open_cl_lines, VariantKey::open_cl_lines (is_empty and
  lowering_inputs), the function key's "open-cl-lines" part (appended only when set, so every
  surviving key hashes the same bytes), and compile.rs's plumbing: InputsFrom::open_cl_lines,
  StageEntry::open_cl_lines, the lines half of the stage entries' (mode, lines) match,
  given_inputs' clearing and the request's lines.
- Tests: the variant's half of the AIR test (renamed
  opencl_1d_images_take_their_2d_textures_types, which keeps its OpenCL-mode type names and
  open_cl_1d_images assertions), the api round-trip values, and the field in every
  SpecRequest and LoweringInputs literal (air canon tests, memory plan tests, air_canon,
  validation's check.rs).
- docs/API.md's OpenCL image paragraph named the variant; it now says each Mac's reading of a
  1D texture there, which the kernel does not take.

Public surface: python3 scripts/api-signatures/signatures.py --bless removes exactly the three
field records (metal2vulkan-air::SpecRequest.open_cl_lines,
metal2vulkan::cache::VariantKey.open_cl_lines, metal2vulkan::pipeline::LoweringInputs.open_cl_lines),
a breaking change of the two published crates. refusal_surface.py reads no such field:
--check passes unchanged, docs/REFUSALS.md does not move.

Output: none moves for any input the runtime makes. A kernel compiled with an empty set, the
only one anything sent, specializes and keys as before; SEMANTICS_VERSION stays (as at
a7dd2e846e for the binder's inputs). The per-parameter meter ticks of kept_params go with it.

Search at 9db78abe7d: git grep -n open_cl_lines -- crates docs: 37 hits across compile.rs,
cache/mod.rs, lower_inputs.rs, key.rs, the AIR canon and the tests; 0 after.
2026-12-04 18:12:42 -08:00
Anees Iqbal 2a9bad3c81 Translator: the swizzle and offset-base emit side goes; no slot carrying either is ever emitted
texture::Declared::swizzle and Declared::offset_base, the TextureSwizzle word and the
OffsetBaseAxes tests of a slot, were never inserted: their specializations are gone. Every
emit-side lookup of them therefore failed, and none was reached: a function that reads a slot's
bound swizzle (SlotPlan::swizzle, set with RuntimeFact::TextureSwizzle by texture::swizzles) or
places an offset by a view parent's base-level size (SlotPlan::offset_base) is refused at the
end of select by identity_admits (SlotPlan::identity_lowered, IdentityCause::TextureState),
which runs on every plan before any emit, and select builds the only Plan. Every flag the emit
side read (Sampling::swizzle and offset_base, extended::Sample's, routine::Extended's,
texture::Read::storage_swizzle, texture::Write::swizzle) was true only in such a function.

Deleted:
- texture: Declared::swizzle and offset_base, OffsetBase, Read::storage_swizzle,
  Write::swizzle; emit's swizzled read and unswizzled write arms and their helpers
  (swizzle_lanes, swizzled_texel, unswizzled, swizzled_float, swizzled_held, swizzled_gather,
  held_lane, sampled_lane).
- sampler: Sampling::swizzle and offset_base, with shared_shape's test of them and their
  estimated words (SWIZZLE_WORDS); emit::swizzled_value, texel_and_word and offset_base;
  extended::Sample::swizzle and offset_base, Texture::swizzle and parent, swizzled(), and their
  words; routine::Extended::swizzle and offset_base; bicubic::At::parent and the parent
  argument of footprint_of_image, axis and placed_offset; position::offset_dropped's parent
  argument and PARENT_RULE_WORDS.
- bind::state: TextureFacts::offset_base_axes, parent_relative_level and parent_base_size, and
  TextureShape::Texture::offset_base_axes, which only those read (bind::state is
  crate-private).
- position/tests.rs: the parent-bit test the_offset_rule_reads_the_parent_s_base_through_the_view_bit;
  the rule kernel keeps its two parentless forms, which its other tests read.

Kept: the selection side. A read, write or sample of a swizzled_storage slot still calls
texture::swizzles (the TextureSwizzle fact and SlotPlan::swizzle), and a wrapped offset still
sets SlotPlan::offset_base or, on a heap element, notes ViewBaseTexelOffset, so every refusal is
the one it was; the NotImplemented(TextureSwizzle) refusals are untouched.

Docs that named the deleted specializations now say what is true: RuntimeFact::TextureSwizzle,
LoweringInputs::swizzled_storage, VariantKey::swizzled_storage (the runtime asks for none:
git grep swizzled_storage -- crates/metal2vulkan-runtime has 0 hits), SlotPlan's two flags,
texture::swizzles and swizzled_storage, position's module doc, extended's module doc and
engine_swizzled_storage's.

Output: none moves. Every deleted branch ran only where its flag was true, in a plan the
identity domains refuse; offset_dropped with no parent emits the same instructions as before
(the (base, None) arm without the disjunction, the (None, None) arm as was). The estimated
words that leave counted only refused functions, so no census moves.

Search at 9db78abe7d: git grep -n 'offset_base\b\|OffsetBase\b' -- crates: 45 hits, now the two
SlotPlan flag writes, its field and identity_lowered's read, and the docs; git grep -n
'swizzle.insert\|offset_base.insert' -- crates: 0 (never inserted); git grep -n
'OffsetBaseAxes\|SpecKey::TextureSwizzle' -- crates docs: 0 after.

The runtime-sources inputs move: crates/metal2vulkan/src/bind/state.rs (bind/).
2026-12-04 18:12:42 -08:00
Anees Iqbal b770cc4af7 Translator tests: engine_texture.rs drops the FamilyStrategy import the nil-arm census read
The nil-arm test (removed one commit back) was its only user (s.words()); clippy's
unused-imports failed the lib test build at 4d40d42166 (job m3-max-86868).
2026-12-04 18:12:42 -08:00
Anees Iqbal 004794d5e2 Translator: the nil-arm census analysis goes; the presence constant it read is gone
lower/texture/absent.rs walked the body for the blocks the default ResourcePresence
specialization never runs and counted their words under the census key
texture.is_null.absent_arm, for an output-size gate to except them. That constant is gone: a
static slot's is_null reads its resource ID's element (emit::identity_id), a run-time value no
driver folds at pipeline creation, so the walk's premise is false and its key named words the
module runs like any other.

Deleted: absent.rs (absent_arm, ABSENT_ARM), TexturePlan::absent_arm, its call at the end of
select, Plan::census's arm split, StrategyCensus's doc of the key, the texture module doc's
nil-arm paragraph, and engine_texture.rs's nil-arm kernels and their test
a_nil_textures_arm_is_counted_apart, with queries_and_null_checks's assertion that its kernel
keeps no arm. texture::declare's doc named presence constants it no longer declares. The
output-size exceptions file the test named (validation/budgets/output-size-exceptions.json)
does not exist; validation's budgets read no census key.

What moves: the strategy census alone. An instruction of a nil texture's arm now counts its
words under its own strategy, as every other instruction does, and no texture.is_null.absent_arm
entry is made. Module words, refusals, requirements, interfaces and notes do not move (the walk
fed the census alone), so SEMANTICS_VERSION stays: its doc lists what a bump covers and the
census, reporting only, is not in it. The walk's meter charge goes with it.

Search at 9db78abe7d: git grep -n 'absent_arm\|ABSENT_ARM' -- crates: absent.rs, texture/mod.rs,
select.rs, artifact.rs's doc and engine_texture.rs; nothing outside the translator (no
validation, runtime, script or doc reader).
2026-12-04 18:12:42 -08:00
Anees Iqbal 7a94ef0733 Translator: a heap's storage conversions go; the converted arm read a handle no lowering reads
bind::heap::member_storage_format admitted a storage heap member viewed through a converting
alias (SwizzleBgra, SrgbEncode, SrgbEncodeBgra) where bind::heap::storage_conversions listed its
texel class and red-blue order, for the texture lowering to convert by the handle's class
(lower::texture::heap_storage_conversions). That lowering is gone: a heap element's storage
class is Identity (lower::texture::storage_class), and an argument buffer's texture is the
element its resource ID's index names in its class's array. So the arm and its list go:

- member_storage_format refuses every aliased member, as it refused an aliased one the list
  did not name. Its only caller is tier_read_gaps, over Metal's read-write tier formats
  (device::metal::READ_WRITE_TIER1/2_FORMATS), none of them sRGB or blue-first, so none takes a
  converting class (metal::format::storage_choice gives SwizzleBgra to BGRA8Unorm and
  BGR10A2Unorm and the SrgbEncode classes to the sRGB formats alone): the arm never held for
  any input that reaches it, and tier_read_gaps answers the same on every profile.
- StorageConversion, storage_conversions and its test a_heap_converts_by_class_and_red_blue_order.
- metal::format::red_blue_exchanged, read only by them, and its test
  a_red_blue_exchange_is_a_blue_first_format_s.
- pipeline::artifact::PrecisionNote::SrgbTexelDecode's doc named the deleted lowering: it now
  says a slot's SrgbEncode read decodes, and an argument buffer's texture converts nothing.

Search at 9db78abe7d: git grep -n 'storage_conversions\|StorageConversion\|red_blue_exchanged'
-- crates docs: the definitions, member_storage_format, the two tests and three doc mentions;
git grep -n heap_storage_conversions: the two docs alone, no definition.

The runtime-sources inputs move: crates/metal2vulkan/src/bind/heap.rs and
crates/metal2vulkan/src/metal/format/mod.rs are in crates/metal2vulkan-validation/build.rs's
list. No output changes: no lowering read the list.
2026-12-04 18:12:41 -08:00
Anees Iqbal 4e5d9ff609 Translator: SlotPlan::presence and ConstexprArray::words go, set and never read
- lower::texture::SlotPlan::presence: select set it for a slot's is_null; nothing read it. A
  slot's presence is its resource ID's (emit::identity_id), which the IsNull strategy reads
  without the plan's flag.
- lower::sampler::ConstexprArray::words, each candidate's sampler word, and
  constexpr::sampler_word, its only writer. Nothing read the words: a constexpr sampler array is
  matched by its first handle and its candidates' state words, and each candidate's index is
  pushed (PushField::ConstexprSampler). sampler_word could fail only where state_of fails on
  undecodable words, which finish's constexpr_desc still runs for every candidate, so no input
  changes outcome; descriptor's filters never fail (min_mag answers every filter).

Search, at 9db78abe7d: git grep -n '\.presence\b\|presence:' -- crates/metal2vulkan/src: the
field, its initializer and the one write; git grep -n 'sampler_word(' -- crates: select.rs:642
alone for constexpr::sampler_word (the others are emit::sampler_word, a separate function); no
reader of ConstexprArray.words (git grep -n '\.words\b' over lower/sampler). Behaviour: none;
translation output unchanged (golden tables untouched).
2026-12-04 18:12:41 -08:00
Anees Iqbal 8ec9d3858b Translator tests: the profile docs say Device::from_queries, not the resident-table domains
Six test docs still named the resident-table domains, which are gone: every committed profile
is now derived by Device::from_queries alone (pipeline::testing::profile,
spirv::testing::committed_profiles). Each says that now:

- engine_rate_map.rs profile_with, engine_rotated_colors.rs devices, fuzz_interp.rs
  CpuInterp::new, public_fixtures_engine.rs (module doc), api_surface.rs device: the profile
  as Device::from_queries derives it.
- engine_workgroup_layout.rs (module doc): its two profile sets are both from_queries', the
  committed description as stated and without its pipeline-robustness feature
  (identity_profiles), not the resident-table and the identity domains.
- api_surface.rs device_under named a policy parameter it does not take.

Comments only; no code moves. Search: git grep -n 'resident-table domains' -- crates at
9db78abe7d: 6 hits, 0 after.
2026-12-04 18:12:41 -08:00
Anees Iqbal 47fec71d2a Validation player: command-replay refuses an option given twice, and section 10 lists every option
options() now refuses an option a command line gives twice, "--NAME is
given twice", before anything runs: exit status 2 and the usage
printed, as for an option the subcommand does not take. Before, the
second value replaced the first in the map with nothing said, so a
script that spliced options after its own (`--until-frame X
${PLAY_ARGS}`) played the splice's value unnoticed. The module doc and
with_options' doc say so.

docs/REPLAY-STREAM.md section 10 named the options each subcommand
takes only in part, though it said each takes "the options its usage
names". Its play synopsis now lists all twenty, adding --state-log,
--state-threads, --state-keys, --state-digests, --prepass-width and
--dump-command-buffers with --dump-dir. A paragraph after the
states-only one now says what the state options and --prepass-width do,
from the module doc. dump and shapes show [--blobs DIR]. The rule now
reads: each option once, none it does not take.

Callers audited at development 039f7a9350 for an option given twice
(the 9db78abe7d audit of unknown options covered the same callers): the
orchestration's round script and its leg scripts, every orchestration
job script that runs the player, the scripts of every carry repository
at its HEAD (104 invocations in all), the consumer's tree (no caller),
CI, CONTRIBUTING.md and the docs (none runs the player), and the
in-tree tests. No invocation names an option twice. Where options are
spliced from the environment, the values on record don't repeat an
option either: PLAY_ARGS (--check-presents), PLAYARGS (empty or
--managed two-copy) and UNTIL (becomes --until-frame, in scripts that
do not pass --until-frame themselves). Three splices have no recorded
value and stay unaudited: FS_PLAY_ARGS, EXTRA and PARGS.

Verified: the red commit's every_subcommand_refuses_an_option_given_twice
fails at its parent (lavapipe-free run, job m3-max-86867: 1 passed, 1
failed). The jobs for this commit are named in the lane's report.
2026-12-04 18:12:41 -08:00
Anees Iqbal 824f34b68e Validation tests: command-replay refuses an option given twice, and compare-dumps an option it does not take (red)
command-replay's options() refuses an option a subcommand does not take
(62e9d045c3), but an option given twice still goes into its map in
silence, the last value winning: `play ... --until-frame 3 --until-frame
5` plays to frame 5. A script that splices options from its environment
after its own (`--until-frame X ${PLAY_ARGS}`) would play the splice's
value with nothing to say so. A repeated option should be a bad command
line instead.

replay_options::every_subcommand_refuses_an_option_given_twice runs each
of the six subcommands with one option given twice, required or not
(play --until-frame, dump --stream, shapes --blobs, snippet
video-surfaces --handle, compare-dumps --a, compare-plays --frame), and
expects exit status 2, a standard error line "--X is given twice", no
play report and no snippet written. Red here: dump, shapes and the
snippet run to exit 0, and play writes its report.

every_subcommand_refuses_an_option_it_does_not_take now runs
compare-dumps too (--frame), the one subcommand it left out. It passes
here, as the refusal is in place; its red is a negative control, the
fix's commit names it. The two tests share their setup and their checks.
2026-12-04 18:12:41 -08:00
Anees Iqbal a6de987639 Runtime: the narrowed attachment-read counter and its per-draw rectangle go; the narrower form is not taken
The UHD 630 numbers answer the question attachment_read_copy_bytes_after_barrier_narrowed was
added to size (9db78abe7d): a form whose memory barrier forgets only the rectangle bounding the
pass's draws' scissors would remove at least half the attachment-read copy bytes, or it is not a
lane. On Intel's Windows driver 101.2145 for the UHD Graphics 630 (Windows 11, the consumer's
x86-64 guest, no feedback loop), whole-boot counts at a test tree with the split:
- desktop boot (130 s, 15,678 copies, 72,587,189,668 bytes): after barrier 56,148,113,276,
  narrowed 25,369,581,904, so the form would remove 30,778,531,372 bytes, 42.4%;
- 40 s 1080p H.264 playback (25,551 copies, 138,558,378,988 bytes): after barrier
  75,057,769,016, narrowed 39,566,419,316, so it would remove 35,491,349,700 bytes, 25.6%.
Both under the planner's 50% bar, so the form is not built and the count that sized it is
deleted (rule 4), with what fed it: shadow::Held's dropped areas, rendered rectangle and
may-write flag, Held::drew and Held::narrowed, held_texels, Area::meet, the per-draw update in
draw() and the scissor_of helper it shared with drawn_through (inlined back as before). Held keeps
one flag for the moment counters. The other five split counters (own pixel, whole texture, first
in pass, after barrier, beyond held) stay: the consumer prints them.

The README's sentence on the counter becomes the measured shares (card, driver, OS; no job ids).
The signatures table loses the field. The device test and the host test drop the narrowed column;
the host test of the narrowed texels goes with the code it tested.

Verified: pending (clippy x3, rustdoc, lavapipe rt suite).
2026-12-04 18:12:41 -08:00
Anees Iqbal acb5680cca Runtime README: KosmicKrisp's indirect patch draws, the one-instance overrun the driver's source shows and why the runtime keeps one form
Lane kktess read the driver's source (Mesa 26.3.1, kk_cmd_draw.c kk_launch_tess, kk_tessellation.cl):
for an indirect tessellated draw the vertex and control-point grids are computed as thread counts and
dispatched as threadgroup counts. The control-point work past the last instance's patches writes into
the same allocation as the draw's vertex outputs, so a one-instance indirect patch draw carries the
overrun too; the bare repro's one-instance draws were right 8 of 8, so this is a source read, not a run.

The forms weighed (instance count folded into the vertex count, one indirect command per instance,
a direct draw, device-generated commands) each either write a new indirect command from the guest's
arguments, which Vulkan allows only outside a render pass (VUID-vkCmdDispatch-None-10672 and the
copy, update and fill VUIDs), so every indirect patch draw on every device would copy the arguments
and end and restart its pass, or read the counts back, or need a query-chosen form past the floor.
The known gap stays; the lane parked on its trigger. Docs only; no job.
2026-12-04 18:12:41 -08:00
Anees Iqbal 4075d137fa Runtime: the attachment-read copies' bytes parted by read, by moment, and what a narrower form would copy after a barrier
What: six Metrics counters part attachment_read_copy_bytes, the copies a draw makes into a
shadow on a device without the attachment feedback loop (and for a surface plane, a texture in
place over a buffer without the feedback usage, a Direct3D 11 plane, on every device):
- by read: attachment_read_copy_bytes_own_pixel (a slot read only at the fragment's own pixel,
  or a fetched colour attachment) and attachment_read_copy_bytes_whole_texture (every level and
  layer the texture reaches); the two sum to attachment_read_copy_bytes;
- by moment: attachment_read_copy_bytes_first_in_pass (the shadow has held nothing since its
  pass began), attachment_read_copy_bytes_after_barrier (a memory barrier after draws, or a
  fetching draw after draws, left it holding nothing) and attachment_read_copy_bytes_beyond_held
  (it holds something and the draw reads past it); the three sum to attachment_read_copy_bytes;
- attachment_read_copy_bytes_after_barrier_narrowed: for each copy after a barrier, what a form
  whose barrier forgets only the rectangle the pass's draws rendered would have copied: what of
  the copy lies in the rectangle bounding the scissors (cut to Metal's render area) of the
  pass's draws since the shadow began to hold what it held, in the attachment's level and layer,
  plus what of it the shadow did not hold when the barrier dropped it; the whole copy where one
  of those draws may have written memory (Draws::writes_memory, or an indirect command buffer's
  execution), which may reach the image other than as its attachment. At most the after-barrier
  part.
No copy is added, removed or resized.

Why: the consumer's Intel UHD 630 under Windows, which has no feedback loop, counts tens of
gigabytes of these copies in a desktop boot and a video playback. A narrower form, a barrier that
forgets only the rendered rectangle, is a lane only if it would remove at least half the bytes;
the existing two counters cannot say. The rectangle counts from the shadow's first copy after it
held nothing, not from its last copy: a later copy only adds areas, and the areas copied earlier
are stale where the draws between rendered.

How: shadow::Held keeps what it held at the barrier, the rectangle and a may-write flag;
Held::narrowed works out the kept texels by inclusion and exclusion over at most eight held
areas, only at a copy after a barrier. The per-draw cost is one rectangle update for each shadow
of a pass that has one (Held::drew at the draw's end); a pass with no shadow does nothing more.
No speed is measured.

Verified, at dd1913401b (this tree; the message alone changed since):
- lavapipe (llvmpipe, LLVM 23.1.1), job m3-max-86812: the runtime suite under --cfg m2v_cpu_icd,
  1025 passed, 4 skipped. Among them
  d3d11_reads::every_device_parts_the_bytes_it_copies_into_a_direct3d_11_planes_shadow, which
  drives the shadow route on every device through a Direct3D 11 plane (R8Unorm, 16 x 8): an
  own-pixel read under a small scissor, a whole read, a memory barrier, a draw under another
  small scissor, a whole read; it asserts copies 3, bytes 280, own pixel 24, whole texture 256,
  first in pass 24, after barrier 128, beyond held 128, after barrier narrowed 60. And three host
  tests in tests/shadow.rs (moments, the narrowed texels over overlapping held areas, a
  may-write draw, another level or layer; the parts' sums).
- Red control, lavapipe, job m3-max-86813: this tree with the six split adds removed; the
  device test failed with [3, 280, 0, 0, 0, 0, 0, 0] against [3, 280, 24, 256, 24, 128, 128, 60].
- clippy --workspace --all-targets --all-features -D warnings: plain job m3-max-86814,
  --cfg m2v_gpu job m3-max-86815, --cfg m2v_cpu_icd job m3-max-86816. rustdoc -D warnings,
  scripts/api-docs and the signatures check: job m3-max-86817.
- The signatures table is blessed (six Metrics fields); refusal_surface.py wrote no change.
Not run: a device without the feedback loop through any route other than the Direct3D 11 plane.
2026-12-04 18:12:41 -08:00
Anees Iqbal b996b27a99 Translator tests: a texel's undecorated nudge sum floors to the code fused or not
extended_unorm::mapped takes a texel's code as floor(w + (nudge - 384)) with
the sum undecorated, so a device may fuse the code space's product into it,
fma(u, m, nudge - 384), rounding once from the exact product. The exact
sum's fraction stays near 1/128 to 0.992 for a BGRA10_XR field and
0.5 +- 0.016 for a BGR10_XR one, far past one rounding's error, so the
floor cannot cross an integer.

a_fused_texel_sum_floors_to_the_code now holds that for every code of both
formats, each of a BGRA10_XR field's 64 low-bit patterns and a BGR10_XR
code widened by replicating its bits included: the sum is formed exactly in
i128 (steps of 2^-46) and rounded once to the nearest f32, ties to even, and
its floor, and the unfused sum's, is the code less 384. A later edit that
moves a nudge or the scale off those margins fails it. The module docs and
mapped's comment say why the sum stays undecorated.

Test-only: the emitted code is unchanged, so no SEMANTICS_VERSION bump; the
runtime-sources hash is unchanged (c9ff784a...).
2026-12-04 18:12:41 -08:00
Jacob McSwain 74e4ad9d3a Translator: accept the module flags Apple's Metal shader converter writes
Shaders made by Apple's Metal shader converter could not be translated. The converter writes four
module flags the translator did not know, and an unknown flag is refused with Abi(UnknownKey).

The four flags:
- agx.allow_mismatched_component_counts (an i32, 0 or 1)
- irc.version_major, irc.version_minor, irc.version_patch (integers; 3.0.0 in the shaders seen)

What changes: the decoder accepts these flags and ignores them, as it treats wchar_size,
frame-pointer and the debug-info flags. It still checks them:
- each flag appears at most once;
- the agx flag is 0 or 1;
- the version parts are integers.
Anything else is refused as before. No public API changes.

Evidence:
- A new fixture with these flags compiles to the same SPIR-V as the same shader without them, on
  all 15 profiles: the flags change nothing in the translation.
- converter_module_flags_are_checked_and_dropped and the kernel_converter_module_flags fixture fail
  without this change.
- Of 12 converter-made shaders, 8 carry these flags. They now get past the flags, but each stops at
  a different, unrelated refusal; none compiles with this change alone.

Version: SEMANTICS_VERSION 2386 -> 2387, because inputs refused before can now compile.

Golden table: left for the bless on development; golden_hashes_match_the_table lists the fixture's
15 new cells. The fixture's expectations row is included.

Not run: device tests, the Windows clippy legs, the CI matrix.
2026-12-04 19:36:27 -06:00
Anees Iqbal a71ba816e3 Runtime README: the extended-range known gaps state card, driver and OS, not lab job ids
scripts/api-docs (CI's API reference step) refuses a lab job id in the prose docs, and
e849ae4665's two known-gap bullets cited six. They now name each measurement's card, driver and
OS: RX 7900 XTX (RADV, Mesa 26.2.6, Linux), Iris Xe (ANV, Mesa 26.2.6, Linux), RTX 3090 (NVIDIA
620.70.06, Linux), and KosmicKrisp (Mesa 26.3.1) on an Apple M3 Max, macOS 27.0.1. The ids stay
here: the GPU-time arms m3-max-86672 (XTX), 86676 (Iris), 86692 (3090); KosmicKrisp creation
m3-max-86686 and 86724; ANV creation m3-max-86719. Found by the pin Z prepush m3-max-86741
(STEP api_docs EXIT=1); the grep over the four prose files is now empty.
2026-12-04 12:24:13 -08:00
Anees Iqbal 01c1d0525c Pin Z bless: golden hashes at e849ae4665
The golden hash table re-blessed at development e849ae4665 (SEMANTICS_VERSION 2386: the pixel
sampler's single quotient sample and the extended-range decode's straight-line select moved the
artifacts). M3 job m3-max-86734 (bless-job.sh): inventory, golden, printouts, the AIR fixtures'
metallib half and the opened chains each exit 0; only golden_hashes.tsv changed (725 rows). The
engine inventory, the printouts and the opened chains are unchanged. The authored compile census
at dc3e7e5add (m3-max-86670) changed no table row; its run at e849ae4665 is in the merge check.
2026-12-04 12:16:34 -08:00
Anees Iqbal e849ae4665 Runtime README: the extended-range decode's price as a select, and the largest guest function's first creation with it
What: the known gaps of textures say what the straight-line decode costs.
- The bullet that described the per-site branch and its price now describes the select: every
  float sample, gather and read maps its lanes and selects where the word names BGR10_XR or
  BGRA10_XR; a texture of another format pays the arithmetic and the select, and a
  robustness-bounded read its in-range test. Its GPU-time price against the branch, base
  dc3e7e5add against 14d30efdfe, four alternated rounds' p50 medians: RX 7900 XTX (RADV,
  m3-max-86672) +0.3% sampling, +2.7% constexpr_sampling, +0.8% texture_read; Iris Xe (ANV, Mesa
  26.2.6, m3-max-86676) +0.5%, +1.3%, -0.2%; RTX 3090 (m3-max-86692) +0.1%, +0.8%, 0.0%. It says
  these predate 571a22f97a's uncontracted difference.
- A new bullet: one guest fragment function of 318 float samples, first created with every driver
  cache off, takes 23 s on KosmicKrisp (Mesa 26.3.1, Apple M3 Max; m3-max-86686 at 14d30efdfe and
  m3-max-86724 at 571a22f97a) and 9.2 s on ANV (Mesa 26.2.6, Iris Xe; m3-max-86719 at 571a22f97a),
  against 14 to 18 s and 4.0 s for the same function without the map (pin W, the same jobs and
  main's three earlier KosmicKrisp tables). Both are past the 5 s ceiling, as at W.

Why: the planner's ruling for pin Z: if Z ships the select form, its creation cost is stated as
measured, beside the row already owed for that variant.

Verified: the figures are the named jobs' lines; KosmicKrisp's 0 MTLLibrary failures at both W and
571a22f97a (m3-max-86724). Docs only; no code changes.
2026-12-04 12:11:12 -08:00
Anees Iqbal e64cf97918 Translator: an extended-range filter's difference w - 384 is NoContraction again, so no device fuses the code space's product into it
What: the straight-line decode (14d30efdfe) moved alpha's clamp after the difference, which made
the difference's operand the product w = u * m itself, and dropped the difference's NoContraction.
The RTX 3090, the RTX 5080 and KosmicKrisp then fused the two into fma(u, m, -384): n rounded once
from the exact product, where Metal's code space rounds w first. A nearest sample's w is the code,
so the fused n was a fraction off it, and the decoded value with it. The difference is decorated
again, as at pin X. A texel's floor (reads, gathers) was unaffected: floor(u * m + nudge - 384) is
the code less 384 fused or not.

Why: the replays at 7459e4d8ba moved 14 cells, the same counts on the RTX 3090 (round
7459e4d8ba-1204-1147, job 86698), the RTX 5080 (86700) and KosmicKrisp (86694): the samples of
extended-swizzles-bgr10xr (0ag1, ar10, bgra, gggg, rgba; sl and sn) and extended-swizzles-bgra10xr
(0ag1, bgra, gggg, rgba; sl), e.g. bgr10xr gggg/sn 336 elements at X, 504 now on the 3090.
Lavapipe (job 86688) showed none: it does not contract.

Test: a_runtime_samplers_implicit_sample_is_one_sample checks, on every committed profile, that the
module's one difference of 384 is decorated NoContraction; it fails without this change.
SEMANTICS_VERSION 2386. runtime-sources.sha256 unchanged.
2026-12-04 12:11:12 -08:00
Anees Iqbal 9a5aa02725 docs: the API guide's extended-range paragraph says the decode selects without a branch
What: docs/API.md's BGR10_XR / BGRA10_XR paragraph describes the straight-line decode of 14d30efdfe:
every lane mapped and selected where the word names one of the formats, no branch; the sum alone
decorated NoContraction; a slot's test, flags and constants made once per binding in the function's
first block; a robustness-bounded read testing its operands at every such read. No code changes.

Evidence for 14d30efdfe (generated code identical at 7459e4d8ba and here):

Words, runtime-floor, the largest variant 3f4cca857dfa (m3-max-86685, .json sidecars included):
W 162,351; pin X's per-site branch at dc3e7e5add 211,959; 14d30efdfe 176,844, about 175,630
without sidecars against W's 161,140 (+9.0%, under the 177,254 bar). The decode costs 14,493 words
over W where the branch cost 49,608, about 46 words a site over its 318 sites, the per-binding
decodes included. On the other 14 profiles: 170,128 (the RADV and ANV ones), 170,112 (the two
RTX 50), 170,100 (the three lavapipe), 176,880 (Pascal), 197,547 (moltenvk-m3). Small rows:
54f0489eefb5 1,692 (dc3e7e5add 1,680), 2a423fb525e7 2,394 (2,403).

GPU time of a float texture that is not extended-range, the harness's sampling (sample_down, a
runtime sampler), constexpr_sampling (sample_up) and texture_read (texels_out, a read the device's
robustness bounds, which now pays its in-range test at every read), base dc3e7e5add against
14d30efdfe: four rounds, the arms' order alternated each round, 200 timed runs each, the median of
the four GPU p50s in microseconds, the four's range in brackets:
- RX 7900 XTX, RADV (m3-max-86672): sampling 16.05 (16.00-16.10) -> 16.10 (16.10-16.40), +0.3%;
  constexpr_sampling 29.95 (29.90-30.30) -> 30.75 (30.40-30.90), +2.7%; texture_read
  45.40 (45.40-45.40) -> 45.75 (45.70-45.80), +0.8%.
- Iris Xe, ANV (m3-max-86676): sampling 394.90 (393.70-395.70) -> 396.90 (394.70-398.60), +0.5%;
  constexpr_sampling 820.60 (818.60-821.80) -> 831.45 (827.70-837.40), +1.3%; texture_read
  1564.25 (1561.70-1566.30) -> 1561.10 (1557.20-1566.40), -0.2%.
- RTX 3090, NVIDIA's driver (m3-max-86692): sampling 61.80 (61.70-61.80) -> 61.85 (61.80-61.90),
  +0.1%; constexpr_sampling 65.90 (65.80-66.00) -> 66.45 (66.30-66.60), +0.8%; texture_read
  134.65 (134.60-134.70) -> 134.65 (134.60-134.70), +0.0%.
Every workload is within 3% on each card; the XTX's constexpr_sampling, +2.7%, is the closest.

Check m3-max-86665 at 14d30efdfe: 3907 passed, 1387 skipped. Lint m3-max-86683 at 7459e4d8ba:
fmt, clippy plain, m2v_gpu and m2v_cpu_icd, rustdoc all clean.
2026-12-04 12:11:12 -08:00
Anees Iqbal acbafb52f3 Translator: identity_id's crate re-export goes, nothing outside its module reads it now
What: lower::texture no longer re-exports emit::identity_id; its callers are emit.rs itself and
words.rs, which names it by path. The extended-range decode (14d30efdfe) read a slot's word through
the re-export and now reads it through identity_word.

Why: rustc's unused_imports warning, seen in the harness arm build m3-max-86667; warnings are errors
in CI.

Verified: cargo fmt; the build is the lint job that follows.
2026-12-04 12:11:12 -08:00
Anees Iqbal 19bcc2dd2d Translator: an extended-range texture's decode is straight-line, its test made once per binding
What: a float sample, gather or read of a sampled image no longer branches on the texture's word at
each site. The site computes Metal's value of every lane (the code space, a texel's code whole, the
clamp, the two products and their sum) and selects it where the binding's decode maps the lane: no
block, branch or phi of its own. The decode (the word's test folded into its bits, the lanes' flags,
the scale, the bounds and a texel's nudge) is made once per texture slot, lanes kind and source, in
the function's first block (EmitCx::extended_decode, from the slot's word, a push field loaded
there); a heap element's at its site, from its handle. A read the device's robustness bounds still
selects 0 for a code lane outside the image, now at every such read.

The arithmetic is X's, rearranged where the bits are provably the same:
- the clamp moves from the code w to n = w - 384, alpha's bounds [0, 510]: w - 384 is exact on
  [384, 894] and rounds below 0 and above 510 outside it (clamping_the_difference_clamps_the_code,
  every f32 near the bounds, every 64th elsewhere in [0, 1024));
- a texel's floor takes its nudge less 384, so it is n itself: every code of both formats, the low
  six bits of a 16-bit field and NVIDIA's replicated 10-bit codes (the module's tests);
- a lane that is not alpha's is clamped to +-65536, finite, so no device's float controls change it;
- the sum keeps NoContraction, which forbids combining it with a product or factoring n out of it;
  the products and the difference drop theirs (n has two uses, and the products feed only the sum).

Why: pin X's per-site arm (58988c6b83) put a test, a branch, a merge and a phi on each of the 318
float samples of the largest variant 3f4cca857dfa, +49,608 words at runtime-floor over pin W
(m3-max-86625: W 162,351, e1dd48a92b 211,959). KosmicKrisp failed that variant's MTLLibrary
(m3-max-86641: W 18 s, e1dd48a92b 100 s and a refusal) and Iris Xe took 9.3 s against W's 4.0 s
(m3-max-86640).

The affine lead does not hold: fma(u, fl(m/510), fl(-384/510)) misses Metal's quotient for 834 of
the 1024 BGR10_XR codes and 543 of the BGRA10_XR codes (543 and 575 with lavapipe's reciprocal
conversion), so the exact form stays.

Tests: a_runtime_samplers_implicit_sample_is_one_sample also asserts no OpSelectionMerge and no
OpPhi on every committed profile; the module's tests cover the shifted floor and the clamp. The
ARM_WORDS estimate is 48. SEMANTICS_VERSION 2385. runtime-sources.sha256 unchanged (none of its
listed sources moved). docs/REFUSALS.md unchanged.

Turnip limits read from Mesa 26.3.1 for the 196,608 sampled-image floor of 50b05dbce2: no targeted
driver sits between 131,072 and 196,608 (Turnip tu_device.cc:1080/1089 16,777,216; RADV
radv_physical_device.c:1998/2007 8,388,606; ANV anv_physical_device.c:1463/1472 201,326,592, ARL
33,554,432; lavapipe lvp_device.c:1160/1169 1,015,808; KosmicKrisp kk_physical_device.c:731/743
2^20).
2026-12-04 12:11:12 -08:00
Anees Iqbal 0fdcf9833d Runtime README: a Direct3D 11 plane's own-pass reads were zero in a video playback too
The known gap for a Direct3D 11 plane's attachment reads said the frequency was near zero by one
desktop boot. The consumer's playback boot on the Intel UHD 630 (Windows 11, its tree at pin W
with the plane-import diagnostics; job m3-max-86661, build 86658) played a 40 s 1920 x 1080 30 fps
H.264 clip made on our hosts for 41 s in a video player: rt-diag plane-passes 0 in every shape
(one plane, both planes of one picture, with depth or stencil, with a colour attachment not a
plane, a plane as a resolve target, planes of more than one picture) at all five counts writes;
934 pictures drawn, 2,053 Direct3D 11 plane submissions; fatal 0, lost-device 0. The line now
names both runs and stays "expected", since two workloads are not every guest.
2026-12-04 11:59:16 -08:00
Anees Iqbal dc3e7e5add Conformance ledger: NVIDIA's render-then-sample-magnified-linear row returns, the device's own linear filter
What: the NVIDIA venue's render-then-sample-magnified-linear row, as 2a406a848e removed it (pin W's
text): a linear magnified sample of a rendered 8-bit target, 30 elements a code from Metal's, the
device's own answer under device-sampling and device-color-conversion. docs/CONFORMANCE-COVERAGE.md
regenerated.

Why: 2a406a848e dropped the row as stale at pin X, where a runtime pixel sampler's second sample
moved this case's filter. With the pixel sampler back at W's single quotient sample (50b05dbce2), the
device's own linear filter shows again: the RTX 5080's replay at e1dd48a92b (job m3-max-86636)
reports exactly this row, 30 elements differ (U8), the largest difference 1, and nothing else
unexpected.

Verified: the 5080 replay above; the row's fields are the replay's line. The RTX 3090's replay at the
same sha is still running.
2026-12-04 11:35:41 -08:00
Anees Iqbal fde349e7b2 Translator tests: a constexpr sampler's device sampler is checked made, not for the deleted unnormalized field
Fix forward for a3b78a142a: engine_identity's
a_constexpr_sampler_is_the_set_1_element_its_pushed_index_names asserted that the constexpr
sampler's vk::SamplerDesc was not unnormalized, and that field is gone with the form. The test
still makes the device sampler and holds the PixelSamplerScaling note. Found by the build of
job m3-max-86604 (E0609, metal2vulkan lib test). Test-only; no version moves.
2026-12-04 11:35:41 -08:00
Anees Iqbal 0494e2543d Translator: the unnormalized sampler form nothing makes once the twins went is deleted
The runtime's unnormalized twins were the last maker of a device sampler with
unnormalizedCoordinates (8fb26059c7 and 27a6c1ebd3 kept the form for them alone). With the twins
gone in the previous commit, nothing builds such a sampler, so the form goes (rule 4):
SamplerUse::unnormalized and SamplerUse::with_unnormalized, vk_sampler's unnormalized arm (the
invariant check, the nearest mip mode at [0, 0], the dropped anisotropy and bias),
metal::sampler::unnormalized_reads, vk::SamplerDesc::unnormalized (its key, its codec field and
ash_interop's unnormalizedCoordinates, which is now always false), and their tests.

Consumer: reims-vgpu at 9889a815bb names none of them (git grep -w over its Rust sources:
with_unnormalized 0, unnormalized 0, SamplerUse 0). The signature table loses the two fields and
the method. The codec change rides on ARTIFACT_FORMAT_VERSION 615 of the previous commit (one
tip); metal/sampler.rs, vk/structs.rs and ash_interop/convert.rs are runtime inputs, so
runtime-sources.sha256 is re-pinned; RUNTIME_VERSION 2579 of the previous commit covers it, and no
run reaches a removed arm.
2026-12-04 11:35:41 -08:00
Anees Iqbal f3a820799e Translator and runtime: a runtime pixel sampler samples once, at the quotient, as at pin W
The planner's ruling on pin X's fragment growth (12-04). The level-0 arm that 8f69218029 put on
every implicit sample and gather through a runtime sampler slot (a test of the slot's word, a
second, explicit level-0 sample through the state's unnormalized twin, and a branch with a phi)
doubled large fragment shaders: the largest corpus variant went from 161,140 to 318,071
runtime-floor words, and its pipeline creation from 4.0 s to 28.1 s on the Iris Xe and past
300 s on KosmicKrisp. What it bought was last-bit filter weights of a linear downscale, never
another texel.

Translator: a slot sample or gather is the one W form again. The pixel coordinate reaches the
device's normalized sampler as the coordinate over the level-0 size, chosen in ALU by the slot's
word (and its texel centre for a nearest pixel state), under PrecisionNote::PixelSamplerScaling.
Gone: Sampling::level_zero, the level-0 test and value, TextureSlot::level_zero_samplers (and
its codec field), LEVEL_ZERO_ELEMENT, UNNORMALIZED_TWIN_ELEMENT, SamplerWord's
UNNORMALIZED_FILTERS, UNNORMALIZED_LINEAR, UNNORMALIZED_MODES and reads_unnormalized, and
emit's offset_texels, which only the level-0 value read. The follow-ups go with it: c99bf0c6c3's
linear-only test and its red test, 69a3254e1a's DeviceSampling paragraph on the unnormalized
sampler's sub-texel step (no form reaches that sampler now), b58c67e981's count, 77e2a4f187's,
9fe45f0043's and a86f5ed62b's test counts. The translator test
a_runtime_samplers_implicit_sample_is_one_sample holds a fragment's implicit slot sample to one
implicit sample and no explicit one on every committed profile (at X the level-0 arm's explicit
sample made it fail).

Runtime: set 1's sampled array holds the textures and their second elements, 131,072, and the
plain sampler array 8,000 again: no unnormalized twins, no level-0 elements, no level-0 views
(Gauges::level_zero_views and its harness and replay entries go, with tests/level_zero.rs and
83bb95724d's bind check). The floor's descriptor limits are what those arrays need: sampled
images 196,608 (textures, second elements, read texture buffers), samplers 24,000, per-stage
resources 393,216 plus the attachments, all pools 417,216; X asked 262,144, 32,000, 458,752 and
490,752. These still hold the second elements on every device at the floor, so
Capabilities::attachment_reads stays always true and 7a6b0d10bc stays: no guest-visible answer
moves (W's own floor, 131,072 sampled images, would have made it a per-device answer again).
runtime-floor.json and regen_device_profiles.py state the new floor.

Docs: PixelSamplerScaling's doc and its docs/API.md entry keep W's text without the level-0
clauses; the measured line names the cards: a linear downscale by 8 through a slot within
0.88/255 of Metal's on KosmicKrisp and RADV, 0.95/255 on the Iris Xe, 1.19/255 on the RTX 3090
and 1.375/255 on lavapipe (the ledger rows' largest differences). The runtime README, RESOURCE-ID
and the pixel_samplers module doc drop the level-0 elements and twins.

Ledger: the pixel-downscales rows return on the seven venues (RX 7900 XTX, Radeon 780M, RX 550,
NVIDIA, Iris Xe, llvmpipe, Apple M3 Max) and the pixel-samplers slot rows on five cards and
lavapipe, from 24cb048066, ed46bdbfc5, 82b7d9e4a2, bb7661f09a and 0c70839937's removed lines;
the frac/slot rows that said ours read as the device's own answer under note
pixel-sampler-scaling. Coverage regenerated. The replays at this tip are the check.

Versions: SEMANTICS_VERSION 2384 (slot samples lose the level-0 arm), ARTIFACT_FORMAT_VERSION 615
(TextureSlot's codec loses level_zero_samplers), RUNTIME_VERSION 2579 (set 1's sizes, no twins or
level-0 elements, the floor's limits); runtime-sources.sha256 re-pinned. The signature table and
api_surface lose the removed items; docs/REFUSALS.md is unchanged (refusal_surface --check).

Consumer: reims-vgpu at 9889a815bb names none of the removed items (git grep -w: 0 hits each for
LEVEL_ZERO_ELEMENT, UNNORMALIZED_TWIN_ELEMENT, level_zero_samplers, level_zero_views,
reads_unnormalized, UNNORMALIZED_LINEAR, UNNORMALIZED_FILTERS, UNNORMALIZED_MODES).
2026-12-04 11:35:41 -08:00
Anees Iqbal af66b8a4e2 Runtime README: a view of another format leaves its shadow's first copy
The README said the shadow is of the attachment's format and that the pass's clear stands for
the first copy into it. The encoder takes the clear only where the shadow's format is the
attachment's (render_encoder.rs, Shadowed::cleared); the shadow keeps its texture's format, so
an attachment that is a view of another format copies at its first read as well. The Render
encoders section and the known gap for a device without the attachment feedback loop now say so,
with the two copies the view test asserts (d95c47603b; seen as (0, 2) on the Intel UHD 630,
Windows, job m3-max-86637).
2026-12-04 11:35:21 -08:00
Anees Iqbal d95c47603b Runtime tests: a view of another format reads its attachment's shadow through two copies
every_device_reads_its_attachment_through_a_view_of_another_format expected the shadow route to
copy once: the pass's clear standing for the shadow's first copy, the read after the barrier
copying. The shadow keeps its texture's format (RGBA8Unorm), and the encoder lets a pass's clear
colour stand for a copy only where the shadow's format is the attachment's
(render_encoder.rs, Shadowed::cleared), so an RGBA8Unorm_sRGB view's first read copies too:
two copies, which is the runtime's intended form (a clear of the UNORM shadow with the sRGB
view's colour would store other bits).

Seen on the Intel UHD 630 (Windows, driver 101.2145, no attachment feedback loop), job
m3-max-86637: "loop reads and copies (0, 2)"; the other 1027 tests passed, 5 skipped. Every
device the lab runs with the loop takes the (2, 0) arm, unchanged. The test now expects (0, 2)
on the shadow route; its rerun is the UHD 630 leg at the next pin's tip.
2026-12-04 11:33:55 -08:00
Anees Iqbal 9c689f0eb3 AGENTS.md: rule 2's attachment feedback loop clause names the Direct3D 11 plane
Rule 2's clause for the attachment feedback loop said a device without the loop reads a render
target through a counted copy of that target. Since 1baee4fb75 a Direct3D 11 plane's image takes
only its texture's bind-flag usage, never the loop usage, on every device, so a draw that reads
such a plane in its own pass takes that same counted copy on a device that has the loop too. The
clause now says so: "a device without it, and on every device a Direct3D 11 plane, whose image
takes only its texture's bind-flag usage, reads a render target through a counted copy of that
target, recorded as a known gap".

It adds no query and no form chosen by a device, so rule 2's count of fourteen stands. The
runtime README's known-gaps entry for the plane states the same route.

The owner approved this clause as worded (Telegram 3777, "A", relayed verbatim by the bridge
session), on the planner's proposal after the 181 lane landed.
2026-12-04 11:27:53 -08:00
Anees Iqbal 63df44554b Runtime README: a Direct3D 11 plane's own-pass reads are expected near zero, not verified
The known-gaps entry for a Direct3D 11 plane read as an attachment of its own pass (1baee4fb75)
gains how often that happens: expected near zero for decoded video, not verified. The one count
on file is the consumer's 93 s Windows desktop boot on the Intel UHD 630 (rt at 865592b96b), whose
plane-pass diagnostic counted no render pass over a plane in any shape; that boot drew two video
pictures, so it bounds desktop use, not playback. On a device with the attachment feedback loop
each such draw now pays the counted shadow copy; the count bounds that cost until a boot that
plays video reports it.

Docs only; verified by reading the entry in place.
2026-12-04 11:21:24 -08:00
Anees Iqbal 9150343e26 Runtime: an attachment view of another format keeps the sampled usage where the image loops; a Direct3D 11 plane's import reads compatibleHandleTypes
An attachment view in a format other than its image's (a texture view of another format, a
texture whose views are extended, a surface plane under a texture of another format) was made with
the image's usage that the format holds, masked to the attachment usages and the feedback usage
(VkImageViewUsageCreateInfo). That mask dropped VK_IMAGE_USAGE_SAMPLED_BIT. A pass whose draw
reads such an attachment renders it in VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT, which
enables the feedback loop for it (Vulkan's "Non-Overlapping Access Between Resources"), and
VUID-VkRenderingAttachmentInfo-imageView-10780 asks such a view for the feedback usage, an
attachment usage, and the sampled or input attachment usage. The view now keeps the sampled usage
where it keeps the feedback usage; elsewhere its mask is as before. Not Windows-only: any device
with the attachment feedback loop.

Red, then green, under the Khronos validation layer 1.4.363.0 on the Radeon 780M (RADV PHOENIX,
Mesa 26.2.6, VK_EXT_attachment_feedback_loop_layout present), the same tests in both:
- red, this tree without the attachment view change (job m3-max-86610, archive built in job
  m3-max-86606): view_loop_reads and d3d11_reads both fail, two
  VUID-VkRenderingAttachmentInfo-imageView-10780 each ("imageLayout is
  VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT, but image view usage is
  COLOR_ATTACHMENT|ATTACHMENT_FEEDBACK_LOOP"): the RGBA8Unorm_sRGB view, and the R16Uint plane under
  an RG8Unorm texture made with the feedback usage;
- green, this tree (job m3-max-86609, archive built in job m3-max-86607 from a commit of this tree
  but the README): 2 of 2 pass, no message.
Lavapipe (llvmpipe, Mesa 26.2.4, which has the loop), this tree, job m3-max-86608: 81 tests run
(the attachment read, view, surface, plane and shadow tests), 81 passed, 948 skipped by the filter.

Tests: view_loop_reads (new, every device of a device cfg): an RGBA8Unorm render target made for
views of other formats and its RGBA8Unorm_sRGB view at an index; a pass over the view reads it at
its own pixel, through the loop on a loop device (2 loop reads, no copy), else its shadow (1 copy),
every texel exact. d3d11_reads' control, the plane made with the feedback usage beside, now covers
the chroma plane (R16Uint image, RG8Unorm texture) too. Its stand-in image is moved once to the
general layout by a command buffer of the test's own before its texture is made, as Direct3D 11
leaves its texture (the layout every acquire of a plane names), and its usage assertion compares
raw flags (ash's flags have no Debug here): both fix the previous commit's test, which did not
compile under a device cfg and, run, met VUID-vkCmdBeginRendering-pRenderingInfo-09592 against
its undefined stand-in (lavapipe job m3-max-86589, the 780M job m3-max-86595).

compatibleHandleTypes: the Direct3D 11 import's image format query
(VkPhysicalDeviceExternalImageFormatInfo of VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT) read
only IMPORTABLE. VUID-VkImageCreateInfo-pNext-00990 asks the handle types an image is made with to
be among the query's compatibleHandleTypes; a usage the query answers otherwise is now one the
import does not offer, so a plane none of whose usage it offers is Limit::NoImport, as before for
one not importable. Windows only: compiled by the Windows clippy named on landing; the Windows rt
leg (UHD 630) is main's to run.

The runtime README says the attachment view's usage, and the Direct3D 11 import's compatible
handle types. The runtime-sources pin is unchanged (3b7da9e9...); docs/REFUSALS.md regenerates
unchanged.
2026-12-04 11:19:10 -08:00
Anees Iqbal 1baee4fb75 Runtime: a Direct3D 11 plane takes only its bind flags' usage, never the attachment feedback loop's
A Direct3D 11 plane's image (Device::import_d3d11_surface, on Windows) took the usage its
texture's bind flags give (0x17 for RENDER_TARGET | SHADER_RESOURCE) and, on a device with the
attachment feedback loop, where its texture was a render target shaders read, also
VK_IMAGE_USAGE_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT (0x80017), the one usage Direct3D 11's description
has no counterpart for. Vulkan states no rule for an image over memory another API made with
other parameters than that API's (its rule for an import of Vulkan's own export is the same image,
VUID-VkMemoryDedicatedAllocateInfo-image-01876). The consumer's issue 181 (device lost on AMD's
legacy Windows driver while work touches imported planes, its logs counting 134 to 20,261 loop
reads over all attachments) points here; nothing shows this is 181's cause, and the lab's Windows
card (UHD 630) has no loop, so no lab device has run a plane made with the loop usage.

The plane's image now takes exactly the usage its bind flags give, on every device: the import
asks no feedback usage and makes none. A draw that reads such a plane as an attachment of its own
pass takes the route rt already has for a surface plane whose image took no feedback usage
(Device::surface_texture): a copy into the plane's shadow, on a device with the loop as on one
without it. One form, no query added, nothing keyed. The cost: on a loop device such a draw pays a
counted copy (Metrics::attachment_read_copies), recorded in the runtime README's known gaps of
render encoders; the import's section and the attachment reads' copy paragraph say so.

How often a draw reads a plane it renders to, from a files read of the consumer (reims-vgpu
development 9889a815bb, read only): the consumer's own work over the planes is copies and clears
(render passes with no draw); the guest's render passes over a video plane are counted by its
boot diagnostics (rt-diag plane-passes) with no count on file, and no counter of the consumer's
splits the loop reads by planes. Not settled by the files; expected rare for decoded video.

Tests: d3d11_reads (new, every device of a device cfg): planes made as d3d11_plane_texture makes
them but for the import (no Direct3D 11 off Windows), an R8Unorm luma and an R16Uint chroma under
an RG8Unorm texture, of usage 0x17, read at their own pixel by draws of a pass over a view of each:
one copy into the shadow and no loop read, one plane submission, every texel exact; the control,
the luma with the feedback usage beside on a loop device, reads through the loop. The Direct3D 11
usage test (Windows) now imports under a render target shaders read and asserts the usage is the
bind flags' exactly, the textures not looped. Verified by the jobs named on landing.

The runtime-sources pin is unchanged (3b7da9e9...): no translator file moved. docs/REFUSALS.md
regenerates unchanged.
2026-12-04 11:19:10 -08:00
Anees Iqbal 1156d66df8 Runtime: a command buffer whose submission is a Managed copy-in counts no stage
A command buffer with nothing for the GPU that takes a Managed buffer's copy-in has the copy-in as
its submission and completes after it. Its retirement gives it one GPU time, at its queue's last end
or its kernel end, whichever is later, as Metal reports a command buffer with nothing for the GPU,
and it fed those same times to the runtime's stage metric. So the copy's whole GPU run was counted
in gpu_end_to_handler, with its steps and tail, the figure the round and the plays read as
completion latency. The perf audit found it on the gb-3090-r3 play on the RX 7900 XTX: 52 command
buffers over 16 ms. One copy-in it dumped was 274 MB and 38.8 ms of GPU time, about 7 GB/s (jobs
m3-max-86564, m3-max-86566). The copy itself is Metal's didModifyRange: point on a discrete GPU;
only its attribution was wrong.

The submit thread now marks such a command buffer as its group goes. For each copy-in that
Captured::take hands to a lead, the finished member with that lead's number gets
Gpu::copy_in_only, if it has nothing for the GPU. An empty command buffer has one segment, so it is
always among the finished. Retirement leaves a marked command buffer out of scheduled_to_gpu_start,
gpu_run and gpu_end_to_handler, and out of the behind, steps and tail sums that go with them. Its
commit_to_scheduled still counts. What the guest sees does not change: gpu_start_time and
gpu_end_time are still one time, computed as before. A command buffer with nothing for the GPU that
took no copy-in counts as before.

Why leave it out rather than count the copy-in's own timestamps as its run:
- runtime_command_buffer_gpu_nanos already counts the copy-in's run as the runtime's own, and its
  doc says that is no Metal command buffer's gpu_run.
- A member of a group sent member by member retires before the copy-ins of its submission, so its
  retirement could not read their timestamps without moving the copy-ins' retirement.
- gpu_run would then differ from the command buffer's own gpu_end_time - gpu_start_time, which
  stays Metal's answer.

Test: empty_commit_takes_named_ranges (tests/managed.rs) now asserts the stage counts the command
buffer added: [1, 0, 0, 0] where its one submission was the copy-in, [1, 1, 1, 1] otherwise. Its
existing assertions show the path ran: 256 bytes captured, one submission, one runtime command
buffer.

Red: at 6f6e322f16 (scratch; development plus the test alone), on lavapipe (llvmpipe, LLVM 23.1.1;
job m3-max-86583), the declared-buffer and no-effects-dispatch tests fail in the two-copy view, each
counting [1, 1, 1, 1]. 39 of the 41 selected tests passed and 2 failed.
Green: at e6bdfe999a (scratch; this tree on development), on lavapipe (job m3-max-86581), the
runtime's Managed, gpu_span and stage-histogram tests passed: 41 passed, 986 skipped (filtered).

Docs: the doc of Metrics::scheduled_to_gpu_start and the runtime README now name this exclusion.
runtime-sources.sha256 does not change, because no input of its fingerprint changed (pin-compute.py
reads 3b7da9e9).
2026-12-04 11:09:57 -08:00
Anees Iqbal 29933a21f9 Conformance ledger: the NVIDIA venue's half-texel-nans widened rows hold the RTX 5080's answer beside the RTX 3090's
What: the NVIDIA rows of half-texel-nans-r16f, -rg16f, -rgba16f, -r32f, -rg32f, -rgba32f and
-rg11b10f at case/words/widened list two answers, the RTX 3090's and the RTX 5080 Laptop GPU's, and
say which run each came from. The 5080 narrows a 32-bit texel to half as Metal does and differs from
Metal in NaN bits alone; the 3090 keeps a 32-bit texel's own bits through the half read, its existing
difference under native-half-conversion. The same module runs on both.

Why: pin X's round read the 5080's replay red on these 7 sites (m3-max-86484), against rows recorded
on the 3090; the 5080 replay was last run at pin T. Planner ruling: alternatives in the NVIDIA rows
if every differing word is a NaN on both sides.

Verified: the words of the 7 cases at a0db12ed89 on both cards (scratch probe, not committed: 3090
m3-max-86496, 5080 m3-max-86497), against Metal's recording of each case: the 5080 differs from
Metal in 9,644 widened words, every one a NaN in both answers, its counts equal to its replay's
(558, 1111, 2216, 641, 1279, 2559, 1280); the 3090 differs in 9,983, of which 1,193 in the three
32-bit cases are not a NaN on either side (a denormal for Metal's ±0, FLT_MAX for Metal's infinity,
1/3 unrounded), its existing rows' counts. The other 28 columns are equal on both cards.
2026-12-03 19:03:00 -08:00
Anees Iqbal 2a406a848e Conformance ledger: the XR families' extended-swizzles rows on the RX 7900 XTX, Iris Xe and NVIDIA venues; NVIDIA's render-then-sample-magnified-linear row goes
What: 132 rows, 44 for each card venue (RX 7900 XTX, Iris(R) Xe, NVIDIA), of extended-swizzles-bgra10xr
and -bgr10xr: the 44 sites the llvmpipe rows (58988c6b83) and the Apple M3 Max rows (35ca0e4606) hold,
each with its card's own answer and the llvmpipe row's cause: a sample past the edge through a
border address mode reads the device's border in code space, and a BGRA10_XR linear sample filters in
the fields' low 6 bits, the runtime's known gaps, not built (one parked fix row). The NVIDIA venue
covers the RTX 3090 and the RTX 5080 Laptop GPU, whose answers are equal at all 44 sites. The NVIDIA
row of render-then-sample-magnified-linear at case/sampled/texels goes: both NVIDIA cards now answer
Metal's texels there. The commit that made them match is not named (expected: the nearest pixel
sampler's texel centre, c99bf0c6c3; unaudited). docs/CONFORMANCE-COVERAGE.md is regenerated.

Why: pin X's short round read every card replay red on these lines (xtx m3-max-86478, iris 86482,
3090 86483, 5080 86484); at pin W the three card replays were green. main/ad recorded the llvmpipe
rows alone, and no merged check or pre-push set ran a card replay.

Verified: the answers are the four replays' own, at a0db12ed89. The card replays with these rows are
this pin's pre-push proof.
2026-12-03 18:59:00 -08:00
Anees Iqbal a0db12ed89 Pin X bless: the golden cells and the census differences by the commit that moved them
The bless commit c4bcc45c28 left its attribution pending on the M3's jobs. This commit carries it and changes
no file.

The authored compile census at the bless differs from pin W's in 162 cells (18 of them regressions), and none
is unexplained. Each attribution point was checked out on the M3 and its census blessed alone against its own
tree's table (m3-max-86314 over 17 points, m3-max-86420 splitting 27a6c1ebd3..e649629fde at 5 more), and the
tables were diffed in history order. Most points also move the artifacts_at product line, which is not counted
below. The last table equals the one c4bcc45c28 commits.
- 41438f2693, a depth cube's read by face samples its cube view: 9 cells from refused (IdentityDomains) to
  compiled.
- 58988c6b83, BGR10_XR and BGRA10_XR textures held as UNORM codes: 1520 artifacts move in 304 cases.
- The span ending at 43f22a5661 (8f69218029, the level-0 elements): 360 artifacts move in 72 cases.
- The span ending at c99bf0c6c3 (a nearest runtime pixel sampler keeps its texel centre): the same 360 cells
  move again, none back to its artifact before 43f22a5661.
- f514d6f283, a bicubic sample of a format with no bicubic treatment is the runtime's limit: 18 cells, 2 cases
  on 9 profiles, from compiled to not_supported{tooling_requirement:bicubic_texels}. The two public
  engine/bcx_rules cases bicubic-8-bit-normalized-and-srgb-sums-near-the-rounding-tie (63d0f152) and
  bicubic-rounding-of-random-float-and-srgb-texels (cbf5dd18) bind RGBA8Unorm_sRGB textures that their kernel
  samples through a bicubic constexpr sampler, which the runtime refuses at dispatch (Gap::BicubicTexels); the
  intended refusal, classified as the runtime's limit.
- 7948443887, object and mesh functions need the mesh extension's two stages and the two indirect draw features
  together: 135 cells in 15 cases change the MeshShading refusal's label to name every feature.
- 8a80dd27df, an object function reads its draw's group counts at an address: 90 of those cells go to
  compiled, and 45 change label.
- ecdce9a3b5, a mesh pipeline without an object function draws through a launcher task stage: 24 artifacts move
  in 6 cases.
- 07d9577c20, the mesh stages no longer require drawIndirectCount: 60 artifacts move and 15 cells change label.
- 8fb26059c7, aea7564c29, fbf7edb539, e649629fde, ee45758ba9, 5bfaa69869, f7c56cd4d2, 3e3deb25b9, 27a6c1ebd3,
  763caf0270, b01d5e529d and 970e710e4c move no cell.

The golden hash table moves from pin W's (865592b96b) to the blessed one by these commits. Each attribution
point was checked out on the M3 and blessed alone (m3-max-86313, and m3-max-86372 at c226c542b2, which takes
the place of f7c56cd4d2, whose library tests do not compile), and the tables were diffed in history order.
The last table equals the one c4bcc45c28 commits.
- ee45758ba9, SEMANTICS 2371, a sparse read through a sampler reads its texel: 2 rows added
  (a2_sparse_read_through's .ll and .air.ll).
- 41438f2693, SEMANTICS 2372: 30 cells in 2 rows (unk_read_depth_cube).
- 58988c6b83, SEMANTICS 2373: 10808 cells in 723 rows.
- 5bfaa69869 (SEMANTICS 2374): the semantics line alone.
- The span ending at 43f22a5661, SEMANTICS 2375: 3277 cells in 219 rows.
- The span ending at c99bf0c6c3, SEMANTICS 2376: 3277 cells in 219 rows, and the runtime-floor profile line.
- The span ending at c226c542b2 (SEMANTICS 2377) and 3e3deb25b9 (SEMANTICS 2378): the semantics line alone.
- e649629fde, SEMANTICS 2379, the identity domains lower object and mesh functions: 1212 cells in 82 rows.
- 763caf0270, SEMANTICS 2380: 8 rows added, and 15 profile lines.
- 8a80dd27df, SEMANTICS 2381: 282 cells in 32 rows.
- ecdce9a3b5 (SEMANTICS 2382): the semantics line alone.
- 07d9577c20, SEMANTICS 2383: 176 cells in 88 rows.
- 27a6c1ebd3, b01d5e529d and 970e710e4c move no cell.
In all, 19062 cell moves, and 10 rows added.
2026-12-03 18:30:39 -08:00
Anees Iqbal 303638b080 Conformance ledger: half-texel-nans' rows on KosmicKrisp; the runtime README's unexplained-rows bullet goes
What: 12 rows of venue Apple M3 Max for what KosmicKrisp (Mesa 26.3.1) answers in half-texel-nans:
- 9 rows of R16Float, RG16Float and RGBA16Float at a nearest sample, a read and a read through a
  sample (515, 1026 and 2045 elements): every differing element is a NaN in both answers, the
  device's NaN bits (rule 1), Metal's texel bits kept where the device answers 0x7e00.
- 3 rows of R32Float, RG32Float and RGBA32Float at a nearest sample (42, 85 and 171 elements):
  0x7bff in Metal's answer, 0x7c00 in the device's, a texel past 65504 that Metal saturates and the
  conversion takes to the infinity of its sign (PrecisionNote::HalfTexelConversion), as the other
  venues' rows at these sites record.
Each row names its notes and marks the cause of the move as expected, not verified: the device
converting in the shader rather than in its texture unit since the extended-range select
(58988c6b83) follows every float sample. docs/CONFORMANCE-COVERAGE.md is regenerated. The runtime
README's bullet listing these rows as seen and not explained goes: no KosmicKrisp replay row is
left unlisted.

Why: the planner ruled these rows, with no code change, on a counted compare of the words the case
reads at 41438f2693 and at 58988c6b83 (a scratch probe, not committed): 0 of 147,456 words differ
on lavapipe (86398), the RTX 3090 (86400) and the RX 7900 XTX (86401); on KosmicKrisp (86403,
86421) 11,056 differ, 10,758 NaN to NaN and 298 the single pair 0x7bff to 0x7c00. llvmpipe's
nearest-sample rows exceed its read rows by the same 42, 85 and 171 elements.

Verified: the rows' answers and first elements are KosmicKrisp's own, from a replay of the eight
cases at 4e7f66642e (m3-max-86425, an Apple M3 Max). The runtime-sources pin is unchanged.
2026-12-03 18:21:27 -08:00
Anees Iqbal 4e7f66642e Runtime README: the Mac host's unrecorded conformance rows are the 12 half-texel-nans rows alone
The XR families' 62 KosmicKrisp rows are recorded in known-gaps-rt.tsv by the commit before this
one (extended-swizzles 44, xr-blend, xr-gamut, xr-gradient and xr-masked 18), so the known-gaps
bullet that listed 74 rows seen and not explained now names the 12 half-texel-nans rows that stay
unrecorded for that venue.

Verified: the M3's KosmicKrisp replay with those rows (m3-max-86387, an Apple M3 Max) printed 12
unexpected lines, every one half-texel-nans. The runtime-sources pin is unchanged (README only).
2026-12-03 18:04:49 -08:00
Anees Iqbal 35ca0e4606 Conformance ledger: the XR families' rows on KosmicKrisp
What: 62 rows of venue Apple M3 Max for what KosmicKrisp (Mesa 26.3.1) answers in the XR
families, the same gaps the other venues' rows record:
- 18 rows of the device's blend of the codes (PrecisionNote::ExtendedRangeBlend and
  ExtendedRangeBlendWindow) and its resolve (DeviceRoundedResolve): xr-blend (4), xr-gamut (9),
  xr-gradient (3), xr-masked (2). The two premul blends differ from the other venues past the
  window (the largest difference 53,463 against 24,637), unexamined against Vulkan's clamp of a
  fixed-point source, as their rows say.
- 44 rows of extended-swizzles-bgra10xr and -bgr10xr, with the llvmpipe rows' cause: a sample
  past the edge through a border address mode reads the device's border in code space, and a
  BGRA10_XR linear sample filters in the fields' low 6 bits (the runtime's known gaps, not built).
docs/CONFORMANCE-COVERAGE.md is regenerated.

Why: the replay of KosmicKrisp at development (m3-max-86361) listed them as unlisted; the planner
ruled both families rows, the extended-swizzles fix a bug row of its own.

Verified: the answers are KosmicKrisp's own, from that replay. The replay of the whole ledger on
KosmicKrisp with these rows (m3-max-86387, an Apple M3 Max): 12 unexpected, every one
half-texel-nans (not these families), 0 of the 62.
2026-12-03 18:03:36 -08:00
Anees Iqbal d15b9922ad Multisample bytes test: a 16-bit depth cleared to 0.25 may hold either code nearest it; the KosmicKrisp gap line goes
The red on KosmicKrisp (Mesa 26.3.1) on the Apple M3 Max was the test's, not the driver's. The word
its region row read outside the region, 1048575232, is 0x3E7FFD00: code 16383 read as 16383/65535,
not 0x3E7FFFC0 as the gap line said. The split test's new row, the 4-sample Depth16Unorm cleared to
0.25 and read with no copy, reads it too (M3 leg job m3-max-86335 at 9e6ec32898, build
m3-max-86328):

  cleared, no copy, 8 x 8: 256 of 256 samples are not Metal's ... the words read: 0x3E7FFD00 x 256
  4 x 3 at (2, 1) of 8 x 8: 208 of 256 ... the words read: 0x3E7FFD00 x 208

So the device's clear converts 0.25 (16383.75 in codes) to 16383, and the copy's load and store keep
it exactly. Vulkan's "Conversion From Floating-Point to Normalized Fixed-Point" (3.10.2) returns
"one of the two unsigned binary integer values ... closest" (it should round to nearest), and the
test took only 16384. A sample the clear leaves now holds either code nearest 0.25 * 65535, each
still read within 1e-7 of its code; inside units stay exact. Metal's own code for this clear is not
recorded.

The runtime README's KosmicKrisp bullet in the known gaps of blit encoders (353bf003e8) described a
driver fault that is not one, and goes. The module docs' list items no longer open with a link
followed by a colon, which clippy under --cfg m2v_gpu and m2v_cpu_icd read as a link reference
definition (doc_nested_refdefs; job m3-max-86330 at 9e6ec32898).

Test and docs only: no version bump; the runtime-sources pin is unchanged (3b7da9e9...). Verified by
the jobs named on landing.
2026-12-03 17:53:47 -08:00
Anees Iqbal 2bc14c3443 Multisample bytes test: the 4-sample Depth16Unorm region row in a test of its own, beside the clear read with no copy
On KosmicKrisp (Mesa 26.3.1) on the Apple M3 Max the 4 x 3 Depth16Unorm region row fails (the
runtime README's known gaps of blit encoders), and since the M3 leg reads known gaps by exact test
name, that one row darkened the whole test there: its stencil rows, its whole-texture rows and the
128 x 128 all-codes row, which never ran on that device because the test stopped at the region row.

The row moves to every_device_reads_the_clear_of_a_multisample_16_bit_depth_alone_and_outside_a_region_copied_in,
beside a new row that clears the same 4-sample texture to 0.25 and reads every sample with no copy.
One run on the device tells which driver step leaves the outside samples' value: the clear (or the
fetch of a cleared image) if that row reads it too, the region's load and store if it reads a code.
Each device's rows now all run and print what the kernel read (M2V-READ: the count, the first, and
each distinct word read with its count) before any read is checked, so a failing row no longer hides
the rows after it.

Not widened: the clear's expectation stays code 16384, though Vulkan 3.10.2 also lets a device
convert 0.25 to 16383. Allowing it only outside the region needs the inside test bound apart
(several lines); the one-line form would also accept 16383 for an inside unit of value 16384, which
FragDepth's (c + 1/4) / 65535 does not allow.

Test only: no version bump; the runtime-sources pin is unchanged (3b7da9e9...). Verified by the jobs
named on landing: clippy plain and --cfg m2v_gpu, the rt suite on lavapipe, and one M3 leg.
2026-12-03 17:53:47 -08:00
Anees Iqbal bf519653bf Runtime README: the Mac host's conformance replay families not yet recorded, and a depth clear's conversion with no note
The M3's KosmicKrisp conformance replay at development c4bcc45c28 (job m3-max-86361) differs from
Metal's answers in 74 rows that known-gaps-rt.tsv does not list for that venue; it differed in none
at pin W (round 865592b96b). Three families: extended-swizzles of BGRA10_XR and BGR10_XR (44 rows),
the xr-blend, xr-gamut, xr-gradient and xr-masked cases (18), and half-texel-nans (12). The planner
ruled that pin X does not wait for them: the line says what is seen, not why, and the next pin
carries a fix or a recorded row with its cause per family.

A clear's depth conversion: KosmicKrisp clears a Depth16Unorm texture to 0.25 as code 16383 (M3
leg m3-max-86335: 0x3E7FFD00 = 16383/65535 on all 256 samples of a clear with no copy), which
Vulkan's fixed-point conversion allows; rounding to nearest gives 16384. No static note covers a
clear's conversion, so the README says so; none is built for this pin (planner). Docs only: no
version moves, and the runtime-sources pin is unchanged.
2026-12-03 17:50:35 -08:00
Anees Iqbal c4bcc45c28 Pin X bless: golden hashes, engine inventory, the mesh_simd printout, opened chains and the authored compile census
Blessed at 970e710e4c on the M3 (bless m3-max-86311: inventory, golden, printouts, link half and
opened chains each exit 0; census m3-max-86312, census-exit 0); development's tip 353bf003e8 adds
a README line alone, which moves none of these tables.

- golden_hashes.tsv and public_fixture_expectations_engine.tsv: the cells W..X moved (the
  attribution commit names each moving commit).
- air_input/mesh_simd.txt: the printout of the mesh branch's new fixture.
- opened_chains.txt: 28 contexts enable VK_EXT_mesh_shader with taskShader, meshShader and
  multiDrawIndirect (members +3, extensions +1); the two without the extension are unchanged.
- authored-compile.tsv: 322 rows (AUTHORED_COMPILE_CENSUS_VERSION 11), among them the two bicubic
  cases' 18 cells, compiled to not_supported{bicubic_texels}, and the mesh functions that now
  compile.
2026-12-03 17:37:45 -08:00
Anees Iqbal 353bf003e8 Runtime README: on KosmicKrisp the samples outside a region copied into a multisample Depth16Unorm texture do not keep their code
The Mac host's device leg (KosmicKrisp, Mesa 26.3.1, on the M3 Max) fails
tests::multisample_bytes' 4-sample Depth16Unorm part row since pin V (rounds at 133c992dad and
865592b96b, job m3-max-86090): 208 of 256 samples, exactly those outside the 4 x 3 region at
(2, 1), read 0x3E7FFFC0 (262143 / 2^20), which no 16-bit code gives (Vulkan 3.10.1: c / 65535;
16384 is 0x3E800080, 16383 0x3E7FFD00). Inside the region every code reads right, and the
whole-texture and stencil rows pass there.

The copy renders the region alone (rt blit/samples.rs: render area and scissor the region, the
depth loaded and stored); Vulkan's load and store operations update only values within the render
area (8.5 "Render Pass Load Operations", 8.6 "Render Pass Store Operations"), so the outside
samples keep the clear's code, as the RTX 3090, RX 7900 XTX, Iris Xe and lavapipe read them. A
files-only read (lane kkd16) found no path of ours that reads the outside samples in another
form: one OpImageFetch through one view reads inside and outside alike, and the copy-out reads
the region alone. Recorded as a known gap with no second form; which driver step leaves the
value (the clear, or the copy's load and store) is not isolated. Docs only: no version moves,
and the runtime-sources pin is unchanged.
2026-12-03 17:29:56 -08:00
Anees Iqbal 970e710e4c Runtime README: the XR branch's price says which cards measured before NoContraction
The line read as if the RTX 3090 and the RX 7900 XTX kept the map's operations uncontracted, a
per-card form. NoContraction is on every device (58988c6b83); those two cards' timings (85290,
85291) were taken before it, and all three cards' before the gather's nearest code. Docs only.
2026-12-03 17:22:50 -08:00
Anees Iqbal b01d5e529d Versions: ARTIFACT_FORMAT_VERSION 614 and RUNTIME_VERSION 2578 for the mesh pipeline
The mesh branch (devpolicy) bumped both past an older base; its rebase onto main/s3 and
then onto main/s4 collapsed them into the stack's own numbers (ARTIFACT 613 is the interface
deletions' 27a6c1ebd3, RUNTIME 2577 is s3's). Mesh changes the artifact encoding (its stage
facts and pipeline fields) and the runtime's behaviour (mesh states draw, the floor's mesh
features, a mesh draw under a past depth range refused as Viewport), so each takes the next
number. SEMANTICS 2383 is already past the stack's 2378. Stack staging only; no code moves.
2026-12-03 17:07:18 -08:00
Anees Iqbal 24dadff1ad Runtime README: on the RX 7900 XTX a mesh draw's cost is any task stage's, not the launcher's
The XTX's one-group launcher draw took 8 times a one-triangle vertex draw,
and the row could not say whether the launcher's shape or any task stage
costs it. The cost test's new row answers on the card: a one-group draw of
a state with an object function, whose task stage is the guest's
function, took 74,560 ns where the launcher's took 64,720 ns and the
triangle 7,920 ns. The known gap says so, and its XTX figures are now that
one run's: 8.2 times, and 1.39 times at M 256 against M 4 (221,120 and
159,280 ns; 2.39 ns a group).

Verified: RX 7900 XTX (RADV, Mesa 26.2.6), job 86149 at 50a3d29e17, carry
8840414fd2, mesh_costs_print_per_card unvalidated, medians of nine
command buffers.
2026-12-03 17:05:48 -08:00
Anees Iqbal e667052521 Runtime tests: the mesh cost test's doc comment wrapped at 100 columns
Comment only; no behaviour changes. Verified: cargo fmt --all.
2026-12-03 17:05:48 -08:00
Anees Iqbal df4d351048 Runtime tests: the mesh cost rows time a one-group draw of an object state too
On the RX 7900 XTX (RADV, Mesa 26.2.6, job 86024) a one-group mesh draw
through the launcher took 63,560 ns against a one-triangle vertex draw's
7,920 ns, 8.0 times; on the RTX 3090 it took 0.84 times. The row cannot
tell whether that cost is the launcher's shape or any task stage on that
driver. mesh_costs_print_per_card now also times a one-group draw of a
state with an object function (mesh_draws_object, 1 object thread), whose
task stage is the guest's function, not the launcher: printed as
"object 1 group N ns" beside the launcher's row. Nothing asserts on time.

Verified: see the job named in the handover.
2026-12-03 17:05:48 -08:00
Anees Iqbal 6b0f0ab72d Runtime: a mesh draw under a viewport depth range past [0, 1] is refused as Viewport
The handover from pr2627-c: the second of it and devpolicy to land carries
the mesh rule, the fold where the mesh function writes no per-primitive
viewport index and a typed refusal where it does, and until that fold
exists a mesh draw under a past range is refused as Viewport, under the
same row. pr2627-c landed first (1d6054b189), and its twin (d2a12e948c, in
the stack this branch now sits on) folds the range into a vertex function
alone, so a mesh draw has nothing to fold.

The encoder's route now answers DrawKind::Viewport for a mesh state where
the range shows, as it does under the Clamp mode, so a mesh draw reads its
refusal from the one field every draw reads and no twin is attempted. A
mesh state lowers none of its functions apart from its compile, so its
fragment function from AIR is taken to read [[position]]'s z or w
(Content::reads_position_depth, set when the content is made): its draws
under such a range are refused with or without a depth attachment, and a
fragment function the consumer compiled answers its own.

No red commit: rebased onto the twin, RenderPipelineState::folded already
answered Viewport for a state with no vertex descriptor (its let-else), so
a mesh draw was refused at bind_content before this change. The route
makes it the draw's one check and keeps the twin out of the mesh path.

Docs: set_viewport, DrawKind::Viewport, and the runtime README's twin
known gap and Gap::Draw list. docs/REFUSALS.md regenerated (no change
expected: the refusal's sites are the same). runtime-sources.sha256
re-pinned.

Test: tests::mesh_state::on_device::
a_mesh_draw_under_a_depth_range_past_0_1_is_refused draws a mesh state of
mesh_draws under [0, 2] (refused, Gap::Draw Viewport) and under [0, 1]
(drawn, one launch counted).

Verified: see the job named in the handover.
2026-12-03 17:05:48 -08:00
Anees Iqbal 1382f98b52 Runtime README: the mesh cases as compared on each GPU, and the form's costs
The mesh known gap said the lowering had never been compared with Metal
on a GPU. It now says what was: the conformance suite's 44 cases of mesh
pipelines, recorded on an M3 Max under macOS 27.0.1, replayed on lavapipe
(Mesa 26.2.4), the RTX 5080 Laptop (NVIDIA 615.71.09), the RTX 3090
(NVIDIA 620.70.06), the Radeon 780M and the RX 7900 XTX (RADV, Mesa
26.2.6), each answering 9 exact, 5 announced, 29 refused as the ledger
lists and 1 divergent: mesh-barrier-readers, whose fragment-stage
barriers the M3 answers outside its family's supported set (feature set
tables, note 3), so the header's order is kept. It names the device test
that draws an object grid past the task total in pieces, and the venues
it ran on, since no conformance case draws one.

The planner asked for the launcher's cost and the idle invocations' cost
at the state's maximum M as known-gap rows, on the RTX 3090 and the RX
7900 XTX, with the ratios: the 3090's one-group launcher draw is 0.84
times a one-triangle vertex draw and its 65,535 groups of 4 threads 1.01
times as long at M 128 as at M 4; the XTX's are 8.0 times and 1.39 times
(at M 256). The sentence that no replay stream or live session used one
is dropped: the bullet already says so.

Verified (jobs, carry b11f9ecd63 built at 19bf5ff006):
- lavapipe, mr6 85972: 9 exact, 5 announced, 1 divergent, 29 refused;
  ledger drift 0; the pieces test passed.
- RTX 5080 Laptop 85920, RTX 3090 85935, Radeon 780M 85955 (carry
  999b3e4cdf at 26d0420861): 9, 5, 1, 29 each; RX 7900 XTX 86024: the
  same.
- Pieces test (4,194,305 object threadgroups, one counted in pieces,
  nothing drawn whole) with the validation layer: RTX 3090 86010, Radeon
  780M 86017, RX 7900 XTX 86024.
- Costs, mesh_costs_print_per_card unvalidated, medians of nine command
  buffers: RTX 3090 85935, RX 7900 XTX 86024.
2026-12-03 17:05:48 -08:00
Anees Iqbal ff6e54b4ae Conformance ledger: the mesh rows on the RX 7900 XTX
The RX 7900 XTX (RADV, Mesa 26.2.6) replayed the 44 cases of mesh
pipelines at 19bf5ff006 (job 86024, carry b11f9ecd63) and answered as the
RTX 5080 Laptop, the RTX 3090 and the Radeon 780M did: 9 exact, 5
announced, 1 divergent, 29 refused. Its 25 lines of drift are exactly the
rows those venues carry, so the same rows are written for the venue
"RX 7900 XTX": the ThreadgroupMemoryLength and IndirectObjectGrid
refusals, the two CommandTypes cases, the eight divergent sites of
mesh-barrier-readers with the reason quoting the header and note 3 of
the feature set tables, and the twelve mesh-limits cases refused at
maxTotalThreadsPerThreadgroup.

docs/CONFORMANCE-COVERAGE.md regenerated (coverage.py).

Verified: job 86024 printed the 25 lines these rows answer, and the same
job's device tests passed 8 of 8 with the validation layer. A replay of
this commit on the card, to show no drift, follows.
2026-12-03 17:05:48 -08:00
Anees Iqbal 1d1a16aaf6 Conformance ledger: the mesh rows on the Radeon 780M
The mesh replay on the Radeon 780M (RADV, Mesa 26.2.6), job m3-max-85955 at 26d0420861 with the
carried binaries, held the same 25 sites as the RTX 5080 Laptop and the RTX 3090 (jobs 85920 and
85935), case for case, site for site and answer for answer, and nothing else: 9 exact, 5
announced, 1 divergent (mesh-barrier-readers, the ruled rows), 29 refused. Those 25 rows come in
for venue 780M. The runtime's 7 mesh device tests passed there under the validation layer.

The RX 550 (RADV, Mesa 26.2.6), which lists no VK_EXT_mesh_shader, replayed the same 44 cases in
job m3-max-85949 with exit 0: 25 lacking the feature, 7 exact (the creations Metal refuses), 12
refused at the `*` rows, so no per-venue row fires on a venue without mesh stages.

docs/CONFORMANCE-COVERAGE.md is regenerated in this commit (coverage.py --check passes locally).
2026-12-03 17:05:47 -08:00
Anees Iqbal a889f97a7a Runtime tests: an object grid past the task total is drawn in pieces on each device
The mesh replays of this lane (lavapipe, RTX 5080 Laptop, RTX 3090, Radeon 780M; jobs 85712,
85920, 85935, 85955) counted 0 object grids in pieces on every card: no conformance case and no
device test drew an object grid past a device's task limits, so the multi-draw of host-written
records and the folded numbering by DrawIndex had run on no device. A form taken by a device's
limits needs evidence that it ran.

an_object_grid_past_the_task_total_draws_in_pieces draws 4,194,305 object threadgroups, past
the maxTaskWorkGroupTotalCount of 4,194,304 every committed mesh device reports (vulkaninfo on
each), with a descriptor stating one object thread so lavapipe runs it quickly. It asserts the
draw is counted in pieces and not whole, the command buffer completes (under the validation
layer where the device tests take it), and nothing is drawn: each object threadgroup launches
ctl.x + x by ctl.y mesh threadgroups and ctl is zero.

Verified: the next jobs run it on lavapipe and on each card.
2026-12-03 17:05:47 -08:00
Anees Iqbal e5a9b6d7d0 Conformance ledger: the mesh rows on NVIDIA
The mesh replay on the RTX 5080 Laptop (NVIDIA 615.71.09), job m3-max-85920 at 26d0420861 with
the carried binaries, held exactly the rows lavapipe holds and nothing else: 25 sites "not listed"
on this venue, every one the same case, site and answer as its llvmpipe row (IndirectObjectGrid
at the two indirect object draws, ThreadgroupMemoryLength at the lengths case, CommandTypes at
the two command cases, the tile getter at the 12 made mesh-limits states, and mesh-barrier-
readers' 8 fragment-to-* sites). Those 25 rows come in for venue NVIDIA.

The same run: 9 exact, 5 announced (the draw cases, under the device's native NaN encoding
note), 1 divergent (mesh-barrier-readers, the ruled rows), 29 refused; mesh-partial-barrier-
uniform is exact (its PredicationVote refusal is fixed in 0d7bbee12c). The runtime's 7 mesh
device tests passed there under the validation layer 1.4.363.0.

docs/CONFORMANCE-COVERAGE.md is regenerated in this commit (coverage.py --check passes locally).
2026-12-03 17:05:47 -08:00
Anees Iqbal a39a600f08 Runtime: a render state keeps its vertex descriptor as an Option, None for a mesh state
Clippy in job m3-max-85855 (26d0420861, plain) stopped the runtime's lib on
clippy::large_enum_variant: once Made::Mesh held nothing (34fbfcf33f), the enum was a 952-byte
RenderPipelineDescriptor beside an empty variant. The field is now
Option<RenderPipelineDescriptor>: Some for a state of newRenderPipelineStateWithDescriptor:, None
for a mesh state, of which the state keeps nothing. A vertex state is the size it was before the
mesh work, and no Box is allocated per state. The four readers match Some and None as they matched
the two variants.

Verified by the error text of 85855 only; the next job runs the three clippy configurations.
2026-12-03 17:05:47 -08:00
Anees Iqbal 6639653a97 Conformance ledger: the mesh rows as the runtime now answers, on lavapipe
The mesh cases were 49 rows of `*` refusing a call the runtime's side lacked (mesh_pipeline,
mesh_pipeline_limits, mesh_pipeline_for_commands, mesh_pipeline_bindings,
mesh_descriptor_facts). The adapter answers all five, and the lavapipe replay of job
m3-max-85712 (c6bd918103) read each of those rows as no longer held. They go, and the rows the
replay holds come in (47):

- `*`, the calls that make no pipeline: the mesh descriptor's label and binaryArchives (3 cases,
  the consumer's own, as the render descriptor's) and the two reflection cases' 8 option sites
  each (the consumer's own reflection).
- llvmpipe, the calls that make one, so a venue without mesh stages reads them as lacking the
  feature and holds no row (a `*` row there fails as no longer held, now lacks the feature):
  - IndirectObjectGrid at the indirect draw of mesh-object-draws and of
    mesh-barrier-indirect-object-reader (the step-4 ruling: refused at the draw);
  - ThreadgroupMemoryLength at indirect-mesh-commands-object-threadgroup-lengths' pipeline (the
    object function's [[threadgroup(n)]] argument, refused at the creation, as ruled);
  - CommandTypes at both mesh-commands cases' command buffer (the ICB ruling; its row's count:
    0 of 22 kept streams, jobs 85614/85615);
  - maxTotalThreadsPerThreadgroup, a tile getter, at 12 mesh-limits cases whose state is made
    (an M3 Max answers 0 there; the runtime makes no tile state);
  - mesh-barrier-readers, divergent at the attachment and drawn count of its four rows whose
    barrier names the fragment stage in afterStages. main's ruling: the documented answer stands.
    MTLRenderCommandEncoder.h says the barrier makes stores at or before afterStages coherent
    with loads at or after beforeStages, which the runtime does; the M3 recorded the reader
    without the fragment's words, and the Metal Feature Set Tables (October 23, 2026, note 3)
    say Apple3 through Apple11 GPUs don't support barriers with the fragment stage in after.

The other mesh rows stay: function facts, the pipeline handler pair, the binary archive adder
and the visible-table stages answer as before. mesh-partial-barrier-uniform holds no row: its
PredicationVote refusal is fixed in 0d7bbee12c. The GPU venues' rows follow their runs.

docs/CONFORMANCE-COVERAGE.md is regenerated in this commit (coverage.py --check passes locally).
2026-12-03 17:05:47 -08:00
Anees Iqbal 822b869f23 Runtime: a mesh state whose walk votes in a workgroup word is made
The lavapipe conformance replay of job m3-max-85712 (c6bd918103) refused mesh-partial-barrier-
uniform at case/pipeline: "a render pipeline state with DrawInput { cause: RuntimeFact { fact:
\"PredicationVote\" } } is not built". Its object or mesh function holds a workgroup barrier in a
loop that part of the threadgroup skips, so its predicated walk votes in a workgroup word of its
own beside the arena (lower::simd::divergent). The translator counts that word against the
stage's workgroup memory at the creation and refuses a function whose word does not fit
(divergent.rs, mesh::workgroup_limit). A compute state supplies the fact by counting the word
against threadgroup lengths a dispatch sets; a mesh state answers no threadgroup memory length
and takes no length from a draw, so the render state's fact check now accepts it for a mesh
state, as it accepts the other facts of an object or mesh function.

The check is the conformance case itself: mesh-partial-barrier-uniform compares on the next
replay (lavapipe in CI, and the GPU runs of this lane).
2026-12-03 17:05:47 -08:00
Anees Iqbal 132e7a16c6 Conformance: a made mesh state's sites are its own method, so the coverage reads its Field
Job m3-max-85712 (c6bd918103) failed conformance_coverage's
the_conformance_coverage_document_is_what_the_sources_derive: MeshStateLimits'
max_total_threads_per_threadgroup became a Field in the adapter commit, and the coverage
generator finds a Field's leaf only as `Node::leaf("site", field(&self.x, ..))`. The node
recorded it through `state.` inside Creation<MeshStateLimits>::node.

The made state's leaves move to MeshStateLimits::with_sites (&self), in the same order and with
the same values; the creation's node adds them where the state was made. docs/CONFORMANCE-
COVERAGE.md is regenerated: MeshDescriptorFacts (label, binary_archives) and MeshStateLimits
(max_total_threads_per_threadgroup) join the table of refusable fields.

Verified: `python3 -I -B scripts/conformance-coverage/coverage.py --check` passes on this tree
(run locally, no cargo); the conformance suite runs in the next job.
2026-12-03 17:05:47 -08:00
Anees Iqbal 60e30f5196 Runtime: a mesh state keeps nothing of its descriptor, and the group counts fill by fixed chunks
Clippy in job m3-max-85712 (c6bd918103, plain, m2v_gpu and m2v_cpu_icd alike) stopped the
runtime's lib on two errors:

- dead_code: Made::Mesh held the MeshPipelineDescriptor, which only a test helper read. A vertex
  state keeps its descriptor because a pass makes its content again from it (for_pass); no pass
  does that for a mesh state. Made::Mesh is now a unit variant, and the test helper says a mesh
  state keeps no vertex or fragment function (rule 4: nothing unused is kept).
- clippy::chunks_exact_to_as_chunks in mesh_draw::count_bytes: the three counts now go through
  as_chunks_mut::<4>(), the same bytes.

Verified by the error text of 85712 only; the next job runs the three clippy configurations.
2026-12-03 17:05:46 -08:00
Anees Iqbal 45e0a733bd Runtime tests: a mesh draw of 3 by 1 threads rounds both axes down, and the two thread maxima are applied
Job m3-max-85712 (the lane's check at c6bd918103, built on msi) failed two runtime tests:

- tests::mesh_draw::a_mesh_draw_gives_metal_s_counts_and_regions, row 2: a drawMeshThreads of
  (3, 1, 1) threads with mesh threadgroups of (4, 2, 1) and no object function gives counts
  (0, 0, 1), each axis rounded down (3/4 and 1/2), as the code does and as Metal drew nothing
  for grid-threads-3x1-by-4 in the recording mesh-grid-draws. The row expected (0, 1, 1), as if
  the threadgroup were one thread tall. The expectation is fixed; the draw was already empty.
- tests::translator_fields: GraphicsState::max_total_threads_per_object_threadgroup and
  max_total_threads_per_mesh_threadgroup, added by the translator's mesh maxima, had no
  verdict. Both are Applied: render.rs reads them to make each stage's capped maximum.

Verified by the failure text of 85712 only; the next job runs both tests.
2026-12-03 17:05:46 -08:00
Anees Iqbal 127c824380 Conformance probe: a mesh descriptor that states 1024 threads for each stage
The planner asked, before READY, what a Mac's mesh state answers for
maxTotalThreadsPerObjectThreadgroup and maxTotalThreadsPerMeshThreadgroup when the descriptor
states nothing and when it states 1024, so the runtime's default maximum matches what a guest
reads. The probe had `plain` (nothing stated) and no 1024 case; it gains `max-1024-1024`.

Measured on the M3 Max under macOS 27.0.1 (26A434), job m3-max-85757, each case a first
compile (a new salt), the same salt again, and for `plain` and `max-1024-1024` unsalted:
`plain` answers 1024 and 1024, `max-1024-1024` 1024 and 1024, `max-64-32` 64 and 32, and
`no-object` 3 and 1024, every run alike. The runtime's default, 1024 capped by the stage's
Vulkan limit, is Metal's answer for both.

The conformance recording mesh-limits-plain holds 128 and 128 because the suite records each
thread maximum as the least of the answer and THREAD_FLOOR (128) on both sides
(pipeline_limits.rs, "The thread maxima are compared up to Vulkan's floor"): Metal's 1024 is
stored as 128, and the runtime's answer is floored alike. It stays as recorded.
2026-12-03 17:05:46 -08:00
Anees Iqbal dd6c0baabc Docs: five doc comments of the mesh work wrapped at 100 columns
The mesh floor's extension list, the object stage's thread maximum, the mesh draw module, the
conformance descriptor reads and the replay's form counters each carried a doc line past the
tree's 100 columns, written in this lane's earlier commits. Rewrapped; no word changes.

Verified: the diff is whitespace and line breaks in comments only.
2026-12-03 17:05:46 -08:00
Anees Iqbal 47d3946998 Runtime docs: what starts the build of an object or mesh function's threadgroup memory
An object or mesh function with a [[threadgroup(n)]] argument stays refused at the creation
(Gap::RenderPipeline): setObjectThreadgroupMemoryLength:atIndex: and its mesh form are not built.
The known gap now says what starts that build: the first replay stream, consumer walk or guest
that makes a mesh state whose object or mesh function declares such an argument. The stream
greps of this lane found no stream making a mesh state (jobs 84938 and 85231: 25 kept streams,
0 naming newRenderPipelineStateWithMeshDescriptor, a mesh draw or setObjectThreadgroupMemoryLength).

Docs only; the paragraph's tail is reflowed to 100 columns. Verified: the README diff alone.
2026-12-03 17:05:46 -08:00
Anees Iqbal f8d8f4a51a Runtime tests: the mesh form's costs, printed per card
Before READY the planner asked for the launcher's cost and the cost of a stage's
workgroup at the state's maximum M, one card per vendor, as known-gap rows.
mesh_costs_print_per_card (m2v_gpu, ignored; run under
METAL2VULKAN_TEST_UNVALIDATED=1 with --run-ignored only, once per card) times,
as the median GPU time of nine command buffers after two unmeasured:

- a mesh-only draw of 1 group (the launcher's task workgroup and one mesh
  workgroup) against a 1-triangle draw of a vertex state on the same kind of
  pass: the launcher's fixed cost;
- 65,535 groups of 4 threads on a state at its default M (capped by the
  device) and on one at M 4: the idle invocations' cost, as a ratio;
- the time per group between 1 and 65,535 groups at the default M.

It prints one "mesh_costs:" row per device and asserts nothing about time
(main: no test-only link, the cheap launcher row, lavapipe left out).

Verified: JOBLINE
2026-12-03 17:05:46 -08:00
Anees Iqbal a5a7142fba Runtime: each recorded mesh draw is counted by its form
Condition 7 asks for the path's counter on each venue the mesh cases run on.
Three new metrics count each recorded mesh draw by the form it took:

- Metrics::mesh_draws_launched: a state without an object function, one task
  workgroup of its launcher (direct and indirect draws);
- Metrics::mesh_object_grids_whole: an object grid within the task limits, one
  vkCmdDrawMeshTasksEXT of its counts;
- Metrics::mesh_object_grids_in_pieces: an object grid past them, one
  vkCmdDrawMeshTasksIndirectEXT of its pieces.

A grid the host knows is empty records nothing and is not counted. The
conformance replay prints, for each case that drew any, "mesh forms: CASE on
DEVICE: a launched, b object grids whole, c in pieces", beside its other form
lines; no verdict reads it. The lavapipe device test a_mesh_draw_draws_metal_s_grids
asserts the count of each draw's form. The README's mesh line and
draw_mesh_threadgroups' doc name the three; signatures blessed.

Verified: JOBLINE
2026-12-03 17:05:46 -08:00
Anees Iqbal 4964047ba2 Runtime docs: the venues without mesh stages, and each card's mesh limits
The runtime README's Mesh stages section names the four venues that list no
VK_EXT_mesh_shader, where a mesh render pipeline state is refused
(Unsupported{MeshShading}): the Radeon RX 550 (RADV, Mesa 26.2.6), the Iris Xe
(ANV, Mesa 26.2.6), and the M3 Max under KosmicKrisp (Mesa 26.3.1) and MoltenVK
(1.4.2). A table gives the others' limits that decide a mesh draw: the task
grid (count and total), the task and mesh invocations and width, and
maxTaskPayloadAndSharedMemorySize:

- RTX 3090, RTX 2080 (NVIDIA 620.70.06); RTX 5080 Laptop (NVIDIA 615.71.09):
  task (4194304, 65535, 65535), total 4194304; 128 task, 128 mesh; 32768.
- RX 7900 XTX, Radeon 780M (RADV, Mesa 26.2.6): task (65535, 65535, 65535),
  total 4194304; 1024 task, 256 mesh; 65536.
- lavapipe (Mesa 26.2.4 and 26.2.6): task 65536 per axis, total 4194304;
  1024 and 1024; 32768.

It then says what the caps mean: the NVIDIA cards answer at most 128 for each
stage where Metal answers up to 1,024, a larger threadgroup's draw is
Limit::MeshThreadgroupThreads, and the AMD cards cap the mesh stage at 256.
These are the CAP ruling's known-gap rows.

Verified: docs only; each number read from vulkaninfo on that card.
2026-12-03 17:05:45 -08:00
Anees Iqbal 07d9577c20 Translator and runtime: the mesh stages no longer require drawIndirectCount
Since the step-4 ruling no mesh draw reads a GPU-written draw count: an
indirect draw of an object function is the runtime's refusal at the draw
(DrawKind::IndirectObjectGrid), a mesh-only indirect draw is the launcher's one
task workgroup (vkCmdDrawMeshTasksEXT(1, 1, 1)), and an object grid's pieces past
the task limits take a host-written count through multiDrawIndirect. Rule 4
(anything unused is deleted) drops it, as the planner ruled through main:

- lower::mesh::FEATURES and floor::MESH_STAGES hold taskShader, meshShader and
  multiDrawIndirect; device creation enables VK_EXT_mesh_shader with those
  three where the device reports all three.
- The cond-1 tests iterate the three; the floor test also shows a device
  without drawIndirectCount given the mesh stages, and the device test no
  longer reads it.
- The README's Mesh stages section and its extension row, docs/API.md, the
  compile_mesh_pipeline and new_mesh_render_pipeline_state docs, and the
  requirement's own doc say three.
- SEMANTICS_VERSION 2370 (placeholder; main renumbers): the MeshShading
  refusal's needs change on a profile without drawIndirectCount (the M3 Max
  under MoltenVK reports it false).

No lab device changes: every card that lists VK_EXT_mesh_shader reports
drawIndirectCount (vulkaninfo on the RTX 3090, RTX 2080, RTX 5080 Laptop,
RX 7900 XTX, Radeon 780M and lavapipe). REFUSALS.md and the signatures were
regenerated and did not move; the runtime sources pin was rewritten.

Verified: JOBLINE
2026-12-03 17:05:45 -08:00
Anees Iqbal ab493847c9 Translator tests: a device without drawIndirectCount takes the mesh stages (red)
Since the step-4 ruling no mesh draw reads a GPU-written draw count: an
indirect draw of an object function is the runtime's refusal at the draw, a
mesh-only one is the launcher's one task workgroup, and an object grid's pieces
take a host count through multiDrawIndirect. The new test compiles every object
and mesh function of mesh_order and mesh_outputs, and mesh_draws' pipeline with
and without its object function, on each committed profile that lists
VK_EXT_mesh_shader, with drawIndirectCount removed from the device. It fails
until lower::mesh::FEATURES stops requiring the feature.

Verified: JOBLINE
2026-12-03 17:05:45 -08:00
Anees Iqbal 3ab8bcd357 Conformance: the runtime's side answers the mesh pipeline calls
The rt side answered every mesh call with Unavailable. It now answers them
through the runtime's mesh render pipeline states (new module rt_side/mesh.rs):

- mesh_pipeline and mesh_pipeline_for_commands: new_mesh_render_pipeline_state
  of the case's object, mesh and fragment functions over RGBA32Uint colour
  attachments, the second with support_indirect_command_buffers set.
- mesh_pass: one pass over the targets, each cleared to zero and stored, every
  step encoded whatever an earlier one answered (the set_object_*,
  set_mesh_*, set_fragment_buffer, draw_mesh_threadgroups, draw_mesh_threads
  and draw_mesh_threadgroups_indirect calls; both barrier forms are the
  runtime's memory_barrier, whose doc names both), committed and waited for
  within WAIT; the states it set announce their notes.
- mesh_pipeline_limits: the descriptor's limits with rasterization disabled,
  the state's answers floored as the Metal side floors them, or Metal's
  refusal where the runtime's error is one (refuses_as_metal, now shared).
- mesh_descriptor_facts: the translator's MeshPipelineDescriptor stated and
  read through descriptor_reads (new state_mesh and read_mesh; the colour
  attachments' stating and reading are now one helper each, shared with the
  render walk).
- mesh_pipeline_bindings: the consumer's own (reflection_is_the_consumers).
- mesh_command_buffer: the runtime's indirect command buffer of both mesh draw
  types, which it refuses as CommandTypes (the planner's ruling: not built).

Three getters the runtime has no counterpart of become fields a side refuses
alone, the other getters still compared, as the render facts already do: a mesh
descriptor's label and binaryArchives, and a mesh state's
maxTotalThreadsPerThreadgroup (a tile threadgroup's). The Metal side answers
each as Ok, so the recordings' sites are unchanged.

The answered-calls test gains the five mesh calls with a case that reaches each.

Verified: JOBLINE
2026-12-03 17:05:45 -08:00
Anees Iqbal c2a7d6f0fe Runtime docs: mesh draw commands in an indirect command buffer stay CommandTypes
The runtime README's known gaps of indirect command buffers gain a line for
MTLIndirectCommandTypeDrawMeshThreadgroups and MTLIndirectCommandTypeDrawMeshThreads:
refused as IndirectCommandsKind::CommandTypes, and what lifts them. Two general
gaps come first, because the conformance suite's three mesh command cases
(mesh-commands-own-state, mesh-commands-unordered-draws and
indirect-mesh-commands-object-threadgroup-lengths) each set their own pipeline
state (CommandPipelines) and are encoded by the CPU, which is not built. With
both built, the mesh types take a command layout of their own
(VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_MESH_TASKS_EXT) carrying the draw's group
counts and threadgroup sizes. CommandTypes' doc comment names the two mesh types
and the same order.

This is the planner's ruling on the mesh indirect command buffers: they stay a
typed refusal, not built in the mesh lane.

Verified: docs only. docs/REFUSALS.md regenerated with refusal_surface.py and
unchanged (its row is Gap::IndirectCommandBuffers, not the kind); the runtime
sources pin is EQUAL; cargo fmt --all.
2026-12-03 17:05:45 -08:00
Anees Iqbal 28c2803429 Runtime: an indirect mesh draw of an object function is refused at the draw
What: a new DrawKind::IndirectObjectGrid. MeshCall::of refuses an indirect draw (MeshGrid::Indirect)
of a state with an object function with Gap::Draw of it, after the threadgroup checks and before
anything is recorded; draw_mesh_threadgroups_indirect's doc says so. Launch::Arguments, the
object grid's indirect command the previous commit drew, is deleted with its recording. An
indirect draw of a state without an object function is drawn through the launcher, as before.
The runtime README's mesh known gap records the refusal, where Metal draws, and that no guest has
met it (no replay stream or live session has used a mesh state).

Why: the planner's step-4 ruling. An object grid the GPU reads may lie past the device's task
limits (maxTaskWorkGroupCount, maxTaskWorkGroupTotalCount), where it runs in pieces whose number
only the counts decide; the runtime reads no GPU word on the host (condition 6) and no command
inside the pass can write the pieces' records (condition 5), and Vulkan leaves a task grid past
the limits undefined (VUID-VkDrawMeshTasksIndirectCommandEXT-TaskEXT-07322).

Tests: the parent's red tests pass here, narrowed to the kind: the no-device
tests::mesh_draw::an_indirect_draw_of_an_object_function_is_refused_at_the_draw and the lavapipe
draw test's indirect draw of mesh_draws' object state. docs/REFUSALS.md, error/basis.rs and
api_signatures.tsv are regenerated.

Verified: JOBLINE
2026-12-03 17:05:44 -08:00
Anees Iqbal a838dfb8db Runtime tests: red, an indirect mesh draw of an object function is refused at the draw
What: tests::mesh_draw::an_indirect_draw_of_an_object_function_is_refused_at_the_draw asks
MeshCall::of for an indirect draw of a state with an object function and expects a
Gap::Draw; the lavapipe draw test asks the encoder's draw_mesh_threadgroups_indirect of
mesh_draws' object state and expects the same, before anything is recorded. Both fail at this
commit: the draw records the object grid's indirect command from the GPU's counts, which is right
only within the device's task limits.

Why: the planner's step-4 ruling, red first: an indirect draw of an object pipeline is a typed
refusal at the draw. The next commit makes it.

Verified: JOBLINE (expected to fail here)
2026-12-03 17:05:44 -08:00
Anees Iqbal a5624a650f Runtime: a mesh render pipeline state draws drawMeshThreadgroupsWithIndirectBuffer
What: RenderCommandEncoder::draw_mesh_threadgroups_indirect, Metal's
drawMeshThreadgroupsWithIndirectBuffer:indirectBufferOffset:threadsPerObjectThreadgroup:
threadsPerMeshThreadgroup:. The arguments (Metal's MTLDispatchThreadgroupsIndirectArguments,
three u32s) are checked as a vertex draw's are (OtherDevice, IndirectOffset,
IndirectArgumentsPastEnd at 12 bytes, ArgumentPlace; the checks are now one helper,
arguments_checked, for both). The draw pushes the arguments' address as the group counts'
address, so nothing is written to the ring and nothing read back:

- without an object function the state's launcher reads the GPU's counts there and emits the mesh
  grid where Metal draws it, one task workgroup, vkCmdDrawMeshTasksEXT(1, 1, 1);
- with one, the arguments are the object grid's own indirect command, one
  vkCmdDrawMeshTasksIndirectEXT record (Vulkan's command is Metal's layout).

The buffer counts as the draw's read (its hazards, a Managed buffer's copy, kept until the command
buffer retires), as a vertex draw's arguments. Call::Mesh carries the arguments; mesh_draw gains
MeshGrid::Indirect and Launch::Arguments. README and docs/API.md say the indirect form is drawn.

Why: R3 of the mesh build. The object pipeline's indirect form is drawn here as the task grid's
indirect command, which is right only within the device's task limits; the planner's step-4
ruling refuses it at the draw, which the next two commits do red-first.

Tests: tests::mesh_draw adds the indirect calls' counts, regions and launches; the lavapipe draw
test adds three indirect draws through the launcher: 3 groups by 8 at offset 8 (the M3's
grid-indirect-3x1-by-8 pixels and words), and an axis of 65,536 and 1024 by 1024, which draw
nothing, as on the M3. api_signatures.tsv and docs/REFUSALS.md are regenerated.

Verified: JOBLINE
2026-12-03 17:05:44 -08:00
Anees Iqbal 14a935e73d Docs: a mesh stage's default thread maximum of 1024 is as an M3 recorded it
What: GraphicsState::max_total_threads_per_object_threadgroup's doc, docs/API.md's mesh
pipelines section and RenderPipelineState::max_total_threads_per_object_threadgroup's doc now
say the rule's last step, 1024 where neither the descriptor nor the function states a maximum,
is as an M3 recorded it (an M3 Max, macOS 27.0.1, a first compile, the conformance probe
mesh_pipeline_limits.m), and that Metal's headers state no default.

Why: the planner's wording ruling on T9: the value is measured, and the doc says where from.

Verified: comment and doc text only; cargo fmt; runtime-sources.sha256 unchanged (the pinned
set holds none of these files).
2026-12-03 17:05:44 -08:00
Anees Iqbal a08a4fd1da Runtime: mesh render pipeline states draw drawMeshThreadgroups and drawMeshThreads
What: the render encoder binds the object and mesh functions' tables (set_object_* and
set_mesh_*: buffer, buffer offset, bytes, texture, sampler state with and without LOD clamps) and
draws a mesh state directly: draw_mesh_threadgroups and draw_mesh_threads. The device loads
VK_EXT_mesh_shader's commands where it enabled the extension (Core::mesh). A new module,
mesh_draw, holds the draw's grid:

- each threadgroup is checked against Metal's maximum for its stage (Refusal::ThreadgroupSize for
  no threads or past it) and then against the state's capped maximum, a new
  Limit::MeshThreadgroupThreads naming the stage, the size, the state's maximum, the Vulkan limit
  that holds it (a new public WorkGroupLimit, maxTaskWorkGroupInvocations, maxTaskWorkGroupSize[0]
  or their mesh siblings) and that limit's value, counted in a new
  Metrics::mesh_threadgroups_past_device. The object size is read only where the state has an
  object function.
- the draw writes three group counts into the ring and pushes their address
  (GroupCountsAddress), and writes each stage's DispatchRegion: the mesh stage's L, and the object
  stage's L with Metal's threads per grid and the partial flag for a draw of threads (no grid for
  a draw of threadgroups, so the object function's is counts times L).
- without an object function the counts are the mesh grid (a draw of threads rounds it down, as
  the M3 recorded in mesh-grid-draws), and the draw is the launcher's one task workgroup,
  vkCmdDrawMeshTasksEXT(1, 1, 1).
- with one, an object grid within the task limits is one vkCmdDrawMeshTasksEXT of its counts;
  past them it runs in pieces of the most workgroups the limits allow, one piece directly and more
  as one vkCmdDrawMeshTasksIndirectEXT whose records lie in the ring (stride 12), the folded object
  function numbering them by DrawIndex. More pieces than one ring chunk holds (5,461) is a new
  Limit::ObjectThreadgroups.
- an empty grid records nothing; a mesh draw with a vertex function's state is Refusal::MeshDraw,
  whose doc now covers both directions.

Each mesh draw fills its push bytes and blocks (its counts and regions are its own); it records
no topology (a mesh pipeline holds no input assembly, which leaves the recorded topology as it
was) and biases as triangles. No draw ends the pass and nothing reads a GPU word back
(conditions 5 and 6 for direct draws). The indirect mesh draw is not built yet: the README's known
gap says so, and the consumer refuses it itself.

Why: R2 of the mesh build, direct draws, in the ruled order after the state (R1b).

Tests: tests::mesh_draw (no device) checks the size refusals and the limit with its Vulkan names,
each call's counts, regions and launch against the region helpers, and the pieces on the 780M's
and the RTX 50's task grids (cover, minimality, the chunk limit). tests::mesh_state's new device
test draws mesh_draws' states into two RGBA32Uint targets and compares every pixel with the
fixture's words, which match the M3's recordings (mesh-grid-draws, mesh-object-draws): through the
launcher (3x2 groups by 4, 7x5 threads by 2x2), through the object function (2 groups of 2, 3
threads of 2 with a partial threadgroup), empty grids, and the refusals. It also prints each
device's task and mesh limits for the known gaps' per-card table. docs/REFUSALS.md, error/basis.rs
and api_signatures.tsv are regenerated; README and docs/API.md state the direct draws.

Verified: JOBLINE
2026-12-03 17:05:44 -08:00
Anees Iqbal b92932f1eb Runtime: MeshDraw's message, and the tests' tables at four
What: Refusal's Display names MeshDraw. The indirect test's Draws and the render offsets tests
take four tables (crate::render::TABLES) where they wrote two.

Why: m3-max-85433 at ce095262a1 failed clippy (plain): Refusal's Display match did not cover
MeshDraw, and three test literals still had two tables after 06c4155ad9 made four. The device
cfg's render_offsets assertion on dirty_offsets is the fourth such literal.

Verified: the four places clippy named, and the one device-cfg literal of the same kind found by
grep. The next job's clippy steps read them.
2026-12-03 17:05:43 -08:00
Anees Iqbal 3d55fb8511 Runtime: the floor's public mesh docs name the four features, not the private MESH_STAGES
What: the docs of MESH_EXTENSIONS, the floor's mesh feature field and its extension list name
taskShader, meshShader, multiDrawIndirect and drawIndirectCount in place of a link to the
crate-private MESH_STAGES.

Why: RUSTDOCFLAGS='-D warnings' cargo doc refused three public docs that linked a private item
(m3-max-85346, rustdoc EXIT=101, at bf42fe0b82); public docs never link to private items.

Verified: the three lines rustdoc named are the three changed. The next job's rustdoc step reads
them.
2026-12-03 17:05:43 -08:00
Anees Iqbal 36a93dc7ec Runtime: a mesh render pipeline state is made, with its VkPipeline and Metal's thread and grid answers
What: Device::new_mesh_render_pipeline_state(&MeshPipelineDescriptor, sampler_ids) makes a
RenderPipelineState of a mesh descriptor.
- The content is compiled with compile_mesh_pipeline at each creation. The translator gives no
  key of a mesh descriptor before its compile, so neither the map of contents nor the cache
  directory holds one.
- The draw tables become four: VERTEX, FRAGMENT, OBJECT and MESH, in Draws, OffsetLayout and the
  render encoder's tables, blocks and dirty offsets.
- draws() maps the object stage (or the launcher) and the mesh stage to their tables, takes their
  threadgroup facts, and maps DispatchRegion, GroupCountsAddress (new FieldValue::GroupCounts) and
  the mesh stage's layer and viewport counts.
- MeshThreads holds each stage's answer: the translator's stated maximum capped by
  maxTask/MeshWorkGroupInvocations and maxTask/MeshWorkGroupSize[0]. Its workgroup is that answer
  in one row, rounded up to the stages' LocalSizeConstraint multiple.
- stage_module specializes ObjectLocalSize/ObjectFlatLocalSize, with ObjectMultiRegion 1, and
  LocalSize/FlatLocalSize, with MultiRegion 0, to the two workgroups. A threadgroup memory length
  stays refused.
- make() gives a mesh pipeline no vertex input or input assembly, and drops PRIMITIVE_TOPOLOGY and
  PRIMITIVE_RESTART_ENABLE from its dynamic states (VUID-VkGraphicsPipelineCreateInfo-
  pDynamicStates-07065 and -07066).
- The state answers maxTotalThreadsPerObjectThreadgroup, maxTotalThreadsPerMeshThreadgroup,
  objectThreadExecutionWidth and meshThreadExecutionWidth (32), maxTotalThreadgroupsPerMeshGrid
  (the descriptor's, else 1,048,576) and both required sizes. A state without an object function
  answers 0 for its object stage, as docs/API.md's accepted differences say.
- New Refusal::MeshDraw (basis: ours) refuses a draw of primitives or patches, or an execution of
  an indirect command buffer, with a mesh state (VUID-vkCmdDraw-stage-06481). The encoder records
  no mesh draw yet; that is the next step.
- The runtime re-exports MeshPipelineDescriptor.

Why: step 2 of the ruled order (floor, state, direct, indirect, ICB, adapter), under the planner's
cap ruling: a made state answers the capped maxima.

Docs: the README's known gap now says mesh states are made and not drawn, each creation compiles,
threadgroup memory arguments are refused, and the maxima are capped. The stale identity-domains
bullet for object and mesh functions is deleted: 2761e27594 removed that refusal. docs/API.md is
updated. docs/REFUSALS.md and error/basis.rs are regenerated. api_signatures.tsv is blessed: new
runtime methods, the refusal and the re-export, with nothing removed.

Tests: tests::mesh_state, under a device cfg, on every device of the cfg's kind. Where the device
has the mesh set:
- mesh_pipeline_limits' four states (nothing stated; 64, 32 and grid 8; without an object
  function, with and without grid 8) are made with their VkPipeline and answer the capped maxima;
- a draw of primitives with one is Refusal::MeshDraw;
- mesh_draws' rasterizing states into two RGBA32Uint colours, with and without the object
  function, make their VkPipeline.
Elsewhere each state is refused naming MeshShading.
2026-12-03 17:05:43 -08:00
Anees Iqbal 7fa5ab461e Translator: a mesh stage's stated maximum is its required size's threads first, as Metal answers it
What: stated_threads takes the descriptor's required threadgroup size for the stage first: its
threads, then the descriptor's maximum, then the function's attribute, then 1024. mesh_fields
keys both required sizes, since the stated maxima now depend on them. The doc comments say where
each part of the rule was measured.

Why: the conformance probe mesh_pipeline_limits.m, measured on an M3 Max under macOS 27.0.1 with
each case a first compile, records the rule:
- `plain`, with nothing stated, answers 1024 for both stages. That is the source of "else 1024".
- A required size answers its threads, even below a function's own maximum:
  required-object-32x2 answers 64, required-mesh-16x2 answers 32, and
  required-object-32-attribute-64 answers 32.
- A maximum or an attribute answers itself.
The parent commit left the required size out. The descriptor's doc said no limit depended on it,
which those rows contradict.

Tests: a_mesh_pipeline_states_its_thread_maxima_by_metal_s_rule adds three rows:
- (32,2,1) required for the object stage gives (64, 1024);
- (16,2,1) required for the mesh stage gives (1024, 32);
- mesh_outputs with (32,1,1) required for the object stage, whose function states 64, gives
  (32, 32).
The ARTIFACT_FORMAT_VERSION bump of the parent covers this, and every mesh pipeline's key moves.
api_signatures.tsv is re-blessed and unchanged.
2026-12-03 17:05:43 -08:00
Anees Iqbal ed873cf04b Tests: the floor's mesh-stage test iterates the four features, not their indices
What: mesh_stages_are_enabled_where_listed_with_all_four_features loops over MESH_STAGES' entries
in place of an index range.

Why: clippy's needless_range_loop refused the index loop under -D warnings (the runtime's lib
test target), so the clippy step of m3-max-85346 at bf42fe0b82 exited 101 on it alone.

Verified: the line clippy named; the loop's assertions are the same four. The next job's three
clippy steps read it.
2026-12-03 17:05:43 -08:00
Anees Iqbal 2ffddf5a56 Translator: a mesh render pipeline states each stage's thread maximum by Metal's rule
What: GraphicsState gains max_total_threads_per_object_threadgroup and
max_total_threads_per_mesh_threadgroup, both Option<u32>. compile_mesh_pipeline sets them by
Metal's rule, before any device limit: the descriptor's maximum where it states one, else the
function's [[max_total_threads_per_threadgroup(n)]], else 1024. The object one is None without an
object function; every vertex pipeline states neither. The cache codec encodes both.

Why: a mesh render pipeline state answers maxTotalThreadsPerObjectThreadgroup and
maxTotalThreadsPerMeshThreadgroup, and the runtime specializes each stage's workgroup to that
many threads (capped by the stage's device limits, per the planner's cap ruling). The function's
attribute lives only in its compile, so the runtime cannot read it from the descriptor; the
pipeline now states it, as a compute pipeline's metal_info states its kernel's.

ARTIFACT_FORMAT_VERSION 609 (a placeholder; the number is set at landing): GraphicsState's
encoding has two more fields. A digest omits a field at its default, so no vertex pipeline's
content digest moves; a mesh pipeline's does.

Tests: engine_mesh's a_mesh_pipeline_states_its_thread_maxima_by_metal_s_rule, on the first
committed profile with the mesh stages: mesh_pipeline_limits with nothing stated (1024, 1024),
with 64 and 32 stated (64, 32), its mesh function alone (none, 1024), and mesh_outputs, whose
object and mesh functions state 64 and 32 (64, 32). The codec round trip carries both fields.
docs/API.md's mesh pipelines section states the rule and what a consumer does with it.
api_signatures.tsv is blessed: two public fields added, nothing removed.
2026-12-03 17:05:43 -08:00
Anees Iqbal ecdce9a3b5 Translator: a mesh pipeline without an object function draws through a launcher task stage
What: link::mesh::Launcher. Link plans it for a mesh render pipeline without an object function.
Its push range is 8 bytes at the first offset no stage's range covers (tessellation's
push_offset; Unsupported{MeshShading} needing maxPushConstantsSize where none is free), and it
places its one field, PushField::GroupCountsAddress, as an object-stage placement, first in the
interface. compile_mesh_pipeline builds its module and puts it first among the stages, joining
its requirements:
- a TaskEXT entry of LocalSize 1 1 1 loads the three counts at the pushed address (4-aligned,
  Metal's MTLDispatchThreadgroupsIndirectArguments layout);
- it emits that grid where each axis is within Metal's measured 65,535 and the device's
  maxMeshWorkGroupCount, and the product within Metal's 1,048,575 and the device's
  maxMeshWorkGroupTotalCount, tested as an object function's wrapper tests its grid; past them
  it emits 0, 0, 0, so nothing is drawn, as Metal draws nothing;
- where the mesh function reads a payload, it declares an arena of that size
  (memory::arena::declare_payload) and emits it unwritten, as VUID-RuntimeSpirv-MeshEXT-12380
  requires.

Why: the planner's ruling on the mesh build, step 4, mesh-only pipelines. Every draw of such a
pipeline, direct or indirect, is then vkCmdDrawMeshTasksEXT(1, 1, 1) in its pass and in order:
for an indirect draw the address is the guest's buffer, so nothing is written before the pass,
and Metal's limits are held on the GPU. Direct draws take the same stage, with their counts
written to the ring, so the state has one form.

SEMANTICS_VERSION 2369 (a placeholder; the number is set at landing): a mesh-only pipeline gains a
stage. No function's own module moves.

Tests: the parent's red test passes. The identity-domains test checks each stage, the launcher
included, with spirv-val and the profile's requirements. docs/API.md's mesh pipelines section,
compile_mesh_pipeline's doc and the pipeline module docs describe the launcher.
runtime-sources.sha256 is unchanged.

Verified: see the job named below.
2026-12-03 17:05:43 -08:00
Anees Iqbal 52fb3de2c3 Tests: a mesh pipeline without an object function draws through a launcher task stage (red)
What: engine_mesh's a_mesh_pipeline_without_an_object_function_draws_through_a_launcher. On every
committed profile with the mesh stages, mesh_draws' pipeline without its object function has
three stages, TASK_EXT, MESH_EXT and FRAGMENT in that order, and places one push field for the
object stage, GroupCountsAddress (matched by name).

Why: the planner's ruling on the mesh build, step 4: a mesh-only pipeline draws through a task
stage of one invocation that reads the draw's group counts by address (the guest's buffer for an
indirect draw, the ring for a direct one) and launches that grid, and nothing past Metal's
measured limits; the draw is vkCmdDrawMeshTasksEXT(1, 1, 1), in the pass, in order.

Red: fails on every profile with the mesh stages: the pipeline has the mesh and fragment stages
alone.
2026-12-03 17:05:42 -08:00
Anees Iqbal 8a80dd27df Translator: an object function reads its draw's group counts at an address, the rest of its region pushed
What: a new push field, PushField::GroupCountsAddress: the device address of a draw's three
threadgroup counts in Metal's MTLDispatchThreadgroupsIndirectArguments layout (three u32s at a
multiple of 4). A folded object function, its one grid form, places it with its own
DispatchRegion, in place of the 32-byte record at ReplayRegionAddress:
- access::object_region builds the region the folded walk reads: the pushed DispatchRegion, its
  first xyz replaced by the counts read at the address (three 4-aligned loads);
  EmitCx::push_field routes a folded object function's DispatchRegion there
  (held_push_field loads a field as its block holds it);
- its threadgroups per grid are the counts, and its threads per grid the counts times L,
  wrapping as Metal's builtins do, or the region's grid where the draw states one (a draw of
  threads, whose partial flag the region carries as before);
- plan_replay places the two fields for a folded object function; a folded kernel, a flat
  variant and a replay variant keep their record;
- under the identity domains GroupCountsAddress is an admitted field, and ReplayRegionAddress
  is refused for every stage (its object exception is gone).

Why: the planner's ruling on the mesh build, point 5: the counts need nothing beside them, so a
draw can point the field at counts as an indirect buffer holds them, and the threads per grid
come from the pushed L.

SEMANTICS_VERSION 2368 (a placeholder; the number is set at landing): every object function's
module moves. The engine golden table's object cells on the profiles with the mesh stages move
with it; they wait for the bless at the next named pin.

Tests: the parent's red test passes. The push field ordering test places GroupCountsAddress
after DispatchRegion. The field's encoding (cache codec) and its shape (u64) are added;
tests/api_signatures.tsv gains the variant; docs/API.md's mesh pipelines section, the dispatch
module docs, LoweringInputs::folded_groups and RuntimeFact::FoldedGroups say what the object
function reads. runtime-sources.sha256 is re-pinned.

Verified: see the job named below.
2026-12-03 17:05:42 -08:00
Anees Iqbal e537cfb7f5 API signatures: the subgroup model's object and mesh stages and the runtime's mesh extension list
What: tests/api_signatures.tsv gains the five public items two earlier commits of this branch
added without the table: SubgroupModel's object and mesh fields (the stages' own subgroup facts)
and the runtime floor's MESH_EXTENSIONS with Features.mesh.

Why: signatures.py --check fails on a public item the table does not hold; the commits that made
them did not bless it.

Verified: python3 scripts/api-signatures/signatures.py --bless wrote exactly these five lines here
(and the next commit's push field, left to it).
2026-12-03 17:05:42 -08:00
Anees Iqbal ca90151363 Tests: an object function reads its draw's group counts at an address, its size from its region (red)
What: engine_mesh's an_object_function_reads_its_group_counts_at_an_address. On every committed
profile with the mesh stages, mesh_draws' pipeline with its object function places, for the
object stage, PushField::GroupCountsAddress and PushField::DispatchRegion, and no
PushField::ReplayRegionAddress. The fields are matched by name, since GroupCountsAddress does
not exist yet. The identity-domains test and the new one share mesh_draws_pipelines, which makes
the pipelines once per profile.

Why: the planner's ruling on the mesh build, point 5: an object function reads Metal's three
group counts (MTLDispatchThreadgroupsIndirectArguments) by address and computes its threads per
grid from the pushed threadgroup size, so the counts need nothing beside them. Today it reads a
32-byte record at ReplayRegionAddress holding the counts with L, the threads and the flags.

Red: fails on every profile with the mesh stages, since the object stage places
ReplayRegionAddress alone.
2026-12-03 17:05:42 -08:00
Anees Iqbal 3fba14db84 Validation tests: the census compiles the committed mesh and object cases' pipelines
The identity domains lower object and mesh functions since the identity
arm for them was deleted, so the authored compile census's one compile of
each committed mesh or object case's pipeline (lavapipe) now compiles
instead of being refused as not implemented under the identity domains.
The test that held the refusal now holds the compile; its name and doc
say so. A run's preparation still refuses those cases by
MeshRenderPipeline alone: no candidate draws a mesh pipeline yet.

Verified: the old assertion failed with outcome Ok(Compiled) for
a-mesh-grid-of-threadgroups-draws-through-its-fragment in m3-max-85222
(validation, lavapipe). The new form runs in the next job.
2026-12-03 17:05:42 -08:00
Anees Iqbal 17bd402d0c Runtime: device creation enables VK_EXT_mesh_shader with taskShader, meshShader, multiDrawIndirect and drawIndirectCount, all together or none
What: floor::MESH_EXTENSIONS (VK_EXT_mesh_shader) and floor::MESH_STAGES (taskShader, meshShader,
multiDrawIndirect, drawIndirectCount). The floor reads VkPhysicalDeviceMeshShaderFeaturesEXT from
a device that lists the extension. decide() enables the extension and all four features where
the device lists it and reports all four, and none of them otherwise. Device creation chains the
mesh structure where the extension is enabled. shader_enables states the four features and
ExtMeshShader to the translator. The README's Floor states the extension row and a Mesh stages
section with its table.

Why: condition 1 of the planner's ruling on the mesh build. The runtime enabled none of it, so
the translator's profile of every runtime device refused object and mesh functions. With this
commit, a device that offers the four gets them, and the translator's MeshShading query and
refusal (the translator commit before) decide the rest from what creation enabled. The four go
together because a mesh draw runs its grid as pieces of one multi-draw and an indirect one reads
its count of pieces from a buffer. No answer chooses a second form.

Tests: floor's mesh_stages_are_enabled_where_listed_with_all_four_features checks:
- at the floor, nothing is enabled;
- reported but not listed, nothing;
- listed and reported, the extension and all four, and the translator is told each;
- listed with any one of the four missing, none.
the_readme_states_the_floor holds the new rows to the code. Under a device cfg,
every_device_the_loader_lists_is_above_the_floor creates each device with the mesh structure
chained, and the device test expects the extension where the device reports all four.

Verified: see the job named below.
2026-12-03 17:05:41 -08:00
Anees Iqbal 763caf0270 Translator: object and mesh functions take their SIMD groups from the task and mesh stages' own subgroup facts
What: the profile's subgroup model now records the task and mesh stages (SubgroupModel::object
and ::mesh), read like the other stages from subgroupSupportedStages, the device's operation
classes, requiredSubgroupSizeStages under subgroupSizeControl, and the size range.
computeFullSubgroups gives full subgroups to the compute, task and mesh stages, as Vulkan says
("requiring full subgroups in compute, mesh, or task shaders"). STAGE_BITS names the two stages,
so a module's SubgroupStage and RequiredSubgroupSizeStage properties for them are in the enabled
capabilities. The stand-in that answered "no subgroups" for both stages (UNMODELED_STAGE) is
deleted.

subgroup::tier, width_needs, requirement and quad_free treat object and mesh functions as they
treat kernels (Stage::has_workgroup):
- full subgroups and a pinned 32 (Direct), or 64 or 128 split into 32-lane clusters;
- a local size multiple of that size, which dispatch::plan_kernel already states as
  RuntimeFact::LocalSizeConstraint for the flattened form;
- quads tiered as cross-lane quad operations;
- a quad-only function at the size the stage gives.
The emulated tier stays the kernels' alone. An object or mesh stage that pins no size and runs
below 32 lanes (lavapipe) refuses a SIMD-group function as Unsupported{SimdWidth}, naming
subgroupSizeControl, the stage's RequiredSubgroupSizeStage and its maxSubgroupSize. Quad
instructions stay kernel-only (lower::simd), so an object or mesh quad is a shuffle, and the
requirement derivation still asks subgroupQuadOperationsInAllStages of a quad instruction in the
task and mesh stages.

Why: conditions 2 and 3 of the planner's ruling on the mesh build. An object or mesh function's
SIMD groups run on the native subgroup. Its workgroup is its pipeline's stated maximum (the
condition 4 commit), made a multiple of the subgroup size, and the invocations past a draw's
threadgroup are not live, so a partial SIMD group has Metal's inactive lanes; no threadgroup
size is refused for not being whole SIMD groups. The planner ruled (a) for lavapipe: the typed
device-lack refusal, decided by those queries alone, with no emulated tier. Main fires that
ruling's trigger: a real card's profile that lists the mesh extension but lacks size control
for the task or mesh stage.

The stage facts extend the existing subgroup queries to two more stages; no form is added.
Every profile's fingerprint changes with its subgroup model. SEMANTICS_VERSION 2367 (a
placeholder for the number at landing): object and mesh functions of SIMD-group operations
compile where they were refused.

Tests: the parent's red test passes. The tier golden table gains the object and mesh columns:
- Direct on the AMD, Arc and RTX 50 profiles;
- a width refusal on lavapipe;
- missing operations where the device lists neither stage (Iris Xe, UHD 770, Pascal, MoltenVK,
  the runtime floor).
The invariants hold for object and mesh as for kernels.
object_and_mesh_stages_read_their_own_subgroup_facts checks the three queries apart on the
780M's description:
- a mesh stage outside requiredSubgroupSizeStages takes two 32-lane clusters of its 64 lanes
  while the task stage pins 32;
- without computeFullSubgroups both are refused naming it;
- without the task stage listed, an object function is refused naming it while a mesh function
  keeps Direct.
The narrow-subgroup and quad-only tests cover the two stages.
docs/API.md's mesh pipelines section states the stages' SIMD groups, the refusal and the quads.
runtime-sources.sha256 is re-pinned.

Reuse: the shape of this change was read in PR 25's device/subgroup.rs and device/derive.rs
(the model's two stages, STAGE_BITS, has_workgroup in tier, width_needs, requirement and
quad_free). Not taken: its change to the quad-instruction requirement, which would have dropped
subgroupQuadOperationsInAllStages for the task and mesh stages against Vulkan's "restricted to
fragment and compute stages", and its fixture and refusal.

Verified: see the job named below.
2026-12-03 17:05:41 -08:00
Anees Iqbal 4cac67a58a Tests: object and mesh functions run their SIMD groups on their stages' own subgroups (red)
What: engine_mesh's object_and_mesh_simdgroups_run_on_their_stages_subgroups, and the owned
fixture engine/mesh_simd (MSL compiled by scripts/regen-air-fixtures; TOOLCHAIN names it): an
object function and a mesh function of SIMD-group operations (simd_sum, the exclusive prefix
sum, simd_ballot, simd_shuffle_xor) and a quad-only object function (quad_shuffle_xor,
quad_broadcast of a constant lane, quad_sum), each writing one record a thread.

On every committed profile whose device lists VK_EXT_mesh_shader, each must compile to a module
that passes L3, states full subgroups and RuntimeFact::LocalSizeConstraint (a multiple of at
least 32 for the SIMD-group functions), and holds no OpGroupNonUniformQuadBroadcast or
OpGroupNonUniformQuadSwap. The exception is a stage that pins no size and runs subgroups below
32 lanes, where the SIMD-group functions must be refused as Unsupported{SimdWidth} naming
subgroupSizeControl, the stage's RequiredSubgroupSizeStage and its maxSubgroupSize. Only
lavapipe profiles may refuse.

Why: condition 3 of the planner's ruling on the mesh build: an object or mesh function's SIMD
groups run on the native subgroup, at a local size made a multiple of it. Condition 2: quads stay
kernel-only instructions, so no object or mesh module needs subgroupQuadOperationsInAllStages.
The planner's ruling (a): lavapipe's task and mesh stages pin no size and run 8 lanes, so they
get the typed device-lack refusal, with no emulated tier.

Red: today every profile refuses SIMD-group operations in object and mesh functions, because
the profile models no task or mesh subgroup facts.

Verified: see the job named below.
2026-12-03 17:05:41 -08:00
Anees Iqbal e649629fde Translator: the identity domains lower object and mesh functions; IdentityCause::ObjectOrMeshStage deleted
What: identity_refusal no longer refuses a function for being an object or mesh function, and it
takes an object function's PushField::ReplayRegionAddress, the address of the region record its
folded grid's draw pieces read (bind::mesh_arguments); that field stays refused for every other
stage. IdentityCause::ObjectOrMeshStage, which nothing produces now, is deleted.

Why: the mesh build. Every profile refused object and mesh functions under the identity
domains, the one form, so no mesh render pipeline compiled anywhere.

Public item removed (api_signatures.tsv): metal2vulkan::error::IdentityCause::ObjectOrMeshStage.
Consumer search: reims-vgpu development 35cea45c0e plus its 210 steelbrain refs younger than a
day: 0 hits for ObjectOrMeshStage.

SEMANTICS_VERSION 2366 (a placeholder; the number is set at landing): object and mesh functions
compile where they were refused.

Tests: the parent's red test passes; the validation companion's mesh pipelines compile where they
were refused; the linked reflection test's mesh pipeline compiles with its unwritten fragment
input dropped, as the tessellated one does. docs/API.md's cause list no longer names the
deleted cause; runtime-sources.sha256 is re-pinned.

Verified: see the job named below.
2026-12-03 17:05:41 -08:00
Anees Iqbal fbf7edb539 Tests: a mesh render pipeline compiles under the identity domains (red)
What: engine_mesh.rs, on every committed profile whose device lists VK_EXT_mesh_shader with
taskShader, meshShader, multiDrawIndirect and drawIndirectCount: the owned fixture mesh_draws'
mesh render pipeline, with and without its object function and with its fragment function
writing two RGBA32Uint colors, must compile, and each of its stages must pass L3 (spirv-val and
requirements within the profile).

Why: the mesh build makes the identity domains lower object and mesh functions. Today every
profile refuses them as Unsupported{IdentityDomains} of cause ObjectOrMeshStage, so this test
fails at this commit.

Verified: see the job named below.
2026-12-03 17:05:40 -08:00
Anees Iqbal b662250e62 Translator: an object or mesh function runs each draw's threadgroup within a workgroup of its stated maximum
What: lower::dispatch's threadgroups at the stated maximum (DispatchPlan::at_max, for the object
and mesh stages). The stage's workgroup is its pipeline's stated maximum (sx, sy, sz), which a
runtime specializes once when it makes the pipeline, and Metal's threadgroup of each draw is
always the region's nominal size L within it:
- region() takes L from the region whatever MultiRegion says, and the folded object function's
  position in the grid, its threads per grid and its partial threads take that L where a kernel
  takes (sx, sy, sz);
- every threadgroup answers the threads it runs, L or a partial object threadgroup's, so
  threads_per_threadgroup, the simdgroup and quadgroup counts and the position in the threadgroup
  are Metal's, and an invocation at or past their product is not live: it returns from the body
  before it starts, or walks the body predicated where the body holds a workgroup barrier;
- plan_partial_groups now plans the mesh stage too (its region is DispatchRegion; Metal never
  makes a mesh threadgroup partial, so it records no PartialObjectThreadgroups), and
  simd::divergent walks a mesh body predicated as an object body;
- the entry wrapper strides its slots over the workgroup's invocations (running_threads), not
  Metal's threads, since every invocation runs it: its barriers, OpEmitMeshTasksEXT and
  OpSetMeshOutputsEXT stay in uniform control flow;
- an object or mesh function whose predication vote word does not fit beside its arena is now
  refused as the arena's limit refuses it; it no longer drops to running whole threadgroups only.

Why: condition 4 of the planner's ruling on the mesh build: one pipeline per state, made at
creation at the stated maximum, with each draw's sizes pushed and the extra invocations ending at
once. Apple's header holds every draw to the pipeline's maximum ("The maximum size of the product
of threadsPerMeshThreadgroup that can be used for draws with this pipeline", and the same for the
object stage), and drawMeshThreads rounds a mesh grid down to whole threadgroups. The
MeshPipelineDescriptor doc that said a draw is not held to the maximum is corrected.

Kernels are unchanged: their builtins take (sx, sy, sz) as before, so no kernel module word
moves. Every profile refuses object and mesh functions under the identity domains today, so no
output moves either, and SEMANTICS_VERSION stays.

Tests: dispatch's threadgroups_at_the_stated_maximum_match_metal runs one module of a 64-thread
workgroup on the CPU interpreter, in both local-size forms and both modelled subgroup widths:
draws of threadgroups of 1 to 64 threads with the region's grid stated or all 0, and an object
function's partial threadgroups flagged, each Metal thread once among the live invocations with
Metal's builtins and the rest not live. runtime-sources.sha256 is re-pinned.

Verified: see the job named below.
2026-12-03 17:05:40 -08:00
Anees Iqbal 3e2e65ee1a Translator: an object function has one grid form, folded; the unfolded object grid is deleted
What: given_inputs compiles every object function folded (LoweringInputs::folded_groups), alone or
in a mesh render pipeline, so its draws run any object grid in pieces within the task stage's
limits (bind::mesh_arguments). The unfolded form is deleted: DispatchPlan::object_grid and the
decl's object_grid (an unfolded object function's threadgroups per grid, wrapped at 2^32),
lower::mesh::folds_object_grids with lower::mesh::mesh_stages, which only it called, and
compile_mesh_pipeline's choice between the two. The single-region builtins test keeps its kernel cases and drops the object grid's.

Why: condition 1 of the planner's ruling on the mesh build: one grid form, no device-chosen
second one. folds_object_grids chose the folded form on a device that runs mesh stages and has
device addresses, 64-bit integers, multiDrawIndirect and drawIndirectCount. Device::from_queries
refuses a device without the first two, and object and mesh functions now need the last two
with the extension, so every device that compiles an object function took the folded form and
the unfolded one was reached only by an object function compiled alone.

No SEMANTICS_VERSION bump: an object function's key holds folded_groups, so its key changes with
its module, and every profile refuses object functions under the identity domains today.
docs/API.md's mesh pipelines section and LoweringInputs::folded_groups say an object function
is always folded.

Verified: see the job named below.
2026-12-03 17:05:40 -08:00
Anees Iqbal 7948443887 Translator: object and mesh functions need the mesh extension's two stages and the two indirect draw features together
What: lower::mesh::FEATURES lists taskShader, meshShader, multiDrawIndirect and
drawIndirectCount. An object or a mesh function, and so every mesh render pipeline with or
without an object function, now needs VK_EXT_mesh_shader and all four enabled; a device without
any of them refuses it as Unsupported{MeshShading} naming each one it lacks (plan_entry's
missing_caps). mesh_stages is that same test, and folds_object_grids no longer repeats the two
draw features.

Why: one query decides whether a device runs mesh pipelines. Before this, an object function
asked only for taskShader and a mesh function only for meshShader, and neither for the two draw
features a mesh draw's pieces take (a direct draw's pieces through multiDrawIndirect, an
indirect draw's through drawIndirectCount), so a device with only part of the set compiled stages
the draws could not run.

SEMANTICS_VERSION 2365 (a placeholder; the number is set at landing): a refusal names more
missing features on a device without the extension (both stages' features for either stage),
and a device with part of the set now refuses where it compiled. No committed profile with the
extension lacks any of the four, so no such profile's cell moves. The six committed profiles
without the extension do move: each refusal of an object or mesh function now names every one of
the four features the profile lacks. That is 246 golden cells and the same 246 engine inventory
cells, 41 on each of intel-irisxe-anv, intel-irisxe-rplp-anv, intel-uhd770-rpls-anv,
moltenvk-m3, nvidia-pascal-linux and runtime-floor, over the 14 engine fixtures that hold object
or mesh functions. They wait for the bless at the next named pin.

Tests: the red test of the parent passes, and the refusal test of profiles without the
extension expects the extension and each of the four the profile lacks. docs/API.md's mesh
pipelines section and compile_mesh_pipeline's doc state the set; runtime-sources.sha256 is
re-pinned.

Verified: m3-max-85179 at this commit's first build (tree equal to this one but for the base):
the parent's red test failed and passes here; clippy (plain) 0; the golden and inventory lists
against the base moved exactly the 246 cells above, each to the new refusal.
2026-12-03 17:05:37 -08:00
Anees Iqbal aea7564c29 Tests: a device without any one of the four mesh features refuses mesh stages by name (red)
What: engine_mesh.rs, on every committed profile whose device lists VK_EXT_mesh_shader, with one
of taskShader, meshShader, multiDrawIndirect and drawIndirectCount removed from its description.
Every object function and mesh function of the owned fixtures mesh_order and mesh_outputs, and
mesh_draws' mesh render pipeline with and without its object function, must be refused as
Unsupported{MeshShading} needing exactly the removed feature.

Why: object and mesh functions run only where the device enables all four together with the
extension: an object function's draws need the mesh stage, a mesh function's pipeline may take
an object stage, and a mesh draw's pieces take multiDrawIndirect and drawIndirectCount. Today an
object function needs only taskShader and a mesh function only meshShader, and neither needs the
two draw features, so such a device reaches the identity domains' refusal of the stage instead.

Verified: see the job named below; the test fails at this commit.
2026-12-03 17:05:37 -08:00
Anees Iqbal f514d6f283 Validation: a bicubic sample of a format with no bicubic treatment is the runtime's limit
Two public cases of engine/bcx_rules failed on lavapipe:
bicubic-8-bit-normalized-and-srgb-sums-near-the-rounding-tie (63d0f152) and
bicubic-rounding-of-random-float-and-srgb-texels (cbf5dd18). Each binds
RGBA8Unorm_sRGB textures at slots 4-6 and 13, which the kernel samples
through its bicubic constexpr sampler. Until 94adea1c61 (with 0a3a4fe911,
SEMANTICS 2365) the translator refused the whole kernel for its 1D bicubic
samples (slots 12-15), so the cases read as the product's refusal. That
commit built the 1D sample, as meant; the kernel now compiles, and the
runtime refuses its dispatch at slot 4 as Gap::BicubicTexels, an old known
gap its README states (bicubic_texels_word is None for 8-bit sRGB codes).
The executor counted that Gap as a failure, since the case's structure
did not classify it as refused. The refusal moved from the translator to
the runtime; this makes the classification say so.

ToolingRequirement::BicubicTexels ("bicubic_texels"): Limit::Runtime, it
stops the engine's candidate and keeps its cases Metal-qualified. The
checker raises it in checked_requirements
(executor_contract::bicubic_texels) when the case binds, at a texture
slot its function samples through a bicubic constexpr sampler, a texture
whose format gets None from the public
metal2vulkan::metal::format::bicubic_texels_word, so the rule is the
runtime's own. "Samples through a bicubic sampler" is read from the AIR:
an air.sample_* call (with gradients or not, no comparison) of a 1D or
2D colour texture, as the product decodes it, whose sampler operand is a
constexpr sampler (!air.sampler_states) with a bicubic min or mag filter,
as the translator decides it, and whose texture operand is an entry
texture argument, followed through the arguments of direct calls. A
runtime sampler is never bicubic and the translator refuses an argument
buffer's texture, so neither is claimed; a texture reached another way
(a texture array's element, a loaded pointer) is no claim. No census row
carries it: it needs the bound format, a case literal.

The device test that holds the refusal both ways on lavapipe already
exists: metal2vulkan-runtime's
tests::bicubic::every_device_pushes_each_bicubic_slots_format_treatment
(six formats' words pushed, the RGBA8Unorm_sRGB texture refused), with
the conformance ledger's bicubic-texel-classes rgba8unorm-srgb/dispatch
refusal. The requirement's doc names both.

samplers.rs gives each constexpr sampler's state by its global's name
(constexpr_sampler_states); min_lod_clamp.rs's call parsing is shared
(direct_call, operand_list); neither changes what classification
computes. The new module is listed beside depth_range.rs as the
checker's rule over case literals, not classification.

AUTHORED_COMPILE_CENSUS_VERSION 11: the two cases' cells move from
compiled to not_supported{tooling_requirement:bicubic_texels}, which a
cached cell would hide; the census is due a bless on development.
ENGINE_EXECUTOR_ABI is not bumped: no recorded candidate row holds
these cases (corpus/observations holds only their Metal rows).
SEMANTICS_VERSION is untouched: no translation changes.

Tests: requirement.rs's
a_bicubic_sample_of_a_format_with_no_treatment_stops_only_the_candidate
and the Runtime list; bicubic_texels.rs's own: every bcx_rules slot is
found; an RGBA8Unorm_sRGB texture at a 2D or 1D slot (or a texture
array's element there) raises it and RGBA8Unorm does not; a linear
sampler or a gather raises nothing; operands followed through direct
calls; and checked_requirements keeps the case for Metal and stops the
candidate.

Verified at this tree (f8eb488b95's), on lavapipe:
- job m3-max-86229: both cases read not_supported{tooling_requirement:
  bicubic_texels} (refusal=1 failure=0 each), and the public batch
  (ci-lavapipe, device type cpu, validation layer 1.4.363.0) reads
  cases=1189 match=815 mismatch=15 noted_difference=164 refusal=195
  failure=0 held_open=15 new_mismatch=0;
- job m3-max-86238, the same batch at db7bedc60d (the base): match=815
  mismatch=15 noted_difference=164 refusal=193 failure=2, the two
  failures these cases (exit=1, the runtime's BicubicTexels). The change
  moves exactly them from failure to refusal;
- job m3-max-86228: fmt, clippy (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd),
  Rustdoc -D warnings, and the validation suite, 1349 passed, 2 skipped.
2026-12-03 17:02:29 -08:00
Anees Iqbal f838b75e6c Docs: HOWTO and ARCHITECTURE name no device policy
The device policy went with the resident core's deletion (device/policy.rs):
Device::from_queries takes the description alone and derives the profile from its queries
(docs/API.md, section 1). Three sentences still named a policy: HOWTO's first step ("describe
the Vulkan device as created and choose a policy"), its isolation recipe ("the device
description and policy ... equal description and policy give the same profile fingerprint and
keys") and ARCHITECTURE's device profile ("from the description's Vulkan queries and the
policy"). Each now names the description alone.

Docs only. Neither file is an input of runtime-sources.sha256, and no test or script reads
either file's prose.

Verified: on the CPU with no device, at this commit, git grep -i -w policy over docs/HOWTO.md
and docs/ARCHITECTURE.md finds nothing; DeviceDescription derives serde's Serialize and
Deserialize under feature serde (device/description.rs), as the recipe says.
2026-12-03 16:58:33 -08:00
Anees Iqbal 1d30dac781 Runtime README: a texture buffer held as words made after a handle-reaching command is recorded
A draw or dispatch whose function reaches a texture buffer through an argument buffer decides
between its plain pipeline and its words twin when it is recorded, from the live texture buffers
held as words (Gauges::word_texture_buffers; pipeline.rs's and render.rs's twin choice). On a device
that holds some format as words, a texture buffer held as words made after such a command is
recorded and before it runs, and reached through an argument buffer made resident by use_heap or
by a residency set, is accessed by the plain pipeline, through its R32_UINT view taken as the
format's own: the values are not Metal's. A use_resource of the texture names it at recording,
when it already exists, so the window is the heap's and the residency set's alone.

The ruling: no form; the window is a known gap, recorded in the textures' known gaps beside the
words' other costs. Its trigger is a guest report of wrong texture-buffer values on such a device.

runtime-sources.sha256 does not move: the README is not among its inputs. No code changes.

Verified, on the CPU with no device:
- m3-max-86179, at this commit: scripts/api-docs's prose check (its job-id grep over the runtime
  README among others) passes, and the suites, whose tests read the README's Floor, Enabled, not
  stated and consumer sections, pass but for the golden table, which fails at the base too.
2026-12-03 16:57:32 -08:00
Anees Iqbal 8fb26059c7 Translator: the lowering's unnormalized-sampler and heap-flag paths nothing reaches are deleted
The second half of the cleanup after the resident core's deletion (0ce2f39b71): crate-private
lowering paths whose inputs nothing sets, and the docs that still describe deleted machinery.

Unnormalized constexpr samplers. No selection picks PixelPosition::Unnormalized or
UnnormalizedTexel (pixel_position answers Scaled, Texel, TexelBySpec or TexelByWord), so they go
with BindingKey::unnormalized, PixelPosition::unnormalized(), emit's two coordinate arms and two
offset matches, the sampler.pixel_unnormalized and sampler.pixel_unnormalized_gather census arms,
pixel_note's and centre_denormals' arms, finish()'s invariant for an unnormalized identity
sampling, and constexpr_desc's zero bias for a SamplerUse of unnormalized coordinates, which no
constexpr sampler's use is. The runtime's unnormalized twins of linear pixel samplers
(SamplerUse::unnormalized, vk_sampler's form, offset_texels) stay.

Heap handle flags. AccessPlan's heap_class_index, heap_red_blue and heap_unreadable had no setter;
only heap_alpha is set. They go with carries_class(), Lookup::Flagged's class, red_blue and
unreadable fields (Flagged is now the alpha-carrying form alone), the handle constants
FLAG_TEXEL_CLASS, FLAG_RED_BLUE, FLAG_STORAGE_UNREADABLE, HANDLE_TEXEL_CLASS, HANDLE_RED_BLUE and
HANDLE_STORAGE_UNREADABLE, the sampler.heap.texel_class census arm, heap_element_of's unreadable
branch (its one caller passed false), and identity_refusal's HeapResource refusal of a flagged
form other than the alpha's, which could not fire. The handle-table search, which only the
function-table directory calls, in its element and entry forms, keeps its generic carry of the
alpha flag: Lookup is shared with the identity handle's form, whose element mask the heap accesses
read.

Docs that named deleted items now say what the code does: the PixelSamplerScaling entry (a
constexpr pixel sampler's linear sample or gather records it on every device; the runtime slot's
nearest test is its word, SamplerWord::nearest_pixel, not a specialization), ViewBaseTexelOffset
(no heap_raw; a slot's footprint placed so is refused, IdentityCause::TextureState),
SimdgroupAccessOrder (no resident-table profile), constexpr.rs, memory::handles (heap handles are
the identity arrays' elements; the handle table is the function-table directory's search),
bind::heap, lower::texture (is_null, border texels, level views and the out-of-bounds alpha come
from the resource ID's word), heap_raw's mentions in the sampler modules, the resident-table
mentions in access::object, provenance::objects and validation's tier table, the OpenCL line
variant's docs (the runtime refuses such a binding, Gap::OpenClLineTexture), and PushField's
TextureLevels. SlotPlan::border_texels, never set, goes. Tests: engine_identity's expected lookup
is Lookup::Flagged; the search's host-model test runs the element, flagged and entry forms; the
census assertions of sampler.pixel_unnormalized, which no arm names now, go.

Consumer: in reims at 7d016acc9c, and at 8f3ca9df99, nothing names a crate-private item here
(lower and memory are pub(crate)), and the public-item search is the previous commit's.

Nothing compiled changes: no selection reached the deleted arms, no flag was set, and the census
words of every plan are the same, so SEMANTICS_VERSION and ARTIFACT_FORMAT_VERSION stay.
runtime-sources.sha256 moves without a RUNTIME_VERSION bump: memory/handles.rs loses constants
and fields nothing set, and metal/sampler.rs, metal/texel_format.rs, metal/format/mod.rs and
bind/heap.rs change in comments and a test. docs/REFUSALS.md regenerates unchanged; the
signature table is unchanged.

Verified, on the CPU with no device:
- m3-max-86179, at the series' tip (the two cleanup commits and the README line): fmt, the
  refusal surface's, the signatures', both coverage docs' and scripts/api-docs' checks, clippy
  (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd), Rustdoc, private docs (metal2vulkan and
  metal2vulkan-runtime) and doctests pass. The metal2vulkan suites ran 3,492 tests: 3,491 passed,
  24 skipped, and the failure is golden_hashes_match_the_table, which fails at the base too (a
  bless due at the next pin). Validation ran 1,343 tests, all passed, 2 skipped; conformance ran
  1,061, all passed.
- m3-max-86194 and m3-max-86213, at the tip and at its base db7bedc60d: the golden table's changed
  lines are the same 5,114 at both, line for line, so no cell moves.
2026-12-03 16:57:32 -08:00
Anees Iqbal 27a6c1ebd3 Translator and runtime: the interface items no path makes since the resident core went are deleted
0ce2f39b71 deleted the resident core: every device compiles the identity domains, which read a
texture's presence, out-of-bounds alpha, swizzle, border texels and level count, and a sampler's
state, from the resource ID's words. The interface items the resident core stated for them stayed,
with nothing left that makes them:

- SpecKey's Presence, OutOfBoundsAlpha, TextureSwizzle, OffsetBaseAxes, NearestPixelSampler and
  BorderTexels: no lowering declares them.
- RuntimeFact's ResourcePresence, OutOfBoundsAlpha, StorageTextureLevels, StorageTextureLevelViews,
  OpenClLineTexture and BorderTexels: no plan states them.
- PushField::ControlPointIndexOffset: no plan places it. identity_pushes (lower/select.rs) named
  it on its false side; that arm goes, and lower/push.rs's shape arm with it.
- PrecisionNote::F16IntConvDoubleRounding (metal2vulkan-degrade-f16-int-conv-double-rounding): no
  lowering records it. Its catalogue entry in docs/API.md goes, with the conformance crate's
  Degradation and the validation comparison's allowance and reach arms.
- Feature's LocalSize, TexelBuffer and GroupCount: no site constructs them (docs/REFUSALS.md listed
  each with no site). Their reach.tsv rows go.
- CombinedSampler's unnormalized field, with_unnormalized, heap_index and from_heap_index: the field
  was set only from lower::sampler's BindingKey::unnormalized, which no selection sets (none picks
  PixelPosition::Unnormalized or UnnormalizedTexel) and finish() refuses as an invariant, and the
  two index methods had no caller. sampler_use() now makes the use from the comparison and the
  texel class alone. The runtime's DrawInputCause::UnnormalizedSampler and its two checks (a
  constexpr sampler of a draw or dispatch with the field set) go with it.

The device sampler of unnormalized coordinates stays: SamplerUse::unnormalized, vk_sampler's
unnormalized form and SamplerDesc::unnormalized are what the runtime's linear pixel samplers'
twins are made with.

Tests: device/tests/mechanism.rs covers the 56 facts left; the assertions that a plan states none
of the deleted facts, and the spec values set for deleted keys, go; engine_spec_bits labels its
constant SamplerMinLevel; cache/tests.rs's round trip of OffsetBaseAxes goes; api_tests.rs's
SpecializationLayout round trip names SamplerMinLevel.

The consumer names none of them: in reims at 7d016acc9c, and at 8f3ca9df99, git grep finds 0 hits
each for unnormalized, Unnormalized, heap_index, F16IntConvDoubleRounding,
f16-int-conv-double-rounding, LocalSize, GroupCount, SpecKey::, RuntimeFact::, PushField::,
ControlPointIndexOffset, NearestPixelSampler, OffsetBaseAxes, ResourcePresence,
StorageTextureLevel, OpenClLineTexture, BorderTexels and OutOfBoundsAlpha. TexelBuffer's 2 hits
are maxTexelBufferElements and the runtime's TexelBufferTooLarge, DrawInputCause's 1 is
DrawInputCause::Slot, Feature::'s 10 are other variants and another crate's Feature, and
TextureSwizzle's 66 are Metal's MTLTextureSwizzle.

ARTIFACT_FORMAT_VERSION 612 -> 613 (renumbered at landing): the codec's lists are positional, and
SpecKey, PushField, RuntimeFact, PrecisionNote and CombinedSampler lose members. SEMANTICS_VERSION
stays: nothing that compiles changes. runtime-sources.sha256 moves without a RUNTIME_VERSION bump:
device/mechanism.rs loses the arms of the deleted facts, which no run reached. docs/REFUSALS.md and
the signature table are regenerated; the metal and conformance coverage docs regenerate unchanged.

Verified, on the CPU with no device:
- m3-max-86143, at this commit: clippy (plain, all targets and features) passes; the mechanism,
  spec-bits, round-trip and texture-level tests ran 64 tests, all passed, 2,571 skipped.
- m3-max-86179, at the series' tip (the two cleanup commits and the README line): fmt, the
  refusal surface's, the signatures', both coverage docs' and scripts/api-docs' checks, clippy
  (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd), Rustdoc, private docs (metal2vulkan and
  metal2vulkan-runtime) and doctests pass. The metal2vulkan suites ran 3,492 tests: 3,491 passed,
  24 skipped, and the failure is golden_hashes_match_the_table, which fails at the base too (a
  bless due at the next pin). Validation ran 1,343 tests, all passed, 2 skipped; conformance ran
  1,061, all passed.
- m3-max-86194 and m3-max-86213, at the tip and at its base db7bedc60d: the golden table's changed
  lines are the same 5,114 at both, line for line, so no cell moves.
2026-12-03 16:57:32 -08:00
Anees Iqbal db7bedc60d Runtime docs: the XR branch's measured price on textures of other formats
The runtime README's first known gap of textures said every float or half sample, gather and read
pays the BGR10_XR and BGRA10_XR word test and branch, with no number. It now gives the price the
compute harness measured, with and without the branch alternated in one job (GPU time, medians):

- Iris Xe (Mesa 26.2.6), m3-max-85317, 5 rounds: sampling +0.4%, sampling_distinct_512x512x16
  0.0%, texture_read -0.2%.
- RTX 3090 (NVIDIA 620.70.06), m3-max-85290, 3 rounds: 0.0%, 0.0%, +3.0% (texture_read's base
  rounds spread 3.2%, so that figure is within its noise; its mean is +2.0%).
- RX 7900 XTX (Mesa 26.2.6), m3-max-85291, 3 rounds: -0.2%, 0.0%, -0.4%.

These were measured on earlier forms of the branch: 85290 and 85291 before the map's operations
were kept uncontracted (NoContraction), and all three before a gather took its nearest code
(texel_nudge). Both changes add instructions inside the branch alone, which a texture of another
format does not run.
2026-12-03 16:18:20 -08:00
Anees Iqbal 3e3deb25b9 Translator and runtime: BGR10_XR and BGRA10_XR render targets take Metal's writes, clears, masks and covered blends
The red commit's test, and the conformance cases that render into either format, which the runtime
refused (Gap::TextureFormat on a RenderTarget texture).

Attachments. A BGR10_XR or BGRA10_XR color attachment is its texture's UNORM image
(FormatEmulation::ExtendedRangeUnorm, now admitted as a color attachment and, blended, as a blended
one): A2R10G10B10_UNORM_PACK32, and R16G16B16A16_UNORM with red and blue exchanged. The formats'
second, raw candidate and ExtendedRange::of_attachment are gone; the runtime makes a RenderTarget
texture of either, and a device whose format query lacks the usages is refused the pipeline,
naming them (the runtime's floor does not require R16G16B16A16_UNORM as a color attachment).

Writes (lower::stage_io::extended_unorm_color). A fragment function writes Metal's code of its
output (rounded to half, nearest even, then encoded as a kernel write encodes it) as the field's
value over its maximum, a little above the code (metal::format::extended_unorm_field: 10-bit
(c + 0.0005) / 1023, 16-bit (64 c + 0.25) / 65535), which a device's conversion stores as that code
whether it rounds to nearest, toward zero, by floor(x 1024) or, as lavapipe does for a 10-bit
target, through 16 bits (round(x 65535) >> 6; an offset of 0.25 stored code + 1 for the 251 codes
from 772). BGR10_XR's two alpha bits are written as ones, as Metal writes them. Clears store
Metal's clear codes (metal::format::extended_unorm_clear, the runtime's clear values). Masks are
Metal's on the image's channels (BGRA10_XR's red and blue exchanged; BGR10_XR's alpha bits written
with any color channel). A resolve is the device's AVERAGE of the codes, which average as the
values do; PrecisionNote::DeviceRoundedResolve now names a BGRA10_XR field's low bits. A fetch of
either attachment is refused NotImplemented(Format) at compile, and at link where the function
does not write it.

Blends (pipeline::extended_blend). Metal's blend into these formats, measured on an Apple M3 Max
(macOS 27.0.1) over the xr-blend recordings: the source clamped to the values of codes 0 and 1022
(a NaN to code 0) and alpha to [0, 1], a destination color code to 1022, half arithmetic, the
result rounded to a code. That model is every recorded channel's but 9 of 172,032 (premultiplied
source-over, one code each, listed in the ledger rows). The function clamps its output as Metal's
blend does; a blend that stores its source (one and zero, added) stores the clamped codes exactly.
Any other blends the codes in Vulkan with a source factor of one, the function writing the term
X that makes Vulkan's blend of the codes Metal's blend of the values; destination factors that read
the source read it from a second output (dualSrcBlend, in the floor), BGR10_XR's alpha too, so its
alpha bits stay ones. A factor pair the module does not cover (a BGRA10_XR destination alpha among
them) is refused NotImplemented(Format).

Notes, static per pipeline: PrecisionNote::ExtendedRangeBlend on every blend that does not store its
source (the device rounds each draw's result to the field, a BGRA10_XR field keeping the fraction of
a code in its six low bits); PrecisionNote::ExtendedRangeBlendWindow where the corrected term or a
second-output factor can leave [0, 1], which Vulkan clamps (pipeline::extended_blend::window_holds,
from the factors and operations at the corners of the source's range; a unit test classifies every
factor pair and operation at both formats). Both are in docs/API.md's catalogue with counts, and the
runtime's README records the window as a known gap with its trigger.

Ledger: 18 llvmpipe rows of the B cases that differ (the xr-blend addition and premultiplied
source-over, xr-gamut, the blended xr-gradient and xr-masked over draws, and xr-gradient's
unblended resolve), each citing its note, with counts from a model of our blend whose count of
differing elements is lavapipe's replay's to within 11; and the same cases' rows on the RTX 3090
(NVIDIA 620.70.06, m3-max-85796; there xr-gradient-bgra10xr-unblended-x1 too, 39 fields a code
off by the device's arithmetic of the gradient), the RX 7900 XTX (m3-max-85797) and the Iris Xe
(m3-max-85798), each pointing at the case's llvmpipe row, with that device's counts.

Cache key: LoweringInputs::extended_unorm_colors is hashed into the function key where it is set
(pipeline::compile::key), so a fragment function compiled for a BGR10_XR or BGRA10_XR attachment
never takes another's translation; the key test asserts that the attachment and the format each
change the key.

SEMANTICS_VERSION 2378 and ARTIFACT_FORMAT_VERSION 612. RUNTIME_VERSION 2577 (XR render targets
are made); runtime-sources.sha256 re-pinned. api_signatures blessed and
api_surface extended (ExtendedUnormBlend, ExtendedUnormColor, extended_unorm_clear);
docs/REFUSALS.md regenerated (the fetch's refusal site).
2026-12-03 16:18:20 -08:00
Anees Iqbal e9290d8138 Runtime tests: BGR10_XR and BGRA10_XR render targets store Metal's codes (red)
An arm64 guest walk met render pipelines and passes into MTLPixelFormatBGR10_XR (554) and
MTLPixelFormatBGRA10_XR (552); the runtime refuses a texture of either with RenderTarget usage
(Gap::TextureFormat), so no pass draws into one.

every_device_renders_extended_range_targets_as_metal_stores_them, on every device of the cfg's
kind, for both formats in Shared and Private storage (a Private target read back by a blit into a
buffer): a pass clears an 8 by 8 target to Metal's specials and code boundaries and the words come
back as Metal's clear stores them; rt6_samples' half4 fill over 64 values across and past the
codes' range (a NaN, the infinities, the ends) draws unblended, then blended with Metal's default
factors, one and zero, and each texel holds Metal's store (unblended: the half's code; blended: the
source clamped to codes 0 to 1022, a NaN to code 0, alpha to [0, 1]); over a Shared BGR10_XR target
whose words' two top bits are zero, a draw under straight alpha-over leaves those bits ones, as
Metal's store writes them.

The ledger's refused rows of the conformance cases that render into either format, which this
change's fix makes run, go: xr-draw, xr-clears, xr-clear-routes, xr-masked, xr-blend, xr-gamut,
xr-gradient and xr-unwritten, BGR10_XR and BGRA10_XR without sRGB (168 rows); the sRGB twins' and
the two-plane forms' stay. Coverage regenerated.
2026-12-03 16:18:20 -08:00
Anees Iqbal c226c542b2 Translator tests and runtime docs: the fold's round-trip fields and a private link
Job m3-max-85802, the twin's suites and lint at 52e98915ba on lavapipe, ran
two steps green: the runtime's device tests (red at 8672e74957, green at
52e98915ba) and the runtime suite (1003 passed, 4 skipped). Validation also
passed (1344 passed, 2 skipped). The translator's test build failed: api_tests'
round-trip literals of VariantKey and LoweringInputs name every field, and
lacked depth_range_fold (E0063). That failed the fold tests, tr_core and
clippy in all three configurations. The private rustdoc failed on one
unresolved link in RenderCompiled::content's doc
(Device::render_pipeline_state, a private method of crate::Device).

- api_tests: both literals set depth_range_fold: true, so the round trip
  covers the new field.
- render.rs: the link names crate::Device::render_pipeline_state.

No product code changes. The runtime-sources pin does not move
(pin-compute). Verified: the READY gives the rerun's job lines.
2026-12-03 16:18:20 -08:00
Anees Iqbal 1880ab5637 Runtime README: the depth range twin's first-draw stall, measured
The twin's known gap named its stall without a figure. Both figures come
from the twin's device test, which times its first draw through a twin. The
runs used release builds, three per card, with the drivers' disk shader
caches off (__GL_SHADER_DISK_CACHE=0, MESA_SHADER_CACHE_DISABLE=true), as a
first boot pays:

- lavapipe (Mesa 26.2.6, LLVM 23.1.4), job m3-max-85864: 1539, 1376 and
  1350 us. The longest make at encode, which is the twin's lowering, was
  1428, 1078 and 1275 us.
- RTX 3090 (NVIDIA 620.70.06), job m3-max-85826: 5054, 5067 and 5467 us.
  The lowering was 808, 841 and 1303 us; the rest is the driver's
  VkPipeline compile.

A debug build's first draw on the 3090 (job m3-max-85807) took 17.0 ms.
That figure is not used.

Docs only: no source, version or pin moves.
2026-12-03 16:18:20 -08:00
Anees Iqbal fc8809d849 Translator: the identity domains push the depth range fold's field
A render pipeline of a vertex function under the depth range fold was
refused under the identity domains: "unsupported: IdentityDomains (an
encoder value the function reads as DepthRangeFold)". That is the
runtime's every device: the first draw through a twin on an RTX 3090, job
m3-max-85794. identity_refusal (lower/select.rs) names each push field the
identity domains push, and PushField::DepthRangeFold was not in it. The
runtime does push it: draws() maps it to FieldValue::DepthRangeFold, and
fill_push writes the first viewport's [znear, zfar - znear].

The field joins the list, and identity_admits' doc names it beside
ViewportCount. No encoding changes: the fold's variant was refused before
and is made now. The versions stay at the fold's placeholders
(SEMANTICS_VERSION 2368, ARTIFACT_FORMAT_VERSION 609). The runtime-sources
pin does not move, because lower/select.rs is not one of its inputs
(pin-compute).

Verified: the READY gives the job lines (the commit before red, here
green).
2026-12-03 16:18:19 -08:00
Anees Iqbal 1167c88d4f Translator tests: a folded render pipeline is made under the identity domains
Red first. The runtime's first draw through a depth range twin on an RTX
3090 (job m3-max-85794) answered "the translator made no pipeline:
unsupported: IdentityDomains (an encoder value the function reads as
DepthRangeFold)". The identity domains' list of the encoder values they
push (lower/select.rs, identity_refusal) does not name the fold's push
field. The fold's own tests compile the function alone, which that check
does not reach.

This test compiles a render pipeline of a folded vertex function
(VariantKey::depth_range_fold) into a Depth32Float attachment through
compile_render_variant on Device::from_queries' moltenvk-m3 and lavapipe
profiles, and asserts the fold's fact. Expected red here; the next
commit names the field.
2026-12-03 16:18:19 -08:00
Anees Iqbal 549ab0ac23 Runtime: a draw that reads the depth through a range past [0, 1] goes through a depth range twin
The partial fix draws through a viewport depth range past [0, 1] where
nothing reads the depth, and refuses every other draw (DrawKind::Viewport).
Metal draws those too (M3 Max, macOS 27.0.1, job m3-max-85617). It reads
[[position]].z = znear + z * (zfar - znear) unclamped. It stores that, and a
[[depth]] output, clamped to [0, 1], and tests the clamped value. Clip
space's 0 <= z <= w clips whatever the range. Vulkan takes no such range
without VK_EXT_depth_range_unrestricted, which the floor does not have.

The translator commits before this one build the fold:
LoweringInputs::depth_range_fold. Under it, the vertex function stores
znear * w + (zfar - znear) * z as its z, from PushField::DepthRangeFold. It
stores z and w - z as two clip distances after its own. Under
depthClampEnable with the viewport at [0, 1], that clips, reads, stores and
tests what Metal does. This commit draws through it.

- RenderCompiled keeps what its content was made for (arrays, words, srgb)
  and a OnceLock'd twin. depth_range_twin lowers the content's descriptor
  again for the same inputs under VariantKey::depth_range_fold
  (lowered_content, factored out of render_pipeline_state). It is made at
  the first draw that needs it, counted (Metrics::depth_range_twins), and
  timed as a make at encode. It is held as long as its content, and no map
  keeps it. The translator's refusal of it is kept, so a later draw answers
  it without lowering again. That refusal is the clip-distance limits.
- RenderPipelineState::folded gives the twin's state, its samplers numbered
  at the state's indices, cached in RenderInner. It refuses (Viewport) a
  vertex function the consumer compiled, and a twin that stores no fold.
- Fixed::fold (RuntimeFact::DepthRangeFold) makes every VkPipeline of the
  twin take depthClampEnable. draws() takes the fact, and the vertex push
  field as FieldValue::DepthRangeFold. fill_push writes the first
  viewport's [znear, zfar - znear] as f32 bits.
- The encoder's route (in place of draws_refused) is found when the
  pipeline state, the viewports or the depth clip mode are set. A draw
  reads one field, as before.
  - Under a past range that the pass's depth attachment or the fragment's
    [[position]] z or w reads, draws go through the twin.
  - The route refuses under the Clamp mode, and for a function that writes
    [[viewport_array_index]] while the viewports set have different ranges.
  - Only the viewports a draw reaches count: the first, or every one set
    for a function that selects.
  - bind_content composes the twin with the content for the draws' bindings
    (for_draws). The viewports are recorded at [0, 1] while folded.
- RenderCommandEncoder::DEPTH_RANGE_NOTE (DeviceArithmetic) is the static
  note of every draw through a twin. The docs/API.md catalogue says so.

Bounds: a twin holds at most 8 VkPipelines (Clip mode only), and 8 more for
its words twin, so a content holds at most 48 where it held 32, for its
life.

Docs: set_viewport, DrawKind::Viewport, Metrics::translations_at_encode,
and the runtime README's paragraph, Gap::Draw list and a known gap. The
known gap gives the first draw's stall, the twin's pipelines, the limit
refusal and the two refusals. REFUSALS.md and api_signatures.tsv are
regenerated. api_signatures also takes the translator rows of the commits
before (VariantKey and LoweringInputs depth_range_fold, PushField and
RuntimeFact DepthRangeFold). RUNTIME_VERSION 2576. The
runtime-sources pin does not move (pin-compute).

Verified: the READY gives the job lines (red at the commit before, green
here, on lavapipe and an RTX 3090; clippy in three configurations;
rustdoc).
2026-12-03 16:18:19 -08:00
Anees Iqbal 2c00d545b4 Runtime tests: a draw that reads the depth through a range past [0, 1] draws Metal's values
Red first for the depth range twin. Two device tests, and the counter they
read (Metrics::depth_range_twins, declared here and counted by the next
commit):

- tests::draw: every_device_draws_through_a_depth_range_past_zero_to_one_as_metal_does
  replaces the partial fix's test, whose refusals the twin turns into draws.
  It draws Metal's fullscreen triangle one column at a time, each at the z
  of its own texture, and checks the values the M3 Max recorded (macOS
  27.0.1, job m3-max-85617, the conformance probe viewport_depth_past_unit):
  [[position]].z = znear + z * (zfar - znear) unclamped under [-1, 1];
  Depth32Float storing it clamped to [0, 1]; triangles past clip space's
  0 <= z <= w not drawn; a [[depth]] output stored clamped under [0, 2];
  Depth16Unorm storing the clamped depth (within 1 of the nearest code, the
  device's conversion); the depth test comparing the clamped depth, Equal
  and Less against 0, Equal and Greater against 1. A draw where nothing
  reads the depth makes no twin; the Clamp mode is refused and Clip draws
  again; one twin per content (3).
- tests::viewports: a vertex function that writes [[viewport_array_index]]
  into a depth attachment is refused under viewports of two ranges (one
  past [0, 1]) and draws through one twin under two viewports of the same
  past range.

Expected red at this commit: the first draw through [-1, 1] that reads the
depth is refused (DrawKind::Viewport). The job line is in the next
commit's body.
2026-12-03 16:18:19 -08:00
Anees Iqbal f7c56cd4d2 Translator: a vertex function under the depth range fold folds the range into its position
Under LoweringInputs::depth_range_fold, a vertex (or post-tessellation
vertex) function that stores its position does three things at each
return:
- it stores the position's z as znear * w + (zfar - znear) * z, reading
  [znear, zfar - znear] from PushField::DepthRangeFold;
- it stores z and w - z, of the z it returned, as two clip distances
  after its own;
- it records PrecisionNote::DeviceArithmetic.

Drawn with the viewport's depths [0, 1] and depth clamping enabled, this
maps a viewport depth range past [0, 1] as Metal maps it (the M3 Max, jobs
m3-max-85541 and m3-max-85617): [[position]].z reads znear + z / w *
(zfar - znear) unclamped; the depth stored and tested is that, clamped to
[0, 1] by the clamp; and the clip distances keep Metal's 0 <= z <= w where
the clamp leaves z unclipped.

Planning:
- The function's own ClipDistance array is declared two longer, with its
  own elements stored as before.
- A function with none declares ClipDistance of 2 (shaderClipDistance).
- Under the fold the declared count must fit maxClipDistances and
  maxCombinedClipAndCullDistances, else Unsupported names
  Feature::ClipDistance and the limit.
- The usual path's check (maxClipDistances alone) is unchanged.
- A function that stores no position, and any other stage, compiles as
  without it.

docs/API.md's DeviceArithmetic entry says the fold records it on every
such compile and why. SEMANTICS_VERSION 2377 and ARTIFACT_FORMAT_VERSION
611 (a new push field and fact). runtime-sources.sha256
takes the translator's new sources, including the commit before's.

Verified: see the twin's READY job lines (the red tests at the commit
before fail, pass here).
2026-12-03 16:18:19 -08:00
Anees Iqbal 96167b3f8d Translator tests: a vertex function folds a viewport depth range into its position (red)
Metal maps a viewport depth range past [0, 1] that Vulkan takes in no
viewport: position.z reads znear + z * (zfar - znear) unclamped, and the
depth stored and tested is that clamped to [0, 1], with clip space's
0 <= z <= w clipping as always (the M3 Max, jobs m3-max-85541 and
m3-max-85617). The twin a draw that reads the depth under such a range
runs folds the range into the vertex position: z' = znear * w +
(zfar - znear) * z, with the Vulkan viewport [0, 1] and depth clamping on,
and clip space's z bounds kept as two clip distances.

This adds the input and its plumbing, with no lowering yet:
LoweringInputs::depth_range_fold and VariantKey::depth_range_fold (vertex
stage), its key bytes, PushField::DepthRangeFold (a uvec2 of [znear,
zfar - znear]), RuntimeFact::DepthRangeFold (a Variant mechanism), and
the codec's names (appended).

engine_depth_range_fold's tests:
- on every committed profile, rfb_full, rfb_span and fan_clip_triangle
  (six clip distances of its own) under the input state the fact, place
  the 8-byte field, record PrecisionNote::DeviceArithmetic and declare two
  clip distances after their own; without it, none of that; L3 both ways;
  a fragment function's module is the same under it;
- seven maxClipDistances or maxCombinedClipAndCullDistances refuse six
  plus two, naming the limit, and compile the function without the fold.

Red here: the input changes nothing yet.
2026-12-03 16:18:19 -08:00
Anees Iqbal 56790e7f1a Translator: the identity domains' encoder values are an exhaustive match on PushField
lower/select.rs's identity_refusal kept a hand list of the encoder values (PushField) the identity
domains push, and refused a function whose plan placed any other as an encoder value
(IdentityCause::EncoderValue). A field the runtime pushes but the list missed was refused only
when a whole pipeline compiled, and nothing failed when the field was added: StageInStride
(a [[stage_in]] layout of MTLBufferLayoutStrideDynamic) and DepthRangeFold each met it.

The list is now identity_pushes, a match that names every PushField: the parameter block's
address where the push window holds it, a slot's bind offset where the kernel reaches its storage
views, the values identity_admits lists, and false for each other field by name, with no
wildcard. A field added to PushField does not compile until it is placed on one side of it.
StageInStride sits on the true side, as the list took it; DepthRangeFold is not yet a field, and
its commit places it.

Nothing compiled changes: every field answers as it did, so no version moves. lower/select.rs is
not an input of runtime-sources.sha256, which stays.

Verified, on the CPU with no device:
- m3-max-85928, at this commit on its base: with a probe variant added to PushField, cargo check
  names lower/select.rs's match among the non-exhaustive ones (E0004, with cache/codec.rs and
  lower/push.rs), and at the base it names only those two; without the probe it checks clean.
- m3-max-85885, at this change on 133c992dad, before its rebase (its doc comment's wording since,
  and StageInStride then on the false side, as that base's list refused it): with a probe
  variant added to PushField, cargo check names lower/select.rs's match among the non-exhaustive
  ones (E0004, with cache/codec.rs and lower/push.rs), and at the base it names only those two;
  without the probe it checks clean. The golden table passes (no cell moves); the refusal
  surface's check, fmt, signatures, clippy (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd), Rustdoc and
  private docs pass.
2026-12-03 16:18:19 -08:00
Anees Iqbal 6ba47f2b57 Translator comments: a texture buffer's read takes no swizzle
select_read_as's comment on Metal's out-of-bounds alpha ended in half a sentence, "A texture
buffer's swizzle applies to its reads: Metal returns each channel from the source the bound",
whose second half went with the texture buffer's swizzle in the cutover to the one form: the
runtime makes no swizzled texture buffer (Gap::TextureBufferSwizzle), so the read takes none. The
comment now says that.

A comment only: nothing compiled changes, and lower/texture/mod.rs is not an input of
runtime-sources.sha256 (computed equal to the pinned hash). rustfmt passes on the file.
2026-12-03 16:18:18 -08:00
Anees Iqbal c74a3015f9 REFUSALS.md: a runtime refusal nothing builds refuses nowhere
The refusal surface's Where column gave every variant of the runtime's Refusal, Limit and Gap a
device condition from its basis alone: "at the device's limit" for a device's own limit, and
"every device (a public call's own check of its arguments)" for every other, whether or not
anything builds it. Gap::CubicSampler has had no construction site since the runtime made a
sampler of Metal's undeclared filter 2 as nearest, and kept only because the consumer names it,
yet its row still said it refused on every device. The generator now gives such a condition only
to a variant with a site (or a helper that builds it), so a variant nothing builds reads "-", as
its Sites cell's 0 already said ("0 is a variant nothing builds today").

docs/REFUSALS.md is regenerated: CubicSampler's row alone changes; error/basis.rs does not.

Verified, on the CPU with no device: scripts/refusal-surface/refusal_surface.py --check reads both
outputs current, with 0 variants without a reach mark and 0 without a basis; Refusal (96 of 96)
and Limit (21 of 21) have a site each, and of Gap's 31 only CubicSampler has none.
2026-12-03 16:18:18 -08:00
Anees Iqbal f43cff7e76 METAL-COVERAGE: the sparse tile sizes and region conversions are sparse tiles, not tile pipelines
Six MTLDevice items were filed in the coverage map as tile render pipelines ("tile render
pipelines; metal2vulkan-runtime makes none", size L, group tile): sparseTileSizeInBytes,
sparseTileSizeInBytesForSparsePageSize:, the two sparseTileSizeWithTextureType:pixelFormat:
sampleCount: forms and convertSparsePixelRegions:toTileRegions:... and
convertSparseTileRegions:toPixelRegions:.... They answer a sparse texture's tile size and convert
regions between pixels and its tiles, and have nothing to do with tile render pipelines. They now
read "sparse tiles", size S, group sparse, as MTLTexture.firstMipmapInTail, tailSizeInBytes and
isSparse already do; that group's name, "placement sparse page sizes", becomes "sparse page and
tile sizes", which it held already with those three. The tile render pipeline group keeps its
other 20 items.

docs/METAL-COVERAGE.md is regenerated: missing by size S 178 -> 184 and L 313 -> 307, the sparse
group 5 -> 11 items, the tile group 26 -> 20; the status totals do not move.

Verified, on the CPU with no device: scripts/metal-coverage/coverage.py --check reads the document
current; the table's status counts, which the validation suite's
the_coverage_documents_totals_are_the_tables compares with the document, are unchanged, and every
missing row keeps a size and a group.
2026-12-03 16:18:18 -08:00
Anees Iqbal b51989986d AIR intrinsics: list llvm.trap as known and not decoded
The bitcode-reader census over the private corpus reported llvm.trap as an unlisted unknown
intrinsic: one row, 132 calls, each MSL's __builtin_trap (a call, then unreachable), all in
functions the kernel reaches. MSL 4.1 and Metal's headers do not define a reached trap. The row
translates today (runtime-floor translation audit, release: translated): canonicalization
removes every trap for its constants. The planner's ruling: the row is not refused, so it closes
with the name listed. UNDECODED now lists llvm.trap with that reason, so the census counts it
listed; its calls still stay Callee::UnknownIntrinsic, and a trap that survives canonicalization
is still refused as UnknownIntrinsic. No translation changes, so no version moves. The module and
list docs say the list holds llvm.* names too; api_signatures.tsv is reblessed for the
const-value.

Verified: see the READY line (census before/after on ms01, the list's unit tests red then green,
fmt, clippy plain).
2026-12-03 16:18:18 -08:00
Anees Iqbal 1508996bad AIR tests: llvm.trap is listed as not decoded (red)
The bitcode-reader census (pr2627's, over the private corpus) reports llvm.trap as an unlisted
unknown intrinsic: one row, 132 calls, each MSL's __builtin_trap (a call, then unreachable). The
row translates today: canonicalization removes every trap for its constants. A closed census has no
unlisted name, so the name is listed with its reason, and a trap that survives canonicalization
stays the typed UnknownIntrinsic refusal.

trap_is_listed_not_decoded asserts llvm.trap classifies Unknown and is listed;
known_families_decode_or_are_listed carries the name. Both fail here: undecoded_family("llvm.trap")
is None.
2026-12-03 16:18:18 -08:00
Anees Iqbal 8bc3ad5e86 Runtime: Gap::CubicSampler goes
The runtime never raises it: Device::new_sampler_state makes a Cubic filter
(MTLSamplerMinMagFilterCubic, Metal's undeclared raw value 2) and filters it as nearest. The variant
stayed only because the consumer named it. The consumer's public tip no longer does: `git grep -n
CubicSampler 7d016acc9c` in reims-vgpu (its pin V move, push #97) has 0 hits.

The basis tests that used it as their Ours example use Gap::MemorylessTexture, also Ours.
docs/REFUSALS.md regenerated (the runtime's Gap: 31 -> 30 variants); api_signatures blessed (one
variant row out). RUNTIME_VERSION unchanged: no run of an artifact does anything else, since the
variant was never raised. runtime-sources.sha256 is unchanged: the runtime crate's error.rs is not one of
its inputs (computed equal, 1ab29fff…).
2026-12-03 16:18:18 -08:00
Anees Iqbal a86f5ed62b Translator tests: a sample's level-0 arm takes the extended-range alpha clamp too
Two counts merged by hand when the exact pixel-sampler form was staged on the BGR10_XR and
BGRA10_XR reads: a_base_level_takes_the_whole_bias and
bias_and_clamp_outside_a_fragment_are_explicit_levels asserted 3 FClamps for sample_bias_kernel's
three samples. Each sample and each sample's level-0 arm passes its texel through the extended-range
arm, which clamps an alpha code once, so the module holds 6 (m3-max-86088 on gem10: left 6, right 3
for both). The assertions and their comments now say so. Test-only; no version moves.
2026-12-03 16:17:59 -08:00
Anees Iqbal 0c70839937 Conformance ledger: the new pixel-samplers row texts name the card and driver, not the job
The rows 3cd020278b wrote quoted two lab job ids, for the RTX 3090's per-element compare and
lavapipe's dumps. As the prose docs do, a row now states a measurement by its card and driver:
NVIDIA 620.70.06, and Mesa 26.2.6 with LLVM 23.1.4. The job ids stay in 3cd020278b's message.
Texts only; no answer changes.
2026-12-03 16:17:59 -08:00
Anees Iqbal bb7661f09a Conformance ledger: the linear pixel-samplers slot rows of five cards and lavapipe's rgba8 pair read the exact form
A linear runtime pixel sampler's slot site hands the bound state's unnormalized twin the
coordinate itself at the texture's level-0 element. So each card's slot digest moves off the one
its normalized sampler gave at x / N.

Answers change on the 6 slot rows (rgba8 and rgba16f linear edge, zero and border) of:
- RX 7900 XTX (m3-max-85879, RADV 26.2.6)
- RTX 3090 (m3-max-85881, 620.70.06)
- 780M (m3-max-85882)
- RX 550 (m3-max-85883)
- Iris Xe (m3-max-85938, Mesa 26.2.6)

Each digest comes from that card's replay of the 20 pixel-samplers cases at 82b6989d59. The linear
arm is unchanged by 9cc5655c57. Every row of those cases at those venues takes a text naming the
new grouping of the four sources' digests. Answers change on slot rows alone: 32 rows, checked
against the parent's ledger.

On the 3090 (m3-max-85937, the same build with each source's results dumped), slot is nearer
Metal's answer than the normalized sources in every linear case. For example, rgba16f edge: slot
differs from Metal at 24 of 800 coordinates by at most 0.0142, the others at 45 by at most
0.0215.

lavapipe's two rgba8 rows (linear zero and border, case/output/slot) move to 7423f6db70a5. This is
the exact form's change, not an image change:
- The pinned-lavapipe check m3-max-85860 (msi's Mesa 26.2.4, LLVM 23.1.1) gives that digest.
- The merged check m3-max-85692 counted the same 4 drift lines among its 10, at the same product
  code (3777af5b7a changes a test alone).
- Mesa 26.2.6 (m3-max-85845) gives it too.

Per element (85845's dumps, same sha256), slot differs from norm at 79 of 800 coordinates by at
most 2.35e-7, and from Metal's at 489 where norm does at 495, each by at most 0.00181. That is the
device's filter at Metal's coordinate. So the pin and the ledger's "# llvmpipe:" line stay.

No nearest or subnormal row changes. 9cc5655c57 keeps a nearest runtime pixel sampler's texel
centre, as shipped.

Coverage regenerated (scripts/conformance-coverage/coverage.py).
2026-12-03 16:17:59 -08:00
Anees Iqbal c99bf0c6c3 Translator and runtime: a nearest runtime pixel sampler keeps its texel centre; only linear takes the level-0 arm
The exact arm hands the device's unnormalized sampler Metal's coordinate itself. Under a linear
filter that is the device's own filter at Metal's coordinate (DeviceSampling). Under a nearest
filter it moves texel selection onto the device sampler's own handling of the coordinate, and the
pixel-samplers replays at 82b6989d59 show new slot divergences where the cards matched Metal
before:
- RX 550 (m3-max-85883): rgba8 and rgba16f nearest-zero and -border.
- RTX 3090 (m3-max-85881): subnormal-zero and -border.

Metal's recorded answers for the subnormal cases read texel -1 at a negative subnormal and texel 0
at a positive one, so no flush of a subnormal to 0 is taken.

What changes:
- SamplerWord::reads_unnormalized holds only for pixel coordinates with linear min and mag filters
  (no mip filter, isotropic, s and t clamped), the descriptor's unnormalized_reads of linear
  filters.
- The shader's level-0 test compares the word's filter bits with UNNORMALIZED_LINEAR alone.
  Two instructions fewer per test.
- A nearest word takes the form shipping before the series: the texel's centre over the size.
  A gather through a nearest word takes x / N with its PixelSamplerScaling note, as before the
  series.
- The runtime makes twins, and holds level-0 elements, only for linear states.
- SamplerWord::UNNORMALIZED_NEAREST is deleted. This series added it and nothing reads it now;
  it is not on development.
- a_words_unnormalized_reads_are_its_descriptors now pairs the word with the descriptor's
  unnormalized_reads of linear filters: 9 descriptors, linear with linear over 3 by 3 modes.
- Docs: the predicate's filters in docs/RESOURCE-ID.md and the runtime README; the sampler
  module's pixel-coordinate list names the level-0 arm. The conformance pixel_samplers module
  doc is corrected: a const site under the identity domains reads a normalized sampler, a linear
  slot site the twin. SEMANTICS_VERSION 2376 and RUNTIME_VERSION 2575 (a nearest word's arm and
  the runtime's linear-only twins and level-0 elements); the runtime-sources pin is recomputed.

Checks: red d9abcdde67 holds only_a_linear_pixel_samplers_word_reads_unnormalized. This commit's
gate and the family's card replays are named in the ledger commit that follows.
2026-12-03 16:17:59 -08:00
Anees Iqbal bdf5f42619 Translator tests: only a linear pixel sampler's word reads unnormalized (red)
A runtime sampler slot's exact arm hands the device's unnormalized sampler the coordinate itself.
Under a nearest filter that moves the texel the device reads off Metal's: the pixel-samplers
family's replays at 82b6989d59 show new divergences at case/output/slot where the cards matched
Metal before, on the RX 550 (rgba8 and rgba16f nearest zero and border, m3-max-85883) and on the
RTX 3090 (subnormal zero and border, m3-max-85881). Metal's recorded answers read texel -1 at a
negative subnormal and texel 0 at a positive one.

This test states the rule the fix keeps: only a word of linear filters reads through the
unnormalized twin; a nearest one keeps the texel-centre form. It fails now: every nearest
pairing reads unnormalized.
2026-12-03 16:17:59 -08:00
Anees Iqbal 82b7d9e4a2 Conformance ledger: the llvmpipe rows of three rgba16f pixel-samplers cases read the exact form
The exact form (86b5171e25) hands a runtime pixel sampler's coordinate itself to the device's
unnormalized sampler through the texture's level-0 element, where `arg`, `norm` and `const` (a
constexpr pixel sampler, normalized under the identity domains) hand its normalized sampler the
coordinate over the size. lavapipe filters RGBA8 at 8-bit weights, where both coordinates read
one answer, but weighs an RGBA16Float texel pair at its own sub-texel precision, so the `slot`
site of pixel-samplers-rgba16f-linear-edge, -zero and -border answers its own digest; mirror stays
on the normalized path and nearest reads the same texel either way.

My miss: group C's gate replayed only the pixel-downscales cases on lavapipe, not the
pixel-samplers family, which also samples through a runtime pixel sampler; the staged check
(job m3-max-85692, lvp_conf on the pinned lavapipe) found the three rows stale.

Checked per element (job m3-max-85845, lavapipe Mesa 26.2.6, the same slot digests as 85692's
pinned 26.2.4), each source's 800 results against Metal's recorded answers: `slot` differs from
`norm` at 107 (edge) and 81 (zero, border) of 800 coordinates, by at most 1.31e-6, 81 and 55 of
them nearer Metal's answer and 21 farther; the largest difference from Metal's, 0.0107, is the
same for every source. RGBA8 and mirror: `slot` equals `norm` bit for bit on edge and mirror.
The device's filter at Metal's coordinate (rule 1, note device-sampling). Each case's four
llvmpipe rows take the new text; the slot rows take the new digests.
docs/CONFORMANCE-COVERAGE.md is regenerated.
2026-12-03 16:17:58 -08:00
Anees Iqbal b58c67e981 Translator tests: a word's unnormalized reads count Metal's raw filter value 2 as nearest
a_words_unnormalized_reads_are_its_descriptors walks every pair of SamplerMinMagFilter values and
counts the descriptors the device's unnormalized sampler reads as they are. Its count was written
when the enum held two filters. It now holds three: Cubic, Metal's undeclared raw value 2, filters
as nearest since the cubic-nearest change (7d1dba5df0). So nearest with nearest, nearest with
raw 2 in either place, raw 2 with raw 2, and linear with linear are the 5 pairs that read as one
filter, 45 descriptors over the 3 by 3 address modes. The per-descriptor assertion, the word's
answer against the descriptor's, already held for every descriptor. Only the count was stale.

Found by the merged check m3-max-85692 (tr_core: 3175 passed, this 1 failed).
2026-12-03 16:17:58 -08:00
Anees Iqbal 83bb95724d Runtime: a draw's level-0 check reads the texture's flag before the sampler slots
A draw whose bindings changed walks its functions' level-0 texture slots. It read each slot's
sampler bits first and the texture's written flag last, so a texture whose level-0 element was
already written still cost the sampler scan at every rebind. The bind line measured that, in
user-space instructions per repeated bind-and-draw of a pixel sampler and a multi-level texture
(the archives of job m3-max-85166, run by job m3-max-85379): 3353.3 at base 9886324e31 and
3463.3 at bc7f291710 on the RTX 3090 (+3.28%), 3932.8 and 4042.8 on the Iris Xe (+2.80%).

TextureObject::level_zero_held reads the one flag (true also where the texture has no level-0
element or no index), and hold_level_zero skips a texture it finds held before it reads any
sampler slot. A dispatch takes the same path. Nothing else changes: an unheld texture is held
exactly as before. The bind line at this commit is the check.
2026-12-03 16:17:58 -08:00
Anees Iqbal 69a3254e1a Precision note: device sampling names its unnormalized sampler's sub-texel step
The exact form hands a pixel sampler's coordinate as given to the device's unnormalized sampler,
and on RADV that sampler's sub-texel step is not Metal's. PrecisionNote::DeviceSampling's doc and
its API.md catalogue entry now carry the measured bound.

Measured on seven linear downscales by 8 (the pixel-downscales cases' textures) at 306a517dc4,
against Metal's answers recorded on an Apple M3 Max:
- RADV, Mesa 26.2.6 (RX 7900 XTX job m3-max-85100, Radeon 780M job m3-max-85101, RX 550 job
  m3-max-85161): at 172,665 coordinates whose x - 0.5 lies at a half step of the 1/256 grid on
  both axes, the even steps (86,333) all differ from the normalized control at Metal's step and
  the odd ones (86,332) none: round half to even where Metal rounds half up; the largest
  difference is 1.906/255. At the case's 172,665 coordinates 2^-21 apart, 1.5% differ, 0.945/255.
- NVIDIA 620.70.06 (RTX 3090) and ANV Mesa 26.2.6 (Iris Xe), job m3-max-85099: the slot equals
  the normalized control at Metal's step bit for bit at every coordinate.
- KosmicKrisp (Apple M3 Max), job m3-max-85028: Metal's answer bit for bit.
- lavapipe Mesa 26.2.4 (job m3-max-85083): within 1.375/255 in the compared windows.

The remainder is the device's: the same module answers Metal on KosmicKrisp, and the coordinate
reaches the sampler unchanged. pipeline/artifact.rs is not a runtime input; the runtime-sources
pin is unchanged.
2026-12-03 16:17:58 -08:00
Anees Iqbal ed46bdbfc5 Conformance ledger: the pixel-downscales rows of six venues read the exact form
The texture slot's runtime pixel sampler (`slot`) now samples the texture's level-0 element
through its state's unnormalized twin at the coordinate as given, so its answers moved. Each
venue's rows are rewritten from a clean replay of the seven cases at 306a517dc4 (the product
code of this tip), with new waiting-on texts:

- NVIDIA (RTX 3090, 620.70.06, job m3-max-85099) and Iris(R) Xe (Mesa 26.2.6, same job): `slot`
  answers the argument buffer's normalized control's (`norm`) digest at every set, bit for bit
  over every element (the probe's dumps, 172,665 a set).
- RX 7900 XTX (job m3-max-85100), 780M (alone on its node, job m3-max-85101) and RX 550 (job
  m3-max-85161), RADV Mesa 26.2.6: `grid` and `ulp` answer Metal's digests; at `frac` `norm` lies
  within 0.031/255 of Metal's and `slot` within 0.95/255, 1.5% of the samples at another sub-texel
  step. The probe's half-step set shows RADV rounding a half step of the 1/256 grid to the even
  step where Metal rounds up (every even one of 86,333, none of the 86,332 odd), the device's own
  arithmetic: the same module answers Metal bit for bit on KosmicKrisp (job m3-max-85028).
- llvmpipe (Mesa 26.2.4, LLVM 23.1.1, the pinned image's; job m3-max-85083): `slot` and `norm`
  answer one digest at `grid` and `ulp`; at `frac` `slot` lands within 1.375/255 of Metal's in
  the compared windows, `norm` within 1/255.

No row says ours. docs/CONFORMANCE-COVERAGE.md is regenerated
(scripts/conformance-coverage/coverage.py).
2026-12-03 16:17:58 -08:00
Anees Iqbal 77e2a4f187 Fix forward: the level-0 tests read fixed chunks, and two sample counts take the level-0 arm
The gate at bc7f291710 (job m3-max-85083) failed clippy under --cfg m2v_gpu and --cfg
m2v_cpu_icd on two chunks_exact calls of a constant size in the runtime's level_zero tests
(clippy::chunks_exact_to_as_chunks); they read as_chunks now. The translator suite failed two
counts the exact form changes: sample_bias_kernel's explicit-level samples are 6 (each sample's
and its level-0 arm's), and fragment_select_sample's 8 (each candidate's gradient sample and its
level-0 arm's).
2026-12-03 16:17:57 -08:00
Anees Iqbal 8947c4a8d4 Fix forward: the arrays device test makes its second set 1 with the one argument left
clippy under --cfg m2v_gpu and --cfg m2v_cpu_icd (job m3-max-85038) found set_1_is_filled_at_creation
passing the second-element switch that the dead-path deletion removed from Arrays::new.
2026-12-03 16:17:57 -08:00
Anees Iqbal 24cb048066 Conformance ledger: the pixel-downscales rows of the Apple M3 Max go
The texture slot's runtime pixel sampler now samples through the level-0 arm, at the coordinate
itself, so on KosmicKrisp (Apple M3 Max), whose filter is Metal's, the seven pixel-downscales
cases are announced with no divergence at any set: the 18 frac/slot rows of that venue no longer
diverge ("it now matches", job m3-max-85022, a clean replay of the seven cases on KosmicKrisp at
28d28599bd). docs/CONFORMANCE-COVERAGE.md regenerated.
2026-12-03 16:17:57 -08:00
Anees Iqbal 9fe45f0043 Fix forward: clippy's indexing lint, the tests of the level-0 arm, the floor profile
The first build's legs (job m3-max-84933, lavapipe) found:
- clippy (m2v_cpu_icd): level_zero_test indexed SamplerWord::ADDRESS and ADDRESS_SHIFT, which
  lower/ denies; it now zips the two arrays and takes the s and t axes;
- the level_zero device tests made Private textures, which replace_region refuses ("the CPU
  reaches no Private or Memoryless texture"); they take the descriptor's default storage mode;
- floor::the_floor_profile_states_exactly_the_floor: runtime-floor.json's m2v_runtime_floor block,
  and regen_device_profiles.py's RUNTIME_FLOOR that writes it, state the new limits (sampled
  images 262,144, samplers 32,000, per-stage resources 458,760, all pools 490,752);
- eight translator tests that count a slot sample's instructions now count the level-0 arm's
  explicit level-0 sample or operand-less gather beside the device path's, and its own sign
  extract of a dynamic offset; the tests' operand-mask helpers read a mask only where the
  instruction holds one.
2026-12-03 16:17:57 -08:00
Anees Iqbal 7a6b0d10bc Runtime: delete the paths of a device that reads no attachment
With set 1's floor raised for the level-0 elements, every device that meets the floor holds the
sampled-texture array's second elements, so Capabilities::attachment_reads is always true and
every path for a device without it was dead. Deleted: the device core's attachment_reads field,
Arrays::new's second-element switch (second elements are always written null on displacement),
the device-level conjunct of Plan::reads_attachments and of the two readable tests in
RenderCommandEncoder::attachment_reads (the limit-driven Gap::Draw of AttachmentRead and
FetchedAttachment), and the tests' branches and skips for such a device (draw, fetch,
held_loop_reads, over_reads, real_size_overs, real_size_renders, visibility). The refusal's doc
no longer names the device-level cause.

Kept, by the consumer's checkout (reims-vgpu development 76e6c90369, git grep -w):
- floor::Capabilities::attachment_reads: 3 hits. rt_platform/device.rs:1589 reads it into its
  forms report, and :2833 and :2846 are that report's test. The field stays, documented as always
  true and read nowhere in the runtime.
- DrawKind::AttachmentRead: 6 hits (rt_platform/render.rs:298, rt_platform/diag.rs:26, 3069 and
  3108, rt_platform/unbuilt.rs:21). The variant stays: texture-level causes still raise it (a
  read from the vertex function, a written texture, a depth or stencil attachment, an image with
  neither the feedback usage nor a shadow, two attachments of one image, a shadow's one layer, a
  surface plane in its stand-in).

REFUSALS.md and the API signature table regenerated with no change; no public item removed, so
api_surface is unchanged.
2026-12-03 16:17:57 -08:00
Anees Iqbal 43f22a5661 Docs, versions and API tables: the level-0 elements and unnormalized twins
The runtime's README describes set 1's sampled-image array of 196,608 elements (textures, second
elements, level-0 elements) and the plain sampler array's 8,000 unnormalized twins, the level-0
element written at the first dispatch or draw that samples a texture through a state that reads
unnormalized (Gauges::level_zero_views), the floor's limits (sampled images 262,144, samplers
32,000, per-stage resources 458,752, all pools 490,752; Vulkan's least with descriptorIndexing is
500,000), and attachment reads on every device. docs/RESOURCE-ID.md gives the two ranges, the word
test and what a consumer laying the arrays out itself writes; an argument buffer's sampler still
scales a pixel coordinate. The API signature table is blessed and api_surface names the two consts.

Versions: SEMANTICS_VERSION 2375 (slot pixel samples gain the exact arm, and the interface's
level_zero_samplers), ARTIFACT_FORMAT_VERSION 610 (TextureSlot's codec gains level_zero_samplers),
RUNTIME_VERSION 2574 (set 1's sizes, twins, level-0 elements and the floor's limits).
REFUSALS.md regenerated with no change.
2026-12-03 16:17:56 -08:00
Anees Iqbal 8f69218029 Translator and runtime: a runtime pixel sampler samples at x itself through the level-0 element
The planner's group C ruling: a sample or gather through a runtime sampler slot whose state reads
unnormalized coordinates takes Metal's coordinates as they are, not scaled into normalized ones.

Translator: a slot sample or gather of a 1D or 2D texture, not an array, not multisampled, not
depth, with no compare, no residency, no footprint and no offset base, through [[sampler(n)]],
n < 16, records the sampler in TextureSlot::level_zero_samplers and branches on the sampler's word
(SamplerWord::reads_unnormalized: PIXEL with nearest or linear filters, clamp-to-edge or
clamp-to-zero or clamp-to-border s and t) and on the texture index (below 65,536). The exact arm
hands x itself, moved by its offset, at explicit level 0, to the sampler's unnormalized twin
(plain sampler element index + UNNORMALIZED_TWIN_ELEMENT) and the texture's level-0 element
(sampled element index + LEVEL_ZERO_ELEMENT); every other word runs the existing path.

Runtime: set 1's sampled array holds 3 x 65,536 elements (textures, seconds, level-0) and the
plain sampler array 16,000 (states, then their twins). A state whose word reads unnormalized
writes its unnormalized twin. A texture of one 1D or 2D layer writes its level-0 element at the
first dispatch or draw that samples it through such a state: its own sampled view for one level,
else a view of its first level it owns (Gauges::level_zero_views), released with the texture.
The floor's limits grow to hold the arrays (sampled images 4 x 65,536, samplers 32,000), which
every second element now fits, so Capabilities::attachment_reads is always true.
2026-12-03 16:17:56 -08:00
Anees Iqbal 4db5449f4d Tests: a texture's level-0 view, made at its first pixel-state sample, counted (red)
The planner's group C ruling builds the exact form for runtime pixel samplers with a texture's
level-0 element made at the first bind that needs it, not at the texture's making. This commit
adds Gauges::level_zero_views (the views of a texture's first level alone that textures hold at
their level-0 elements), its entries in the replay's gauge list, the harness's loop gauges and the
teardown's matrix rows, and the device tests in tests/level_zero.rs:

- texel centres sampled through a linear clamp-to-edge pixel state answer the texels, for a
  37 by 23 RGBA8Unorm texture of one level and of six;
- a six-level texture makes one view at its first dispatch through a pixel state and none at its
  making, through a normalized state, at its next binds or through a second pixel state; a
  one-level texture makes none; the view goes with its texture;
- the same through draws (dl_runtime), the draws answering texel (0, 0);
- 200 textures made, sampled once and dropped hold the gauge at 1 while used and 0 after each.

Nothing raises the gauge yet, so the tests are red.
2026-12-03 16:17:56 -08:00
Anees Iqbal 5bfaa69869 Translator: BGR10_XR and BGRA10_XR textures leave the raw-held forms
With their textures held as the UNORM codes of their bits (the previous commit),
ExtendedRange::of no longer names MTLPixelFormatBGR10_XR (554) or MTLPixelFormatBGRA10_XR (552).
Their srgb=false forms stay for the two live uses that hold raw codes: a texture buffer's words
(texel_words builds Bgr10/Bgra10 { srgb: false } itself; the words path decodes and encodes them
through lower::arith::extended_range) and, until their render targets are built, a render
pipeline's colour attachment (ExtendedRange::of_attachment, through the formats' second, raw
candidate; the pipeline is made as before, and no pass draws into one).

- ExtendedRange::HEAP_READ drops them (7 to 5): an argument buffer's 552 or 554 texture is an
  element of the sampled float class, read through the step's arm (its handle's bit 30), not raw
  in the unsigned integer class (bind::heap::raw_held). The heap's class layout loses the two
  extended entries.
- texel_format::crosses_classes still excludes them (metal::format::extended_unorm), and a heap's
  storage element of one is still refused NotImplemented(ArgumentBufferTextures).
- The attachment sites (color_writes' extended_range_colors and merges_extended, link's fetch
  refusal, bfloat blend, written and unwritten attachments, alpha-to-coverage, stage_io's missing
  attachment, write_conversion) read ExtendedRange::of_attachment: every answer for a 552 or 554
  attachment is the one before.
- The extended-range sRGB twins and the two-plane forms keep their raw paths (RGB10A8_2P_XR10's
  goes with its two images).

Tests: the format table test asserts both formats' first candidate is ExtendedRangeUnorm with no
raw-held form, an attachment form, a raw second candidate, and no cross-class read; a new runtime
test samples a BGRA10_XR texture through an argument buffer's half member and a BGR10_XR one
through its float member (examples/heap_samples' hs_sample, a constexpr and a slot sampler).

Consumer search (reims-vgpu at 35cea45c0e, *.rs, *.c, *.h): 0 hits for HEAP_READ, heap_read(,
ExtendedRange, "Bgr10 {", "Bgra10 {", WordLayout::Extended, texel_words and crosses_classes;
ExtendedRangeColor appears only in crates/reims-vgpu-c/link-order.txt. Formats still reaching
the raw-held path: the extended-range sRGB twins, the two-plane forms, the padded R10X6/RG10X12
forms and their twins, RGB10A2Unorm_sRGB and the bfloat forms.

SEMANTICS_VERSION 2374 (the heap's class layout and its reads). ARTIFACT_FORMAT_VERSION unchanged
(no encoded type changes). RUNTIME_VERSION 2573 (bind's heap class layout); runtime-sources.sha256 re-pinned.
api_signatures blessed: ExtendedRange::HEAP_READ is [ExtendedRange; 5] (a consumer indexing its
two first entries breaks; none in the consumer). REFUSALS.md unchanged.
2026-12-03 16:14:42 -08:00
Anees Iqbal 58988c6b83 Translator and runtime: BGR10_XR and BGRA10_XR textures are held as the UNORM codes of their bits and read as Metal's values
An arm64 guest walk met MTLPixelFormatBGR10_XR (554) and MTLPixelFormatBGRA10_XR (552), which the
runtime refused (Gap::TextureFormat): the translator held them raw in an integer format whose
values the identity domains do not convert.

A texture of either is now held in the UNORM format of its bits (FormatEmulation::ExtendedRangeUnorm):
BGR10_XR in A2R10G10B10_UNORM_PACK32, bit-identical, its alpha read as one; BGRA10_XR in
R16G16B16A16_UNORM, viewed with red and blue exchanged. Copies, blits, getBytes and replaceRegion
move Metal's bytes unchanged. The emulation is admitted for sampling, linear filtering and min/max
reductions; a device whose format query lacks the usage is refused the texture. The runtime's form
admits it.

Every float or half sample, gather and read of a sampled colour image (lower::texture::extended_unorm)
tests the texture's word: a slot's pushed resource ID word, format (word >> 16) in 552..554; an
argument buffer member's handle, which now carries the word's low bits and bit 30 where the word
names one of those formats (AccessPlan::heap_extended). Where it does, each lane holding a channel's
code (the word's border-texel bits: code lanes, and alpha lanes) is mapped from the field's value u to
Metal's (c - 384) / 510: w = u * m (m = 1023, or 65535 / 64), a read's and a gather's code taken
whole (a 16-bit field's floor(w + 1/128), whatever its low 6 bits hold; a 10-bit field's nearest
code, floor(w + 1/2), as NVIDIA's gather on the RTX 3090 widens a 10-bit code by replicating its
bits, (c << 6 | c >> 4) / 65535, up to 0.015 of a code low, m3-max-85756), alpha clamped to [384, 894], and the quotient formed as n * KH + n * KL
(KH + KL the f32 split of 1/510), which rounds once to Metal's correctly rounded value at every code,
fused or not (unit tests over all 1024 codes of both formats, and of a replicated 10-bit code). The difference, both products and the sum are
decorated NoContraction: lavapipe otherwise factored the sum into n * fl(1/510), which misrounds 572
of the codes (the first try replay's reads one f32 step off at exactly the codes that misround). A read the device's robustness bounds
tests its operands inside the branch and reads a code lane outside as 0, Metal's out-of-bounds texel.
A sample is the device's filter of the codes, which the affine map keeps. On a real card a
nearest sample is Metal's value exactly: the RX 7900 XTX's every nearest sample of both formats,
m3-max-85664. Lavapipe converts a field by its reciprocal, c * fl(1 / (2^b - 1)), as
PrecisionNote::DeviceTexelConversion records, and the map keeps that: its nearest sample of
BGRA10_XR's code 602 is four f32 ulps from Metal's (m3-max-85482, LLVM 23.1.1; m3-max-85612, LLVM
23.1.4). The runtime test compares nearest samples exactly, on lavapipe (cfg m2v_cpu_icd) against
lavapipe's conversion so mapped.

A render pipeline with a 552 or 554 colour attachment is made as before, through the formats'
second, raw candidate (R32_UINT, R16G16B16A16_UINT; emulation ExtendedRange): their render targets
are not built, and a texture of either with RenderTarget usage takes that candidate, which the
runtime refuses (Gap::TextureFormat), so no pass draws into one. A storage element is not built
(the storage choice refuses the emulation).

Not built (the runtime's known gaps, docs/API.md): a sample past the edge through a border address
mode reads the device's border in code space (opaque white 1.2529, BGRA10_XR's 1.2549; black
-0.7529); a linear sample of a BGRA10_XR texel whose fields' low 6 bits are set filters them in
(within 63/64 of a code step); every float sample, gather and read of a sampled colour image pays
the word's test and branch.

SEMANTICS_VERSION 2373 (module words: the arm, the handle's bits). RUNTIME_VERSION 2572 (a run views an
extended-range format held as its UNORM codes); runtime-sources.sha256 re-pinned. api_signatures
blessed: FormatEmulation::ExtendedRangeUnorm added
(a consumer matching FormatEmulation exhaustively meets a new variant; the enum is non_exhaustive).
REFUSALS.md unchanged.

The ledger's llvmpipe rows for extended-swizzles-bgr10xr gain the four border sites (0ag1/g2,
0ag1/sl, 0ag1/sn, ar10/g1) the replay on lavapipe at the CI pin (Mesa 26.2.4, LLVM 23.1.1) shows,
m3-max-85482, and its BGRA10_XR rows of nearest and linear samples name the low-bits gap beside
the border's: most of the case's random fields hold low bits, which a sample filters in. Lavapipe's
conversion shows at none of the case's elements (each texel's fields checked against lavapipe's
reciprocal conversion). Coverage regenerated.
2026-12-03 16:14:41 -08:00
Anees Iqbal 5d628eeee8 Tests: BGR10_XR and BGRA10_XR textures are made and read as Metal's values (red)
The runtime refuses a texture of MTLPixelFormatBGR10_XR (554) or MTLPixelFormatBGRA10_XR (552)
(Gap::TextureFormat): the translator holds them raw in an integer format whose values its identity
domains do not convert. An arm64 guest walk met them.

A new runtime test, every_device_reads_samples_and_gathers_extended_range_values, makes a 4 by 2
texture of each, holding codes at the ends, at the values 0 and 1, and alphas outside [0, 1], with
the bits Metal does not read set in every other texel, and through the owned fixture
fpv_swizzled_reads checks: the bytes come back from getBytes as replaceRegion wrote them; a read
and a nearest sample of each texel answer (c - 384) / 510 correctly rounded, alpha clamped to
[0, 1] and BGR10_XR's alpha 1; a gather of each component answers its four texels; a linear
sample between four texels answers the mean of their codes' value within 1e-3; and through a view
of the swizzle alpha, blue, zero, red each lane its source.

The conformance ledger drops the refused rows of texture-round-trip-552 and -554,
fresh-pattern-552 and -554, and extended-swizzles-bgr10xr and -bgra10xr, whose textures are made
next; the coverage doc is regenerated.

Red: the test fails at new_texture with the refusal, and the six cases' replays fail on the
unlisted refusal, until the next commit.
2026-12-03 16:14:41 -08:00
Anees Iqbal 41438f2693 Translator: a depth cube's read by face samples its cube view, as a colour cube's does
A read of a depth cube or depth cube array by face (depthcube<float, access::read>'s
read(coord, face, lod), air.read_depth_cube and air.read_depth_cube_array) was refused on every
profile, Unsupported{IdentityDomains; NotImplemented}: the read kept the 2D-array view
(RuntimeFact::ImageViewShape), which the identity arrays hold no element of. The resident tables
built it before the cutover to the one form, and that commit deleted its interpreter test with
them; the runtime's README listed it as a known gap.

A colour cube's read by face already samples its cube element, the texture's cube view, at the
texel's centre and the read's explicit level through element 0 of the plain sampler array (the
default sampler, nearest, every level), its operands tested in the shader. A depth cube's element
is its cube view of the depth, which that plain float sampler samples without a comparison as a
depth cube's sample() does, the depth the sample's first component. So slot::samples_cube_element
no longer excludes a depth shape: the read takes the same form, and the slot states no
ImageViewShape.

Tests:
- engine_texture's an_identity_cube_read_by_face_samples_its_cube_element compiles
  unk_read_depth_cube too, on every identity profile: L3 passes, no ImageViewShape fact, its two
  textures from the sampled float depth cube and depth cube-array classes, its sampler from the
  plain array, OpImageSampleExplicitLod and no OpImageFetch. Red with slot.rs at the base.
- The runtime's tests::cube_reads gains cr_depth (a Depth32Float depth cube of three levels) and
  cr_depth_array (a depth cube array of two cubes and two levels): every texel of every face,
  level and cube reads its uploaded depth bit for bit, and each read outside the texture reads 0.
- scripts/qualify-public-cases, CI's step, qualifies the public case
  depth-cube-and-cube-array-reads-at-32-and-16-bit-coordinates (3 x 3 depth textures, every
  texel of every face and cube, depths over many binades) on lavapipe against its Apple M3 Max
  observation.

Docs: lower::texture's module docs, slot.rs, emit.rs, API.md and RESOURCE-ID.md say a depth
cube's read by face samples its cube view; the runtime README's known gap loses the depth cube
read and names it lowered. engine_texture_unk's module docs no longer claim an interpreter run of
the depth cube reads.

Engine inventory: engine/unk_read_depth_cube.ll moves from Unsupported{IdentityDomains;
NotImplemented} to ok on all 15 profiles; its .air.ll twin moves at the M3 bless.
SEMANTICS_VERSION 2365 -> 2367 (a placeholder, renumbered at landing): the fixture's 15 golden
cells, one a profile, change from the refusal to modules, and no other cell moves. The golden
table and the authored compile census (the case's row, not_supported today) are re-blessed on
development.

Verified, at this commit's tree on 6459eaa946 (rebased since onto the sparse path's deletion,
whose only overlap is the SEMANTICS line):
- m3-max-85654, on the CPU with no device: the engine inventory's eight llvm_as parts differ
  from the table by nothing (the row moved with the change). Red, with slot.rs at the base:
  an_identity_cube_read_by_face_samples_its_cube_element fails at the depth cube; green: it and
  the 20 other cube tests of the translator pass. The golden table's cells: 105 change at this
  commit, the base's 90 (development's, blessed since) and unk_read_depth_cube's 15, the two lists
  otherwise equal. The refusal surface's check, fmt, signatures, clippy (plain, --cfg m2v_gpu,
  --cfg m2v_cpu_icd), Rustdoc, private docs, doctests and scripts/api-docs pass; the metal2vulkan
  suites ran 3,471 tests: 3,470 passed, 24 skipped, and the failure is
  golden_hashes_match_the_table, whose table is blessed on development; validation ran 1,344
  tests, all passed, 2 skipped; conformance ran 1,053, all passed.
- m3-max-85654, on devices: the runtime's every_device_reads_a_cube_by_face_as_its_texels, with
  the depth cube and depth cube array rows, passes on lavapipe (llvmpipe, LLVM 23.1.1, 256 bits,
  m2v_cpu_icd) and on the RTX 5080 Laptop GPU (m2v_gpu).
- m3-max-85654, CI's lavapipe image: scripts/qualify-public-cases exits 0, every case's slot
  current, the depth cube case's among them.
- m3-max-85857, on the CPU with no device, at this commit on the sparse path's deletion: clippy
  of the workspace (all targets and features) passes, and the 34 cube and engine-inventory tests
  of the translator all pass.
2026-12-03 16:14:41 -08:00
Anees Iqbal ee45758ba9 Translator: a sparse read through a sampler reads its texel, resident
Metal 4.1's sparse_read(sampler s, coord, offset, lod), a read through a sampler whose function
observes bit 0 of its status word (sparse_color::resident()), was refused in the texture family
(Unsupported{Lowering(Texture); NotImplemented}): what a sampler's addressing does to the residency
of a sparse texture's texels was unmeasured, the M3 having read only a texture that is not sparse.
With an observed residency now the constant resident word and the runtime making no sparse
texture, the question is Metal's answer over a texture that is not sparse, through each kind of
addressing, inside the texture and outside it.

Measured, with the new owned fixture engine/a2_sparse_read_through (a texture2d<float> read at
p[i] through constexpr clamp_to_edge, clamp_to_zero, clamp_to_border of opaque white, and repeat,
storing each colour and each resident()), over a 4x4 RGBA32Float texture of two levels at twelve
positions: inside the texture, one and several texels past each edge, at level 1, and at levels 2
and 5, past its last. On the Apple M3 Max (macOS 27.0.1), plain and under Metal's validation layer
(which reported nothing), every residency is resident, at every position through every sampler,
and every colour is the one a read through that sampler reads (the read_through family's rules:
the edge texel through clamp_to_edge and repeat, the border texel through the two border modes,
zero in every lane past the last level). So the read takes the constant word as every other
observed residency does, and select_read's refusal goes. Nothing else changes: the read through a
sampler and the word were each built already.

Tests:
- engine_texture_oob/through.rs's
  a_sparse_read_through_a_clamp_to_edge_sampler_reads_its_texel_resident runs sparse_edge (the
  test's Metal 4.1 module, storing 1.0 in lane 3 where resident) and edge_plain (the same read with
  its word unused) on every profile and class over a two-level 4x4 texture: inside, past each edge,
  at i32::MIN, at level 1 and past the last level, each reads the clamp-to-edge texel (zero past
  the last level) and sparse_edge's lane 3 reads 1.0 at every row; it links and passes spirv-val
  on every profile where it translates. It replaces
  a_sparse_read_through_a_clamp_to_edge_sampler_is_refused.
- engine_identity's a_sparse_access_of_a_texture_slot_is_resident compiles a2_sparse_read_through
  too, on every identity profile and moltenvk-m3 without robustImageAccess2: L3 passes, the
  interface states no specialization constant but the dispatch's, and the module holds no
  OpImageSparse* instruction.
- The conformance case sparse-read-through (cases/sparse_read_through.rs, the fixture's kernel,
  12 threads) records the M3 Max's colours and residencies, and Metal's times. It declares
  simdgroup-access-order, which loosens no value: the kernel writes out[5 * i + k] for five k,
  stores the translator does not find disjoint between two threads of one SIMD-group, so the
  runtime's pipeline notes it on every device (announced on lavapipe), as for the other cases
  with that store.

Docs: lower::texture's module docs (the read through a sampler, the status words) and API.md's
texture paragraph say a sparse read through a sampler reads resident, with the M3 Max's answer.
docs/CONFORMANCE-COVERAGE.md is regenerated.

The new fixture's companions (.ll, .air.ll, TOOLCHAIN's line) come from
scripts/regen-air-fixtures on the M3 Max; its air_input golden printout is blessed under the
pinned LLVM. Engine inventory: the new rows engine/a2_sparse_read_through.air.ll and .ll, ok on
all 15 profiles. The .air.ll row, which only macOS assembles, carries the .ll row's answer, as
every blessed pair in the table does (1,724 pairs equal; the 10 that differ are the previous
commit's, which the next bless moves); the M3 bless confirms it.

SEMANTICS_VERSION 2365 -> 2366 (a placeholder, renumbered at landing): a function with such a
read translated to a refusal and now translates. The golden table gains the new fixture's rows at
the next pin's bless; no other cell moves (the cells that change at this commit are the previous
commit's 237, cell for cell).

Verified:
- m3-max-85077, the Apple M3 Max (macOS 27.0.1): the fixture's companions from
  scripts/regen-air-fixtures, and its kernel plainly and under the validation layer (the answers
  above).
- m3-max-85084 and m3-max-85200, the M3 Max: the recording of sparse-read-through, plain and under
  the validation layer, and its times.
- m3-max-85550, the M3 Max: the air_input golden printout, blessed under Homebrew LLVM 21.1.8,
  the pinned major.
- m3-max-85515, on the CPU with no device, at this change before its golden and row: the engine
  inventory's eight llvm_as parts differ from the table only by the new row (ok on all 15
  profiles, now in it). Red, with lower/texture/mod.rs at the previous commit:
  a_sparse_read_through_a_clamp_to_edge_sampler_reads_its_texel_resident and
  a_sparse_access_of_a_texture_slot_is_resident fail, and the control
  a_clamp_to_edge_read_clamps_its_coordinate_into_the_texture passes. Green: all three pass.
- m3-max-85600, on the CPU with no device, at this change before the .air.ll row and the
  declaration: the golden table's cells at this commit and at the previous commit are the same
  237, cell for cell; the refusal surface's check, fmt, signatures, clippy (plain, --cfg m2v_gpu,
  --cfg m2v_cpu_icd), Rustdoc, private docs, doctests and scripts/api-docs pass; the metal2vulkan
  suites ran 3,471 tests: 3,469 passed, 24 skipped, and the failures are
  golden_hashes_match_the_table, whose table is blessed at the next pin, and
  inventory_lists_every_fixture_in_order, which the .air.ll row now answers; validation ran 1,343
  tests, all passed, 2 skipped; conformance ran 1,055, all passed. In CI's lavapipe image,
  sparse-status-plain differed only as justified, and sparse-read-through differed only at its
  notices, by simdgroup-access-order, which it now declares.
- m3-max-85750, at this commit: inventory_lists_every_fixture_in_order passes, conformance ran
  1,055 tests, all passed, and in CI's lavapipe image both cases differ only as justified:
  sparse-read-through by the simdgroup-access-order notice it declares, sparse-status-plain by
  native-nan-encoding.
2026-12-03 16:14:40 -08:00
346 changed files with 33710 additions and 11546 deletions

No files matched your search

+2 -1
View File
@@ -67,7 +67,8 @@ order, and a lower one never overrides a higher one.
elsewhere; and a Shared heap's image texture in its heap on an integrated or CPU device, and
elsewhere an optimal image of its own in device memory, its heap range left unused, whose
device memory beside the heap's block is recorded as a known gap), the attachment feedback
loop (a device without it reads a render target through a counted copy of that target,
loop (a device without it, and on every device a Direct3D 11 plane, whose image takes only its
texture's bind-flag usage, reads a render target through a counted copy of that target,
recorded as a known gap), run-time texel
offsets (a device with the maintenance8 feature takes a run-time texel offset as the sampling
or read instruction's own operand; a device without it branches over the offset's values, and
+16
View File
@@ -292,6 +292,22 @@ pub struct EntryPoint {
/// as the function's `MTLFunctionReflection.userAnnotation`; it changes nothing the function
/// computes.
pub user_annotation: Option<DiagName>,
/// A vertex function (post-tessellation ones included) or a mesh function, the stages that
/// write varyings, of a module whose `llvm.module.flags` states
/// `agx.allow_mismatched_component_counts` as 1; false for every other function. The flag is
/// the module's, so it holds for each producing function the module defines. What it changes is
/// measured, not read from its name (Apple M3 Max, macOS 27.0.1): Metal makes a render pipeline
/// whose fragment function reads a user varying at another component count than its vertex
/// function writes (1 to 4 lanes of `float`, `uint` or `int`, either way) when the vertex
/// function's module states the flag as 1, and refuses the same pipeline when the vertex
/// function's module states 0 or no such flag, whether or not the fragment function's states 1
/// ("Fragment input(s) `user(locn0)` mismatching vertex shader output type(s) or not written by
/// vertex shader"); `irc.version_*` changed nothing there. In such a pipeline a narrower input
/// reads the output's first lanes, under perspective, `center_no_perspective` and flat
/// interpolation, and a wider input reads the output's lanes and, past them, values that are no
/// constant (150 such lanes read 147 distinct values, none written by the function): Metal
/// defines none. A mesh function's has not been measured.
pub mismatched_component_counts: bool,
}
impl EntryPoint {
+51 -10
View File
@@ -120,6 +120,9 @@ pub(super) fn decode(
pointees,
layouts,
};
// `agx.allow_mismatched_component_counts` stated as 1: the module's, so its producing
// functions' (`EntryPoint::mismatched_component_counts`).
let mut mismatched = false;
for &(kind, ops) in &lists {
let site = Site::module();
match kind {
@@ -137,7 +140,9 @@ pub(super) fn decode(
n.finish()?;
}
Named::CompileOptions => abi.compile = compile_options(m, ops, &site, cx.meter)?,
Named::ModuleFlags => abi.limits = module_flags(m, ops, &site, cx.meter)?,
Named::ModuleFlags => {
(abi.limits, mismatched) = module_flags(m, ops, &site, cx.meter)?;
}
Named::Ident => {
// Only the first producer is kept, so only it is allocated and charged.
for &id in ops {
@@ -271,7 +276,7 @@ pub(super) fn decode(
}
cx.meter.reserve(&mut abi.entries, ops.len())?;
for &id in ops {
abi.entries.push(entry(&mut cx, stage, id)?);
abi.entries.push(entry(&mut cx, stage, id, mismatched)?);
}
}
}
@@ -387,23 +392,50 @@ fn plain_signature(n: &mut Ops<'_>, site: &Site) -> Result<LinkageSignature, Err
}
/// `!llvm.module.flags`: `!{i32 <behavior>, !"<key>", <value>}`. The `air.max_*` limits are
/// decoded; `wchar_size`, `frame-pointer`, `SDK Version`, and debug info's `Dwarf Version` and
/// `Debug Info Version` are LLVM's and carry nothing the translation reads; `air.workaround.sampler_state_variable_length_encoding` (an `i1`) names the
/// form of the module's constexpr sampler words, which each `air.sampler_state` global's own type
/// states; any other flag is unknown.
/// decoded, and returned with whether `agx.allow_mismatched_component_counts` (an integer, 0 or
/// 1, stated at most once) is 1, which the module's vertex and mesh functions carry
/// (`EntryPoint::mismatched_component_counts`, which says what it changes). `wchar_size`,
/// `frame-pointer`, `SDK Version`, and debug info's `Dwarf Version` and `Debug Info Version` are
/// LLVM's and carry nothing the translation reads, and neither do `irc.version_major`,
/// `irc.version_minor` and `irc.version_patch` (integers), each stated once: their shapes are
/// checked and nothing is kept (a measured render pipeline linked the same whatever they state).
/// `air.workaround.sampler_state_variable_length_encoding` (an `i1`) names the form of the
/// module's constexpr sampler words, which each `air.sampler_state` global's own type states. Any
/// other flag is unknown.
fn module_flags(
m: &Module,
ops: &[MdId],
site: &Site,
meter: &mut Meter,
) -> Result<ModuleLimits, Error> {
) -> Result<(ModuleLimits, bool), Error> {
let key = Some("llvm.module.flags");
let mut l = ModuleLimits::default();
let (mut mismatch, mut major, mut minor, mut patch) = (false, false, false, false);
let mut mismatched = false;
for &id in ops {
meter.tick(1)?;
let mut n = Ops::node(m, id, site.clone())?;
n.u32(key)?;
let flag = n.string(key)?;
// The converter's flags: an integer each, stated once; the agx flag 0 or 1.
let agx = flag == b"agx.allow_mismatched_component_counts";
let shape = match flag {
_ if agx => Some((&mut mismatch, 1)),
b"irc.version_major" => Some((&mut major, u32::MAX)),
b"irc.version_minor" => Some((&mut minor, u32::MAX)),
b"irc.version_patch" => Some((&mut patch, u32::MAX)),
_ => None,
};
if let Some((seen, limit)) = shape {
let repeated = std::mem::replace(seen, true);
let value = n.u32(key)?;
if value > limit || repeated {
return Err(site.err(AbiError::BadValue, key));
}
mismatched |= agx && value == 1;
n.finish()?;
continue;
}
let slot = match flag {
b"air.max_device_buffers" => &mut l.max_device_buffers,
b"air.max_constant_buffers" => &mut l.max_constant_buffers,
@@ -435,7 +467,7 @@ fn module_flags(
}
n.finish()?;
}
Ok(l)
Ok((l, mismatched))
}
/// `!{ptr @init, !"<type>", !"<name>", i32 <index>[, i1 <flag>]}`.
@@ -501,8 +533,15 @@ fn global_binding(cx: &mut Cx<'_, '_>, id: MdId, site: &Site) -> Result<GlobalBi
cx.global_binding(node, global)
}
/// An entry node: `!{ptr @fn, !outputs, !inputs, <stage attribute>...}`.
fn entry(cx: &mut Cx<'_, '_>, stage: Named, id: MdId) -> Result<EntryPoint, Error> {
/// An entry node: `!{ptr @fn, !outputs, !inputs, <stage attribute>...}`, of a module whose
/// `agx.allow_mismatched_component_counts` is 1 where `mismatched`, which a vertex or mesh
/// function carries.
fn entry(
cx: &mut Cx<'_, '_>,
stage: Named,
id: MdId,
mismatched: bool,
) -> Result<EntryPoint, Error> {
cx.meter.tick(1)?;
let m = cx.m;
let module_site = Site::module();
@@ -596,6 +635,8 @@ fn entry(cx: &mut Cx<'_, '_>, stage: Named, id: MdId) -> Result<EntryPoint, Erro
outputs,
name,
user_annotation,
mismatched_component_counts: mismatched
&& matches!(stage, Stage::Vertex { .. } | Stage::Mesh { .. }),
})
}
+90
View File
@@ -3436,6 +3436,95 @@ fn static_samplers_decode_from_their_globals() {
);
}
/// The converter's module flags (`agx.allow_mismatched_component_counts`, `irc.version_*`) are
/// checked for their shapes, and a module with no entry decodes as without them: `irc.version_*`
/// is kept nowhere, and the agx flag only on producing entries (the next test).
#[test]
fn converter_module_flags_are_checked_and_dropped() {
let flags = |nodes: &[(u64, &'static str, u64)]| {
let nodes = nodes.to_vec();
module_with(move |b| {
let ids: Vec<MdId> = nodes
.iter()
.map(|&(behavior, key, value)| node(b, &[I(behavior), S(key), I(value)]))
.collect();
b.named_md("llvm.module.flags", &ids);
})
};
let plain = flags(&[(7, "air.max_textures", 128)]).unwrap();
let with = flags(&[
(7, "air.max_textures", 128),
(7, "agx.allow_mismatched_component_counts", 1),
(1, "irc.version_major", 3),
(1, "irc.version_minor", 1),
(1, "irc.version_patch", 4),
])
.unwrap();
assert_eq!(with.limits, plain.limits);
assert_eq!(with.compile, plain.compile);
flags(&[(7, "agx.allow_mismatched_component_counts", 0)]).unwrap();
flags(&[(1, "irc.version_major", 3)]).unwrap();
for refused in [
&[(1, "irc.version_major", 3), (1, "irc.version_major", 3)][..],
&[
(7, "agx.allow_mismatched_component_counts", 1),
(7, "agx.allow_mismatched_component_counts", 1),
][..],
&[(7, "agx.allow_mismatched_component_counts", 2)][..],
] {
expect_abi(flags(refused), AbiError::BadValue);
}
expect_abi(flags(&[(7, "agx.something_else", 1)]), AbiError::UnknownKey);
}
/// `agx.allow_mismatched_component_counts` stated as 1 is the module's, kept on each vertex and
/// mesh function it defines (`EntryPoint::mismatched_component_counts`); its fragment, kernel and
/// object functions never carry it, and a module stating 0 or nothing keeps it off everywhere.
#[test]
fn the_agx_flag_is_kept_on_the_module_s_producing_functions() {
let lists: [(&str, &[&str]); 5] = [
("air.vertex", &["v", "v2"]),
("air.fragment", &["f"]),
("air.kernel", &["k"]),
("air.object", &["o"]),
("air.mesh", &["m"]),
];
let decoded = |flag: Option<u64>| {
module_with(move |b| {
if let Some(v) = flag {
let n = node(b, &[I(7), S("agx.allow_mismatched_component_counts"), I(v)]);
b.named_md("llvm.module.flags", &[n]);
}
let void = b.void();
for (list, names) in lists {
let entries: Vec<MdId> = (names.iter())
.map(|name| {
let f = entry_fn(b, name, void, &[]);
let (outputs, inputs) = (node(b, &[]), node(b, &[]));
node(b, &[F(f), N(outputs), N(inputs)])
})
.collect();
b.named_md(list, &entries);
}
})
.unwrap()
};
let flagged = |abi: &AirAbi| {
let mut on: Vec<String> = (abi.entries.iter())
.filter(|e| e.mismatched_component_counts)
.map(|e| e.name.to_string())
.collect();
on.sort_unstable();
on
};
let abi = decoded(Some(1));
assert_eq!(abi.entries.len(), 6);
assert_eq!(flagged(&abi), ["m", "v", "v2"]);
for off in [Some(0), None] {
assert!(flagged(&decoded(off)).is_empty(), "{off:?}");
}
}
#[test]
fn visible_function_references_and_signatures() {
let abi = module_with(|b| {
@@ -5340,6 +5429,7 @@ fn reach_entry(roles: Vec<ParamRole>) -> EntryPoint {
outputs: Vec::new(),
name: DiagName::new("k"),
user_annotation: None,
mismatched_component_counts: false,
}
}
@@ -77,12 +77,12 @@ use super::ModuleValue;
use crate::budget::Meter;
use crate::error::{BitcodeError, DiagName, InputError, InputErrorKind, IntrinsicError, Location};
use crate::error::{Error, Feature, Limit};
use crate::intrinsics::{self, Bound, DeclClass};
use crate::intrinsics::{self, Bound, DeclClass, LegacyAlignmentError};
use crate::ir::{
AddrSpace, Align, Arena, Atomic, AtomicRmwOp, Block, BlockId, Body, Call, CallAttrs, Callee,
CastOp, Const, ConstId, ConstTable, FastMath, FloatPredicate, FuncId, Function, Inst, InstId,
InstKind, IntFlags, IntPredicate, LoopHints, Md, MdId, Ordering, RangeMd, Sym, Symbols,
SyncScope, TailKind, Type, TypeId, TypeTable, Unroll, Value,
InstKind, IntFlags, IntPredicate, LoopHints, Md, MdId, Ordering, ParamAttrs, RangeMd, Sym,
Symbols, SyncScope, TailKind, Type, TypeId, TypeTable, Unroll, Value,
};
const B: u32 = FUNCTION_BLOCK;
@@ -1180,6 +1180,7 @@ impl FnDecoder {
volatile,
atomic,
range: None,
speculative: false,
};
self.push(s, cx, code, (ty, tid), kind, m)
}
@@ -1535,7 +1536,7 @@ impl FnDecoder {
return self.drop_call(s, cx, m);
}
let mut enums = SiteEnums::default();
let attrs = match list {
let mut attrs = match list {
None => None,
Some(list) => {
let bc_params = cx.bc_types.params(fn_bc).unwrap_or(&[]);
@@ -1558,6 +1559,22 @@ impl FnDecoder {
}))
}
};
if let Target::Intrinsic(_, class) = &target {
// An older LLVM's memory intrinsic takes its alignment as an operand; the current
// form states it as the pointers' `align` attribute, which lowering reads. A constant
// alignment that is not a power of two is a malformed record, as an `align`
// attribute of that value is.
let upgraded = intrinsics::upgrade_legacy_memory(*class, &mut args, cx.consts)
.map_err(|e| match e {
LegacyAlignmentError::Intrinsic(e) => {
Error::from(InputError::new(InputErrorKind::Intrinsic(e), s.location()))
}
LegacyAlignmentError::Malformed => bad(),
})?;
if let Some(legacy) = upgraded {
attrs = upgrade_legacy_attrs(attrs, &mut enums, legacy, m)?;
}
}
let callee = match target {
Target::Callee(c) => c,
Target::Intrinsic(f, class) => match intrinsics::bind(class, &args, cx.consts) {
@@ -1739,6 +1756,46 @@ impl FnDecoder {
}
}
/// `attrs` and `enums` of a legacy memory intrinsic's call, upgraded as LLVM's reader does: the
/// removed alignment operand's attributes go with it, the later positions move down, and the
/// leading pointer operands' `align` is the alignment the operand stated (replacing their own,
/// none for an alignment of 0).
pub(super) fn upgrade_legacy_attrs(
attrs: Option<Box<CallAttrs>>,
enums: &mut SiteEnums,
legacy: intrinsics::LegacyAlignment,
m: &mut Meter,
) -> Result<Option<Box<CallAttrs>>, Error> {
if enums.params.len() > legacy.removed {
enums.params.remove(legacy.removed);
}
let CallAttrs { func, ret, params } = match attrs {
Some(a) => *a,
None if legacy.align.is_none() => return Ok(None),
None => {
m.charge(std::mem::size_of::<CallAttrs>())?;
CallAttrs::default()
}
};
let mut params = params.into_vec();
if params.len() > legacy.removed {
params.remove(legacy.removed);
}
if legacy.align.is_some() {
let missing = legacy.pointers.saturating_sub(params.len());
m.reserve(&mut params, missing)?;
params.resize(params.len().max(legacy.pointers), ParamAttrs::default());
}
for p in params.iter_mut().take(legacy.pointers) {
p.align = legacy.align;
}
Ok(Some(Box::new(CallAttrs {
func,
ret,
params: params.into_boxed_slice(),
})))
}
/// What a call's callee operand names, before its arguments are read.
enum Target {
/// A direct or indirect call.
@@ -12,10 +12,11 @@ use super::ModuleTables;
use crate::bitstream::writer::Writer;
use crate::error::BitcodeError;
use crate::error::{Error, Feature};
use crate::intrinsics::{LlvmIntrinsic, Template};
use crate::ir::print::print;
use crate::ir::{
BlockId, Callee, Const, FuncId, InstId, InstKind, IntFlags, IntPredicate, Md, MdId, Type,
Unroll, Value,
Align, BlockId, Callee, Const, FuncId, InstId, InstKind, IntFlags, IntPredicate, Md, MdId,
Type, Unroll, Value,
};
const STRTAB: &[u8] = b"kair.x";
@@ -1305,3 +1306,270 @@ fn legacy_metadata_records_read_as_their_modern_twins() {
refused(decode_err(legacy_module(&[(8, vec![6, 0])], 5)), 8);
refused(decode_err(module_with(&[(9, vec![0, 2])], &[])), 9);
}
/// How a legacy memory intrinsic's alignment operand is written in [`legacy_copy_module`], and
/// its volatile flag where that is not `false`.
#[derive(Clone, Copy)]
enum LegacyAlign {
/// An `i32` constant.
Constant(u64),
/// The kernel's second parameter.
Parameter,
/// An `i32` constant, the volatile flag being the kernel's second parameter.
VolatileParameter(u64),
}
/// `@k(ptr addrspace(1) %p [, i32 %a | i1 %v])` calling `llvm.memcpy.p1i8.p1i8.i64` as an LLVM
/// before the alignment moved to the pointers' attributes declared it, `void (ptr, ptr, i64, i32,
/// i1)`: `memcpy(%p, %p, 400, <align>, <volatile>)`, the volatile flag `false` where it is not
/// `%v`. Types: 0 `i64`, 1 `i32`, 2 `i1`, 3 `void`, 4 `ptr addrspace(1)`, 5 the declaration's, 6
/// the kernel's. Values: `@k` 0, the declaration 1, `%p` 2, `%a` or `%v` 3 where there is one,
/// then the local constants.
fn legacy_copy_module(align: LegacyAlign) -> Vec<u8> {
const NAMES: &[u8] = b"kllvm.memcpy.p1i8.p1i8.i64";
// The kernel's second parameter's type, where it has one: `i32` for `%a`, `i1` for `%v`.
let parameter = match align {
LegacyAlign::Constant(_) => None,
LegacyAlign::Parameter => Some(1),
LegacyAlign::VolatileParameter(_) => Some(2),
};
let first_const = if parameter.is_some() { 4 } else { 3 };
stream(2, 0, NAMES, |w| {
block(
w,
codes::TYPE_BLOCK,
&[
(1, vec![7]),
(7, vec![64]),
(7, vec![32]),
(7, vec![1]),
(2, vec![]),
(25, vec![1]),
(21, vec![0, 3, 4, 4, 0, 1, 2]),
(
21,
match parameter {
Some(ty) => vec![0, 3, 4, ty],
None => vec![0, 3, 4],
},
),
],
);
w.unabbrev(8, &[0, 1, 6, 0, 0, 0, 0, 0, 0]);
w.unabbrev(8, &[1, 25, 5, 0, 1, 0, 0, 0, 0]);
// Local constants: `i64 400`, then the alignment where it is one, then `i1 false` where
// the volatile flag is.
let mut consts = vec![(1, vec![0]), (4, vec![800])];
let mut at = first_const;
let align_at = match align {
LegacyAlign::Constant(bytes) | LegacyAlign::VolatileParameter(bytes) => {
consts.extend([(1, vec![1]), (4, vec![bytes * 2])]);
at += 1;
at
}
LegacyAlign::Parameter => 3,
};
let volatile = match align {
LegacyAlign::VolatileParameter(_) => 3,
LegacyAlign::Constant(_) | LegacyAlign::Parameter => {
consts.extend([(1, vec![2]), (4, vec![0])]);
at += 1;
at
}
};
let (len, next) = (first_const, at + 1);
w.enter(u64::from(codes::FUNCTION_BLOCK), 4);
w.unabbrev(1, &[1]);
block(w, codes::CONSTANTS_BLOCK, &consts);
w.unabbrev(
34,
&[
0,
1 << 15,
5,
rel(next, 1),
rel(next, 2),
rel(next, 2),
rel(next, len),
rel(next, align_at),
rel(next, volatile),
],
);
w.unabbrev(10, &[]);
w.end();
})
}
/// A memory intrinsic declared with an alignment operand decodes to the current form: the
/// operand is gone, and its value is the `align` of the destination and the source, as LLVM's
/// reader upgrades it. Metal's compilers before the move wrote this form, and lowering reads
/// the alignment from the attribute only.
#[test]
fn a_legacy_memory_intrinsic_states_its_alignment_on_its_pointers() {
let t = decode(&legacy_copy_module(LegacyAlign::Constant(16))).unwrap();
// The upgraded call verifies against the legacy declaration.
verify_module_level(&t).unwrap();
let body = body_of_named(&t, b"k");
let call = body
.insts
.values()
.find_map(|i| match &i.kind {
InstKind::Call(c) => Some(c),
_ => None,
})
.unwrap();
assert!(matches!(
call.callee,
Callee::Llvm {
op: LlvmIntrinsic::Memcpy {
volatile: false,
..
},
..
}
));
assert_eq!(call.args.len(), 4);
let sixteen = Align::from_bytes(16);
let params = &call.attrs.as_ref().unwrap().params;
assert_eq!(
params.iter().map(|p| p.align).collect::<Vec<_>>(),
[sixteen, sixteen]
);
// An alignment of 0 states none.
let none = decode(&legacy_copy_module(LegacyAlign::Constant(0))).unwrap();
verify_module_level(&none).unwrap();
let call = body_of_named(&none, b"k")
.insts
.values()
.find_map(|i| match &i.kind {
InstKind::Call(c) => Some(c.clone()),
_ => None,
})
.unwrap();
assert_eq!(call.args.len(), 4);
assert!(call.attrs.is_none());
}
/// An alignment that is not a constant power of two is refused, not dropped: one that is not a
/// constant as `ImmediateNotConstant`, and a constant that is not a power of two as a malformed
/// record, as an `align` attribute of that value is.
#[test]
fn a_legacy_memory_intrinsic_s_alignment_must_be_a_constant_power_of_two() {
let e = decode(&legacy_copy_module(LegacyAlign::Parameter))
.map(|_| ())
.unwrap_err();
assert!(format!("{e:?}").contains("ImmediateNotConstant"), "{e:?}");
let e = decode(&legacy_copy_module(LegacyAlign::Constant(24)))
.map(|_| ())
.unwrap_err();
assert_eq!(
bitcode_kind(&e),
Some(&BitcodeError::MalformedRecord {
block: codes::FUNCTION_BLOCK,
code: codes::FUNC_CALL,
}),
"{e}"
);
}
/// A legacy call whose volatile flag is not a constant where it is made is upgraded as any
/// other, and keeps its template (`Callee::Unbound`) as a current-form call does, for
/// specialization to bind where inlining makes the flag a constant. The verifier takes it one
/// operand short of the legacy declaration, as it takes the bound call.
#[test]
fn a_legacy_memory_intrinsic_with_an_unbound_volatile_flag_verifies() {
let t = decode(&legacy_copy_module(LegacyAlign::VolatileParameter(16))).unwrap();
let call = body_of_named(&t, b"k")
.insts
.values()
.find_map(|i| match &i.kind {
InstKind::Call(c) => Some(c),
_ => None,
})
.unwrap();
assert!(matches!(
call.callee,
Callee::Unbound {
template: Template::Llvm(LlvmIntrinsic::Memcpy { .. }),
..
}
));
assert_eq!(call.args.len(), 4);
let sixteen = Align::from_bytes(16);
let params = &call.attrs.as_ref().unwrap().params;
assert_eq!(
params.iter().map(|p| p.align).collect::<Vec<_>>(),
[sixteen, sixteen]
);
verify_module_level(&t).unwrap();
}
/// An upgraded call's attributes move as LLVM's reader moves them: the removed alignment
/// operand's (position 3) go with it, the volatile flag's (position 4) become position 3's, and
/// the pointers' `align` is the operand's, replacing their own; an alignment of 0 removes it.
#[test]
fn a_legacy_memory_intrinsic_s_attributes_move_with_its_operands() {
use super::enum_attrs::{EnumAttrs, SiteEnums};
use super::function::upgrade_legacy_attrs;
use crate::intrinsics::LegacyAlignment;
use crate::ir::{CallAttrs, ParamAttrs};
let param = |align: Option<u64>, deref: Option<u64>| ParamAttrs {
align: align.and_then(Align::from_bytes),
dereferenceable: deref,
..ParamAttrs::default()
};
let kinds = |kind: u32| {
let mut e = EnumAttrs::default();
e.insert(kind);
e
};
let attrs = || {
Some(Box::new(CallAttrs {
params: vec![
param(Some(4), Some(400)),
param(Some(4), None),
param(None, None),
param(None, Some(3)),
param(None, Some(4)),
]
.into_boxed_slice(),
..CallAttrs::default()
}))
};
let enums = || SiteEnums {
params: vec![kinds(1), kinds(2), kinds(3), kinds(4), kinds(5)],
..SiteEnums::default()
};
let mut m = super::tests::meter();
let legacy = |bytes: u64| LegacyAlignment {
align: Align::from_bytes(bytes),
removed: 3,
pointers: 2,
};
let mut e = enums();
let got = upgrade_legacy_attrs(attrs(), &mut e, legacy(16), &mut m)
.unwrap()
.unwrap();
assert_eq!(
got.params.to_vec(),
[
param(Some(16), Some(400)),
param(Some(16), None),
param(None, None),
param(None, Some(4)),
]
);
assert_eq!(e.params, [kinds(1), kinds(2), kinds(3), kinds(5)]);
// An alignment of 0 removes the pointers' own.
let mut e = enums();
let got = upgrade_legacy_attrs(attrs(), &mut e, legacy(0), &mut m)
.unwrap()
.unwrap();
assert_eq!(got.params[0], param(None, Some(400)));
assert_eq!(got.params[1], param(None, None));
// No attributes and no alignment: none.
let mut e = SiteEnums::default();
assert!(upgrade_legacy_attrs(None, &mut e, legacy(0), &mut m)
.unwrap()
.is_none());
}
+28 -17
View File
@@ -2,20 +2,23 @@
//!
//! An LLVM `load` or `store` may move a whole array or struct (`load [4 x <4 x float>], ptr
//! addrspace(2) %p`): Metal's own linker emits one where it passes a field of a buffer's struct to
//! a function by value. Lowering reads and writes buffer and threadgroup memory a scalar or vector
//! at a time. After SCCP, [`expand`] replaces each such access, in its place, by its members' (the
//! scalars and vectors the type holds, in layout order): a `getelementptr i8` at the member's
//! constant byte distance from the access's pointer (none at distance 0), and a load chained into
//! the aggregate by `insertvalue`, starting from `undef`; a store's members are each an
//! `extractvalue` and a store. A member's alignment is the access's, lowered to the largest power
//! of two dividing its distance; an access that states none leaves its members' unstated (each
//! member's ABI alignment, which its offset in the layout honours).
//! a function by value, and a converter-built vertex function's return value is one stored to and
//! loaded from a stack allocation. Lowering reads and writes buffer, threadgroup and stack memory a
//! scalar or vector at a time. After SCCP, [`expand`] replaces each such access, in its place, by
//! its members' (the scalars and vectors the type holds, in layout order): a `getelementptr i8` at
//! the member's constant byte distance from the access's pointer (none at distance 0), and a load
//! chained into the aggregate by `insertvalue`, starting from `undef`; a store's members are each
//! an `extractvalue` and a store. A member's alignment is the access's, lowered to the largest
//! power of two dividing its distance; an access that states none leaves its members' unstated
//! (each member's ABI alignment, which its offset in the layout honours).
//!
//! What is split: a non-volatile, non-atomic access in `device`, `constant` or `threadgroup`
//! memory of an array or struct that holds no pointer, with at least one and at most
//! [`MAX_MEMBERS`] members, nested at most [`MAX_DEPTH`] deep. The rest stays whole: `thread`
//! memory's allocations the memory planner takes whole, a pointer member (a handle or a resource)
//! is lowering's to follow, and lowering holds no larger aggregate, so it refuses the access.
//! What is split: a non-volatile, non-atomic access in `device`, `constant`, `threadgroup` or
//! `thread` memory of an array or struct that holds no pointer, with at least one and at most
//! [`MAX_MEMBERS`] members, nested at most [`MAX_DEPTH`] deep. The rest stays whole: a pointer
//! member (a handle or a resource) is lowering's to follow, and lowering holds no larger
//! aggregate, so it refuses the access (`Lowering(Access)` `AccessType`). A stack allocation's
//! whole-aggregate access is split like the rest because lowering holds only scalars and vectors
//! there too.
use crate::budget::Meter;
use crate::error::Error;
@@ -59,6 +62,8 @@ struct Split {
ptr_ty: TypeId,
align: Option<Align>,
members: (usize, usize),
/// A speculative load's (`InstKind::Load`'s `speculative`): each member's load is too.
speculative: bool,
}
impl Split {
@@ -184,14 +189,15 @@ fn split_of(
members: &mut Vec<Member>,
m: &mut Meter,
) -> Result<Option<Split>, Error> {
let (ptr, val, ty, align) = match &inst.kind {
let (ptr, val, ty, align, speculative) = match &inst.kind {
InstKind::Load {
ptr,
align,
volatile: false,
atomic: None,
speculative,
..
} => (*ptr, None, inst.ty, *align),
} => (*ptr, None, inst.ty, *align, *speculative),
InstKind::Store {
val,
ptr,
@@ -199,7 +205,7 @@ fn split_of(
volatile: false,
atomic: None,
} => match ty_of(*val) {
Some(ty) => (*ptr, Some(*val), ty, *align),
Some(ty) => (*ptr, Some(*val), ty, *align, false),
None => return Ok(None),
},
_ => return Ok(None),
@@ -210,7 +216,10 @@ fn split_of(
let split = matches!(
tl.0.get(ptr_ty),
Some(Type::Ptr {
space: AddrSpace::Device | AddrSpace::Constant | AddrSpace::Threadgroup,
space: AddrSpace::Device
| AddrSpace::Constant
| AddrSpace::Threadgroup
| AddrSpace::Thread,
})
);
if !split {
@@ -223,6 +232,7 @@ fn split_of(
ptr_ty,
align,
members,
speculative,
}))
}
@@ -331,6 +341,7 @@ fn emit(
volatile: false,
atomic: None,
range: None,
speculative: s.speculative,
},
},
m,
@@ -0,0 +1,496 @@
//! A kernel's plain loads of its constant references, made in its entry block.
//!
//! A kernel often reads a `constant T&` parameter only behind its bounds branch (`if (gid >= n)
//! return; out[gid] = in[gid] * scale;`): the load of `scale` lies in a block the threads past the
//! end skip. [`expand`] moves each such load into the entry block, ahead of every branch, its value
//! reaching each use by dominance, where all of the following hold. Each is read from the body's
//! structure and the entry's ABI, never from a name.
//!
//! - **A plain load of a scalar or vector.** Neither volatile nor atomic, of an integer, a float or
//! a vector of them. The load of a pointer or an aggregate stays.
//! - **The reference's own bytes, at an offset fixed at translation time.** Its address is a
//! parameter the ABI binds as a buffer of the constant address space with a stated
//! `air.buffer_size` (a `constant T&`; no function constant gates it), or that parameter plus
//! `getelementptr`s at constant, non-negative indices and bitcasts, which move with the load. The
//! bytes read lie inside the referenced object, `[0, air.buffer_size)`, one address for every
//! thread of the dispatch. A pointer parameter (`constant T*`, no size), an offset outside the
//! object, and an offset the run computes stay.
//! - **A pointer no other root shares.** Neither the parameter nor an address step from it (a
//! `getelementptr`, a bitcast or address-space cast, a `freeze`) is an operand of a phi, a
//! `select`, or a vector or aggregate insert, the value of a store, or the function's result.
//! Such a pointer may meet one loaded from memory, which lowering then reaches by the address it
//! holds (a wide pointer); its loads stay.
//! - **No write before it.** No instruction on any path from the function's start to the load may
//! write device memory or order another thread's writes before it: a store or memory intrinsic
//! whose destination is not thread or threadgroup memory, an atomic or atomic load of any space,
//! a fence or barrier, a texture write, or a call of any kind but arithmetic, conversions, group
//! operations, built-in reads and texture reads and queries. A device buffer may cover the
//! constant buffer's bytes, so such a write could change what the load reads.
//!
//! Anything else stays where it is. The moved load reads the bytes it read where it stood, and a
//! thread that skipped its block reads them too and uses nothing of them. That thread runs a load
//! the program did not run, so the moved load is marked speculative
//! ([`InstKind::Load`]'s `speculative`): Metal requires the reference's binding only where the
//! program reads it, and an app may leave it unbound, or bound shorter than the object, where the
//! branch is not taken. Lowering contains a speculative load whatever its offset: a bound storage
//! view's robust buffer access reads zero outside its range, and a slot reached by its device
//! address checks the load against its bounds and reads zero outside, as it checks an access at
//! an offset the run computes.
use std::collections::{BTreeMap, BTreeSet};
use crate::abi::{ParamBinding, ParamRole};
use crate::budget::Meter;
use crate::error::Error;
use crate::intrinsics::{AirIntrinsic, LlvmIntrinsic, TexOp};
use crate::ir::{AddrSpace, BlockId, Body, Callee, CastOp, FuncId, Idx, InstId, InstKind};
use crate::ir::{Layout, ModuleParts, Type, TypeId, TypeLayouts, TypeTable, Value};
use super::pieces::gep_offset;
use super::rewrite::{apply, filled, invariant, scoped, BodyEdit};
/// The address steps a load's address is followed through to its parameter.
const STEPS: usize = 64;
/// Make in the entry block each load of `func`'s body that reads a constant reference the
/// entry's `bindings` bind, where nothing before it may write device memory, each marked
/// speculative (the module docs).
pub(super) fn expand(
body: Body,
parts: &ModuleParts,
func: FuncId,
bindings: &[ParamBinding],
m: &mut Meter,
) -> Result<Body, Error> {
let f = parts
.funcs
.get(func)
.ok_or_else(|| invariant("entry out of range"))?;
let Some(Type::Function { params: tys, .. }) = parts.types.get(f.ty) else {
return Err(invariant("the entry's type is not a function"));
};
let objects: BTreeMap<u32, u64> = bindings
.iter()
.filter_map(|b| reference(b, tys, &parts.types))
.collect();
if objects.is_empty() {
return Ok(body);
}
m.charge(objects.len() * std::mem::size_of::<(u32, u64)>() * 2)?;
let next = scoped(m, |m, held| {
let cx = Cx {
body: &body,
parts,
tys,
objects: &objects,
};
let shared = cx.shared(m, held)?;
let own: BTreeMap<u32, u64> = (objects.iter())
.filter(|(p, _)| !shared.contains(p))
.map(|(&p, &size)| (p, size))
.collect();
let bytes = own.len() * std::mem::size_of::<(u32, u64)>() * 2;
m.charge(bytes)?;
*held = held.saturating_add(bytes);
let cx = Cx {
objects: &own,
..cx
};
let moved = cx.moves(m, held)?;
if moved.is_empty() {
return Ok(None);
}
let mut edit = BodyEdit::keep_all(&body, m, held)?;
// Each moved load runs where the program did not run it.
for &id in moved.keys() {
let Some(inst) = body.insts.get(id) else {
continue;
};
let mut kind = inst.kind.clone();
if let InstKind::Load { speculative, .. } = &mut kind {
*speculative = true;
let bytes = std::mem::size_of::<(InstId, InstKind)>() * 2;
m.charge(bytes)?;
*held = held.saturating_add(bytes);
edit.rewrite.insert(id, kind);
}
}
edit.moved = moved;
apply(&body, &edit, &|c| c, m).map(Some)
});
m.release(objects.len() * std::mem::size_of::<(u32, u64)>() * 2);
match next? {
Some(next) => {
body.release(m);
Ok(next)
}
None => Ok(body),
}
}
/// The parameter `b` binds and the bytes of the object it references, where it is a constant
/// reference: a buffer of the constant address space with a stated `air.buffer_size`, which no
/// function constant gates, of a constant-space pointer type in `tys`.
fn reference(b: &ParamBinding, tys: &[TypeId], types: &TypeTable) -> Option<(u32, u64)> {
let ParamRole::Buffer(arg) = &b.role else {
return None;
};
if b.unused || b.predicate.is_some() || arg.space != AddrSpace::Constant {
return None;
}
let ty = types.get(*tys.get(usize::try_from(b.param).ok()?)?)?;
let pointer = matches!(
ty,
Type::Ptr {
space: AddrSpace::Constant
}
);
pointer.then_some((b.param, u64::from(arg.buffer_size?)))
}
/// What the walk reads.
struct Cx<'a> {
body: &'a Body,
parts: &'a ModuleParts,
/// The entry's parameter types.
tys: &'a [TypeId],
/// The constant references: parameter, and the bytes of the object it references.
objects: &'a BTreeMap<u32, u64>,
}
impl Cx<'_> {
/// The constant references whose pointer another root may share: the parameter, or an address
/// step from it (a `getelementptr`, a bitcast or address-space cast, a `freeze`), is an
/// operand of a phi, a `select`, or a vector or aggregate insert, the value of a store, or the
/// function's result (the module docs). Its table is charged to `held`.
fn shared(&self, m: &mut Meter, held: &mut usize) -> Result<BTreeSet<u32>, Error> {
let n = self.body.insts.len();
// The reference each instruction's pointer steps from.
let mut from: Vec<Option<u32>> = filled(m, held, n, None)?;
let of = |from: &[Option<u32>], v: Value| match v {
Value::Arg(a) => u32::try_from(a.index())
.ok()
.filter(|p| self.objects.contains_key(p)),
Value::Inst(i) => from.get(i.index()).copied().flatten(),
Value::Const(_) => None,
};
// To a fixed point: a step may lie before its base in the layout. Each pass that changes
// anything adds a step, so at most `n` passes run.
for _ in 0..=n {
let mut changed = false;
for (id, inst) in self.body.insts.iter() {
m.tick(1)?;
let base = match &inst.kind {
InstKind::Gep { base, .. } => *base,
InstKind::Cast {
op: CastOp::Bitcast | CastOp::AddrSpaceCast,
v,
}
| InstKind::Freeze(v) => *v,
_ => continue,
};
let Some(p) = of(&from, base) else {
continue;
};
if let Some(slot) = from.get_mut(id.index()).filter(|s| s.is_none()) {
*slot = Some(p);
changed = true;
}
}
if !changed {
break;
}
}
let mut shared = BTreeSet::new();
for (_, inst) in self.body.insts.iter() {
m.tick(1)?;
let mut share = |v: Value| {
if let Some(p) = of(&from, v) {
shared.insert(p);
}
};
match &inst.kind {
InstKind::Store { val, .. } => share(*val),
InstKind::Select { t, f, .. } => {
share(*t);
share(*f);
}
InstKind::Phi { .. }
| InstKind::InsertElement { .. }
| InstKind::InsertValue { .. }
| InstKind::Ret(_) => inst.kind.for_each_value(share),
_ => {}
}
}
Ok(shared)
}
/// The loads to make in the entry block, each with the address steps it moves with, mapped to
/// the entry block. Its tables are charged to `held`.
fn moves(&self, m: &mut Meter, held: &mut usize) -> Result<BTreeMap<InstId, BlockId>, Error> {
let mut moved = BTreeMap::new();
let n = self.body.blocks.len();
let entry = BlockId::new(0);
if n < 2 {
return Ok(moved);
}
// The blocks the entry reaches, and those a write may precede: every block a block that
// writes leads to.
let mut reached = filled(m, held, n, false)?;
let mut written = filled(m, held, n, false)?;
let mut stack: Vec<BlockId> = filled(m, held, n, entry)?;
stack.clear();
if let Some(r) = reached.get_mut(entry.index()) {
*r = true;
}
stack.push(entry);
while let Some(b) = stack.pop() {
m.tick(1)?;
for s in self.body.successors(b) {
// A branch back to the entry block: it is no place every path starts from.
if s == entry {
return Ok(moved);
}
if let Some(r) = reached.get_mut(s.index()).filter(|r| !**r) {
*r = true;
stack.push(s);
}
}
}
for (b, _) in self.body.blocks.iter() {
m.tick(1)?;
if !self.body.block_insts(b).any(|(_, i)| self.writes(&i.kind)) {
continue;
}
stack.push(b);
while let Some(b) = stack.pop() {
m.tick(1)?;
for s in self.body.successors(b) {
if let Some(w) = written.get_mut(s.index()).filter(|w| !**w) {
*w = true;
stack.push(s);
}
}
}
}
let mut layouts = None;
for (b, _) in self.body.blocks.iter().skip(1) {
let mut clean = reached.get(b.index()).copied().unwrap_or(false)
&& !written.get(b.index()).copied().unwrap_or(true);
for (id, inst) in self.body.block_insts(b) {
m.tick(1)?;
if !clean {
break;
}
if self.writes(&inst.kind) {
clean = false;
continue;
}
let InstKind::Load {
ptr,
volatile: false,
atomic: None,
..
} = inst.kind
else {
continue;
};
if !self.plain_value(inst.ty) {
continue;
}
if layouts.is_none() {
let l = TypeLayouts::new(&self.parts.data_layout, &self.parts.types, m)?;
*held = held.saturating_add(
self.parts.types.len() * std::mem::size_of::<Option<Layout>>(),
);
layouts = Some(l);
}
let Some(tl) = layouts.as_ref() else {
continue;
};
let Some(steps) = self.steps(tl, ptr, inst.ty, m)? else {
continue;
};
// Each step is made before what uses it: the moved instructions arrive in the
// entry block in their old order.
let mut after = id;
if steps.iter().any(|&s| {
let before = s < after;
after = s;
!before
}) {
continue;
}
for s in steps.into_iter().chain([id]) {
if moved.insert(s, entry).is_none() {
let bytes = std::mem::size_of::<(InstId, BlockId)>() * 2;
m.charge(bytes)?;
*held = held.saturating_add(bytes);
}
}
}
}
Ok(moved)
}
/// Whether a load of type `ty` reads a plain value: an integer, a float, or a vector of them.
fn plain_value(&self, ty: TypeId) -> bool {
let scalar = |t: &Type| {
matches!(
t,
Type::Int(_) | Type::Half | Type::BFloat | Type::Float | Type::Double
)
};
match self.parts.types.get(ty) {
Some(Type::Vector { elem, .. }) => self.parts.types.get(*elem).is_some_and(scalar),
Some(t) => scalar(t),
None => false,
}
}
/// The address steps of a load of `ty` at `ptr`, the nearest first, where `ptr` is a constant
/// reference plus a translation-time offset and the bytes read lie inside its object.
fn steps(
&self,
layouts: &TypeLayouts,
ptr: Value,
ty: TypeId,
m: &mut Meter,
) -> Result<Option<Vec<InstId>>, Error> {
let mut steps = Vec::new();
let mut at = 0u64;
let mut v = ptr;
for _ in 0..STEPS {
m.tick(1)?;
let i = match v {
Value::Arg(a) => {
let Some(&size) = u32::try_from(a.index())
.ok()
.and_then(|p| self.objects.get(&p))
else {
return Ok(None);
};
let inside = layouts
.store_size(ty)
.and_then(|n| at.checked_add(n))
.is_some_and(|end| end <= size);
return Ok(inside.then_some(steps));
}
Value::Inst(i) => i,
Value::Const(_) => return Ok(None),
};
let Some(inst) = self.body.insts.get(i) else {
return Ok(None);
};
match &inst.kind {
InstKind::Gep {
src_ty,
base,
indices,
..
} => {
let Some(next) = gep_offset(self.parts, layouts, *src_ty, indices)
.and_then(|o| at.checked_add(o))
else {
return Ok(None);
};
at = next;
v = *base;
}
InstKind::Cast {
op: CastOp::Bitcast,
v: inner,
} => v = *inner,
_ => return Ok(None),
}
steps.push(i);
}
Ok(None)
}
/// The type of value `v`.
fn value_ty(&self, v: Value) -> Option<TypeId> {
match v {
Value::Inst(i) => self.body.insts.get(i).map(|n| n.ty),
Value::Arg(a) => self.tys.get(a.index()).copied(),
Value::Const(k) => self.parts.consts.ty(k),
}
}
/// Whether pointer `v` points into memory of one thread or threadgroup, which no device
/// buffer covers.
fn local(&self, v: Value) -> bool {
match self.value_ty(v).and_then(|t| self.parts.types.get(t)) {
Some(Type::Ptr { space }) => local_space(*space),
_ => false,
}
}
/// Whether `kind` may write device memory, or order another thread's writes before what
/// follows it (the module docs).
fn writes(&self, kind: &InstKind) -> bool {
match kind {
InstKind::Store {
ptr, atomic: None, ..
} => !self.local(*ptr),
InstKind::Store { .. }
| InstKind::AtomicRmw { .. }
| InstKind::CmpXchg { .. }
| InstKind::Fence(_)
| InstKind::Load {
atomic: Some(_), ..
} => true,
InstKind::Call(c) => match &c.callee {
Callee::Air { op, .. } => !reads_only(op),
Callee::Llvm { op, .. } => match op {
LlvmIntrinsic::Float { .. }
| LlvmIntrinsic::Int { .. }
| LlvmIntrinsic::NarrowInt { .. }
| LlvmIntrinsic::Abs { .. }
| LlvmIntrinsic::Cttz { .. }
| LlvmIntrinsic::Ctlz { .. } => false,
LlvmIntrinsic::Memset { dst, .. }
| LlvmIntrinsic::Memcpy { dst, .. }
| LlvmIntrinsic::Memmove { dst, .. } => !local_space(*dst),
LlvmIntrinsic::Agx(_) => true,
},
_ => true,
},
_ => false,
}
}
}
/// Whether `space` is memory of one thread or threadgroup.
fn local_space(space: AddrSpace) -> bool {
matches!(
space,
AddrSpace::Thread | AddrSpace::Threadgroup | AddrSpace::ThreadgroupImageblock
)
}
/// Whether AIR intrinsic `op` neither writes memory nor orders another thread's writes:
/// arithmetic, conversions, group operations, built-in reads, and texture reads and queries.
fn reads_only(op: &AirIntrinsic) -> bool {
match op {
AirIntrinsic::Math(_)
| AirIntrinsic::Convert(_)
| AirIntrinsic::Pack(_)
| AirIntrinsic::BoolReduce(_)
| AirIntrinsic::Group(_)
| AirIntrinsic::IsUniform(_)
| AirIntrinsic::SimdgroupSize(_)
| AirIntrinsic::GlobalBuiltin(_)
| AirIntrinsic::WorkItem(_)
| AirIntrinsic::Sampler(_) => true,
AirIntrinsic::Texture(t) => matches!(
t.op,
TexOp::Read
| TexOp::Sample { .. }
| TexOp::SampleGrad { .. }
| TexOp::Gather { .. }
| TexOp::Query(_)
),
_ => false,
}
}
@@ -2246,6 +2246,7 @@ fn emit(
volatile: false,
atomic: None,
range: None,
speculative: false,
};
for &decl in a.escapes.markers.get(&i).into_iter().flatten() {
let marker = Call {
@@ -2322,6 +2323,7 @@ fn emit(
volatile: false,
atomic: None,
range: None,
speculative: false,
};
e.push(e.words.i64t, kind, m)?;
}
@@ -2343,6 +2345,7 @@ fn emit(
volatile: false,
atomic: None,
range: None,
speculative: false,
};
let wide = e.push(e.words.i64t, kind, m)?;
let cast = InstKind::Cast {
@@ -96,6 +96,7 @@ fn kernel(func: FuncId, params: Vec<ParamBinding>) -> EntryPoint {
outputs: Vec::new(),
name: DiagName::new("k"),
user_annotation: None,
mismatched_component_counts: false,
}
}
@@ -131,7 +132,6 @@ fn request() -> SpecRequest {
SpecRequest {
call_stack_depth: 1,
open_cl_mode: false,
open_cl_lines: BTreeSet::new(),
entry: "k".into(),
constants: BTreeMap::new(),
}
@@ -621,6 +621,7 @@ fn phi_kernel(dead: bool) -> (Module, AirAbi) {
volatile: false,
atomic: None,
range: None,
speculative: false,
},
);
k.br(join);
@@ -1082,6 +1083,7 @@ fn a_function_pointer_kept_in_a_thread_s_memory_is_its_word() {
volatile: false,
atomic: None,
range: None,
speculative: false,
},
);
call_through(k, fp, arg(1))
@@ -1208,6 +1210,7 @@ fn a_loaded_pointer_no_function_can_answer_is_a_dynamic_call() {
volatile: false,
atomic: None,
range: None,
speculative: false,
},
);
call_through(k, fp, arg(1))
@@ -1241,6 +1244,7 @@ fn constant_chosen_kernel() -> (Module, AirAbi, GlobalId) {
volatile: false,
atomic: None,
range: None,
speculative: false,
},
);
let is = k.push(
@@ -1501,6 +1505,7 @@ fn argument_buffer_kernel(how: TableUse) -> (Module, AirAbi) {
volatile: false,
atomic: None,
range: None,
speculative: false,
},
)
};
@@ -4,7 +4,7 @@
//! the search order, a library's own calls binding to its own definitions, a variable shared by
//! every reference, the refusals of what is missing or not loaded.
use std::collections::{BTreeMap, BTreeSet};
use std::collections::BTreeMap;
use super::*;
use crate::abi::{
@@ -152,6 +152,7 @@ fn compute(f: &mut FunctionBuilder<'_>, names: &mut Names, x: Value, d: &Def<'_>
volatile: false,
atomic: None,
range: None,
speculative: false,
},
);
v = f.bin(BinOp::Add, v, word);
@@ -296,6 +297,7 @@ fn client(kernel: Def<'_>, defs: &[Def<'_>], dead: bool) -> (Module, AirAbi) {
outputs: Vec::new(),
name: DiagName::new("k"),
user_annotation: None,
mismatched_component_counts: false,
}];
(module, abi)
}
@@ -314,7 +316,6 @@ fn request() -> SpecRequest {
SpecRequest {
call_stack_depth: 1,
open_cl_mode: false,
open_cl_lines: BTreeSet::new(),
entry: "k".into(),
constants: BTreeMap::new(),
}
@@ -1,7 +1,7 @@
//! Linking tests over IR built with the typed test builder: a kernel calls visible functions
//! through reference stubs, and linked modules define them.
use std::collections::{BTreeMap, BTreeSet};
use std::collections::BTreeMap;
use super::*;
use crate::abi::{
@@ -144,6 +144,7 @@ fn caller(dead: bool) -> (Module, AirAbi) {
outputs: Vec::new(),
name: DiagName::new("k"),
user_annotation: None,
mismatched_component_counts: false,
}];
abi.visible_function_refs = vec![reference(stub, "f")];
(module, abi)
@@ -216,6 +217,7 @@ fn callee(name: &str, calls: &[&str]) -> LinkedModule {
volatile: false,
atomic: None,
range: None,
speculative: false,
},
);
let mut v = f.bin(BinOp::Add, x3, word);
@@ -255,7 +257,6 @@ fn request() -> SpecRequest {
SpecRequest {
call_stack_depth: 1,
open_cl_mode: false,
open_cl_lines: BTreeSet::new(),
entry: "k".into(),
constants: BTreeMap::new(),
}
@@ -550,6 +551,7 @@ fn constant_callee() -> LinkedCode {
volatile: false,
atomic: None,
range: None,
speculative: false,
},
)
};
@@ -1311,6 +1313,7 @@ fn a_difference_no_adapter_passes_is_not_implemented() {
volatile: false,
atomic: None,
range: None,
speculative: false,
},
))
},
+19 -19
View File
@@ -84,9 +84,13 @@
//! through the call's map pointer and Apple's arithmetic. **AIR 2.7 simdgroup-matrix block loads and
//! stores** take their AIR 2.8 form, their extent, stride and origin built from the elements per
//! row, the origin and the constant transpose flag (`legacy_matrix`). **Aggregate accesses**: a
//! load or store of a whole array or struct in buffer or threadgroup memory becomes its scalar
//! and vector members' accesses, joined by `insertvalue` or split by `extractvalue`
//! (`aggregates`). **Program-scope buffer bindings**: each load of the pointer a bound buffer's
//! load or store of a whole array or struct in buffer, threadgroup or stack memory becomes its
//! scalar and vector members' accesses, joined by `insertvalue` or split by `extractvalue`
//! (`aggregates`). **Constant references**: in a kernel, each plain load of a scalar or vector
//! from a `constant T&` parameter's object, at an offset fixed at translation time, is made in
//! the entry block where nothing on any path before it may write device memory and no other
//! root shares the parameter's pointer, marked speculative, as a speculated arm's load is
//! (`const_hoist`). **Program-scope buffer bindings**: each load of the pointer a bound buffer's
//! global holds becomes a read of the entry's parameter of that buffer, its own or one appended
//! (`global_binding`). **Global built-in
//! variables**: each `air.get_*` read of a program-scope built-in becomes a read of a built-in
@@ -109,6 +113,7 @@ mod async_copy;
mod block_read;
mod byval;
mod command_writes;
mod const_hoist;
mod const_loads;
mod const_tables;
mod devirt;
@@ -207,12 +212,6 @@ pub struct SpecRequest {
/// sits 3 past its index, and OpenCL C's work-item functions read the dispatch's values
/// ([`opencl`]). Any other entry than a kernel specializes as without it.
pub open_cl_mode: bool,
/// With [`open_cl_mode`](Self::open_cl_mode), the texture indices of the kernel's 1D images
/// (`texture1d` and `texture1d_array` arguments) that a 1D texture is bound for, where Apple's
/// OpenCL binds a 2D texture of height 1: each keeps its 1D type and its 1D operations, which
/// read the 1D texture. Every other 1D image of the kernel is read as the 2D texture
/// ([`Entry::open_cl_1d_images`]).
pub open_cl_lines: BTreeSet<u32>,
}
/// The constexpr samplers of one linked function that a pipeline state numbers
@@ -304,11 +303,6 @@ pub struct Entry {
/// no measurement says whether it speculates them (an arm of an instruction, size or shape no
/// probe covers). Such a branch keeps the AIR's lanes; Metal's may be the block's.
pub unmeasured_speculation: bool,
/// In a kernel of OpenCL mode ([`SpecRequest::open_cl_mode`]), the texture indices of its 1D
/// images (`texture1d` and `texture1d_array` arguments): each is read as the 2D texture of
/// height 1 Apple's OpenCL binds for it, or as a 1D texture where
/// [`SpecRequest::open_cl_lines`] names it. Empty elsewhere.
pub open_cl_1d_images: BTreeSet<u32>,
}
/// An entry's explicit call stack: what its recursion through visible functions runs on. Its stacks
@@ -634,7 +628,7 @@ pub fn specialize_dynamic(
// OpenCL mode: a 1D image's operations are the 2D texture's that Apple's OpenCL binds for it,
// but those of an image a 1D texture is bound for.
let body = if req.open_cl_mode && matches!(ep.stage, Stage::Kernel { .. }) {
opencl_1d::expand(body, &mut parts, (ep, &req.open_cl_lines), m)?
opencl_1d::expand(body, &mut parts, ep, m)?
} else {
body
};
@@ -770,8 +764,16 @@ pub fn specialize_dynamic(
// in plain AIR, each OpenCL C `mad` call its multiply and addition, and each `mul24` and
// `mad24` call the 32-bit product of its operands' low 24 bits (and the addition).
let body = routine::expand(body, &mut parts, m)?;
// Aggregate loads and stores of buffer and threadgroup memory as their members' accesses.
// Aggregate loads and stores of buffer, threadgroup and stack memory as their members'
// accesses.
let body = aggregates::expand(body, &mut parts, func, m)?;
// A kernel's plain loads of its constant references, made in its entry block where nothing
// before them may write device memory.
let body = if matches!(ep.stage, Stage::Kernel { .. }) {
const_hoist::expand(body, &parts, func, &ep.params, m)?
} else {
body
};
// A simdgroup reduction before a discard that Metal's compiler moves past it is placed after
// the discard, where the fragment lowering gives Metal's lanes.
let body = if matches!(ep.stage, Stage::Fragment { .. }) {
@@ -819,9 +821,8 @@ pub fn specialize_dynamic(
ep.params.extend(lanes.bindings());
}
// OpenCL mode's indices and hidden buffers.
let mut open_cl_1d_images = BTreeSet::new();
if let Some(first) = hidden {
(ep, open_cl_1d_images) = opencl::entry(ep, first, &req.open_cl_lines)?;
ep = opencl::entry(ep, first)?;
}
// The buffer parameters the program-scope bindings' reads became, each at a slot no other
// parameter binds.
@@ -925,7 +926,6 @@ pub fn specialize_dynamic(
lockstep: Lockstep::default(),
call_stack,
unmeasured_speculation,
open_cl_1d_images,
module,
})
}
+7 -23
View File
@@ -68,8 +68,6 @@
//! left, and lowering refuses it. [`entry`] then moves the entry's buffer-indexed arguments 3 on
//! and adds the three buffers' bindings.
use std::collections::BTreeSet;
use crate::abi::{
AbiInt, Access, ArgTypeInfo, BufferArg, EntryPoint, ParamBinding, ParamRole, Slot,
};
@@ -336,6 +334,7 @@ impl Sink<'_> {
volatile: false,
atomic: None,
range: None,
speculative: false,
},
m,
)?;
@@ -672,29 +671,14 @@ pub(super) fn barriers(mut body: Body, parts: &ModuleParts, m: &mut Meter) -> Re
/// `first` to `first + 2`: each argument bound at a buffer index 3 past its own (an argument
/// buffer, a function table and an acceleration structure as a buffer), threadgroup memory,
/// textures and samplers at theirs, a 1D image's texture of the 2D type Metal's OpenCL binds for
/// it (`texture1d` as `texture2d`, `texture1d_array` as `texture2d_array`) but at a texture index
/// of `lines`, a 1D texture's, which keeps its type, and the buffers' bindings after the entry's
/// own. With it, the texture indices of the entry's 1D images (`Entry::open_cl_1d_images`).
pub fn entry(
mut ep: EntryPoint,
first: u32,
lines: &BTreeSet<u32>,
) -> Result<(EntryPoint, BTreeSet<u32>), Error> {
let mut images = BTreeSet::new();
/// it (`texture1d` as `texture2d`, `texture1d_array` as `texture2d_array`), and the buffers'
/// bindings after the entry's own.
pub fn entry(mut ep: EntryPoint, first: u32) -> Result<EntryPoint, Error> {
for p in &mut ep.params {
if let ParamRole::Texture(t) = &p.role {
if let ParamRole::Texture(_) = &p.role {
let bound = (p.ty.name.as_ref()).and_then(|name| bound_texture(&name.to_string()));
if let Some(bound) = bound {
let index = match t.location.index {
AbiInt::Const(index) => Some(index),
_ => None,
};
if let Some(index) = index {
images.insert(index);
}
if !index.is_some_and(|index| lines.contains(&index)) {
p.ty.name = Some(DiagName::new(bound));
}
p.ty.name = Some(DiagName::new(bound));
}
continue;
}
@@ -737,7 +721,7 @@ pub fn entry(
name: Some(DiagName::new(name)),
});
}
Ok((ep, images))
Ok(ep)
}
/// The MSL type of the texture Metal's OpenCL binds for an image argument whose type AIR names
+10 -43
View File
@@ -18,20 +18,17 @@
//! array, its coordinate `(x, 0)`, a sampled coordinate `(x, 0.5)` (the row's centre in
//! normalized and unnormalized coordinates alike), its offset `(o, 0)` or, where the 1D form has
//! none, `(0, 0)`. Lowering then declares the slot, and the binder binds it, as the 2D texture
//! Metal's OpenCL binds. An image a 1D texture is bound for (`SpecRequest::open_cl_lines`, the
//! binder's variant) keeps its 1D operations, which read the 1D texture: the 5300M's answer.
//! Not rewritten: `get_num_mip_levels`, whose 1D answer (0) a 2D texture's is
//! Metal's OpenCL binds; a 1D texture bound there, which Apple's OpenCL never binds, is the
//! consumer's to refuse. Not rewritten: `get_num_mip_levels`, whose 1D answer (0) a 2D texture's is
//! not, and the image format queries, which read a hidden buffer whatever the shape
//! (`canon::opencl`); neither is OpenCL C's.
use std::collections::BTreeSet;
use crate::abi::{AbiInt, EntryPoint, ParamRole};
use crate::abi::EntryPoint;
use crate::budget::Meter;
use crate::error::Error;
use crate::intrinsics::{AirIntrinsic, ImageDim, ImageShape, Query, TexOp, TexRole, Texture};
use crate::ir::{
ArgIdx, Body, Call, CallConv, Callee, Const, FnAttrs, FuncId, Function, Idx, InstId, InstKind,
ArgIdx, Body, Call, CallConv, Callee, Const, FnAttrs, FuncId, Function, InstId, InstKind,
Linkage, ModuleParts, Param, ParamAttrs, Type, TypeId, UnnamedAddr, Value, Visibility,
};
@@ -60,9 +57,8 @@ fn widened(t: Texture) -> Option<Texture> {
}
}
/// The 1D texture operation `kind` calls that [`expand`] rewrites, with its declaration and call:
/// not one of a texture parameter of `kept`, a 1D texture's.
fn site<'a>(kind: &'a InstKind, kept: &[u32]) -> Option<(Texture, FuncId, &'a Call)> {
/// The 1D texture operation `kind` calls that [`expand`] rewrites, with its declaration and call.
fn site(kind: &InstKind) -> Option<(Texture, FuncId, &Call)> {
let InstKind::Call(call) = kind else {
return None;
};
@@ -70,36 +66,11 @@ fn site<'a>(kind: &'a InstKind, kept: &[u32]) -> Option<(Texture, FuncId, &'a Ca
Callee::Air {
decl,
op: AirIntrinsic::Texture(t),
} if widened(t).is_some() && !of_params(t, call, kept) => Some((t, decl, call)),
} if widened(t).is_some() => Some((t, decl, call)),
_ => None,
}
}
/// Whether operation `t`'s `call` names a texture that is one of the entry's parameters `kept`.
fn of_params(t: Texture, call: &Call, kept: &[u32]) -> bool {
let texture = t.layout().index(TexRole::Texture);
match texture.and_then(|i| call.args.get(i)) {
Some(Value::Arg(a)) => u32::try_from(a.index()).is_ok_and(|p| kept.contains(&p)),
_ => false,
}
}
/// The parameters of `ep` that bind a texture at an index of `lines`: the 1D images a 1D texture
/// is bound for, whose operations stay 1D.
fn kept_params(ep: &EntryPoint, lines: &BTreeSet<u32>, m: &mut Meter) -> Result<Vec<u32>, Error> {
let mut kept = Vec::new();
for p in &ep.params {
m.tick(1)?;
if let ParamRole::Texture(t) = &p.role {
if matches!(t.location.index, AbiInt::Const(index) if lines.contains(&index)) {
m.reserve(&mut kept, 1)?;
kept.push(p.param);
}
}
}
Ok(kept)
}
/// Whether `parts` declares a 1D texture operation [`expand`] rewrites. Every site calls one, so
/// a module that declares none has none, and [`expand`] need not read its instructions.
fn declares_sites(parts: &ModuleParts, m: &mut Meter) -> Result<bool, Error> {
@@ -121,25 +92,23 @@ fn declares_sites(parts: &ModuleParts, m: &mut Meter) -> Result<bool, Error> {
}
/// Make each 1D texture operation of the entry `ep`'s inlined `body` that the module doc lists a
/// call of a function built for it, and inline the result: each but those of an image at a
/// texture index of `lines`, which a 1D texture is bound for.
/// call of a function built for it, and inline the result.
pub(super) fn expand(
body: Body,
parts: &mut ModuleParts,
(ep, lines): (&EntryPoint, &BTreeSet<u32>),
ep: &EntryPoint,
m: &mut Meter,
) -> Result<Body, Error> {
if !declares_sites(parts, m)? {
return Ok(body);
}
let func = ep.func;
let kept = kept_params(ep, lines, m)?;
// One function per operation and declaration, and each call's.
let mut made: Vec<((Texture, FuncId), FuncId)> = Vec::new();
let mut calls: Vec<(InstId, FuncId)> = Vec::new();
for (id, inst) in body.insts.iter() {
m.tick(1)?;
let Some((t, decl, call)) = site(&inst.kind, &kept) else {
let Some((t, decl, call)) = site(&inst.kind) else {
continue;
};
let f = match made.iter().find(|(k, _)| *k == (t, decl)) {
@@ -156,8 +125,6 @@ pub(super) fn expand(
}
m.release(made.capacity() * std::mem::size_of::<((Texture, FuncId), FuncId)>());
drop(made);
m.release(kept.capacity() * std::mem::size_of::<u32>());
drop(kept);
if calls.is_empty() {
m.release(calls.capacity() * std::mem::size_of::<(InstId, FuncId)>());
return Ok(body);
+1
View File
@@ -258,6 +258,7 @@ impl<'p> Out<'p> {
volatile: false,
atomic: None,
range: None,
speculative: false,
};
self.push(ty, kind, m)
}
@@ -195,6 +195,7 @@ fn emit(
volatile: false,
atomic: None,
range: None,
speculative: false,
},
},
m,
@@ -292,6 +292,7 @@ impl Sink<'_> {
volatile: false,
atomic: None,
range: None,
speculative: false,
};
self.push(ty, load, m)
}
@@ -3153,6 +3153,7 @@ fn load(ptr: Value) -> InstKind {
volatile: false,
atomic: None,
range: None,
speculative: false,
}
}
@@ -298,6 +298,7 @@ fn load(ty: TypeId, ptr: Value) -> Inst {
volatile: false,
atomic: None,
range: None,
speculative: false,
},
}
}
+20 -1
View File
@@ -39,7 +39,11 @@
//! [`expand`] speculates each outermost branch Metal speculates whose arms hold a group operation
//! that answers differently there (the operations above): the branch becomes a jump into its arm
//! (a diamond's arms run one after the other), each value the arms join with becomes a `select`
//! on the condition, and a sunk store stores the chosen value where the arms join. A branch whose
//! on the condition, and a sunk store stores the chosen value where the arms join. Each load of
//! the arms, a `constant` reference's, then runs in lanes the program did not run it in, and is
//! marked speculative ([`InstKind::Load`]'s `speculative`): lowering contains it where the
//! reference is unbound or bound shorter than the load, as the constant-reference hoist's loads
//! (`const_hoist`). A branch whose
//! arms hold no such operation is left as it is, as is one whose arms hold an instruction no
//! measurement covers (a vector or aggregate operation, an address computation, a math function
//! other than `sqrt`, a call outside the families above, a load other than a `constant`
@@ -681,6 +685,21 @@ fn flatten(
let Some(head_term) = term(fold.head) else {
return;
};
// Each load of the arms runs in every lane of the branch's block.
for a in &fold.arms {
for &b in &a.blocks {
for (id, i) in body.block_insts(b) {
if !matches!(i.kind, InstKind::Load { .. }) {
continue;
}
let mut kind = i.kind.clone();
if let InstKind::Load { speculative, .. } = &mut kind {
*speculative = true;
}
edit.rewrite.insert(id, kind);
}
}
}
match &fold.arms[..] {
[a] => {
edit.rewrite.insert(
@@ -22,8 +22,8 @@ struct Types {
i32t: TypeId,
}
/// A body of `fn(i32 t, ptr addrspace(1) out)` that `build` writes, with its type table and
/// parameter types.
/// A body of `fn(i32 t, ptr addrspace(1) out, ptr addrspace(2) k)` that `build` writes, `k` a
/// `constant` reference of 4 bytes, with its type table and parameter types.
struct Built {
body: Body,
types: TypeTable,
@@ -32,9 +32,18 @@ struct Built {
}
impl Built {
/// The parameters' attributes: `k` dereferenceable for its 4 bytes.
fn params(&self) -> Vec<Param> {
let mut params = vec![Param::default(); self.param_tys.len()];
if let Some(k) = params.get_mut(2) {
k.attrs.dereferenceable = Some(4);
}
params
}
fn decisions(&self) -> Vec<Decision> {
let mut m = meter();
let params = vec![Param::default(); self.param_tys.len()];
let params = self.params();
decisions(
&self.body,
(&self.types, &self.consts),
@@ -54,7 +63,7 @@ impl Built {
/// measurement decides.
fn expanded_noting(self) -> (Body, bool) {
let mut m = meter();
let params = vec![Param::default(); self.param_tys.len()];
let params = self.params();
expand(
self.body,
(&self.types, &self.consts),
@@ -73,7 +82,8 @@ fn built(build: impl FnOnce(&mut FunctionBuilder<'_>, &Types)) -> Built {
i32t: m.int(32),
};
let dev = m.ptr(AddrSpace::Device);
let fty = m.fn_ty(types.void, &[types.i32t, dev]);
let cst = m.ptr(AddrSpace::Constant);
let fty = m.fn_ty(types.void, &[types.i32t, dev, cst]);
let mut f = m.define("f", fty);
build(&mut f, &types);
let id = f.finish();
@@ -341,6 +351,57 @@ fn a_quad_reduction_keeps_its_arm() {
assert_eq!(phis_and_selects(&body), (1, 0));
}
/// The load of `k`, a `constant` reference, then `+ t`.
fn read_k(f: &mut FunctionBuilder<'_>, t: &Types) -> Value {
let x = f.push(
t.i32t,
InstKind::Load {
ptr: f.arg(2),
align: None,
volatile: false,
atomic: None,
range: None,
speculative: false,
},
);
f.bin(BinOp::Add, x, f.arg(0))
}
/// Whether each load of `body` is speculative, in layout order.
fn speculative_loads(body: &Body) -> Vec<bool> {
body.insts
.iter()
.filter_map(|(_, i)| match i.kind {
InstKind::Load { speculative, .. } => Some(speculative),
_ => None,
})
.collect()
}
/// A `constant` reference's load in a speculated arm runs in every lane of the branch's block,
/// where the program ran it in the arm's lanes alone: it is marked speculative, so lowering
/// contains it where the reference is bound shorter than the load or not at all. An arm that keeps
/// its lanes keeps its load as it is.
#[test]
fn a_constant_reference_load_of_a_speculated_arm_is_speculative() {
let b = triangle(|f, t| {
let x = read_k(f, t);
first(f, t, x)
});
assert_eq!(b.decisions(), [Decision::Speculated]);
let body = b.expanded();
assert_eq!(conditional_branches(&body), 0);
assert_eq!(speculative_loads(&body), [true]);
let b = triangle(|f, t| {
let x = read_k(f, t);
let y = first(f, t, x);
let s = quad_sum(f, t, x);
f.bin(BinOp::Add, y, s)
});
assert_eq!(b.decisions(), [Decision::Kept]);
assert_eq!(speculative_loads(&b.expanded()), [false]);
}
/// A device read keeps its arm.
#[test]
fn a_device_read_keeps_its_arm() {
@@ -354,6 +415,7 @@ fn a_device_read_keeps_its_arm() {
volatile: false,
atomic: None,
range: None,
speculative: false,
},
);
first(f, t, x)
+5 -3
View File
@@ -1,6 +1,6 @@
//! Canonicalization tests over IR built with the typed test builder.
use std::collections::{BTreeMap, BTreeSet};
use std::collections::BTreeMap;
use super::*;
use crate::abi::{
@@ -21,6 +21,7 @@ use crate::ir::{
mod aggregates;
mod command_buffers;
mod constant_fields;
mod constant_hoist;
mod constant_sets;
mod conversions;
mod float_compares;
@@ -97,6 +98,7 @@ fn kernel(func: FuncId, params: Vec<ParamBinding>) -> EntryPoint {
outputs: Vec::new(),
name: DiagName::new("k"),
user_annotation: None,
mismatched_component_counts: false,
}
}
@@ -165,6 +167,7 @@ fn load(f: &mut FunctionBuilder<'_>, ty: TypeId, ptr: Value) -> Value {
volatile: false,
atomic: None,
range: None,
speculative: false,
},
)
}
@@ -184,7 +187,6 @@ fn request(constants: &[(u32, ConstValue)]) -> SpecRequest {
SpecRequest {
call_stack_depth: 1,
open_cl_mode: false,
open_cl_lines: BTreeSet::new(),
entry: "k".into(),
constants: constants.iter().cloned().collect::<BTreeMap<_, _>>(),
}
@@ -2052,6 +2054,7 @@ fn a_deeply_nested_written_global_is_rebuilt_on_a_small_stack() {
volatile: true,
atomic: None,
range: None,
speculative: false,
},
);
store(&mut f, v, arg(0));
@@ -2864,7 +2867,6 @@ fn a_static_initializer_branch_on_an_unsupplied_constant_takes_its_false_way() {
let r = SpecRequest {
call_stack_depth: 1,
open_cl_mode: false,
open_cl_lines: BTreeSet::new(),
entry: "k".into(),
constants: [(3, boolean(1))].into_iter().collect(),
};
@@ -1,5 +1,5 @@
//! Aggregate loads and stores of buffer and threadgroup memory, split into their members' accesses
//! (`canon::aggregates`).
//! Aggregate loads and stores of buffer, threadgroup and stack memory, split into their members'
//! accesses (`canon::aggregates`).
use super::*;
@@ -31,6 +31,15 @@ enum Move {
/// `store [2 x i32] [7, 7]` into a threadgroup array, loaded back whole, element 1 stored to
/// `out`.
Threadgroup,
/// `store { <2 x float>, i32 } zeroinitializer` into a stack allocation, field 1 overwritten
/// from the constant buffer, the whole loaded back, its field 1 stored to `out`.
Stack,
/// [`Move::Stack`] with a volatile whole load.
StackVolatile,
/// A `{ ptr addrspace(1), i32 }` stack allocation, zero-stored and loaded whole.
StackPointer,
/// A `[300 x float]` stack allocation, zero-stored and loaded whole.
StackWide,
}
/// `kernel k(constant void *in [[buffer(0)]], device void *out [[buffer(1)]])`, moving an aggregate
@@ -81,6 +90,16 @@ fn moved(how: Move) -> Entry {
let k = m.constant(i32t, Const::Int(7));
Value::Const(m.constant(tg_ty, Const::Aggregate([k, k].into())))
};
let m_thread = m.ptr(AddrSpace::Thread);
let stack_ty = m.struct_ty(&[v2, i32t]);
let zero_of = |m: &mut ModuleBuilder, ty| Value::Const(m.constant(ty, Const::Null));
let (stack_zero, ptr_zero, wide_zero) = (
zero_of(&mut m, stack_ty),
zero_of(&mut m, with_ptr),
zero_of(&mut m, wide),
);
let zero64 = m.const_int(i64t, 0);
let one = m.const_int(i32t, 1);
let fty = m.fn_ty(void, &[cst, dev]);
let mut f = m.define("k", fty);
let load_as = |f: &mut FunctionBuilder<'_>, ty: TypeId, ptr: Value, volatile: bool| {
@@ -92,6 +111,7 @@ fn moved(how: Move) -> Entry {
volatile,
atomic: None,
range: None,
speculative: false,
},
)
};
@@ -176,6 +196,69 @@ fn moved(how: Move) -> Entry {
let x = extract(&mut f, i32t, whole, 1);
store_as(&mut f, x, 4);
}
Move::Stack | Move::StackVolatile | Move::StackPointer | Move::StackWide => {
let ty = match how {
Move::StackPointer => with_ptr,
Move::StackWide => wide,
_ => stack_ty,
};
let zero = match how {
Move::StackPointer => ptr_zero,
Move::StackWide => wide_zero,
_ => stack_zero,
};
let slot = f.push(
m_thread,
InstKind::Alloca {
ty,
count: one,
align: None,
},
);
f.push_void(InstKind::Store {
val: zero,
ptr: slot,
align: Align::from_bytes(8),
volatile: false,
atomic: None,
});
{
let live = load_as(&mut f, i32t, arg(0), false);
let field1 = f.push(
m_thread,
InstKind::Gep {
src_ty: ty,
base: slot,
indices: [zero64, one].into(),
inbounds: true,
},
);
f.push_void(InstKind::Store {
val: live,
ptr: field1,
align: Align::from_bytes(4),
volatile: false,
atomic: None,
});
}
// The slot is 8-aligned (its zero store says so), and so is the whole load.
let whole = f.push(
ty,
InstKind::Load {
ptr: slot,
align: Align::from_bytes(8),
volatile: how == Move::StackVolatile,
atomic: None,
range: None,
speculative: false,
},
);
let x = match how {
Move::StackWide => extract(&mut f, f32t, whole, 7),
_ => extract(&mut f, i32t, whole, 1),
};
store_as(&mut f, x, 4);
}
Move::Wide => {
let whole = load_as(&mut f, wide, arg(0), false);
let x = extract(&mut f, f32t, whole, 7);
@@ -250,6 +333,36 @@ fn a_threadgroup_aggregate_is_split() {
assert_eq!(text.matches("store ").count(), 3, "{text}");
}
/// A whole struct stored to and loaded from a stack allocation, where the rest of the body
/// writes it in part, is its members' accesses as a buffer's is: the zero store is two member
/// stores (aligned 8 and 8, the second at byte 8), the whole load two member loads (8 and 8)
/// joined by two `insertvalue`s from `undef`, and no access of the whole struct is left.
#[test]
fn a_stack_aggregate_is_split() {
let text = body_text(&moved(Move::Stack));
let lines = |what: &str| text.lines().filter(|l| l.contains(what)).count();
assert_eq!(lines("load %t7"), 0, "{text}");
assert_eq!(lines("store %t7"), 0, "{text}");
assert_eq!(lines("alloca"), 1, "{text}");
assert_eq!(
lines("extractvalue <2 x float> %t7 zeroinitializer, 0"),
1,
"{text}"
);
assert_eq!(
lines("extractvalue i32 %t7 zeroinitializer, 1"),
1,
"{text}"
);
assert_eq!(lines("store %i1, %i0, align 8"), 1, "{text}");
assert_eq!(lines("store %i3, %i4, align 8"), 1, "{text}");
assert_eq!(lines("load <2 x float>, %i0, align 8"), 1, "{text}");
assert_eq!(lines("load i32, %i11, align 8"), 1, "{text}");
assert_eq!(lines("getelementptr inbounds i8, %i0, i64 8"), 2, "{text}");
assert_eq!(lines("insertvalue"), 2, "{text}");
assert_eq!(lines("insertvalue %t7 undef"), 1, "{text}");
}
/// A volatile access, an aggregate that holds a pointer, and one of more members than the split
/// takes stay whole.
#[test]
@@ -258,6 +371,9 @@ fn what_is_not_split_stays_whole() {
(Move::Volatile, "load volatile %t8"),
(Move::PointerStruct, "load %t5"),
(Move::Wide, "load %t5"),
(Move::StackVolatile, "load volatile %t7"),
(Move::StackPointer, "= load %t"),
(Move::StackWide, "= load %t"),
] {
let text = body_text(&moved(how));
assert!(text.contains(whole), "{how:?}: {text}");
@@ -0,0 +1,330 @@
//! A kernel's plain loads of its constant references, made in its entry block ahead of its bounds
//! branch (`canon::const_hoist`), and the loads that stay where they are.
use super::*;
/// What lies between the kernel's start and its loads of `scale` and `p.bias`, or how they are
/// reached.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
enum Shape {
/// The bounds branch alone.
Bounds,
/// A store to `out` behind the branch, before the loads.
StoreBefore,
/// An atomic add to `out` behind the branch, before the loads.
AtomicBefore,
/// `scale` read by a function called behind the branch, which stores to `out` first.
CalleeWrites,
/// `p.bias` read as `(&p.first)[gid & 1]`, its offset computed behind the branch.
PointerBehind,
/// `scale` a `constant float*`, which states no object size.
Pointer,
/// `p.bias` read at byte 8, past `p`'s 8 bytes.
PastObject,
/// `scale`'s pointer also chosen by a `select` against a pointer loaded from `out`, and read
/// through it: another root shares it.
Shared,
}
/// `kernel k(device float* out [[buffer(0)]], constant uint& n [[buffer(1)]], constant float&
/// scale [[buffer(2)]], constant P& p [[buffer(3)]], uint gid [[thread_position_in_grid]])`, with
/// `struct P { float first; float bias; }`: `if (gid >= n) return; out[gid] = float(gid) * scale +
/// p.bias;`, `shape` adding what it says. The bounds-branch shape of the kernels the hoist was
/// measured on, synthetic.
fn kernel_of(shape: Shape) -> Entry {
let mut m = ModuleBuilder::new();
let void = m.void();
let i1 = m.int(1);
let i8t = m.int(8);
let i32t = m.int(32);
let i64t = m.int(64);
let f32t = m.float();
let dev = m.ptr(AddrSpace::Device);
let cst = m.ptr(AddrSpace::Constant);
let zero_f = m.constant(f32t, Const::Float(0f32.to_bits().into()));
let zero_f = Value::Const(zero_f);
let (zero, one, two) = (
m.const_int(i32t, 0),
m.const_int(i32t, 1),
m.const_int(i32t, 2),
);
let no = m.const_int(i1, 0);
let bias_at = m.const_int(
i64t,
match shape {
Shape::PastObject => 8,
_ => 4,
},
);
// `float h(device float* out, constant float& s, uint gid) { out[gid] = 0; return s; }`
let h = {
let hty = m.fn_ty(f32t, &[dev, cst, i32t]);
let mut f = m.define("h", hty);
let o = f.push(
dev,
InstKind::Gep {
src_ty: f32t,
base: arg(0),
indices: [arg(2)].into(),
inbounds: true,
},
);
store(&mut f, zero_f, o);
let v = load(&mut f, f32t, arg(1));
f.ret(Some(v));
f.finish()
};
let add_ty = m.fn_ty(i32t, &[dev, i32t, i32t, i32t, i1]);
let add = m.declare("air.atomic.global.add.u.i32", add_ty);
let add_op = AirIntrinsic::parse("air.atomic.global.add.u.i32").unwrap();
let fty = m.fn_ty(void, &[dev, cst, cst, cst, i32t]);
let mut f = m.define("k", fty);
let (then, exit) = (f.block(), f.block());
let n = load(&mut f, i32t, arg(1));
let past = f.push(
i1,
InstKind::ICmp {
pred: IntPredicate::Uge,
a: arg(4),
b: n,
},
);
f.cond_br(past, exit, then);
f.switch_to(then);
let o = f.push(
dev,
InstKind::Gep {
src_ty: f32t,
base: arg(0),
indices: [arg(4)].into(),
inbounds: true,
},
);
match shape {
Shape::StoreBefore => store(&mut f, zero_f, o),
Shape::AtomicBefore => {
call(
&mut f,
i32t,
Callee::Air {
decl: add,
op: add_op,
},
&[arg(0), one, zero, two, no],
);
}
_ => {}
}
let scale = match shape {
Shape::CalleeWrites => call(&mut f, f32t, Callee::Direct(h), &[arg(0), arg(2), arg(4)]),
_ => load(&mut f, f32t, arg(2)),
};
let bias_ptr = match shape {
Shape::PointerBehind => {
let k = f.bin(BinOp::And, arg(4), one);
f.push(
cst,
InstKind::Gep {
src_ty: f32t,
base: arg(3),
indices: [k].into(),
inbounds: true,
},
)
}
_ => f.push(
cst,
InstKind::Gep {
src_ty: i8t,
base: arg(3),
indices: [bias_at].into(),
inbounds: true,
},
),
};
let bias = load(&mut f, f32t, bias_ptr);
let shared = match shape {
Shape::Shared => {
let loaded = load(&mut f, cst, arg(0));
let first = f.push(
i1,
InstKind::ICmp {
pred: IntPredicate::Eq,
a: arg(4),
b: zero,
},
);
let either = f.push(
cst,
InstKind::Select {
c: first,
t: arg(2),
f: loaded,
fmf: FastMath::NONE,
},
);
Some(load(&mut f, f32t, either))
}
_ => None,
};
let g = f.push(
f32t,
InstKind::Cast {
op: CastOp::UIToFP,
v: arg(4),
},
);
let x = f.bin(BinOp::FMul, g, scale);
let y = f.bin(BinOp::FAdd, x, bias);
let y = match shared {
Some(v) => f.bin(BinOp::FAdd, y, v),
None => y,
};
store(&mut f, y, o);
f.br(exit);
f.switch_to(exit);
f.ret(None);
let k = f.finish();
let module = m.finish().unwrap();
let reference = |param: u32, size: Option<u32>| {
let mut b = buffer(param, param);
if let ParamRole::Buffer(a) = &mut b.role {
a.access = Access::Read;
a.space = AddrSpace::Constant;
a.buffer_size = size;
}
b
};
let scale_size = match shape {
Shape::Pointer => None,
_ => Some(4),
};
let gid = ParamBinding {
param: 4,
role: ParamRole::Builtin(crate::abi::Builtin::ThreadPositionInGrid),
unused: false,
predicate: None,
ty: ArgTypeInfo::default(),
name: Some(DiagName::new("gid")),
};
let params = vec![
buffer(0, 0),
reference(1, Some(4)),
reference(2, scale_size),
reference(3, Some(8)),
gid,
];
let abi = abi(vec![kernel(k, params)], Vec::new());
specialize(module, &abi, &request(&[]), &mut meter()).unwrap()
}
/// The loads of the specialized kernel in its entry block and in its other blocks, and whether a
/// store lies in its entry block.
fn placed(e: &Entry) -> (usize, usize, bool) {
let body = e.module.func(e.func).unwrap().body.as_ref().unwrap();
let (mut entry, mut elsewhere, mut stored) = (0, 0, false);
for (b, _) in body.blocks.iter() {
for (_, i) in body.block_insts(b) {
match (&i.kind, b.index() == 0) {
(InstKind::Load { .. }, true) => entry += 1,
(InstKind::Load { .. }, false) => elsewhere += 1,
(InstKind::Store { .. }, at_entry) => stored |= at_entry,
_ => {}
}
}
}
(entry, elsewhere, stored)
}
/// The speculative loads of the specialized kernel, each in its entry block: the loads the hoist
/// made there, where the program ran them behind the branch.
fn speculative(e: &Entry) -> usize {
let body = e.module.func(e.func).unwrap().body.as_ref().unwrap();
let mut n = 0;
for (b, _) in body.blocks.iter() {
for (_, i) in body.block_insts(b) {
if let InstKind::Load {
speculative: true, ..
} = i.kind
{
assert_eq!(b.index(), 0, "a speculative load outside the entry block");
n += 1;
}
}
}
n
}
/// Behind the bounds branch alone, the loads of `scale` and of `p.bias` (with its address) are made
/// in the entry block beside `n`'s; the store stays behind the branch.
#[test]
fn a_constant_reference_read_behind_the_bounds_branch_is_read_in_the_entry_block() {
let e = kernel_of(Shape::Bounds);
assert_eq!(placed(&e), (3, 0, false), "{}", body_text(&e));
// `scale`'s and `p.bias`'s, which the program read behind the branch; `n`'s it read there.
assert_eq!(speculative(&e), 2, "{}", body_text(&e));
}
/// A store to device memory before the loads keeps them behind the branch: `out` may cover the
/// constant buffer's bytes.
#[test]
fn a_store_before_the_load_keeps_it_where_it_is() {
let e = kernel_of(Shape::StoreBefore);
assert_eq!(placed(&e), (1, 2, false), "{}", body_text(&e));
assert_eq!(speculative(&e), 0, "{}", body_text(&e));
}
/// An atomic before the loads keeps them behind the branch.
#[test]
fn an_atomic_before_the_load_keeps_it_where_it_is() {
let e = kernel_of(Shape::AtomicBefore);
assert_eq!(placed(&e), (1, 2, false), "{}", body_text(&e));
assert_eq!(speculative(&e), 0, "{}", body_text(&e));
}
/// A load in a callee that writes `out` first keeps it, and the load after the call, behind the
/// branch once the callee is inlined.
#[test]
fn a_load_in_a_callee_that_writes_keeps_it_where_it_is() {
let e = kernel_of(Shape::CalleeWrites);
assert_eq!(placed(&e), (1, 2, false), "{}", body_text(&e));
assert_eq!(speculative(&e), 0, "{}", body_text(&e));
}
/// A load whose address the branch's block computes stays; `scale`'s, at the parameter itself, is
/// made in the entry block.
#[test]
fn a_pointer_computed_behind_the_branch_keeps_its_load_where_it_is() {
let e = kernel_of(Shape::PointerBehind);
assert_eq!(placed(&e), (2, 1, false), "{}", body_text(&e));
assert_eq!(speculative(&e), 1, "{}", body_text(&e));
}
/// A load through a `constant float*`, which states no object size, stays; `p.bias`'s is made in
/// the entry block.
#[test]
fn a_constant_pointer_without_an_object_size_keeps_its_load_where_it_is() {
let e = kernel_of(Shape::Pointer);
assert_eq!(placed(&e), (2, 1, false), "{}", body_text(&e));
assert_eq!(speculative(&e), 1, "{}", body_text(&e));
}
/// A load past the referenced object's bytes stays; `scale`'s is made in the entry block.
#[test]
fn a_load_past_the_object_keeps_it_where_it_is() {
let e = kernel_of(Shape::PastObject);
assert_eq!(placed(&e), (2, 1, false), "{}", body_text(&e));
assert_eq!(speculative(&e), 1, "{}", body_text(&e));
}
/// A reference whose pointer a `select` shares with a pointer loaded from memory keeps its loads
/// where they are: lowering may reach it through a device address no check bounds. `p.bias`'s is
/// made in the entry block.
#[test]
fn a_reference_another_root_shares_keeps_its_loads_where_they_are() {
let e = kernel_of(Shape::Shared);
// `n`'s and `p.bias`'s in the entry block; `scale`'s, the loaded pointer's and the selected
// load behind the branch.
assert_eq!(placed(&e), (2, 3, false), "{}", body_text(&e));
assert_eq!(speculative(&e), 1, "{}", body_text(&e));
}
@@ -332,12 +332,6 @@ attributes #3 = { nounwind willreturn }\n\
/// [`IMAGES`] specialized, in OpenCL mode where `open_cl_mode`; `None` without `llvm-as`.
fn images(test: &str, open_cl_mode: bool) -> Option<Entry> {
images_bound(test, open_cl_mode, BTreeSet::new())
}
/// [`IMAGES`] specialized, in OpenCL mode where `open_cl_mode`, a 1D texture bound for each 1D
/// image at a texture index of `lines`; `None` without `llvm-as`.
fn images_bound(test: &str, open_cl_mode: bool, lines: BTreeSet<u32>) -> Option<Entry> {
let bitcode = match metal2vulkan_devtools::llvm_assemble_text(&format!("{HEAD}{IMAGES}")) {
Ok(b) => b,
Err(e) => {
@@ -349,7 +343,6 @@ fn images_bound(test: &str, open_cl_mode: bool, lines: BTreeSet<u32>) -> Option<
let req = SpecRequest {
entry: "img".into(),
open_cl_mode,
open_cl_lines: lines,
..SpecRequest::default()
};
Some(specialize(d.module, &d.abi, &req, &mut meter()).expect("specialized"))
@@ -513,52 +506,15 @@ fn opencl_1d_images_are_read_written_and_queried_as_2d_textures() {
);
}
/// A 1D image a 1D texture is bound for (`SpecRequest::open_cl_lines`), which Apple's OpenCL never
/// binds, keeps its type and its 1D operations, which read that texture; every other 1D image is
/// the 2D texture's still. The entry names its 1D images in OpenCL mode alone, whatever is bound.
/// In OpenCL mode each 1D image takes the type of the 2D texture Apple's OpenCL binds for it
/// (`texture1d` as `texture2d`, `texture1d_array` as `texture2d_array`); without the mode each
/// keeps its own.
#[test]
fn opencl_1d_images_bound_to_1d_textures_keep_their_1d_operations() {
use crate::intrinsics::{ImageDim, Query};
let test = "opencl_1d_images_bound_to_1d_textures_keep_their_1d_operations";
let (Some(plain), Some(cl), Some(lines)) = (
images(test, false),
images(test, true),
images_bound(test, true, BTreeSet::from([1, 2])),
) else {
fn opencl_1d_images_take_their_2d_textures_types() {
let test = "opencl_1d_images_take_their_2d_textures_types";
let (Some(plain), Some(cl)) = (images(test, false), images(test, true)) else {
return;
};
let ops = |e: &Entry| {
let mut v: Vec<_> = texture_ops(e)
.into_iter()
.filter(|(op, ..)| {
!matches!(
op,
TexOp::Query(Query::ChannelOrder | Query::ChannelDataType)
)
})
.collect();
v.sort();
v
};
let width = TexOp::Query(Query::Width);
let layers = TexOp::Query(Query::ArraySize);
let sample = |e: &Entry| {
texture_ops(e)
.into_iter()
.find(|(op, ..)| matches!(op, TexOp::Sample { .. }))
.expect("a sample")
.0
};
// `b` (texture 1) and `c` (texture 2) stay 1D; `d` (texture 3) writes its 2D texture.
let mut want = vec![
(layers, ImageDim::D1, true),
(TexOp::Read, ImageDim::D1, false),
(sample(&lines), ImageDim::D1, true),
(width, ImageDim::D1, false),
(TexOp::Write, ImageDim::D2, false),
];
want.sort();
assert_eq!(ops(&lines), want, "{}", print(&lines.module));
let names = |e: &Entry| -> Vec<(u32, String)> {
e.ep.params
.iter()
@@ -571,15 +527,6 @@ fn opencl_1d_images_bound_to_1d_textures_keep_their_1d_operations() {
})
.collect()
};
assert_eq!(
names(&lines),
[
(0, "texture2d<unknown, read>".to_owned()),
(1, "texture1d<unknown, read>".to_owned()),
(2, "texture1d_array<unknown, read>".to_owned()),
(3, "texture2d<unknown, write>".to_owned()),
]
);
assert_eq!(
names(&cl),
[
@@ -589,9 +536,15 @@ fn opencl_1d_images_bound_to_1d_textures_keep_their_1d_operations() {
(3, "texture2d<unknown, write>".to_owned()),
]
);
assert_eq!(cl.open_cl_1d_images, BTreeSet::from([1, 2, 3]));
assert_eq!(lines.open_cl_1d_images, BTreeSet::from([1, 2, 3]));
assert!(plain.open_cl_1d_images.is_empty());
assert_eq!(
names(&plain),
[
(0, "texture2d<unknown, read>".to_owned()),
(1, "texture1d<unknown, read>".to_owned()),
(2, "texture1d_array<unknown, read>".to_owned()),
(3, "texture1d<unknown, write>".to_owned()),
]
);
}
#[test]
@@ -229,7 +229,8 @@ fn an_absent_value_stored_into_private_bytes_nothing_reads_is_unobserved() {
}
/// Every read that reaches the gated-off field's bytes observes the store: the field itself, an
/// aggregate load covering it, one byte of it, the field through the pointer loaded back from the
/// aggregate load covering it (split into its members' loads, joined from an `undef` by
/// `insertvalue`), one byte of it, the field through the pointer loaded back from the
/// cell, a copy of the struct, and any read once the struct's address escapes. The observed value
/// reads zero.
#[test]
@@ -248,7 +249,15 @@ fn a_read_that_reaches_an_absent_value_in_private_memory_observes_it() {
text.contains("store i32 zeroinitializer"),
"{reach:?}: {text}"
);
assert!(!text.contains("undef"), "{reach:?}: {text}");
// The one `undef` left is the start of the `insertvalue` chain that joins a split load's
// members: `insertvalue %tN undef %iM, 0`.
let observed_undef = text.lines().any(|l| {
l.contains("undef")
&& !(l.contains("= insertvalue %t")
&& l.contains(" undef %i")
&& l.ends_with(", 0"))
});
assert!(!observed_undef, "{reach:?}: {text}");
assert!(!text.contains("%a1"), "{reach:?}: {text}");
}
}
@@ -157,6 +157,7 @@ fn a_side_effect_nothing_uses_stays() {
volatile: true,
atomic: None,
range: None,
speculative: false,
},
);
air_call(f, "air.wg.barrier", void, &[i32t, i32t], &[two, one]);
@@ -3280,8 +3280,9 @@ fn layouts_poison_on_overflow() {
assert!(!sig.matches(&t, ty));
}
/// Every name below, one or more of each known AIR family, decodes here or its family is listed
/// in [`UNDECODED`], never both; and every listed family has a name below.
/// Every name below, one or more of each known AIR family and the listed `llvm.*` name, decodes
/// here or its family is listed in [`UNDECODED`], never both; and every listed family has a name
/// below.
#[test]
fn known_families_decode_or_are_listed() {
let names = [
@@ -3423,6 +3424,8 @@ fn known_families_decode_or_are_listed() {
"air.get_imageblock_num_colors",
"air.get_color_coverage_mask",
"air.store.implicit_imageblock.mask.v4f16",
// MSL's `__builtin_trap`: listed, not decoded (an `llvm.*` name never decodes as `air.*`).
"llvm.trap",
];
for name in names {
let listed = undecoded_family(name).is_some();
@@ -683,6 +683,25 @@ impl LlvmIntrinsic {
})
}
/// The signature of the declaration an older LLVM wrote for a memory intrinsic, which has an
/// `i32` alignment before the volatile flag; `None` for any other operation.
pub(super) fn legacy_signature(&self) -> Option<Signature> {
let sig = self.signature()?;
let (ret, params) = (sig.ret, sig.params());
match self {
LlvmIntrinsic::Memset { .. }
| LlvmIntrinsic::Memcpy { .. }
| LlvmIntrinsic::Memmove { .. } => {
let (head, flag) = params.split_at(params.len().checked_sub(1)?);
let mut legacy = head.to_vec();
legacy.push(Operand::Imm(ImmKind::I32));
legacy.extend_from_slice(flag);
Some(Signature::new(ret, &legacy))
}
_ => None,
}
}
/// Read the call's immediates into the variant.
pub(super) fn bind(self, imm: &Immediates<'_>) -> Result<LlvmIntrinsic, IntrinsicError> {
Ok(match self {
+84 -5
View File
@@ -30,7 +30,8 @@
//! queries, ray intersection (`air.intersect`), tensor descriptors, indirect commands, OpenCL C's
//! vector data loads and stores, MSL 4.1's generic-pointer space queries, and the
//! closed `llvm.*` set with the AGX family. Every other `air.*` name (names whose declarations have not been observed) stays
//! unknown. [`UNDECODED`] lists the known families among them, and the intrinsic census of the
//! unknown, as does every other `llvm.*` name. [`UNDECODED`] lists the known families and names
//! among them (`llvm.trap` the one `llvm.*` name), and the intrinsic census of the
//! `bitcode-reader` audit reports every unknown name with row counts. [`UNDECODED_FEATURES`] names
//! the undecoded families that belong to a typed feature not implemented yet (intersection function
//! tables), so their calls are refused as that feature.
@@ -299,9 +300,10 @@ impl AirIntrinsic {
}
}
/// The `air.*` families the decoder knows of but does not decode, each with the reason: their
/// calls stay `Callee::UnknownIntrinsic`. This is the "listed" half of the census contract: every
/// corpus name decodes or matches an entry here. Each entry is a name prefix.
/// The `air.*` families, and the `llvm.*` names, the decoder knows of but does not decode, each
/// with the reason: their calls stay `Callee::UnknownIntrinsic`. This is the "listed" half of the
/// census contract: every corpus name decodes or matches an entry here. Each entry is a name
/// prefix.
pub const UNDECODED: &[(&str, &str)] = &[
(
"air.function_constant_predicate",
@@ -332,8 +334,14 @@ pub const UNDECODED: &[(&str, &str)] = &[
"air.store.implicit_imageblock.mask.",
MULTISAMPLE_IMAGEBLOCK,
),
// MSL's `__builtin_trap`: a call, then `unreachable`.
("llvm.trap", TRAP),
];
/// The reason `llvm.trap` is [`UNDECODED`].
const TRAP: &str = "MSL and Metal's headers do not define a reached trap; a trap that survives \
canonicalization is refused as an unknown intrinsic";
/// The reason a multisample imageblock's operations are [`UNDECODED`].
const MULTISAMPLE_IMAGEBLOCK: &str = "a multisample imageblock's sample count, colors, coverage \
masks and masked stores: tile functions and fragment \
@@ -466,7 +474,14 @@ pub fn classify(name: &[u8], sym: Sym, fn_ty: TypeId, types: &TypeTable) -> Opti
match llvm::parse(rest, sym, types, fn_ty) {
Ok(llvm::Parsed::Dropped(d)) => DeclClass::Drop(d),
Ok(llvm::Parsed::Kept(op)) => match op.signature() {
Some(sig) if !sig.matches(types, fn_ty) => DeclClass::Mismatch,
Some(sig)
if !sig.matches(types, fn_ty)
&& !op
.legacy_signature()
.is_some_and(|legacy| legacy.matches(types, fn_ty)) =>
{
DeclClass::Mismatch
}
_ => DeclClass::Llvm(op),
},
Err(llvm::Fail::Unknown) => DeclClass::Unknown,
@@ -550,3 +565,67 @@ pub fn bind(
DeclClass::Drop(_) | DeclClass::Unknown => Ok(Bound::Unknown),
}
}
/// What upgrading a legacy memory intrinsic's call removed: the alignment it stated, and the
/// operand position it held.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) struct LegacyAlignment {
/// The alignment; `None` for an alignment of 0, which states none.
pub align: Option<crate::ir::Align>,
/// The position of the removed operand (3), whose attributes go with it.
pub removed: usize,
/// The pointer operands it applies to: the destination, and the source of a copy.
pub pointers: usize,
}
/// Why a legacy memory intrinsic's call is not upgraded.
#[derive(Clone, Debug, PartialEq, Eq)]
pub(crate) enum LegacyAlignmentError {
/// The alignment is not a constant ([`IntrinsicError::ImmediateNotConstant`]).
Intrinsic(IntrinsicError),
/// The alignment is a constant that is not a power of two, or is above 2^32: a malformed
/// record, as an `align` attribute of that value is.
Malformed,
}
/// Upgrade a call of a memory intrinsic declared with an `i32` alignment before the volatile flag
/// (`llvm.memcpy.p0i8.p0i8.i64(i8*, i8*, i64, i32, i1)`) to the current form, as LLVM's reader
/// upgrades it (`UpgradeIntrinsicCall`): the alignment operand is removed from `args` and returned,
/// and the caller removes that position's attributes and sets the pointer operands' `align` to it
/// (`setDestAlignment`, `setSourceAlignment`: replacing any the call states, and removing it for
/// an alignment of 0). `Ok(None)` for any other call. An alignment that is not a constant is
/// [`IntrinsicError::ImmediateNotConstant`], and a malformed one (not a power of two, or above
/// 2^32), which LLVM's verifier refuses, is [`LegacyAlignmentError::Malformed`].
pub(crate) fn upgrade_legacy_memory(
class: DeclClass,
args: &mut Vec<Value>,
consts: &ConstTable,
) -> Result<Option<LegacyAlignment>, LegacyAlignmentError> {
let DeclClass::Llvm(op) = class else {
return Ok(None);
};
let Some(legacy) = op
.legacy_signature()
.filter(|legacy| legacy.params().len() == args.len())
else {
return Ok(None);
};
let removed = args.len().saturating_sub(2);
let bytes = Immediates::new(legacy, args, consts)
.get(removed)
.map_err(LegacyAlignmentError::Intrinsic)?;
let align = match bytes {
0 => None,
bytes => Some(crate::ir::Align::from_bytes(bytes).ok_or(LegacyAlignmentError::Malformed)?),
};
args.remove(removed);
let pointers = match op {
LlvmIntrinsic::Memset { .. } => 1,
_ => 2,
};
Ok(Some(LegacyAlignment {
align,
removed,
pointers,
}))
}
@@ -898,6 +898,45 @@ fn llvm_bases_decode_against_their_declarations() {
"{name}"
);
}
// The declaration an older LLVM wrote: an `i32` alignment before the volatile flag.
let align = Operand::Imm(ImmKind::I32);
assert_eq!(
llvm(
"llvm.memcpy.p0i8.p1i8.i64",
void,
&[p0, p1, i64s, align, flag]
),
DeclClass::Llvm(LlvmIntrinsic::Memcpy {
dst: AddrSpace::Thread,
src: AddrSpace::Device,
len: Elem::I64,
volatile: false,
})
);
assert!(matches!(
llvm(
"llvm.memmove.p1i8.p1i8.i32",
void,
&[p1, p1, i32s, align, flag]
),
DeclClass::Llvm(LlvmIntrinsic::Memmove { .. })
));
assert!(matches!(
llvm(
"llvm.memset.p0i8.i64",
void,
&[p0, Operand::Num(NumTy::scalar(Elem::I8)), i64s, align, flag]
),
DeclClass::Llvm(LlvmIntrinsic::Memset { .. })
));
assert_eq!(
llvm(
"llvm.memcpy.p0i8.p1i8.i64",
void,
&[p0, p1, i64s, flag, flag]
),
DeclClass::Mismatch
);
let i8s = Operand::Num(NumTy::scalar(Elem::I8));
assert!(matches!(
llvm("llvm.memset.p1.i32", void, &[p1, i8s, i32s, flag]),
@@ -1114,6 +1153,15 @@ fn markers_are_dropped() {
assert_eq!(bases.len(), 32);
}
/// `llvm.trap` (MSL's `__builtin_trap`, a call followed by `unreachable`) is outside the closed
/// set and listed as not decoded: its calls stay `Callee::UnknownIntrinsic`, so a trap that
/// survives canonicalization is refused as an unknown intrinsic, and the census counts it listed.
#[test]
fn trap_is_listed_not_decoded() {
assert_eq!(llvm("llvm.trap", Operand::Void, &[]), DeclClass::Unknown);
assert!(undecoded_family("llvm.trap").is_some());
}
#[test]
fn handle_positions_are_typed_seeds() {
let texture = HandleKind::Texture(ImageShape {
+6
View File
@@ -163,6 +163,12 @@ pub enum InstKind {
atomic: Option<Atomic>,
/// A `!range` attachment on the loaded value.
range: Option<RangeMd>,
/// The load runs where the program does not run it: canonicalization made it out of the
/// branch's arm it stood in (a constant reference's load made in a kernel's entry block,
/// or a load of a branch's arm that Metal's backend speculates). A thread may then read
/// bytes the program never read, which its binding need not hold, so lowering contains
/// the access whatever its offset. A decoded load is never speculative.
speculative: bool,
},
/// `store` of `val` to `ptr`.
Store {
+4
View File
@@ -319,6 +319,7 @@ impl Printer<'_> {
volatile,
atomic,
range,
speculative,
} => {
self.out.push_str("load");
self.atomic_prefix(*atomic, *volatile);
@@ -330,6 +331,9 @@ impl Printer<'_> {
if let Some(r) = range {
w!(self, ", !range {:?}", r.ranges);
}
if *speculative {
self.out.push_str(", speculative");
}
}
InstKind::Store {
val,
@@ -232,6 +232,7 @@ fn every_opcode_prints() {
volatile: true,
atomic,
range,
speculative: false,
};
let x = k.push(i32t, load);
k.push_void(InstKind::Store {
+40
View File
@@ -38,6 +38,7 @@ use crate::budget::Meter;
use crate::error::Error;
use crate::error::{DiagName, InputError, InputErrorKind, Location, VerifyError};
use crate::graph::{Cfg, DomTree};
use crate::intrinsics::{LlvmIntrinsic, Template};
/// A verified AIR module. Immutable: passes consume it with [`Module::into_parts`] and build a
/// new one through [`Module::new`].
@@ -916,6 +917,45 @@ impl<'a> Verifier<'a> {
let Some((ret, params, vararg)) = fn_sig(types, fn_ty) else {
return operand(false);
};
// A memory intrinsic declared with an alignment operand (an older LLVM's form,
// its `i32` alignment before the `i1` volatile flag) is called without it: decode
// moved its value to the pointers' `align`. So is one whose volatile flag is not
// yet a constant (`Callee::Unbound`), which specialization binds as it binds the
// current form's.
let upgraded: Vec<TypeId>;
let legacy = |params: &[TypeId]| match params {
[.., align, flag] if params.len() == 5 => {
self.ty(*align) == Some(&Type::Int(32)) && self.is_i1(*flag)
}
_ => false,
};
let params = match call.callee {
Callee::Llvm {
op:
LlvmIntrinsic::Memset { .. }
| LlvmIntrinsic::Memcpy { .. }
| LlvmIntrinsic::Memmove { .. },
..
}
| Callee::Unbound {
template:
Template::Llvm(
LlvmIntrinsic::Memset { .. }
| LlvmIntrinsic::Memcpy { .. }
| LlvmIntrinsic::Memmove { .. },
),
..
} if !vararg && call.args.len() + 1 == params.len() && legacy(params) => {
upgraded = params
.iter()
.enumerate()
.filter(|&(i, _)| i + 2 != params.len())
.map(|(_, &p)| p)
.collect();
&upgraded[..]
}
_ => params,
};
let arity_ok = if vararg {
call.args.len() >= params.len()
} else {
@@ -56,6 +56,7 @@ fn load(f: &mut FunctionBuilder<'_>, ty: TypeId, ptr: Value) -> Value {
volatile: false,
atomic: None,
range: None,
speculative: false,
},
)
}
@@ -505,6 +506,7 @@ fn instruction_typing_is_enforced() {
scope: SyncScope::System,
}),
range: None,
speculative: false,
},
);
},
@@ -1050,3 +1052,60 @@ fn dominance_is_charged_to_the_ledger_and_returned() {
Err(Error::LimitExceeded(crate::error::Limit::LedgerBytes))
);
}
/// A memory intrinsic's call is one operand short of its declaration only where the declaration is
/// the older LLVM's form, an `i32` alignment before the `i1` volatile flag (decode removed the
/// call's alignment operand): a call one short of the current four-parameter form, or of a
/// five-parameter declaration whose fourth parameter is not `i32`, is refused.
#[test]
fn a_memory_intrinsic_call_one_short_only_of_the_legacy_declaration() {
let call = |legacy: bool, align_ty_i32: bool, args: usize| {
let mut m = ModuleBuilder::new();
let t = tys(&mut m);
let i64t = m.int(64);
let mut params = vec![t.dev, t.dev, i64t];
if legacy {
params.push(if align_ty_i32 { t.i32 } else { i64t });
}
params.push(t.i1);
let decl_ty = m.fn_ty(t.void, &params);
let decl = m.declare("llvm.memcpy.p1i8.p1i8.i64", decl_ty);
let len = m.const_int(i64t, 16);
let no = m.const_int(t.i1, 0);
let fty = m.fn_ty(t.void, &[t.dev, t.i32]);
let mut f = m.define("k", fty);
let all = [f.arg(0), f.arg(0), len, no];
let args: Box<[Value]> = match args {
4 => all.into(),
_ => [all[0], all[1], all[3]].into(),
};
f.push(
t.void,
InstKind::Call(Box::new(Call {
callee: Callee::Llvm {
decl,
op: crate::intrinsics::LlvmIntrinsic::Memcpy {
dst: AddrSpace::Device,
src: AddrSpace::Device,
len: crate::intrinsics::Elem::I64,
volatile: false,
},
},
args,
fmf: FastMath::NONE,
tail: TailKind::None,
attrs: None,
range: None,
})),
);
f.ret(None);
f.finish();
m.finish()
};
// Four operands of the current declaration, and of the legacy one.
assert!(call(false, true, 4).is_ok());
assert!(call(true, true, 4).is_ok());
// One short of the current declaration, and of a five-parameter one without the `i32`.
assert_eq!(verify_kind(call(false, true, 3)), VerifyError::OperandType);
assert_eq!(verify_kind(call(true, false, 4)), VerifyError::OperandType);
}
File diff suppressed because it is too large. Load diff
@@ -24,7 +24,8 @@
// salt never used before):
// - Made, answering (object threads, mesh threads, object width, mesh width, mesh grid):
// `plain` 1024, 1024, 32, 32, 1048576, and `maxTotalThreadsPerThreadgroup` 0 in every case;
// `no-object` 3, 1024, 32, 32, 1048576; `max-64-32` 64 and 32; `attribute-64` and
// `no-object` 3, 1024, 32, 32, 1048576; `max-64-32` 64 and 32; `max-1024-1024` as `plain`
// (plain only, a first compile, the same salt again and unsalted alike); `attribute-64` and
// `attribute-64-max-64` 64 for the object stage, `mesh-attribute-64` and
// `mesh-attribute-64-max-64` 64 for the mesh stage; `grid-8` 8, `grid-2097152` 2097152,
// `grid-8-no-object` 8; `grid-attribute-4` 1048576 (an object function's
@@ -117,6 +118,7 @@ static const Case CASES[] = {
{"plain", "obj", "msh", 0, 0, 0, 0, 1, Z, Z},
{"no-object", NULL, "alone", 0, 0, 0, 0, 1, Z, Z},
{"max-64-32", "obj", "msh", 64, 32, 0, 0, 1, Z, Z},
{"max-1024-1024", "obj", "msh", 1024, 1024, 0, 0, 1, Z, Z},
{"max-object-2048", "obj", "msh", 2048, 0, 0, 0, 1, Z, Z},
{"max-mesh-2048", "obj", "msh", 0, 2048, 0, 0, 1, Z, Z},
{"max-mesh-2048-no-object", NULL, "alone", 0, 2048, 0, 0, 1, Z, Z},
@@ -14,7 +14,8 @@
// Cases: `set0` and `set1` (`newFunctionWithName:constantValues:` with constant 17, `b_set`,
// false or true, every other constant undefined), `none` (`newFunctionWithName:`). Each prints
// every constant's `required`, the pipeline's creation, and the 20 words the kernel stores
// (the buffer is filled with 0xAB first). Case `gate` makes kernel `kg`, whose buffer 1 is gated
// (the buffer is filled with 0xAB first). A function Metal does not make prints the error's domain,
// code and text. Case `gate` makes kernel `kg`, whose buffer 1 is gated
// on `!g_flag` and on `g_flag` (buffers 1 and 2) with `g_flag` undefined, and prints the buffers
// its pipeline's reflection binds and the words it stores.
//
@@ -52,6 +53,15 @@
// - `empty` and `descriptor`, every shape: every function answers count 0, and the state is made;
// `ko` stores 7 (`o_opt` undefined), `kn` 9, `k` 0, and `kg` leaves word 0 as filled
// (0xabababab).
// - `set0`: `k`'s constants but `u_opt` answer `required` 1; made with constant 17 alone, the
// function and the state are made and the command buffer completes: Metal refuses no required
// constant left without a value (macOS 27.0.1 build 26A434).
// - `ib/kib/empty`: the constant answers `required` 1; the function and the state are made, the
// imageblock length is 0, the buffer way runs (word 0 is 5) and the texture keeps -1, as for
// `zero`. `ib/kib2/empty`: made, the imageblock length is 1024, and the imageblock way runs
// (texel (0, 0) is (0, 0, 7, 9), (7, 7) is (7, 7, 7, 9)), as for `max`. On both, Metal takes
// the way the AIR's branch on `derived bool == 0` takes when that test is true, and keeps the
// imageblock where that way uses it. The constant's own read (word 1) stores nothing.
#import <Foundation/Foundation.h>
#import <Metal/Metal.h>
#include <stdio.h>
@@ -139,7 +149,7 @@ static id<MTLFunction> made_as(id<MTLLibrary> L, const char *how, NSString *name
d.name = name;
f = [L newFunctionWithDescriptor:d error:&e];
}
if (!f) { printf("RESULT function %s error %s\n", name.UTF8String, e.localizedDescription.UTF8String); exit(0); }
if (!f) { printf("RESULT function %s error domain=%s code=%ld %s\n", name.UTF8String, e.domain.UTF8String, (long)e.code, e.localizedDescription.UTF8String); exit(0); }
printf("RESULT function %s %s constants=%lu\n", name.UTF8String, how, (unsigned long)f.functionConstantsDictionary.count);
fflush(stdout);
return f;
@@ -200,13 +210,114 @@ static int stage_case(id<MTLDevice> D, id<MTLCommandQueue> Q, id<MTLLibrary> L,
return 0;
}
// Cases `ib/<kernel>/<how>`: an explicit imageblock argument gated on a program-scope bool
// derived from a required `uint` constant (`ib_mode`, index 40: the argument is there only for
// 0xffffffff), whose body writes a cell (`imageblock::data`) and the slice of the threadgroup's
// cells to a texture where that bool is true, and word 0 of a buffer otherwise. `kib` branches
// on the bool, `kib2` on its negation (the buffer write first). `how`: `empty` (made with no
// constant value), `zero` (`ib_mode` 0) or `max` (0xffffffff). Each prints the constant's
// `required` (of the function made by name, no pipeline made of it), the function's making, the
// compute state's making and its imageblock length for 8 by 8, then one 8 by 8 dispatch of an
// 8 by 8 threadgroup with an 8 by 8 imageblock: the command buffer's status, words 0 and 1 (5
// where the buffer way ran; the constant's read), and texel (0, 0) and (7, 7) of an
// RGBA32Float texture set to -1 first (the slice way writes (x, y, 7, 9)). Case `ib-source`
// prints that library's source, for `xcrun metal`.
static const char *SRC_IB =
"#include <metal_stdlib>\nusing namespace metal;\n"
"struct Cell { float4 colour; };\n"
"constant uint ib_mode [[function_constant(40)]];\n"
"constant bool ib_on = ib_mode == 0xffffffffu;\n"
"constant bool ib_off = ib_mode != 0xffffffffu;\n"
"constant bool ib_on2 = !ib_off;\n"
"kernel void kib(imageblock<Cell, imageblock_layout_explicit> block [[function_constant(ib_on)]],\n"
" texture2d<float, access::write> out [[texture(0)]], device uint *words [[buffer(0)]],\n"
" ushort2 lid [[thread_position_in_threadgroup]], ushort2 gid [[thread_position_in_grid]]) {\n"
" if (ib_on) {\n"
" threadgroup_imageblock Cell *cell = block.data(lid);\n"
" cell->colour = float4(float(gid.x), float(gid.y), 7.0, 9.0);\n"
" threadgroup_barrier(mem_flags::mem_threadgroup_imageblock);\n"
" if (lid.x == 0 && lid.y == 0) out.write(block.slice(block.data(ushort2(0))->colour), ushort2(0));\n"
" } else if (gid.x == 0 && gid.y == 0) {\n"
" words[0] = 5;\n"
" }\n"
" if (gid.x == 0 && gid.y == 0) words[1] = ib_mode;\n"
"}\n"
"kernel void kib2(imageblock<Cell, imageblock_layout_explicit> block [[function_constant(ib_on2)]],\n"
" texture2d<float, access::write> out [[texture(0)]], device uint *words [[buffer(0)]],\n"
" ushort2 lid [[thread_position_in_threadgroup]], ushort2 gid [[thread_position_in_grid]]) {\n"
" if (ib_off) {\n"
" if (gid.x == 0 && gid.y == 0) words[0] = 5;\n"
" } else {\n"
" threadgroup_imageblock Cell *cell = block.data(lid);\n"
" cell->colour = float4(float(gid.x), float(gid.y), 7.0, 9.0);\n"
" threadgroup_barrier(mem_flags::mem_threadgroup_imageblock);\n"
" if (lid.x == 0 && lid.y == 0) out.write(block.slice(block.data(ushort2(0))->colour), ushort2(0));\n"
" }\n"
" if (gid.x == 0 && gid.y == 0) words[1] = ib_mode;\n"
"}\n";
static int ib_case(id<MTLDevice> D, id<MTLCommandQueue> Q, const char *kernel, const char *how) {
NSError *e = nil;
id<MTLLibrary> L = [D newLibraryWithSource:[NSString stringWithUTF8String:SRC_IB] options:nil error:&e];
if (!L) { printf("RESULT library error domain=%s code=%ld %s\n", e.domain.UTF8String, (long)e.code, e.localizedDescription.UTF8String); return 1; }
NSString *name = [NSString stringWithUTF8String:kernel];
id<MTLFunction> plain = [L newFunctionWithName:name];
for (NSString *k in plain.functionConstantsDictionary) {
MTLFunctionConstant *fc = plain.functionConstantsDictionary[k];
printf("RESULT constant %lu type=%ld required=%d\n", (unsigned long)fc.index, (long)fc.type, fc.required);
}
MTLFunctionConstantValues *v = [MTLFunctionConstantValues new];
uint32_t mode = strcmp(how, "max") == 0 ? 0xffffffffu : 0;
if (strcmp(how, "empty") != 0) [v setConstantValue:&mode type:MTLDataTypeUInt atIndex:40];
id<MTLFunction> f = [L newFunctionWithName:name constantValues:v error:&e];
if (!f) { printf("RESULT function error domain=%s code=%ld %s\n", e.domain.UTF8String, (long)e.code, e.localizedDescription.UTF8String); return 0; }
printf("RESULT function made constants=%lu\n", (unsigned long)f.functionConstantsDictionary.count);
fflush(stdout);
id<MTLComputePipelineState> ps = [D newComputePipelineStateWithFunction:f error:&e];
if (!ps) { printf("RESULT pipeline error domain=%s code=%ld %s\n", e.domain.UTF8String, (long)e.code, e.localizedDescription.UTF8String); return 0; }
printf("RESULT pipeline made imageblock_length_8x8=%lu\n", (unsigned long)[ps imageblockMemoryLengthForDimensions:MTLSizeMake(8, 8, 1)]);
fflush(stdout);
MTLTextureDescriptor *td = [MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA32Float width:8 height:8 mipmapped:NO];
td.usage = MTLTextureUsageShaderWrite | MTLTextureUsageShaderRead;
td.storageMode = MTLStorageModeShared;
id<MTLTexture> tex = [D newTextureWithDescriptor:td];
static float texels[8][8][4];
for (int i = 0; i < 8 * 8 * 4; i++) ((float *)texels)[i] = -1.0f;
[tex replaceRegion:MTLRegionMake2D(0, 0, 8, 8) mipmapLevel:0 withBytes:texels bytesPerRow:8 * 16];
id<MTLBuffer> words = [D newBufferWithLength:64 options:MTLResourceStorageModeShared];
memset(words.contents, 0xAB, 64);
id<MTLCommandBuffer> cb = [Q commandBuffer];
id<MTLComputeCommandEncoder> ce = [cb computeCommandEncoder];
[ce setComputePipelineState:ps];
[ce setTexture:tex atIndex:0];
[ce setBuffer:words offset:0 atIndex:0];
[ce setImageblockWidth:8 height:8];
[ce dispatchThreads:MTLSizeMake(8, 8, 1) threadsPerThreadgroup:MTLSizeMake(8, 8, 1)];
[ce endEncoding]; [cb commit]; [cb waitUntilCompleted];
[tex getBytes:texels bytesPerRow:8 * 16 fromRegion:MTLRegionMake2D(0, 0, 8, 8) mipmapLevel:0];
const uint32_t *w = words.contents;
printf("RESULT status=%ld%s%s words %08x %08x texel00 %g %g %g %g texel77 %g %g %g %g\n", (long)cb.status,
cb.error ? " error " : "", cb.error ? cb.error.localizedDescription.UTF8String : "", w[0], w[1],
texels[0][0][0], texels[0][0][1], texels[0][0][2], texels[0][0][3],
texels[7][7][0], texels[7][7][1], texels[7][7][2], texels[7][7][3]);
return 0;
}
int main(int argc, char **argv) {
if (argc < 2) return 2;
const char *c = argv[1];
if (strcmp(c, "ib-source") == 0) { fputs(SRC_IB, stdout); return 0; }
@autoreleasepool {
printf("RESULT case=%s debug_layer=%s\n", c, getenv("MTL_DEBUG_LAYER") ? getenv("MTL_DEBUG_LAYER") : "unset");
id<MTLDevice> D = MTLCreateSystemDefaultDevice();
id<MTLCommandQueue> Q = [D newCommandQueue];
if (strncmp(c, "ib/", 3) == 0) {
char kernel[16] = {0};
const char *slash = strchr(c + 3, '/');
if (!slash || (size_t)(slash - c - 3) >= sizeof kernel) return 2;
memcpy(kernel, c + 3, (size_t)(slash - c - 3));
return ib_case(D, Q, kernel, slash + 1);
}
NSError *e = nil;
id<MTLLibrary> L = [D newLibraryWithSource:[NSString stringWithUTF8String:SRC] options:nil error:&e];
if (!L) { printf("RESULT library error %s\n", e.localizedDescription.UTF8String); return 1; }
@@ -250,7 +361,7 @@ int main(int argc, char **argv) {
BOOL b = strcmp(c, "set1") == 0;
[v setConstantValue:&b type:MTLDataTypeBool atIndex:17];
f = [L newFunctionWithName:@"k" constantValues:v error:&e];
if (!f) { printf("RESULT function error %s\n", e.localizedDescription.UTF8String); return 0; }
if (!f) { printf("RESULT function error domain=%s code=%ld %s\n", e.domain.UTF8String, (long)e.code, e.localizedDescription.UTF8String); return 0; }
}
id<MTLComputePipelineState> ps = [D newComputePipelineStateWithFunction:f error:&e];
if (!ps) { printf("RESULT pipeline error %s\n", e.localizedDescription.UTF8String); return 0; }
@@ -0,0 +1,699 @@
{
"format": 1,
"case": "chroma-pair-texel-gathers-bgrg422",
"suite_version": 1,
"shaders": [
{
"fixture": "fpv_swizzled_reads.ll",
"entry": "fpv_swz_gather_x",
"source_sha256": "b91fae6759b1cb6496c80a57c5628aef675497891efefe9f6cdd5a8a38a6703e"
},
{
"fixture": "fpv_swizzled_reads.air.ll",
"entry": "fpv_swz_gather_x",
"source_sha256": "18992f6252c2fcdc827256266349a4efc8b5d5428dbb37a6f22218db7a9c8a54"
},
{
"fixture": "fpv_swizzled_reads.ll",
"entry": "fpv_swz_gather_y",
"source_sha256": "b91fae6759b1cb6496c80a57c5628aef675497891efefe9f6cdd5a8a38a6703e"
},
{
"fixture": "fpv_swizzled_reads.air.ll",
"entry": "fpv_swz_gather_y",
"source_sha256": "18992f6252c2fcdc827256266349a4efc8b5d5428dbb37a6f22218db7a9c8a54"
},
{
"fixture": "fpv_swizzled_reads.ll",
"entry": "fpv_swz_gather_z",
"source_sha256": "b91fae6759b1cb6496c80a57c5628aef675497891efefe9f6cdd5a8a38a6703e"
},
{
"fixture": "fpv_swizzled_reads.air.ll",
"entry": "fpv_swz_gather_z",
"source_sha256": "18992f6252c2fcdc827256266349a4efc8b5d5428dbb37a6f22218db7a9c8a54"
},
{
"fixture": "fpv_swizzled_reads.ll",
"entry": "fpv_swz_gather_w",
"source_sha256": "b91fae6759b1cb6496c80a57c5628aef675497891efefe9f6cdd5a8a38a6703e"
},
{
"fixture": "fpv_swizzled_reads.air.ll",
"entry": "fpv_swz_gather_w",
"source_sha256": "18992f6252c2fcdc827256266349a4efc8b5d5428dbb37a6f22218db7a9c8a54"
}
],
"answers": [
{
"key": {
"chip": "apple-m3-max",
"os_version": "27.0.1",
"os_build": "26A434",
"metal_level": "27.0.1"
},
"provenance": "metal_run",
"device": "Apple M3 Max",
"runs": 3,
"outcomes": [
{
"runs": 3,
"transcript": {
"root": {
"name": "case",
"observed": {
"value": "absent"
},
"children": [
{
"name": "inputs",
"observed": {
"value": "absent"
},
"children": [
{
"name": "air",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "b91fae6759b1cb6496c80a57c5628aef675497891efefe9f6cdd5a8a38a6703e"
}
}
},
{
"name": "air-typed",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "18992f6252c2fcdc827256266349a4efc8b5d5428dbb37a6f22218db7a9c8a54"
}
}
},
{
"name": "entry",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "ec15cf47f4671624c66cfd2215ddd6b49f606a9836b21bf5d6efe51120a17250"
}
}
},
{
"name": "format",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "946e5fffd5aeab455618b623ec6cbc5ec6f26e67320db4f4ea7f2c62bef85bcc"
}
}
},
{
"name": "texture:bytes",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "97d94990adf22069b968c7e737659f3deec9487277219fd99998f04df0bbcce5"
}
}
},
{
"name": "positions",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "1bdb601fe30639f55df17904745a273ecbdd7cfaaf2375fdc7c7168ef085b46b"
}
}
},
{
"name": "buffer:blank",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "087d80f7f182dd44f184aa86ca34488853ebcc04f0c60d5294919a466b463831"
}
}
},
{
"name": "sampler",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "640e494dd31edb66b0748239aa90547d77e8ab37843b5bc8352a5f39e5296f06"
}
}
}
]
},
{
"name": "library",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "texture",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "positions",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "sampler",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "x/pipeline",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "x/output",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "x/dispatch",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "x/status",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "x/read-back",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "texels/bgrg422/gathers/x",
"observed": {
"value": {
"bytes": "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 truncated
},
"shape": {
"bytes": {
"region": {
"buffer": {
"offset": 0,
"length": 4096
}
},
"element": "f32",
"row_offset": 0,
"row_elements": 4,
"row_pitch": 16,
"rows": 256,
"image_pitch": 4096,
"images": 1,
"gaps": "ignored"
}
},
"digest": {
"kind": "sha256",
"hex": "f409b83161097b2fce88593d4e2f93e646f261614d168936d8c80b6dbedbdd32"
}
}
},
{
"name": "y/pipeline",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "y/output",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "y/dispatch",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "y/status",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "y/read-back",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "texels/bgrg422/gathers/y",
"observed": {
"value": {
"bytes": "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 truncated
},
"shape": {
"bytes": {
"region": {
"buffer": {
"offset": 0,
"length": 4096
}
},
"element": "f32",
"row_offset": 0,
"row_elements": 4,
"row_pitch": 16,
"rows": 256,
"image_pitch": 4096,
"images": 1,
"gaps": "ignored"
}
},
"digest": {
"kind": "sha256",
"hex": "e41ba95149730a32a1dfdba6e7ed1b8e46bb5923b57634d10b5e2d45a93c7b3c"
}
}
},
{
"name": "z/pipeline",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "z/output",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "z/dispatch",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "z/status",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "z/read-back",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "texels/bgrg422/gathers/z",
"observed": {
"value": {
"bytes": "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 truncated
},
"shape": {
"bytes": {
"region": {
"buffer": {
"offset": 0,
"length": 4096
}
},
"element": "f32",
"row_offset": 0,
"row_elements": 4,
"row_pitch": 16,
"rows": 256,
"image_pitch": 4096,
"images": 1,
"gaps": "ignored"
}
},
"digest": {
"kind": "sha256",
"hex": "ca65053fde743aa72334c80638b1308061912e47c4c81ac8be2a49559ff574b9"
}
}
},
{
"name": "w/pipeline",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "w/output",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "w/dispatch",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "w/status",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "w/read-back",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "texels/bgrg422/gathers/w",
"observed": {
"value": {
"bytes": "AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwALine truncated
},
"shape": {
"bytes": {
"region": {
"buffer": {
"offset": 0,
"length": 4096
}
},
"element": "f32",
"row_offset": 0,
"row_elements": 4,
"row_pitch": 16,
"rows": 256,
"image_pitch": 4096,
"images": 1,
"gaps": "ignored"
}
},
"digest": {
"kind": "sha256",
"hex": "e9bac255f4adc7cb4ada9298e193a5ff66b434d15afabd458505325f29c398c7"
}
}
},
{
"name": "notices",
"observed": {
"value": "absent"
},
"children": [
{
"name": "set",
"observed": {
"value": {
"nothing": "announced_nothing"
}
}
},
{
"name": "counts",
"observed": {
"value": {
"fields": {}
}
}
}
]
}
]
}
}
}
],
"validated": "ran"
}
],
"times": [
{
"venue": "native Metal",
"chip": "apple-m3-max",
"os_build": "26A434",
"rounds": 8,
"measured": "8 round(s) of the whole selection, in the case set's own order; a figure is the median of the rounds' own medians; Metal's leg ran at a one-minute load average of 4.11",
"instrument": 400,
"times": {
"case": "chroma-pair-texel-gathers-bgrg422",
"calls": 24,
"in_calls": 32775419,
"on_cpu": 1615544,
"blocked": 31193794,
"elsewhere": 3438167,
"spend": 36183586,
"spend_least": 34915125,
"spend_most": 37207584,
"per_call": [
{
"call": "buffer",
"least_calls": 5,
"most_calls": 5,
"wall": 14584,
"on_cpu": 14791,
"blocked": 0,
"wall_least": 12792,
"wall_most": 16042,
"wall_total": 71541,
"on_cpu_total": 72542,
"blocked_total": 0
},
{
"call": "compute_pipeline",
"least_calls": 4,
"most_calls": 4,
"wall": 59417,
"on_cpu": 59667,
"blocked": 0,
"wall_least": 55125,
"wall_most": 63500,
"wall_total": 319541,
"on_cpu_total": 320834,
"blocked_total": 0
},
{
"call": "dispatch_threads",
"least_calls": 4,
"most_calls": 4,
"wall": 36916,
"on_cpu": 37041,
"blocked": 0,
"wall_least": 36250,
"wall_most": 39042,
"wall_total": 286832,
"on_cpu_total": 287543,
"blocked_total": 0
},
{
"call": "library",
"least_calls": 1,
"most_calls": 1,
"wall": 26701250,
"on_cpu": 737041,
"blocked": 25917584,
"wall_least": 26187791,
"wall_most": 27419875,
"wall_total": 26701250,
"on_cpu_total": 737041,
"blocked_total": 25917584
},
{
"call": "read_buffer",
"least_calls": 4,
"most_calls": 4,
"wall": 4417,
"on_cpu": 4667,
"blocked": 0,
"wall_least": 3625,
"wall_most": 4958,
"wall_total": 19876,
"on_cpu_total": 20708,
"blocked_total": 0
},
{
"call": "sampler",
"least_calls": 1,
"most_calls": 1,
"wall": 41250,
"on_cpu": 41375,
"blocked": 0,
"wall_least": 40875,
"wall_most": 43583,
"wall_total": 41250,
"on_cpu_total": 41375,
"blocked_total": 0
},
{
"call": "texture_2d_in_role",
"least_calls": 1,
"most_calls": 1,
"wall": 68542,
"on_cpu": 68958,
"blocked": 0,
"wall_least": 64000,
"wall_most": 80334,
"wall_total": 68542,
"on_cpu_total": 68958,
"blocked_total": 0
},
{
"call": "wait",
"least_calls": 4,
"most_calls": 4,
"wall": 480250,
"on_cpu": 10583,
"blocked": 470125,
"wall_least": 149333,
"wall_most": 510917,
"wall_total": 5264168,
"on_cpu_total": 51917,
"blocked_total": 5213251
}
]
}
}
]
}
@@ -0,0 +1,699 @@
{
"format": 1,
"case": "chroma-pair-texel-gathers-gbgr422",
"suite_version": 1,
"shaders": [
{
"fixture": "fpv_swizzled_reads.ll",
"entry": "fpv_swz_gather_x",
"source_sha256": "b91fae6759b1cb6496c80a57c5628aef675497891efefe9f6cdd5a8a38a6703e"
},
{
"fixture": "fpv_swizzled_reads.air.ll",
"entry": "fpv_swz_gather_x",
"source_sha256": "18992f6252c2fcdc827256266349a4efc8b5d5428dbb37a6f22218db7a9c8a54"
},
{
"fixture": "fpv_swizzled_reads.ll",
"entry": "fpv_swz_gather_y",
"source_sha256": "b91fae6759b1cb6496c80a57c5628aef675497891efefe9f6cdd5a8a38a6703e"
},
{
"fixture": "fpv_swizzled_reads.air.ll",
"entry": "fpv_swz_gather_y",
"source_sha256": "18992f6252c2fcdc827256266349a4efc8b5d5428dbb37a6f22218db7a9c8a54"
},
{
"fixture": "fpv_swizzled_reads.ll",
"entry": "fpv_swz_gather_z",
"source_sha256": "b91fae6759b1cb6496c80a57c5628aef675497891efefe9f6cdd5a8a38a6703e"
},
{
"fixture": "fpv_swizzled_reads.air.ll",
"entry": "fpv_swz_gather_z",
"source_sha256": "18992f6252c2fcdc827256266349a4efc8b5d5428dbb37a6f22218db7a9c8a54"
},
{
"fixture": "fpv_swizzled_reads.ll",
"entry": "fpv_swz_gather_w",
"source_sha256": "b91fae6759b1cb6496c80a57c5628aef675497891efefe9f6cdd5a8a38a6703e"
},
{
"fixture": "fpv_swizzled_reads.air.ll",
"entry": "fpv_swz_gather_w",
"source_sha256": "18992f6252c2fcdc827256266349a4efc8b5d5428dbb37a6f22218db7a9c8a54"
}
],
"answers": [
{
"key": {
"chip": "apple-m3-max",
"os_version": "27.0.1",
"os_build": "26A434",
"metal_level": "27.0.1"
},
"provenance": "metal_run",
"device": "Apple M3 Max",
"runs": 3,
"outcomes": [
{
"runs": 3,
"transcript": {
"root": {
"name": "case",
"observed": {
"value": "absent"
},
"children": [
{
"name": "inputs",
"observed": {
"value": "absent"
},
"children": [
{
"name": "air",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "b91fae6759b1cb6496c80a57c5628aef675497891efefe9f6cdd5a8a38a6703e"
}
}
},
{
"name": "air-typed",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "18992f6252c2fcdc827256266349a4efc8b5d5428dbb37a6f22218db7a9c8a54"
}
}
},
{
"name": "entry",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "ec15cf47f4671624c66cfd2215ddd6b49f606a9836b21bf5d6efe51120a17250"
}
}
},
{
"name": "format",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "e6bfd42cb3ef4c11ccd2eb76227f9fa93916250b47c03f644c3171b9be8d9c02"
}
}
},
{
"name": "texture:bytes",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "97d94990adf22069b968c7e737659f3deec9487277219fd99998f04df0bbcce5"
}
}
},
{
"name": "positions",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "1bdb601fe30639f55df17904745a273ecbdd7cfaaf2375fdc7c7168ef085b46b"
}
}
},
{
"name": "buffer:blank",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "087d80f7f182dd44f184aa86ca34488853ebcc04f0c60d5294919a466b463831"
}
}
},
{
"name": "sampler",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "640e494dd31edb66b0748239aa90547d77e8ab37843b5bc8352a5f39e5296f06"
}
}
}
]
},
{
"name": "library",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "texture",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "positions",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "sampler",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "x/pipeline",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "x/output",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "x/dispatch",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "x/status",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "x/read-back",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "texels/gbgr422/gathers/x",
"observed": {
"value": {
"bytes": "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 truncated
},
"shape": {
"bytes": {
"region": {
"buffer": {
"offset": 0,
"length": 4096
}
},
"element": "f32",
"row_offset": 0,
"row_elements": 4,
"row_pitch": 16,
"rows": 256,
"image_pitch": 4096,
"images": 1,
"gaps": "ignored"
}
},
"digest": {
"kind": "sha256",
"hex": "e38f51f518a826e01bfa96e8e428b5dc11cf794a972af12b34a763f1728a8068"
}
}
},
{
"name": "y/pipeline",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "y/output",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "y/dispatch",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "y/status",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "y/read-back",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "texels/gbgr422/gathers/y",
"observed": {
"value": {
"bytes": "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 truncated
},
"shape": {
"bytes": {
"region": {
"buffer": {
"offset": 0,
"length": 4096
}
},
"element": "f32",
"row_offset": 0,
"row_elements": 4,
"row_pitch": 16,
"rows": 256,
"image_pitch": 4096,
"images": 1,
"gaps": "ignored"
}
},
"digest": {
"kind": "sha256",
"hex": "c5f059013ef60218f92719bac0505648ed32530e4ed8be7a29b75d2b14f62156"
}
}
},
{
"name": "z/pipeline",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "z/output",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "z/dispatch",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "z/status",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "z/read-back",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "texels/gbgr422/gathers/z",
"observed": {
"value": {
"bytes": "gYCAPdHQUD6xsLA9wcBAPNHQUD739vY+8fBwPrGwsD339vY++fj4Pvn4eD7x8HA++fj4PtXUVD7p6Og9+fh4PtXUVD6JiIg93dxcPuno6D2JiIg9gYCAPY2MDD/d3Fw+gYCAPdXUVD6ioSE/jYwMP9XUVD6CgQE/7ezsPqKhIT+CgQE/tLMzP4eGBj/t7Ow+tLMzP83MTD/T0lI/h4YGP83MTD+trCw/395eP9PSUj+trCw/qaioPqyrKz/f3l4/qaioPpOSkj6FhAQ/rKsrP5OSkj6Ligo/1dTUPoWEBD+Ligo/rKsrP7u6uj7V1NQ+rKsrP6yrKz+7uro+u7q6Pvf2dj/b2lo/0dBQPoGAgD3b2lo/oqEhP/f29j7R0FA+oqEhP/Py8j75+Pg+9/b2PvPy8j7FxMQ+1dRUPvn4+D7FxMQ+19bWPomIiD3V1FQ+19bWPpaVFT+BgIA9iYiIPZaVFT+wry8/1dRUPoGAgD2wry8/ubg4P4KBAT/V1FQ+ubg4P8C/Pz+0szM/goEBP8C/Pz/Ew0M/zcxMP7SzMz/Ew0M/sbAwP62sLD/NzEw/sbAwP4aFBT+pqKg+rawsP4aFBT+KiQk/k5KSPqmoqD6KiQk/u7o6P4uKCj+TkpI+u7o6P9TTUz+sqys/i4oKP9TTUz/U01M/rKsrP6yrKz+joqI+7+7uPtvaWj/39nY/7+7uPsXERD+ioSE/29paP8XERD/j4mI/8/LyPqKhIT/j4mI/1NNTP8XExD7z8vI+1NNTP6uqKj/X1tY+xcTEPquqKj/Pzs4+lpUVP9fW1j7Pzs4+qaioPrCvLz+WlRU/qaioPt/e3j65uDg/sK8vP9/e3j6Qjw8/wL8/P7m4OD+Qjw8/s7IyP8TDQz/Avz8/s7IyP8/OTj+xsDA/xMNDP8/OTj/k42M/hoUFP7GwMD/k42M/2tlZP4qJCT+GhQU/2tlZP7GwMD+7ujo/iokJP7GwMD+dnBw/1NNTP7u6Oj+dnBw/nZwcP9TTUz/U01M/iokJP4GAAD/v7u4+o6KiPoGAAD/f3t4+xcREP+/u7j7f3t4+8/LyPuPiYj/FxEQ/8/LyPqGgID/U01M/4+JiP6GgID+enR0/q6oqP9TTUz+enR0/4+LiPs/Ozj6rqio/4+LiPquqqj6pqKg+z87OPquqqj6RkJA+397ePqmoqD6RkJA+mZiYPpCPDz/f3t4+mZiYPr++vj6zsjI/kI8PP7++vj7j4uI+z85OP7OyMj/j4uI+gYAAP+TjYz/Pzk4/gYAAP9nY2D7a2Vk/5ONjP9nY2D7V1FQ+sbAwP9rZWT/V1FQ+0dDQPZ2cHD+xsDA/0dDQPdHQ0D2dnBw/nZwcP/n4eD/s62s/gYAAP4qJCT/s62s/0dBQP9/e3j6BgAA/0dBQP5iXFz/z8vI+397ePpiXFz+FhIQ+oaAgP/Py8j6FhIQ+ubg4Pp6dHT+hoCA/ubg4Prm4uD7j4uI+np0dP7m4uD6FhAQ/q6qqPuPi4j6FhAQ/p6YmP5GQkD6rqqo+p6YmP7CvLz+ZmJg+kZCQPrCvLz+hoCA/v76+PpmYmD6hoCA/oaAgP+Pi4j6/vr4+oaAgP7GwMD+BgAA/4+LiPrGwMD/Avz8/2djYPoGAAD/Avz8/zcxMP9XUVD7Z2Ng+zcxMP9PSUj/R0NA91dRUPtPSUj/T0lI/0dDQPdHQ0D37+no/zcxMP+zraz/5+Hg/zcxMP+Pi4j7R0FA/7OtrP+Pi4j6fnp4+mJcXP9HQUD+fnp4+zczMPoWEhD6Ylxc/zczMPtva2j65uDg+hYSEPtva2j7FxMQ+ubi4Prm4OD7FxMQ+jYyMPoWEBD+5uLg+jYyMPtnY2D2npiY/hYQEP9nY2D3Z2Ng9sK8vP6emJj/Z2Ng9jYyMPqGgID+wry8/jYyMPp+enj6hoCA/oaAgP5+enj7R0FA+sbAwP6GgID/R0FA+lZSUPsC/Pz+xsDA/lZSUPpKRET/NzEw/wL8/P5KRET+2tTU/09JSP83MTD+2tTU/trU1P9PSUj/T0lI/2djYPZGQED7NzEw/+/p6P5GQED7d3Fw+4+LiPs3MTD/d3Fw+nZycPp+enj7j4uI+nZycPtPS0j7NzMw+n56ePtPS0j65uLg+29raPs3MzD65uLg+nZwcPsXExD7b2to+nZwcPuHg4D2NjIw+xcTEPuHg4D3x8HA+2djYPY2MjD7x8HA+p6amPtnY2D3Z2Ng9p6amPsXExD6NjIw+2djYPcXExD7p6Og+n56ePo2MjD7p6Og+iokJP9HQUD6fnp4+iokJP66tLT+VlJQ+0dBQPq6tLT/f3l4/kpERP5WUlD7f3l4/9/Z2P7a1NT+SkRE/9/Z2P/f2dj+2tTU/trU1P7++vj6TkpI+kZAQPtnY2D2TkpI+8fDwPd3cXD6RkBA+8fDwPeHgYD6dnJw+3dxcPuHgYD6ZmBg/09LSPp2cnD6ZmBg/qqkpP7m4uD7T0tI+qqkpP9nY2D6dnBw+ubi4PtnY2D7t7Gw+4eDgPZ2cHD7t7Gw+sbCwPfHwcD7h4OA9sbCwPcHAwDynpqY+8fBwPsHAwDzBwEA9xcTEPqempj7BwEA9lZSUPuno6D7FxMQ+lZSUPsLBQT+KiQk/6ejoPsLBQT/FxEQ/rq0tP4qJCT/FxEQ/p6amPt/eXj+urS0/p6amPtHQ0D339nY/395eP9HQ0D3R0NA99/Z2P/f2dj/19HQ/9/Z2P5OSkj6/vr4+9/Z2P/r5eT/x8PA9k5KSPvr5eT/l5GQ/4eBgPvHw8D3l5GQ/ubg4P5mYGD/h4GA+ubg4P7e2Nj+qqSk/mZgYP7e2Nj/e3V0/2djYPqqpKT/e3V0/6OdnP+3sbD7Z2Ng+6OdnP9TTUz+xsLA97exsPtTTUz+enR0/wcDAPLGwsD2enR0/jYyMPsHAQD3BwMA8jYyMPuXkZD6VlJQ+wcBAPeXkZD7x8PA+wsFBP5WUlD7x8PA+mJcXP8XERD/CwUE/mJcXP5mYGD+npqY+xcREP5mYGD+ZmBg/0dDQPaempj6ZmBg/mZgYP9HQ0D3R0NA92NdXP6yrKz/39nY/9fR0P6yrKz+pqKg++vl5P/f2dj+pqKg+oaAgPuXkZD/6+Xk/oaAgPp2cHD65uDg/5eRkP52cHD6JiIg+t7Y2P7m4OD+JiIg+//7+Pt7dXT+3tjY///7+Pp+eHj/o52c/3t1dP5+eHj+ioSE/1NNTP+jnZz+ioSE/lpUVP56dHT/U01M/lpUVP/n4+D6NjIw+np0dP/n4+D7Pzs4+5eRkPo2MjD7Pzs4+raysPvHw8D7l5GQ+raysPpeWlj6Ylxc/8fDwPpeWlj6JiIg+mZgYP5iXFz+JiIg+g4KCPpmYGD+ZmBg/g4KCPoOCgj6ZmBg/mZgYP+Xk5D6KiQk/rKsrP9jXVz+KiQk/t7Y2P6moqD6sqys/t7Y2P83MTD+hoCA+qaioPs3MTD/My0s/nZwcPqGgID7My0s/2NdXP4mIiD6dnBw+2NdXP/HwcD///v4+iYiIPvHwcD/Avz8/n54eP//+/j7Avz8/jYyMPqKhIT+fnh4/jYyMPvHwcD6WlRU/oqEhP/HwcD6koyM/+fj4PpaVFT+koyM/2dhYP8/Ozj75+Pg+2dhYP9zbWz+trKw+z87OPtzbWz+ysTE/l5aWPq2srD6ysTE/s7KyPomIiD6XlpY+s7KyPrW0ND6DgoI+iYiIPrW0ND61tDQ+g4KCPoOCgj7f3t4+wcDAPoqJCT/l5OQ+wcDAPoWEhD63tjY/iokJP4WEhD67uro+zcxMP7e2Nj+7uro+sbAwP8zLSz/NzEw/sbAwP93cXD/Y11c/zMtLP93cXD/h4GA/8fBwP9jXVz/h4GA/xsVFP8C/Pz/x8HA/xsVFP4uKCj+NjIw+wL8/P4uKCj+xsLA+8fBwPo2MjD6xsLA+vbw8PqSjIz/x8HA+vbw8Prm4uD3Z2Fg/pKMjP7m4uD2BgIA93NtbP9nYWD+BgIA9qagoPrKxMT/c21s/qagoPs3MzD6zsrI+srExP83MzD6FhAQ/tbQ0PrOysj6FhAQ/hYQEP7W0ND61tDQ+oaAgPtnYWD7BwMA+397ePtnYWD6joqI+hYSEPsHAwD6joqI+9/b2Pru6uj6FhIQ+9/b2PrW0ND+xsDA/u7q6PrW0ND+wry8/3dxcP7GwMD+wry8/2djYPuHgYD/d3Fw/2djYPqWkpD7GxUU/4eBgP6WkpD7DwsI+i4oKP8bFRT/DwsI+jYwMP7GwsD6Ligo/jYwMP9XUVD+9vDw+sbCwPtXUVD++vT0/ubi4Pb28PD6+vT0/j46OPoGAgD25uLg9j46OPunoaD6pqCg+gYCAPenoaD6WlRU/zczMPqmoKD6WlRU/w8JCP4WEBD/NzMw+w8JCP8PCQj+FhAQ/hYQEP9XUVD6rqqo+2dhYPqGgID6rqqo+lZQUP6Oioj7Z2Fg+lZQUP5uaGj/39vY+o6KiPpuaGj/Pzs4+tbQ0P/f29j7Pzs4+2djYPrCvLz+1tDQ/2djYPquqKj/Z2Ng+sK8vP6uqKj/Ew0M/paSkPtnY2D7Ew0M/ubg4P8PCwj6lpKQ+ubg4P7KxMT+NjAw/w8LCPrKxMT+vri4/1dRUP42MDD+vri4/nZwcP769PT/V1FQ/nZwcP/v6+j6Pjo4+vr09P/v6+j7n5uY+6ehoPo+Ojj7n5uY+/fz8PpaVFT/p6Gg+/fz8PoSDAz/DwkI/lpUVP4SDAz+EgwM/w8JCP8PCQj/V1NQ+5eTkPquqqj7V1FQ+5eTkPoKBAT+VlBQ/q6qqPoKBAT+CgQE/m5oaP5WUFD+CgQE/5eTkPs/Ozj6bmho/5eTkPrW0tD7Z2Ng+z87OPrW0tD7h4GA+q6oqP9nY2D7h4GA+8fBwPsTDQz+rqio/8fBwPs/Ozj65uDg/xMNDP8/Ozj7Lyso+srExP7mLine truncated
},
"shape": {
"bytes": {
"region": {
"buffer": {
"offset": 0,
"length": 4096
}
},
"element": "f32",
"row_offset": 0,
"row_elements": 4,
"row_pitch": 16,
"rows": 256,
"image_pitch": 4096,
"images": 1,
"gaps": "ignored"
}
},
"digest": {
"kind": "sha256",
"hex": "e98b5be8828fc9b9f92bcddf6f95ed602aea42dc46490caa10eb4f281c46249b"
}
}
},
{
"name": "w/pipeline",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "w/output",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "w/dispatch",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "w/status",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "w/read-back",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "texels/gbgr422/gathers/w",
"observed": {
"value": {
"bytes": "AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwALine truncated
},
"shape": {
"bytes": {
"region": {
"buffer": {
"offset": 0,
"length": 4096
}
},
"element": "f32",
"row_offset": 0,
"row_elements": 4,
"row_pitch": 16,
"rows": 256,
"image_pitch": 4096,
"images": 1,
"gaps": "ignored"
}
},
"digest": {
"kind": "sha256",
"hex": "e9bac255f4adc7cb4ada9298e193a5ff66b434d15afabd458505325f29c398c7"
}
}
},
{
"name": "notices",
"observed": {
"value": "absent"
},
"children": [
{
"name": "set",
"observed": {
"value": {
"nothing": "announced_nothing"
}
}
},
{
"name": "counts",
"observed": {
"value": {
"fields": {}
}
}
}
]
}
]
}
}
}
],
"validated": "ran"
}
],
"times": [
{
"venue": "native Metal",
"chip": "apple-m3-max",
"os_build": "26A434",
"rounds": 8,
"measured": "8 round(s) of the whole selection, in the case set's own order; a figure is the median of the rounds' own medians; Metal's leg ran at a one-minute load average of 4.11",
"instrument": 400,
"times": {
"case": "chroma-pair-texel-gathers-gbgr422",
"calls": 24,
"in_calls": 31868417,
"on_cpu": 1588208,
"blocked": 30291457,
"elsewhere": 3411542,
"spend": 35234375,
"spend_least": 34697376,
"spend_most": 351309000,
"per_call": [
{
"call": "buffer",
"least_calls": 5,
"most_calls": 5,
"wall": 13834,
"on_cpu": 14000,
"blocked": 0,
"wall_least": 13208,
"wall_most": 24791,
"wall_total": 75418,
"on_cpu_total": 76292,
"blocked_total": 0
},
{
"call": "compute_pipeline",
"least_calls": 4,
"most_calls": 4,
"wall": 60209,
"on_cpu": 59292,
"blocked": 0,
"wall_least": 36125,
"wall_most": 186500,
"wall_total": 292209,
"on_cpu_total": 293126,
"blocked_total": 0
},
{
"call": "dispatch_threads",
"least_calls": 4,
"most_calls": 4,
"wall": 35250,
"on_cpu": 35459,
"blocked": 0,
"wall_least": 31333,
"wall_most": 41875,
"wall_total": 287042,
"on_cpu_total": 287875,
"blocked_total": 0
},
{
"call": "library",
"least_calls": 1,
"most_calls": 1,
"wall": 26379584,
"on_cpu": 768042,
"blocked": 25611542,
"wall_least": 25852333,
"wall_most": 339770125,
"wall_total": 26379584,
"on_cpu_total": 768042,
"blocked_total": 25611542
},
{
"call": "read_buffer",
"least_calls": 4,
"most_calls": 4,
"wall": 3583,
"on_cpu": 3708,
"blocked": 0,
"wall_least": 3083,
"wall_most": 4500,
"wall_total": 18959,
"on_cpu_total": 19625,
"blocked_total": 0
},
{
"call": "sampler",
"least_calls": 1,
"most_calls": 1,
"wall": 41334,
"on_cpu": 41625,
"blocked": 0,
"wall_least": 40916,
"wall_most": 60958,
"wall_total": 41334,
"on_cpu_total": 41625,
"blocked_total": 0
},
{
"call": "texture_2d_in_role",
"least_calls": 1,
"most_calls": 1,
"wall": 69750,
"on_cpu": 70041,
"blocked": 0,
"wall_least": 58625,
"wall_most": 191125,
"wall_total": 69750,
"on_cpu_total": 70041,
"blocked_total": 0
},
{
"call": "wait",
"least_calls": 4,
"most_calls": 4,
"wall": 180792,
"on_cpu": 8459,
"blocked": 173292,
"wall_least": 147667,
"wall_most": 500417,
"wall_total": 4347667,
"on_cpu_total": 51750,
"blocked_total": 4299708
}
]
}
}
]
}
@@ -0,0 +1,414 @@
{
"format": 1,
"case": "chroma-pair-texel-linear-samples-bgrg422",
"suite_version": 1,
"shaders": [
{
"fixture": "fpv_swizzled_reads.ll",
"entry": "fpv_swz_sample",
"source_sha256": "b91fae6759b1cb6496c80a57c5628aef675497891efefe9f6cdd5a8a38a6703e"
},
{
"fixture": "fpv_swizzled_reads.air.ll",
"entry": "fpv_swz_sample",
"source_sha256": "18992f6252c2fcdc827256266349a4efc8b5d5428dbb37a6f22218db7a9c8a54"
}
],
"answers": [
{
"key": {
"chip": "apple-m3-max",
"os_version": "27.0.1",
"os_build": "26A434",
"metal_level": "27.0.1"
},
"provenance": "metal_run",
"device": "Apple M3 Max",
"runs": 3,
"outcomes": [
{
"runs": 3,
"transcript": {
"root": {
"name": "case",
"observed": {
"value": "absent"
},
"children": [
{
"name": "inputs",
"observed": {
"value": "absent"
},
"children": [
{
"name": "air",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "b91fae6759b1cb6496c80a57c5628aef675497891efefe9f6cdd5a8a38a6703e"
}
}
},
{
"name": "air-typed",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "18992f6252c2fcdc827256266349a4efc8b5d5428dbb37a6f22218db7a9c8a54"
}
}
},
{
"name": "entry",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "5fdee9d06c2b3202fa13b90735e2cc6d2c6add2fc764d1b8f257eca5025e3d26"
}
}
},
{
"name": "format",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "946e5fffd5aeab455618b623ec6cbc5ec6f26e67320db4f4ea7f2c62bef85bcc"
}
}
},
{
"name": "texture:bytes",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "97d94990adf22069b968c7e737659f3deec9487277219fd99998f04df0bbcce5"
}
}
},
{
"name": "positions",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "8a907c4a84a8e3b7e86797979bacc6573d250baee78fd718ed3975bd8d4ad1de"
}
}
},
{
"name": "buffer:blank",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "087d80f7f182dd44f184aa86ca34488853ebcc04f0c60d5294919a466b463831"
}
}
},
{
"name": "sampler",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "c7af40fff57e04ab850c5f1f77e7233bfc1d5038e05b4178c5c31ebe61f0000c"
}
}
}
]
},
{
"name": "library",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "pipeline",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "texture",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "positions",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "output",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "sampler",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "dispatch",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "status",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "read-back",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "texels/bgrg422/linear-samples",
"observed": {
"value": {
"bytes": "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 truncated
},
"shape": {
"bytes": {
"region": {
"buffer": {
"offset": 0,
"length": 8832
}
},
"element": "f32",
"row_offset": 0,
"row_elements": 4,
"row_pitch": 16,
"rows": 552,
"image_pitch": 8832,
"images": 1,
"gaps": "ignored"
}
},
"digest": {
"kind": "sha256",
"hex": "4344444504a5cb6d726c882f8c770907cd0bec0f4be52f9dbd8c526407226d38"
}
}
},
{
"name": "notices",
"observed": {
"value": "absent"
},
"children": [
{
"name": "set",
"observed": {
"value": {
"nothing": "announced_nothing"
}
}
},
{
"name": "counts",
"observed": {
"value": {
"fields": {}
}
}
}
]
}
]
}
}
}
],
"validated": "ran"
}
],
"times": [
{
"venue": "native Metal",
"chip": "apple-m3-max",
"os_build": "26A434",
"rounds": 8,
"measured": "8 round(s) of the whole selection, in the case set's own order; a figure is the median of the rounds' own medians; Metal's leg ran at a one-minute load average of 4.11",
"instrument": 400,
"times": {
"case": "chroma-pair-texel-linear-samples-bgrg422",
"calls": 9,
"in_calls": 30467583,
"on_cpu": 1146917,
"blocked": 29290749,
"elsewhere": 3237458,
"spend": 33839041,
"spend_least": 32921541,
"spend_most": 35884499,
"per_call": [
{
"call": "buffer",
"least_calls": 2,
"most_calls": 2,
"wall": 7291,
"on_cpu": 7458,
"blocked": 0,
"wall_least": 7125,
"wall_most": 10875,
"wall_total": 20792,
"on_cpu_total": 21792,
"blocked_total": 0
},
{
"call": "compute_pipeline",
"least_calls": 1,
"most_calls": 1,
"wall": 108292,
"on_cpu": 108667,
"blocked": 0,
"wall_least": 103000,
"wall_most": 136458,
"wall_total": 108292,
"on_cpu_total": 108667,
"blocked_total": 0
},
{
"call": "dispatch_threads",
"least_calls": 1,
"most_calls": 1,
"wall": 160833,
"on_cpu": 161042,
"blocked": 0,
"wall_least": 154667,
"wall_most": 187667,
"wall_total": 160833,
"on_cpu_total": 161042,
"blocked_total": 0
},
{
"call": "library",
"least_calls": 1,
"most_calls": 1,
"wall": 26181292,
"on_cpu": 737334,
"blocked": 25432292,
"wall_least": 25689541,
"wall_most": 28161792,
"wall_total": 26181292,
"on_cpu_total": 737334,
"blocked_total": 25432292
},
{
"call": "read_buffer",
"least_calls": 1,
"most_calls": 1,
"wall": 6666,
"on_cpu": 6916,
"blocked": 0,
"wall_least": 6167,
"wall_most": 7916,
"wall_total": 6666,
"on_cpu_total": 6916,
"blocked_total": 0
},
{
"call": "sampler",
"least_calls": 1,
"most_calls": 1,
"wall": 40667,
"on_cpu": 40791,
"blocked": 0,
"wall_least": 39084,
"wall_most": 47084,
"wall_total": 40667,
"on_cpu_total": 40791,
"blocked_total": 0
},
{
"call": "texture_2d_in_role",
"least_calls": 1,
"most_calls": 1,
"wall": 58166,
"on_cpu": 58417,
"blocked": 0,
"wall_least": 56792,
"wall_most": 69708,
"wall_total": 58166,
"on_cpu_total": 58417,
"blocked_total": 0
},
{
"call": "wait",
"least_calls": 1,
"most_calls": 1,
"wall": 3752500,
"on_cpu": 17541,
"blocked": 3737083,
"wall_least": 3688667,
"wall_most": 3937458,
"wall_total": 3752500,
"on_cpu_total": 17541,
"blocked_total": 3737083
}
]
}
}
]
}
@@ -0,0 +1,414 @@
{
"format": 1,
"case": "chroma-pair-texel-linear-samples-gbgr422",
"suite_version": 1,
"shaders": [
{
"fixture": "fpv_swizzled_reads.ll",
"entry": "fpv_swz_sample",
"source_sha256": "b91fae6759b1cb6496c80a57c5628aef675497891efefe9f6cdd5a8a38a6703e"
},
{
"fixture": "fpv_swizzled_reads.air.ll",
"entry": "fpv_swz_sample",
"source_sha256": "18992f6252c2fcdc827256266349a4efc8b5d5428dbb37a6f22218db7a9c8a54"
}
],
"answers": [
{
"key": {
"chip": "apple-m3-max",
"os_version": "27.0.1",
"os_build": "26A434",
"metal_level": "27.0.1"
},
"provenance": "metal_run",
"device": "Apple M3 Max",
"runs": 3,
"outcomes": [
{
"runs": 3,
"transcript": {
"root": {
"name": "case",
"observed": {
"value": "absent"
},
"children": [
{
"name": "inputs",
"observed": {
"value": "absent"
},
"children": [
{
"name": "air",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "b91fae6759b1cb6496c80a57c5628aef675497891efefe9f6cdd5a8a38a6703e"
}
}
},
{
"name": "air-typed",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "18992f6252c2fcdc827256266349a4efc8b5d5428dbb37a6f22218db7a9c8a54"
}
}
},
{
"name": "entry",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "5fdee9d06c2b3202fa13b90735e2cc6d2c6add2fc764d1b8f257eca5025e3d26"
}
}
},
{
"name": "format",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "e6bfd42cb3ef4c11ccd2eb76227f9fa93916250b47c03f644c3171b9be8d9c02"
}
}
},
{
"name": "texture:bytes",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "97d94990adf22069b968c7e737659f3deec9487277219fd99998f04df0bbcce5"
}
}
},
{
"name": "positions",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "8a907c4a84a8e3b7e86797979bacc6573d250baee78fd718ed3975bd8d4ad1de"
}
}
},
{
"name": "buffer:blank",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "087d80f7f182dd44f184aa86ca34488853ebcc04f0c60d5294919a466b463831"
}
}
},
{
"name": "sampler",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "c7af40fff57e04ab850c5f1f77e7233bfc1d5038e05b4178c5c31ebe61f0000c"
}
}
}
]
},
{
"name": "library",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "pipeline",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "texture",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "positions",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "output",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "sampler",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "dispatch",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "status",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "read-back",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "texels/gbgr422/linear-samples",
"observed": {
"value": {
"bytes": "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 truncated
},
"shape": {
"bytes": {
"region": {
"buffer": {
"offset": 0,
"length": 8832
}
},
"element": "f32",
"row_offset": 0,
"row_elements": 4,
"row_pitch": 16,
"rows": 552,
"image_pitch": 8832,
"images": 1,
"gaps": "ignored"
}
},
"digest": {
"kind": "sha256",
"hex": "40f4e78dff7b2fdfe314c960cf7522a1d057d224d2dcd8fe492bb6ed18d1a7d9"
}
}
},
{
"name": "notices",
"observed": {
"value": "absent"
},
"children": [
{
"name": "set",
"observed": {
"value": {
"nothing": "announced_nothing"
}
}
},
{
"name": "counts",
"observed": {
"value": {
"fields": {}
}
}
}
]
}
]
}
}
}
],
"validated": "ran"
}
],
"times": [
{
"venue": "native Metal",
"chip": "apple-m3-max",
"os_build": "26A434",
"rounds": 8,
"measured": "8 round(s) of the whole selection, in the case set's own order; a figure is the median of the rounds' own medians; Metal's leg ran at a one-minute load average of 4.11",
"instrument": 400,
"times": {
"case": "chroma-pair-texel-linear-samples-gbgr422",
"calls": 9,
"in_calls": 30671833,
"on_cpu": 1152417,
"blocked": 29475791,
"elsewhere": 3257666,
"spend": 33955499,
"spend_least": 33421792,
"spend_most": 36077874,
"per_call": [
{
"call": "buffer",
"least_calls": 2,
"most_calls": 2,
"wall": 7208,
"on_cpu": 7375,
"blocked": 0,
"wall_least": 6959,
"wall_most": 8834,
"wall_total": 21792,
"on_cpu_total": 22124,
"blocked_total": 0
},
{
"call": "compute_pipeline",
"least_calls": 1,
"most_calls": 1,
"wall": 110250,
"on_cpu": 110542,
"blocked": 0,
"wall_least": 102166,
"wall_most": 123542,
"wall_total": 110250,
"on_cpu_total": 110542,
"blocked_total": 0
},
{
"call": "dispatch_threads",
"least_calls": 1,
"most_calls": 1,
"wall": 164250,
"on_cpu": 164500,
"blocked": 0,
"wall_least": 151708,
"wall_most": 178709,
"wall_total": 164250,
"on_cpu_total": 164500,
"blocked_total": 0
},
{
"call": "library",
"least_calls": 1,
"most_calls": 1,
"wall": 26405875,
"on_cpu": 724833,
"blocked": 25675625,
"wall_least": 25938125,
"wall_most": 28792750,
"wall_total": 26405875,
"on_cpu_total": 724833,
"blocked_total": 25675625
},
{
"call": "read_buffer",
"least_calls": 1,
"most_calls": 1,
"wall": 6542,
"on_cpu": 7042,
"blocked": 0,
"wall_least": 6125,
"wall_most": 9750,
"wall_total": 6542,
"on_cpu_total": 7042,
"blocked_total": 0
},
{
"call": "sampler",
"least_calls": 1,
"most_calls": 1,
"wall": 40625,
"on_cpu": 40833,
"blocked": 0,
"wall_least": 40542,
"wall_most": 45000,
"wall_total": 40625,
"on_cpu_total": 40833,
"blocked_total": 0
},
{
"call": "texture_2d_in_role",
"least_calls": 1,
"most_calls": 1,
"wall": 62041,
"on_cpu": 62334,
"blocked": 0,
"wall_least": 60084,
"wall_most": 70750,
"wall_total": 62041,
"on_cpu_total": 62334,
"blocked_total": 0
},
{
"call": "wait",
"least_calls": 1,
"most_calls": 1,
"wall": 3800083,
"on_cpu": 20375,
"blocked": 3781666,
"wall_least": 3704833,
"wall_most": 3913958,
"wall_total": 3800083,
"on_cpu_total": 20375,
"blocked_total": 3781666
}
]
}
}
]
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,351 @@
{
"format": 1,
"case": "sparse-read-through",
"suite_version": 1,
"shaders": [
{
"fixture": "a2_sparse_read_through.ll",
"entry": "a2_sparse_read_through",
"source_sha256": "503a066d24018e70b436c4d4cfb8ba2c838fed21a8a76cb9ff5a735d3d248e76"
},
{
"fixture": "a2_sparse_read_through.air.ll",
"entry": "a2_sparse_read_through",
"source_sha256": "bacef4a468f9e6b728aaddce7dec795e5f0c56144fb20f9e4c3b73a3640e3fcd"
}
],
"answers": [
{
"key": {
"chip": "apple-m3-max",
"os_version": "27.0.1",
"os_build": "26A434",
"metal_level": "27.0.1"
},
"provenance": "metal_run",
"device": "Apple M3 Max",
"runs": 3,
"outcomes": [
{
"runs": 3,
"transcript": {
"root": {
"name": "case",
"observed": {
"value": "absent"
},
"children": [
{
"name": "inputs",
"observed": {
"value": "absent"
},
"children": [
{
"name": "air",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "503a066d24018e70b436c4d4cfb8ba2c838fed21a8a76cb9ff5a735d3d248e76"
}
}
},
{
"name": "air-typed",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "bacef4a468f9e6b728aaddce7dec795e5f0c56144fb20f9e4c3b73a3640e3fcd"
}
}
},
{
"name": "texture",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "d32fb7e3ab4f2c02a7b991d65c1ec4b2139495f2e2641fd16c04160d1a55845f"
}
}
},
{
"name": "positions",
"observed": {
"value": "absent",
"digest": {
"kind": "sha256",
"hex": "29b926e7376d8f1a4480c442cd37e9d4eddd80ce96d95df2dc41f536d59c8592"
}
}
}
]
},
{
"name": "library",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "pipeline",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "texture",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "buffer/positions",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "buffer/out",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "dispatch",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "status",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": {
"variant": {
"name": "Completed",
"payload": "absent"
}
}
}
}
}
},
{
"name": "read-back",
"observed": {
"value": {
"variant": {
"name": "Ok",
"payload": "absent"
}
}
}
},
{
"name": "stored",
"observed": {
"value": {
"bytes": "AACgPwAAIEAAABA/AACAPwAAoD8AACBAAAAQPwAAgD8AAKA/AAAgQAAAED8AAIA/AACgPwAAIEAAABA/AACAPwEAAAABAAAAAQAAAAEAAAAAAFBAAABgQAAAcD8AAIA/AABQQAAAYEAAAHA/AACAPwAAUEAAAGBAAABwPwAAgD8AAFBAAABgQAAAcD8AAIA/AQAAAAEAAAABAAAAAQAAAAAAUEAAAMA/AADgPgAAgD8AAAAAAAAAAAAAAAAAAAAAAACAPwAAgD8AAIA/AACAPwAAUEAAAMA/AADgPgAAgD8BAAAAAQAAAAEAAAABAAAAAACAPgAAIEAAAAA/AACAPwAAAAAAAAAAAAAAAAAAAAAAAIA/AACAPwAAgD8AAIA/AACAPgAAIEAAAAA/AACAPwEAAAABAAAAAQAAAAEAAAAAABBAAAAAPwAAAD4AAIA/AAAAAAAAAAAAAAAAAAAAAAAAgD8AAIA/AACAPwAAgD8AABBAAAAAPwAAAD4AAIA/AQAAAAEAAAABAAAAAQAAAAAAUEAAAGBAAABwPwAAgD8AAAAAAAAAAAAAAAAAAAAAAACAPwAAgD8AAIA/AACAPwAAUEAAAGBAAABwPwAAgD8BAAAAAQAAAAEAAAABAAAAAACAPgAAAD8AAAAAAACAPwAAAAAAAAAAAAAAAAAAAAAAAIA/AACAPwAAgD8AAIA/AACAPgAAAD8AAAAAAACAPwEAAAABAAAAAQAAAAEAAAAAAKA/AADAPwAAoD4AAIA/AACgPwAAwD8AAKA+AACAPwAAoD8AAMA/AACgPgAAgD8AAKA/AADAPwAAoD4AAIA/AQAAAAEAAAABAAAAAQAAAAAAUEAAAAA/AABAPgAAgD8AAFBAAAAAPwAAQD4AAIA/AABQQAAAAD8AAEA+AACAPwAAUEAAAAA/AABAPgAAgD8BAAAAAQAAAAEAAAABAAAAAABQQAAAYEAAAHA/AACAPwAAAAAAAAAAAAAAAAAAAAAAAIA/AACAPwAAgD8AAIA/AABQQAAAYEAAAHA/AACAPwEAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAEAAAABAAAA"
},
"shape": {
"bytes": {
"region": {
"buffer": {
"offset": 0,
"length": 960
}
},
"element": "u32",
"row_offset": 0,
"row_elements": 20,
"row_pitch": 80,
"rows": 12,
"image_pitch": 960,
"images": 1,
"gaps": "ignored"
}
}
}
},
{
"name": "notices",
"observed": {
"value": "absent"
},
"children": [
{
"name": "set",
"observed": {
"value": {
"nothing": "announced_nothing"
}
}
},
{
"name": "counts",
"observed": {
"value": {
"fields": {}
}
}
}
]
}
]
}
}
}
],
"validated": "ran"
}
],
"times": [
{
"venue": "native Metal",
"chip": "apple-m3-max",
"os_build": "26A434",
"rounds": 8,
"measured": "8 round(s) of the whole selection, in the case set's own order; a figure is the median of the rounds' own medians; Metal's leg ran at a one-minute load average of 12.22",
"instrument": 293,
"times": {
"case": "sparse-read-through",
"calls": 8,
"in_calls": 34154083,
"on_cpu": 1241126,
"blocked": 32942792,
"elsewhere": 4091834,
"spend": 38263001,
"spend_least": 35415335,
"spend_most": 44320168,
"per_call": [
{
"call": "buffer",
"least_calls": 2,
"most_calls": 2,
"wall": 6917,
"on_cpu": 7083,
"blocked": 0,
"wall_least": 6417,
"wall_most": 10875,
"wall_total": 21875,
"on_cpu_total": 22292,
"blocked_total": 0
},
{
"call": "compute_pipeline",
"least_calls": 1,
"most_calls": 1,
"wall": 133000,
"on_cpu": 133416,
"blocked": 0,
"wall_least": 126833,
"wall_most": 157375,
"wall_total": 133000,
"on_cpu_total": 133416,
"blocked_total": 0
},
{
"call": "dispatch_threads",
"least_calls": 1,
"most_calls": 1,
"wall": 172625,
"on_cpu": 172833,
"blocked": 0,
"wall_least": 168125,
"wall_most": 236042,
"wall_total": 172625,
"on_cpu_total": 172833,
"blocked_total": 0
},
{
"call": "library",
"least_calls": 1,
"most_calls": 1,
"wall": 29058875,
"on_cpu": 769375,
"blocked": 28289500,
"wall_least": 26297250,
"wall_most": 34836958,
"wall_total": 29058875,
"on_cpu_total": 769375,
"blocked_total": 28289500
},
{
"call": "read_buffer",
"least_calls": 1,
"most_calls": 1,
"wall": 9167,
"on_cpu": 9417,
"blocked": 0,
"wall_least": 7000,
"wall_most": 10125,
"wall_total": 9167,
"on_cpu_total": 9417,
"blocked_total": 0
},
{
"call": "texture",
"least_calls": 1,
"most_calls": 1,
"wall": 94334,
"on_cpu": 94667,
"blocked": 0,
"wall_least": 86917,
"wall_most": 103959,
"wall_total": 94334,
"on_cpu_total": 94667,
"blocked_total": 0
},
{
"call": "wait",
"least_calls": 1,
"most_calls": 1,
"wall": 4590125,
"on_cpu": 26417,
"blocked": 4569041,
"wall_least": 4537667,
"wall_most": 4738792,
"wall_total": 4590125,
"on_cpu_total": 26417,
"blocked_total": 4569041
}
]
}
}
]
}
@@ -132,6 +132,7 @@ pub mod mesh_pipeline_reflection;
pub mod nan_integer_conversions;
pub mod nearest_positions;
pub mod norm_storage_writes;
pub mod one_level_filters;
pub mod padded_blends;
pub mod padded_fetch;
pub mod pass_attachment_pairs;
@@ -186,6 +187,7 @@ pub mod simdgroup_lockstep;
pub mod snorm_tile_store;
pub mod sparse_heaps;
pub mod sparse_mappings;
pub mod sparse_read_through;
pub mod sparse_status;
pub mod sparse_tiles;
pub mod srgb_fetch;
@@ -627,6 +629,7 @@ pub fn all() -> Vec<Box<dyn Case>> {
cases.push(Box::new(srgb_storage_writes::SrgbStorageWrites));
cases.push(Box::new(block_writes_only::BlockWritesOnlyWrites));
cases.push(Box::new(sparse_status::SparseStatusPlain));
cases.push(Box::new(sparse_read_through::SparseReadThrough));
cases.push(Box::new(
srgb_storage_fragment_writes::SrgbStorageFragmentWrites,
));
@@ -642,6 +645,7 @@ pub fn all() -> Vec<Box<dyn Case>> {
}
cases.extend(sampler_bind_clamps::all());
cases.extend(sampler_crossings::boxed());
cases.extend(one_level_filters::all());
cases.extend(render_chains::boxed());
cases.extend(compute_render_chains::boxed());
cases.extend(draw_state_changes::boxed());
@@ -1,5 +1,5 @@
//! Metal's 4:2:2 chroma-pair textures (`GBGR422`, `BGRG422`): what a copy moves, and what a
//! kernel's `read()` and nearest sample of one answer.
//! kernel's `read()`, nearest and linear sample and gather of one answer.
//!
//! Both of these formats are **public** Metal pixel formats, and every call the cases make of them
//! — `newTextureWithDescriptor:`, `replaceRegion:`, `getBytes:`, the four blit copies and a
@@ -15,9 +15,13 @@
//!
//! That probe covered 64 texels and is not re-runnable. These cases take Metal's answer over 256
//! texels of a fixed pattern and commit it, so a new macOS is one `conformance record` from saying
//! whether Apple changed it.
//! whether Apple changed it. A second probe (an Apple M3 Max under macOS 27.0.1) took the model's
//! rule over 64 texels of hashed bytes: a texel's green is its own luma, and its red and blue are
//! `(3c + n + 2) >> 2` of its pair's chroma `c` and the chroma `n` of the pair on its side (left
//! for an even texel, right for an odd one, the pair itself at the texture's edges); a linear
//! sample filters those texels.
//!
//! # The three families
//! # The families
//!
//! [`ChromaCopies`] is a copy sweep as one declarative program ([`crate::work`]): a whole blit
//! in and out, the host's whole `replaceRegion:`/`getBytes:`, seven blits in of regions whose x
@@ -38,6 +42,15 @@
//! recording answers rather than assumes. Comparison is exact and each case's allowances are on the
//! notices site alone. Every texel compares bit for bit.
//!
//! [`ChromaTexels`] also takes two accesses over a texture of `hashed` bytes, whose neighbouring
//! pairs' chroma differ by amounts that are not multiples of 4, so a decode's rounding shows (the
//! pattern above steps every byte by 1, so `3c + n` is a multiple of 4 at every texel): `sample()`
//! through a linear clamp-to-edge sampler at `linear_positions` (a quarter of the way between
//! each texel and its right neighbour, the corner of each 2 by 2 footprint, the texel centres of
//! two rows, and the edges and past them), and `gather()` of each component through the nearest
//! sampler at the corner of each 2 by 2 footprint. Clamp to edge is the one address mode Metal's
//! header grants these formats ("When sampling, ClampToEdge is the only usable wrap mode").
//!
//! # Why nothing here can fault a GPU
//!
//! Every program is a handful of 16 x 16 textures, blits of regions inside them, and one compute
@@ -47,10 +60,12 @@
//! process. So is a render target of these formats, whose pipeline Metal's validation aborts plain
//! too.
use crate::allowance::Allowance;
use crate::case::{
made, Abort, Bindings, Case, Failure, Input, MetalSource, SamplerSpec, Side, TextureRole,
TextureSpec,
};
use crate::degradation::Degradation;
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
use crate::recording::ShaderRef;
use crate::transcript::{ByteLayout, Digest, Element, Gaps, Node, Observed, Region, Sites, Value};
@@ -103,6 +118,14 @@ const FORMATS: [(PixelFormat, &str); 2] = [
/// The case names, written out so each is a `&'static str` the report and `conformance replay`
/// can name.
const LINEAR_NAMES: [&str; 2] = [
"chroma-pair-texel-linear-samples-gbgr422",
"chroma-pair-texel-linear-samples-bgrg422",
];
const GATHER_NAMES: [&str; 2] = [
"chroma-pair-texel-gathers-gbgr422",
"chroma-pair-texel-gathers-bgrg422",
];
const COPY_NAMES: [&str; 2] = ["chroma-pair-copies-gbgr422", "chroma-pair-copies-bgrg422"];
const READ_NAMES: [&str; 2] = [
"chroma-pair-texel-reads-gbgr422",
@@ -113,8 +136,8 @@ const SAMPLE_NAMES: [&str; 2] = [
"chroma-pair-texel-samples-bgrg422",
];
/// Every case of the family: the copy sweep, the texel reads and the texel samples, of each
/// format.
/// Every case of the family: the copy sweep, the texel reads, the nearest and linear texel
/// samples and the gathers, of each format.
pub fn all() -> Vec<Box<dyn Case>> {
let mut cases: Vec<Box<dyn Case>> = Vec::new();
for (at, (format, word)) in FORMATS.into_iter().enumerate() {
@@ -128,6 +151,8 @@ pub fn all() -> Vec<Box<dyn Case>> {
for (name, access) in [
(READ_NAMES[at], Access::Read),
(SAMPLE_NAMES[at], Access::NearestSample),
(LINEAR_NAMES[at], Access::LinearSample),
(GATHER_NAMES[at], Access::Gather),
] {
cases.push(Box::new(ChromaTexels {
name,
@@ -155,14 +180,96 @@ enum Access {
/// `t.sample(s, uv)` at every texel's centre, through a nearest clamp-to-edge sampler of
/// normalized coordinates.
NearestSample,
/// `t.sample(s, uv)` at `linear_positions`, through a linear clamp-to-edge sampler of
/// normalized coordinates, over a texture of `hashed` bytes.
LinearSample,
/// `t.gather(s, uv, int2(0), c)` of each component `c` at `gather_positions`, through a
/// nearest clamp-to-edge sampler, over a texture of `hashed` bytes.
Gather,
}
/// The gather kernels, one a component, and the word each one's site carries.
const GATHER_ENTRIES: [(&str, &str); 4] = [
("fpv_swz_gather_x", "x"),
("fpv_swz_gather_y", "y"),
("fpv_swz_gather_z", "z"),
("fpv_swz_gather_w", "w"),
];
/// The 512 bytes a texture of the linear and gather accesses holds: byte `k` a hash of `k`, so
/// neighbouring pairs' chroma differ by amounts that are not all multiples of 4 and the decode's
/// rounding, `(3c + n + 2) >> 2`, shows.
fn hashed() -> Vec<u8> {
(0..WHOLE as u32)
.map(|k| {
let mut h = k.wrapping_mul(2_654_435_761).wrapping_add(0x9e37_79b9);
h ^= h >> 15;
h = h.wrapping_mul(0x85eb_ca6b);
h ^= h >> 13;
h as u8
})
.collect()
}
/// A normalized coordinate on one axis of a [`SIDE`]-wide texture, `at` texels in.
fn normalized(at: f32) -> f32 {
at / SIDE as f32
}
/// The linear sample's positions, rows outer: in every row's centre, a quarter of the way past
/// each texel's centre toward its right neighbour (the texel weighted 3 to 1); the corner of each
/// 2 by 2 footprint, where the four texels weigh alike; the centres of rows 0 and 7, where the
/// sample is the texel itself; and in rows 0 and 15, `u` at 0, at 1 and a quarter of the texture
/// past each edge, which clamp to the edge texels.
fn linear_positions() -> Vec<[f32; 2]> {
let mut points = Vec::new();
for y in 0..SIDE as u32 {
for x in 0..SIDE as u32 {
points.push([normalized(x as f32 + 0.75), normalized(y as f32 + 0.5)]);
}
}
for y in 0..SIDE as u32 {
for x in 0..SIDE as u32 {
points.push([normalized(x as f32 + 1.0), normalized(y as f32 + 1.0)]);
}
}
for y in [0u32, 7] {
for x in 0..SIDE as u32 {
points.push([normalized(x as f32 + 0.5), normalized(y as f32 + 0.5)]);
}
}
for y in [0u32, 15] {
for u in [0.0, 1.0, -0.25, 1.25] {
points.push([u, normalized(y as f32 + 0.5)]);
}
}
points
}
/// The gather's positions, rows outer: the corner of each 2 by 2 footprint, `(x + 1, y + 1)`
/// texels in, whose four texels are `(x, y)` to `(x + 1, y + 1)`, clamped to the edge in the last
/// row and column.
fn gather_positions() -> Vec<[f32; 2]> {
let mut points = Vec::new();
for y in 0..SIDE as u32 {
for x in 0..SIDE as u32 {
points.push([normalized(x as f32 + 1.0), normalized(y as f32 + 1.0)]);
}
}
points
}
impl Access {
/// The fixture's entry point this access runs.
fn entry(self) -> &'static str {
/// The fixture's entry points this access runs, each with the word its site carries after
/// the access's own (none where the access runs one).
fn entries(self) -> Vec<(&'static str, Option<&'static str>)> {
match self {
Access::Read => READ_ENTRY,
Access::NearestSample => SAMPLE_ENTRY,
Access::Read => vec![(READ_ENTRY, None)],
Access::NearestSample | Access::LinearSample => vec![(SAMPLE_ENTRY, None)],
Access::Gather => GATHER_ENTRIES
.iter()
.map(|&(entry, word)| (entry, Some(word)))
.collect(),
}
}
@@ -171,12 +278,44 @@ impl Access {
match self {
Access::Read => "reads",
Access::NearestSample => "samples",
Access::LinearSample => "linear-samples",
Access::Gather => "gathers",
}
}
/// The positions the kernel reads: integer texel positions, or the texel centres as
/// normalized coordinates.
/// The bytes the texture holds: the step pattern for the read and the nearest sample, whose
/// recordings were taken over it, the hashed bytes for the linear sample and the gather.
fn texture_bytes(self) -> Vec<u8> {
match self {
Access::Read | Access::NearestSample => pattern(),
Access::LinearSample | Access::Gather => hashed(),
}
}
/// The positions the access reads, one a lane.
fn lanes(self) -> usize {
match self {
Access::Read | Access::NearestSample => TEXELS,
Access::LinearSample => linear_positions().len(),
Access::Gather => gather_positions().len(),
}
}
/// The positions the kernel reads: integer texel positions, the texel centres as normalized
/// coordinates, or the linear sample's or the gather's normalized positions.
fn positions(self) -> Vec<u8> {
let floats = |points: Vec<[f32; 2]>| {
points
.iter()
.flatten()
.flat_map(|axis| axis.to_le_bytes())
.collect()
};
match self {
Access::LinearSample => return floats(linear_positions()),
Access::Gather => return floats(gather_positions()),
Access::Read | Access::NearestSample => {}
}
let mut bytes = Vec::with_capacity(TEXELS * 8);
for y in 0..SIDE as u32 {
for x in 0..SIDE as u32 {
@@ -185,7 +324,7 @@ impl Access {
bytes.extend(x.to_le_bytes());
bytes.extend(y.to_le_bytes());
}
Access::NearestSample => {
_ => {
let centre = |index: u32| (index as f32 + 0.5) / SIDE as f32;
bytes.extend(centre(x).to_le_bytes());
bytes.extend(centre(y).to_le_bytes());
@@ -198,13 +337,12 @@ impl Access {
/// The sampler state the access binds, where it binds one.
fn sampler(self) -> Option<SamplerSpec> {
match self {
Access::Read => None,
Access::NearestSample => Some(
SamplerSpec::filtered(SamplerMinMagFilter::Nearest)
.addressed(SamplerAddressMode::ClampToEdge),
),
}
let filter = match self {
Access::Read => return None,
Access::NearestSample | Access::Gather => SamplerMinMagFilter::Nearest,
Access::LinearSample => SamplerMinMagFilter::Linear,
};
Some(SamplerSpec::filtered(filter).addressed(SamplerAddressMode::ClampToEdge))
}
}
@@ -562,6 +700,16 @@ impl Case for ChromaCopies {
MetalSource::Run
}
fn allowances(&self) -> Vec<Allowance> {
// Metal announces nothing. The runtime's 4:2:2 texture states the static note of its
// linear and bicubic samples, `bicubic-filter-arithmetic` (`Texture::precision_note`),
// which the rt side announces for every texture it makes. A declaration at the notices
// site alone: every byte still compares exactly.
vec![crate::replay::notice_allowance(
Degradation::BicubicFilterArithmetic.code(),
)]
}
fn inputs(&self) -> Result<Vec<Input>, String> {
// The tables and the bytes they move, named one by one, so a diff of a failed input
// fingerprint says which of them changed rather than "the program".
@@ -647,32 +795,43 @@ pub struct ChromaTexels {
/// The texels a [`SIDE`]-square texture holds.
const TEXELS: usize = (SIDE * SIDE) as usize;
/// The layout a read's `float4`s are compared under: one row a texel of four lanes, so a diff
/// names the texel and the channel.
fn texel_layout() -> ByteLayout {
/// The layout `lanes` `float4`s are compared under: one row a lane of four channels, so a diff
/// names the position and the channel.
fn texel_layout(lanes: usize) -> ByteLayout {
ByteLayout {
region: Region::Buffer {
offset: 0,
length: (TEXELS * 16) as u64,
length: (lanes * 16) as u64,
},
element: Element::F32,
row_offset: 0,
row_elements: 4,
row_pitch: 16,
rows: TEXELS as u32,
image_pitch: (TEXELS * 16) as u32,
rows: lanes as u32,
image_pitch: (lanes * 16) as u32,
images: 1,
// A texel's four lanes fill its row, so there is nothing between them.
gaps: Gaps::Ignored,
}
}
/// The entries `access` runs, one a line, as the case's `entry` input: the read's and the nearest
/// sample's input keeps its one entry's name alone, as their recordings were taken under.
fn entry_names(access: Access) -> String {
access
.entries()
.iter()
.map(|&(entry, _)| entry)
.collect::<Vec<_>>()
.join("\n")
}
impl ChromaTexels {
/// The fixture this case runs.
/// The fixture this case runs, at its first entry: every entry lives in the one fixture.
fn fixture(&self) -> Fixture {
Fixture {
name: READ_FIXTURE,
entry: self.access.entry(),
entry: self.access.entries()[0].0,
}
}
}
@@ -686,15 +845,34 @@ impl Case for ChromaTexels {
MetalSource::Run
}
fn allowances(&self) -> Vec<Allowance> {
// Metal announces nothing. The runtime's 4:2:2 texture states the static note of its
// linear and bicubic samples, `bicubic-filter-arithmetic` (`Texture::precision_note`),
// which the rt side announces for every texture it makes; and a sample or gather through
// the fixture's runtime sampler slot announces `pixel-sampler-scaling` whatever the
// filter (`crate::replay::pixel_sampler_scaling_notice` holds why), measured through the
// rt side on lavapipe (Mesa 26.2.4) for every sampling access. Each is a declaration at
// the notices site alone: every texel still compares bit for bit.
let mut allowances = vec![crate::replay::notice_allowance(
Degradation::BicubicFilterArithmetic.code(),
)];
if self.access.sampler().is_some() {
allowances.push(crate::replay::pixel_sampler_scaling_notice());
}
allowances
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
let fixture = self.fixture();
let mut shaders = Vec::new();
for extension in [RUNTIME_TEXT, METAL_TEXT] {
shaders.push(ShaderRef {
fixture: format!("{READ_FIXTURE}{extension}"),
entry: self.access.entry().to_owned(),
source_sha256: crate::sha256_hex(fixture.text(extension)?.as_bytes()),
});
for (entry, _) in self.access.entries() {
for extension in [RUNTIME_TEXT, METAL_TEXT] {
shaders.push(ShaderRef {
fixture: format!("{READ_FIXTURE}{extension}"),
entry: entry.to_owned(),
source_sha256: crate::sha256_hex(fixture.text(extension)?.as_bytes()),
});
}
}
Ok(shaders)
}
@@ -710,9 +888,9 @@ impl Case for ChromaTexels {
name: "air-typed".to_owned(),
digest: Digest::sha256(fixture.text(METAL_TEXT)?.as_bytes()),
},
Input::bytes("entry", fixture.entry.as_bytes()),
Input::bytes("entry", entry_names(self.access).as_bytes()),
Input::bytes("format", &self.format.as_raw().to_le_bytes()),
Input::bytes("texture:bytes", &pattern()),
Input::bytes("texture:bytes", &self.access.texture_bytes()),
Input::bytes("positions", &self.access.positions()),
Input::bytes("buffer:blank", &[BLANK]),
];
@@ -729,11 +907,18 @@ impl Case for ChromaTexels {
failure: Failure::named("FixtureNotRead", why),
})?;
let library = made(sites, "library", side.library(&source.source()))?;
let pipeline = made(
sites,
"pipeline",
side.compute_pipeline(library, self.access.entry()),
)?;
let entries = self.access.entries();
// An access of one entry makes its calls in the order its recording was taken in: the
// pipeline before the texture, the output before the sampler.
let single = entries.len() == 1;
let first = match single {
true => Some(made(
sites,
"pipeline",
side.compute_pipeline(library, entries[0].0),
)?),
false => None,
};
// The texture is made with its bytes, which is the whole of what the case feeds it: what
// a fresh texture reads is a separate question from what Metal's decode does with known
// codes, and this case asks the second.
@@ -750,50 +935,85 @@ impl Case for ChromaTexels {
// different question of Metal.
TextureRole::Read,
),
&pattern(),
&self.access.texture_bytes(),
),
)?;
let positions = made(sites, "positions", side.buffer(&self.access.positions()))?;
let output = made(sites, "output", side.buffer(&vec![BLANK; TEXELS * 16]))?;
let lanes = self.access.lanes();
let first_output = match single {
true => Some(made(
sites,
"output",
side.buffer(&vec![BLANK; lanes * 16]),
)?),
false => None,
};
let mut samplers = Vec::new();
if let Some(spec) = self.access.sampler() {
samplers.push(made(sites, "sampler", side.sampler(&spec))?);
}
let textures = [texture];
let buffers = [output, positions];
let command_buffer = made(
sites,
"dispatch",
side.dispatch_threads(
pipeline,
&Bindings::new(&textures, &buffers).sampled(&samplers),
&[],
[TEXELS as u32, 1, 1],
[GROUP, 1, 1],
),
)?;
let status = made(sites, "status", side.wait(command_buffer))?;
if status != Value::unit_variant("Completed") {
return Err(Abort {
at: "status".to_owned(),
failure: Failure::named("CommandBufferStatus", crate::diff::print(&status)),
});
}
let bytes = made(sites, "read-back", side.read_buffer(output, 0, TEXELS * 16))?;
if bytes.len() != TEXELS * 16 {
return Err(Abort {
at: "read-back".to_owned(),
failure: Failure::named(
"ShortReadBack",
format!("{} bytes of {}", bytes.len(), TEXELS * 16),
for (entry, component) in entries {
// A site of its own for each entry's calls where the access runs several.
let at = |name: &str| match component {
Some(word) => format!("{word}/{name}"),
None => name.to_owned(),
};
let pipeline = match first {
Some(pipeline) => pipeline,
None => made(
sites,
&at("pipeline"),
side.compute_pipeline(library, entry),
)?,
};
let output = match first_output {
Some(output) => output,
None => made(sites, &at("output"), side.buffer(&vec![BLANK; lanes * 16]))?,
};
let textures = [texture];
let buffers = [output, positions];
let command_buffer = made(
sites,
&at("dispatch"),
side.dispatch_threads(
pipeline,
&Bindings::new(&textures, &buffers).sampled(&samplers),
&[],
[lanes as u32, 1, 1],
[GROUP, 1, 1],
),
});
)?;
let status = made(sites, &at("status"), side.wait(command_buffer))?;
if status != Value::unit_variant("Completed") {
return Err(Abort {
at: at("status"),
failure: Failure::named("CommandBufferStatus", crate::diff::print(&status)),
});
}
let bytes = made(
sites,
&at("read-back"),
side.read_buffer(output, 0, lanes * 16),
)?;
if bytes.len() != lanes * 16 {
return Err(Abort {
at: at("read-back"),
failure: Failure::named(
"ShortReadBack",
format!("{} bytes of {}", bytes.len(), lanes * 16),
),
});
}
let digest = Digest::sha256(&bytes);
let leaf = match component {
Some(word) => format!("texels/{}/{}/{word}", self.word, self.access.word()),
None => format!("texels/{}/{}", self.word, self.access.word()),
};
sites.push(Node::leaf(
leaf,
Observed::bytes(bytes, texel_layout(lanes)).digested(digest),
));
}
let digest = Digest::sha256(&bytes);
sites.push(Node::leaf(
format!("texels/{}/{}", self.word, self.access.word()),
Observed::bytes(bytes, texel_layout()).digested(digest),
));
Ok(())
}
}
@@ -803,13 +1023,13 @@ mod tests {
use super::*;
use std::collections::BTreeSet;
/// Six cases, each of a different question, and each name says which format it is of.
/// Ten cases, each of a different question, and each name says which format it is of.
#[test]
fn the_cases_name_their_format() {
let cases = all();
assert_eq!(cases.len(), 6);
assert_eq!(cases.len(), 10);
let names: BTreeSet<&str> = cases.iter().map(|case| case.name()).collect();
assert_eq!(names.len(), 6);
assert_eq!(names.len(), 10);
for name in names {
assert!(
name.ends_with("gbgr422") || name.ends_with("bgrg422"),
@@ -931,11 +1151,56 @@ mod tests {
assert!(spec.normalized_coordinates);
}
/// The hashed texture makes the decode's rounding show: at some texel, for each chroma byte
/// of both formats, its pair's chroma `c` and the chroma `n` of the pair on its side give a
/// `3c + n` that is not a multiple of 4. The step pattern of the read and the nearest sample
/// gives none.
#[test]
fn the_hashed_texture_shows_the_decode_rounding() {
let row = ROW as usize;
let pairs = SIDE as usize / 2;
let off_quarter = |bytes: &[u8], chroma: usize| {
(0..SIDE as usize).any(|y| {
(0..SIDE as usize).any(|x| {
let pair = x / 2;
let side = match x % 2 {
0 => pair.saturating_sub(1),
_ => (pair + 1).min(pairs - 1),
};
let c = u32::from(bytes[y * row + pair * 4 + chroma]);
let n = u32::from(bytes[y * row + side * 4 + chroma]);
(3 * c + n) % 4 != 0
})
})
};
for chroma in [0, 1, 2, 3] {
assert!(off_quarter(&hashed(), chroma), "byte {chroma} of a pair");
assert!(!off_quarter(&pattern(), chroma), "byte {chroma} of a pair");
}
}
/// The linear sample and the gather read inside the texture and past its edges, and each
/// position is a normalized coordinate of the texture.
#[test]
fn the_linear_and_gather_positions_are_the_texture_s() {
assert_eq!(linear_positions().len(), 2 * TEXELS + 2 * SIDE as usize + 8);
assert_eq!(gather_positions().len(), TEXELS);
for [u, v] in linear_positions().into_iter().chain(gather_positions()) {
assert!((-0.25..=1.25).contains(&u), "{u}");
assert!((0.0..=1.0).contains(&v), "{v}");
}
assert_eq!(Access::Gather.entries().len(), 4);
let spec = Access::LinearSample.sampler().expect("a sampler state");
assert_eq!(spec.min_filter, SamplerMinMagFilter::Linear);
assert_eq!(spec.mag_filter, SamplerMinMagFilter::Linear);
assert_eq!(spec.s_address_mode, SamplerAddressMode::ClampToEdge);
}
/// The layout covers every texel and names the texel as its row, so a diff over 256 texels
/// says which one moved.
#[test]
fn the_texel_layout_names_the_texel() {
let layout = texel_layout();
let layout = texel_layout(TEXELS);
assert_eq!(layout.extent(), TEXELS * 16);
assert_eq!(layout.at(0, 255, 3), 255 * 16 + 12);
}
@@ -41,8 +41,9 @@ use crate::transcript::{Node, Observed, Sites, Value};
use metal2vulkan::metal::BlendFactor;
use super::extended_range_targets::{
fixture, fixture_inputs, half_bytes, not_read, program, read_layout, shader_refs, shape,
texel_layout, Format, FILLS, FILL_HALF, FORMATS, HEIGHT, PLANES, READ_FLOAT, VERTEX, WIDTH,
blend_notices, fixture, fixture_inputs, half_bytes, not_read, program, read_layout,
shader_refs, shape, texel_layout, Format, FILLS, FILL_HALF, FORMATS, HEIGHT, PLANES,
READ_FLOAT, VERTEX, WIDTH,
};
/// The kernel that writes a `float4` into a two-plane extended-range texture, which is how the
@@ -240,9 +241,12 @@ impl Case for ExtendedRangeBlend {
// device that blends as Metal does shows as announced with nothing differing -- which is
// what this M3 Max and lavapipe both show -- and one that does not shows the code. The
// allowance fails the case if the notice stops firing, so it cannot outlive its reason.
vec![crate::replay::notice_allowance(
let mut allowances = vec![crate::replay::notice_allowance(
Degradation::HalfOutputFastMathBlend.code(),
)]
)];
// A `BGR10_XR` or `BGRA10_XR` target's blend of its codes (`blend_notices`).
allowances.extend(blend_notices(self.format.format, Some(&self.blend)));
allowances
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -1,8 +1,8 @@
//! A wide-gamut client's render pipelines into `BGRA10_XR` and its `_sRGB` twin: what a draw
//! stores, compared code for code.
//!
//! A `CAMetalLayer` that asks for wide gamut hands its client `BGRA10_XR` drawables, and a client
//! such as Impeller then makes every pipeline over that format: four samples resolved into the
//! A `CAMetalLayer` that asks for wide gamut hands its client `BGRA10_XR` drawables, and a 2D
//! renderer then makes every pipeline over that format: four samples resolved into the
//! drawable, a stencil (or depth and stencil) attachment, and blending on by default. Three
//! families hold those shapes against Metal:
//!
@@ -50,8 +50,8 @@ use crate::values::StoreAction;
use metal2vulkan::metal::{BlendFactor as F, BlendOperation as O, ColorWriteMask, PixelFormat};
use super::extended_range_targets::{
fixture, fixture_inputs, half_bits, not_read, program, shader_refs, shape, texel_layout,
Format, FILLS, FILL_FLOAT, FILL_HALF, FORMATS, VERTEX,
blend_notices, fixture, fixture_inputs, half_bits, not_read, program, shader_refs, shape,
texel_layout, Format, FILLS, FILL_FLOAT, FILL_HALF, FORMATS, VERTEX,
};
/// The fixture's fill that writes depth alone (`[[depth(any)]]`), reading a `float` a sample.
@@ -312,9 +312,12 @@ impl Case for GamutDraw {
MetalSource::Run
}
/// The family's notices, and nothing else: every texel compares exactly.
/// The family's notices, and a `BGRA10_XR` target's blend of its codes (`blend_notices`):
/// every texel compares exactly.
fn allowances(&self) -> Vec<Allowance> {
notices()
let mut allowances = notices();
allowances.extend(blend_notices(self.format.format, Some(&self.blend)));
allowances
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -733,9 +736,12 @@ impl Case for MaskedDraw {
MetalSource::Run
}
/// The family's notices, and nothing else: every texel compares exactly.
/// The family's notices, and the second draw's blend of a `BGR10_XR` or `BGRA10_XR` target's
/// codes (`blend_notices`): every texel compares exactly.
fn allowances(&self) -> Vec<Allowance> {
notices()
let mut allowances = notices();
allowances.extend(blend_notices(self.format.format, self.blend.as_ref()));
allowances
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -2,7 +2,7 @@
//! its gradients into: what the pass stores, compared code for code.
//!
//! A `CAMetalLayer` that asks for wide gamut hands its client `BGRA10_XR` drawables, and a 2D
//! renderer such as Impeller fills its gradients there by draws that evaluate the gradient in the
//! renderer fills its gradients there by draws that evaluate the gradient in the
//! fragment function from a buffer of color stops, often at four samples resolved into the
//! drawable. Each case here is one pass over a 32 x 32 target cleared to an opaque color, with two
//! draws of the owned fixture `xr_gradients`:
@@ -34,7 +34,8 @@ use crate::values::StoreAction;
use metal2vulkan::metal::BlendFactor as F;
use super::extended_range_targets::{
fixture, fixture_inputs, not_read, program, shader_refs, texel_layout, Format, FORMATS,
blend_notices, fixture, fixture_inputs, not_read, program, shader_refs, texel_layout, Format,
FORMATS,
};
/// The fixture and its entry points.
@@ -245,9 +246,13 @@ impl Case for GradientDraw {
/// still compares exactly): `half-output-fast-math-blend` (the fixture is a fast-math module
/// whose `half4` gradient a pipeline blends).
fn allowances(&self) -> Vec<Allowance> {
vec![crate::replay::notice_allowance(
let mut allowances = vec![crate::replay::notice_allowance(
Degradation::HalfOutputFastMathBlend.code(),
)]
)];
// A `BGRA10_XR` target's blend of its codes (`blend_notices`).
let blend = self.blended.then_some(&OVER);
allowances.extend(blend_notices(self.format.format, blend));
allowances
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -39,8 +39,8 @@ use crate::degradation::Degradation;
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
use crate::recording::ShaderRef;
use crate::render::{
ColorState, Dispatch, PassColor, Plane, ReadAt, RenderPass, RenderPipelineSpec, RenderStep,
RenderWork, TargetSpec,
Blend, ColorState, Dispatch, PassColor, Plane, ReadAt, RenderPass, RenderPipelineSpec,
RenderStep, RenderWork, TargetSpec,
};
use crate::transcript::{
Aspect, ByteLayout, Digest, Element, Gaps, Node, Observed, Region, Sites, Value,
@@ -269,6 +269,37 @@ pub(super) fn half_bytes() -> Vec<u8> {
.collect()
}
/// The notices a pipeline announces that blends `blend` into an attachment of `format`, where the
/// attachment is `BGR10_XR` or `BGRA10_XR`, whose images blend their codes: `extended-range-blend`
/// where the blend stores more than its source as it is, and `extended-range-blend-window` beside
/// it where its corrected source term can leave the code range. This restates the translator's
/// classification from the blend's factors (`PrecisionNote::ExtendedRangeBlendWindow`) for the
/// blends this family draws: one and zero, added, stores its source; straight alpha-over holds the
/// window; an addition of one and one and premultiplied source-over do not. A blend the family does
/// not draw is a panic here, so a new one is classified before it is recorded. Every texel still
/// compares exactly: a difference is the gap the notes describe.
pub(super) fn blend_notices(format: PixelFormat, blend: Option<&Blend>) -> Vec<Allowance> {
use metal2vulkan::metal::BlendFactor as F;
let codes = matches!(format, PixelFormat::BGR10XR | PixelFormat::BGRA10XR);
let Some(blend) = blend.filter(|_| codes) else {
return Vec::new();
};
let window = match (blend.source_rgb, blend.destination_rgb) {
(F::One, F::Zero) => return Vec::new(),
(F::SourceAlpha, F::OneMinusSourceAlpha) => false,
(F::One, F::One) | (F::One, F::OneMinusSourceAlpha) => true,
other => panic!("a blend this family does not draw: {other:?}"),
};
let mut notes = vec![Degradation::ExtendedRangeBlend];
if window {
notes.push(Degradation::ExtendedRangeBlendWindow);
}
notes
.into_iter()
.map(|kind| crate::replay::notice_allowance(kind.code()))
.collect()
}
/// The buffer the fills read their extent from: the row's width and the samples of a pixel, as the
/// fixture's `Rt6Shape`.
pub(super) fn shape(width: u32, samples: u32) -> Vec<u8> {
@@ -0,0 +1,455 @@
//! Which of a sampler's two filters Metal applies to a texture of **one level**, at an explicit
//! level and at a kernel's bias.
//!
//! A sampler whose minifying and magnifying filters differ names its filter by the level: the
//! magnifying one at a level of 0 or below, the minifying one above it. On a texture of one level
//! the clamp into the texture's levels takes every level to 0, so whether Metal reads the level
//! before or after that clamp is the whole question: after it, every sample would magnify. A Metal
//! probe of a one-level `rgba8Unorm` texture through samplers without a mip filter (the Apple M3
//! Max on macOS 27.0.1) read the choice before the clamp, and `metal2vulkan`'s
//! `lower::sampler::level` states the rule so. This case puts the question to Metal under every mip
//! filter and through clamps that move the level across 0 from either side, and compares the
//! runtime's answer, the device's own sampler, with Metal's.
//!
//! **The texture** is 16 by 4 `R32Float` of one level, texel `(x, y)` holding `1 + x + 16 y`, so a
//! sample names the texel it read and how it read it. **The lanes** sample a quarter of a texel
//! past each texel's centre toward its right neighbour, in each row (60 positions, the probe's), at
//! each of the probe's nine levels: -2, -0.5, 0, 1/64, 1/4, 1/2, 1, 2 and 5. There a nearest filter
//! reads texel `(x, y)` and a linear one `3/4` of it and `1/4` of `(x + 1, y)`, its value plus
//! `1/4`, exact in `float` on every device; a level is a value a `half` holds, so Metal's rounding
//! of it moves nothing.
//!
//! **The rows** are every `MTLSamplerMipFilter`, crossed with the two `(min, mag)` pairs whose
//! filters differ, crossed with three clamps: Metal's defaults `[0, FLT_MAX]`, `lodMinClamp` 1
//! (which raises every level above 0) and `lodMaxClamp` 0 (which lowers every level to 0). The
//! two clamps tell the sampler's clamp apart from the texture's: a choice read after the
//! sampler's clamp minifies at every level of the first and magnifies at every level of the
//! second.
//!
//! **`sampler-one-level-filters-level`**: the owned fixture `unv_runtime_levels`' `unv_rpos2d`
//! samples at `(p.x, p.y)` at `level(p.z)` through the runtime sampler at `[[sampler(0)]]` and
//! writes the first channel. **`sampler-one-level-filters-bias`**: `mip_level_sampling`'s
//! `mip_bias_kernel` samples at `bias(p.z)`, a kernel's level `p.z`, and writes the `float4`.
//!
//! **What Metal answered** (the Apple M3 Max on macOS 27.0.1), alike in both
//! cases and under all three mip filters, every lane of a cell one filter (`mag` the magnifying
//! filter, `min` the minifying one):
//!
//! | clamp | -2 | -0.5 | 0 | 1/64 | 1/4 | 1/2 | 1 | 2 | 5 |
//! |---|---|---|---|---|---|---|---|---|---|
//! | `[0, FLT_MAX]` | mag | mag | mag | min | min | min | min | min | min |
//! | `lodMinClamp` 1 | min | min | min | min | min | min | min | min | min |
//! | `lodMaxClamp` 0 | mag | mag | mag | mag | mag | mag | mag | mag | mag |
//!
//! So Metal reads its choice after the sampler's clamp and before the clamp into the texture's
//! one level, the rule `tests` holds every recorded lane to. The device's own sampler takes
//! Vulkan's choice, which reads `λ` after the sampler's `[minLod, maxLod]` and before the view's
//! levels, so the runtime's answer is expected to be Metal's on every device.
//!
//! Nothing here can fault a GPU: one compute dispatch of 540 threads a row, one read-only 16 by 4
//! texture, no loop.
use crate::allowance::Allowance;
use crate::case::{
call, made, Abort, Bindings, Case, Failure, Input, MetalSource, SamplerSpec, Side,
};
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
use crate::recording::ShaderRef;
use crate::texture::{TextureRequest, Upload};
use crate::transcript::{ByteLayout, Digest, Element, Gaps, Node, Observed, Region, Sites, Value};
use metal2vulkan::metal::{PixelFormat, SamplerMinMagFilter, SamplerMipFilter};
/// The texture's width and height.
const WIDTH: u32 = 16;
const HEIGHT: u32 = 4;
/// The levels every position is sampled at: the probe's nine, each a value a `half` holds.
const LEVELS: [f32; 9] = [-2.0, -0.5, 0.0, 0.015_625, 0.25, 0.5, 1.0, 2.0, 5.0];
/// The byte every output buffer holds before a row runs.
const FILL: u8 = 0xab;
/// The threads a group: the 540 lanes are nine groups of 60, so the grid is whole groups on every
/// device.
const GROUP: u32 = 60;
/// Every `MTLSamplerMipFilter`.
const MIP_FILTERS: [(&str, SamplerMipFilter); 3] = [
("not-mipmapped", SamplerMipFilter::NotMipmapped),
("nearest", SamplerMipFilter::Nearest),
("linear", SamplerMipFilter::Linear),
];
/// The two `(min, mag)` pairs whose filters differ.
const FILTER_PAIRS: [(&str, SamplerMinMagFilter, SamplerMinMagFilter); 2] = [
(
"nearest-min-linear-mag",
SamplerMinMagFilter::Nearest,
SamplerMinMagFilter::Linear,
),
(
"linear-min-nearest-mag",
SamplerMinMagFilter::Linear,
SamplerMinMagFilter::Nearest,
),
];
/// The `(lodMinClamp, lodMaxClamp)` pairs: Metal's defaults, a lower bound above 0 and an upper
/// bound of 0.
const CLAMPS: [(&str, f32, f32); 3] = [
("clamp-default", 0.0, f32::MAX),
("clamp-from-1", 1.0, f32::MAX),
("clamp-to-0", 0.0, 0.0),
];
/// What the kernel reads the level as.
#[derive(Clone, Copy, Debug)]
enum Kind {
/// `level(p.z)`, through `unv_rpos2d`, which writes the first channel.
Level,
/// `bias(p.z)`, through `mip_bias_kernel`, which writes the `float4`.
Bias,
}
/// One case of this module.
#[derive(Clone, Copy, Debug)]
pub struct OneLevelFilters {
name: &'static str,
kind: Kind,
}
/// Every case of this module.
pub fn all() -> Vec<Box<dyn Case>> {
[
("sampler-one-level-filters-level", Kind::Level),
("sampler-one-level-filters-bias", Kind::Bias),
]
.into_iter()
.map(|(name, kind)| Box::new(OneLevelFilters { name, kind }) as Box<dyn Case>)
.collect()
}
/// Texel `(x, y)`: `1 + x + 16 y`, a small integer exact in `float`.
fn texel(x: u32, y: u32) -> f32 {
(1 + x + WIDTH * y) as f32
}
/// The texture's texels, row by row.
fn texture_bytes() -> Vec<u8> {
(0..HEIGHT)
.flat_map(|y| (0..WIDTH).map(move |x| texel(x, y)))
.flat_map(f32::to_le_bytes)
.collect()
}
/// The texels each lane samples beside: every texel but a row's last, row by row.
fn positions() -> Vec<(u32, u32)> {
(0..HEIGHT)
.flat_map(|y| (0..WIDTH - 1).map(move |x| (x, y)))
.collect()
}
/// The lanes: every position at each level, level by level.
fn lanes() -> u32 {
(LEVELS.len() * positions().len()) as u32
}
/// The parameter buffer: `(s, t, level, 0)` a lane, a quarter of a texel past the texel's centre
/// toward its right neighbour.
fn params() -> Vec<u8> {
let mut out = Vec::new();
for &level in &LEVELS {
for (x, y) in positions() {
let s = (x as f32 + 0.75) / WIDTH as f32;
let t = (y as f32 + 0.5) / HEIGHT as f32;
for word in [s, t, level, 0.0] {
out.extend(word.to_le_bytes());
}
}
}
out
}
/// Every row: its name and the sampler state it makes.
fn rows() -> Vec<(String, SamplerSpec)> {
let mut out = Vec::new();
for (mip_name, mip) in MIP_FILTERS {
for (pair, min, mag) in FILTER_PAIRS {
for (clamp, lo, hi) in CLAMPS {
let mut spec = SamplerSpec::new().mipped(mip).clamped_from(lo);
spec.lod_max_clamp = hi;
spec.min_filter = min;
spec.mag_filter = mag;
out.push((format!("{mip_name}-{pair}-{clamp}"), spec));
}
}
}
out
}
impl OneLevelFilters {
/// The fixture and entry point the case runs.
fn fixture(&self) -> Fixture {
match self.kind {
Kind::Level => Fixture {
name: "unv_runtime_levels",
entry: "unv_rpos2d",
},
Kind::Bias => Fixture {
name: "mip_level_sampling",
entry: "mip_bias_kernel",
},
}
}
/// The `float`s a lane writes.
fn lane_floats(&self) -> u32 {
match self.kind {
Kind::Level => 1,
Kind::Bias => 4,
}
}
/// The bytes a row's output buffer takes.
fn output_bytes(&self) -> usize {
(lanes() * self.lane_floats() * 4) as usize
}
/// The layout a row's output is read under: one row of the layout a level, its positions'
/// results in order, so a diff names the level and the position.
fn layout(&self) -> ByteLayout {
let row_elements = positions().len() as u32 * self.lane_floats();
let rows = LEVELS.len() as u32;
ByteLayout {
region: Region::Buffer {
offset: 0,
length: self.output_bytes() as u64,
},
element: Element::F32,
row_offset: 0,
row_elements,
row_pitch: row_elements * 4,
rows,
image_pitch: rows * row_elements * 4,
images: 1,
gaps: Gaps::Compared,
}
}
}
impl Case for OneLevelFilters {
fn name(&self) -> &'static str {
self.name
}
fn metal_source(&self) -> MetalSource {
MetalSource::Run
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
let fixture = self.fixture();
let mut shaders = Vec::new();
for extension in [RUNTIME_TEXT, METAL_TEXT] {
shaders.push(ShaderRef {
fixture: format!("{}{extension}", fixture.name),
entry: fixture.entry.to_owned(),
source_sha256: crate::sha256_hex(fixture.text(extension)?.as_bytes()),
});
}
Ok(shaders)
}
fn allowances(&self) -> Vec<Allowance> {
// Nothing is loosened: every sample of every row compares exactly. Every row samples
// through the runtime sampler at `[[sampler(0)]]`, which the runtime's pipelines note as
// scaled (`crate::replay::pixel_sampler_scaling_notice` holds why); the declaration sits
// at the notices site alone.
vec![crate::replay::pixel_sampler_scaling_notice()]
}
fn inputs(&self) -> Result<Vec<Input>, String> {
let fixture = self.fixture();
let mut inputs = vec![
Input {
name: "air".to_owned(),
digest: Digest::sha256(fixture.text(RUNTIME_TEXT)?.as_bytes()),
},
Input {
name: "air-typed".to_owned(),
digest: Digest::sha256(fixture.text(METAL_TEXT)?.as_bytes()),
},
Input::bytes("entry", fixture.entry.as_bytes()),
Input::bytes("buffer:params", &params()),
Input::bytes("buffer:out", &vec![FILL; self.output_bytes()]),
Input::bytes("texture:level-0", &texture_bytes()),
];
for (name, spec) in rows() {
inputs.push(Input::bytes(format!("sampler:{name}"), &spec.words()));
}
Ok(inputs)
}
fn run(&self, side: &mut dyn Side, sites: &mut Sites) -> Result<(), Abort> {
let fixture = self.fixture();
let loaded = fixture.loaded().map_err(|why| Abort {
at: "library".to_owned(),
failure: Failure::named("FixtureNotRead", why),
})?;
let library = made(sites, "library", side.library(&loaded.source()))?;
let pipeline = made(
sites,
"pipeline",
side.compute_pipeline(library, fixture.entry),
)?;
let bytes = texture_bytes();
let uploads = [Upload::level_0([WIDTH, HEIGHT], WIDTH * 4, HEIGHT, &bytes)];
let request =
TextureRequest::read_2d(PixelFormat::R32Float.as_raw(), WIDTH, HEIGHT).loaded(&uploads);
let texture = made(sites, "texture", side.texture(&request))?;
let parameters = made(sites, "buffer/params", side.buffer(&params()))?;
for (name, spec) in rows() {
let at = |site: &str| format!("{name}/{site}");
let sampler = made(sites, &at("sampler"), side.sampler(&spec))?;
let output = made(
sites,
&at("buffer/out"),
side.buffer(&vec![FILL; self.output_bytes()]),
)?;
let command_buffer = made(
sites,
&at("dispatch"),
side.dispatch_threads(
pipeline,
&Bindings::new(&[texture], &[parameters, output]).sampled(&[sampler]),
&[],
[lanes(), 1, 1],
[GROUP, 1, 1],
),
)?;
call(
sites,
&at("status"),
side.wait(command_buffer),
Clone::clone,
)?;
let read = call(
sites,
&at("read-back"),
side.read_buffer(output, 0, self.output_bytes()),
|_| Value::Absent,
)?;
sites.push(
Node::branch(name.clone(), Vec::new())
.with(Node::leaf("sampled", Observed::bytes(read, self.layout()))),
);
}
Ok(())
}
}
#[cfg(test)]
mod tests {
use super::*;
/// The bytes the committed recording of `case` holds at row `row`, over every outcome of every
/// answer, or `None` where the tree holds no recording of the case yet. A recording that holds
/// no bytes at the row is a failure: that is a renamed site.
fn recorded(case: &str, row: &str) -> Option<Vec<Vec<u8>>> {
let recording = crate::recording::read(case).ok()?;
let mut out = Vec::new();
for answer in &recording.answers {
for outcome in &answer.outcomes {
let held = outcome
.transcript
.root
.child(row)
.and_then(|node| node.child("sampled"))
.map(|node| &node.observed.value);
match held {
Some(Value::Bytes(bytes)) => out.push(bytes.clone()),
_ => panic!("{case}: the recording holds no bytes at {row}/sampled"),
}
}
}
assert!(!out.is_empty(), "{case}: a recording with no outcome");
Some(out)
}
/// Whether a sample at `level` through a sampler clamping the level into `[lo, hi]` minifies:
/// where `L + q` of the level clamped into the sampler's clamp is above 0, `L` its floor and
/// `q` its fraction truncated onto sixty-fourths (`lower::sampler::level`). `last`, where
/// given, also clamps the level into the texture's levels `[0, last]` first, the reading that
/// module stated before that probe: on this texture of one level it magnifies everywhere.
fn minifies(level: f32, (lo, hi): (f32, f32), last: Option<f32>) -> bool {
let mut h = level.max(lo).min(hi);
if let Some(last) = last {
h = h.max(0.0).min(last);
}
let l = h.floor();
let q = ((h - l) * 64.0).floor() / 64.0;
l + q > 0.0
}
/// What `filter` reads at position `(x, y)`'s lane: the texel, or a linear filter's `3/4` of
/// it and `1/4` of its right neighbour, which is one more.
fn sampled(filter: SamplerMinMagFilter, (x, y): (u32, u32)) -> f32 {
match filter {
SamplerMinMagFilter::Linear => texel(x, y) + 0.25,
_ => texel(x, y),
}
}
/// Every lane of every recorded row is the filter Metal's rule names: the minifying one where
/// the level clamped into the sampler's clamp is above 0 on Metal's grid, before the clamp
/// into the texture's one level, and the magnifying one elsewhere. The reading that took the
/// choice after the texture's clamp names the other filter at every lane where the two
/// readings part, and the case holds such lanes: under the default clamp, at the six levels
/// above 0, and every level of `lodMinClamp` 1.
#[test]
fn the_recorded_filters_are_chosen_before_the_texture_levels_clamp() {
let mut parted = 0;
for case in all() {
let floats = match case.name() {
"sampler-one-level-filters-level" => 1,
_ => 4,
};
for (row, spec) in rows() {
let Some(outcomes) = recorded(case.name(), &row) else {
return;
};
let clamp = (spec.lod_min_clamp, spec.lod_max_clamp);
let filter = |minify: bool| match minify {
true => spec.min_filter,
false => spec.mag_filter,
};
for bytes in outcomes {
for (i, &level) in LEVELS.iter().enumerate() {
let before = filter(minifies(level, clamp, None));
let after = filter(minifies(level, clamp, Some(0.0)));
for (p, &position) in positions().iter().enumerate() {
let at = (i * positions().len() + p) * floats * 4;
let got = f32::from_le_bytes(
bytes[at..at + 4].try_into().expect("four bytes"),
);
let want = sampled(before, position);
assert_eq!(
got,
want,
"{} {row}: level {level} at {position:?} read {got}, where the \
{before:?} filter reads {want}",
case.name()
);
if sampled(after, position) != got {
parted += 1;
}
}
}
}
}
}
// Per case and outcome: 6 rows (3 mip filters, 2 pairs) at 6 levels under the default
// clamp, and at all 9 under `lodMinClamp` 1, 60 positions each.
assert!(parted >= 2 * 6 * (6 + 9) * 60, "{parted} lanes parted");
}
}
@@ -23,14 +23,13 @@
//! `the_recorded_digests_are_the_m4_answers` hold the recorded M3 answers against the digests an
//! Apple M4 answered: same question, two chips.
//!
//! **What may differ, and what justifies it.** A `const` site hands the device's unnormalized
//! sampler the coordinate itself, and a nearest `slot` or `arg` site hands the device's normalized
//! sampler its texel's centre over the size, where the device reads exactly Metal's texel. A linear
//! `slot` or `arg` site hands it the coordinate divided by the size, which the device's sampler
//! reads in its own arithmetic: at a sub-texel step it may read the neighbouring step, which the
//! runtime announces on every device (`pixel-sampler-scaling`, and
//! `argument-pixel-sampler-scaling` for `arg`). The `slot` site announces it under a nearest
//! state too, as the function does not know the bound state.
//! **What may differ, and what justifies it.** A nearest site hands the device's normalized
//! sampler its texel's centre over the size, where the device reads exactly Metal's texel (a
//! nearest `const` site clamped to the edge fetches the texel). A linear site hands it the
//! coordinate divided by the size, which the device's sampler reads in its own arithmetic: at a
//! sub-texel step it may read the neighbouring step, which the runtime announces on every device
//! (`pixel-sampler-scaling`, and `argument-pixel-sampler-scaling` for `arg`). The `slot` site
//! announces it under a nearest state too, as the function does not know the bound state.
//! Each notice is declared at the notices site alone, so a texel that differs still fails the case
//! where it differs, and is a `known-gaps-rt.tsv` row naming the note.
//!
@@ -40,8 +39,9 @@
//! sign, or `-2^-126` beside them (`subnormal_grid`). A nearest `slot` or `arg` site hands the
//! device its texel's centre `floor(x) + 0.5`, whose `floor` reads a subnormal by the device's
//! float controls (`device-denormals`, a native note): where a negative subnormal is a texel apart
//! from zero to Metal's sampler, an address mode that reads texel -1 as texel 0 (clamp to edge,
//! mirror clamp to edge) answers alike, and clamp to zero and to the border read the border.
//! from zero to Metal's sampler (the recorded answers read texel -1 there, and texel 0 at a
//! positive subnormal), an address mode that reads texel -1 as texel 0 (clamp to edge, mirror
//! clamp to edge) answers alike, and clamp to zero and to the border read the border.
//!
//! Nothing here can fault a GPU: one small texture, three or four compute passes a case, no loop.
//! The coordinates do reach outside the texture, which is what the address modes are for.
@@ -0,0 +1,258 @@
//! `sparse-read-through`: what Metal 4.1's `sparse_read(sampler s, coord, offset, lod)` answers
//! through a sampler of a texture that is not sparse: each read's colour, and its residency
//! (`sparse_color::resident()`).
//!
//! The kernel is the owned fixture `a2_sparse_read_through`. Thread `i` reads a 4 × 4
//! `RGBA32Float` texture of two levels at [`POSITIONS`]`[i]` (x, y, then the level) through four
//! constexpr samplers, `clamp_to_edge`, `clamp_to_zero`, `clamp_to_border` (opaque white) and
//! `repeat`, and stores the four colours' words, then the four residencies (1 for resident). The
//! positions lie inside the texture, one and several texels past each edge, at level 1 (which a
//! sampler without a mip filter reads as level 0), and at levels past the texture's last.
//!
//! Our own probe of this kernel on the Apple M3 Max (macOS 27.0.1), plain and under Metal's
//! validation layer (which reported nothing), read every residency as resident, at every position
//! and through every sampler, with the colours of a read through a sampler (the conformance family
//! `read_through`): the edge texel through `clamp_to_edge` and `repeat`, the border texel through
//! `clamp_to_zero` and `clamp_to_border`, zero in every lane at a level past the last. The runtime
//! answers resident, a constant, so the recording, which is the M3 Max's, holds it to that answer.
//!
//! One compute pass of [`THREADS`] threads, no loop, and every coordinate outside the texture is
//! the sampler's to address: nothing here can fault a GPU.
use crate::case::{call, made, Abort, Bindings, Case, Failure, Input, MetalSource, Side};
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
use crate::recording::ShaderRef;
use crate::texture::{TextureRequest, Upload};
use crate::transcript::{ByteLayout, Digest, Element, Gaps, Node, Observed, Region, Sites};
use metal2vulkan::metal::PixelFormat;
/// The fixture the kernel lives in, and the kernel.
const FIXTURE: &str = "a2_sparse_read_through";
/// The texture's width and height at level 0.
const SIDE: u32 = 4;
/// The texture's levels.
const LEVELS: u32 = 2;
/// Each thread's position: x, y, the level, and a word the kernel does not read.
pub const POSITIONS: [[i32; 4]; 12] = [
[1, 2, 0, 0],
[3, 3, 0, 0],
[4, 1, 0, 0],
[-1, 2, 0, 0],
[2, -1, 0, 0],
[7, 9, 0, 0],
[-6, -5, 0, 0],
[1, 1, 1, 0],
[3, 0, 1, 0],
[5, 5, 1, 0],
[0, 0, 2, 0],
[2, 1, 5, 0],
];
/// The threads: one a position.
pub const THREADS: u32 = POSITIONS.len() as u32;
/// The bytes a thread stores: five `uint4`s.
const STORED: u32 = 80;
/// The byte every output word holds before the dispatch.
const BLANK: u8 = 0xab;
/// The texel at `(x, y)` of `level`: distinct within and between the levels, and exact in
/// `float`.
pub fn texel(level: u32, x: u32, y: u32) -> [f32; 4] {
let (x, y) = (x as f32, y as f32);
match level {
0 => [x + 0.25, y + 0.5, (x + 4.0 * y) / 16.0, 1.0],
_ => [x + 10.25, y + 10.5, 0.75, 0.5],
}
}
/// Each level's bytes, row by row.
fn levels() -> Vec<Vec<u8>> {
(0..LEVELS)
.map(|level| {
let side = SIDE >> level;
(0..side)
.flat_map(|y| (0..side).map(move |x| (x, y)))
.flat_map(|(x, y)| texel(level, x, y))
.flat_map(f32::to_le_bytes)
.collect()
})
.collect()
}
/// The uploads of `levels`' bytes, one a level.
fn uploads(levels: &[Vec<u8>]) -> Vec<Upload<'_>> {
(0..LEVELS)
.zip(levels)
.map(|(level, bytes)| {
let side = SIDE >> level;
Upload {
level,
..Upload::level_0([side, side], side * 16, side, bytes)
}
})
.collect()
}
/// The texture of `uploads`.
fn request<'a>(uploads: &'a [Upload<'a>]) -> TextureRequest<'a> {
TextureRequest::read_2d(PixelFormat::RGBA32Float.as_raw(), SIDE, SIDE)
.levels(LEVELS)
.loaded(uploads)
}
/// Buffer 0: each thread's position, four `int`s.
fn positions() -> Vec<u8> {
POSITIONS
.iter()
.flatten()
.flat_map(|word| word.to_le_bytes())
.collect()
}
/// The layout the stored words compare under: one row a thread.
fn stored_layout() -> ByteLayout {
let length = THREADS * STORED;
ByteLayout {
region: Region::Buffer {
offset: 0,
length: u64::from(length),
},
element: Element::U32,
row_offset: 0,
row_elements: STORED / 4,
row_pitch: STORED,
rows: THREADS,
image_pitch: length,
images: 1,
gaps: Gaps::Ignored,
}
}
/// The case.
pub struct SparseReadThrough;
impl Case for SparseReadThrough {
fn name(&self) -> &'static str {
"sparse-read-through"
}
fn metal_source(&self) -> MetalSource {
MetalSource::Run
}
fn allowances(&self) -> Vec<crate::allowance::Allowance> {
// One declaration, which loosens no value: the kernel writes `out[5 * i + k]` for five
// `k`, stores the translator does not find disjoint between two threads of one
// SIMD-group, so the runtime's pipeline notes SIMD-group access pairs on every device
// (`crate::replay::simdgroup_access_order_notice`; measured through the rt side on
// lavapipe). Each thread writes slots of its own, so the note moves no value.
vec![crate::replay::simdgroup_access_order_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
let fixture = Fixture {
name: FIXTURE,
entry: FIXTURE,
};
let mut shaders = Vec::new();
for extension in [RUNTIME_TEXT, METAL_TEXT] {
shaders.push(ShaderRef {
fixture: format!("{FIXTURE}{extension}"),
entry: FIXTURE.to_owned(),
source_sha256: crate::sha256_hex(fixture.text(extension)?.as_bytes()),
});
}
Ok(shaders)
}
fn inputs(&self) -> Result<Vec<Input>, String> {
let fixture = Fixture::new(FIXTURE);
let levels = levels();
Ok(vec![
Input {
name: "air".to_owned(),
digest: Digest::sha256(fixture.text(RUNTIME_TEXT)?.as_bytes()),
},
Input {
name: "air-typed".to_owned(),
digest: Digest::sha256(fixture.text(METAL_TEXT)?.as_bytes()),
},
Input::bytes("texture", &request(&uploads(&levels)).words()),
Input::bytes("positions", &positions()),
])
}
fn run(&self, side: &mut dyn Side, sites: &mut Sites) -> Result<(), Abort> {
let loaded = Fixture::new(FIXTURE).loaded().map_err(|why| Abort {
at: "library".to_owned(),
failure: Failure::named("FixtureNotRead", why),
})?;
let library = made(sites, "library", side.library(&loaded.source()))?;
let pipeline = made(sites, "pipeline", side.compute_pipeline(library, FIXTURE))?;
let levels = levels();
let uploads = uploads(&levels);
let texture = made(sites, "texture", side.texture(&request(&uploads)))?;
let positions = made(sites, "buffer/positions", side.buffer(&positions()))?;
let blank = vec![BLANK; (THREADS * STORED) as usize];
let out = made(sites, "buffer/out", side.buffer(&blank))?;
let command_buffer = made(
sites,
"dispatch",
side.dispatch_threads(
pipeline,
&Bindings::new(&[texture], &[positions, out]),
&[],
[THREADS, 1, 1],
[THREADS, 1, 1],
),
)?;
call(sites, "status", side.wait(command_buffer), Clone::clone)?;
let stored = call(
sites,
"read-back",
side.read_buffer(out, 0, blank.len()),
|_| crate::transcript::Value::Absent,
)?;
sites.push(Node::leaf(
"stored",
Observed::bytes(stored, stored_layout()),
));
Ok(())
}
}
#[cfg(test)]
mod tests {
use super::*;
use std::collections::BTreeSet;
/// Every texel of the two levels is distinct, so a read of the wrong texel or the wrong level
/// shows as a value, and the uploads hold each level whole.
#[test]
fn every_texel_is_distinct() {
let mut seen = BTreeSet::new();
for level in 0..LEVELS {
let side = SIDE >> level;
for y in 0..side {
for x in 0..side {
let bits = texel(level, x, y).map(f32::to_bits);
assert!(seen.insert(bits), "{level} ({x}, {y})");
}
}
}
let levels = levels();
for upload in uploads(&levels) {
assert_eq!(
upload.bytes.len(),
upload.needed(),
"level {}",
upload.level
);
}
}
}
@@ -718,12 +718,17 @@ impl Case for TextureFills {
// by copies from a buffer, which carry the note of an upload into one
// (`restricted-depth-upload`): those bytes are a depth below 0, which Metal keeps and a
// device that clamps does not, so the note loosens the notices site alone and the digest
// still decides. The format's own digest still compares.
// still decides. A 4:2:2 texture (`GBGR422`, `BGRG422`) states the static note of its
// linear and bicubic samples, which the rt side announces where it makes one
// (`bicubic-filter-arithmetic`). The format's own digest still compares.
use crate::degradation::Degradation as D;
let mut allowances = vec![notice_allowance(D::CompressedTexelDecode.code())];
if matches!(self.raw, 252 | 260) {
allowances.push(notice_allowance(D::RestrictedDepthUpload.code()));
}
if matches!(self.raw, 240 | 241) {
allowances.push(notice_allowance(D::BicubicFilterArithmetic.code()));
}
allowances
}
@@ -147,13 +147,18 @@ const FORMATS: [(PixelFormat, u32, &str); 76] = [
/// for copies alone (`metal::format::copies_only`) is
/// [`format_footprints`](crate::cases::format_footprints)'s, which records the same host round
/// trip of it beside the footprints and texture types Metal answers for it, so it is none here.
/// So is a 4:2:2 format (`GBGR422`, `BGRG422`), whose image holds Metal's bytes two to a texel of a
/// 2-texel block: [`chroma_pairs`](crate::cases::chroma_pairs)' copy cases record its host round
/// trips, of regions on and off the pairs.
///
/// It is the table's guard and nothing else reads it: [`FORMATS`] holds the names a case must
/// answer with as static strings, so the list cannot be built from the predicate at run time, and
/// this is what keeps the two from parting.
#[cfg(test)]
fn texel_bytes(pf: PixelFormat) -> Option<u32> {
if metal2vulkan::metal::format::copies_only(pf) {
if metal2vulkan::metal::format::copies_only(pf)
|| matches!(pf, PixelFormat::GBGR422 | PixelFormat::BGRG422)
{
return None;
}
let block = metal2vulkan::metal::format::byte_format(pf)?.block()?;
@@ -32,8 +32,6 @@ pub enum Degradation {
DepthDenormals,
/// [`PrecisionNote::F16FmaDoubleRounding`].
F16FmaDoubleRounding,
/// [`PrecisionNote::F16IntConvDoubleRounding`].
F16IntConvDoubleRounding,
/// [`PrecisionNote::GradFromBias`].
GradFromBias,
/// [`PrecisionNote::DeviceTranscendentals`].
@@ -174,6 +172,10 @@ pub enum Degradation {
DeviceHalfDenormals,
/// [`PrecisionNote::RoundedSampleDepthCopy`].
RoundedSampleDepthCopy,
/// [`PrecisionNote::ExtendedRangeBlend`].
ExtendedRangeBlend,
/// [`PrecisionNote::ExtendedRangeBlendWindow`].
ExtendedRangeBlendWindow,
}
impl Degradation {
@@ -189,7 +191,6 @@ impl Degradation {
Degradation::CompressedTexelDecode,
Degradation::DepthDenormals,
Degradation::F16FmaDoubleRounding,
Degradation::F16IntConvDoubleRounding,
Degradation::GradFromBias,
Degradation::DeviceTranscendentals,
Degradation::ReductionOrder,
@@ -260,6 +261,8 @@ impl Degradation {
Degradation::StencilOutputOverlap,
Degradation::DeviceHalfDenormals,
Degradation::RoundedSampleDepthCopy,
Degradation::ExtendedRangeBlend,
Degradation::ExtendedRangeBlendWindow,
];
/// The kind's code, `metal2vulkan-degrade-<kind>`: its precision note's, which the translator
@@ -281,7 +284,6 @@ impl Degradation {
Degradation::CompressedTexelDecode => PrecisionNote::CompressedTexelDecode,
Degradation::DepthDenormals => PrecisionNote::DepthDenormals,
Degradation::F16FmaDoubleRounding => PrecisionNote::F16FmaDoubleRounding,
Degradation::F16IntConvDoubleRounding => PrecisionNote::F16IntConvDoubleRounding,
Degradation::GradFromBias => PrecisionNote::GradFromBias,
Degradation::DeviceTranscendentals => PrecisionNote::DeviceTranscendentals,
Degradation::ReductionOrder => PrecisionNote::ReductionOrder,
@@ -354,6 +356,8 @@ impl Degradation {
Degradation::StencilOutputOverlap => PrecisionNote::StencilOutputOverlap,
Degradation::DeviceHalfDenormals => PrecisionNote::DeviceHalfDenormals,
Degradation::RoundedSampleDepthCopy => PrecisionNote::RoundedSampleDepthCopy,
Degradation::ExtendedRangeBlend => PrecisionNote::ExtendedRangeBlend,
Degradation::ExtendedRangeBlendWindow => PrecisionNote::ExtendedRangeBlendWindow,
}
}
@@ -361,7 +365,6 @@ impl Degradation {
pub const fn from_precision_note(note: PrecisionNote) -> Degradation {
match note {
PrecisionNote::F16FmaDoubleRounding => Degradation::F16FmaDoubleRounding,
PrecisionNote::F16IntConvDoubleRounding => Degradation::F16IntConvDoubleRounding,
PrecisionNote::GradFromBias => Degradation::GradFromBias,
PrecisionNote::DeviceTranscendentals => Degradation::DeviceTranscendentals,
PrecisionNote::ReductionOrder => Degradation::ReductionOrder,
@@ -443,6 +446,8 @@ impl Degradation {
PrecisionNote::StencilOutputOverlap => Degradation::StencilOutputOverlap,
PrecisionNote::DeviceHalfDenormals => Degradation::DeviceHalfDenormals,
PrecisionNote::RoundedSampleDepthCopy => Degradation::RoundedSampleDepthCopy,
PrecisionNote::ExtendedRangeBlend => Degradation::ExtendedRangeBlend,
PrecisionNote::ExtendedRangeBlendWindow => Degradation::ExtendedRangeBlendWindow,
}
}
}
@@ -1,26 +1,31 @@
//! The translator's pipeline descriptors as a side states and reads them for the descriptor
//! families ([`crate::render_descriptors`], [`crate::compute_descriptors`]), and the stage lists
//! and buffer mutability every pipeline descriptor family reads.
//! families ([`crate::render_descriptors`], [`crate::compute_descriptors`],
//! [`crate::mesh_descriptors`]), and the stage lists and buffer mutability every pipeline
//! descriptor family reads.
//!
//! The runtime takes Metal's pipeline descriptors as the translator's
//! ([`RenderPipelineDescriptor`], [`ComputePipelineDescriptor`]), so the stating and the reading
//! are one walk. What neither descriptor holds, its `label` and its `binaryArchives`, the side
//! answers itself as a [`Field`].
//! ([`RenderPipelineDescriptor`], [`ComputePipelineDescriptor`], [`MeshPipelineDescriptor`]), so
//! the stating and the reading are one walk. What neither descriptor holds, its `label` and its
//! `binaryArchives`, the side answers itself as a [`Field`].
use crate::case::Field;
use crate::compute_descriptors::{
ComputeDescriptorFacts, SuppliedLists as ComputeSuppliedLists, AWAY as COMPUTE_AWAY,
};
use crate::mesh_descriptors::{
DescriptorLimits as MeshDescriptorLimits, MeshDescriptorFacts,
SuppliedLists as MeshSuppliedLists, AWAY as MESH_AWAY,
};
use crate::render_descriptors::{
AttributeFacts as DescriptorAttributeFacts, ColorFacts, LayoutFacts, LinkedCounts,
AttributeFacts as DescriptorAttributeFacts, ColorAway, ColorFacts, LayoutFacts, LinkedCounts,
RenderDescriptorFacts, SuppliedLists, VertexDescriptorFacts, AWAY, READ_BUFFERS, READ_COLORS,
READ_VERTEX_SLOTS,
};
use metal2vulkan::metal::{Mutability, PixelFormat};
use metal2vulkan::pipeline::{
ColorAttachmentDescriptor, ComputePipelineDescriptor, RenderPipelineDescriptor, StageSource,
TessellationDescriptor, VertexAttributeDescriptor, VertexBufferLayoutDescriptor,
VertexDescriptor,
ColorAttachmentDescriptor, ComputePipelineDescriptor, MeshPipelineDescriptor,
RenderPipelineDescriptor, StageSource, TessellationDescriptor, VertexAttributeDescriptor,
VertexBufferLayoutDescriptor, VertexDescriptor,
};
/// Set every field of the translator's descriptor that [`AWAY`] states, each away from Metal's
@@ -54,20 +59,7 @@ pub(crate) fn state_render(descriptor: &mut RenderPipelineDescriptor) {
AWAY.support_adding_fragment_binary_functions;
descriptor.max_vertex_call_stack_depth = AWAY.max_vertex_call_stack_depth;
descriptor.max_fragment_call_stack_depth = AWAY.max_fragment_call_stack_depth;
for color in AWAY.colors {
let mut attachment = ColorAttachmentDescriptor::new(color.pixel_format);
attachment.blending_enabled = color.blending_enabled;
attachment.source_rgb_blend_factor = color.source_rgb;
attachment.destination_rgb_blend_factor = color.destination_rgb;
attachment.rgb_blend_operation = color.rgb_operation;
attachment.source_alpha_blend_factor = color.source_alpha;
attachment.destination_alpha_blend_factor = color.destination_alpha;
attachment.alpha_blend_operation = color.alpha_operation;
attachment.write_mask = color.write_mask;
if let Some(slot) = descriptor.color_attachments.get_mut(color.index as usize) {
*slot = Some(attachment);
}
}
state_colors(&mut descriptor.color_attachments, AWAY.colors);
for (index, mutability) in AWAY.vertex_buffers {
descriptor.vertex_buffers.insert(*index, *mutability);
}
@@ -112,27 +104,7 @@ pub(crate) fn read_render(
) -> RenderDescriptorFacts {
let (vertex_libraries, vertex_linked) = stage_lists(Some(&descriptor.vertex));
let (fragment_libraries, fragment_linked) = stage_lists(descriptor.fragment.as_ref());
let colors = (0..READ_COLORS)
.map(|index| {
let held = descriptor
.color_attachments
.get(index as usize)
.and_then(Option::as_ref)
.copied()
.unwrap_or_else(|| ColorAttachmentDescriptor::new(PixelFormat::Invalid));
ColorFacts {
pixel_format: held.pixel_format.as_raw(),
blending_enabled: held.blending_enabled,
source_rgb: held.source_rgb_blend_factor.as_raw(),
destination_rgb: held.destination_rgb_blend_factor.as_raw(),
rgb_operation: held.rgb_blend_operation.as_raw(),
source_alpha: held.source_alpha_blend_factor.as_raw(),
destination_alpha: held.destination_alpha_blend_factor.as_raw(),
alpha_operation: held.alpha_blend_operation.as_raw(),
write_mask: held.write_mask.as_raw(),
}
})
.collect();
let colors = read_colors(&descriptor.color_attachments);
let tessellation = descriptor.tessellation.unwrap_or_default();
RenderDescriptorFacts {
label,
@@ -183,6 +155,145 @@ pub(crate) fn read_render(
}
}
/// Set each stated colour attachment of `colors` in `attachments`, at its index.
fn state_colors(attachments: &mut [Option<ColorAttachmentDescriptor>], colors: &[ColorAway]) {
for color in colors {
let mut attachment = ColorAttachmentDescriptor::new(color.pixel_format);
attachment.blending_enabled = color.blending_enabled;
attachment.source_rgb_blend_factor = color.source_rgb;
attachment.destination_rgb_blend_factor = color.destination_rgb;
attachment.rgb_blend_operation = color.rgb_operation;
attachment.source_alpha_blend_factor = color.source_alpha;
attachment.destination_alpha_blend_factor = color.destination_alpha;
attachment.alpha_blend_operation = color.alpha_operation;
attachment.write_mask = color.write_mask;
if let Some(slot) = attachments.get_mut(color.index as usize) {
*slot = Some(attachment);
}
}
}
/// The first [`READ_COLORS`] colour attachments of `attachments`, each slot nothing set Metal's
/// `MTLPixelFormatInvalid` with blending off and every channel written (the runtime's claim about
/// Metal's default, which each family's Metal recording checks).
fn read_colors(attachments: &[Option<ColorAttachmentDescriptor>]) -> Vec<ColorFacts> {
(0..READ_COLORS)
.map(|index| {
let held = attachments
.get(index as usize)
.and_then(Option::as_ref)
.copied()
.unwrap_or_else(|| ColorAttachmentDescriptor::new(PixelFormat::Invalid));
ColorFacts {
pixel_format: held.pixel_format.as_raw(),
blending_enabled: held.blending_enabled,
source_rgb: held.source_rgb_blend_factor.as_raw(),
destination_rgb: held.destination_rgb_blend_factor.as_raw(),
rgb_operation: held.rgb_blend_operation.as_raw(),
source_alpha: held.source_alpha_blend_factor.as_raw(),
destination_alpha: held.destination_alpha_blend_factor.as_raw(),
alpha_operation: held.alpha_blend_operation.as_raw(),
write_mask: held.write_mask.as_raw(),
}
})
.collect()
}
/// Set every field of the translator's mesh descriptor that [`MESH_AWAY`] states, each away from
/// Metal's own default. A limit Metal holds as 0 or a zero size is the runtime's `None`, so a
/// stated one is `Some`.
///
/// The label is no field of the translator's descriptor, as [`state_render`] says.
pub(crate) fn state_mesh(descriptor: &mut MeshPipelineDescriptor) {
let stated = |held: u32| (held != 0).then_some(held);
let sized = |held: [u32; 3]| (held != [0; 3]).then_some(held);
descriptor.raster_sample_count = MESH_AWAY.raster_sample_count;
descriptor.alpha_to_coverage = MESH_AWAY.alpha_to_coverage;
descriptor.alpha_to_one = MESH_AWAY.alpha_to_one;
descriptor.rasterization_enabled = MESH_AWAY.rasterization_enabled;
descriptor.depth_format = Some(MESH_AWAY.depth_format);
descriptor.stencil_format = Some(MESH_AWAY.stencil_format);
descriptor.support_indirect_command_buffers = MESH_AWAY.support_indirect_command_buffers;
let limits = MESH_AWAY.limits;
descriptor.max_total_threads_per_object_threadgroup =
stated(limits.max_total_threads_per_object_threadgroup);
descriptor.max_total_threads_per_mesh_threadgroup =
stated(limits.max_total_threads_per_mesh_threadgroup);
descriptor.object_threadgroup_size_is_multiple_of_thread_execution_width =
limits.object_threadgroup_size_is_multiple_of_thread_execution_width;
descriptor.mesh_threadgroup_size_is_multiple_of_thread_execution_width =
limits.mesh_threadgroup_size_is_multiple_of_thread_execution_width;
descriptor.payload_memory_length = stated(limits.payload_memory_length);
descriptor.max_total_threadgroups_per_mesh_grid =
stated(limits.max_total_threadgroups_per_mesh_grid);
descriptor.max_vertex_amplification_count = limits.max_vertex_amplification_count;
descriptor.required_threads_per_object_threadgroup =
sized(limits.required_threads_per_object_threadgroup);
descriptor.required_threads_per_mesh_threadgroup =
sized(limits.required_threads_per_mesh_threadgroup);
state_colors(&mut descriptor.color_attachments, MESH_AWAY.colors);
}
/// What the translator's mesh `descriptor` answers of itself, beside the `label` and
/// `binary_archives` the side answers, as [`read_render`] reads a render one: a limit the
/// descriptor holds as `None` is Metal's 0 or zero size.
pub(crate) fn read_mesh(
descriptor: &MeshPipelineDescriptor,
label: Field<Option<String>>,
binary_archives: Field<u64>,
supplied: bool,
) -> MeshDescriptorFacts {
MeshDescriptorFacts {
label,
object_function: descriptor.object.as_ref().map(stage_entry),
mesh_function: Some(stage_entry(&descriptor.mesh)),
fragment_function: descriptor.fragment.as_ref().map(stage_entry),
raster_sample_count: u64::from(descriptor.raster_sample_count),
alpha_to_coverage_enabled: descriptor.alpha_to_coverage,
alpha_to_one_enabled: descriptor.alpha_to_one,
rasterization_enabled: descriptor.rasterization_enabled,
colors: read_colors(&descriptor.color_attachments),
depth_attachment_pixel_format: descriptor
.depth_format
.unwrap_or(PixelFormat::Invalid)
.as_raw(),
stencil_attachment_pixel_format: descriptor
.stencil_format
.unwrap_or(PixelFormat::Invalid)
.as_raw(),
support_indirect_command_buffers: descriptor.support_indirect_command_buffers,
binary_archives,
limits: MeshDescriptorLimits {
max_total_threads_per_object_threadgroup: descriptor
.max_total_threads_per_object_threadgroup
.unwrap_or(0),
max_total_threads_per_mesh_threadgroup: descriptor
.max_total_threads_per_mesh_threadgroup
.unwrap_or(0),
object_threadgroup_size_is_multiple_of_thread_execution_width: descriptor
.object_threadgroup_size_is_multiple_of_thread_execution_width,
mesh_threadgroup_size_is_multiple_of_thread_execution_width: descriptor
.mesh_threadgroup_size_is_multiple_of_thread_execution_width,
payload_memory_length: descriptor.payload_memory_length.unwrap_or(0),
max_total_threadgroups_per_mesh_grid: descriptor
.max_total_threadgroups_per_mesh_grid
.unwrap_or(0),
max_vertex_amplification_count: descriptor.max_vertex_amplification_count,
required_threads_per_object_threadgroup: descriptor
.required_threads_per_object_threadgroup
.unwrap_or([0; 3]),
required_threads_per_mesh_threadgroup: descriptor
.required_threads_per_mesh_threadgroup
.unwrap_or([0; 3]),
},
supplied: supplied.then(|| MeshSuppliedLists {
object_linked_functions: stage_lists(descriptor.object.as_ref()).1,
mesh_linked_functions: stage_lists(Some(&descriptor.mesh)).1,
fragment_linked_functions: stage_lists(descriptor.fragment.as_ref()).1,
}),
}
}
/// The mutability of a buffer-index map's first [`READ_BUFFERS`] slots, the runtime's side of
/// Metal's pipeline buffer array.
///
@@ -58,6 +58,7 @@
//! own `init` left. The three stage functions are all **nullable** in `objc2-metal` 0.3.2, unlike
//! the tile descriptor's, so a nil object function is a value the site records rather than a panic.
use crate::case::{field, Field};
use crate::render_descriptors::{optional, ordinal, ColorAway, ColorFacts, LinkedCounts, Shape};
use crate::transcript::{Node, NodeName, Observed, Value};
use metal2vulkan::metal;
@@ -343,11 +344,12 @@ pub struct SuppliedLists {
}
/// What a mesh render pipeline descriptor answers of itself. Each field is one Metal getter's
/// answer, an enumeration by its raw ordinal so an ordinal neither side names still compares.
/// answer, an enumeration by its raw ordinal so an ordinal neither side names still compares, and
/// a [`Field`] one a side may refuse alone, the descriptor's other getters still compared.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct MeshDescriptorFacts {
/// `label`; `None` is Metal's nil.
pub label: Option<String>,
pub label: Field<Option<String>>,
/// `objectFunction`'s own `name`; `None` where the descriptor holds none.
pub object_function: Option<String>,
/// `meshFunction`'s own `name`.
@@ -364,7 +366,7 @@ pub struct MeshDescriptorFacts {
pub stencil_attachment_pixel_format: u32,
pub support_indirect_command_buffers: bool,
/// `binaryArchives`' length; a nil list is 0.
pub binary_archives: u64,
pub binary_archives: Field<u64>,
/// The limit fields.
pub limits: DescriptorLimits,
/// The three per-stage linked-function lists, which [`Shape::Reset`] does not read.
@@ -376,7 +378,7 @@ impl MeshDescriptorFacts {
pub fn node(&self, name: impl Into<NodeName>) -> Node {
let value = Observed::value;
let mut node = Node::branch(name, Vec::new())
.with(Node::leaf("label", value(optional(&self.label))))
.with(Node::leaf("label", field(&self.label, optional)))
.with(Node::leaf(
"object_function",
value(optional(&self.object_function)),
@@ -431,7 +433,7 @@ impl MeshDescriptorFacts {
))
.with(Node::leaf(
"binary_archives",
value(Value::Uint(self.binary_archives)),
field(&self.binary_archives, |count| Value::Uint(*count)),
))
.with(self.limits.node("limits"));
if let Some(supplied) = &self.supplied {
@@ -1933,7 +1933,7 @@ fn read_mesh_descriptor(
let mesh: Option<Retained<ProtocolObject<dyn MTLFunction>>> = descriptor.meshFunction();
let fragment: Option<Retained<ProtocolObject<dyn MTLFunction>>> = descriptor.fragmentFunction();
MeshDescriptorFacts {
label: descriptor.label().map(|label| label.to_string()),
label: Ok(descriptor.label().map(|label| label.to_string())),
object_function: object.map(|held| held.name().to_string()),
mesh_function: mesh.map(|held| held.name().to_string()),
fragment_function: fragment.map(|held| held.name().to_string()),
@@ -1945,7 +1945,7 @@ fn read_mesh_descriptor(
depth_attachment_pixel_format: descriptor.depthAttachmentPixelFormat().0 as u32,
stencil_attachment_pixel_format: descriptor.stencilAttachmentPixelFormat().0 as u32,
support_indirect_command_buffers: descriptor.supportIndirectCommandBuffers(),
binary_archives: archives.map_or(0, |held| held.len() as u64),
binary_archives: Ok(archives.map_or(0, |held| held.len() as u64)),
limits: read_mesh_limits(descriptor),
supplied: supplied.then(|| read_mesh_supplied(descriptor)),
}
@@ -3893,7 +3893,7 @@ impl Side for MetalSide {
state.requiredThreadsPerObjectThreadgroup(),
),
required_threads_per_mesh_threadgroup: axes(state.requiredThreadsPerMeshThreadgroup()),
max_total_threads_per_threadgroup: state.maxTotalThreadsPerThreadgroup() as u64,
max_total_threads_per_threadgroup: Ok(state.maxTotalThreadsPerThreadgroup() as u64),
}))
}
@@ -38,6 +38,7 @@
//! for both (docs/API.md, accepted differences): such a state's two object-stage getters are not
//! read.
use crate::case::{field, Field};
use crate::pipeline_facts::size;
use crate::transcript::{Node, NodeName, Observed, Value};
@@ -165,8 +166,9 @@ pub struct MeshStateLimits {
pub required_threads_per_object_threadgroup: [u64; 3],
/// `requiredThreadsPerMeshThreadgroup`.
pub required_threads_per_mesh_threadgroup: [u64; 3],
/// `maxTotalThreadsPerThreadgroup`, which a drawing state answers 0 for.
pub max_total_threads_per_threadgroup: u64,
/// `maxTotalThreadsPerThreadgroup`, a tile threadgroup's, which a drawing state answers 0
/// for: a [`Field`] a side without tile render states refuses alone.
pub max_total_threads_per_threadgroup: Field<u64>,
}
/// What a made compute pipeline state answers of its limit.
@@ -192,48 +194,58 @@ fn optional(held: Option<u64>) -> Value {
}
}
impl MeshStateLimits {
/// The made state's answers as sites under `node`, the creation's.
fn with_sites(&self, node: Node) -> Node {
let value = Observed::value;
node.with(Node::leaf(
"max_total_threads_per_object_threadgroup",
value(optional(self.max_total_threads_per_object_threadgroup)),
))
.with(Node::leaf(
"max_total_threads_per_mesh_threadgroup",
value(Value::Uint(self.max_total_threads_per_mesh_threadgroup)),
))
.with(Node::leaf(
"object_thread_execution_width",
value(optional(self.object_thread_execution_width)),
))
.with(Node::leaf(
"mesh_thread_execution_width",
value(Value::Uint(self.mesh_thread_execution_width)),
))
.with(Node::leaf(
"max_total_threadgroups_per_mesh_grid",
value(Value::Uint(self.max_total_threadgroups_per_mesh_grid)),
))
.with(Node::leaf(
"required_threads_per_object_threadgroup",
value(size(&self.required_threads_per_object_threadgroup)),
))
.with(Node::leaf(
"required_threads_per_mesh_threadgroup",
value(size(&self.required_threads_per_mesh_threadgroup)),
))
.with(Node::leaf(
"max_total_threads_per_threadgroup",
field(&self.max_total_threads_per_threadgroup, |threads| {
Value::Uint(*threads)
}),
))
}
}
impl Creation<MeshStateLimits> {
/// The answer as the sites a case emits under one node, so both sides emit one shape.
pub fn node(&self, name: impl Into<NodeName>) -> Node {
let value = Observed::value;
let mut node = Node::branch(name, Vec::new())
.with(Node::leaf("refused", value(Value::Bool(self.refused))));
if let Some(state) = &self.state {
node = node
.with(Node::leaf(
"max_total_threads_per_object_threadgroup",
value(optional(state.max_total_threads_per_object_threadgroup)),
))
.with(Node::leaf(
"max_total_threads_per_mesh_threadgroup",
value(Value::Uint(state.max_total_threads_per_mesh_threadgroup)),
))
.with(Node::leaf(
"object_thread_execution_width",
value(optional(state.object_thread_execution_width)),
))
.with(Node::leaf(
"mesh_thread_execution_width",
value(Value::Uint(state.mesh_thread_execution_width)),
))
.with(Node::leaf(
"max_total_threadgroups_per_mesh_grid",
value(Value::Uint(state.max_total_threadgroups_per_mesh_grid)),
))
.with(Node::leaf(
"required_threads_per_object_threadgroup",
value(size(&state.required_threads_per_object_threadgroup)),
))
.with(Node::leaf(
"required_threads_per_mesh_threadgroup",
value(size(&state.required_threads_per_mesh_threadgroup)),
))
.with(Node::leaf(
"max_total_threads_per_threadgroup",
value(Value::Uint(state.max_total_threads_per_threadgroup)),
));
let node = Node::branch(name, Vec::new()).with(Node::leaf(
"refused",
Observed::value(Value::Bool(self.refused)),
));
match &self.state {
Some(state) => state.with_sites(node),
None => node,
}
node
}
}
+62 -1
View File
@@ -52,6 +52,7 @@ pub(crate) mod fields;
mod functions;
mod heap_sizes;
mod managed_naming;
mod mesh;
mod render;
mod state_facts;
mod states;
@@ -1736,6 +1737,61 @@ impl Side for RtSide<'_> {
self.mesh_target(width, height)
}
fn mesh_pipeline(
&mut self,
library: Handle,
functions: &crate::case::MeshFunctions<'_>,
) -> Answer<Handle> {
self.mesh_state(library, functions, false)
}
fn mesh_pipeline_for_commands(
&mut self,
library: Handle,
functions: &crate::case::MeshFunctions<'_>,
) -> Answer<Handle> {
self.mesh_state(library, functions, true)
}
fn mesh_pass(
&mut self,
targets: &[Handle],
steps: &[crate::case::MeshStep],
) -> Answer<crate::case::PassOutcome> {
self.run_mesh_pass(targets, steps)
}
fn mesh_pipeline_limits(
&mut self,
library: Handle,
spec: &crate::pipeline_limits::MeshLimitsSpec<'_>,
) -> Answer<crate::pipeline_limits::Creation<crate::pipeline_limits::MeshStateLimits>> {
self.mesh_limits(library, spec)
}
fn mesh_descriptor_facts(
&mut self,
library: Handle,
spec: &crate::mesh_descriptors::DescriptorSpec<'_>,
) -> Answer<crate::mesh_descriptors::MeshDescriptorFacts> {
self.mesh_descriptor(library, spec)
}
/// The consumer's own: a mesh pipeline's bindings are its reflection's
/// (`reflection_is_the_consumers`).
fn mesh_pipeline_bindings(
&mut self,
_library: Handle,
_spec: &crate::case::MeshReflectionSpec<'_>,
_options: u64,
) -> Answer<crate::function_bindings::StageReflection> {
Err(reflection_is_the_consumers())
}
fn mesh_command_buffer(&mut self, commands: &[crate::case::MeshCommand]) -> Answer<Handle> {
self.mesh_commands(commands)
}
fn visible_function_table(
&mut self,
caller: Handle,
@@ -1989,7 +2045,7 @@ mod answered {
};
/// Each call the side answers, with a case that reaches it.
const CALLS: [(&str, &str); 20] = [
const CALLS: [(&str, &str); 25] = [
(
"heap_buffer_size_and_align",
crate::cases::device_queries::HEAP_BUFFERS,
@@ -2046,6 +2102,11 @@ mod answered {
"newBufferWithBytesNoCopy",
"host-page-writes-kernel-store-writable",
),
("mesh_pipeline", "mesh-grid-draws"),
("mesh_pass", "mesh-grid-draws"),
("mesh_pipeline_limits", "mesh-limits-plain"),
("mesh_descriptor_facts", "mesh-descriptor-defaults"),
("mesh_pipeline_for_commands", "mesh-commands-own-state"),
];
/// The calls `value` records as unavailable, wherever in it they sit.
@@ -0,0 +1,294 @@
//! The rt side's mesh render pipeline calls: a state of a case's object, mesh and fragment
//! functions over its targets, with or without `supportIndirectCommandBuffers`; one pass of a
//! case's mesh steps; what a made state answers of its limits; a mesh descriptor read back before
//! any state is made; and an indirect command buffer of mesh commands, which the runtime refuses
//! by its command types.
//!
//! The runtime takes Metal's mesh descriptor as the translator's
//! ([`rt::MeshPipelineDescriptor`]), so a descriptor is stated and read through the walk both
//! sides share ([`crate::descriptor_reads`]). The runtime keeps no label and takes no binary
//! archive, and it makes no tile render state, so those getters answer refused fields.
use super::states::refuses_as_metal;
use super::{keep, waited_for, RtSide, WAIT};
use crate::case::{
Answer, Failure, Field, Handle, MeshCommand, MeshFunctions, MeshStep, PassOutcome,
};
use crate::descriptor_reads;
use crate::mesh_descriptors::{DescriptorSpec, MeshDescriptorFacts};
use crate::pipeline_limits::{floored, Creation, MeshLimitsSpec, MeshStateLimits};
use crate::transcript::{Negative, Value};
use metal2vulkan_runtime as rt;
/// A typed error of the runtime as the failure it records.
fn of_rt(error: rt::Error) -> Failure {
Failure::of_rt(&error)
}
/// `label`: the runtime keeps none, on a descriptor or on what it makes of one.
fn label() -> Field<Option<String>> {
Err(Failure::unavailable("label"))
}
/// `binaryArchives`: the runtime takes no binary archive.
fn binary_archives() -> Field<u64> {
Err(Failure::unavailable("binaryArchives"))
}
/// `maxTotalThreadsPerThreadgroup`, a tile threadgroup's: the runtime makes no tile render state,
/// so a drawing state has no such getter.
fn tile_threads() -> Field<u64> {
Err(Failure::unavailable("maxTotalThreadsPerThreadgroup"))
}
/// The mesh family's colour format, [`crate::case::TARGET_FORMAT`].
const TARGET: rt::PixelFormat = rt::PixelFormat::RGBA32Uint;
impl RtSide<'_> {
/// The translator's mesh descriptor of the library's `mesh` function, and of `object` where
/// the case names one, every other field Metal's default.
fn mesh_stages(
&self,
library: Handle,
object: Option<&str>,
mesh: &str,
) -> Answer<rt::MeshPipelineDescriptor> {
let mut descriptor = rt::MeshPipelineDescriptor::new(self.kernel(library, mesh)?);
descriptor.object = object
.map(|object| self.kernel(library, object))
.transpose()?;
Ok(descriptor)
}
/// [`crate::case::Side::mesh_pipeline`], and with `for_commands`
/// [`crate::case::Side::mesh_pipeline_for_commands`]: the runtime's state of the functions over
/// `functions.attachments` colour attachments of [`TARGET`].
pub(super) fn mesh_state(
&mut self,
library: Handle,
functions: &MeshFunctions<'_>,
for_commands: bool,
) -> Answer<Handle> {
let mut descriptor = self.mesh_stages(library, functions.object, functions.mesh)?;
descriptor.fragment = Some(self.kernel(library, functions.fragment)?);
for at in 0..functions.attachments as usize {
let slot = (descriptor.color_attachments.get_mut(at))
.ok_or_else(|| Failure::named("NoSuchAttachment", format!("color {at}")))?;
*slot = Some(rt::ColorAttachmentDescriptor::new(TARGET));
}
descriptor.support_indirect_command_buffers = for_commands;
let on = self.on;
let state = (on.device)
.new_mesh_render_pipeline_state(&descriptor, |samplers| Ok(on.sampler_ids(samplers)))
.map_err(|error| on.failure(&error))?;
Ok(keep(&mut self.render_pipelines, state))
}
/// [`crate::case::Side::mesh_pass`]: one render pass over `targets`, each cleared to zero and
/// stored, every step encoded whatever an earlier one answered (a refused call leaves the
/// encoder as it was), then the command buffer committed and waited for within [`WAIT`].
pub(super) fn run_mesh_pass(
&mut self,
targets: &[Handle],
steps: &[MeshStep],
) -> Answer<PassOutcome> {
let mut pass = rt::RenderPassDescriptor::default();
for (at, &target) in targets.iter().enumerate() {
let texture = self.held_texture(target)?.clone();
let attachment = (pass.color_attachments.get_mut(at))
.ok_or_else(|| Failure::named("NoSuchAttachment", format!("color {at}")))?;
attachment.texture = Some(texture);
attachment.load_action = rt::LoadAction::Clear;
attachment.clear_color = rt::ClearColor::new(0.0, 0.0, 0.0, 0.0);
attachment.store_action = rt::StoreAction::Store;
}
let command_buffer = self.queue()?.command_buffer().map_err(of_rt)?;
let mut encoder = (command_buffer.render_command_encoder(&pass)).map_err(of_rt)?;
let refused: Vec<Option<Failure>> = (steps.iter())
.map(|step| self.mesh_step(&mut encoder, step).err())
.collect();
encoder.end_encoding();
command_buffer.commit().map_err(of_rt)?;
for (step, refused) in steps.iter().zip(&refused) {
if let (MeshStep::Pipeline(state), None) = (step, refused) {
self.drawn.insert(state.0 as usize);
}
}
let Some(word) = waited_for(&command_buffer, WAIT) else {
return Ok(PassOutcome {
refused,
status: Value::Nothing(Negative::NeverReturned),
error: None,
});
};
Ok(PassOutcome {
refused,
status: Value::unit_variant(word),
error: (command_buffer.error()).map(|error| Value::unit_variant(format!("{error:?}"))),
})
}
/// One step of a mesh pass on `encoder`.
fn mesh_step(&self, encoder: &mut rt::RenderCommandEncoder, step: &MeshStep) -> Answer<()> {
match step {
MeshStep::Pipeline(state) => {
let state = (self.render_pipelines.get(state.0 as usize)).ok_or_else(|| {
Failure::named("NoSuchHandle", format!("mesh pipeline {}", state.0))
})?;
encoder.set_render_pipeline_state(state).map_err(of_rt)
}
MeshStep::ObjectBuffer {
buffer,
offset,
index,
} => (encoder.set_object_buffer(Some(self.held(*buffer)?), *offset, *index))
.map_err(of_rt),
MeshStep::ObjectBytes { bytes, index } => {
encoder.set_object_bytes(bytes, *index).map_err(of_rt)
}
MeshStep::MeshBuffer {
buffer,
offset,
index,
} => {
(encoder.set_mesh_buffer(Some(self.held(*buffer)?), *offset, *index)).map_err(of_rt)
}
MeshStep::FragmentBuffer {
buffer,
offset,
index,
} => (encoder.set_fragment_buffer(Some(self.held(*buffer)?), *offset, *index))
.map_err(of_rt),
MeshStep::DrawThreadgroups {
groups,
object,
mesh,
} => (encoder.draw_mesh_threadgroups(*groups, *object, *mesh)).map_err(of_rt),
MeshStep::DrawThreads {
threads,
object,
mesh,
} => (encoder.draw_mesh_threads(*threads, *object, *mesh)).map_err(of_rt),
MeshStep::DrawIndirect {
buffer,
offset,
object,
mesh,
} => (encoder.draw_mesh_threadgroups_indirect(
self.held(*buffer)?,
*offset,
*object,
*mesh,
))
.map_err(of_rt),
// The scope, the stages and the buffers only narrow what Metal orders: the runtime's
// barrier, which serves both of Metal's calls, orders every access of the encoder's
// draws so far before its later ones.
MeshStep::BarrierScope { .. } => encoder.memory_barrier().map_err(of_rt),
MeshStep::BarrierResources { buffers, .. } => {
for &buffer in buffers {
self.held(buffer)?;
}
encoder.memory_barrier().map_err(of_rt)
}
}
}
/// [`crate::case::Side::mesh_pipeline_limits`]: the runtime's state of the descriptor,
/// rasterization disabled, and what it answers of its limits, or Metal's refusal where the
/// runtime's error is one.
pub(super) fn mesh_limits(
&mut self,
library: Handle,
spec: &MeshLimitsSpec<'_>,
) -> Answer<Creation<MeshStateLimits>> {
let mut descriptor = self.mesh_stages(library, spec.object, spec.mesh)?;
descriptor.rasterization_enabled = false;
descriptor.max_vertex_amplification_count = spec.amplification;
let stated = |held: u32| (held != 0).then_some(held);
descriptor.max_total_threads_per_object_threadgroup = stated(spec.max_object);
descriptor.max_total_threads_per_mesh_threadgroup = stated(spec.max_mesh);
descriptor.max_total_threadgroups_per_mesh_grid = stated(spec.max_grid);
descriptor.payload_memory_length = stated(spec.payload);
let on = self.on;
let state = match (on.device)
.new_mesh_render_pipeline_state(&descriptor, |samplers| Ok(on.sampler_ids(samplers)))
{
Ok(state) => state,
Err(error) if refuses_as_metal(&error) => return Ok(Creation::refused()),
Err(error) => return Err(on.failure(&error)),
};
let object = spec.object.is_some();
Ok(Creation::made(MeshStateLimits {
max_total_threads_per_object_threadgroup: object
.then(|| floored(u64::from(state.max_total_threads_per_object_threadgroup()))),
max_total_threads_per_mesh_threadgroup: floored(u64::from(
state.max_total_threads_per_mesh_threadgroup(),
)),
object_thread_execution_width: object
.then(|| u64::from(state.object_thread_execution_width())),
mesh_thread_execution_width: u64::from(state.mesh_thread_execution_width()),
max_total_threadgroups_per_mesh_grid: u64::from(
state.max_total_threadgroups_per_mesh_grid(),
),
required_threads_per_object_threadgroup: state
.required_threads_per_object_threadgroup()
.map(u64::from),
required_threads_per_mesh_threadgroup: state
.required_threads_per_mesh_threadgroup()
.map(u64::from),
max_total_threads_per_threadgroup: tile_threads(),
}))
}
/// [`crate::case::Side::mesh_descriptor_facts`]: the translator's descriptor of the library's
/// stages, stated and reset as the spec's shape says, then read. The runtime has no mutable
/// descriptor object, so Metal's `init` is `MeshPipelineDescriptor::new` and its `reset` is the
/// same call again, the stages set again after it, as the Metal side sets them.
pub(super) fn mesh_descriptor(
&self,
library: Handle,
spec: &DescriptorSpec<'_>,
) -> Answer<MeshDescriptorFacts> {
let fresh = || -> Answer<rt::MeshPipelineDescriptor> {
let mut descriptor = self.mesh_stages(library, spec.object, spec.mesh)?;
descriptor.fragment = Some(self.kernel(library, spec.fragment)?);
Ok(descriptor)
};
let mut descriptor = fresh()?;
if spec.shape.sets() {
descriptor_reads::state_mesh(&mut descriptor);
}
if spec.shape.resets() {
descriptor = fresh()?;
}
Ok(descriptor_reads::read_mesh(
&descriptor,
label(),
binary_archives(),
!spec.shape.resets(),
))
}
/// [`crate::case::Side::mesh_command_buffer`]: the runtime's indirect command buffer of both
/// mesh draw kinds, each command setting its own state and buffers, which the runtime refuses
/// by its command types before it makes anything. Were one made, its commands could not be
/// encoded: the runtime encodes no command on the CPU.
pub(super) fn mesh_commands(&mut self, commands: &[MeshCommand]) -> Answer<Handle> {
let mut descriptor = rt::IndirectCommandBufferDescriptor::new();
descriptor.command_types = rt::IndirectCommandType::DRAW_MESH_THREADGROUPS
| rt::IndirectCommandType::DRAW_MESH_THREADS;
descriptor.inherit_pipeline_state = false;
descriptor.inherit_buffers = false;
let count = u32::try_from(commands.len().max(1))
.map_err(|_| Failure::named("TooManyCommands", format!("{}", commands.len())))?;
match self
.on
.device
.new_indirect_command_buffer(&descriptor, count)
{
Err(error) => Err(self.on.failure(&error)),
Ok(_) => Err(Failure::unavailable("indirectRenderCommandAtIndex:")),
}
}
}
@@ -20,7 +20,7 @@ fn of_rt(error: rt::Error) -> crate::case::Failure {
/// Whether the runtime's error is Metal's own refusal of the descriptor: its validation's
/// (`Refused`) or the translator's refusal of a descriptor Metal refuses (`InvalidDescriptor`).
fn refuses_as_metal(error: &rt::Error) -> bool {
pub(super) fn refuses_as_metal(error: &rt::Error) -> bool {
matches!(
error,
rt::Error::Refused(_)
+16 -3
View File
@@ -44,9 +44,11 @@ pub fn selected(names: &[String]) -> Result<Vec<Box<dyn Case>>, String> {
/// venue's surfaces took, and a case whose whole grids ran an observing kernel's
/// partial-threadgroups variant prints how many (`Metrics::partial_variant_whole_grids`), and a
/// case whose dispatches and draws pushed a storage texture's level fields prints how many
/// (`Metrics::level_field_commands`), and each pass prints its dispatches by the form their kernels
/// reached their buffers in (`Metrics::bound_dispatches`, `Metrics::address_dispatches`): nothing
/// in a verdict reads any of them.
/// (`Metrics::level_field_commands`), and a case that drew mesh draws prints how many of each form
/// (`Metrics::mesh_draws_launched`, `Metrics::mesh_object_grids_whole`,
/// `Metrics::mesh_object_grids_in_pieces`), and each pass prints its dispatches by the form their
/// kernels reached their buffers in (`Metrics::bound_dispatches`, `Metrics::address_dispatches`):
/// nothing in a verdict reads any of them.
pub fn replay_rt_on_under(
venues: Venues,
cases: &[Box<dyn Case>],
@@ -80,6 +82,17 @@ pub fn replay_rt_on_under(
device.venue().device
);
}
let launched = after.mesh_draws_launched - before.mesh_draws_launched;
let grids = after.mesh_object_grids_whole - before.mesh_object_grids_whole;
let pieces = after.mesh_object_grids_in_pieces - before.mesh_object_grids_in_pieces;
if launched + grids + pieces > 0 {
println!(
"mesh forms: {} on {}: {launched} launched, {grids} object grids whole, \
{pieces} in pieces",
case.name(),
device.venue().device
);
}
let levels = after.level_field_commands - before.level_field_commands;
if levels > 0 {
println!(
+398 -139
View File
@@ -219,11 +219,13 @@ four histograms of each command buffer's stages, in 23 power-of-two buckets from
2^22 us (about 4.19 s) or more, filled from the times the command buffer already reports: commit
to scheduled (`commit_to_scheduled`, counted as it is scheduled), scheduled to GPU start, the GPU
run, and GPU end to the host time its handlers begin (counted as it retires, for one that
completes with GPU times), each beside its spans' sum in nanoseconds (`commit_to_scheduled_nanos`
and the three like it); of scheduled to GPU start, the part under the GPU spans of other command
buffers retired before it, the runtime's own included (`scheduled_to_gpu_start_behind_nanos`); GPU
end to handlers split at the completion thread's six steps, for all and for those of 1,024 us or
more (`gpu_end_to_handler_steps_nanos`, `gpu_end_to_handler_tail` and its steps); the clock
completes with GPU times, but not one with nothing for the GPU whose submission is a Managed
buffer's copy-in, which is the runtime's own GPU run), each beside its spans' sum in nanoseconds
(`commit_to_scheduled_nanos` and the three like it); of scheduled to GPU start, the part under the
GPU spans of other command buffers retired before it, the runtime's own included
(`scheduled_to_gpu_start_behind_nanos`); GPU end to handlers split at the completion thread's six
steps, for all and for those of 1,024 us or more (`gpu_end_to_handler_steps_nanos`,
`gpu_end_to_handler_tail` and its steps); the clock
calibrations and their calls' time (`calibrations`, `calibration_nanos`); the segments the submit thread held for an event's value that neither
the host had set nor a submitted signal promised, by the length of each hold (`event_holds`, in
the same buckets); the groups a queue held without room that went once a completion left room
@@ -889,7 +891,10 @@ wrote, are what the image holds after it (the save runs on the GPU after the sub
queue touches. Metal's make touches no bytes, and a CPU write to a Shared buffer that no pending GPU
command uses is defined; a save and write-back at a later submission would let one thread's commit
revert another thread's write. The make waits for the GPU work already submitted, so it is refused
in a scheduled handler, which runs on the submit thread (`Refusal::InScheduledHandler`). The two
in a scheduled handler, which runs on the submit thread (`Refusal::InScheduledHandler`). Its wait
for the batch returns only once the batch completed or the device is lost: a `vkWaitSemaphores` that
fails for want of memory or with `VK_ERROR_UNKNOWN` leaves the batch pending, so the call is made
again, and no write-back runs after the make returns, with an error or without. The two
copies count in `Metrics::over_copies_host_memory_restore` (`OverCause::HostMemoryRestore`, a cause
of their own, so that `over_copies_host_memory` counts a copied texture's copies at its uses alone),
each of the bytes bound under the image (and in `over_copies`, `over_copies_imported` and
@@ -1219,14 +1224,16 @@ the descriptor's width and height, on a dedicated import of its handle, counted
as Direct3D 11 copies any texture of default usage; sampled for `D3D11_BIND_SHADER_RESOURCE`,
rendered for `D3D11_BIND_RENDER_TARGET`, storage for `D3D11_BIND_UNORDERED_ACCESS`; each where
the descriptor's format holds it and the import query
(`vkGetPhysicalDeviceImageFormatProperties2`) offers it. Vulkan states no rule for an image over
(`vkGetPhysicalDeviceImageFormatProperties2`) offers it: the handle importable and among the
image's compatible handle types (`VUID-VkImageCreateInfo-pNext-00990`). Vulkan states no rule for an image over
memory another API made with other parameters: its rule for an import of Vulkan's own export is
the same image (`VUID-VkMemoryDedicatedAllocateInfo-image-01876`), and its memory aliasing
promises a consistent reading to images of the same creation parameters. A texture whose uses
ask more (`ShaderWrite` on a texture made without `D3D11_BIND_UNORDERED_ACCESS`) is
`Gap::SurfaceUsage`. The one usage beside them is the attachment feedback loop's, which Direct3D
11's description has no counterpart for: taken where the descriptor's texture is a render target
a draw may read in its own pass. The image is mutable where it lists more than its own format, and
`Gap::SurfaceUsage`. So the image never takes the attachment feedback loop's usage, which Direct3D
11's description has no counterpart for: a draw that reads a plane as an attachment of its own
pass reads it through a copy into the plane's shadow on every device, with the loop or without it
(Known gaps of render encoders). The image is mutable where it lists more than its own format, and
it lists at most two more, the two places it asks beyond the texture Direct3D 11 made: the
descriptor's format where it differs (a chroma plane of `R16Uint` under an `RG8Unorm` texture, the
same bytes per texel in Metal's same view class), and the descriptor's sRGB sibling, which a guest
@@ -1634,15 +1641,15 @@ exported block, an exported surface in either form, and a Direct3D 11 import.
texture over any import), all 13,613 such copies (228.6 MiB) were of textures over imported
memory, 1.05 copies and 16 KB a frame on average over 13,005 frames and 78 copies in the worst
one; no texture over a block of the runtime's own was copied.
- On the NVIDIA cards we measured in Thunderbolt enclosures, freeing host-visible memory takes
about 1.1 ms per MiB and holds any submit of the same process for its length; on an internal
NVIDIA card the same free takes about 0.5 ms per 16 MiB. rt frees one idle allocation at a time,
at its idle age, whatever the queues are doing. `Metrics::allocations_freed` counts the frees,
`Metrics::submissions_during_frees` the submit calls that met one of the block-maker thread's
frees, and `Metrics::submit_call_nanos_during_frees` their time.
- NVIDIA's Linux driver holds a submit made while another thread is inside `vkAllocateMemory` or
`vkFreeMemory` until that call returns, device-local memory included, and calls made back to back
hold it through all of them. So as each of its allocations and frees returns, the block-maker
- A driver may hold a submit of the process for the length of a free (the NVIDIA rows below). rt
frees one idle allocation at a time, at its idle age, whatever the queues are doing.
`Metrics::allocations_freed` counts the frees, `Metrics::submissions_during_frees` the submit
calls that met one of the block-maker thread's frees, and
`Metrics::submit_call_nanos_during_frees` their time.
- On the NVIDIA cards measured (an RTX 3090 under NVIDIA's Linux driver 620.70.06, and an RTX 2080),
the driver holds a submit made while another thread is inside `vkAllocateMemory` or `vkFreeMemory`
until that call returns, device-local memory included, and calls made back to back hold it through
all of them. So as each of its allocations and frees returns, the block-maker
thread marks the `vkQueueSubmit2` calls of rt's inside the driver then, and starts its next one
only once all of them have returned; with none left inside it goes straight on, and what it made
is handed on as its call returns. A submit waits out at most one of its calls, the one it met. Its
@@ -1763,19 +1770,19 @@ exported block, an exported surface in either form, and a Direct3D 11 import.
Shaders reach textures and samplers by index (`docs/RESOURCE-ID.md`). Every pipeline takes set 1,
one descriptor set the device makes at creation, of seven arrays whose element `i` is the object
whose `gpuResourceID` holds index `i`: 65,536 sampled textures (binding 0), 65,536 storage
textures and then 65,536 level elements (binding 1), 8,000 samplers of each use, plain, depth comparison and integer texture
(bindings 2, 3 and 4), and 65,536 uniform and 65,536 storage texel buffers, the texture buffers
(bindings 5 and 6). A texture's index is the same element of both texture arrays: one with a
storage view takes both, any other the sampled one alone, and its storage element stays null. A
texture buffer's index is the same element of both texel-buffer arrays: the uniform one where
shaders read it, the storage one where they write it, the other null; its texture elements stay
null, as a texture's texel-buffer elements do. Every binding is partially bound, updated after bind and
updated while unused elements are pending, so an object's element is written once, as it is
made, with no lock, and never rewritten for layouts.
whose `gpuResourceID` holds index `i`: 65,536 sampled textures and then 65,536 second elements
(binding 0), 65,536 storage textures and then 65,536 level elements (binding 1), 8,000 samplers of
each use, plain, depth comparison and integer texture (bindings 2, 3 and 4), and 65,536 uniform and
65,536 storage texel buffers, the texture buffers (bindings 5 and 6). A texture's index is the same element of both
texture arrays: one with a storage view takes both, any other the sampled one alone, and its storage
element stays null. A texture buffer's index is the same element of both texel-buffer arrays: the
uniform one where shaders read it, the storage one where they write it, the other null; its texture
elements stay null, as a texture's texel-buffer elements do. Every binding is partially bound,
updated after bind and updated while unused elements are pending, so an object's element is written
once, as it is made, with no lock, and never rewritten for layouts.
- Where the device reads attachments (Floor, Attachment reads), binding 0 holds 131,072
elements: element `i + 65,536` is texture `i`'s second element, which a draw pushes in place of
- Binding 0's elements 65,536 to 131,071 are second elements: element `i + 65,536` is texture
`i`'s second element, which a draw pushes in place of
the texture's own index while it reads an attachment of its pass through the texture. Through
the attachment feedback loop it is the texture's view in the feedback layout, written with
element `i` for a texture whose image a pass may move there (a colour render target not in place
@@ -1884,7 +1891,7 @@ made, with no lock, and never rewritten for layouts.
the usage. `TextureUsage` with no bits is Metal's unknown usage: shader read and write, render
target and pixel-format view.
- The image's usage is the descriptor's plus transfer source and destination, and, for a colour
render target where the device reads attachments, sampled, with the feedback usage where it has
render target, sampled, with the feedback usage where it has
the attachment feedback loop (Render encoders). Its home layout is general where it has a storage
element, shader-read-only where shaders only read it, and the attachment layout where only render
passes use it. Its elements of set 1 are written before the call returns, with that layout, and
@@ -1900,7 +1907,10 @@ made, with no lock, and never rewritten for layouts.
first): its sRGB sibling whatever its usage, as Metal views a texture as its sibling without
`PixelFormatView` usage, and with that usage every uncompressed colour format of the same bytes
a texel. A texture of no such format is not mutable. A view of another format takes the image's
usage that its format's features hold (`VkImageViewUsageCreateInfo`). A texture made for shader
usage that its format's features hold (`VkImageViewUsageCreateInfo`), and a pass's attachment
view of it the attachment usages of those, with, where the image has the feedback usage, the
feedback and sampled usages, which Vulkan asks of an attachment in the feedback layout
(`VUID-VkRenderingAttachmentInfo-imageView-10780`). A texture made for shader
writes whose own format the device does not store, where a format it lists does (an 8-bit sRGB
texture and its unorm sibling), takes the storage usage for those views
(`VK_IMAGE_CREATE_EXTENDED_USAGE_BIT`), where the device's image format query makes that image
@@ -1926,9 +1936,17 @@ made, with no lock, and never rewritten for layouts.
- A format is made where the translator's format table maps it for the usage on the device
(`vk_format`) to the format itself or to one whose view gives Metal's values (a swizzled or
rotated view, alpha held in red, an RGBX format, a depth or stencil aspect of a combined
format), and the device's image format query takes the image. Elsewhere it is
`Gap::TextureFormat`: the shaders of the identity domains read a texture through its view alone,
so a format whose texels the shader converts (extended range, bfloat, YCbCr, decoded,
format), and the device's image format query takes the image. `BGR10_XR` and `BGRA10_XR` are
made in the UNORM format of their bits (`A2R10G10B10_UNORM_PACK32`, `R16G16B16A16_UNORM`) for
shader reads, whose codes every identity function's `float` sample, gather and read maps to
Metal's values where the texture's word names them, and for rendering: a fragment function
writes the codes Metal stores, a pass clears to them and resolves them, and a blend whose source
the function can correct is Vulkan's blend of the codes (docs/API.md). On a device whose format
query lacks that format for the usage the texture is `Gap::TextureFormat`, and one made for
shader writes has no storage element (below). Elsewhere it is `Gap::TextureFormat`: the shaders of the
identity domains read a texture through its view alone, so another format whose texels the
shader converts (the
extended-range `_sRGB` and two-plane formats, the padded 10-bit ones, bfloat, YCbCr, decoded,
copies-only, 24-bit depth held as 32-bit float) is not made. Past the query's extent, layers or
sample counts it is `Limit::TextureSize` or `Limit::TextureSamples`.
- Refused as Metal refuses each descriptor (`Refusal::TextureZeroExtent`,
@@ -2362,6 +2380,42 @@ made, with no lock, and never rewritten for layouts.
### Known gaps of textures
- Every `float` or `half` sample, gather and read of a sampled colour image maps its lanes as
`BGR10_XR` and `BGRA10_XR` codes and selects the mapped lanes where its texture's word names one
of them (docs/API.md), with no branch: on a texture of any other format the read pays the map's
arithmetic and the select, and a read the device's robustness bounds pays its in-range test.
In the compute harness's GPU time, against the form that branched on the word, alternated in one
run (medians of 4 rounds' p50s), `sampling`, `constexpr_sampling` and `texture_read` took +0.3%,
+2.7% and +0.8% on an RX 7900 XTX (RADV, Mesa 26.2.6, Linux), +0.5%, +1.3% and -0.2% on an
Iris Xe (ANV, Mesa 26.2.6, Linux), and +0.1%, +0.8% and 0.0% on an RTX 3090 (NVIDIA 620.70.06,
Linux).
These were measured before a sample's difference `w - 384` was kept uncontracted, which costs
a device that would fuse it into the product before it one operation a sample.
- A function with many `float` samples pays that map at each: one guest fragment function of 318
of them is first created, with every driver cache off, in 23 s on KosmicKrisp (Mesa 26.3.1, an
Apple M3 Max, macOS 27.0.1; two runs) and 9.2 s on ANV (Mesa 26.2.6, an Iris Xe, Linux), where
the same function without the map took 14 to 18 s and 4.0 s. Both are past
the 5 s creation ceiling the corpus tools check, as the function was without the map.
- A sample of a `BGR10_XR` or `BGRA10_XR` texture past its edge through a sampler's
`ClampToBorderColor` or `ClampToZero` reads the device's border colour as a code (opaque white
as `1.2529`, `BGRA10_XR`'s `1.2549`; black as `-0.7529`) where Metal reads 0 or 1, and a linear
sample across the edge blends toward it. A sample of a `BGRA10_XR` texel whose fields'
low 6 bits, which Metal neither reads nor writes, hold ones (bytes a CPU copy or a blit wrote)
filters them in, within `63/64` of a code step (`1 / 510`) of Metal's.
- A blended `BGR10_XR` or `BGRA10_XR` attachment blends its codes in the device's precision,
rounding to the field at every draw, where Metal's tile blends `half` values through the pass:
a channel stores Metal's code or one beside it a draw, and a `BGRA10_XR` field's six low bits
hold the fraction (`PrecisionNote::ExtendedRangeBlend`, docs/API.md). Where the blend's corrected
source term can leave the code range (an addition with a negative source; premultiplied
source-over with a source below `-0.7529` times its alpha), Vulkan clamps it, and a channel
stores a code up to 386 from Metal's (`PrecisionNote::ExtendedRangeBlendWindow`). Trigger: a
kept stream or a walk in which a pipeline carrying `ExtendedRangeBlendWindow` blends an
extended-range target and a picture differs from Metal's; the exact form, an ordered read of
the attachment where the device has the pixel interlock, then goes back to the planner. A blend
whose factors read the destination's colour, `BGRA10_XR`'s destination alpha, the blend colour
or a second output of the function's own, or a reverse subtraction, is refused
(`NotImplemented(Format)`); a blend whose destination factor reads the source's colour or alpha
reads it from a second output, which needs dual-source blending at attachment 0.
- A texture buffer with a swizzle other than each channel's own is `Gap::TextureBufferSwizzle`:
Metal applies it to the reads, and neither a buffer view nor a `gpuResourceID` carries one.
- A view of a texture buffer (`newTextureViewWithPixelFormat:` and its kin) is `Gap::TextureView`
@@ -2408,6 +2462,13 @@ made, with no lock, and never rewritten for layouts.
view to take: the translator refuses, on a device that holds some format as words, a function
that reads an sRGB texture buffer's codes or writes fewer than four lanes; MSL reaches
neither.
- A draw or dispatch whose function reaches a texture buffer through an argument buffer runs the
words twin where a texture buffer held as words lives on the device when the draw or dispatch is
recorded (`Gauges::word_texture_buffers`). On a device that holds some format as words, a texture
buffer held as words that is made after such a draw or dispatch is recorded and before it runs,
and that the draw or dispatch reaches through an argument buffer made resident by `use_heap` or
by a residency set, is accessed by the plain pipeline, which takes its `R32_UINT` view as the
format's own: the values it reads and writes are not Metal's.
- `replace_region` and `get_bytes` of a texture without named bytes go through the staging region:
a copy Metal does not make, counted in `Metrics::bytes_copied`.
- A blit copy between textures of a compressed region of whole blocks that ends inside one
@@ -2723,13 +2784,55 @@ made, with no lock, and never rewritten for layouts.
- A drawable's texture (see "Presenting") has no view of another pixel format
(`Gap::TextureView`), and a draw that reads it as an attachment of its own pass is `Gap::Draw`
of `AttachmentRead`: the swapchain's image lists no other format and has no feedback usage.
- A texture of Metal's 4:2:2 chroma-pair formats, `GBGR422` and `BGRG422`, is
`Gap::TextureFormat` at every make and at `heap_texture_size_and_align`. Vulkan's 4:2:2 formats
(`G8B8G8R8_422_UNORM`, `B8G8R8G8_422_UNORM`) are viewed only through a sampler Y′CbCr
conversion, whose chroma reconstruction is the implementation's, so the translator's format
table holds these two as a decoded `RGBA8Unorm` twin, which is not a form the runtime makes (a
format held otherwise than through its view, above). The conformance cases `chroma_pairs` and
`heap-sizes-422` record the refusal on every venue (`known-gaps-rt.tsv`).
- A texture of Metal's 4:2:2 chroma-pair formats, `GBGR422` and `BGRG422`, is held as its bytes,
an `R8G8_UNORM` image at its full width, since Vulkan's 4:2:2 formats (`G8B8G8R8_422_UNORM`,
`B8G8R8G8_422_UNORM`) are viewed only through a sampler Y′CbCr conversion, whose chroma
reconstruction is the implementation's. Only a function lowered for the texture reads its texels
as Metal's (`LoweringInputs::chroma_pairs`, `LoweringInputs::chroma_handles`): a draw or
dispatch that binds one at a texture slot its functions read, or that runs a function that may
reach a `float` colour texture through a handle while one lives on the device
(`Gauges::chroma_textures`), runs the state's content lowered for it. That content is made at
the first such draw or dispatch, a translation and its pipelines' compiles on the encoding thread
(`Metrics::chroma_contents`, within `Metrics::translations_at_encode`), kept in the device's map
of contents, and run by every such draw or dispatch (`Metrics::chroma_launches`); a state never
used with such a texture makes none, and its own module is the one it was. The content's make
is the translator's bounded lowering, as a state's is; on an RTX 3090 it took 4.7 ms.
- The first draw or dispatch that binds a 4:2:2 texture at a state's slot makes that state's
content and waits for it, where Metal makes none. On a Radeon 780M (RADV, Mesa 26.2.6), with the
driver's shader cache empty and then warm, a fragment content that decodes 40 sample sites in
line took 251 to 256 ms cold and 0.4 ms warm to create, after a 94 to 97 ms translation, where
the state's own pipeline took 78 to 83 ms cold; one sample site took 4.0 ms cold and 0.1 ms
warm. A camera preview's first open on that card, with the driver's shader cache empty, held
its frames for about a second (989 ms at the 99th percentile): its content, whose fragment
decodes 41 sample sites in line, took 111 ms to translate and its pipeline 870 ms to create. A
second open in the same session waited for nothing, as the device keeps the content.
- The content's read, nearest sample and gather of the texture are Metal's values exactly. A
decoded texel reads its own pair and the pair beside it, four fetches, and the two taps of a
footprint row share six, so a linear sample or a gather reads twelve texels where the device's
own access reads four, and a bicubic sample sixty-four. A sample through a constexpr sampler
holds its filter's decode alone; through any other sampler it holds the linear and the nearest
decode behind a branch on the sampler's filter, sixteen fetches. A linear sample through such a
sampler at each texel of a 1920 by 1080 frame took about 91 µs of an RTX 3090's time, 1.12 times
the 81 µs of the same kernel over an `RGBA8Unorm` texture of that size. Every tap is clamped to
the edge, whatever the sampler's address modes: Metal's `MTLPixelFormat.h` says of both formats
"When sampling, ClampToEdge is the only usable wrap mode". In a content lowered for handles,
each read, sample and gather through a handle tests whether its texture is such a texture; a
state whose functions reach textures through handles makes that content at its first draw or
dispatch while one lives on the device; in a consumer's session in which a camera preview opened,
0 such makes were seen. A linear or bicubic sample carries
`PrecisionNote::BicubicFilterArithmetic`, which the texture states as its static note
(`Texture::precision_note`). Shader-write and render-target usage, a swizzle, and a function
compiled outside the runtime that would read such a texture are `Gap::ChromaPairsUse`; a type
other than 2D, an odd width, more than one level and a view are `Refusal::ChromaPairs`, as Metal
refuses them. A copy between a buffer and such a texture of more than one row whose buffer rows
lie closer together than the region's rows are long, which Metal takes, is `Gap::ChromaPairsUse`
of `CloseRows`: one Vulkan copy region takes no row stride below its width, and one region a
row, each at its row's own buffer offset, would build it with no extra copy.
- A clear of a depth attachment converts the clear depth to a fixed-point code by the device's
rounding, which Vulkan lets be either of the two codes nearest it ("Conversion From Floating-Point
to Normalized Fixed-Point"): KosmicKrisp (Mesa 26.3.1, on an Apple M3 Max) clears a `Depth16Unorm`
texture to 0.25 as code 16383, where rounding to nearest gives 16384. No static note covers a
clear's conversion.
## Sampler states
@@ -3284,8 +3387,9 @@ while the driver's exit handler waited on a lock, with every runtime thread alre
that names no live buffer undefined; here it reads or writes whatever the device holds at that
address, or faults, and a fault ends as the device ends it, up to a device loss that every guest
process shares (above). What is bounded is a buffer argument's access at a byte offset that is
not a translation-time constant: outside its buffer a load reads zero and a store does nothing
(below). An access at a constant offset is not checked.
not a translation-time constant, and a load the translator makes where the program did not run
it: outside its buffer a load reads zero and a store does nothing (below). Any other access at a
constant offset is not checked.
- No guest word indexes a set 1 array past its length. A slot's texture or sampler, and a
constexpr sampler, are read at the runtime's own placement (texture indices 1 to 65,535, sampler
indices 1 to 3,999; a placement outside them is refused). An argument buffer's texture is read at
@@ -3303,7 +3407,8 @@ while the driver's exit handler waited on a lock, with every runtime thread alre
device keeps from its first such dispatch or draw, its address the argument's pushed value, as
Metal's nil buffer reads zeros. Its pushed buffer is 0 bytes long, so every checked access of
it (below) is outside. Reads past the 64 KiB and writes through a nil argument at a constant
offset aren't covered.
offset aren't covered, but for a load the translator makes where the program did not run it
(below), which is checked.
- A buffer argument's access at a byte offset that is not a translation-time constant is checked
against its buffer, from the buffer's start to its end, as Metal's domain is the buffer: a
dispatch or draw pushes, beside the argument's address, the bind offset and the buffer's length
@@ -3311,7 +3416,11 @@ while the driver's exit handler waited on a lock, with every runtime thread alre
writes the buffer's bytes there. Outside the buffer, a load reads zero, from 16 bytes of zeros
the device keeps in a ring chunk of their own, taken at the first dispatch or draw that checks a
load, which nothing is bound to and nothing writes; a store or an atomic does nothing, and an
atomic answers 0. This holds on every device. An access at a constant offset is not checked,
atomic answers 0. This holds on every device. So is a load the translator makes where the
program did not run it, at any offset: a kernel's load of a `constant T&` argument's object
made in its entry block, ahead of the branch it stood behind, and a load of a branch's arm that
Metal's backend speculates, each of which a thread may run where the guest bound the argument
short or not at all. Any other access at a constant offset is not checked,
before the bind offset or past it: a draw or dispatch that binds a buffer shorter than the
function's constant-offset accesses to it meets the device's own out-of-bounds behaviour, and
where nothing maps there that is a fault, which loses the device on NVIDIA's driver and on RADV
@@ -4399,6 +4508,12 @@ cache is answered compile-required on both.
### Known gaps of pipeline states
- A state of a kernel whose function was specialized with a required function constant left
without a value is refused (`Error::Translation`) where the translator's reading of that
constant leaves a structure it cannot lower, and Metal makes and runs the state: a kernel whose
explicit imageblock argument that constant gates, and whose body still reaches the imageblock,
carries the translator's `Unsupported{Imageblocks}` with `ImageblockCause::Missing`. What Metal
computes from such a constant is undefined (docs/API.md, "Function constants").
- A `half` simdgroup sum or product is Metal's tree of rounded `half` operations on every device,
where the device's reduction of the `float` values rounded once, which it replaces, was faster and
not Metal's answer. The tree has four forms, chosen by two queries: the SIMD-group operations
@@ -4509,8 +4624,6 @@ cache is answered compile-required on both.
`MTLArgumentBuffersTier2`, which `Device::argument_buffers_support` answers: a state over a
function that holds one is `Error::Translation` of `Unsupported{IdentityDomains}`, not
implemented, whose symbol names the first form it holds. By form:
- an object or mesh function ("a function of a stage other than a kernel, vertex or fragment
function"): no test yet;
- a fragment function over its tile's threadgroup memory (a `[[threadgroup(n)]]` argument of a
fragment function): the golden table holds the refusal (`engine/cfit_fragment_tile_memory`). No
guest of the consumer's can ask for one: Metal's feature set tables give tile shaders and
@@ -4530,11 +4643,11 @@ cache is answered compile-required on both.
through its device address"): no test yet;
- a texture argument of a type the identity arrays hold no element of, or whose bound texture's
state beyond its resource ID the function reads ("texture argument S: a type the identity
arrays hold no element of, or state of the bound texture beyond its resource ID"), a depth
cube read by face among them: no test yet. A sampled cube or cube array read by face through
`access::read` or `access::sample` is lowered, a sample of its cube view through element 0 of
the sampler arrays (the default sampler, every level reached) at the texel's centre: the
device test `tests::cube_reads` and the validation case
arrays hold no element of, or state of the bound texture beyond its resource ID"): no test
yet. A sampled cube or cube array read by face through `access::read` or `access::sample`, a
depth cube's and depth cube array's included, is lowered, a sample of its cube view through
element 0 of the sampler arrays (the default sampler, every level reached) at the texel's
centre: the device test `tests::cube_reads` and the validation case
`cube_and_cube_array_face_reads_read_their_faces_under_the_identity_domains`. A storage cube
written or read by face is lowered: the translator test
`a_storage_cube_written_by_face_is_the_2d_array_element_of_its_faces`;
@@ -4547,8 +4660,8 @@ cache is answered compile-required on both.
`under_the_identity_domains_a_runtime_samplers_query_reads_its_pushed_word`;
- other state of a bound texture or sampler beyond its resource ID ("state of a bound texture
or sampler beyond its resource ID (F)", `F` the `RuntimeFact`): a cube's view shape,
`ImageViewShape`; a storage texture's numeric type that nothing in the function states,
`StorageTextureNumericType`; and a texture's swizzle, `TextureSwizzle`: no test yet;
`ImageViewShape`, and a storage texture's numeric type that nothing in the function states,
`StorageTextureNumericType`: no test yet;
- program-scope constant data past 64 KiB read through memory ("constant data of N bytes read
through memory"): `tests::engine_identity`'s
`a_constant_blob_past_the_modules_bound_is_refused_naming_its_size` asserts the text;
@@ -4703,10 +4816,12 @@ cache is answered compile-required on both.
its 8-bit sRGB textures' UNORM twins; a render state's content for a draw's buffers bound so,
or for its 8-bit sRGB textures' UNORM twins; and a render state's content for a pass it does
not render into as made (a colour attachment the pass lacks, or a fetched colour in a 2D
array). Each is made once and kept, with its content or in the device's map of contents, so a
reuse makes nothing; a content the map forgot is made again. `Metrics::translations_at_encode`
counts these makes, made or refused, and `translation_at_encode_max_nanos` holds the longest
one. Only the first kind has a pre-pass that moves it off the encoding thread.
array); a compute or render state's content for the 4:2:2 textures a dispatch or draw reaches;
and a render content's depth range twin. Each is made once and kept, with its content or in the
device's map of contents, so a reuse makes nothing; a content the map forgot is made again.
`Metrics::translations_at_encode` counts these makes, made or refused,
`translation_at_encode_nanos` sums their time and `translation_at_encode_max_nanos` holds the
longest one. Only the first kind has a pre-pass that moves it off the encoding thread.
- On Intel's Windows driver (101.2145) for the UHD 630, the driver's compile of a tiling kernel's
`VkPipeline`, the state's main one, took medians of 6,680 to 6,853 µs for the harness's
`create_state` kernel, in three processes of 40 compiles each with no driver cache hit. The
@@ -4996,7 +5111,10 @@ cache is answered compile-required on both.
descriptor's `inputPrimitiveTopology` names `MTLPrimitiveTopologyClassLine` or
`MTLPrimitiveTopologyClassPoint`; otherwise each is
made by the content's first draw of lines or of points, which waits for it
(`Metrics::first_use_waits`, `first_use_line_waits`, `first_use_point_waits`). Of the two replay
(`Metrics::first_use_waits`, `first_use_line_waits`, `first_use_point_waits`). A draw on
another thread that needs the same `VkPipeline` while that make is in flight waits for it, a
first-use wait counted at the same place; one that needs another of the content's `VkPipeline`s
makes or takes its own and waits for no make but its own. Of the two replay
streams' 537 render contents drawn, 527 draw only triangles and 2 lines and triangles; a content
drawn only as lines (8 of them) makes a triangle `VkPipeline` it never uses. A draw under the
depth clip mode `Clamp` or the triangle fill mode `Lines` takes its class's `VkPipeline` for that
@@ -5174,10 +5292,11 @@ cache is answered compile-required on both.
does, is not drawn.
- On a driver that keeps the topology class in a pipeline (dynamicPrimitiveTopologyUnrestricted
false; RADV), a render pipeline state's first draw in a second topology class compiles a second
pipeline in full when the driver's cache is cold: 225 ms for the heaviest pipeline measured on a
780M, 0.9 to 1.5 ms for the others, nothing once the driver's cache holds it. A driver without
the restriction serves it from its cache (0.1 ms on ANV). Linking from pipeline libraries would
avoid it; the floor does not have them.
pipeline in full when the driver's cache is cold, and that draw waits for it. On a 780M, a guest
session's start made 4 such pipelines, all of the line class, in 1,171 to 1,205 ms in all: one
heavy state's took 1,166 to 1,198 ms and each of the other three under 10 ms. None is made once
the driver's cache holds it. A driver without the restriction serves it from its cache (0.1 ms
on ANV). Linking from pipeline libraries would avoid it; the floor does not have them.
- Each render content is one whole `VkPipeline`, compiled with no shared library parts, so a cold
make pays the content's whole compile. A recorded session's heaviest content, a fragment
function of about 30,800 SPIR-V instructions, takes 1,408 ms of driver time cold on an RTX 3090
@@ -5188,16 +5307,60 @@ cache is answered compile-required on both.
render content's record (The cache directory), so it decodes and specializes no function: on
lavapipe, a recorded session's warm render state creation is 31 to 44% faster with the records
than without them.
- Mesh render pipelines are not built. No call makes a state of a `MTLMeshRenderPipelineDescriptor`
(`newRenderPipelineStateWithMeshDescriptor:`), and the render encoder has no object or mesh
binding and no mesh draw (`drawMeshThreadgroups:`, `drawMeshThreads:` and the indirect form), so
no type here names them and the consumer refuses them itself. `new_render_pipeline_state` takes
a vertex function: an object or mesh function in its place is the translator's refusal
(`Error::Translation`). The translator's mesh lowering (docs/API.md, "Mesh pipelines") is only
compiled and validated: it has never been compared with Metal on a GPU, and rt makes no
`VkPipeline` of it. No replay stream or live session has used one; harvested guest
functions declare them, and validation's committed object and mesh cases qualify on Metal alone
(its `mesh_render_pipeline` requirement).
- Mesh render pipeline states are made and drawn. `Device::new_mesh_render_pipeline_state`
(`newRenderPipelineStateWithMeshDescriptor:`) makes the state and its one `VkPipeline`, and the
state answers its thread and grid maxima. The render encoder binds the object and mesh functions'
tables (`set_object_*`, `set_mesh_*`) and draws `drawMeshThreadgroups:`, `drawMeshThreads:` and
`drawMeshThreadgroupsWithIndirectBuffer:` (of a state without an object function, below); a draw
of primitives or patches with a mesh state, or a mesh draw with a vertex function's, is
`Refusal::MeshDraw`. A draw whose object or mesh threadgroup is within Metal's maximum and past
the state's capped one (below) is `Limit::MeshThreadgroupThreads`, naming the stage's Vulkan limit
and its value, and counted (`Metrics::mesh_threadgroups_past_device`): Metal draws it. An object
grid past the device's task limits runs in pieces of one multi-draw, whose records lie in one ring
chunk, so a grid of more than 5,461 pieces (about 2.29 × 10^10 object threadgroups: a piece holds
4,194,240 or 4,194,304 on the committed profiles with mesh shading) is
`Limit::ObjectThreadgroups`; Metal states no limit there. An indirect mesh draw of a state with an
object function is refused at the draw (`Gap::Draw` of `DrawKind::IndirectObjectGrid`), where
Metal draws it: its object grid is the GPU's, and one past the device's task limits runs in pieces
whose number only the counts decide, which the runtime never reads on the host and no command
inside the pass can write. An indirect draw of a state without an object function is drawn through
the launcher. Each recorded draw is counted by its form (`Metrics::mesh_draws_launched`,
`Metrics::mesh_object_grids_whole`, `Metrics::mesh_object_grids_in_pieces`). No guest has met
either refusal: no replay stream or live session has used a mesh
state. Each creation compiles its content: the translator gives no key of a mesh descriptor before
its compile, so neither the device's map of contents nor the cache directory holds one, and a
guest that makes one state many times compiles it each time. An object or mesh function with a
`[[threadgroup(n)]]` argument is refused at the creation (`Gap::RenderPipeline`), as
`setObjectThreadgroupMemoryLength:atIndex:` and its mesh form are not built; they are built when
the first replay stream, consumer walk or guest makes a mesh state whose object or mesh function
declares one. Each stage's thread maximum is Metal's (the descriptor's required size, else its
maximum, else the function's, else 1024), capped by the stage's Vulkan limit
(`maxTaskWorkGroupInvocations` and `maxTaskWorkGroupSize[0]`, or the mesh stage's), so a device
whose limit is below Metal's answers less than an M3 Max. The conformance suite's 44 cases of mesh
pipelines, recorded on an Apple M3 Max under macOS 27.0.1, are compared on lavapipe (Mesa 26.2.4),
the RTX 5080 Laptop (NVIDIA 615.71.09), the RTX 3090 (NVIDIA 620.70.06), and the Radeon 780M and
the RX 7900 XTX (RADV, Mesa 26.2.6). On each of them, 9 match Metal exactly, 5 match with their
precision notes announced, 29 are refused as the conformance ledger lists, and
`mesh-barrier-readers` differs: behind its four barriers with the fragment stage in their after
stages, the reader draw sees the fragment writer's words, as the header orders, where the M3's
reader did not; Metal's feature set tables (note 3) do not support such a barrier on Apple3
through Apple11 GPUs, so that recording is outside what Metal documents. An object grid past the
task total, drawn in pieces, is drawn by a device test of 4,194,305 object threadgroups on
lavapipe, the RTX 3090, the Radeon 780M and the RX 7900 XTX; no conformance case draws one. Each
stage's workgroup is the state's maximum M, so a draw of a smaller threadgroup runs the rest of
its workgroup idle, and a state without an object function launches its mesh grid from the
launcher's one task invocation. On the RTX 3090 (NVIDIA 620.70.06), a draw of one group through
the launcher took 10,720 ns of GPU time where a one-triangle draw of a vertex state on the same
kind of pass took 12,704 ns, and 65,535 groups of 4 threads took 1.01 times as long at M 128 as at
M 4 (149,504 and 148,672 ns; 2.12 ns a group). On the RX 7900 XTX (RADV, Mesa 26.2.6), the one
group took 64,720 ns where the triangle took 7,920 ns, 8.2 times as long, and a one-group draw of
a state with an object function, whose task stage is the function's, took 74,560 ns: the cost is a
task stage's on that driver, not the launcher's. There the 65,535 groups took 1.39 times as long
at M 256 as at M 4 (221,120 and 159,280 ns; 2.39 ns a group). Each time is the median of nine
command buffers. Harvested guest functions declare object and mesh functions. Validation's
engine candidate draws its committed object and mesh cases through these calls and compares
them with Metal's, but for the case whose object function declares threadgroup memory, which
qualifies on Metal alone (its `mesh_threadgroup_memory` requirement).
- On a Vulkan driver built on Metal (Mesa's KosmicKrisp on the Mac), a fragment function that
declares `[[early_fragment_tests]]` loses every texture write in a pipeline of more than one
sample: it runs, and its buffer writes land, but none of its texture writes does. This is
@@ -5479,15 +5642,26 @@ cache is answered compile-required on both.
Metal stores it.
- A viewport depth range past `[0, 1]` (OpenGL's `[-1, 1]`) is set, as Metal and its API
validation take it. Metal maps clip space's z through it unclamped into a fragment function's
`[[position]].z`, and a depth attachment stores that, and a `[[depth]]` output, clamped to
`[0, 1]` (an Apple M3 Max, macOS 27.0.1: the conformance crate's
`[[position]].z`, a depth attachment stores that, and a `[[depth]]` output, clamped to
`[0, 1]`, the depth test compares the clamped value, and clip space's `0 <= z <= w` clips
whatever the range (an Apple M3 Max, macOS 27.0.1: the conformance crate's
`probes/viewport_depth_past_unit.m`). The runtime enables no `VK_EXT_depth_range_unrestricted`,
so it records the range cut to `[0, 1]`, which shows nowhere in a draw whose pass has no depth
attachment and whose fragment function reads no `[[position]]` z or w, since clipping is in
clip space; such a draw draws as Metal's. Every other draw while such a range is set is a known
gap, refused at the draw (`DrawKind::Viewport`). Whether a range is past `[0, 1]` is found when
the viewports are set, and whether a draw is refused for it when they or the pipeline state
are set, so a draw reads one field for it.
clip space; such a draw draws through the state's own content, as Metal's. Every other draw
under the `Clip` depth clip mode draws through the state's depth range twin: its content
lowered again, its vertex function storing `znear * w + (zfar - znear) * z` as its position's
z and its clip space's z bounds, `z` and `w - z`, as two clip distances after its own, drawn
with the viewport at `[0, 1]` and the device's depth clamp (`depthClamp`, Floor). So it clips,
reads, stores and tests what Metal does, through the device's arithmetic
(`RenderCommandEncoder::DEPTH_RANGE_NOTE`). The twin folds the first viewport's range: a vertex
function that writes `[[viewport_array_index]]` draws through it where every viewport set has
that range. A twin is made by the first draw of its content that needs it, on the encoding
thread (`Metrics::depth_range_twins`, timed as a make at encode), and is held with that
content for the content's life; no map of its own keeps it. Whether a range is past `[0, 1]`
is found when the viewports are set, and whether a draw is refused or goes through the twin
when they, the pipeline state or the depth clip mode are set, so a draw reads one field for
it.
- `set_viewports` and `set_scissor_rects` are `setViewports:count:` and
`setScissorRects:count:`, 1 to 16 each, recorded with their count (`vkCmdSetViewportWithCount`,
`vkCmdSetScissorWithCount`, so no pipeline is made for a count). A vertex function's
@@ -5499,8 +5673,8 @@ cache is answered compile-required on both.
the rectangles set where several are, each cut to the pixels its viewport covers. The index is
stored as the function writes it, as a layer index is (Layered rendering, below).
- A draw may read an attachment of its own pass through a texture, as Metal reads a render
target, where the device reads attachments (Floor, Attachment reads): through the attachment
feedback loop where the device has it, else through a copy. The texture reaches the
target (Floor, Attachment reads): through the attachment feedback loop where the device has it,
else through a copy. The texture reaches the
attachment's level and layer, the fragment function reads it and nothing writes it, and its
image is a colour render target, which one attachment of the pass renders. A texture in place
over a buffer is read through the loop where its linear image took the feedback usage, else
@@ -5533,23 +5707,33 @@ cache is answered compile-required on both.
attachment through the loop, through a texture or by a fetch (below), counts in
`Metrics::attachment_loop_reads`, its barriers in `Metrics::barriers`.
- Through a copy, on a device without the feedback loop, and for a surface plane or a texture in
place over a buffer whose image took no feedback usage (Exported surfaces; Memory blocks and
buffers), the draw reads the image's shadow: an image of the same
place over a buffer whose image took no feedback usage, a Direct3D 11 plane's on every device
(Exported surfaces; Memory blocks and buffers), the draw reads the image's shadow: an image of the same
format, extent, levels and layers, made at the first draw that reads the image and freed with it
(`Gauges::shadows` and `shadow_bytes`). A texture that reaches the attachment's level and layer
reads the shadow through its second element; one that reaches neither reads the image at home.
Where the draw reads what the shadow does not hold, the rendering ends, one barrier orders every
earlier command before the copies and moves what they copy to the transfer layouts, the copies
are recorded (`Metrics::attachment_read_copies` and `attachment_read_copy_bytes`), one barrier
moves it all back, and the rendering begins again. A slot the fragment function reads only at its
own pixel reads the draw's scissor, a pixel wider each way, clamped into its level; any other
slot reads every level and layer its texture reaches. What is new to the shadow is copied as one
moves it all back, and the rendering begins again. Their bytes are parted by read, at the
fragment's own pixel or of all a texture reaches (`attachment_read_copy_bytes_own_pixel` and
`attachment_read_copy_bytes_whole_texture`), and by when they come: the pass's first copy into
the shadow, the first after a memory barrier left it holding nothing, or a read past what it
holds (`attachment_read_copy_bytes_first_in_pass`, `attachment_read_copy_bytes_after_barrier`
and `attachment_read_copy_bytes_beyond_held`). A narrower form, whose memory barrier forgets
only the rectangle bounding the scissors of the pass's draws, is not taken: on Intel's Windows
driver (101.2145) for the UHD Graphics 630, Windows 11, it would have removed 42.4% of these
bytes over a desktop boot and 25.6% over a 40 s 1080p H.264 playback. A slot the fragment
function reads only at its own pixel reads the draw's scissor, a pixel wider each way, clamped
into its level; any other slot reads every level and layer its texture reaches. What is new to the shadow is copied as one
area where it is one (a wider scissor's band), else as the whole read, with no look-ahead. At the
pass's first draw, where the pass cleared the attachment and every read of its level and layer
lies in it alone and inside Metal's render area, the shadow's level and layer is cleared to
the pass's clear colour between the same barriers instead of copied (the shadow is of the
attachment's format, so the clear writes the texels the pass's did); a draw of the pass before
it, of any pipeline, leaves the copy.
lies in it alone and inside Metal's render area, and the shadow is of the attachment's format,
the shadow's level and layer is cleared to the pass's clear colour between the same barriers
instead of copied, so the clear writes the texels the pass's did. A draw of the pass before it,
of any pipeline, leaves the copy, as does an attachment that is a view of another format than
its texture's: the shadow keeps the texture's format, so a pass that clears such a view and
reads it at its first draw and again after a memory barrier copies twice.
- A fragment function's read of a colour attachment (`[[color(n)]]`, framebuffer fetch) reads the
attachment's texture at the fragment's own pixel, through its second element, whose index the
draw pushes (`PushField::FetchedColor`): in the feedback layout, or through the image's shadow,
@@ -5613,6 +5797,27 @@ cache is answered compile-required on both.
### Known gaps of render encoders
- A draw under a viewport depth range past `[0, 1]` that its depth attachment or fragment
function reads draws through its state's depth range twin (`set_viewport`, above), whose
lowering and `VkPipeline` compile are a stall of the first such draw of each content: 1.3 to
1.5 ms on lavapipe (Mesa 26.2.6) and 5.1 to 5.5 ms on an RTX 3090 (NVIDIA 620.70.06), three runs
each of release builds with the drivers' disk shader caches off, the twin's lowering up to
1.4 ms of it. The twin holds `VkPipeline`s of its own beside its content's: at most 8 (the
triangle class's 4, the line and the point class's 2 each, as the `Clamp` mode never reaches
it), and as many again for its words twin where the content has one, so a content and its twin
hold at most 48 where the content alone holds 32, for the content's life. Its two clip
distances need the device's `maxClipDistances` and `maxCombinedClipAndCullDistances` to take
the vertex function's own and 2 more: a draw of a function past them is refused with the
translator's limit refusal (`Error::Translation`), kept with the content so a later draw
answers it without lowering again. Under the `Clamp` depth clip mode, which stores the depth
clamped to the range's part in `[0, 1]` (the probe above), such a draw is refused
(`DrawKind::Viewport`), as is a draw of a vertex function that writes `[[viewport_array_index]]`
while the viewports set have different ranges, one of them past `[0, 1]` (the twin folds one
range), a draw of a vertex function the consumer compiled, which has no AIR to fold, and a mesh
draw, which has no vertex function: the fold in a mesh function that writes no per-primitive
viewport index is not built. A mesh state lowers none of its functions apart from its compile,
so its fragment function, from its AIR, is taken to read `[[position]]`'s z or w, and its draws
under such a range are refused with or without a depth attachment.
- On a device with the attachment feedback loop, every pipeline of a state whose functions can
read a texture takes the loop's colour flag, whether or not a draw hands it an attachment of
its pass, and one whose functions read none takes no flag. What the flag costs a draw that reads
@@ -5639,7 +5844,12 @@ cache is answered compile-required on both.
driver runs tessellation as compute work, and for an indirect draw dispatches the vertex and
control-point grid sizes it computes in threads as that many threadgroups, so the extra work
overwrites the next instance's vertices and control points (read from the driver's source, not
instrumented). A bare Vulkan program of 2 patches in 2 instances, with no runtime code, lost the
instrumented). By the same source, the control-point work past the last instance's patches
writes over the draw's own vertex outputs, so an indirect patch draw of one instance can go wrong
the same way; no run has shown one wrong. Every form that would hand the driver no such draw
writes a new indirect command from the guest's arguments outside the render pass, so it would
copy those arguments and end and restart the pass at every indirect patch draw on every device;
the runtime keeps the one form. A bare Vulkan program of 2 patches in 2 instances, with no runtime code, lost the
second instance's second patch in 3 of 8 indirect draws and in none of 8 direct ones under
KosmicKrisp, and in none under MoltenVK on the same GPU; its indirect draws of one instance were
right. Three of the runtime's device tests draw patches of two instances with `indirect` true, and
@@ -5672,9 +5882,12 @@ cache is answered compile-required on both.
the largest extent past either side of the origin, is a viewport wider or taller than
`maxViewportDimensions` over the area, or one whose edge lies inside the last pixel of an area of
that largest size; at a draw, a viewport depth range past `[0, 1]` where the draw's pass has a
depth attachment or its fragment function may read `[[position]]`'s z or w (above); a pipeline
state whose formats are not the pass's attachments' (but for colours
past the pass's last colour attachment, above), a draw that binds a texture whose image the pass
depth attachment or its fragment function may read `[[position]]`'s z or w and no depth range
twin draws it (under the `Clamp` mode, for a vertex function that writes
`[[viewport_array_index]]` under viewports of different ranges, for a vertex function the
consumer compiled, or for a mesh draw: above, and the depth range twin's known gap below); a
pipeline state whose formats are not the pass's attachments' (but for colours past the pass's
last colour attachment, above), a draw that binds a texture whose image the pass
renders, where neither the feedback loop nor a copy reads it: on a device without the attachment
reads, from the vertex function at the rendered level and layer, written, of a depth or stencil
attachment, of an image the device takes neither the feedback usage nor a shadow for (its format's
@@ -5702,9 +5915,9 @@ cache is answered compile-required on both.
(`PushField::FetchedColor`), if a guest meets it:
- a padded extended-range attachment's blend (`R10Unorm_X6`, `RG10Unorm_X12`, their `_sRGB`
twins and `RGB10A2Unorm_sRGB`), refused naming `FramebufferFetch`, not implemented;
- a write of some of the codes one word of an extended-range attachment holds (`BGR10_XR`, the
two-plane forms' colour word and their `_sRGB` twins, under a mask of some of those codes),
refused naming `FramebufferFetch`, not implemented;
- a write of some of the codes one word of an extended-range attachment holds (the two-plane
forms' colour word and the `_sRGB` twins', under a mask of some of those codes), refused
naming `FramebufferFetch`, not implemented;
- a blend no Vulkan state gives on an attachment whose image holds its channels rotated
(`ARGB8Unorm` reading destination alpha), refused naming `FramebufferFetch`, not implemented;
- a word attachment written under a mask of some of its channels, which takes its format's own
@@ -5753,6 +5966,16 @@ cache is answered compile-required on both.
attachment of its own pass through its shadow, the copy a device without the feedback loop
takes, which Metal does not make (`Metrics::attachment_read_copies` and
`attachment_read_copy_bytes`, in `bytes_copied` too).
- A Direct3D 11 plane (`Device::import_d3d11_surface`, on Windows) whose texture is a render
target shaders read is read as an attachment of its own pass through its shadow on every device,
the copy a device without the feedback loop takes, which Metal does not make
(`Metrics::attachment_read_copies` and `attachment_read_copy_bytes`, in `bytes_copied` too):
its image takes the usage its Direct3D 11 texture's bind flags give and no other, and that
description has no counterpart for the feedback usage (Exported surfaces). How often a guest
draw reads a plane it renders to is expected to be near zero, not verified beyond two runs on
an Intel UHD 630 under Windows that counted no render pass over a plane: a desktop boot, and a
video player's 41 s playback of a 1920 × 1080, 30 fps H.264 clip (934 pictures drawn, 2,053
Direct3D 11 plane submissions).
- A colour render target in place over a buffer (Memory blocks and buffers), on a device with
the feedback loop whose linear image query (`vkGetPhysicalDeviceImageFormatProperties2`: the
texture's format and usage in linear tiling, with the sampled and feedback usages added)
@@ -5873,8 +6096,8 @@ cache is answered compile-required on both.
`VUID-VkRenderingInfo-multisampledRenderToSingleSampled-06857`), a resolve the runtime does not
build (`Resolve`: into a resolve texture of another pixel format, of more than one sample, or
whose level is not the attachment level's size; out of an attachment of one sample; of an
extended-range, bfloat or YCbCr format, whose image Vulkan's average would read in its own
encoding; or of a depth and a stencil attachment into two views), a resolve into a texture made
extended-range format but `BGR10_XR` and `BGRA10_XR`, or of a bfloat or YCbCr format, whose
image Vulkan's average would read in its own encoding; or of a depth and a stencil attachment into two views), a resolve into a texture made
without `RenderTarget` usage whose image has no attachment usage (`ResolveUsage`: Metal
resolves into a texture of any usage; Vulkan only into a view with the attachment usage,
`VUID-VkRenderingInfo-colorAttachmentCount-09476`, which a one-sample colour texture of an
@@ -5896,7 +6119,7 @@ cache is answered compile-required on both.
`resolveDepthPlane` (`TextureType`; a resolve texture of another type is resolved into as at
plane 0, as Metal with its validation layer off does, probe `resolve_depth_planes.m`), the
`CustomSampleDepthStore` store action, a clear of a format only a shader clears (extended
range, bfloat, YCbCr), a `renderTargetArrayLength` past the device's `maxFramebufferLayers`
range but `BGR10_XR` and `BGRA10_XR`, bfloat, YCbCr), a `renderTargetArrayLength` past the device's `maxFramebufferLayers`
(`ArrayLength`: Vulkan renders at most that many layers,
`VUID-VkRenderingInfo-layerCount-07817`, and requires 256 of it, where Metal's arrays hold 2048
slices), and a pass with no attachment past the device's `maxFramebufferWidth` or
@@ -6000,7 +6223,8 @@ cache is answered compile-required on both.
the pass's first draw that reads the image, at the first after a memory barrier after draws,
and where a draw reads what the shadow does not hold, the rendering ended and begun again
around the copies and their two barriers; where the draw is the pass's first and reads only
what its pass cleared, a clear of the shadow takes the copies' place. Its cost, measured on the
what its pass cleared, a clear of the shadow takes the copies' place, except through a view of
another format than its texture's, whose shadow keeps the texture's format. Its cost, measured on the
UHD 630 in the harness (release; GPU time a pass, the median over four rounds of each round's
median) by a pass that loads its `BGRA8Unorm` target, ends for a copy of all of it and begins
again, against the same pass without the copy: 39.0 µs a MiB at 1920 × 1080 and 53.5 µs a MiB
@@ -6216,7 +6440,8 @@ pass's end orders its writes before every later command.
first command (4 bytes each), then any other leading word (4 bytes each);
4. its buffer slots' words, in slot order (8 bytes each);
5. its other fields, including, for each slot it reads at an offset that is not a
translation-time constant, that slot's bounds and the zero range's address (8 bytes each);
translation-time constant or by a load made where the program did not run it, that slot's
bounds and the zero range's address (8 bytes each);
6. 24 bytes of gap and a 4-byte tail word, or its last bounds field as the tail.
From the first field that does not fit, its fields sit in its parameter block. So a vertex
function with no other leading address pushes 25 slot words ((248 - 16 - 28) / 8, rounded down)
@@ -6302,6 +6527,13 @@ pass's end orders its writes before every later command.
`copyIndirectCommandBuffer:sourceRange:destination:destinationIndex:`, compute commands, and a
function's draws other than plain or indexed triangles and plain or indexed patch draws, which
the translator refuses (`Unsupported{GpuEncodedIndirectCommands, NotImplemented}`).
- Mesh draw commands (`MTLIndirectCommandTypeDrawMeshThreadgroups` and
`MTLIndirectCommandTypeDrawMeshThreads`, alone or beside other types) are refused as
`CommandTypes`. Two general gaps come before them: the conformance suite's three mesh command
cases each set their own pipeline state (`CommandPipelines`) and are encoded by the CPU, which is
not built. With both of those built, the mesh types take a command layout of their own (the
`VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_MESH_TASKS_EXT` token), with each draw's group counts and
threadgroup sizes, as a direct mesh draw pushes them.
## Presenting
@@ -6460,6 +6692,7 @@ Presenting runs on the runtime's own device; nothing is exported or imported.
| `VK_EXT_device_generated_commands` | device, with indirect command buffers | an indirect command buffer's execution, through `deviceGeneratedCommands`, enabled where the device reports it with the limits an execution needs (Indirect command buffers, above) |
| `VK_KHR_maintenance5` | device, with indirect command buffers | the preprocess buffers' usage flag (`VkBufferUsageFlags2CreateInfoKHR`), through `maintenance5`, enabled with the extension above alone |
| `VK_KHR_fragment_shader_barycentric` | device, where reported | a fragment function's `[[barycentric_coord]]`, through the barycentric feature below; `Device::extensions` names it only where that feature is enabled |
| `VK_EXT_mesh_shader` | device, with the mesh stages | Metal's object and mesh functions, as task and mesh shaders, through the mesh-stage features below (Mesh stages, below); `Device::extensions` names it only with all three |
### Features
@@ -6653,39 +6886,39 @@ pipeline states). So `Device::extensions` names the extension only with its feat
### Limits
The descriptor limits are what the runtime's fixed arrays need: 65,536 sampled textures, 65,536
storage textures and 65,536 level elements, 65,536 read and 65,536 written texture buffers, and three arrays of 8,000
samplers, one per use (plain, depth comparison, integer texture): 4,000 indices and 4,000 variant
elements each (Set 1 and index grants). A read texture buffer (a uniform texel buffer) counts
against the sampled-image limits and a written one (a storage texel buffer) against the
storage-image limits. Vulkan requires at least 500,000 of each texture and sampler limit and of
the two resource totals on a device that supports `descriptorIndexing`, as every lab device does.
4,000 is Vulkan's minimum `maxSamplerAllocationCount`. Of the lab's devices, the least
The descriptor limits are what the runtime's fixed arrays need: 65,536 sampled textures with their
65,536 second elements, 65,536 storage textures and 65,536 level elements, 65,536 read and 65,536
written texture buffers, and three arrays of 8,000 samplers, one per use (plain, depth comparison,
integer texture): 4,000 indices and 4,000 variant elements each (Set 1 and index grants). A read
texture buffer (a uniform texel buffer) counts against the sampled-image limits and a written one (a
storage texel buffer) against the storage-image limits. Vulkan requires at least 500,000 of each
texture and sampler limit and of the two resource totals on a device that supports
`descriptorIndexing`, as every lab device does. 4,000 is Vulkan's minimum
`maxSamplerAllocationCount`. Of the lab's devices, the least
`maxPerStageDescriptorUpdateAfterBindSamplers` and `maxDescriptorSetUpdateAfterBindSamplers` is
500,000 (MoltenVK on an Apple M3 Max) and the least `maxUpdateAfterBindDescriptorsInAllPools`
1,048,576 (Intel UHD Graphics 630 on Windows). The compute limits let a threadgroup take
Metal's 1,024 threads in any shape up to 1,024 by 1,024 by 64. `maxColorAttachments` holds
Metal's eight color attachments on every device; Vulkan 1.3 requires 4 of it, and Vulkan 1.4 8.
1,048,576 (Intel UHD Graphics 630 on Windows). The compute limits let a threadgroup take Metal's
1,024 threads in any shape up to 1,024 by 1,024 by 64. `maxColorAttachments` holds Metal's eight
color attachments on every device; Vulkan 1.3 requires 4 of it, and Vulkan 1.4 8.
`maxFragmentOutputAttachments` holds a fragment function's output to each of them; Vulkan 1.3 and
1.4 require 4 of it, and Roadmap 2026 8.
A Boolean limit's minimum is 1,
`VK_TRUE`; `timestampValidBits` is the queue family's. No `maxPushConstantsSize` is asked: the
push window, and the pipeline layout's one push range, is the device's `maxPushConstantsSize` up to
256 bytes (`metal2vulkan::device::DeviceProfile::push_window`), at least Vulkan's least, 128, and a
function's fields past it go to a parameter block whose address the window holds. On a device
below 256 an indirect command reaches fewer vertex slots (Known gaps of indirect command buffers).
1.4 require 4 of it, and Roadmap 2026 8. A Boolean limit's minimum is 1, `VK_TRUE`;
`timestampValidBits` is the queue family's. No `maxPushConstantsSize` is asked: the push window, and
the pipeline layout's one push range, is the device's `maxPushConstantsSize` up to 256 bytes
(`metal2vulkan::device::DeviceProfile::push_window`), at least Vulkan's least, 128, and a function's
fields past it go to a parameter block whose address the window holds. On a device below 256 an
indirect command reaches fewer vertex slots (Known gaps of indirect command buffers).
| Limit | Minimum | Used for |
|---|---|---|
| `maxPerStageDescriptorUpdateAfterBindSampledImages` | `131072` | the sampled-texture and read texture-buffer arrays |
| `maxDescriptorSetUpdateAfterBindSampledImages` | `131072` | the sampled-texture and read texture-buffer arrays |
| `maxPerStageDescriptorUpdateAfterBindSampledImages` | `196608` | the sampled-texture array with its second elements, and the read texture-buffer array |
| `maxDescriptorSetUpdateAfterBindSampledImages` | `196608` | the sampled-texture array with its second elements, and the read texture-buffer array |
| `maxPerStageDescriptorUpdateAfterBindStorageImages` | `196608` | the storage-texture array with its level elements, and the written texture-buffer array |
| `maxDescriptorSetUpdateAfterBindStorageImages` | `196608` | the storage-texture array with its level elements, and the written texture-buffer array |
| `maxPerStageDescriptorUpdateAfterBindSamplers` | `24000` | the three sampler arrays; the lab's least is 500,000 |
| `maxDescriptorSetUpdateAfterBindSamplers` | `24000` | the three sampler arrays; the lab's least is 500,000 |
| `maxSamplerAllocationCount` | `4000` | Vulkan's minimum: live samplers |
| `maxPerStageUpdateAfterBindResources` | `327680` | the four texture and texture-buffer arrays, the level elements among them, in one stage; a fragment stage needs its `maxColorAttachments` more |
| `maxUpdateAfterBindDescriptorsInAllPools` | `351680` | all seven arrays; the lab's least is 1,048,576 |
| `maxPerStageUpdateAfterBindResources` | `393216` | the four texture and texture-buffer arrays, the second and level elements among them, in one stage; a fragment stage needs its `maxColorAttachments` more |
| `maxUpdateAfterBindDescriptorsInAllPools` | `417216` | all seven arrays; the lab's least is 1,048,576 |
| `maxComputeWorkGroupInvocations` | `1024` | Metal's most threads per threadgroup |
| `maxComputeWorkGroupSize[0]` | `1024` | a threadgroup's width |
| `maxComputeWorkGroupSize[1]` | `1024` | a threadgroup's height |
@@ -6793,19 +7026,14 @@ blocks), and only that call makes a sparse buffer. Elsewhere the call refuses.
### Attachment reads
A draw that reads, through a texture, an attachment its own pass renders (Metal's read of a
render target) is built where the device's descriptor limits hold the sampled-texture array's
second elements beside the floor's arrays: 65,536 sampled images more than the limits above name
(`maxPerStageDescriptorUpdateAfterBindSampledImages`,
`maxDescriptorSetUpdateAfterBindSampledImages`, `maxPerStageUpdateAfterBindResources` and
`maxUpdateAfterBindDescriptorsInAllPools`); a device without them refuses such a draw
(`Gap::Draw` of `DrawKind::AttachmentRead`), and is otherwise the same
(`floor::Capabilities::attachment_reads`). The draw reads through the attachment feedback loop
where the device also lists the extension marked "with the feedback loop" above and reports the
feature below, which device creation then enables, and neither otherwise
(`floor::Capabilities::feedback_loop`). A device that reads attachments without them reads
through a copy of the image into its shadow (Render encoders), a known gap. AMD's Windows driver
is expected to take the loop, not verified in the lab (public reports of it list
A draw that reads, through a texture, an attachment its own pass renders (Metal's read of a render
target) is built on every device: the floor's limits above hold the sampled-texture array's second
elements (`floor::Capabilities::attachment_reads` is always true). The draw reads through the
attachment feedback loop where the device also lists the extension marked "with the feedback loop"
above and reports the feature below, which device creation then enables, and neither otherwise
(`floor::Capabilities::feedback_loop`). A device that reads attachments without them reads through a
copy of the image into its shadow (Render encoders), a known gap. AMD's Windows driver is expected
to take the loop, not verified in the lab (public reports of it list
`VK_EXT_attachment_feedback_loop_layout` from 2.0.250 on).
| Attachment-read feature | Structure | Used for |
@@ -6957,6 +7185,37 @@ covers them all. This was read in the release's source, not reproduced in the la
|---|---|---|
| `extendedDynamicState` | `VkPhysicalDeviceExtendedDynamicStateFeaturesEXT` | no state of the runtime's; RADV 26.3.1's cache of fragment epilogs, which a depth or stencil output under a dynamic test enable draws through |
### Mesh stages
Where the device lists `VK_EXT_mesh_shader` and reports all three features below, device creation
enables the extension and the three, and none of them otherwise (`floor::MESH_EXTENSIONS`). An
object function is a task shader and a mesh function a mesh shader, and an object grid past the
task limits runs in pieces of one multi-draw, so a device that lacks any one of the three takes no
mesh render pipeline state: the translator refuses it, `Unsupported{MeshShading}` naming what the
device lacks. No answer chooses a second form.
| Mesh-stage feature | Structure | Used for |
|---|---|---|
| `taskShader` | `VkPhysicalDeviceMeshShaderFeaturesEXT` | an object function, as a task shader |
| `meshShader` | `VkPhysicalDeviceMeshShaderFeaturesEXT` | a mesh function, as a mesh shader |
| `multiDrawIndirect` | `VkPhysicalDeviceFeatures` | an object grid past the task stage's limits, drawn as pieces of one multi-draw of host-written records |
Of the venues run, four list no `VK_EXT_mesh_shader`, so a mesh render pipeline state is refused
there (vulkaninfo on each): the Radeon RX 550 (RADV, Mesa 26.2.6), the Iris Xe (ANV, Mesa 26.2.6),
and the M3 Max under KosmicKrisp (Mesa 26.3.1) and under MoltenVK (1.4.2). The others list it with
all three features, under these limits (vulkaninfo on each):
| Card (driver) | `maxTaskWorkGroupCount`; total | Task invocations and width | Mesh invocations and width | `maxTaskPayloadAndSharedMemorySize` |
|---|---|---|---|---|
| RTX 3090, RTX 2080 (NVIDIA 620.70.06); RTX 5080 Laptop (NVIDIA 615.71.09) | (4,194,304, 65,535, 65,535); 4,194,304 | 128 | 128 | 32,768 |
| RX 7900 XTX, Radeon 780M (RADV, Mesa 26.2.6) | (65,535, 65,535, 65,535); 4,194,304 | 1,024 | 256 | 65,536 |
| lavapipe (Mesa 26.2.4 and 26.2.6) | (65,536, 65,536, 65,536); 4,194,304 | 1,024 | 1,024 | 32,768 |
A stage's thread maximum is Metal's capped by its invocations and width, so on the NVIDIA cards a
state answers at most 128 for each stage where Metal answers up to 1,024, and a draw of a larger
threadgroup is `Limit::MeshThreadgroupThreads`; on the AMD cards the mesh stage's cap is 256. An
object grid past the task count or total is drawn in pieces (Known gaps of render pipeline states).
### Not enabled
The translator's profile reads each feature below where a device enables it, and device creation
+30 -41
View File
@@ -32,8 +32,7 @@
//! face: the translator samples the cube view there at the texel's centre and the read's level
//! (docs/RESOURCE-ID.md). The device writes every element once at creation ([`Arrays::new`]).
//!
//! Where the device reads attachments through textures (`floor::Capabilities::attachment_reads`),
//! the sampled-texture array is twice as long: element `i + 65,536` is texture `i`'s second
//! The sampled-texture array holds 131,072 elements. Element `i + 65,536` is texture `i`'s second
//! element, which a draw pushes in place of the texture's own while it reads an attachment of its
//! pass through the texture (`crate::render_encoder`). Through the attachment feedback loop it is
//! the texture's sampled view in the feedback layout, written with element `i` for a texture whose
@@ -79,6 +78,13 @@ pub(crate) const UNIFORM_TEXELS_BINDING: u32 = 5;
/// The binding of the storage texel-buffer array: the texture buffers shaders write.
pub(crate) const STORAGE_TEXELS_BINDING: u32 = 6;
/// The elements of the sampled-texture array: the textures' and their second elements'.
pub(crate) const SAMPLED_ELEMENTS: u32 = 2 * TEXTURES;
/// The element list of an index's every element at its array's default.
const DEFAULTS: [(usize, Option<vk::Sampler>); SAMPLER_ARRAYS as usize] =
[(0, None), (1, None), (2, None)];
/// Set 1's bindings, each its binding, descriptor type and count: the arrays a kernel's layout
/// names under the identity domains, which every pipeline's layout takes from this set. Shaders
/// declare the arrays unsized, and the set's layout holds [`layout_counts`] elements: more in the
@@ -323,8 +329,6 @@ pub(crate) struct Arrays {
pub(crate) plain: vk::Sampler,
/// The default sampler of the comparison array.
pub(crate) compare: vk::Sampler,
/// Whether the sampled-texture array holds the second elements.
seconds: bool,
pub(crate) grants: Mutex<Grants>,
/// The sampler each sampler array's element at each index holds, plain, comparison and
/// integer texture, as last written: a default, or a sampler the index's owner holds, so a
@@ -333,9 +337,8 @@ pub(crate) struct Arrays {
}
impl Arrays {
/// Makes set 1 and writes every element its default; with `seconds`, the sampled-texture
/// array holds the second elements too. With `buffers`, set 0's layout holds a kernel's
/// storage buffers ([`buffer_bindings`]); without, it is empty.
/// Makes set 1 and writes every element its default. With `buffers`, set 0's layout holds a
/// kernel's storage buffers ([`buffer_bindings`]); without, it is empty.
///
/// # Safety
///
@@ -344,11 +347,11 @@ impl Arrays {
pub(crate) unsafe fn new(
device: &ash::Device,
counters: &Counters,
(seconds, buffers): (bool, bool),
buffers: bool,
) -> Result<Arrays, Error> {
let mut made = Made::default();
// SAFETY: the caller's contract; what was made is destroyed where a later step fails.
let arrays = unsafe { made.make(device, counters, (seconds, buffers)) };
let arrays = unsafe { made.make(device, counters, buffers) };
if arrays.is_err() {
// SAFETY: nothing else holds what was made.
unsafe { made.destroy(device, counters) };
@@ -416,7 +419,7 @@ impl Arrays {
let storage = storage.or(displaced.then(vk::ImageView::null));
let second = match looped {
Some(view) => Some((view, vk::ImageLayout::ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT)),
None => (displaced && self.seconds).then(|| {
None => displaced.then(|| {
(
vk::ImageView::null(),
vk::ImageLayout::SHADER_READ_ONLY_OPTIMAL,
@@ -437,7 +440,7 @@ impl Arrays {
/// another object can be placed there: the uniform texel-buffer array's with `views[0]` and
/// the storage one's with `views[1]`, a null descriptor where a view is null. Where it
/// displaced, it writes the index's texture elements null too (the sampled, the storage, and
/// the second where the set holds them), which a texture there may have held. The
/// the second), which a texture there may have held. The
/// descriptor-slot gauge rises where no object held the index. Its owner word, which
/// [`Arrays::vacate_texels`] takes.
///
@@ -465,8 +468,7 @@ impl Arrays {
self.write_texels(device, index, views);
if displaced {
let null = vk::ImageView::null();
let second =
(self.seconds).then_some((null, vk::ImageLayout::SHADER_READ_ONLY_OPTIMAL));
let second = Some((null, vk::ImageLayout::SHADER_READ_ONLY_OPTIMAL));
self.write_texture(device, index, None, Some(null), second);
}
}
@@ -772,9 +774,7 @@ impl Arrays {
if grants.vacate(IndexClass::Sampler, index, owner) {
// SAFETY: the caller's contract; the lock is held, so no object is placed there
// before every element is its default.
unsafe {
self.write_samplers(device, counters, index, &[(0, None), (1, None), (2, None)])
};
unsafe { self.write_samplers(device, counters, index, &DEFAULTS) };
counters.fall(Gauge::DescriptorSlots);
}
}
@@ -819,7 +819,7 @@ impl Arrays {
let mut grants = lock(&self.grants);
// SAFETY: the caller's contract; the lock is held, so no variant is placed there before
// every element is its default.
unsafe { self.write_samplers(device, counters, index, &[(0, None), (1, None), (2, None)]) };
unsafe { self.write_samplers(device, counters, index, &DEFAULTS) };
grants.variants.push(index);
}
@@ -993,9 +993,8 @@ impl Made {
&mut self,
device: &ash::Device,
counters: &Counters,
(seconds, buffers): (bool, bool),
buffers: bool,
) -> Result<Arrays, Error> {
let sampled = sampled_images(seconds);
let bindings = buffer_bindings();
let first = vk::DescriptorSetLayoutCreateInfo::default().bindings(if buffers {
&bindings[..]
@@ -1011,7 +1010,7 @@ impl Made {
// SAFETY: the device is live, with the update-after-bind features of each binding's type
// (the floor's).
let layout = unsafe {
with_arrays_layout(layout_counts(seconds), |info| {
with_arrays_layout(layout_counts(), |info| {
supported(device, info, 1)?;
device
.create_descriptor_set_layout(info, None)
@@ -1022,7 +1021,7 @@ impl Made {
let sizes = [
vk::DescriptorPoolSize {
ty: vk::DescriptorType::SAMPLED_IMAGE,
descriptor_count: sampled,
descriptor_count: SAMPLED_ELEMENTS,
},
vk::DescriptorPoolSize {
ty: vk::DescriptorType::STORAGE_IMAGE,
@@ -1078,7 +1077,7 @@ impl Made {
let compare = default(true)?;
self.compare = Some(compare);
// SAFETY: the set is the device's and no command buffer uses it yet.
unsafe { fill(device, set, sampled, plain, compare) };
unsafe { fill(device, set, plain, compare) };
Ok(Arrays {
first,
layout,
@@ -1086,7 +1085,6 @@ impl Made {
set,
plain,
compare,
seconds,
grants: Mutex::new(Grants::new()),
samplers: Mutex::new(
vec![[plain, compare, plain]; SAMPLER_ELEMENTS as usize].into_boxed_slice(),
@@ -1179,12 +1177,12 @@ pub(crate) unsafe fn supported(
}
/// The elements of each binding of set 1's layout, by [`BINDINGS`]: theirs, the sampled-texture
/// array's [`sampled_images`], the storage-texture array's level elements past its textures, and
/// array's [`SAMPLED_ELEMENTS`], the storage-texture array's level elements past its textures,
/// each sampler array's [`SAMPLER_ELEMENTS`], its variant elements past the [`SAMPLERS`] a
/// pipeline's layout names.
pub(crate) fn layout_counts(seconds: bool) -> [u32; 7] {
pub(crate) fn layout_counts() -> [u32; 7] {
let mut counts = BINDINGS.map(|(_, _, count)| count);
counts[SAMPLED_BINDING as usize] = sampled_images(seconds);
counts[SAMPLED_BINDING as usize] = SAMPLED_ELEMENTS;
counts[STORAGE_BINDING as usize] = TEXTURES + LEVEL_ELEMENTS;
for array in 0..SAMPLER_ARRAYS {
counts[(FIRST_SAMPLER_BINDING + array) as usize] = SAMPLER_ELEMENTS;
@@ -1192,34 +1190,25 @@ pub(crate) fn layout_counts(seconds: bool) -> [u32; 7] {
counts
}
/// The elements of the sampled-texture array: [`TEXTURES`], twice that with the second elements.
pub(crate) fn sampled_images(seconds: bool) -> u32 {
match seconds {
true => 2 * TEXTURES,
false => TEXTURES,
}
}
/// Writes every element of `set` its default: a null descriptor in each texture and texel-buffer
/// array, the sampled-texture array's `sampled` elements and the storage-texture array's level
/// elements among them, `plain` in the plain and
/// integer-texture sampler arrays and `compare` in the comparison array.
/// array, the sampled-texture array's second elements and the storage-texture array's level
/// elements among them, `plain` in the plain and integer-texture sampler arrays and `compare` in
/// the comparison array.
///
/// # Safety
///
/// `set` is set 1 of `device`, of `sampled` sampled-texture elements, `nullDescriptor` is enabled,
/// and no other thread writes an element of it meanwhile.
/// `set` is set 1 of `device`, `nullDescriptor` is enabled, and no other thread writes an element
/// of it meanwhile.
unsafe fn fill(
device: &ash::Device,
set: vk::DescriptorSet,
sampled: u32,
plain: vk::Sampler,
compare: vk::Sampler,
) {
let sampled = vec![
vk::DescriptorImageInfo::default()
.image_layout(vk::ImageLayout::SHADER_READ_ONLY_OPTIMAL);
sampled as usize
SAMPLED_ELEMENTS as usize
];
let storage = vec![
vk::DescriptorImageInfo::default().image_layout(vk::ImageLayout::GENERAL);
+14 -5
View File
@@ -43,7 +43,7 @@ use crate::copy_out;
use crate::counters::Metric;
use crate::device::Core;
use crate::encoder::Resource;
use crate::error::{Error, Gap, Refusal, TextureBytesCause};
use crate::error::{ChromaPairsGap, Error, Gap, Refusal, TextureBytesCause};
use crate::fence::Fence;
use crate::hazard::Access;
use crate::indirect::{reset_regions, IndirectCommandBuffer};
@@ -1892,12 +1892,15 @@ impl BufferCopy {
///
/// Metal's validation stops an offset or a row stride of a format of single texels that is no
/// whole number of its texels, rows or images closer than the region's, and a region past the
/// buffer's end ([`Refusal::BufferCopyLayout`]). A copy command in the floor further takes an
/// offset of whole texel blocks, a multiple of 4 for a depth or stencil aspect, for each image,
/// and a row stride of whole blocks ([`Gap::BufferCopyAlignment`]).
/// buffer's end ([`Refusal::BufferCopyLayout`]), but takes a `GBGR422` or `BGRG422` region's rows
/// closer than the region's (the conformance case `chroma-pair-copies`, an Apple M3 Max), which
/// is a gap ([`Gap::ChromaPairsUse`] of [`ChromaPairsGap::CloseRows`]). A copy command in the
/// floor further takes an offset of whole texel blocks, a multiple of 4 for a depth or stencil
/// aspect, for each image, and a row stride of whole blocks ([`Gap::BufferCopyAlignment`]).
///
/// Err: [`Gap::TextureBytes`]; [`Refusal::TextureRegion`];
/// [`Refusal::BufferCopyLayout`]; [`Gap::BufferCopyAlignment`]; [`Refusal::AliasingCopy`].
/// [`Refusal::BufferCopyLayout`]; [`Gap::ChromaPairsUse`]; [`Gap::BufferCopyAlignment`];
/// [`Refusal::AliasingCopy`].
pub(crate) fn buffer_copy(
texture: &Side<'_>,
at: TexturePlace,
@@ -1961,8 +1964,14 @@ pub(crate) fn buffer_copy(
if single && (offset % bytes != 0 || (rows > 1 && bytes_per_row % bytes != 0)) {
return Err(refused());
}
let pairs = matches!(pixel_format, PixelFormat::GBGR422 | PixelFormat::BGRG422);
let image_span = match rows {
1 => Some(row),
_ if bytes_per_row < row && pairs => {
return Err(Error::Unsupported(Gap::ChromaPairsUse {
cause: ChromaPairsGap::CloseRows,
}));
}
_ if bytes_per_row < row => return Err(refused()),
_ => (rows - 1)
.checked_mul(bytes_per_row)
-6
View File
@@ -59,12 +59,6 @@ impl Block {
Block { claim }
}
/// Returns capture/replay address metadata for this block (if supported).
pub fn capture_info(&self) -> Option<memory::BlockCaptureInfo> {
let (core, block) = self.held().ok()?;
core.pool.capture_info(&block.memory)
}
/// Whether the block is of `core`'s device.
pub(crate) fn is_of(&self, core: &Arc<Core>) -> bool {
Weak::as_ptr(&self.claim.core) == Arc::as_ptr(core)
+10 -5
View File
@@ -353,6 +353,10 @@ pub(crate) struct Gpu {
/// A texture over a Managed buffer's device copy in an image of its own is kept: the submit
/// thread looks for the copies in it owes (`crate::over::ManagedOvers`).
pub(crate) managed: bool,
/// It has nothing for the GPU ([`is_empty`](Self::is_empty)) and took a Managed buffer's
/// copy-in (`crate::capture`), which is then its submission: set by the submit thread as its
/// group goes. The copy's GPU run is the runtime's own, so its stages count none ([`retire`]).
pub(crate) copy_in_only: bool,
/// The images of released textures whose copies back the commands make, kept until the
/// command buffer retires.
pub(crate) images: Vec<Arc<Image>>,
@@ -504,6 +508,7 @@ impl CommandBuffer {
kept,
ring: Writes::default(),
managed: false,
copy_in_only: false,
images: Vec::new(),
fences: Fences::default(),
executed: Vec::new(),
@@ -1629,10 +1634,6 @@ impl Building {
self.tally.count(metric);
}
pub(crate) fn count_by(&mut self, metric: Metric, count: u64) {
self.tally.count_by(metric, count);
}
/// Copies `bytes` into the parameter ring, returning their address.
pub(crate) fn write_ring(&mut self, bytes: &[u8]) -> Result<u64, Error> {
Ok(self.write_ring_placed(bytes)?.address)
@@ -2124,7 +2125,10 @@ pub(crate) fn retire(
state.times.gpu_end = end;
inner.queue.last_end.fetch_max(end, Relaxed);
}
let stages = (gpu_times.filter(|_| error.is_none()))
// One whose submission was a copy-in it took counts no stages: the copy's GPU run is the
// runtime's own (`Metrics::runtime_command_buffer_gpu_nanos`), and its handlers wait for
// that run, not for a GPU end of its own.
let stages = (gpu_times.filter(|_| error.is_none() && !gpu.copy_in_only))
.map(|(start, end)| (state.times.kernel_end, start, end));
state.status = match error {
Some(_) => CommandBufferStatus::Error,
@@ -2141,6 +2145,7 @@ pub(crate) fn retire(
mut kept,
ring,
managed: _,
copy_in_only: _,
images,
fences,
executed,
+25 -14
View File
@@ -170,36 +170,47 @@ impl Done {
/// Waits until the progress semaphore reaches `value`, a value [`Work::flush`] gave: once
/// what that batch carries has completed.
///
/// `vkWaitSemaphores` fails with `VK_ERROR_DEVICE_LOST`, or for want of memory or with
/// `VK_ERROR_UNKNOWN`, which say nothing of the batch: it stays pending, and what it carries
/// may still write after the call returns. Such a call is made again ([`wait_through`]) until
/// it succeeds or the device is lost, so no caller returns while that batch may still run on
/// a live device: a restoring make's write-back of the host's bytes among them
/// (`crate::texture`). A lasting failure on a live device so waits.
///
/// Err: [`Error::Vulkan`] (`VK_ERROR_DEVICE_LOST`) where the device is lost first.
///
/// [`Work::flush`]: crate::submit::Work::flush
pub(crate) fn wait(&self, core: &Core, value: u64) -> Result<(), Error> {
let lost = Error::Vulkan {
call: "vkWaitSemaphores",
result: vk::Result::ERROR_DEVICE_LOST,
};
let semaphores = [self.progress];
let values = [value];
let wait = vk::SemaphoreWaitInfo::default()
.semaphores(&semaphores)
.values(&values);
loop {
let mut reached = false;
wait_through(core, || loop {
// SAFETY: the progress semaphore is the device's, live while the core is.
match unsafe {
core.device
.wait_semaphores(&wait, LOSS_POLL.as_nanos() as u64)
} {
Ok(()) => return Ok(()),
// A lost device's pending batches never signal: the work side ends them.
Err(vk::Result::TIMEOUT) if core.work.lock().lost() => return Err(lost),
Err(vk::Result::TIMEOUT) => {}
Err(result) => {
return Err(Error::Vulkan {
call: "vkWaitSemaphores",
result,
})
Ok(()) => {
reached = true;
return Ok(());
}
// A lost device's pending batches never signal: the work side ends them.
Err(vk::Result::TIMEOUT) if core.work.lock().lost() => {
return Err(vk::Result::ERROR_DEVICE_LOST)
}
Err(vk::Result::TIMEOUT) => {}
Err(result) => return Err(result),
}
});
match reached {
true => Ok(()),
false => Err(Error::Vulkan {
call: "vkWaitSemaphores",
result: vk::Result::ERROR_DEVICE_LOST,
}),
}
}
+188 -43
View File
@@ -4,6 +4,7 @@
//! to its own; nothing turns them on or off.
use crate::pipeline::DispatchVariant;
use crate::shadow::Copied;
use crate::{MemoryClass, PixelFormat, TextureUsage};
use std::collections::VecDeque;
use std::sync::atomic::{AtomicU64, Ordering::Relaxed};
@@ -277,6 +278,8 @@ pub(crate) enum Metric {
RenderRecordsStale,
/// [`Metrics::word_contents`].
WordContents,
/// [`Metrics::depth_range_twins`].
DepthRangeTwins,
/// [`Metrics::creations_before_seed`].
CreationsBeforeSeed,
/// [`Metrics::cache_writes_dropped`].
@@ -289,10 +292,6 @@ pub(crate) enum Metric {
PipelineCacheWritesSkipped,
/// [`Metrics::ring_writes`].
RingWrites,
/// [`Metrics::multi_draw_calls`].
MultiDrawCalls,
/// [`Metrics::multi_draw_items`].
MultiDrawItems,
/// [`Metrics::pushes`].
Pushes,
/// [`Metrics::pushes_held`].
@@ -337,6 +336,10 @@ pub(crate) enum Metric {
SurfacesCopied,
/// [`Metrics::textures_in_place_over_imports`].
TexturesInPlaceOverImports,
/// [`Metrics::chroma_contents`].
ChromaContents,
/// [`Metrics::chroma_launches`].
ChromaLaunches,
/// [`Metrics::exported_blocks_addressed`].
ExportedBlocksAddressed,
/// [`Metrics::texture_clear_barriers`].
@@ -369,10 +372,18 @@ pub(crate) enum Metric {
SampleInterpolatingStates,
/// [`Metrics::rendering_interrupts`].
RenderingInterrupts,
/// [`Metrics::mesh_threadgroups_past_device`].
MeshThreadgroupsPastDevice,
/// [`Metrics::mesh_draws_launched`].
MeshDrawsLaunched,
/// [`Metrics::mesh_object_grids_whole`].
MeshObjectGridsWhole,
/// [`Metrics::mesh_object_grids_in_pieces`].
MeshObjectGridsInPieces,
}
/// The number of [`Metric`]s.
const METRICS: usize = Metric::RenderingInterrupts as usize + 1;
const METRICS: usize = Metric::MeshObjectGridsInPieces as usize + 1;
/// Every [`Metric`], in its order: each at its own index.
const METRIC_ORDER: [Metric; METRICS] = [
@@ -409,14 +420,13 @@ const METRIC_ORDER: [Metric; METRICS] = [
Metric::RenderRecordsRead,
Metric::RenderRecordsStale,
Metric::WordContents,
Metric::DepthRangeTwins,
Metric::CreationsBeforeSeed,
Metric::CacheWritesDropped,
Metric::PipelineCachesReplaced,
Metric::KernelMakesDropped,
Metric::PipelineCacheWritesSkipped,
Metric::RingWrites,
Metric::MultiDrawCalls,
Metric::MultiDrawItems,
Metric::Pushes,
Metric::PushesHeld,
Metric::BoundDispatches,
@@ -439,6 +449,8 @@ const METRIC_ORDER: [Metric; METRICS] = [
Metric::SurfacesInPlace,
Metric::SurfacesCopied,
Metric::TexturesInPlaceOverImports,
Metric::ChromaContents,
Metric::ChromaLaunches,
Metric::ExportedBlocksAddressed,
Metric::TextureClearBarriers,
Metric::AttachmentLoopReads,
@@ -455,6 +467,10 @@ const METRIC_ORDER: [Metric; METRICS] = [
Metric::SampleCopies,
Metric::SampleInterpolatingStates,
Metric::RenderingInterrupts,
Metric::MeshThreadgroupsPastDevice,
Metric::MeshDrawsLaunched,
Metric::MeshObjectGridsWhole,
Metric::MeshObjectGridsInPieces,
];
// Each metric of the order is at its own index.
@@ -490,11 +506,7 @@ impl Default for Tally {
impl Tally {
/// Counts one more of `metric`.
pub(crate) fn count(&mut self, metric: Metric) {
self.count_by(metric, 1);
}
pub(crate) fn count_by(&mut self, metric: Metric, count: u64) {
self.counts[metric as usize] += count;
self.counts[metric as usize] += 1;
self.counted |= 1 << metric as usize;
}
}
@@ -526,6 +538,8 @@ pub(crate) enum Gauge {
WordPipelines,
/// [`Gauges::word_texture_buffers`].
WordTextureBuffers,
/// [`Gauges::chroma_textures`].
ChromaTextures,
/// [`Gauges::kernel_entries`].
KernelEntries,
/// [`Gauges::render_contents`].
@@ -872,6 +886,7 @@ struct Atomics {
partial_variant_whole_grids: AtomicU64,
partial_variant_ragged_grids: AtomicU64,
translations_at_encode: AtomicU64,
translation_at_encode_nanos: AtomicU64,
translation_at_encode_max_nanos: AtomicU64,
extended_view_dispatches: AtomicU64,
level_field_commands: AtomicU64,
@@ -887,6 +902,7 @@ struct Atomics {
render_records_read: AtomicU64,
render_records_stale: AtomicU64,
word_contents: AtomicU64,
depth_range_twins: AtomicU64,
creations_before_seed: AtomicU64,
pipeline_cache_looks_skipped: AtomicU64,
pipeline_cache_lock_waits: AtomicU64,
@@ -897,8 +913,6 @@ struct Atomics {
kernel_makes_dropped: AtomicU64,
pipeline_cache_writes_skipped: AtomicU64,
ring_writes: AtomicU64,
multi_draw_calls: AtomicU64,
multi_draw_items: AtomicU64,
pushes: AtomicU64,
pushes_held: AtomicU64,
bound_dispatches: AtomicU64,
@@ -925,6 +939,11 @@ struct Atomics {
over_unkept_by_cause: [AtomicU64; OVER_CAUSES],
attachment_read_copies: AtomicU64,
attachment_read_copy_bytes: AtomicU64,
attachment_read_copy_bytes_own_pixel: AtomicU64,
attachment_read_copy_bytes_whole_texture: AtomicU64,
attachment_read_copy_bytes_first_in_pass: AtomicU64,
attachment_read_copy_bytes_after_barrier: AtomicU64,
attachment_read_copy_bytes_beyond_held: AtomicU64,
resolve_copies: AtomicU64,
resolve_copy_bytes: AtomicU64,
plane_copies_in: AtomicU64,
@@ -957,6 +976,8 @@ struct Atomics {
surfaces_in_place: AtomicU64,
surfaces_copied: AtomicU64,
textures_in_place_over_imports: AtomicU64,
chroma_contents: AtomicU64,
chroma_launches: AtomicU64,
exported_blocks_addressed: AtomicU64,
surface_waits: AtomicU64,
surface_wait_nanos: AtomicU64,
@@ -982,6 +1003,10 @@ struct Atomics {
sample_copies: AtomicU64,
sample_interpolating_states: AtomicU64,
rendering_interrupts: AtomicU64,
mesh_threadgroups_past_device: AtomicU64,
mesh_draws_launched: AtomicU64,
mesh_object_grids_whole: AtomicU64,
mesh_object_grids_in_pieces: AtomicU64,
/// Each [`Part`]'s calls, at its index: their count, bytes, total and longest nanoseconds,
/// and those over each of [`OVER_NANOS`].
parts: [[AtomicU64; 7]; PARTS],
@@ -998,6 +1023,7 @@ struct Atomics {
kernel_variants: AtomicU64,
word_pipelines: AtomicU64,
word_texture_buffers: AtomicU64,
chroma_textures: AtomicU64,
kernel_entries: AtomicU64,
render_contents: AtomicU64,
attachment_views: AtomicU64,
@@ -1161,14 +1187,13 @@ impl Counters {
Metric::RenderRecordsRead => &a.render_records_read,
Metric::RenderRecordsStale => &a.render_records_stale,
Metric::WordContents => &a.word_contents,
Metric::DepthRangeTwins => &a.depth_range_twins,
Metric::CreationsBeforeSeed => &a.creations_before_seed,
Metric::CacheWritesDropped => &a.cache_writes_dropped,
Metric::PipelineCachesReplaced => &a.pipeline_caches_replaced,
Metric::KernelMakesDropped => &a.kernel_makes_dropped,
Metric::PipelineCacheWritesSkipped => &a.pipeline_cache_writes_skipped,
Metric::RingWrites => &a.ring_writes,
Metric::MultiDrawCalls => &a.multi_draw_calls,
Metric::MultiDrawItems => &a.multi_draw_items,
Metric::Pushes => &a.pushes,
Metric::PushesHeld => &a.pushes_held,
Metric::BoundDispatches => &a.bound_dispatches,
@@ -1191,6 +1216,8 @@ impl Counters {
Metric::SurfacesInPlace => &a.surfaces_in_place,
Metric::SurfacesCopied => &a.surfaces_copied,
Metric::TexturesInPlaceOverImports => &a.textures_in_place_over_imports,
Metric::ChromaContents => &a.chroma_contents,
Metric::ChromaLaunches => &a.chroma_launches,
Metric::ExportedBlocksAddressed => &a.exported_blocks_addressed,
Metric::TextureClearBarriers => &a.texture_clear_barriers,
Metric::AttachmentLoopReads => &a.attachment_loop_reads,
@@ -1207,6 +1234,10 @@ impl Counters {
Metric::SampleCopies => &a.sample_copies,
Metric::SampleInterpolatingStates => &a.sample_interpolating_states,
Metric::RenderingInterrupts => &a.rendering_interrupts,
Metric::MeshThreadgroupsPastDevice => &a.mesh_threadgroups_past_device,
Metric::MeshDrawsLaunched => &a.mesh_draws_launched,
Metric::MeshObjectGridsWhole => &a.mesh_object_grids_whole,
Metric::MeshObjectGridsInPieces => &a.mesh_object_grids_in_pieces,
}
}
@@ -1630,10 +1661,12 @@ impl Counters {
answer
}
/// A make at encode that took `nanos` nanoseconds ([`Metrics::translations_at_encode`]).
/// A make at encode that took `nanos` nanoseconds ([`Metrics::translations_at_encode`],
/// [`Metrics::translation_at_encode_nanos`]).
pub(crate) fn translation_at_encode(&self, nanos: u64) {
let a = &self.atomics;
a.translations_at_encode.fetch_add(1, Relaxed);
a.translation_at_encode_nanos.fetch_add(nanos, Relaxed);
a.translation_at_encode_max_nanos.fetch_max(nanos, Relaxed);
}
@@ -1748,14 +1781,26 @@ impl Counters {
kinds.get(from..).unwrap_or_default().to_vec()
}
/// `copies` more copies of attachments' images into their shadows, of `bytes`
/// `copies` more copies of attachments' images into their shadows, of `copied`'s bytes
/// ([`Metrics::attachment_read_copies`], [`Metrics::attachment_read_copy_bytes`]), which
/// count in [`Metrics::bytes_copied`] too.
pub(crate) fn attachment_read_copied(&self, copies: u64, bytes: u64) {
/// count in [`Metrics::bytes_copied`] too, and parted by read and by when they came
/// ([`Metrics::attachment_read_copy_bytes_own_pixel`] and the fields beside it).
pub(crate) fn attachment_read_copied(&self, copies: u64, copied: &Copied) {
let a = &self.atomics;
let bytes = copied.bytes();
a.attachment_read_copies.fetch_add(copies, Relaxed);
a.attachment_read_copy_bytes.fetch_add(bytes, Relaxed);
a.bytes_copied.fetch_add(bytes, Relaxed);
a.attachment_read_copy_bytes_own_pixel
.fetch_add(copied.own_pixel, Relaxed);
a.attachment_read_copy_bytes_whole_texture
.fetch_add(copied.whole_texture, Relaxed);
a.attachment_read_copy_bytes_first_in_pass
.fetch_add(copied.first_in_pass, Relaxed);
a.attachment_read_copy_bytes_after_barrier
.fetch_add(copied.after_barrier, Relaxed);
a.attachment_read_copy_bytes_beyond_held
.fetch_add(copied.beyond_held, Relaxed);
}
/// A copy between a marked surface plane and its stand-in, of `bytes`, into the stand-in
@@ -2011,6 +2056,7 @@ impl Counters {
Gauge::KernelVariants => &a.kernel_variants,
Gauge::WordPipelines => &a.word_pipelines,
Gauge::WordTextureBuffers => &a.word_texture_buffers,
Gauge::ChromaTextures => &a.chroma_textures,
Gauge::KernelEntries => &a.kernel_entries,
Gauge::RenderContents => &a.render_contents,
Gauge::AttachmentViews => &a.attachment_views,
@@ -2272,6 +2318,7 @@ impl Counters {
partial_variant_whole_grids: a.partial_variant_whole_grids.load(Relaxed),
partial_variant_ragged_grids: a.partial_variant_ragged_grids.load(Relaxed),
translations_at_encode: a.translations_at_encode.load(Relaxed),
translation_at_encode_nanos: a.translation_at_encode_nanos.load(Relaxed),
translation_at_encode_max_nanos: a.translation_at_encode_max_nanos.load(Relaxed),
extended_view_dispatches: a.extended_view_dispatches.load(Relaxed),
level_field_commands: a.level_field_commands.load(Relaxed),
@@ -2282,6 +2329,7 @@ impl Counters {
render_records_read: a.render_records_read.load(Relaxed),
render_records_stale: a.render_records_stale.load(Relaxed),
word_contents: a.word_contents.load(Relaxed),
depth_range_twins: a.depth_range_twins.load(Relaxed),
creations_before_seed: a.creations_before_seed.load(Relaxed),
pipeline_cache_looks_skipped: a.pipeline_cache_looks_skipped.load(Relaxed),
pipeline_cache_lock_waits: a.pipeline_cache_lock_waits.load(Relaxed),
@@ -2293,8 +2341,6 @@ impl Counters {
pipeline_cache_writes_skipped: a.pipeline_cache_writes_skipped.load(Relaxed),
cache_bytes_written: a.cache_bytes_written.load(Relaxed),
ring_writes: a.ring_writes.load(Relaxed),
multi_draw_calls: a.multi_draw_calls.load(Relaxed),
multi_draw_items: a.multi_draw_items.load(Relaxed),
pushes: a.pushes.load(Relaxed),
pushes_held: a.pushes_held.load(Relaxed),
bound_dispatches: a.bound_dispatches.load(Relaxed),
@@ -2357,6 +2403,21 @@ impl Counters {
over_copies_unkept_kind_image_memory: unkept(OverCause::ImageMemory),
attachment_read_copies: a.attachment_read_copies.load(Relaxed),
attachment_read_copy_bytes: a.attachment_read_copy_bytes.load(Relaxed),
attachment_read_copy_bytes_own_pixel: a
.attachment_read_copy_bytes_own_pixel
.load(Relaxed),
attachment_read_copy_bytes_whole_texture: a
.attachment_read_copy_bytes_whole_texture
.load(Relaxed),
attachment_read_copy_bytes_first_in_pass: a
.attachment_read_copy_bytes_first_in_pass
.load(Relaxed),
attachment_read_copy_bytes_after_barrier: a
.attachment_read_copy_bytes_after_barrier
.load(Relaxed),
attachment_read_copy_bytes_beyond_held: a
.attachment_read_copy_bytes_beyond_held
.load(Relaxed),
resolve_copies: a.resolve_copies.load(Relaxed),
resolve_copy_bytes: a.resolve_copy_bytes.load(Relaxed),
plane_copies_in: a.plane_copies_in.load(Relaxed),
@@ -2389,6 +2450,8 @@ impl Counters {
surfaces_in_place: a.surfaces_in_place.load(Relaxed),
surfaces_copied: a.surfaces_copied.load(Relaxed),
textures_in_place_over_imports: a.textures_in_place_over_imports.load(Relaxed),
chroma_contents: a.chroma_contents.load(Relaxed),
chroma_launches: a.chroma_launches.load(Relaxed),
exported_blocks_addressed: a.exported_blocks_addressed.load(Relaxed),
surface_waits: a.surface_waits.load(Relaxed),
surface_wait_nanos: a.surface_wait_nanos.load(Relaxed),
@@ -2416,6 +2479,10 @@ impl Counters {
sample_copies: a.sample_copies.load(Relaxed),
sample_interpolating_states: a.sample_interpolating_states.load(Relaxed),
rendering_interrupts: a.rendering_interrupts.load(Relaxed),
mesh_threadgroups_past_device: a.mesh_threadgroups_past_device.load(Relaxed),
mesh_draws_launched: a.mesh_draws_launched.load(Relaxed),
mesh_object_grids_whole: a.mesh_object_grids_whole.load(Relaxed),
mesh_object_grids_in_pieces: a.mesh_object_grids_in_pieces.load(Relaxed),
takes: part(Part::Take),
take_lock_waits: part(Part::TakeLock),
take_makes: part(Part::TakeMake),
@@ -2470,6 +2537,7 @@ impl Counters {
kernel_variants: a.kernel_variants.load(Relaxed),
word_pipelines: a.word_pipelines.load(Relaxed),
word_texture_buffers: a.word_texture_buffers.load(Relaxed),
chroma_textures: a.chroma_textures.load(Relaxed),
kernel_entries: a.kernel_entries.load(Relaxed),
render_contents: a.render_contents.load(Relaxed),
attachment_views: a.attachment_views.load(Relaxed),
@@ -2649,7 +2717,11 @@ pub struct Metrics {
/// [`commit_to_scheduled`](Self::commit_to_scheduled); 0 where the GPU start is placed before
/// the kernel end, as for one that presents, scheduled once its call returned. Counted on the
/// completion thread as each retires, before its handlers run; one that ends with an error,
/// or completes without GPU times, counts none here or in the two below.
/// or completes without GPU times, counts none here or in the two below, and nor does one
/// with nothing for the GPU whose submission is a Managed buffer's copy-in: the copy's GPU run
/// is the runtime's own
/// ([`runtime_command_buffer_gpu_nanos`](Self::runtime_command_buffer_gpu_nanos)), and its
/// handlers wait for it.
pub scheduled_to_gpu_start: [u64; STAGE_BUCKETS],
/// The spans [`scheduled_to_gpu_start`](Self::scheduled_to_gpu_start) counts, summed, in
/// nanoseconds.
@@ -2899,7 +2971,8 @@ pub struct Metrics {
/// nanoseconds; a maximum since the device was made.
pub first_use_variant_wait_max_nanos: u64,
/// Of the [`first_use_waits`](Self::first_use_waits), those for a render content's
/// line-class pipeline, made by its first draw of lines.
/// line-class pipeline: its first draw of lines, which made it, and each draw of lines that
/// met that make in flight on another thread and waited for it.
pub first_use_line_waits: u64,
/// The nanoseconds of the [`first_use_line_waits`](Self::first_use_line_waits), in total.
pub first_use_line_wait_nanos: u64,
@@ -2907,7 +2980,8 @@ pub struct Metrics {
/// a maximum since the device was made.
pub first_use_line_wait_max_nanos: u64,
/// Of the [`first_use_waits`](Self::first_use_waits), those for a render content's
/// point-class pipeline, made by its first draw of points.
/// point-class pipeline: its first draw of points, which made it, and each draw of points that
/// met that make in flight on another thread and waited for it.
pub first_use_point_waits: u64,
/// The nanoseconds of the [`first_use_point_waits`](Self::first_use_point_waits), in total.
pub first_use_point_wait_nanos: u64,
@@ -2915,8 +2989,9 @@ pub struct Metrics {
/// nanoseconds; a maximum since the device was made.
pub first_use_point_wait_max_nanos: u64,
/// Of the [`first_use_waits`](Self::first_use_waits), those for a render content's pipeline
/// under the depth clip mode `Clamp` or the triangle fill mode `Lines`, made by its first draw
/// under them.
/// under the depth clip mode `Clamp` or the triangle fill mode `Lines`: its first draw under
/// them, which made it, and each draw under them that met that make in flight on another
/// thread and waited for it.
pub first_use_raster_waits: u64,
/// The nanoseconds of the [`first_use_raster_waits`](Self::first_use_raster_waits), in total.
pub first_use_raster_wait_nanos: u64,
@@ -3050,22 +3125,34 @@ pub struct Metrics {
/// Translations made at encode, on the encoding thread, which the draw or dispatch that needs
/// one waits for: each the make of a module or content the state's creation did not make,
/// whether the translator lowers it or the cache directory holds its lowering, and whether it
/// is made or refused. Four makes count: an observing kernel's partial-threadgroups variant
/// is made or refused. Six makes count: an observing kernel's partial-threadgroups variant
/// on emulated SIMD groups (`KernelVariant::EmulatedPartialThreadgroups`) that a dispatch
/// lowers because no
/// [`ComputePipelineState::prepare_dispatch`](crate::ComputePipelineState::prepare_dispatch)
/// of its shape lowered it first; a compute state's content for a dispatch's buffers bound
/// at a multiple of 4 below their alignment or its 8-bit sRGB textures' UNORM twins; a
/// render state's content for a draw's buffers bound at a multiple of 4 below their
/// alignment or its 8-bit sRGB textures' UNORM twins; and a render state's content for a pass it does not render into as made (a
/// colour attachment the pass lacks, or a fetched colour in a 2D array). Each is made once and
/// kept in the device's map of contents, or with its content, so a reuse counts nothing; a
/// content the map forgot counts again when it is made again. A consumer whose pre-pass
/// prepares every dispatch reads none of the first kind; the other three have no pre-pass.
/// alignment or its 8-bit sRGB textures' UNORM twins; a render state's content for a pass it
/// does not render into as made (a colour attachment the pass lacks, or a fetched colour in a
/// 2D array); a compute or render state's content for the 4:2:2 textures a dispatch or draw
/// reaches ([`chroma_contents`](Self::chroma_contents)); and a render content's depth range
/// twin, for a draw under a viewport depth range past `[0, 1]` that reads the depth
/// ([`depth_range_twins`](Self::depth_range_twins)). Each is made once and kept in the
/// device's map of contents, or with its content, so a reuse counts nothing; a content the map
/// forgot counts again when it is made again. A consumer whose pre-pass prepares every
/// dispatch reads none of the first kind; the other five have no pre-pass.
/// No Metal counterpart: Metal compiles a state whole when it is made.
pub translations_at_encode: u64,
/// The longest of those makes, in nanoseconds of [`host_time`](crate::host_time); a maximum
/// since the device was made, so the difference of two reads does not apply to it.
/// The nanoseconds of [`host_time`](crate::host_time) the
/// [`translations_at_encode`](Self::translations_at_encode) took, in total, each from its
/// start to its end on the encoding thread that made it, made or refused. A sum, so unlike
/// [`translation_at_encode_max_nanos`](Self::translation_at_encode_max_nanos) the difference
/// of two reads is the time of the makes between them. No Metal counterpart: Metal compiles a
/// state whole when it is made.
pub translation_at_encode_nanos: u64,
/// The longest of the [`translations_at_encode`](Self::translations_at_encode), in nanoseconds
/// of [`host_time`](crate::host_time); a maximum since the device was made, so the difference
/// of two reads does not apply to it.
pub translation_at_encode_max_nanos: u64,
/// `vkAllocateMemory` and `vkFreeMemory` calls made ahead of need, off the consumer's calls:
/// the block-maker thread's (the runtime's fixed-size internals, the pool's units, and the
@@ -3177,6 +3264,11 @@ pub struct Metrics {
/// ([`Gauges::word_pipelines`]). Only a device that holds some format's texture buffer as words
/// makes them.
pub word_contents: u64,
/// Depth range twins made: render contents lowered again with the vertex function folding
/// the viewport's depth range into its position, for draws under a range past `[0, 1]` that
/// reads the depth (`RenderCommandEncoder::set_viewport`), each at the first such draw of
/// its content, its time in [`translations_at_encode`](Self::translations_at_encode).
pub depth_range_twins: u64,
/// `VkPipeline` creations that went through the device's empty pipeline cache while the
/// reaper read and took in the device's blob ([`DeviceOptions::pipeline_cache_dir`]): each
/// compiled without the blob's data, and those pipelines are not in this run's blob, so a
@@ -3236,10 +3328,6 @@ pub struct Metrics {
/// its dispatch region at 256 bytes, more than 8 at 128), and each `set_bytes` copy, a render
/// encoder's too.
pub ring_writes: u64,
/// Recorded multi-draw indirect calls.
pub multi_draw_calls: u64,
/// Metal draws submitted by those indirect calls, excluding the direct heads.
pub multi_draw_items: u64,
/// `vkCmdPushConstants` recorded: a draw's or a dispatch's push bytes, where the command
/// buffer did not already hold them.
pub pushes: u64,
@@ -3296,6 +3384,32 @@ pub struct Metrics {
pub attachment_read_copies: u64,
/// The bytes of those copies, which count in [`bytes_copied`](Self::bytes_copied) too.
pub attachment_read_copy_bytes: u64,
/// No Metal counterpart, as Metal makes no such copy (a cost of the copy form a device
/// without the attachment feedback loop takes): the part of
/// [`attachment_read_copy_bytes`](Self::attachment_read_copy_bytes) copied for reads at the
/// fragment's own pixel, through a slot the fragment function reads only there or a colour
/// attachment it fetches (`[[color(n)]]`), each the draw's scissor a pixel wider each way.
/// With [`attachment_read_copy_bytes_whole_texture`](Self::attachment_read_copy_bytes_whole_texture)
/// it sums to `attachment_read_copy_bytes`.
pub attachment_read_copy_bytes_own_pixel: u64,
/// No Metal counterpart, likewise: the part of
/// [`attachment_read_copy_bytes`](Self::attachment_read_copy_bytes) copied for reads through
/// any other slot, each of every level and layer its texture reaches.
pub attachment_read_copy_bytes_whole_texture: u64,
/// No Metal counterpart, likewise: the part of
/// [`attachment_read_copy_bytes`](Self::attachment_read_copy_bytes) a draw copied into a
/// shadow that had held nothing since its pass began: the pass's first copy into it. With
/// [`attachment_read_copy_bytes_after_barrier`](Self::attachment_read_copy_bytes_after_barrier)
/// and [`attachment_read_copy_bytes_beyond_held`](Self::attachment_read_copy_bytes_beyond_held)
/// it sums to `attachment_read_copy_bytes`.
pub attachment_read_copy_bytes_first_in_pass: u64,
/// No Metal counterpart, likewise: the part a draw copied into a shadow that a memory barrier
/// after draws, or a draw that reads a colour attachment at its own pixel after draws, left
/// holding nothing: all the draw reads of its image.
pub attachment_read_copy_bytes_after_barrier: u64,
/// No Metal counterpart, likewise: the part a draw copied into a shadow that held something,
/// of what it reads that the shadow did not hold.
pub attachment_read_copy_bytes_beyond_held: u64,
/// Copies of what a pass resolved into a texture's resolve image, which Metal does not make:
/// one for each resolve into a texture in place over a buffer whose linear image takes no
/// attachment usage, of the pass's render area into the buffer's bytes at the texture's pitch
@@ -3508,10 +3622,8 @@ pub struct Metrics {
/// while it was inside one, or inside the driver as one began. Its frees are an idle
/// allocation's, an imported or exported block's given back, a texture's allocation of its
/// own, a surface plane's import, a copy's staging buffer of its own, and one it made and
/// could not use. A driver may hold such a call until the free returns: on the NVIDIA cards
/// measured in Thunderbolt enclosures, about 1.1 ms per MiB of host-visible memory. A call
/// made during a free is counted as it enters the driver, one that a free began beside as it
/// returns.
/// could not use. A driver may hold such a call until the free returns. A call made during a
/// free is counted as it enters the driver, one that a free began beside as it returns.
pub submissions_during_frees: u64,
/// The nanoseconds of [`host_time`](crate::host_time) those calls took, from each call to its
/// return, in total: the time the driver may have held them behind the frees, with their own
@@ -3661,6 +3773,17 @@ pub struct Metrics {
/// copies in [`over_copies_host_memory_restore`](Self::over_copies_host_memory_restore). No
/// Metal counterpart: Metal's texture over a no-copy buffer is its bytes, with no move.
pub textures_in_place_over_imports: u64,
/// Contents lowered for a 4:2:2 texture (`GBGR422`, `BGRG422`): a compute or render state's
/// content made at the first dispatch or draw that binds one at a slot its functions read, or
/// that may reach one through a handle while one lives on the device
/// (`LoweringInputs::chroma_pairs`, `LoweringInputs::chroma_handles`), each a translation
/// and its pipelines' compiles at encode, counted also in
/// [`translations_at_encode`](Self::translations_at_encode). No Metal counterpart: Metal's
/// functions read the format's texels directly.
pub chroma_contents: u64,
/// Dispatches and draws that ran a content lowered for a 4:2:2 texture
/// ([`chroma_contents`](Self::chroma_contents)). No Metal counterpart.
pub chroma_launches: u64,
/// Exported blocks a public call handed out a device address of, each counted at the first:
/// [`Buffer::gpu_address`](crate::Buffer::gpu_address) answering an address in one, and a
/// texture buffer's storage element at an index over its bytes; the block's own handle states
@@ -3812,6 +3935,23 @@ pub struct Metrics {
/// moves of attachments to the feedback layout or of heap textures, and an execution's count
/// kernel. No Metal counterpart: a Metal render encoder is one pass.
pub rendering_interrupts: u64,
/// Mesh draws refused because an object or mesh threadgroup was within Metal's maximum for its
/// stage and past the state's on this device, which the stage's Vulkan limits hold
/// ([`Limit::MeshThreadgroupThreads`](crate::Limit::MeshThreadgroupThreads)): draws the guest
/// asked for that did not run. No Metal counterpart.
pub mesh_threadgroups_past_device: u64,
/// Mesh draws recorded of a state without an object function: each one task workgroup of the
/// state's launcher, which emits the mesh grid (`drawMeshThreadgroups:`, `drawMeshThreads:` and
/// `drawMeshThreadgroupsWithIndirectBuffer:`). A draw of an empty grid records nothing and is
/// not counted. No Metal counterpart.
pub mesh_draws_launched: u64,
/// Mesh draws recorded of a state with an object function whose object grid lay within the
/// device's task limits: one `vkCmdDrawMeshTasksEXT` of its counts. No Metal counterpart.
pub mesh_object_grids_whole: u64,
/// Mesh draws recorded of a state with an object function whose object grid was past the
/// device's task limits: one `vkCmdDrawMeshTasksIndirectEXT` of its pieces' records. No Metal
/// counterpart.
pub mesh_object_grids_in_pieces: u64,
/// Takes from the pool on the consumer's threads, each whole: a block of
/// [`Device::take_block`](crate::Device::take_block) and a texture block, carved from a free
/// range or from an allocation the take made ([`take_makes`](Self::take_makes)); their bytes
@@ -4049,6 +4189,11 @@ pub struct Gauges {
/// texture buffer through a handle runs its words twin
/// ([`word_pipelines`](Self::word_pipelines)).
pub word_texture_buffers: u64,
/// Textures of `GBGR422` or `BGRG422`, held as their bytes: while any lives, a draw or
/// dispatch of a stage that reaches a `float` colour texture through a handle
/// (`PipelineInterface::handle_float_images`) runs the content lowered under
/// `LoweringInputs::chroma_handles`.
pub chroma_textures: u64,
/// Entries of the device's map of compiled contents, compute and render, which holds at most
/// 1,024 and forgets the least recently used past them.
pub kernel_entries: u64,
+33 -31
View File
@@ -87,16 +87,19 @@ impl Device {
/// while its texture lives.
///
/// **The image is the texture Direct3D 11 made.** Its usage is what the texture's
/// [`bind_flags`](D3d11Plane::bind_flags) give, and nothing more: copied from and into, as
/// Direct3D 11 copies any texture of default usage; sampled for `D3D11_BIND_SHADER_RESOURCE`,
/// rendered for `D3D11_BIND_RENDER_TARGET` and storage for `D3D11_BIND_UNORDERED_ACCESS`; each
/// where the descriptor's format holds it and the import query
/// (`vkGetPhysicalDeviceImageFormatProperties2`) offers it. The one usage beside them, which
/// the description has no counterpart for, is the attachment feedback loop's, taken where the
/// descriptor's texture is a render target a draw may read in its own pass and the import
/// offers it with the rest. Vulkan's import of memory another API made states no rule for an image of other usage or
/// flags than the texture's; its rules for an import of Vulkan's own export ask the same
/// image (`VUID-VkMemoryDedicatedAllocateInfo-image-01876`).
/// [`bind_flags`](D3d11Plane::bind_flags) give, and nothing more, on every device: copied from
/// and into, as Direct3D 11 copies any texture of default usage; sampled for
/// `D3D11_BIND_SHADER_RESOURCE`, rendered for `D3D11_BIND_RENDER_TARGET` and storage for
/// `D3D11_BIND_UNORDERED_ACCESS`; each where the descriptor's format holds it and the import
/// query (`vkGetPhysicalDeviceImageFormatProperties2`) offers it, the handle importable and
/// among the image's compatible handle types. Vulkan's import of memory
/// another API made states no rule for an image of other usage or flags than the texture's;
/// its rules for an import of Vulkan's own export ask the same image
/// (`VUID-VkMemoryDedicatedAllocateInfo-image-01876`). So the image never takes the attachment
/// feedback loop's usage, which the description has no counterpart for: a draw that reads a
/// plane as an attachment of its own pass reads it through a copy into the plane's shadow, on
/// a device with the loop as on one without it, a copy Metal does not make
/// ([`Metrics::attachment_read_copies`](crate::Metrics::attachment_read_copies)).
///
/// **Views of another format.** The image is mutable where it lists more than its own
/// format, and lists at most two more, the two places it asks beyond the texture Direct3D 11
@@ -166,7 +169,8 @@ impl Device {
/// the descriptor's differ in their texel's bytes or Metal's view class; [`Limit::NoImport`]
/// of [`ImportHandle::D3d11Texture`] where the device does not enable
/// `VK_KHR_external_memory_win32` or its optimal images of the plane's formats and usage do
/// not import the handle (`vkGetPhysicalDeviceImageFormatProperties2`); [`Gap::SurfaceUsage`]
/// not import the handle (`vkGetPhysicalDeviceImageFormatProperties2`: the handle not
/// importable, or not among the image's compatible handle types); [`Gap::SurfaceUsage`]
/// for a usage the descriptor asks that the texture's bind flags do not give or the import
/// does not offer (`ShaderWrite` on a texture made without `D3D11_BIND_UNORDERED_ACCESS`);
/// [`Limit::TextureSize`] where a plane's extent is past the `maxExtent` the image format
@@ -273,9 +277,7 @@ impl Device {
held.contains(feature)
};
let imports = |usage: vk::ImageUsageFlags, list: &[vk::Format]| {
(import_query(core, format, usage, list)).is_ok_and(|(features, _)| {
features.contains(vk::ExternalMemoryFeatureFlags::IMPORTABLE)
})
(import_query(core, format, usage, list)).is_ok_and(|(external, _)| takes(&external))
};
// The usage the texture's bind flags give, no other.
let wanted = bound_usage(plane.bind_flags);
@@ -286,15 +288,9 @@ impl Device {
if usage.is_empty() || !imports(usage, &pair) {
return Err(Error::Limit(Limit::NoImport { handle }));
}
// With the feedback usage where the plane asks it and the import offers it with the
// rest, so a draw reads it as an attachment of its own pass through the loop; else
// through its shadow. The one usage Direct3D 11's description has no counterpart for,
// taken only where the plane's descriptor asks it.
let looped = usage | vk::ImageUsageFlags::ATTACHMENT_FEEDBACK_LOOP_EXT;
let usage = match plan.looped && imports(looped, &pair) {
true => looped,
false => usage,
};
// No feedback usage, which Direct3D 11's description has no counterpart for: a draw
// reads the plane as an attachment of its own pass through its shadow
// (`Device::surface_texture`).
let missing = plan.usage & !usage;
if !missing.is_empty() {
return Err(Error::Unsupported(Gap::SurfaceUsage {
@@ -458,17 +454,26 @@ impl Device {
}
}
/// Whether an image whose import query answers `external` imports a Direct3D 11 texture's handle:
/// the handle is importable, and among the handle types the image may be made with
/// (`compatibleHandleTypes`, which `VUID-VkImageCreateInfo-pNext-00990` asks of the handle types
/// the image is made with).
fn takes(external: &vk::ExternalMemoryProperties) -> bool {
(external.external_memory_features).contains(vk::ExternalMemoryFeatureFlags::IMPORTABLE)
&& (external.compatible_handle_types).contains(HANDLE)
}
/// What `vkGetPhysicalDeviceImageFormatProperties2` answers of an optimal 2D image of `format`
/// and `usage` imported from a Direct3D 11 texture, mutable and listing `list` where it is not
/// empty: the handle's external memory features and the image's properties with the handle
/// (its `maxExtent` the limit of such an image's extent, `VUID-VkImageCreateInfo-extent-02252`),
/// or the query's error.
/// empty: the handle's external memory properties (its features and the compatible handle types)
/// and the image's properties with the handle (its `maxExtent` the limit of such an image's
/// extent, `VUID-VkImageCreateInfo-extent-02252`), or the query's error.
pub(crate) fn import_query(
core: &Core,
format: vk::Format,
usage: vk::ImageUsageFlags,
list: &[vk::Format],
) -> Result<(vk::ExternalMemoryFeatureFlags, vk::ImageFormatProperties), vk::Result> {
) -> Result<(vk::ExternalMemoryProperties, vk::ImageFormatProperties), vk::Result> {
let (instance, physical) = (core.instance.vk(), core.physical);
let mut external = vk::PhysicalDeviceExternalImageFormatInfo::default().handle_type(HANDLE);
let mut listed = vk::ImageFormatListCreateInfo::default().view_formats(list);
@@ -489,8 +494,5 @@ pub(crate) fn import_query(
// the device's `VK_KHR_external_memory_win32`).
unsafe { instance.get_physical_device_image_format_properties2(physical, &info, &mut out) }?;
let properties = out.image_format_properties;
let features = external_out
.external_memory_properties
.external_memory_features;
Ok((features, properties))
Ok((external_out.external_memory_properties, properties))
}
+14 -65
View File
@@ -275,20 +275,16 @@ pub(crate) struct Core {
/// pipeline of a state whose functions can read a texture, which takes the loop's colour flag
/// at the state's make (`crate::render::Draws::reads_textures`).
pub(crate) feedback_loop: bool,
pub(crate) capture_replay: bool,
/// `VK_EXT_device_fault`'s command, where device creation enabled it (where the device lists
/// it): a lost device's fault report, read once, at its first loss (`crate::fault`).
pub(crate) fault: Option<ash::ext::device_fault::Device>,
/// `VK_EXT_mesh_shader`'s draw commands, where device creation enabled it with its stages
/// (`floor::MESH_EXTENSIONS`): a mesh render pipeline state's draws record them.
pub(crate) mesh: Option<ash::ext::mesh_shader::Device>,
/// `VK_EXT_device_generated_commands`' entry points, limits and the indirect command buffers'
/// caches, where device creation enabled it (`floor::Capabilities::indirect_commands`); an
/// indirect command buffer is refused without them.
pub(crate) indirect: Option<crate::indirect::Indirect>,
draw_indirect_limit: u32,
pub(crate) draw_indirect_first_instance: bool,
/// A draw may read an attachment of its own pass through a texture
/// (`floor::Capabilities::attachment_reads`): through the feedback loop where `feedback_loop`
/// holds, else through a copy of the image into its shadow (`crate::shadow`).
pub(crate) attachment_reads: bool,
/// Device creation enabled `linearColorAttachment` (`VK_NV_linear_color_attachment`, where
/// the device lists it): an opaque handle's surface plane whose format's `LINEAR` tiling
/// renders through `VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV` alone lies in place
@@ -327,7 +323,8 @@ pub(crate) struct Core {
#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))]
pub(crate) fail_wakes: std::sync::atomic::AtomicU32,
/// For the device tests: how many more host waits on what the GPU has pending (the device's
/// idle wait, an import's bind wait) fail as out of host memory, before the driver is called.
/// idle wait, an import's bind wait, a wait for a batch's progress value) fail as out of host
/// memory, before the driver is called.
#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))]
pub(crate) fail_waits: std::sync::atomic::AtomicU32,
/// For the device tests: where nonzero, the private arena's budget in place of the device's
@@ -468,9 +465,6 @@ pub(crate) struct Queues {
#[non_exhaustive]
#[derive(Clone, Default)]
pub struct DeviceOptions {
/// No Metal counterpart. Opt in to combining draws into a Vulkan indirect draw command
/// where the logical device enables `multiDrawIndirect`.
pub multi_draw_indirect: bool,
/// The consumer's hooks around each allocation of the pool: its map before any of its blocks
/// goes out, and its unmap before the allocation is freed. `None` where the consumer keeps no
/// mapping of its own.
@@ -654,6 +648,7 @@ impl Device {
mut maintenance8,
mut pipeline_robustness,
mut extended_dynamic_state,
mut mesh,
} = enabled_features;
// `sparseBinding` for imports over several dma-bufs (`Device::import_dma_bufs`), only where
// the device's queries offer that import: it changes no other path, as only that import
@@ -729,6 +724,9 @@ impl Device {
if enabled(ash::ext::extended_dynamic_state::NAME) {
features = features.push_next(&mut extended_dynamic_state);
}
if enabled(ash::ext::mesh_shader::NAME) {
features = features.push_next(&mut mesh);
}
// SAFETY: as for the floor check.
let listed = unsafe { vk_instance.enumerate_device_extension_properties(raw) }
.map_err(Error::vulkan("vkEnumerateDeviceExtensionProperties"))?;
@@ -835,6 +833,9 @@ impl Device {
.extensions
.contains(&ash::ext::device_fault::NAME))
.then(|| ash::ext::device_fault::Device::new(vk_instance, &device));
let mesh = (capabilities.extensions)
.contains(&ash::ext::mesh_shader::NAME)
.then(|| ash::ext::mesh_shader::Device::new(vk_instance, &device));
let sample_locations = (capabilities.extensions)
.contains(&ash::ext::sample_locations::NAME)
.then(|| {
@@ -932,13 +933,9 @@ impl Device {
ticks,
calibrated,
feedback_loop: capabilities.feedback_loop,
capture_replay: capabilities.buffer_device_address_capture_replay,
fault,
mesh,
indirect,
draw_indirect_limit: capabilities.draw_indirect_limit(options.multi_draw_indirect),
draw_indirect_first_instance: capabilities.features.core.draw_indirect_first_instance
== vk::TRUE,
attachment_reads: capabilities.attachment_reads,
linear_attachments: (capabilities.features.linear_attachment).linear_color_attachment
== vk::TRUE,
resolve_modes,
@@ -1241,42 +1238,6 @@ impl Device {
complete::lose(&self.shared.core, loss);
}
/// Whether Vulkan `bufferDeviceAddressCaptureReplay` is enabled on this device.
pub fn buffer_device_address_capture_replay(&self) -> bool {
self.shared.core.capture_replay
}
/// Waits non-destructively until all in-flight GPU work has completed and retired.
pub fn wait_idle(&self) -> Result<(), Error> {
let core = &self.shared.core;
if core.closed() {
return Err(Error::Quiesced);
}
// Wait for submitted command buffers to retire on the completion thread.
let deadline = Instant::now() + Duration::from_secs(10);
while core.pool.in_flight() > 0 && Instant::now() < deadline {
std::thread::sleep(Duration::from_millis(1));
}
// SAFETY: `device` is live and wait_idle synchronizes all host queues.
let _q = lock(&core.queues.runtime);
unsafe { core.device.device_wait_idle() }.map_err(Error::vulkan("vkDeviceWaitIdle"))?;
Ok(())
}
/// Replays a previously captured block at its exact Vulkan device address.
pub fn take_block_replayed(&self, capture: memory::BlockCaptureInfo) -> Result<Block, Error> {
let core = &self.shared.core;
if core.closed() {
return Err(Error::Quiesced);
}
let memory =
core.pool
.take_replayed(core, capture, crate::counters::Site::take(capture.class))?;
let info = memory.info();
let block = memory::Block::new(memory, Arc::clone(core));
Ok(Block::claim(core, info, block))
}
/// No Metal counterpart: takes a block of `class` memory of `len` bytes rounded up to 64 KiB
/// (to the device's `bufferImageGranularity` where that is larger), for the consumer to place
/// buffers in: a handle ([`Block`]) whose last drop gives it back. A block is a range of one
@@ -1398,12 +1359,6 @@ impl Device {
&self.shared.core
}
/// No Metal counterpart. The maximum number of draws in one Vulkan indirect draw command
/// with batching enabled, or zero when batching is unavailable or disabled.
pub fn draw_indirect_limit(&self) -> u32 {
self.core().draw_indirect_limit()
}
/// Gives up this handle where it is not the last, which ends nothing; the last comes back,
/// for the caller to drop once it holds no lock, which ends the device on its thread. A call
/// that holds a handle while another thread may drop the consumer's last one gives its own up
@@ -1729,9 +1684,7 @@ unsafe fn objects(
// SAFETY: the device is live.
let made = unsafe { Done::new(device) }.and_then(|mut done| {
// SAFETY: the device is live, with the floor's features.
let arrays = match unsafe {
Arrays::new(device, counters, (capabilities.attachment_reads, buffers))
} {
let arrays = match unsafe { Arrays::new(device, counters, buffers) } {
Ok(arrays) => arrays,
Err(error) => {
// SAFETY: the completion objects are unused.
@@ -1789,10 +1742,6 @@ pub(crate) struct EncoderLimits {
}
impl Core {
pub(crate) fn draw_indirect_limit(&self) -> u32 {
self.draw_indirect_limit
}
/// A digest of what the device enabled: its extensions, the consumer's features and the
/// translator's profile of the device (its features, properties and limits). Two devices of
/// one physical device opened with the same [`DeviceOptions`] have one; the stage keys and a
+64 -18
View File
@@ -6,15 +6,18 @@ use crate::bound::{Descriptor, NULL};
use crate::buffer::{Buffer, BufferInner, BufferObject};
use crate::coherence::Range;
use crate::command::{Building, CommandBuffer, Owed};
use crate::counters::Metric;
use crate::counters::{Gauge, Metric};
use crate::device::Core;
use crate::error::{Error, Gap, Limit, PartialThreadgroupsSite, Refusal, StageInKind};
use crate::error::{
ChromaPairsGap, Error, Gap, Limit, PartialThreadgroupsSite, Refusal, StageInKind,
};
use crate::fence::Fence;
use crate::floor;
use crate::function_table::VisibleFunctionTable;
use crate::hazard::{Access, Dependency};
use crate::indirect::IndirectCommandBuffer;
use crate::kept::{Handle, Lent, Uncounted};
use crate::kernel_map::Chroma;
use crate::memory::BlockId;
use crate::over::{self, Reached, Span};
use crate::pipeline::{
@@ -349,6 +352,10 @@ struct DispatchFacts {
/// buffer slot at a multiple of 4 below its argument's alignment ([`check_alignments`]),
/// found with the alignments.
variant: Option<Arc<Compiled>>,
/// Where the kernel reads a 4:2:2 texture, which the variant is lowered for
/// ([`Chroma`]): its slots bound to one, found with the alignments, and whether it may reach
/// one through a handle while one lives on the device, which each dispatch looks at again.
chroma: Chroma,
}
/// Which of its state's modules a dispatch runs.
@@ -1238,6 +1245,13 @@ impl ComputeCommandEncoder {
let inner = &state.compiled;
let max = inner.whole.interface.max_total_threads;
size_checked(&inner.whole.interface, size)?;
// A kernel that may reach a 4:2:2 texture through a handle runs its content for one while
// one lives on the device: a change of that decides the content again.
let handles = inner.whole.interface.handle_float_images
&& self.core.counters.live(Gauge::ChromaTextures) > 0;
if handles != self.facts.chroma.handles {
self.facts.aligned = false;
}
// Every module of a state is the same function, with the same arguments and alignments,
// so the whole module answers this check and the next, once after each change; a buffer
// bound at a multiple of 4 below its argument's alignment is the variant's below.
@@ -1318,25 +1332,51 @@ impl ComputeCommandEncoder {
return Err(element(slot, gap));
}
}
// The texture slots bound to a 4:2:2 texture, which only a content lowered for it reads
// as Metal's texels.
let mut slots = 0u128;
for &(slot, _) in &interface.textures {
if matches!(self.textures.get(slot as usize), Some(Some(t)) if t.chroma_pairs()) {
slots |= 1 << slot;
}
}
let chroma = Chroma {
slots: [slots, 0],
handles,
};
self.facts.chroma = chroma;
// The variant of those slots and of the buffers bound at a multiple of 4 below their
// argument's alignment, which holds each to what its accesses need, as it checks. A
// kernel the consumer compiled has none: its own module refuses such a buffer.
self.facts.variant = match (first, words) {
(None, 0) => None,
(first, words) => match state.variant(first.map_or(0, |_| srgb), words) {
Some(variant) => {
let variant = variant?;
check_alignments(&self.core, &self.slots, &variant.whole.interface, false)?;
Some(variant)
}
None => {
check_alignments(&self.core, &self.slots, interface, false)?;
match first {
Some((slot, gap)) => return Err(element(slot, gap)),
None => None,
// kernel the consumer compiled has none: its own module refuses such a buffer, and a
// 4:2:2 texture it would read.
self.facts.variant = match (first, words, chroma.any()) {
(None, 0, false) => None,
(first, words, _) => {
match state.variant(first.map_or(0, |_| srgb), words, chroma) {
Some(variant) => {
let variant = variant?;
check_alignments(
&self.core,
&self.slots,
&variant.whole.interface,
false,
)?;
Some(variant)
}
None => {
check_alignments(&self.core, &self.slots, interface, false)?;
if chroma.any() {
return Err(Error::Unsupported(Gap::ChromaPairsUse {
cause: ChromaPairsGap::CompiledFunction,
}));
}
match first {
Some((slot, gap)) => return Err(element(slot, gap)),
None => None,
}
}
}
},
}
};
// A texture declared written with no storage element, which the kernel may reach
// through its storage image beyond its slots.
@@ -1385,6 +1425,10 @@ impl ComputeCommandEncoder {
recording(&mut self.building).count(Metric::DispatchesWithoutEffects);
return Ok(());
}
// A dispatch of a content lowered for a 4:2:2 texture.
if variant.is_some() && self.facts.chroma.any() {
recording(&mut self.building).count(Metric::ChromaLaunches);
}
// What a kernel reads of a stage-in region the encoder never set is not established.
if inner.whole.interface.stage_in_region && self.stage_in_region.is_none() {
return Err(Error::Unsupported(Gap::NoStageInRegion));
@@ -2112,9 +2156,11 @@ impl Parameters {
| FieldValue::FetchedColor(_)
| FieldValue::RenderTargetArrayLength
| FieldValue::ViewportCount
| FieldValue::DepthRangeFold
| FieldValue::IndirectRange
| FieldValue::IndirectSequence
| FieldValue::IndirectBase => {}
| FieldValue::IndirectBase
| FieldValue::GroupCounts => {}
}
}
self.block_address = (interface.block_len > 0).then_some(interface.block_address);
+210 -32
View File
@@ -357,6 +357,18 @@ pub enum Refusal {
/// pipeline that is not a tessellation one, its validation off; Metal's validation stops a
/// draw of primitives with a tessellation pipeline).
PatchDraw,
/// A draw of primitives or patches, or an execution of an indirect command buffer's commands,
/// with a mesh render pipeline state
/// ([`Device::new_mesh_render_pipeline_state`](crate::Device::new_mesh_render_pipeline_state)),
/// whose functions only a mesh draw runs: Vulkan's vertex draws take no pipeline with a task or
/// mesh stage (`VUID-vkCmdDraw-stage-06481`); or a mesh draw
/// ([`RenderCommandEncoder::draw_mesh_threadgroups`](crate::RenderCommandEncoder::draw_mesh_threadgroups),
/// [`draw_mesh_threads`](crate::RenderCommandEncoder::draw_mesh_threads)) with a state of a
/// vertex function, which Vulkan's mesh draws take no pipeline of
/// (`VUID-vkCmdDrawMeshTasksEXT-stage-06480`).
///
/// Basis: ours (Metal's answer to such a draw is not measured).
MeshDraw,
/// A draw of patches while the encoder has no tessellation factor buffer
/// (`setTessellationFactorBuffer:offset:instanceStride:`).
///
@@ -450,14 +462,20 @@ pub enum Refusal {
},
/// A threadgroup of no threads, or of more than Metal's `maxTotalThreadsPerThreadgroup` for
/// the kernel (a required size's threads, where the descriptor requires one). One within it
/// and past the state's on this device is the device's [`Limit::ThreadgroupThreads`].
/// and past the state's on this device is the device's [`Limit::ThreadgroupThreads`]. A mesh
/// draw's object or mesh threadgroup likewise, of more than Metal's maximum for its stage
/// (`GraphicsState::max_total_threads_per_object_threadgroup` and its mesh sibling in the
/// translator: Metal's rule); one within it and past the state's on this device is
/// [`Limit::MeshThreadgroupThreads`].
///
/// Basis: metal-documented (a threadgroup's threads total at most the state's
/// `maxTotalThreadsPerThreadgroup`).
/// `maxTotalThreadsPerThreadgroup`, an object or mesh threadgroup's at most the state's
/// `maxTotalThreadsPerObjectThreadgroup` or `maxTotalThreadsPerMeshThreadgroup`).
ThreadgroupSize {
/// The threadgroup size asked for.
size: [u32; 3],
/// The state's `maxTotalThreadsPerThreadgroup`.
/// The state's `maxTotalThreadsPerThreadgroup`, or for a mesh draw its stage's maximum on
/// this device.
max: u32,
},
/// An imageblock size
@@ -810,6 +828,21 @@ pub enum Refusal {
/// The texture's pixel format.
pixel_format: PixelFormat,
},
/// A texture of `GBGR422` or `BGRG422` that breaks one of Metal's rules for the format, `rule`
/// naming which: a type other than 2D, an odd width, more than one level, or a view of one.
///
/// Basis: metal-measured (our probe on an Apple M3 Max, macOS 27.0.1: plain Metal asserts
/// "MTLPixelFormat422 requires even width", "MTLTextureDescriptor requests 4 mipmap levels,
/// but the MTLPixelFormat422 pixel format does not support mipmaps", and for a view "source
/// texture pixelFormat (MTLPixelFormatGBGR422) not castable"; the SDK's `MTLPixelFormat.h`:
/// "422 textures must have a width that is a multiple of 2, and can only be used for 2D
/// non-mipmap textures").
ChromaPairs {
/// The texture's pixel format.
pixel_format: PixelFormat,
/// The rule it breaks.
rule: ChromaPairsRule,
},
/// [`BlitCommandEncoder::copy_from_texture`](crate::BlitCommandEncoder::copy_from_texture)
/// between textures of two pixel formats, or of two sample counts.
///
@@ -1435,6 +1468,19 @@ pub enum Gap {
/// The pixel format asked for.
pixel_format: PixelFormat,
},
/// A texture of `GBGR422` or `BGRG422` asked for a use the runtime does not build, `cause`
/// naming it. Its image holds the texture's bytes as `R8G8_UNORM`, which only the functions
/// the runtime lowers for it read as Metal's texels (`LoweringInputs::chroma_pairs`): a
/// shader's write, a render pass's store and a swizzle would read or store the bytes
/// themselves, and a function compiled outside the runtime is not lowered for the texture.
///
/// Basis: ours (Metal's render pipelines refuse the formats as colour attachments, and the
/// runtime builds reads, samples, gathers and copies of them, but for a copy of rows closer
/// than the region's, `ChromaPairsGap::CloseRows`).
ChromaPairsUse {
/// The use not built.
cause: ChromaPairsGap,
},
/// [`BlitCommandEncoder::generate_mipmaps`](crate::BlitCommandEncoder::generate_mipmaps) of a
/// texture whose image the device's blits do not filter: its format query lacks blits from
/// or to the image's format, or its linear filtering, or the image holds the pixel format
@@ -1446,13 +1492,6 @@ pub enum Gap {
/// The texture's pixel format.
pixel_format: PixelFormat,
},
/// A sampler state whose minification or magnification filter is cubic. Not raised:
/// [`Device::new_sampler_state`](crate::Device::new_sampler_state) makes a `Cubic` filter
/// (`MTLSamplerMinMagFilterCubic`, Metal's undeclared raw value 2) and filters it as nearest.
/// The variant stays because a consumer names it.
///
/// Basis: ours (the runtime's choice of nearest for a value Metal does not document).
CubicSampler,
/// [`Texture::replace_region`](crate::Texture::replace_region),
/// [`Texture::get_bytes`](crate::Texture::get_bytes), a Managed texture's places or a blit
/// copy between a buffer and a texture
@@ -1846,8 +1885,12 @@ pub enum IndirectCommandsKind {
/// Command types other than plain draws alone (`MTLIndirectCommandTypeDraw`), indexed draws
/// alone (`MTLIndirectCommandTypeDrawIndexed`), patch draws alone
/// (`MTLIndirectCommandTypeDrawPatches`) or indexed patch draws alone
/// (`MTLIndirectCommandTypeDrawIndexedPatches`): mesh draws, or dispatches, which take other
/// command layouts; or two draw kinds in one buffer, as a command layout takes
/// (`MTLIndirectCommandTypeDrawIndexedPatches`): mesh draws
/// (`MTLIndirectCommandTypeDrawMeshThreadgroups`, `MTLIndirectCommandTypeDrawMeshThreads`),
/// which wait on commands that set their own pipeline state
/// ([`CommandPipelines`](Self::CommandPipelines)) and commands the CPU encodes, and then take a
/// command layout of their own; dispatches, which take another command layout; or two draw
/// kinds in one buffer, as a command layout takes
/// one draw token (`VUID-VkIndirectCommandsLayoutCreateInfoEXT-pTokens-11100`) and no form
/// found draws both kinds in command order at a bounded cost: two executions over the same
/// records reorder the commands, an execution of each command costs two a command, and indices
@@ -1947,7 +1990,7 @@ pub enum DrawInputCause {
/// a layer index the translator's variant drops (`RuntimeFact::RenderTargetArrayLength` with
/// `layer_dropped`). Metal's counterpart is the draw's state the fact stands for.
RuntimeFact {
/// The fact's name (`RuntimeFact::name`), such as `"ResourcePresence"`.
/// The fact's name (`RuntimeFact::name`), such as `"FlatGrid"`.
fact: &'static str,
},
/// An argument slot the encoder does not bind: a visible or intersection function table at a
@@ -1970,9 +2013,6 @@ pub enum DrawInputCause {
/// one whose use the translator states no device sampler for. Metal's counterpart is the
/// sampler the function's source declares.
ConstexprSampler,
/// A `constexpr sampler` of unnormalized coordinates (`coord::pixel`). Metal's counterpart is
/// the sampler the function's source declares.
UnnormalizedSampler,
/// A function's parameter block longer than one chunk of the runtime's parameter ring
/// (64 KiB). Metal's counterpart is the function's arguments, which Metal binds however many
/// there are.
@@ -2003,12 +2043,12 @@ pub enum KernelInputKind {
/// counterpart: it states no subgroup control.
StageFlags,
/// A fact of the module the encoder does not supply: a `RuntimeFact` the runtime does not
/// name, such as a resource's presence or a sampler's coordinates, or an address alignment of
/// a slot that is not a kernel's buffer or that is not a power of two, at the state's make.
/// name, or an address alignment of a slot that is not a kernel's buffer or that is not a power
/// of two, at the state's make.
/// Metal's counterpart is the dispatch's state the fact stands for: the bound resource's own
/// state.
RuntimeFact {
/// The fact's name (`RuntimeFact::name`), such as `"ResourcePresence"`.
/// The fact's name (`RuntimeFact::name`), such as `"FlatGrid"`.
fact: &'static str,
},
/// An argument slot the encoder does not bind: an intersection function table at a buffer
@@ -2095,8 +2135,12 @@ pub enum DrawKind {
/// mirrors the draw), or bounds past the device's viewport limits (`maxViewportDimensions`,
/// `viewportBoundsRange`), refused where it is set; or, at a draw, a depth range past
/// `[0, 1]` where the draw's pass has a depth attachment or its fragment function may read
/// `[[position]]`'s z or w. No Vulkan viewport maps clip space as it does. One that covers no
/// pixel draws nothing, as Metal's.
/// `[[position]]`'s z or w, and no depth range twin draws it: under the `Clamp` depth clip
/// mode, for a vertex function that writes `[[viewport_array_index]]` while the viewports set
/// have different ranges, for a vertex function the consumer compiled, or for a mesh draw
/// ([`RenderCommandEncoder::set_viewport`](crate::RenderCommandEncoder::set_viewport)). No
/// Vulkan viewport maps clip space as it does. One that covers no pixel draws nothing, as
/// Metal's.
Viewport,
/// A pipeline state whose colour, depth or stencil formats are not its pass's attachments',
/// or whose `rasterSampleCount` is not their sample count: Metal's validation stops such
@@ -2109,13 +2153,12 @@ pub enum DrawKind {
/// ([`RenderCommandEncoder::set_render_pipeline_state`](crate::RenderCommandEncoder::set_render_pipeline_state)).
AttachmentFormats,
/// A draw that binds a texture whose image the pass renders, where neither the attachment
/// feedback loop nor a copy into the image's shadow reads it: on a device without the
/// attachment reads (`floor::Capabilities::attachment_reads`), from the vertex function at the
/// feedback loop nor a copy into the image's shadow reads it: from the vertex function at the
/// rendered level and layer, written, of a depth or stencil attachment, of an image the device
/// takes neither the feedback usage nor a shadow for (its format's image, or in place over a
/// buffer its linear image), or of an image two attachments of the pass render; through a shadow, which holds
/// one layer, an attachment of a layered pass or a 3D texture's depth plane; and on any
/// device, a surface plane the pass renders in its stand-in, an optimal image of the
/// buffer its linear image), or of an image two attachments of the pass render; through a
/// shadow, which holds one layer, an attachment of a layered pass or a 3D texture's depth
/// plane; and a surface plane the pass renders in its stand-in, an optimal image of the
/// runtime's that holds what the pass renders until its end copies it into the plane (a plane
/// whose format the device's `LINEAR` tiling renders only beside other such planes, in a pass
/// that sets another attachment beside it or resolves into it).
@@ -2170,6 +2213,16 @@ pub enum DrawKind {
/// (`VUID-VkGraphicsPipelineCreateInfo-sampleLocationsEnable-01524`). Metal interpolates such a
/// varying at the sample's own position.
SamplePositions,
/// `drawMeshThreadgroupsWithIndirectBuffer:` through a mesh render pipeline state with an
/// object function
/// ([`RenderCommandEncoder::draw_mesh_threadgroups_indirect`](crate::RenderCommandEncoder::draw_mesh_threadgroups_indirect)):
/// its object grid is the GPU's to read, and one past the device's task limits
/// (`maxTaskWorkGroupCount` along an axis, `maxTaskWorkGroupTotalCount` in all) runs in pieces
/// whose number only the counts decide, which the runtime never reads on the host and no
/// command inside the pass can write. Metal draws it. The same grid drawn directly runs, and
/// so does an indirect draw of a state without an object function, whose launcher reads the
/// counts on the GPU.
IndirectObjectGrid,
}
/// What a render pass asks that the runtime does not build ([`Gap::RenderPass`]).
@@ -2190,8 +2243,9 @@ pub enum RenderPassKind {
/// A resolve the runtime does not build: into a resolve texture of another pixel format than
/// its attachment's (the format's sRGB twin among them), of more than one sample, or whose
/// level is not the attachment level's width and height; of an attachment of one sample; of
/// an extended-range, bfloat or YCbCr color attachment, whose image Vulkan's average would
/// read in its own encoding; or of a depth and a stencil attachment into two views
/// an extended-range color attachment but `BGR10_XR` and `BGRA10_XR` (whose codes average as
/// their values do), or a bfloat or YCbCr one, whose image Vulkan's average would read in its
/// own encoding; or of a depth and a stencil attachment into two views
/// (VUID-VkRenderingInfo-pDepthAttachment-06086).
Resolve,
/// A resolve into a texture made without `RenderTarget` usage (and not of Metal's unknown
@@ -2275,7 +2329,8 @@ pub enum RenderPassKind {
/// `setColorStoreAction:atIndex:` family.
StoreAction,
/// A `Clear` load action on an attachment whose format the runtime clears only through a
/// shader: an extended-range, bfloat or YCbCr format.
/// shader: an extended-range format but `BGR10_XR` and `BGRA10_XR`, or a bfloat or YCbCr
/// format.
ClearFormat,
/// A pass with no attachment wider or taller than the device's `maxFramebufferWidth` or
/// `maxFramebufferHeight`: Vulkan's rendering covers at most that
@@ -2318,6 +2373,43 @@ pub enum TextureViewKind {
TextureBuffer,
}
/// Which of Metal's rules for a `GBGR422` or `BGRG422` texture a descriptor or a view breaks
/// ([`Refusal::ChromaPairs`]).
#[non_exhaustive]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum ChromaPairsRule {
/// A texture type other than `Type2D`.
TextureType,
/// An odd width.
OddWidth,
/// More than one mipmap level.
Levels,
/// A view of the texture, of any format, type or range.
View,
}
/// What use of a `GBGR422` or `BGRG422` texture the runtime does not build
/// ([`Gap::ChromaPairsUse`]).
#[non_exhaustive]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum ChromaPairsGap {
/// `ShaderWrite` usage, or Metal's unknown usage, which the runtime takes as every usage.
ShaderWrite,
/// `RenderTarget` usage.
RenderTarget,
/// A swizzle other than each channel from itself.
Swizzle,
/// A draw or dispatch binds the texture at a slot a function compiled outside the runtime
/// reads, or, while one lives on the device, runs such a function that may reach a `float`
/// colour texture through a handle: no lowering for the texture made that function.
CompiledFunction,
/// A copy between a buffer and the texture of more than one row whose buffer rows are closer
/// together than the region's rows are long, which Metal takes (the source's rows then
/// overlap); one Vulkan copy region takes no row stride below its width
/// (`VUID-VkBufferImageCopy-bufferRowLength-09101`), and a region a row would express it.
CloseRows,
}
/// Why an observing kernel's partial-threadgroups variant does not run a grid that ends in
/// partial threadgroups ([`Gap::PartialThreadgroups`]). Metal has no counterpart: Metal runs every
/// partial threadgroup.
@@ -2401,6 +2493,32 @@ pub enum TextureBacking {
Drawable,
}
/// A Vulkan limit on a task or a mesh workgroup ([`Limit::MeshThreadgroupThreads`]), of the
/// stage the limit names: the task stage's for an object function, the mesh stage's for a mesh
/// function. No Metal counterpart.
#[non_exhaustive]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum WorkGroupLimit {
/// `maxTaskWorkGroupInvocations` or `maxMeshWorkGroupInvocations`.
Invocations,
/// `maxTaskWorkGroupSize[0]` or `maxMeshWorkGroupSize[0]`: the stage's workgroup runs its
/// threads in one row.
Width,
}
impl WorkGroupLimit {
/// The limit's name in `VkPhysicalDeviceMeshShaderPropertiesEXT` for `stage`'s workgroup:
/// the task stage's for [`Stage::Object`], the mesh stage's otherwise.
pub fn vulkan_name(self, stage: Stage) -> &'static str {
match (stage, self) {
(Stage::Object, WorkGroupLimit::Invocations) => "maxTaskWorkGroupInvocations",
(Stage::Object, WorkGroupLimit::Width) => "maxTaskWorkGroupSize[0]",
(_, WorkGroupLimit::Invocations) => "maxMeshWorkGroupInvocations",
(_, WorkGroupLimit::Width) => "maxMeshWorkGroupSize[0]",
}
}
}
/// No Metal counterpart: a limit of the device or of the runtime a call ran into, with what it was
/// asked.
#[non_exhaustive]
@@ -2453,6 +2571,41 @@ pub enum Limit {
/// The state's `maxTotalThreadsPerThreadgroup` on this device.
max: u32,
},
/// A mesh draw whose object or mesh threadgroup is within Metal's maximum for its stage and
/// past the mesh render pipeline state's on this device
/// ([`RenderPipelineState::max_total_threads_per_object_threadgroup`](crate::RenderPipelineState::max_total_threads_per_object_threadgroup),
/// [`max_total_threads_per_mesh_threadgroup`](crate::RenderPipelineState::max_total_threads_per_mesh_threadgroup)):
/// the state answers the least of Metal's maximum and the stage's Vulkan limits, and `limit`
/// is the one that holds it, `device` its value on this device. Metal runs the threadgroup; one
/// past Metal's own maximum is [`Refusal::ThreadgroupSize`]. Each is counted in
/// [`Metrics::mesh_threadgroups_past_device`](crate::Metrics::mesh_threadgroups_past_device).
///
/// Basis: device (the device's task and mesh work-group limits).
MeshThreadgroupThreads {
/// The stage: [`Stage::Object`] or [`Stage::Mesh`].
stage: Stage,
/// The threadgroup size the draw asked for.
size: [u32; 3],
/// The state's maximum for the stage on this device.
max: u32,
/// The Vulkan limit that holds the state's maximum there.
limit: WorkGroupLimit,
/// That limit's value on this device.
device: u32,
},
/// A mesh draw of an object function over more object threadgroups than one draw launches on
/// this device: a grid past the device's task limits (`maxTaskWorkGroupCount`,
/// `maxTaskWorkGroupTotalCount`) runs in pieces of one multi-draw, whose records lie in one
/// parameter ring chunk, so `max` is those records' count times the threadgroups of a piece.
/// Metal states no limit on an object grid.
///
/// Basis: ours (a ring chunk is 64 KiB).
ObjectThreadgroups {
/// The object threadgroups the draw asked for.
groups: [u32; 3],
/// The most one draw launches on this device.
max: u64,
},
/// `setBytes` data longer than one parameter ring chunk. Metal documents the call for data
/// under 4 KB.
///
@@ -2930,6 +3083,10 @@ impl fmt::Display for Refusal {
"patches are drawn with a post-tessellation vertex function's pipeline state, and \
only with one",
),
Refusal::MeshDraw => f.write_str(
"a mesh render pipeline state draws only mesh draws, not primitives, patches or \
an indirect command buffer's commands",
),
Refusal::NoTessellationFactorBuffer => {
f.write_str("a draw of patches needs a tessellation factor buffer")
}
@@ -3040,6 +3197,10 @@ impl fmt::Display for Refusal {
Refusal::TextureSwizzleWithWrites => {
f.write_str("a swizzled texture takes no shader-write or render-target usage")
}
Refusal::ChromaPairs { pixel_format, rule } => write!(
f,
"a {pixel_format:?} texture breaks Metal's rule of the format: {rule:?}"
),
Refusal::TextureBytesPrivate => {
f.write_str("the CPU reaches no Private or Memoryless texture")
}
@@ -3318,9 +3479,6 @@ impl fmt::Display for Gap {
"a grid of {threads_per_grid:?} threads in threadgroups of {threads_per_threadgroup:?} ends in partial threadgroups, which this kernel's variant does not run"
),
Gap::MemorylessTexture => f.write_str("Memoryless textures are not built"),
Gap::CubicSampler => {
f.write_str("a cubic sampler filter, which the runtime makes as nearest")
}
Gap::TextureBufferSwizzle { pixel_format } => write!(
f,
"a swizzled texture buffer of {pixel_format:?} is not built"
@@ -3329,6 +3487,9 @@ impl fmt::Display for Gap {
f,
"no texture of {pixel_format:?} is made on this device for the usage"
),
Gap::ChromaPairsUse { cause } => {
write!(f, "a 4:2:2 texture's {cause:?} is not built")
}
Gap::MipmapFilter { pixel_format } => write!(
f,
"mipmaps of a {pixel_format:?} texture, whose image this device's blits do not filter"
@@ -3462,6 +3623,23 @@ impl fmt::Display for Limit {
"a threadgroup of {size:?} threads is within Metal's limit for the kernel and past \
this device's {max}"
),
Limit::MeshThreadgroupThreads {
stage,
size,
max,
limit,
device,
} => write!(
f,
"a mesh draw's {stage:?} threadgroup of {size:?} threads is within Metal's limit \
and past this device's {max}, which its {} of {device} holds",
limit.vulkan_name(*stage)
),
Limit::ObjectThreadgroups { groups, max } => write!(
f,
"a mesh draw of {groups:?} object threadgroups is past the {max} one draw \
launches on this device"
),
Limit::BytesLength { len, max } => {
write!(f, "{len} bytes are past the most one call takes, {max}")
}
@@ -31,6 +31,7 @@ impl Refusal {
Refusal::NoPipeline => RefusalBasis::MetalDocumented,
Refusal::CommandRange => RefusalBasis::MetalDocumented,
Refusal::PatchDraw => RefusalBasis::MetalMeasured,
Refusal::MeshDraw => RefusalBasis::Ours,
Refusal::NoTessellationFactorBuffer => RefusalBasis::MetalMeasured,
Refusal::IndexedPatchDrawWithoutIndexType => RefusalBasis::MetalMeasured,
Refusal::PatchDrawWithIndexType { .. } => RefusalBasis::MetalMeasured,
@@ -67,6 +68,7 @@ impl Refusal {
Refusal::TextureViewSlices { .. } => RefusalBasis::MetalDocumented,
Refusal::TextureViewFormat { .. } => RefusalBasis::MetalMeasured,
Refusal::MipmapFormat { .. } => RefusalBasis::MetalMeasured,
Refusal::ChromaPairs { .. } => RefusalBasis::MetalMeasured,
Refusal::TextureCopyMismatch { .. } => RefusalBasis::MetalDocumented,
Refusal::AliasingCopy { .. } => RefusalBasis::MetalMeasured,
Refusal::ManagedTextureBytes { .. } => RefusalBasis::Ours,
@@ -117,6 +119,8 @@ impl Limit {
Limit::BlockIds => RefusalBasis::Ours,
Limit::ThreadgroupMemory { .. } => RefusalBasis::Device,
Limit::ThreadgroupThreads { .. } => RefusalBasis::Device,
Limit::MeshThreadgroupThreads { .. } => RefusalBasis::Device,
Limit::ObjectThreadgroups { .. } => RefusalBasis::Ours,
Limit::BytesLength { .. } => RefusalBasis::Ours,
Limit::IndexRange { .. } => RefusalBasis::Ours,
Limit::TextureSize { .. } => RefusalBasis::Device,
@@ -154,8 +158,8 @@ impl Gap {
Gap::MemorylessTexture => RefusalBasis::Ours,
Gap::TextureBufferSwizzle { .. } => RefusalBasis::Ours,
Gap::TextureFormat { .. } => RefusalBasis::Ours,
Gap::ChromaPairsUse { .. } => RefusalBasis::Ours,
Gap::MipmapFilter { .. } => RefusalBasis::Ours,
Gap::CubicSampler => RefusalBasis::Ours,
Gap::TextureBytes { .. } => RefusalBasis::Ours,
Gap::TextureCopy { .. } => RefusalBasis::Ours,
Gap::OverlappingCopy { .. } => RefusalBasis::Ours,
+13 -32
View File
@@ -165,10 +165,15 @@ impl Event {
}
}
impl Event {
/// Reads the Metal timeline value for checkpointing.
impl SharedEvent {
/// `signaledValue`: the higher of the value of the signal the semaphore's count reached and the
/// host's floor, that count being one a host wait confirmed: a counter read finds it, and a
/// wait with a timeout of 0 confirms it where it is above the count last confirmed. Where the
/// value rose since the host last saw it, the Shared memory command buffers in flight may
/// write is flushed and invalidated first (`crate::coherence`), so the host reads what the GPU
/// wrote before its signal.
pub fn signaled_value(&self) -> u64 {
let inner = &self.inner;
let inner = &self.event.inner;
let (signalled, floor) = {
let state = lock(&inner.state);
// A lost device answers with what was seen before the loss.
@@ -183,16 +188,11 @@ impl Event {
signalled.max(floor)
}
/// Restores the Metal timeline value on a freshly created event.
pub fn restore_signaled_value(&self, value: u64) -> Result<(), Error> {
// The Vulkan semaphore counts submissions, independently of the Metal value.
// Raising the host floor also satisfies waits on the restored value.
self.set_floor(value);
Ok(())
}
fn set_floor(&self, value: u64) {
let inner = &self.inner;
/// `setSignaledValue:`: raises the host's floor to `value`; a value not above it changes
/// nothing. The semaphore is never signalled from the host. Segments the submit thread holds
/// and host waits that the new value meets go on, and listeners it reaches run.
pub fn set_signaled_value(&self, value: u64) {
let inner = &self.event.inner;
let reached = {
let mut state = lock(&inner.state);
if value <= state.floor {
@@ -208,25 +208,6 @@ impl Event {
core.done.fire(core, Arc::clone(inner));
}
}
}
impl SharedEvent {
/// `signaledValue`: the higher of the value of the signal the semaphore's count reached and the
/// host's floor, that count being one a host wait confirmed: a counter read finds it, and a
/// wait with a timeout of 0 confirms it where it is above the count last confirmed. Where the
/// value rose since the host last saw it, the Shared memory command buffers in flight may
/// write is flushed and invalidated first (`crate::coherence`), so the host reads what the GPU
/// wrote before its signal.
pub fn signaled_value(&self) -> u64 {
self.event.signaled_value()
}
/// `setSignaledValue:`: raises the host's floor to `value`; a value not above it changes
/// nothing. The semaphore is never signalled from the host. Segments the submit thread holds
/// and host waits that the new value meets go on, and listeners it reaches run.
pub fn set_signaled_value(&self, value: u64) {
self.event.set_floor(value);
}
/// `waitUntilSignaledValue:timeoutMS:`: true once [`signaled_value`](Self::signaled_value)
/// reaches `value`, false when `timeout` passes first.
+81 -67
View File
@@ -146,10 +146,9 @@ const _: () = {
/// The device extension of the attachment feedback loop (`VK_EXT_attachment_feedback_loop_layout`),
/// through which a draw reads, through a texture, an attachment its own pass renders (Metal's
/// texture read of a render target): its layout, its image usage and its pipeline flag, which every
/// render pipeline takes. Device creation enables it, with its feature, where the device reads
/// attachments (`Capabilities::attachment_reads`), lists it and reports the feature, and not
/// otherwise. A device that reads attachments without it reads through a copy of the image
/// (`Capabilities::feedback_loop`).
/// render pipeline takes. Device creation enables it, with its feature, where the device lists it
/// and reports the feature, and not otherwise. A device without it reads attachments through a
/// copy of the image (`Capabilities::feedback_loop`).
pub const ATTACHMENT_READ_EXTENSIONS: &[&CStr] = &[ash::ext::attachment_feedback_loop_layout::NAME];
/// The device extension of a sampler's border colour through a view's component mapping
@@ -175,6 +174,14 @@ pub const BORDER_SWIZZLE_EXTENSIONS: &[&CStr] = &[
/// otherwise, so [`Device::extensions`](crate::Device::extensions) names it only with its feature.
pub const BARYCENTRIC_EXTENSIONS: &[&CStr] = &[ash::khr::fragment_shader_barycentric::NAME];
/// The device extension of Metal's object and mesh functions (`VK_EXT_mesh_shader`): device
/// creation enables it, with three features (`taskShader`, `meshShader` and `multiDrawIndirect`),
/// where the device lists it and reports all three, and none of them otherwise, so
/// [`Device::extensions`](crate::Device::extensions) names it only with its stages. A device
/// without them refuses every mesh render pipeline state (the translator's
/// `Unsupported{MeshShading}`, naming what the device lacks).
pub const MESH_EXTENSIONS: &[&CStr] = &[ash::ext::mesh_shader::NAME];
/// The device extensions of Metal's indirect command buffers of draws
/// (`VK_EXT_device_generated_commands`) and of the one structure its preprocess memory takes
/// beside it (`VkBufferUsageFlags2CreateInfoKHR`, for `VK_BUFFER_USAGE_2_PREPROCESS_BUFFER_BIT_EXT`),
@@ -252,6 +259,8 @@ pub(crate) fn shader_extension(name: &CStr) -> Option<VkExtension> {
Some(VkExtension::ExtExtendedDynamicState)
} else if name == ash::ext::sample_locations::NAME {
Some(VkExtension::ExtSampleLocations)
} else if name == ash::ext::mesh_shader::NAME {
Some(VkExtension::ExtMeshShader)
} else {
None
}
@@ -290,6 +299,14 @@ pub(crate) const SAMPLER_ELEMENTS: u32 = SAMPLERS + SAMPLER_VARIANTS;
/// Sampler arrays: one per use of a sampler (plain, depth comparison, integer texture).
pub(crate) const SAMPLER_ARRAYS: u32 = 3;
/// The sampler descriptors of set 1: each array's [`SAMPLER_ELEMENTS`] (`crate::arrays`).
pub(crate) const SAMPLER_DESCRIPTORS: u32 = SAMPLER_ARRAYS * SAMPLER_ELEMENTS;
/// The sampled images of set 1 against the descriptor limits: the sampled-texture array's
/// textures and second elements (`crate::arrays::SAMPLED_ELEMENTS`), and the uniform texel
/// buffers, which count as sampled images.
const SAMPLED_IMAGES: u32 = crate::arrays::SAMPLED_ELEMENTS + TEXTURES;
/// Threads in one compute workgroup: Metal's most threads per threadgroup.
pub(crate) const WORKGROUP_INVOCATIONS: u32 = 1024;
@@ -452,6 +469,10 @@ pub struct Features {
/// `VkPhysicalDeviceExtendedDynamicStateFeaturesEXT`, of `VK_EXT_extended_dynamic_state`: read
/// and enabled only where the device lists it ([`OPTIONAL_EXTENSIONS`]).
pub extended_dynamic_state: vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT<'static>,
/// `VkPhysicalDeviceMeshShaderFeaturesEXT`, of `VK_EXT_mesh_shader`: read where the device
/// lists it, and `taskShader` and `meshShader` enabled with `multiDrawIndirect`
/// ([`MESH_EXTENSIONS`]); none of its other features.
pub mesh: vk::PhysicalDeviceMeshShaderFeaturesEXT<'static>,
}
/// One feature: the Vulkan structure that reports it, its member as ash spells it, the member, and
@@ -530,6 +551,9 @@ macro_rules! feature {
(@structure extended_dynamic_state) => {
"VkPhysicalDeviceExtendedDynamicStateFeaturesEXT"
};
(@structure mesh) => {
"VkPhysicalDeviceMeshShaderFeaturesEXT"
};
(@translator) => {
None
};
@@ -757,7 +781,6 @@ pub(crate) const OPTIONAL: &[Feature] = &[
// the device offers it, else a branch over the offset's values, each with its value as
// `ConstOffset` (Vulkan 1.0's).
feature!(maintenance8.maintenance8 => Maintenance8),
feature!(core.multi_draw_indirect),
];
/// The feature of the attachment feedback loop ([`ATTACHMENT_READ_EXTENSIONS`]): enabled where the
@@ -871,6 +894,16 @@ pub(crate) const PIPELINE_ROBUSTNESS: &[Feature] =
/// epilog lookup calls through a null pointer.
pub(crate) const EXTENDED_DYNAMIC_STATE: &[Feature] =
&[feature!(extended_dynamic_state.extended_dynamic_state => ExtendedDynamicState)];
/// The features of Metal's object and mesh functions ([`MESH_EXTENSIONS`]): enabled together where
/// the device lists `VK_EXT_mesh_shader` and reports all three, and none otherwise. An object
/// function is a task shader and a mesh function a mesh shader, and an object grid past the task
/// limits runs in pieces of one multi-draw (`multiDrawIndirect`), so a device that lacks any one
/// of them takes no mesh render pipeline state. No answer chooses a second form.
pub(crate) const MESH_STAGES: &[Feature] = &[
feature!(mesh.task_shader => TaskShader),
feature!(mesh.mesh_shader => MeshShader),
feature!(core.multi_draw_indirect => MultiDrawIndirect),
];
/// The features of [`INDIRECT_COMMANDS`]: enabled together where the device offers indirect
/// command buffers ([`IndirectCommandLimits`]), and neither otherwise. The translator is told of
@@ -905,6 +938,7 @@ pub(crate) const ENABLED: &[&[Feature]] = &[
PIPELINE_ROBUSTNESS,
EXTENDED_DYNAMIC_STATE,
INDIRECT_COMMAND_FEATURES,
MESH_STAGES,
];
/// Each feature of a table device creation enables ([`ENABLED`]) that the translator names, with
@@ -922,6 +956,7 @@ pub(crate) fn creation_extensions() -> impl Iterator<Item = &'static CStr> {
.chain(BORDER_SWIZZLE_EXTENSIONS)
.chain(BARYCENTRIC_EXTENSIONS)
.chain(INDIRECT_COMMANDS)
.chain(MESH_EXTENSIONS)
.copied()
}
@@ -1132,23 +1167,23 @@ pub struct Capabilities {
/// takes the offset as its own `Offset` operand. Where it is false, the sample branches over
/// the offset's values, each branch with its value as `ConstOffset`.
pub texel_offset_operand: bool,
/// The device's descriptor limits hold the sampled-texture array's second elements beside the
/// floor's arrays: a draw may read, through a texture, an attachment its own pass renders, as
/// Metal reads a render target. It reads through the attachment feedback loop where
/// [`feedback_loop`](Self::feedback_loop) holds, and through a copy of the image otherwise.
/// Always true: the floor's descriptor limits hold the sampled-texture array's second
/// elements, so a draw may read, through a texture, an attachment its own pass renders on
/// every device, as Metal reads a render target. It reads through the attachment feedback loop
/// where [`feedback_loop`](Self::feedback_loop) holds, and through a copy of the image
/// otherwise. Kept for the consumers that report it; the runtime reads it nowhere.
pub attachment_reads: bool,
/// The attachment reads hold, and so does the attachment-read feature, with
/// The attachment-read feature holds, with
/// [`ATTACHMENT_READ_EXTENSIONS`]: a draw reads an attachment through the attachment feedback
/// loop, the feedback layout its image moves to and the colour flag the pipelines of a state
/// whose functions can read a texture take.
pub feedback_loop: bool,
/// Whether `bufferDeviceAddressCaptureReplay` is enabled for checkpoint/restore.
pub buffer_device_address_capture_replay: bool,
/// The features device creation enables: every one the floor requires, each of the optional,
/// step-rate, min-LOD, fill-mode, alpha-to-one, quad-control, pixel-interlock, linear-attachment
/// and fault-report ones the device reports, the attachment-read ones where
/// [`feedback_loop`](Self::feedback_loop) holds, the border-swizzle ones where the device reports
/// both, and the barycentric one where the device lists its extension and reports it.
/// both, the barycentric one where the device lists its extension and reports it, and the
/// mesh stages' three where the device lists `VK_EXT_mesh_shader` and reports all three.
pub features: Features,
/// The device extensions device creation enables: [`DEVICE_EXTENSIONS`], then each of
/// [`OPTIONAL_EXTENSIONS`] the device lists, then [`ATTACHMENT_READ_EXTENSIONS`] where
@@ -1156,7 +1191,9 @@ pub struct Capabilities {
/// device lists them and reports both the border swizzle's features, then
/// [`BARYCENTRIC_EXTENSIONS`] where the device lists it and reports its feature, then
/// [`INDIRECT_COMMANDS`] where the device lists both and reports their features
/// ([`indirect_commands`](Self::indirect_commands)).
/// ([`indirect_commands`](Self::indirect_commands)), then [`MESH_EXTENSIONS`] where the device
/// lists it and reports its three features (`taskShader`, `meshShader` and
/// `multiDrawIndirect`).
pub extensions: Vec<&'static CStr>,
/// The first queue family with graphics and compute, whose timestamps the floor checked.
pub queue_family: u32,
@@ -1165,19 +1202,6 @@ pub struct Capabilities {
/// What an indirect command buffer's execution may take, where device creation enables
/// [`INDIRECT_COMMANDS`]; `None` on a device without them.
pub indirect_commands: Option<IndirectCommandLimits>,
/// The physical limit for draws in one Vulkan indirect draw command.
pub max_draw_indirect_count: u32,
}
impl Capabilities {
/// The effective multi-draw limit when the runtime opts in and device creation enables it.
pub(crate) fn draw_indirect_limit(&self, enabled: bool) -> u32 {
if enabled && self.features.core.multi_draw_indirect == vk::TRUE {
self.max_draw_indirect_count
} else {
0
}
}
}
impl std::fmt::Debug for Capabilities {
@@ -1202,7 +1226,6 @@ impl std::fmt::Debug for Capabilities {
.field("extensions", &self.extensions)
.field("queue_family", &self.queue_family)
.field("indirect_commands", &self.indirect_commands)
.field("max_draw_indirect_count", &self.max_draw_indirect_count)
.finish_non_exhaustive()
}
}
@@ -1320,6 +1343,7 @@ unsafe fn query(
let maintenance8_listed = listed(MAINTENANCE8);
let pipeline_robustness_listed = listed(ash::ext::pipeline_robustness::NAME);
let extended_dynamic_state_listed = listed(ash::ext::extended_dynamic_state::NAME);
let mesh_listed = listed(ash::ext::mesh_shader::NAME);
let Features {
core,
@@ -1344,6 +1368,7 @@ unsafe fn query(
maintenance8,
pipeline_robustness,
extended_dynamic_state,
mesh,
} = &mut queried.features;
let mut features = vk::PhysicalDeviceFeatures2::default()
.push_next(&mut *vulkan11)
@@ -1403,6 +1428,9 @@ unsafe fn query(
if extended_dynamic_state_listed {
features = features.push_next(&mut *extended_dynamic_state);
}
if mesh_listed {
features = features.push_next(&mut *mesh);
}
instance.get_physical_device_features2(physical, &mut features);
*core = features.features;
vulkan11.p_next = std::ptr::null_mut();
@@ -1426,6 +1454,7 @@ unsafe fn query(
maintenance8.p_next = std::ptr::null_mut();
pipeline_robustness.p_next = std::ptr::null_mut();
extended_dynamic_state.p_next = std::ptr::null_mut();
mesh.p_next = std::ptr::null_mut();
queried.families = instance.get_physical_device_queue_family_properties(physical);
queried.memory = instance.get_physical_device_memory_properties(physical);
@@ -1510,10 +1539,6 @@ pub(crate) fn decide(device: &Queried) -> Result<Capabilities, BelowFloor> {
let Some((queue_family, _)) = family.filter(|_| missing.is_empty()) else {
return Err(BelowFloor { missing });
};
let capture_replay = reported.vulkan12.buffer_device_address_capture_replay == vk::TRUE;
if capture_replay {
features.vulkan12.buffer_device_address_capture_replay = vk::TRUE;
}
for feature in (OPTIONAL.iter().chain(PORTABILITY_STATED))
.chain(STEP_RATES)
.chain(MIN_LOD_CLAMPS)
@@ -1526,9 +1551,10 @@ pub(crate) fn decide(device: &Queried) -> Result<Capabilities, BelowFloor> {
}
let listed =
|extension: &CStr| (device.extensions.iter()).any(|name| name.as_c_str() == extension);
let attachment_reads = second_elements_fit(device);
let feedback_loop = attachment_reads
&& ATTACHMENT_READ_EXTENSIONS.iter().all(|&name| listed(name))
// The floor's limits hold the sampled-texture array's second elements
// (`arrays::SAMPLED_ELEMENTS`): every device that meets it reads attachments.
let attachment_reads = true;
let feedback_loop = ATTACHMENT_READ_EXTENSIONS.iter().all(|&name| listed(name))
&& (ATTACHMENT_READS.iter()).all(|feature| *(feature.field)(&mut reported) == vk::TRUE);
if feedback_loop {
for feature in ATTACHMENT_READS {
@@ -1559,7 +1585,7 @@ pub(crate) fn decide(device: &Queried) -> Result<Capabilities, BelowFloor> {
*(feature.field)(&mut features) = *(feature.field)(&mut reported);
}
}
if listed(ash::ext::pipeline_robustness::NAME) && kernel_buffers_fit(device, attachment_reads) {
if listed(ash::ext::pipeline_robustness::NAME) && kernel_buffers_fit(device) {
for feature in PIPELINE_ROBUSTNESS {
*(feature.field)(&mut features) = *(feature.field)(&mut reported);
}
@@ -1570,6 +1596,13 @@ pub(crate) fn decide(device: &Queried) -> Result<Capabilities, BelowFloor> {
}
}
let indirect_commands = indirect_commands(device, &mut features);
let mesh = MESH_EXTENSIONS.iter().all(|&name| listed(name))
&& (MESH_STAGES.iter()).all(|feature| *(feature.field)(&mut reported) == vk::TRUE);
if mesh {
for feature in MESH_STAGES {
*(feature.field)(&mut features) = vk::TRUE;
}
}
Ok(Capabilities {
float16: features.vulkan12.shader_float16 == vk::TRUE,
storage_read_without_format: features.core.shader_storage_image_read_without_format
@@ -1586,7 +1619,6 @@ pub(crate) fn decide(device: &Queried) -> Result<Capabilities, BelowFloor> {
texel_offset_operand: features.maintenance8.maintenance8 == vk::TRUE,
attachment_reads,
feedback_loop,
buffer_device_address_capture_replay: capture_replay,
features,
extensions: DEVICE_EXTENSIONS
.iter()
@@ -1603,12 +1635,12 @@ pub(crate) fn decide(device: &Queried) -> Result<Capabilities, BelowFloor> {
.iter()
.filter(|_| indirect_commands.is_some()),
)
.chain(MESH_EXTENSIONS.iter().filter(|_| mesh))
.copied()
.collect(),
queue_family,
memory: device.memory,
indirect_commands,
max_draw_indirect_count: device.limits.max_draw_indirect_count,
})
}
@@ -1756,34 +1788,16 @@ pub(crate) fn flag_names(flags: vk::MemoryPropertyFlags) -> String {
.join(" | ")
}
/// Whether the device's descriptor limits hold the sampled-texture array's second elements
/// (`arrays::sampled_images`) beside the floor's arrays: what the attachment reads take beyond
/// [`limits`]. A uniform texel buffer counts as a sampled image, and a storage one as a storage
/// image.
fn second_elements_fit(device: &Queried) -> bool {
let limits = &device.limits;
let descriptors = &device.vulkan12;
let sampled = 3 * TEXTURES;
let storage = 2 * TEXTURES + LEVEL_ELEMENTS;
descriptors.max_per_stage_descriptor_update_after_bind_sampled_images >= sampled
&& descriptors.max_descriptor_set_update_after_bind_sampled_images >= sampled
&& descriptors.max_per_stage_update_after_bind_resources
>= sampled + storage + limits.max_color_attachments
&& descriptors.max_update_after_bind_descriptors_in_all_pools
>= sampled + storage + SAMPLER_ARRAYS * SAMPLER_ELEMENTS
}
/// Whether `maxPerStageUpdateAfterBindResources` holds the compute stage's descriptors with set 0's
/// kernel storage buffers (`crate::arrays::buffer_bindings`): set 1's arrays, `seconds` their
/// second elements' (a uniform texel buffer counting as a sampled image, a storage one as a
/// storage image), and [`KERNEL_BUFFER_BINDINGS`]. It is the one limit of that layout the
/// kernel storage buffers (`crate::arrays::buffer_bindings`): set 1's arrays (a uniform texel
/// buffer counting as a sampled image, a storage one as a storage image), and
/// [`KERNEL_BUFFER_BINDINGS`]. It is the one limit of that layout the
/// translator's query (`DeviceProfile::binds_kernel_buffers`) cannot count, as set 1 is the
/// runtime's: [`PIPELINE_ROBUSTNESS`] is enabled only where it holds.
fn kernel_buffers_fit(device: &Queried, seconds: bool) -> bool {
let sampled = crate::arrays::sampled_images(seconds) + TEXTURES;
fn kernel_buffers_fit(device: &Queried) -> bool {
let storage = 2 * TEXTURES + LEVEL_ELEMENTS;
device.vulkan12.max_per_stage_update_after_bind_resources
>= sampled + storage + KERNEL_BUFFER_BINDINGS
>= SAMPLED_IMAGES + storage + KERNEL_BUFFER_BINDINGS
}
/// Each limit the floor sets: its Vulkan name, the device's value, and the least value the runtime
@@ -1798,12 +1812,12 @@ pub(crate) fn limits(device: &Queried) -> [(&'static str, u32, u32); 17] {
(
"maxPerStageDescriptorUpdateAfterBindSampledImages",
descriptors.max_per_stage_descriptor_update_after_bind_sampled_images,
2 * TEXTURES,
SAMPLED_IMAGES,
),
(
"maxDescriptorSetUpdateAfterBindSampledImages",
descriptors.max_descriptor_set_update_after_bind_sampled_images,
2 * TEXTURES,
SAMPLED_IMAGES,
),
(
"maxPerStageDescriptorUpdateAfterBindStorageImages",
@@ -1818,12 +1832,12 @@ pub(crate) fn limits(device: &Queried) -> [(&'static str, u32, u32); 17] {
(
"maxPerStageDescriptorUpdateAfterBindSamplers",
descriptors.max_per_stage_descriptor_update_after_bind_samplers,
SAMPLER_ARRAYS * SAMPLER_ELEMENTS,
SAMPLER_DESCRIPTORS,
),
(
"maxDescriptorSetUpdateAfterBindSamplers",
descriptors.max_descriptor_set_update_after_bind_samplers,
SAMPLER_ARRAYS * SAMPLER_ELEMENTS,
SAMPLER_DESCRIPTORS,
),
(
"maxSamplerAllocationCount",
@@ -1834,12 +1848,12 @@ pub(crate) fn limits(device: &Queried) -> [(&'static str, u32, u32); 17] {
(
"maxPerStageUpdateAfterBindResources",
descriptors.max_per_stage_update_after_bind_resources,
2 * TEXTURES + storage + limits.max_color_attachments,
SAMPLED_IMAGES + storage + limits.max_color_attachments,
),
(
"maxUpdateAfterBindDescriptorsInAllPools",
descriptors.max_update_after_bind_descriptors_in_all_pools,
2 * TEXTURES + storage + SAMPLER_ARRAYS * SAMPLER_ELEMENTS,
SAMPLED_IMAGES + storage + SAMPLER_DESCRIPTORS,
),
(
"maxComputeWorkGroupInvocations",
+25 -2
View File
@@ -34,8 +34,9 @@ pub(crate) const KERNEL_ENTRIES: usize = 1024;
/// the buffer slots bound at a multiple of 4 below their argument's alignment, bit `i` the vertex
/// function's slot `i` and bit `32 + i` the fragment function's, and the texture slots that hold
/// an 8-bit sRGB texture's UNORM twin, bit `i` of `srgb`'s first the vertex function's slot `i`
/// and of its second the fragment function's (`RenderPipelineState::for_draws`). Each is 0 for
/// every other content.
/// and of its second the fragment function's (`RenderPipelineState::for_draws`); and for either
/// state's content for a 4:2:2 texture, where its draws or dispatches read one ([`Chroma`]).
/// Each is 0 for every other content.
#[derive(Clone, PartialEq, Eq, Hash)]
pub(crate) struct KernelKey {
pub(crate) pipeline: PipelineKey,
@@ -43,6 +44,28 @@ pub(crate) struct KernelKey {
pub(crate) srgb: [u128; 2],
pub(crate) words: u64,
pub(crate) arrays: u8,
pub(crate) chroma: Chroma,
}
/// Where a content's functions read a texture of `GBGR422` or `BGRG422`, which only a function
/// lowered for it decodes: `slots`' texture slots bound to one, bit `i` slot `i`, the first a
/// kernel's or a vertex function's and the second a fragment function's
/// (`LoweringInputs::chroma_pairs`), and, in `handles`, whether one may be reached through a
/// handle, a stage reaching a `float` colour texture so while a 4:2:2 texture lives on the device
/// (`LoweringInputs::chroma_handles`). A content made for it is counted
/// ([`Metric::ChromaContents`]) and each draw or dispatch of one too
/// ([`Metric::ChromaLaunches`]).
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
pub(crate) struct Chroma {
pub(crate) slots: [u128; 2],
pub(crate) handles: bool,
}
impl Chroma {
/// Whether a content is made for it: some slot, or a handle.
pub(crate) fn any(self) -> bool {
self.slots != [0; 2] || self.handles
}
}
/// What one content compiles to.
+10 -9
View File
@@ -46,6 +46,7 @@ mod instance;
mod kept;
mod kernel_map;
mod memory;
mod mesh_draw;
mod over;
mod own;
mod pass;
@@ -88,10 +89,10 @@ pub use depth_stencil::DepthStencilState;
pub use device::{Device, DeviceOptions, RawDevice};
pub use encoder::{ComputeCommandEncoder, Dispatch, DispatchType, Resource, ResourceUsage};
pub use error::{
DrawInputCause, DrawKind, Error, Gap, IndirectCommandsKind, KernelInputKind, Limit,
PartialThreadgroupsCause, PartialThreadgroupsSite, Refusal, RefusalBasis, RenderPassKind,
RenderPipelineKind, SamplePositionsKind, StageGap, StageInKind, StorageElementCase,
TextureBacking, TextureBytesCause, TextureViewKind,
ChromaPairsGap, ChromaPairsRule, DrawInputCause, DrawKind, Error, Gap, IndirectCommandsKind,
KernelInputKind, Limit, PartialThreadgroupsCause, PartialThreadgroupsSite, Refusal,
RefusalBasis, RenderPassKind, RenderPipelineKind, SamplePositionsKind, StageGap, StageInKind,
StorageElementCase, TextureBacking, TextureBytesCause, TextureViewKind, WorkGroupLimit,
};
pub use event::{Event, SharedEvent};
pub use export::{Export, ExportHandle};
@@ -103,9 +104,7 @@ pub use host_bytes::HostBytes;
pub use import::ImportHandle;
pub use indirect::{IndirectCommandBuffer, IndirectCommandBufferDescriptor, IndirectCommandType};
pub use instance::{Instance, PhysicalDevice};
pub use memory::{
AllocationId, AllocationInfo, BlockCaptureInfo, BlockId, BlockInfo, BlockMappings, MemoryClass,
};
pub use memory::{AllocationId, AllocationInfo, BlockId, BlockInfo, BlockMappings, MemoryClass};
/// `MTLLibrary`: the translator's, read from AIR or a metallib.
/// `MTLSamplerDescriptor`: the translator's.
pub use metal2vulkan::bind::SamplerDescriptor;
@@ -133,6 +132,8 @@ pub use metal2vulkan::metal::{
pub use metal2vulkan::metal::{
PixelFormat, TextureSwizzle, TextureSwizzleChannels, TextureType, TextureUsage,
};
/// `MTLMeshRenderPipelineDescriptor`: the translator's.
pub use metal2vulkan::pipeline::MeshPipelineDescriptor;
/// A function's stage, which a render pipeline state's texture slots are asked by: the
/// translator's.
pub use metal2vulkan::pipeline::Stage;
@@ -161,8 +162,8 @@ pub use positions::SamplePosition;
pub use queue::CommandQueue;
pub use render::RenderPipelineState;
pub use render_encoder::{
BatchStop, IndexBuffer, PatchIndexBuffers, RenderCommandEncoder, ScissorRect, VertexOffsetDraw,
Viewport, VisibilityResultMode,
IndexBuffer, PatchIndexBuffers, RenderCommandEncoder, ScissorRect, Viewport,
VisibilityResultMode,
};
pub use sampler::SamplerState;
pub use stage::{serve_stage, StageBreach, StageFill, StageRequest, StageSpans};
+12 -251
View File
@@ -64,8 +64,7 @@ const BASE_ALIGN: u64 = 2 << 20;
/// block-maker thread frees an allocation idle this long, after the consumer's unmap of it, one at
/// a time and between the allocations it makes, so a free never runs beside its own
/// `vkAllocateMemory`; a class's reserve ([`State::whole`]) is not freed. A driver may hold a
/// submission made during a free for the rest of it (on the NVIDIA cards measured in
/// Thunderbolt enclosures, freeing host-visible memory takes about 1.1 ms per MiB):
/// submission made during a free for the rest of it:
/// [`Metrics::submissions_during_frees`](crate::Metrics::submissions_during_frees) counts them.
pub(crate) const IDLE_AGE_NANOS: u64 = 250_000_000;
@@ -259,28 +258,8 @@ impl AllocationId {
/// device is torn down. It is a range of one allocation, whose one `VkBuffer`, with every buffer
/// usage and a device address, spans it; an imported or exported block is the whole of an
/// allocation of its own. Only an exported block is exportable.
/// Capture/replay address metadata for restoring a block at its exact Vulkan device address.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct BlockCaptureInfo {
/// Storage mode (`Shared` or `Private`).
pub class: MemoryClass,
/// Full parent Vulkan allocation length in bytes.
pub alloc_len: u64,
/// Offset of this block inside its parent allocation.
pub offset: u64,
/// Block length in bytes.
pub len: u64,
/// Guest-visible `VkDeviceAddress` of this block's first byte.
pub gpu_address: u64,
/// Opaque capture address of the parent `VkBuffer`.
pub opaque_buffer_address: u64,
/// Opaque capture address of the parent `VkDeviceMemory`.
pub opaque_memory_address: u64,
}
#[non_exhaustive]
#[derive(Clone, Copy, Debug)]
/// Metadata describing an allocated GPU memory block.
pub struct BlockInfo {
/// The block's number.
pub id: BlockId,
@@ -686,10 +665,6 @@ struct Allocation {
buffer: vk::Buffer,
/// The device address of its first byte.
address: u64,
/// Opaque capture address of `buffer` (0 if capture-replay unsupported).
opaque_buffer_address: u64,
/// Opaque capture address of `memory` (0 if capture-replay unsupported).
opaque_memory_address: u64,
len: u64,
mapping: Option<Mapping>,
device_local: bool,
@@ -703,9 +678,6 @@ struct Allocation {
/// Its block out is a texture block ([`crate::places`]), which fills its allocation: a whole
/// unit, or a long allocation of its own length. False once it is idle.
texture: bool,
/// Reserved for image placement when buffer address replay is enabled. This allocation
/// stays in the texture pool after its last block comes back.
texture_only: bool,
/// When it became idle, in nanoseconds of [`host_time`](crate::host_time): when it was made,
/// or when its last live block came back. The oldest idle allocation is freed first.
idle_since: u64,
@@ -911,8 +883,6 @@ struct State {
/// The internal the block-maker thread took up and is making ([`run`]).
making: Option<Internal>,
stop: bool,
replaying: bool,
making_ahead: bool,
next_id: u32,
next_allocation: u32,
/// The allocations [`BlockMappings::map`] accepted whose unmap has not run.
@@ -1042,8 +1012,6 @@ impl Pool {
asked: [true; INTERNALS],
making: None,
stop: false,
replaying: false,
making_ahead: false,
next_id: 1,
next_allocation: 1,
mapped: HashSet::new(),
@@ -1286,9 +1254,7 @@ impl Pool {
return Err(Error::Quiesced);
}
let texture = matches!(site, Site::TextureBlock);
if let Some((carve, idle_since, long, ahead)) =
state.fit(class, len, align, texture, core.capture_replay)
{
if let Some((carve, idle_since, long, ahead)) = state.fit(class, len, align, texture) {
if ahead {
self.counters.site_take_ahead(site, len);
}
@@ -1504,160 +1470,6 @@ impl Pool {
}
}
/// Returns capture/replay info for a pool block, if capture-replay is enabled.
pub(crate) fn capture_info(&self, memory: &Memory) -> Option<BlockCaptureInfo> {
if memory.own.is_some() {
return None;
}
let state = self.lock();
let alloc = state.allocations[memory.class.index()]
.iter()
.find(|a| a.memory == memory.memory && !a.texture_only)?;
Some(BlockCaptureInfo {
class: memory.class,
alloc_len: alloc.len,
offset: memory.base,
len: memory.len,
gpu_address: memory.address,
opaque_buffer_address: alloc.opaque_buffer_address,
opaque_memory_address: alloc.opaque_memory_address,
})
}
/// Replays a previously captured pool block at its exact Vulkan device address.
pub(crate) fn take_replayed(
&self,
core: &Core,
cap: BlockCaptureInfo,
site: Site,
) -> Result<Memory, Error> {
let index = cap.class.index();
// 1. Check if the parent allocation is already present (e.g. another sub-block restored it,
// or a pre-stocked idle reserve landed at the exact same address!).
{
let mut state = self.lock();
if state.stop {
return Err(Error::Quiesced);
}
let id = number(&mut state)?;
let want_base = cap.gpu_address.saturating_sub(cap.offset);
if let Some(alloc) = state.allocations[index].iter_mut().find(|a| {
!a.texture_only
&& a.address == want_base
&& a.opaque_buffer_address == cap.opaque_buffer_address
&& a.opaque_memory_address == cap.opaque_memory_address
&& a.len == cap.alloc_len
}) {
if alloc.free.take_at(cap.offset, cap.len) {
let carve = alloc.carve(cap.offset);
alloc.live += 1;
alloc.placed += cap.len;
alloc.ahead = false;
self.counters.rise_by(cap.class.placed_gauge(), cap.len);
self.settle(&mut state, cap.class);
self.changed.notify_all();
return Ok(carve.block(id, cap.class, cap.len));
}
}
}
// 2. Pause block-maker ahead allocations, wait for any in-flight ahead make,
// and purge idle reserve slabs so none collide with the target opaque VA!
let idle_allocs: Vec<Allocation> = {
let mut state = self.lock();
state.replaying = true;
while state.making_ahead {
state = self.wait(state);
}
// Re-check if an ahead allocation that just finished landed at the exact target VA!
let want_base = cap.gpu_address.saturating_sub(cap.offset);
let hit = state.allocations[index].iter_mut().find_map(|a| {
if !a.texture_only
&& a.address == want_base
&& a.opaque_buffer_address == cap.opaque_buffer_address
&& a.opaque_memory_address == cap.opaque_memory_address
&& a.len == cap.alloc_len
&& a.free.take_at(cap.offset, cap.len)
{
let carve = a.carve(cap.offset);
a.live += 1;
a.placed += cap.len;
a.ahead = false;
Some(carve)
} else {
None
}
});
if let Some(carve) = hit {
let id = number(&mut state)?;
state.replaying = false;
self.counters.rise_by(cap.class.placed_gauge(), cap.len);
self.settle(&mut state, cap.class);
self.changed.notify_all();
return Ok(carve.block(id, cap.class, cap.len));
}
let mut drained = Vec::new();
for c in MemoryClass::ALL {
let ci = c.index();
let mut kept = Vec::new();
for a in state.allocations[ci].drain(..) {
if a.live == 0 {
drained.push(a);
} else {
kept.push(a);
}
}
state.allocations[ci] = kept;
self.settle(&mut state, c);
}
drained
};
for a in idle_allocs {
free_idle(core, a);
}
// 3. Allocate at the exact captured opaque buffer + memory addresses.
let alloc_res = make_allocation_ex(
core,
cap.class,
cap.alloc_len,
Some(site),
Some((cap.opaque_buffer_address, cap.opaque_memory_address)),
);
let mut allocation = match alloc_res {
Ok(a) => a,
Err(e) => {
let mut state = self.lock();
state.replaying = false;
self.changed.notify_all();
return Err(e);
}
};
let mapped = self.map(&allocation, cap.class, true);
if !mapped {
free_allocation(core, allocation);
let mut state = self.lock();
state.replaying = false;
self.changed.notify_all();
return Err(Error::Limit(Limit::AllocationNotMapped {
class: cap.class,
len: cap.alloc_len,
}));
}
let ok = allocation.free.take_at(cap.offset, cap.len);
debug_assert!(ok, "fresh allocation must contain captured block range");
let mut state = self.lock();
let id = number(&mut state)?;
let memory = allocation.carve(cap.offset).block(id, cap.class, cap.len);
allocation.live = 1;
allocation.placed = cap.len;
state.allocations[index].push(allocation);
state.replaying = false;
self.counters.rise_by(cap.class.placed_gauge(), cap.len);
self.settle(&mut state, cap.class);
self.changed.notify_all();
Ok(memory)
}
/// Takes back a block taken with [`take`](Self::take): its bytes are a free range of its
/// allocation at once.
pub(crate) fn give_back(&self, memory: Memory) {
@@ -1819,12 +1631,8 @@ impl State {
/// free bytes would wait until they ran low; in return a take of up to a unit, the 16 MiB
/// ones among them, lands in memory made ahead once the block-maker thread has made it.
fn whole(&self, class: MemoryClass) -> bool {
(self.allocations[class.index()].iter()).any(|allocation| {
allocation.unit()
&& !allocation.texture_only
&& !allocation.retiring
&& allocation.live == 0
})
(self.allocations[class.index()].iter())
.any(|allocation| allocation.unit() && !allocation.retiring && allocation.live == 0)
}
/// The allocation of `class` whose memory is `memory`.
@@ -1844,11 +1652,9 @@ impl State {
len: u64,
align: u64,
texture: bool,
split_textures: bool,
) -> Option<(Carve, Option<u64>, bool, bool)> {
let texture_only = split_textures && texture;
let (allocation, base) = (self.allocations[class.index()].iter_mut())
.filter(|allocation| allocation.texture_only == texture_only && allocation.serves(len))
.filter(|allocation| allocation.serves(len))
.find_map(|allocation| {
let base = allocation.free.take(len, align)?;
Some((allocation, base))
@@ -1877,9 +1683,7 @@ impl State {
fn aging(&self, class: MemoryClass) -> (Vec<(u64, vk::DeviceMemory)>, u64) {
let idle = (self.allocations[class.index()].iter())
.filter(|allocation| allocation.live == 0 && !allocation.retiring);
let reserve = idle
.clone()
.rfind(|allocation| allocation.unit() && !allocation.texture_only);
let reserve = idle.clone().rfind(|allocation| allocation.unit());
let mut weighed: Vec<(u64, vk::DeviceMemory)> = idle
.filter(|allocation| reserve.is_none_or(|reserve| reserve.memory != allocation.memory))
.map(|allocation| (allocation.idle_since, allocation.memory))
@@ -2090,18 +1894,12 @@ pub(crate) fn run(core: Arc<Core>) {
state = pool.lock();
continue;
}
let wanted = (!state.replaying)
.then(|| {
(MemoryClass::ALL.into_iter())
.find(|&class| !state.failed[class.index()] && !state.whole(class))
})
.flatten();
let wanted = (MemoryClass::ALL.into_iter())
.find(|&class| !state.failed[class.index()] && !state.whole(class));
if let Some(class) = wanted {
state.making_ahead = true;
drop(state);
let made = ahead(&core, class);
state = pool.lock();
state.making_ahead = false;
match made {
// Idle from now: the reserve, which the idle rule does not weigh.
Some(mut allocation) => {
@@ -2382,20 +2180,8 @@ fn make_allocation(
class: MemoryClass,
len: u64,
site: Option<Site>,
) -> Result<Allocation, Error> {
make_allocation_ex(core, class, len, site, None)
}
fn make_allocation_ex(
core: &Core,
class: MemoryClass,
len: u64,
site: Option<Site>,
replay: Option<(u64, u64)>,
) -> Result<Allocation, Error> {
let device = &core.device;
let texture_only = core.capture_replay && matches!(site, Some(Site::TextureBlock));
let capture_replay = core.capture_replay && !texture_only;
let (id, freed_at) = {
let mut state = core.pool.lock();
(
@@ -2403,38 +2189,22 @@ fn make_allocation_ex(
state.freed_at[class.index()],
)
};
let mut buf_opaque = vk::BufferOpaqueCaptureAddressCreateInfo::default()
.opaque_capture_address(replay.map_or(0, |(b, _)| b));
let mut info = vk::BufferCreateInfo::default()
let info = vk::BufferCreateInfo::default()
.size(len)
.usage(floor::BUFFER_USAGE)
.sharing_mode(vk::SharingMode::EXCLUSIVE);
if capture_replay {
info = info.flags(vk::BufferCreateFlags::DEVICE_ADDRESS_CAPTURE_REPLAY);
if replay.is_some_and(|(b, _)| b != 0) {
info = info.push_next(&mut buf_opaque);
}
}
// SAFETY: the device is live, and the create info valid: `len` is at most its
// `maxBufferSize`.
let buffer =
unsafe { device.create_buffer(&info, None) }.map_err(Error::vulkan("vkCreateBuffer"))?;
// SAFETY: the buffer is the device's.
let requirements = unsafe { device.get_buffer_memory_requirements(buffer) };
let mut mem_flags = vk::MemoryAllocateFlags::DEVICE_ADDRESS;
if capture_replay {
mem_flags |= vk::MemoryAllocateFlags::DEVICE_ADDRESS_CAPTURE_REPLAY;
}
let mut flags = vk::MemoryAllocateFlagsInfo::default().flags(mem_flags);
let mut mem_opaque = vk::MemoryOpaqueCaptureAddressAllocateInfo::default()
.opaque_capture_address(replay.map_or(0, |(_, m)| m));
let mut allocate_info = vk::MemoryAllocateInfo::default()
let mut flags =
vk::MemoryAllocateFlagsInfo::default().flags(vk::MemoryAllocateFlags::DEVICE_ADDRESS);
let allocate_info = vk::MemoryAllocateInfo::default()
.allocation_size(requirements.size.max(len))
.memory_type_index(core.memory_type(class))
.push_next(&mut flags);
if capture_replay && replay.is_some_and(|(_, m)| m != 0) {
allocate_info = allocate_info.push_next(&mut mem_opaque);
}
let bits = requirements.memory_type_bits;
// SAFETY: the floor chose the memory type for buffers of this usage on this device, and
// `bufferDeviceAddress` is enabled; a spill takes a type the buffer's requirements allow.
@@ -2453,8 +2223,6 @@ fn make_allocation_ex(
memory,
buffer,
address: 0,
opaque_buffer_address: 0,
opaque_memory_address: 0,
len,
mapping: None,
device_local: !spilled && core.device_local & (1 << core.memory_type(class)) != 0,
@@ -2463,7 +2231,6 @@ fn make_allocation_ex(
live: 0,
placed: 0,
texture: false,
texture_only,
idle_since: crate::host_time(),
made: (0, 0),
wait: Wait::Progress(0),
@@ -2492,12 +2259,6 @@ fn make_allocation_ex(
let of = vk::BufferDeviceAddressInfo::default().buffer(buffer);
// SAFETY: the buffer has device-address usage and is bound.
allocation.address = unsafe { device.get_buffer_device_address(&of) };
if capture_replay {
allocation.opaque_buffer_address = unsafe { device.get_buffer_opaque_capture_address(&of) };
let mof = vk::DeviceMemoryOpaqueCaptureAddressInfo::default().memory(memory);
allocation.opaque_memory_address =
unsafe { device.get_device_memory_opaque_capture_address(&mof) };
}
#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))]
{
allocation.address += core.placed_past;
@@ -0,0 +1,225 @@
//! A mesh draw's grid: what `drawMeshThreadgroups` and `drawMeshThreads` give a mesh render
//! pipeline state's stages (`crate::render`'s mesh states), checked against Metal's maxima and the
//! device's.
//!
//! Each draw writes three group counts into the parameter ring, Metal's
//! `MTLDispatchThreadgroupsIndirectArguments` layout, and pushes their address
//! (`PushField::GroupCountsAddress`): with an object function they are its object grid, which its
//! folded threadgroups read, and without one they are the mesh grid the state's launcher reads
//! (`metal2vulkan`'s `link::mesh::Launcher`) and emits where Metal draws it. Each stage's
//! `DispatchRegion` carries Metal's threadgroup size `L` of the draw, as the translator packs it
//! (`region_bytes`), and the object stage's carries Metal's threads per grid and the partial flag
//! of a `drawMeshThreads` (`nonuniform_region_bytes`); a `drawMeshThreadgroups` states no grid, so
//! the object function's is its counts times `L`. A mesh function's grid is always whole
//! threadgroups.
//!
//! An object grid within the device's task limits (`maxTaskWorkGroupCount` along each axis,
//! `maxTaskWorkGroupTotalCount` in all) is one `vkCmdDrawMeshTasksEXT` of its counts. One past
//! them runs in pieces: one `vkCmdDrawMeshTasksIndirectEXT` of as many equal records as it takes,
//! each a piece of the most workgroups the limits allow, which the folded object function numbers
//! by `DrawIndex`, a workgroup past Metal's last threadgroup returning before its body. A
//! state without an object function draws one task workgroup, its launcher's.
//!
//! An indirect draw (`drawMeshThreadgroupsWithIndirectBuffer`) pushes its arguments' address as
//! the counts' address: the launcher reads the GPU's counts there and emits the mesh grid where
//! Metal draws it, as for a direct draw. With an object function it is refused at the draw
//! (`DrawKind::IndirectObjectGrid`): an object grid past the task limits runs in pieces whose
//! number only its counts decide. Nothing here reads a GPU word, and no draw splits its pass.
use crate::error::{DrawKind, Error, Gap, Limit, Refusal};
use crate::render::MeshThreads;
use crate::ring::CHUNK;
use metal2vulkan::pipeline::{nonuniform_region_bytes, region_bytes, Stage};
/// The bytes of one record of `vkCmdDrawMeshTasksIndirectEXT`
/// (`VkDrawMeshTasksIndirectCommandEXT`: three group counts), its records' stride.
pub(crate) const RECORD: u32 = 12;
/// The most piece records one draw writes: those one ring chunk holds.
const MOST_PIECES: u64 = CHUNK / RECORD as u64;
/// A mesh draw's grid as Metal's call states it.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) enum MeshGrid {
/// `drawMeshThreadgroups`: threadgroups per grid.
Threadgroups([u32; 3]),
/// `drawMeshThreads`: threads per grid.
Threads([u32; 3]),
/// `drawMeshThreadgroupsWithIndirectBuffer`: threadgroups per grid the GPU reads at the
/// draw's arguments, which the draw pushes as the counts' address.
Indirect,
}
/// The task workgroups a mesh draw launches.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) enum Launch {
/// One `vkCmdDrawMeshTasksEXT` of these counts.
Direct([u32; 3]),
/// `pieces` records of `piece` in one `vkCmdDrawMeshTasksIndirectEXT`.
Pieces { piece: [u32; 3], pieces: u32 },
}
/// What a mesh draw records: the group counts it writes (an indirect draw's, the GPU's, it does
/// not), each stage's region (the object's, then the mesh's; the object's unused without an
/// object function), the task workgroups it launches, and whether it draws nothing (a grid with an
/// empty axis, which only the host's counts can be).
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) struct MeshCall {
pub(crate) counts: [u32; 3],
pub(crate) regions: [[u8; 32]; 2],
pub(crate) launch: Launch,
pub(crate) empty: bool,
}
impl MeshCall {
/// The draw of `grid`, with `object` threads per object threadgroup and `mesh` threads per
/// mesh threadgroup, of a state whose threadgroups are `threads`: each threadgroup checked
/// ([`checked`]; an object threadgroup only where the state has an object function, whose
/// size Metal reads only there), then its counts, regions and launch.
///
/// Err: as [`checked`]; [`Limit::ObjectThreadgroups`] for an object grid past what one draw
/// launches; [`Gap::Draw`] of [`DrawKind::IndirectObjectGrid`] for an indirect draw of a state
/// with an object function.
pub(crate) fn of(
threads: &MeshThreads,
grid: MeshGrid,
object: [u32; 3],
mesh: [u32; 3],
) -> Result<MeshCall, Error> {
if threads.object.is_some() {
checked(threads, Stage::Object, object)?;
}
checked(threads, Stage::Mesh, mesh)?;
// Each axis of a checked threadgroup is 1 to 1024, which the regions pack.
let refused = |size, max| Error::Refused(Refusal::ThreadgroupSize { size, max });
let mesh_region =
region_bytes([0; 3], [0; 3], mesh).ok_or_else(|| refused(mesh, threads.mesh))?;
let (counts, object_region) = match (threads.object, grid) {
// Without an object function the counts are the mesh grid: a draw of threads rounds
// it down to whole threadgroups (Metal's measured answer).
(None, MeshGrid::Threadgroups(groups)) => (groups, [0; 32]),
(None, MeshGrid::Threads(t)) => ([0, 1, 2].map(|axis| t[axis] / mesh[axis]), [0; 32]),
// An indirect draw's counts are the GPU's, at its arguments: none is written.
(None, MeshGrid::Indirect) => ([1; 3], [0; 32]),
// A draw of threadgroups states no grid: the object function's is its counts times
// `L`.
(Some(max), MeshGrid::Threadgroups(groups)) => {
let region = region_bytes([0; 3], [0; 3], object);
(groups, region.ok_or_else(|| refused(object, max))?)
}
// An object grid the GPU reads is refused at the draw: past the task limits it runs in
// pieces whose number only its counts decide.
(Some(_), MeshGrid::Indirect) => {
return Err(Error::Unsupported(Gap::Draw {
kind: DrawKind::IndirectObjectGrid,
}));
}
// A draw of threads launches the object threadgroups they fill, rounded up, the last
// along an axis running only the threads left.
(Some(max), MeshGrid::Threads(t)) => {
let groups = [0, 1, 2].map(|axis| t[axis].div_ceil(object[axis]));
let ragged = (0..3).any(|axis| t[axis] % object[axis] != 0);
let region = match ragged {
true => nonuniform_region_bytes([0; 3], t, object),
false => region_bytes([0; 3], t, object),
};
(groups, region.ok_or_else(|| refused(object, max))?)
}
};
let empty = counts.contains(&0);
let launch = match (threads.object, empty) {
(Some(_), false) => launch(counts, threads.task_grid)?,
_ => Launch::Direct([1, 1, 1]),
};
Ok(MeshCall {
counts,
regions: [object_region, mesh_region],
launch,
empty,
})
}
}
/// A draw's threadgroup of `size` for `stage` of a state whose threadgroups are `threads`.
///
/// Err: [`Refusal::ThreadgroupSize`] for a threadgroup of no threads or past Metal's maximum for
/// the stage; [`Limit::MeshThreadgroupThreads`] for one within it and past the state's on this
/// device, naming the Vulkan limit that holds it.
pub(crate) fn checked(threads: &MeshThreads, stage: Stage, size: [u32; 3]) -> Result<(), Error> {
let at = usize::from(stage == Stage::Mesh);
let max = match stage {
Stage::Object => threads.object.unwrap_or(0),
_ => threads.mesh,
};
let total = size.iter().map(|&axis| u64::from(axis)).product::<u64>();
if total == 0 || total > u64::from(threads.metal[at]) {
return Err(Error::Refused(Refusal::ThreadgroupSize { size, max }));
}
if total > u64::from(max) {
let (limit, device) = threads.caps[at];
return Err(Error::Limit(Limit::MeshThreadgroupThreads {
stage,
size,
max,
limit,
device,
}));
}
Ok(())
}
/// The launch of an object grid of `groups` (no axis empty) on a device whose task grid is
/// `(count, total)` (`maxTaskWorkGroupCount`, `maxTaskWorkGroupTotalCount`): the counts
/// themselves where they lie within the limits, else pieces of the most workgroups the limits
/// allow, filled `x` first: one piece launched directly, more through their records.
///
/// Err: [`Limit::ObjectThreadgroups`] where the pieces are more than [`MOST_PIECES`].
pub(crate) fn launch(groups: [u32; 3], (count, total): ([u32; 3], u32)) -> Result<Launch, Error> {
let all = groups.iter().map(|&axis| u64::from(axis)).product::<u64>();
if (0..3).all(|axis| groups[axis] <= count[axis]) && all <= u64::from(total) {
return Ok(Launch::Direct(groups));
}
// Each axis of a piece takes what is left of the grid, within its own limit and the total
// left by the axes before it; every limit is at least 1 (Vulkan's minimums are far above).
let (mut piece, mut held, mut room) = ([1u32; 3], 1u64, u64::from(total.max(1)));
for axis in 0..3 {
let side = (all.div_ceil(held))
.min(u64::from(count[axis].max(1)))
.min(room)
.max(1);
// Within `count[axis]`, a `u32`.
piece[axis] = side as u32;
held *= side;
room /= side;
}
let pieces = all.div_ceil(held);
if pieces == 1 {
return Ok(Launch::Direct(piece));
}
if pieces > MOST_PIECES {
return Err(Error::Limit(Limit::ObjectThreadgroups {
groups,
max: MOST_PIECES * held,
}));
}
Ok(Launch::Pieces {
piece,
// At most `MOST_PIECES`.
pieces: pieces as u32,
})
}
/// The records of a launch in pieces: `pieces` copies of `piece`, [`RECORD`] bytes each.
pub(crate) fn records(piece: [u32; 3], pieces: u32) -> Vec<u8> {
let one: Vec<u8> = piece.iter().flat_map(|axis| axis.to_le_bytes()).collect();
one.repeat(pieces as usize)
}
/// The group counts' bytes, as the object function or the launcher reads them.
pub(crate) fn count_bytes(counts: [u32; 3]) -> [u8; 12] {
let mut out = [0; 12];
for (at, axis) in out.as_chunks_mut::<4>().0.iter_mut().zip(counts) {
*at = axis.to_le_bytes();
}
out
}
+13 -4
View File
@@ -205,8 +205,9 @@ impl ClearColor {
///
/// A store action that resolves resolves into `resolve_texture` by the device's average (the
/// module's documentation). Refused, as [`Gap::RenderPass`] of [`RenderPassKind::Resolve`]: a
/// resolve of an extended-range, bfloat or YCbCr format, which Vulkan's average would take in the
/// image's own encoding. An integer format has no resolve, [`Refusal::ResolveFormat`].
/// resolve of an extended-range format but `BGR10_XR` and `BGRA10_XR` (whose codes average as their
/// values do), or of a bfloat or YCbCr format, which Vulkan's average would take in the image's
/// own encoding. An integer format has no resolve, [`Refusal::ResolveFormat`].
///
/// Not built: `storeActionOptions`, whose one option needs more than one sample.
///
@@ -928,11 +929,14 @@ impl Pass {
if !matches!(formats::sampled_type(pf), Some(SampledType::Float)) {
return Err(Error::Refused(Refusal::ResolveFormat { pixel_format: pf }));
}
// `BGR10_XR`'s and `BGRA10_XR`'s codes average as their values do (the map
// is affine), the device rounding the average.
if !matches!(
texture.emulation(),
FormatEmulation::Direct
| FormatEmulation::RotatedView
| FormatEmulation::AlphaInRed
| FormatEmulation::ExtendedRangeUnorm
) {
return Err(gap(RenderPassKind::Resolve));
}
@@ -1358,14 +1362,19 @@ fn target(
/// The Vulkan clear value of `color` for a color attachment of `pf` held as `emulation`: an
/// integer channel's value truncated toward zero and saturated to its range, NaN 0; any other
/// channel's as a `float`, in the image's channels: a rotated format's, and `A8Unorm`'s held in
/// `R8_UNORM`, rotated (`to_rotated_image`), so its alpha lands in red. `None` where only a shader
/// clears the format: an extended-range, bfloat or YCbCr format.
/// `R8_UNORM`, rotated (`to_rotated_image`), so its alpha lands in red; `BGR10_XR`'s and
/// `BGRA10_XR`'s as the UNORM codes Metal's clear stores (`metal::format::extended_unorm_clear`).
/// `None` where only a shader clears the format: another extended-range, bfloat or YCbCr format.
pub(crate) fn clear_color(
pf: PixelFormat,
emulation: FormatEmulation,
color: ClearColor,
) -> Option<vk::ClearColorValue> {
let rgba = [color.red, color.green, color.blue, color.alpha];
if emulation == FormatEmulation::ExtendedRangeUnorm {
return formats::extended_unorm_clear(pf, rgba)
.map(|float32| vk::ClearColorValue { float32 });
}
if !matches!(
emulation,
FormatEmulation::Direct | FormatEmulation::RotatedView | FormatEmulation::AlphaInRed
+58 -18
View File
@@ -67,7 +67,7 @@ use crate::encoder::{
};
use crate::error::{Error, Gap, IndirectCommandsKind, KernelInputKind, Refusal};
use crate::hazard::Access;
use crate::kernel_map::KernelKey;
use crate::kernel_map::{Chroma, KernelKey};
use crate::reaper::{Free, Job};
use crate::ring::CHUNK;
use crate::sampler::{canonical, constexpr_notes, hold_constexpr, release_constexpr};
@@ -89,6 +89,7 @@ use metal2vulkan::pipeline::{
StageEntries, StageSource, TextureAccess, TextureSlot, GRID_TILE_THREADS,
};
use metal2vulkan::Budget;
use std::collections::BTreeSet;
use std::ffi::CString;
use std::sync::atomic::{AtomicU64, Ordering::Relaxed};
use std::sync::{Arc, Condvar, Mutex, MutexGuard, OnceLock, PoisonError};
@@ -820,6 +821,10 @@ pub(crate) struct Interface {
pub(crate) constexprs: Vec<(usize, CombinedSampler)>,
/// Whether the kernel reads through an address that is not one of its bound slots.
pub(crate) reads_unbound: bool,
/// Whether the kernel may read, sample or gather a `float` colour texture through a handle
/// (`PipelineInterface::handle_float_images`): while a 4:2:2 texture lives on the device, a
/// dispatch of it runs its content lowered under `LoweringInputs::chroma_handles`.
pub(crate) handle_float_images: bool,
/// Whether the kernel writes through an address that is not one of its bound slots.
pub(crate) writes_unbound: bool,
/// Whether the kernel may reach a texture through its storage image through an address that
@@ -1072,6 +1077,10 @@ pub(crate) enum FieldValue {
/// past which a vertex function's `[[viewport_array_index]]` stores `ViewportIndex` 0
/// (`PushField::ViewportCount`).
ViewportCount,
/// Two `f32`s: the near depth of the encoder's first viewport and its far depth less its
/// near, which a depth range twin's vertex function folds into its position
/// (`PushField::DepthRangeFold`, `crate::RenderPipelineState::folded`).
DepthRangeFold,
/// A `u64`: the address of the execution range the vertex function of a state made for
/// indirect command buffers tests its command against (`PushField::IndirectRange`): the
/// ring's range of every command (`Ring::whole`) for a direct draw and an execution over a
@@ -1084,6 +1093,10 @@ pub(crate) enum FieldValue {
/// A `u32`: the first command of the part of an execution the draw is
/// (`PushField::IndirectBase`), 0 for a direct draw; an execution pushes each part's own.
IndirectBase,
/// A `u64`: the address of a mesh draw's three threadgroup counts, Metal's
/// `MTLDispatchThreadgroupsIndirectArguments`, which a mesh render pipeline's object function,
/// or its launcher where it has none, reads (`PushField::GroupCountsAddress`).
GroupCounts,
}
/// A `VkPipeline`'s specialization: the threadgroup size, the threadgroup memory lengths in the
@@ -1209,11 +1222,12 @@ impl crate::Device {
srgb: [0; 2],
words: 0,
arrays: 0,
chroma: Chroma::default(),
};
let compiled = match core.kernels.find(&key) {
Some(compiled) => compiled,
None => {
let compiled = Arc::new(Compiled::of(core, descriptor, (0, 0))?);
let compiled = Arc::new(Compiled::of(core, descriptor, (0, 0, Chroma::default()))?);
core.kernels.keep(key.clone(), compiled, &core.counters)
}
};
@@ -1230,16 +1244,30 @@ impl crate::Device {
}
}
/// The texture slots of `stage` that `mask` names, bit `i` slot `i`: those a content lowers for
/// a 4:2:2 texture (`LoweringInputs::chroma_pairs`).
pub(crate) fn chroma_slots(stage: Stage, mask: u128) -> BTreeSet<SlotRef> {
(0..TEXTURE_SLOTS)
.filter(|&index| mask >> index & 1 == 1)
.map(|index| SlotRef {
stage,
class: SlotClass::Texture,
index,
})
.collect()
}
impl Compiled {
/// The translation of `descriptor`, every variant lowered, with the `VkPipeline`s whose key
/// the descriptor holds; a function kernel's under its texture slots of `srgb` (bit `i` slot
/// `i`) holding an 8-bit sRGB texture's UNORM twin (`LoweringInputs::srgb_storage`) and its
/// `i`) holding an 8-bit sRGB texture's UNORM twin (`LoweringInputs::srgb_storage`), its
/// buffer slots of `words` bound at a multiple of 4 below their argument's alignment
/// (`LoweringInputs::word_bound_buffers`).
/// (`LoweringInputs::word_bound_buffers`), and the 4:2:2 textures `chroma` reaches
/// (`LoweringInputs::chroma_pairs` of its first slots, `LoweringInputs::chroma_handles`).
fn of(
core: &Arc<Core>,
descriptor: &ComputePipelineDescriptor,
(srgb, words): (u128, u32),
(srgb, words, chroma): (u128, u32, Chroma),
) -> Result<Compiled, Error> {
let core = Arc::clone(core);
let budget = Budget::standard();
@@ -1272,6 +1300,8 @@ impl Compiled {
index,
})
.collect();
inputs.chroma_pairs = chroma_slots(Stage::Kernel, chroma.slots[0]);
inputs.chroma_handles = chroma.handles;
let plain = translating(&core, || {
translator.kernel_inputs_read(function, &inputs, &budget, entries)
})
@@ -1979,9 +2009,6 @@ pub(crate) fn interface(
.iter()
.position(|&numbered| numbered == NumberedSampler::Constexpr(words))
.ok_or(KernelInputKind::ConstexprSampler)?;
if sampler.unnormalized {
return Err(KernelInputKind::ConstexprSampler);
}
constexprs.push((at, sampler));
FieldValue::ConstexprSampler(at)
}
@@ -2114,6 +2141,7 @@ pub(crate) fn interface(
numbered,
constexprs,
reads_unbound: translated.reads_unbound_resources,
handle_float_images: translated.handle_float_images,
writes_unbound: translated.writes_unbound_resources,
unbound_storage: translated.unbound_storage_textures,
has_effects: translated.writes_memory,
@@ -2582,34 +2610,46 @@ impl PipelineInner {
/// holding an 8-bit sRGB texture's UNORM twin, each write there encoded in the shader
/// (`LoweringInputs::srgb_storage`), and its buffer slots of `words` bound at a multiple of 4
/// below their argument's alignment, each held to what its accesses need
/// (`LoweringInputs::word_bound_buffers`): the one the device's map of contents holds under
/// the state's key with both, else lowered now and kept there, so the map bounds how many
/// live. It numbers the state's samplers, as it lowers the same function. `None` for a kernel
/// the consumer compiled, which has no function to lower it from. A make, at the dispatch that
/// needs it, counts in [`Metrics::translations_at_encode`](crate::Metrics).
/// (`LoweringInputs::word_bound_buffers`), and its reads of the 4:2:2 textures `chroma`
/// reaches decoded (`LoweringInputs::chroma_pairs`, `LoweringInputs::chroma_handles`): the
/// one the device's map of contents holds under the state's key with them, else lowered now
/// and kept there, so the map bounds how many live. It numbers the state's samplers, as it
/// lowers the same function. `None` for a kernel the consumer compiled, which has no function
/// to lower it from. A make, at the dispatch that needs it, counts in
/// [`Metrics::translations_at_encode`](crate::Metrics), and one for `chroma` in
/// [`Metrics::chroma_contents`](crate::Metrics) too.
///
/// Err: the translator's errors of its lowering, as the state's creation reports them;
/// [`Gap::KernelInput`] of a constexpr sampler where it samples one the state's module does
/// not.
pub(crate) fn variant(&self, srgb: u128, words: u32) -> Option<Result<Arc<Compiled>, Error>> {
pub(crate) fn variant(
&self,
srgb: u128,
words: u32,
chroma: Chroma,
) -> Option<Result<Arc<Compiled>, Error>> {
let core = self.core();
let (descriptor, key) = self.source.as_ref()?;
let key = KernelKey {
srgb: [srgb, 0],
words: u64::from(words),
chroma,
..key.clone()
};
if let Some(compiled) = core.kernels.find(&key) {
return Some(Ok(compiled));
}
let began = host_time();
if chroma.any() {
core.counters.count(Metric::ChromaContents);
}
let made =
Compiled::of(core, descriptor, (srgb, words)).and_then(|compiled| {
match covers(&self.compiled.whole.interface, &compiled.whole.interface) {
Compiled::of(core, descriptor, (srgb, words, chroma)).and_then(
|compiled| match covers(&self.compiled.whole.interface, &compiled.whole.interface) {
true => Ok(core.kernels.keep(key, Arc::new(compiled), &core.counters)),
false => Err(gap(KernelInputKind::ConstexprSampler)),
}
});
},
);
(core.counters).translation_at_encode(host_time().saturating_sub(began));
Some(made)
}
-29
View File
@@ -1,8 +1,6 @@
//! Places: the Private blocks the runtime places textures' images in, taken as the consumer takes
//! blocks. A texture block holds images alone, so no buffer lies beside an optimal image in one
//! block.
//! When the device enables buffer address replay, the pool keeps texture allocations separate
//! and leaves their replay flags clear. Restoring a buffer can still request its captured address.
//!
//! A place is a resource's bytes at a multiple of its alignment. One no longer than the class's
//! block length ([`MemoryClass::block_len`]) is the first that fits in the blocks of that length,
@@ -250,33 +248,6 @@ impl Ranges {
Some(at)
}
/// Takes the exact range `at..at + len` if it is completely free.
pub(crate) fn take_at(&mut self, at: u64, len: u64) -> bool {
let Some(stop) = at.checked_add(len) else {
return false;
};
let Some(index) = self
.free
.iter()
.position(|&(start, end)| start <= at && stop <= end)
else {
return false;
};
let (start, end) = self.free[index];
match (start < at, stop < end) {
(false, false) => {
self.free.remove(index);
}
(true, false) => self.free[index] = (start, at),
(false, true) => self.free[index] = (stop, end),
(true, true) => {
self.free[index] = (start, at);
self.free.insert(index + 1, (stop, end));
}
}
true
}
/// Frees `offset..offset + len`, taken before, joining it to the free ranges beside it.
pub(crate) fn give(&mut self, offset: u64, len: u64) {
let end = offset + len;
+9 -62
View File
@@ -20,7 +20,7 @@ pub struct CommandQueue {
/// The queue itself: what its command buffers and the submit thread hold.
pub(crate) struct QueueInner {
recording: Recording,
max: u32,
/// The command buffers made and not yet retired, and the lists retired ones left.
live: Mutex<Live>,
/// Signalled when one retires.
@@ -46,34 +46,13 @@ pub(crate) struct QueueInner {
/// A queue's live command buffers: those made and not yet retired, and the kept-object lists
/// of retired ones, empty, with their capacity, each in the allocation it came in
/// (`crate::kept::Objects`). Host batches keep only a submission group's worth of idle lists.
/// (`crate::kept::Objects`): together at most the queue's maximum, since each list is a live
/// command buffer's or one retired since.
struct Live {
count: usize,
count: u32,
objects: Vec<Objects>,
}
#[derive(Clone, Copy)]
enum Recording {
Metal(u32),
HostBatch,
}
impl Recording {
fn has_room(self, live: usize) -> bool {
match self {
Self::Metal(max) => live < max as usize,
Self::HostBatch => true,
}
}
fn recycle(self, idle: usize) -> bool {
match self {
Self::Metal(_) => true,
Self::HostBatch => idle < crate::submit::GROUP,
}
}
}
impl Device {
/// `newCommandQueueWithMaxCommandBufferCount:`; `newCommandQueue` is this call with 64.
///
@@ -86,22 +65,10 @@ impl Device {
if max_command_buffer_count == 0 {
return Err(Error::Refused(Refusal::NoCommandBuffers));
}
Ok(self.queue_with_recording(Recording::Metal(max_command_buffer_count)))
}
/// A private FIFO for host copies prepared together and published after their dependencies
/// have been recorded. Recording must never wait for another member of that transaction to
/// retire. Committed work follows the ordinary submit thread's ordering and GPU pacing.
/// The host owns the lifetime of the batch and the memory held by its recorded copies.
pub fn new_host_batch_queue(&self) -> CommandQueue {
self.queue_with_recording(Recording::HostBatch)
}
fn queue_with_recording(&self, recording: Recording) -> CommandQueue {
let core = self.core();
CommandQueue {
Ok(CommandQueue {
inner: Arc::new(QueueInner {
recording,
max: max_command_buffer_count,
live: Mutex::new(Live {
count: 0,
objects: Vec::new(),
@@ -115,7 +82,7 @@ impl Device {
core: Arc::downgrade(core),
}),
device: self.clone(),
}
})
}
}
@@ -133,7 +100,7 @@ impl CommandQueue {
if core.closed() {
return Err(Error::Quiesced);
}
if self.inner.recording.has_room(live.count) {
if live.count < self.inner.max {
break;
}
if crate::device::on_handler_thread(core) {
@@ -238,9 +205,7 @@ impl QueueInner {
self.counters.fall(Gauge::CommandBuffers);
let mut live = lock(&self.live);
live.count -= 1;
if self.recording.recycle(live.objects.len()) {
live.objects.push(kept);
}
live.objects.push(kept);
drop(live);
self.room.notify_one();
}
@@ -256,21 +221,3 @@ pub(crate) fn next_run(expected: Option<u64>, nanos: u64) -> u64 {
_ => nanos.min(u64::MAX - 1),
}
}
#[cfg(test)]
mod recording_tests {
use super::Recording;
#[test]
fn host_batches_stage_independently_of_the_metal_recording_window() {
let metal = Recording::Metal(2);
assert!(metal.has_room(1));
for live in [2, 3, 64, 65, 128] {
assert!(!metal.has_room(live));
assert!(Recording::HostBatch.has_room(live));
}
let group = crate::submit::GROUP;
assert!(Recording::HostBatch.recycle(group - 1));
assert!(!Recording::HostBatch.recycle(group));
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+74 -2
View File
@@ -22,6 +22,9 @@
//! A slot the fragment function reads only at its own pixel (`StageModule::own_pixel_textures`)
//! reads the rectangle of the draw's scissor, a pixel wider each way for its helper invocations,
//! clamped into its level; any other slot reads every level and layer its texture reaches.
//!
//! The copies' bytes are counted by read (at the fragment's own pixel, or all a texture reaches)
//! and by when they come ([`Moment`]).
/// The most areas a shadow's [`Held`] keeps: past them it forgets the oldest, which a later read
/// copies again.
@@ -196,11 +199,62 @@ pub(crate) fn parted(
(rendered, rest)
}
/// When a draw copies into a shadow, for its copies' counters
/// ([`Metrics::attachment_read_copy_bytes_first_in_pass`](crate::Metrics::attachment_read_copy_bytes_first_in_pass)
/// and the two beside it), taken before the draw plans them.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) enum Moment {
/// The shadow has held nothing since its pass began.
FirstInPass,
/// A memory barrier after draws, or a draw that reads a colour attachment at its own pixel
/// after draws, left it holding nothing.
AfterBarrier,
/// It holds something, and the draw reads what it does not hold.
BeyondHeld,
}
/// The bytes of a draw's copies into its pass's shadows, parted for their counters: by read and by
/// [`Moment`].
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub(crate) struct Copied {
/// Of reads at the fragment's own pixel ([`own_pixel`]).
pub(crate) own_pixel: u64,
/// Of reads of all a texture reaches ([`whole`]).
pub(crate) whole_texture: u64,
/// Of each [`Moment`].
pub(crate) first_in_pass: u64,
pub(crate) after_barrier: u64,
pub(crate) beyond_held: u64,
}
impl Copied {
/// A copy of `bytes` for a read at the fragment's own pixel or not, at `moment`.
pub(crate) fn add(&mut self, bytes: u64, own_pixel: bool, moment: Moment) {
*match own_pixel {
true => &mut self.own_pixel,
false => &mut self.whole_texture,
} += bytes;
*match moment {
Moment::FirstInPass => &mut self.first_in_pass,
Moment::AfterBarrier => &mut self.after_barrier,
Moment::BeyondHeld => &mut self.beyond_held,
} += bytes;
}
/// All the copies' bytes.
pub(crate) fn bytes(&self) -> u64 {
self.own_pixel + self.whole_texture
}
}
/// What a shadow holds of its image since the pass's first copy into it or its last memory
/// barrier after draws: areas, each copied whole, at most [`HELD`] of them.
/// barrier after draws: areas, each copied whole, at most [`HELD`] of them; and, for the copies'
/// counters, whether a memory barrier left it holding nothing since it last held something.
#[derive(Debug, Default)]
pub(crate) struct Held {
areas: Vec<Area>,
/// A memory barrier after draws left it holding nothing, and it has held nothing since.
dropped: bool,
}
impl Held {
@@ -239,6 +293,24 @@ impl Held {
/// A memory barrier after draws: the shadow holds nothing of what they rendered.
pub(crate) fn clear(&mut self) {
self.areas.clear();
if !self.areas.is_empty() {
self.dropped = true;
self.areas.clear();
}
}
/// When a draw's copies come, taken before the draw plans them.
pub(crate) fn moment(&self) -> Moment {
match (self.areas.is_empty(), self.dropped) {
(false, _) => Moment::BeyondHeld,
(true, false) => Moment::FirstInPass,
(true, true) => Moment::AfterBarrier,
}
}
/// The draw's copies made the shadow hold something after it held nothing
/// ([`Moment::FirstInPass`] or [`Moment::AfterBarrier`]).
pub(crate) fn began(&mut self) {
self.dropped = false;
}
}
+9 -1
View File
@@ -2420,12 +2420,20 @@ impl WorkState {
// their ranges by writes submitted before, which its upload makes first
// (`crate::capture`).
let taken = self.changes.captured.take(&batch.leads);
for (_, copy_in) in &taken {
for (lead, copy_in) in &taken {
copy_in.backs(&mut batch.backs);
if let Some(coherence) = &core.coherence {
let flushes = batch.flushes.get_or_insert_with(Box::default);
flushes.copied.extend(copy_in.shared_ranges(coherence.atom));
}
// A taker with nothing for the GPU has the copy-in as its submission
// (`Gpu::copy_in_only`). It has one segment, so its group finished it.
let seq = batch.leads[*lead];
if let Some((_, pending, _)) = (batch.finished.iter_mut())
.find(|(_, pending, _)| pending.seq == seq && pending.gpu.is_empty())
{
pending.gpu.copy_in_only = true;
}
}
// The copies back owed by writes submitted before it to the Managed buffers its segments
// reach, which its upload makes first: as it goes, the order of each write and its
@@ -198,8 +198,7 @@ mod on_device {
/// The floor's last item, asked of the created device: every device of the cfg's kind
/// supports both of the runtime's set layouts (`vkGetDescriptorSetLayoutSupport`), the empty
/// set 0 and set 1 of the arrays, with the sampled-texture array's second elements where the
/// device reads attachments, which `Device::new` asks before it makes them.
/// set 0 and set 1 of the arrays, which `Device::new` asks before it makes them.
#[test]
fn every_device_supports_the_runtimes_set_layouts() {
let instance = crate::tests::validation::instance(&[]);
@@ -215,13 +214,11 @@ mod on_device {
let empty = vk::DescriptorSetLayoutCreateInfo::default();
// SAFETY: the device is live, with the floor's features.
unsafe { supported(raw, &empty, 0) }.unwrap_or_else(|error| panic!("{name}: {error}"));
for seconds in [false, device.core().attachment_reads] {
with_arrays_layout(layout_counts(seconds), |info| {
// SAFETY: the device is live, with the floor's features.
unsafe { supported(raw, info, 1) }
})
.unwrap_or_else(|error| panic!("{name}: {error}"));
}
with_arrays_layout(layout_counts(), |info| {
// SAFETY: the device is live, with the floor's features.
unsafe { supported(raw, info, 1) }
})
.unwrap_or_else(|error| panic!("{name}: {error}"));
println!("floor: {name}: set layouts 0 and 1 supported");
}
}
@@ -259,7 +256,7 @@ mod on_device {
let start = Instant::now();
// SAFETY: the device is live and made at the floor.
let buffers = core.translator.profile().binds_kernel_buffers();
let second = unsafe { Arrays::new(&core.device, &counters, (false, buffers)) }
let second = unsafe { Arrays::new(&core.device, &counters, buffers) }
.unwrap_or_else(|error| panic!("{name}: a second set 1: {error}"));
let micros = start.elapsed().as_micros();
assert_eq!(counters.gauges().device_samplers, 4, "{name}");
@@ -0,0 +1,87 @@
//! The driver's make of a render content lowered for a 4:2:2 texture
//! (`LoweringInputs::chroma_pairs`) beside the same state's own content, under a device cfg on
//! every device of the cfg's kind: `colored_vertex` with the owned fixture `device_level`'s
//! `dl_runtime`, one sample of texture 0 through the runtime sampler at sampler 0, decoded at
//! texture 0; and `grd_half_many_samples` drawn by `grd_many_vertex`, 40 samples of each of its
//! eight textures through one runtime sampler, decoded at texture 3 (40 sites). Each content's
//! main pipeline is made by `finish_pipeline`, and the test prints its `vkCreateGraphicsPipelines`
//! time (`Metrics::pipeline_creation_nanos`), its translation's and its modules' SPIR-V bytes. The
//! driver's own shader cache is the job's: a job that times a cold make gives the process an empty
//! one.
//!
//! `llvm-as` assembles the functions; without it the test skips visibly.
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
mod on_device {
use crate::kernel_map::Chroma;
use crate::tests::command::on_device::each_device;
use crate::tests::draw::on_device::{descriptor, examples, library};
use crate::{
ColorAttachmentDescriptor, FunctionDescriptor, PixelFormat, RenderPipelineDescriptor,
RenderPipelineState, StageSource,
};
use metal2vulkan_devtools::engine_dir;
#[test]
fn four_two_two_content_make_time() {
let (Some(examples), Some(levels), Some(many)) = (
examples(),
library(&engine_dir().join("device_level.ll")),
library(&engine_dir().join("grd_half_many_samples.ll")),
) else {
return;
};
let function = |library: &crate::Library, name| {
StageSource::Function(FunctionDescriptor::new(
library.function(name).expect("the function"),
))
};
let mut one = descriptor(&examples, "colored_fragment", PixelFormat::RGBA8Unorm);
one.fragment = Some(function(&levels, "dl_runtime"));
let mut forty = RenderPipelineDescriptor::new(function(&many, "grd_many_vertex"));
forty.fragment = Some(function(&many, "grd_half_many_samples"));
for color in &mut forty.color_attachments[..2] {
*color = Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA16Float));
}
let cases = [("1 site", one, 1u128), ("40 sites", forty, 1 << 3)];
each_device("4:2:2 content make time", |name, _, device| {
for (case, d, slots) in &cases {
let made = |what: &str, state: &RenderPipelineState| {
let before = device.counters().metrics();
(state.finish_pipeline())
.unwrap_or_else(|error| panic!("{name}: {case}: {what}: {error}"));
let after = device.counters().metrics();
let created = after.pipelines_created - before.pipelines_created;
let nanos = after.pipeline_creation_nanos - before.pipeline_creation_nanos;
println!(
"{name}: {case}: {what}: {created} pipeline in {:.1} ms, {} bytes of SPIR-V",
nanos as f64 / 1e6,
state.allocated_size()
);
assert_eq!(created, 1, "{name}: {case}: {what}: the pipelines made");
};
let state = (device.new_render_pipeline_state(d, |samplers| {
assert!(samplers.is_empty(), "{name}: {case}: {samplers:?}");
Ok(Vec::new())
}))
.unwrap_or_else(|error| panic!("{name}: {case}: {error}"));
made("plain", &state);
let before = device.counters().metrics();
let chroma = Chroma {
slots: [0, *slots],
handles: false,
};
let decoded = (state.for_draws(&device, (0, [0; 2], chroma)))
.unwrap_or_else(|error| panic!("{name}: {case}: {error}"));
let after = device.counters().metrics();
let contents = after.chroma_contents - before.chroma_contents;
assert_eq!(contents, 1, "{name}: {case}");
println!(
"{name}: {case}: 4:2:2 content translated in {:.1} ms",
(after.translation_nanos - before.translation_nanos) as f64 / 1e6
);
made("4:2:2", &decoded);
}
});
}
}
@@ -0,0 +1,529 @@
//! Metal's 4:2:2 chroma-pair textures (`GBGR422`, `BGRG422`) made over a buffer laid out as a
//! CoreVideo surface of the matching FourCC lays it out ('yuvs': Y0 Cb Y1 Cr; '2vuy': Cb Y0 Cr
//! Y1), as the consumer makes one for `newTextureWithDescriptor:iosurface:plane:`, under a device
//! cfg on every device of the cfg's kind, through the owned fixture `fpv_swizzled_reads`:
//!
//! - over a Shared and a Private buffer, a 64 by 8 texture of shader-read usage at rows 128 bytes
//! apart (the surface's own pitch for that width) and at 192, and a 640 by 480 one at 1280 over a
//! Private buffer (the consumer's camera frames: 'yuvs', 1280 bytes a row): each is made, in the
//! form `Buffer::texture_copy_cause` answers for it, which for the 640 by 480 one is in place;
//! - a read of each texel, and a nearest sample at its centre, answer Metal's decode exactly
//! (an Apple M3 Max under macOS 27.0.1): green the texel's own
//! luma, red and blue `(3c + n + 2) >> 2` of its pair's chroma `c` and the chroma `n` of the pair
//! on its side (left for an even texel, right for an odd one, the pair itself at the edges), each
//! code `c / 255` correctly rounded, alpha 1;
//! - a gather of each component at the corner of each 2 by 2 footprint answers those four texels'
//! values in Metal's order, `(i0, j1)`, `(i1, j1)`, `(i1, j0)`, `(i0, j0)`;
//! - a linear sample a quarter of the way between two texels, and at the corner of a footprint,
//! answers the weighted mean of the decoded texels (weights 3/4 and 1/4, or 1/4 each), within
//! `f32` rounding;
//! - each kernel state's dispatches run its content lowered for the texture: one content a state
//! (`Metrics::chroma_contents`), every dispatch counted (`Metrics::chroma_launches`), and the
//! texture counted live while it lives (`Gauges::chroma_textures`).
//!
//! On every device too, what Metal refuses of the formats is refused (`Refusal::ChromaPairs`: a
//! 2D array, an odd width, two levels, a view), and the uses the runtime does not build are gaps
//! (`Gap::ChromaPairsUse`: shader-write and render-target usage, a swizzle).
//!
//! The bytes are a hash of their place, so neighbouring pairs' chroma do not all differ by
//! multiples of 4 and the decode's rounding shows. `llvm-as` assembles the kernels; without it the
//! test skips visibly.
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
pub(crate) mod on_device {
use crate::tests::command::on_device::{each_device, finished};
use crate::texture::TextureObject;
use crate::{
Buffer, ChromaPairsGap, ChromaPairsRule, ComputePipelineDescriptor, ComputePipelineState,
Device, DispatchType, Error, FunctionDescriptor, Gap, IndexClass, Library, MemoryClass,
PixelFormat, Refusal, SamplerDescriptor, SamplerMinMagFilter, SamplerState, StageSource,
Texture, TextureDescriptor, TextureSwizzle, TextureType, TextureUsage,
};
use metal2vulkan_devtools::{engine_dir, llvm_assemble, AssembleError};
/// The two formats, each with the FourCC whose surface lays its bytes out.
const FORMATS: [(PixelFormat, &str); 2] = [
(PixelFormat::GBGR422, "yuvs"),
(PixelFormat::BGRG422, "2vuy"),
];
/// The threads of a threadgroup of every dispatch.
pub(crate) const GROUP: u32 = 64;
/// The fixture's library, or None where `llvm-as` is missing.
fn library() -> Option<Library> {
let path = engine_dir().join("fpv_swizzled_reads.ll");
match llvm_assemble(&path) {
Ok(bitcode) => Some(Library::from_air(&bitcode).expect("the library")),
Err(AssembleError::Missing(why)) => {
eprintln!("SKIPPED: {why}");
None
}
Err(error) => panic!("{}: {error:?}", path.display()),
}
}
/// The kernel `name`'s state.
fn state(device: &Device, library: &Library, name: &str) -> ComputePipelineState {
let function = library.function(name).expect("the kernel");
let descriptor = ComputePipelineDescriptor::new(StageSource::Function(
FunctionDescriptor::new(function),
));
(device.new_compute_pipeline_state(&descriptor, |samplers| Ok(vec![0; samplers.len()])))
.unwrap_or_else(|error| panic!("{name}: {error}"))
}
/// Byte `k` of a texture's rows, counted along the rows without their padding: a hash of `k`.
pub(crate) fn byte(k: u32) -> u8 {
let mut h = k.wrapping_mul(2_654_435_761).wrapping_add(0x9e37_79b9);
h ^= h >> 15;
h = h.wrapping_mul(0x85eb_ca6b);
h ^= h >> 13;
h as u8
}
/// The bytes of a `width` by `height` texture at rows `pitch` bytes apart, each row's padding
/// 0xee.
fn rows(width: u32, height: u32, pitch: u64) -> Vec<u8> {
let row = 2 * width;
let mut bytes = vec![0xee; (pitch * u64::from(height)) as usize];
for y in 0..height {
for b in 0..row {
bytes[(u64::from(y) * pitch + u64::from(b)) as usize] = byte(y * row + b);
}
}
bytes
}
/// Metal's codes of texel `(x, y)` of a `width`-wide texture of `format` over [`rows`]' bytes:
/// red, green, blue, and alpha 255.
fn codes(format: PixelFormat, width: u32, x: u32, y: u32) -> [u32; 4] {
let row = 2 * width;
let at = |b: u32| u32::from(byte(y * row + b));
let pairs = width / 2;
let pair = x / 2;
let side = match x % 2 {
0 => pair.saturating_sub(1),
_ => (pair + 1).min(pairs - 1),
};
// The bytes of a pair: GBGR422's Y0 Cb Y1 Cr, BGRG422's Cb Y0 Cr Y1.
let (luma, cb, cr) = match format {
PixelFormat::GBGR422 => (if x % 2 == 0 { 0 } else { 2 }, 1, 3),
_ => (if x % 2 == 0 { 1 } else { 3 }, 0, 2),
};
let chroma = |byte: u32| (3 * at(pair * 4 + byte) + at(side * 4 + byte) + 2) >> 2;
[chroma(cr), at(pair * 4 + luma), chroma(cb), 255]
}
/// Metal's value of texel `(x, y)`: each code over 255, correctly rounded.
fn texel(format: PixelFormat, width: u32, x: u32, y: u32) -> [f32; 4] {
codes(format, width, x, y).map(|c| (f64::from(c) / 255.0) as f32)
}
/// A buffer of `class` holding `bytes` at its start, in a block of its own: a Private one
/// written by a blit from a Shared one.
pub(crate) fn buffer_of(
name: &str,
device: &Device,
class: MemoryClass,
bytes: &[u8],
) -> Buffer {
let len = bytes.len() as u64;
let shared = |len: u64| {
let block = (device.take_block(MemoryClass::Shared, len))
.unwrap_or_else(|error| panic!("{name}: {error}"));
(device.new_buffer(block.id, 0, len, None))
.unwrap_or_else(|error| panic!("{name}: {error}"))
};
let staged = shared(len);
let contents = staged.contents().expect("a Shared buffer");
// SAFETY: the buffer holds `len` bytes, all written, and no work is pending on it.
unsafe { (bytes.as_ptr()).copy_to_nonoverlapping(contents.as_ptr(), bytes.len()) };
if class == MemoryClass::Shared {
return staged;
}
let block =
(device.take_block(class, len)).unwrap_or_else(|error| panic!("{name}: {error}"));
let private = (device.new_buffer(block.id, 0, len, None))
.unwrap_or_else(|error| panic!("{name}: {error}"));
let queue = device.new_command_queue(1).expect("a queue");
let command_buffer = queue.command_buffer().expect("a command buffer");
let mut blit = command_buffer.blit_command_encoder().expect("an encoder");
(blit.copy_from_buffer_to_buffer(&staged, 0, &private, 0, len))
.unwrap_or_else(|error| panic!("{name}: the fill: {error}"));
blit.end_encoding();
command_buffer.commit().expect("a commit");
finished(name, &command_buffer);
assert_eq!(command_buffer.error(), None, "{name}: the fill");
private
}
/// One thread of `kernel` at each of `positions` (8 bytes each) over `texture` through
/// `sampler`: each thread's `float4`.
fn run(
name: &str,
device: &Device,
(state, texture, sampler): (&ComputePipelineState, &Texture, &SamplerState),
positions: &[[u8; 8]],
) -> Vec<[f32; 4]> {
let n = positions.len() as u32;
let bytes: Vec<u8> = positions.iter().flatten().copied().collect();
let at = buffer_of(name, device, MemoryClass::Shared, &bytes);
let out = buffer_of(
name,
device,
MemoryClass::Shared,
&vec![0xab; 16 * n as usize],
);
let queue = device.new_command_queue(1).expect("a queue");
let command_buffer = queue.command_buffer().expect("a command buffer");
let mut encoder =
(command_buffer.compute_command_encoder(DispatchType::Serial)).expect("an encoder");
encoder
.set_compute_pipeline_state(state)
.expect("the state");
encoder.set_texture(Some(texture), 0).expect("the texture");
(encoder.set_sampler_state(Some(sampler), 0)).expect("the sampler");
encoder.set_buffer(Some(&out), 0, 0).expect("the output");
encoder.set_buffer(Some(&at), 0, 1).expect("the positions");
(encoder.dispatch_threads([n, 1, 1], [GROUP.min(n), 1, 1])).expect("the dispatch");
encoder.end_encoding();
command_buffer.commit().expect("a commit");
finished(name, &command_buffer);
assert_eq!(command_buffer.error(), None, "{name}");
let contents = out.contents().expect("a Shared buffer");
// SAFETY: the dispatch that wrote the buffer finished, and its writes reach the host; the
// buffer holds `16 n` bytes.
let floats =
unsafe { std::slice::from_raw_parts(contents.as_ptr().cast::<f32>(), 4 * n as usize) };
(floats.chunks(4))
.map(|c| std::array::from_fn(|k| c[k]))
.collect()
}
/// A texel coordinate's position.
fn texel_at(x: u32, y: u32) -> [u8; 8] {
let mut p = [0u8; 8];
p[..4].copy_from_slice(&x.to_le_bytes());
p[4..].copy_from_slice(&y.to_le_bytes());
p
}
/// A normalized coordinate's position.
fn point(u: f32, v: f32) -> [u8; 8] {
let mut p = [0u8; 8];
p[..4].copy_from_slice(&u.to_le_bytes());
p[4..].copy_from_slice(&v.to_le_bytes());
p
}
fn bits(x: [f32; 4]) -> [u32; 4] {
x.map(f32::to_bits)
}
/// One texture to make and read: its size, the buffer's memory and the rows' pitch.
struct Case {
size: (u32, u32),
class: MemoryClass,
pitch: u64,
/// The consumer's camera frame, which must lie in place.
in_place: bool,
}
const CASES: [Case; 5] = [
Case {
size: (64, 8),
class: MemoryClass::Shared,
pitch: 128,
in_place: false,
},
Case {
size: (64, 8),
class: MemoryClass::Shared,
pitch: 192,
in_place: false,
},
Case {
size: (64, 8),
class: MemoryClass::Private,
pitch: 128,
in_place: false,
},
Case {
size: (64, 8),
class: MemoryClass::Private,
pitch: 192,
in_place: false,
},
Case {
size: (640, 480),
class: MemoryClass::Private,
pitch: 1280,
in_place: true,
},
];
/// The texels a case reads and samples: every texel of a 64 by 8 texture; the first 64 by 8 of
/// a larger one, and its last row's last 64 texels.
fn reached(width: u32, height: u32) -> Vec<(u32, u32)> {
let mut at: Vec<(u32, u32)> = (0..8).flat_map(|y| (0..64).map(move |x| (x, y))).collect();
if (width, height) != (64, 8) {
at.extend((width - 64..width).map(|x| (x, height - 1)));
}
at
}
#[test]
fn every_device_reads_samples_and_gathers_four_two_two_textures_over_a_surface_buffer() {
let Some(library) = library() else {
return;
};
each_device("4:2:2 textures over a surface buffer", |name, _, device| {
let _textures = (device.grant_indices(IndexClass::Texture, 1, 2))
.unwrap_or_else(|error| panic!("{name}: {error}"));
let _samplers = (device.grant_indices(IndexClass::Sampler, 1, 2))
.unwrap_or_else(|error| panic!("{name}: {error}"));
let nearest = (device.new_sampler_state(&SamplerDescriptor::new(), 1))
.unwrap_or_else(|error| panic!("{name}: {error}"));
let mut d = SamplerDescriptor::new();
d.min_filter = SamplerMinMagFilter::Linear;
d.mag_filter = SamplerMinMagFilter::Linear;
let linear =
(device.new_sampler_state(&d, 2)).unwrap_or_else(|error| panic!("{name}: {error}"));
let read = state(&device, &library, "fpv_swz_read");
let sample = state(&device, &library, "fpv_swz_sample");
let gathers = ["x", "y", "z", "w"]
.map(|c| state(&device, &library, &format!("fpv_swz_gather_{c}")));
let before = device.counters().metrics();
for (format, fourcc) in FORMATS {
for case in &CASES {
let (width, height) = case.size;
let label = format!(
"{name}: {format:?} over a {:?} '{fourcc}' buffer, {width}x{height} at \
{}",
case.class, case.pitch
);
let buffer = buffer_of(
&label,
&device,
case.class,
&rows(width, height, case.pitch),
);
let mut d = TextureDescriptor::new(TextureType::Type2D, format, width, height);
d.usage = TextureUsage::SHADER_READ;
let answer = (buffer.texture_copy_cause(&d, 0, case.pitch))
.unwrap_or_else(|error| panic!("{label}: the answer: {error}"));
let texture = (buffer.new_texture(&d, Some(1), 0, case.pitch))
.unwrap_or_else(|error| panic!("{label}: the texture: {error}"));
let made = texture.copied_over().map(|(_, copy)| copy.kind.cause);
assert_eq!(made, answer, "{label}: the form made against the answer");
let live = device.counters().gauges().chroma_textures;
assert_eq!(live, 1, "{label}: the texture counted live");
if case.in_place {
assert_eq!(made, None, "{label}: in place");
}
let at = reached(width, height);
let want: Vec<[f32; 4]> = (at.iter())
.map(|&(x, y)| texel(format, width, x, y))
.collect();
let (w, h) = (width as f32, height as f32);
let centre = |x: u32, y: u32| point((x as f32 + 0.5) / w, (y as f32 + 0.5) / h);
let reads: Vec<[u8; 8]> = at.iter().map(|&(x, y)| texel_at(x, y)).collect();
let centres: Vec<[u8; 8]> = at.iter().map(|&(x, y)| centre(x, y)).collect();
let got = run(&label, &device, (&read, &texture, &nearest), &reads);
let got_nearest = run(&label, &device, (&sample, &texture, &nearest), &centres);
for (i, (want, &(x, y))) in want.iter().zip(&at).enumerate() {
assert_eq!(bits(got[i]), bits(*want), "{label}: read ({x}, {y})");
assert_eq!(
bits(got_nearest[i]),
bits(*want),
"{label}: nearest sample ({x}, {y})"
);
}
// The footprints whose top-left texel is in the first 63 by 7: a gather of
// each component at the footprint's corner, and a linear sample there and a
// quarter of the way from its top-left texel toward its top-right one.
let corners: Vec<(u32, u32)> =
(0..7).flat_map(|y| (0..63).map(move |x| (x, y))).collect();
let corner_points: Vec<[u8; 8]> = (corners.iter())
.map(|&(x, y)| point((x as f32 + 1.0) / w, (y as f32 + 1.0) / h))
.collect();
let quarter_points: Vec<[u8; 8]> = (corners.iter())
.map(|&(x, y)| point((x as f32 + 0.75) / w, (y as f32 + 0.5) / h))
.collect();
let value = |x: u32, y: u32| texel(format, width, x, y);
for (c, gather) in gathers.iter().enumerate() {
let got = run(
&label,
&device,
(gather, &texture, &nearest),
&corner_points,
);
for (i, &(x, y)) in corners.iter().enumerate() {
let quad = [
value(x, y + 1),
value(x + 1, y + 1),
value(x + 1, y),
value(x, y),
];
let want: [f32; 4] = std::array::from_fn(|k| quad[k][c]);
assert_eq!(
bits(got[i]),
bits(want),
"{label}: gather {c} at ({x}, {y})"
);
}
}
let got_corners = run(
&label,
&device,
(&sample, &texture, &linear),
&corner_points,
);
let got_quarters = run(
&label,
&device,
(&sample, &texture, &linear),
&quarter_points,
);
for (i, &(x, y)) in corners.iter().enumerate() {
let mean = |weights: [((u32, u32), f64); 4]| -> [f64; 4] {
std::array::from_fn(|c| {
(weights.iter())
.map(|&((x, y), weight)| f64::from(value(x, y)[c]) * weight)
.sum()
})
};
let corner = mean([
((x, y), 0.25),
((x + 1, y), 0.25),
((x, y + 1), 0.25),
((x + 1, y + 1), 0.25),
]);
let quarter = mean([
((x, y), 0.75),
((x + 1, y), 0.25),
((x, y), 0.0),
((x + 1, y), 0.0),
]);
for (got, want, what) in [
(got_corners[i], corner, "corner"),
(got_quarters[i], quarter, "quarter"),
] {
for c in 0..4 {
assert!(
(f64::from(got[c]) - want[c]).abs() <= 1e-6,
"{label}: linear {what} at ({x}, {y}): {got:?} for {want:?}"
);
}
}
}
println!(
"{label}: made {}, every texel read, sampled and gathered as Metal's \
decode",
match made {
None => "in place".to_owned(),
Some(cause) => format!("copied for {cause:?}"),
}
);
drop((texture, buffer));
let live = device.counters().gauges().chroma_textures;
assert_eq!(live, 0, "{label}: the texture no longer counted");
}
}
// Six kernel states, each with one content lowered for its texture slot 0 bound to a
// 4:2:2 texture, which every one of a case's eight dispatches runs.
let after = device.counters().metrics();
let contents = after.chroma_contents - before.chroma_contents;
let launches = after.chroma_launches - before.chroma_launches;
assert_eq!(
contents, 6,
"{name}: the contents lowered for 4:2:2 textures"
);
let dispatches = (8 * FORMATS.len() * CASES.len()) as u64;
assert_eq!(launches, dispatches, "{name}: the dispatches that ran them");
let bound = after.bound_dispatches - before.bound_dispatches;
let address = after.address_dispatches - before.address_dispatches;
println!(
"{name}: chroma_contents +{contents}, chroma_launches +{launches}, \
bound_dispatches +{bound}, address_dispatches +{address}"
);
});
}
#[test]
fn every_device_refuses_what_metal_refuses_of_four_two_two_textures() {
each_device("4:2:2 refusals", |name, _, device| {
let _textures = (device.grant_indices(IndexClass::Texture, 2, 1))
.unwrap_or_else(|error| panic!("{name}: {error}"));
for (format, _) in FORMATS {
let plain = || {
let mut d = TextureDescriptor::new(TextureType::Type2D, format, 64, 8);
d.usage = TextureUsage::SHADER_READ;
d
};
// A refusal as `Ok`, a gap as `Err`.
let refused = |rule| -> Result<Refusal, Gap> {
Ok(Refusal::ChromaPairs {
pixel_format: format,
rule,
})
};
let gap = |cause| -> Result<Refusal, Gap> { Err(Gap::ChromaPairsUse { cause }) };
let answered = |error: Error, what: &str| match error {
Error::Refused(refusal) => Ok(refusal),
Error::Unsupported(gap) => Err(gap),
other => panic!("{name}: {format:?}, {what}: {other}"),
};
let mut array = plain();
array.texture_type = TextureType::Type2DArray;
let mut odd = plain();
odd.width = 63;
let mut levels = plain();
levels.mipmap_level_count = 2;
let mut written = plain();
written.usage = TextureUsage::SHADER_READ | TextureUsage::SHADER_WRITE;
let mut rendered = plain();
rendered.usage = TextureUsage::SHADER_READ | TextureUsage::RENDER_TARGET;
let mut swizzled = plain();
swizzled.swizzle.red = TextureSwizzle::Green;
for (d, want, what) in [
(array, refused(ChromaPairsRule::TextureType), "a 2D array"),
(odd, refused(ChromaPairsRule::OddWidth), "an odd width"),
(levels, refused(ChromaPairsRule::Levels), "two levels"),
(
written,
gap(ChromaPairsGap::ShaderWrite),
"shader-write usage",
),
(
rendered,
gap(ChromaPairsGap::RenderTarget),
"render-target usage",
),
(swizzled, gap(ChromaPairsGap::Swizzle), "a swizzle"),
] {
match device.new_texture(&d, None) {
Err(error) => {
assert_eq!(answered(error, what), want, "{name}: {format:?}, {what}");
}
Ok(_) => panic!("{name}: {format:?}, {what}: made"),
}
}
let texture = (device.new_texture(&plain(), Some(2)))
.unwrap_or_else(|error| panic!("{name}: {format:?}: {error}"));
let view = texture.new_texture_view(format, TextureType::Type2D, 0..1, 0..1, None);
match view {
Err(error) => {
let want = refused(ChromaPairsRule::View);
assert_eq!(answered(error, "a view"), want, "{name}: {format:?}");
}
Ok(_) => panic!("{name}: {format:?}: a view made"),
}
}
println!("{name}: every 4:2:2 refusal and gap answered");
});
}
}
@@ -0,0 +1,241 @@
//! The GPU time of a linear sample of a 4:2:2 texture beside the same sample of an `RGBA8Unorm`
//! texture of its size, under a device cfg on every device of the cfg's kind, printed and asserting
//! nothing of time. The owned fixture `xr_samples`' `xr_sample_runtime` (through the runtime sampler
//! at sampler slot 0, a linear clamp-to-edge sampler state) and `xr_sample_constexpr` (through its
//! constexpr linear clamp-to-edge sampler) each take one sample at the centre of each texel of a
//! 1920 by 1080 frame, one thread a texel, and write it out, over a `GBGR422` texture made over a
//! Private buffer at 3,840 bytes a row (a 'yuvs' surface's pitch for that width) and over an
//! `RGBA8Unorm` texture made over a Private buffer at 7,680, each in the form
//! `Buffer::new_texture` makes it, which the lines name. The positions and the output are Private
//! buffers too.
//!
//! Each dispatch is a command buffer of its own, timed by its GPU start and end
//! (`CommandBuffer::gpu_start_time`, `CommandBuffer::gpu_end_time`). A round runs nine of each
//! kernel over each texture, the four taking turns, and takes each one's median. Unmeasured rounds
//! run first until a second has passed, so a GPU whose clocks rise under load has raised them;
//! then three rounds print each kernel's two medians and their ratio. The chroma counters show the
//! decode ran: each kernel's state makes one content lowered for its 4:2:2 slot, and each of its
//! dispatches over the `GBGR422` texture runs it (`Metrics::chroma_contents`,
//! `Metrics::chroma_launches`); no dispatch over the `RGBA8Unorm` texture does. Every value written
//! is finite and within [0, 1].
//!
//! Run it on one device with `--run-ignored only`. `llvm-as` assembles the kernels; without it the
//! test skips visibly.
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
mod on_device {
use crate::tests::chroma_pairs::on_device::{buffer_of, byte, GROUP};
use crate::tests::command::on_device::{each_device, finished};
use crate::tests::draw::on_device::library;
use crate::texture::TextureObject;
use crate::{
Buffer, ComputePipelineDescriptor, ComputePipelineState, DispatchType, FunctionDescriptor,
IndexClass, MemoryClass, PixelFormat, SamplerDescriptor, SamplerMinMagFilter, StageSource,
Texture, TextureDescriptor, TextureType, TextureUsage,
};
use metal2vulkan_devtools::engine_dir;
use std::time::{Duration, Instant};
/// The frame's width and height.
const WIDTH: u32 = 1920;
const HEIGHT: u32 = 1080;
/// The dispatches of each kernel over each texture in a round.
const RUNS: usize = 9;
/// The rounds printed.
const ROUNDS: usize = 3;
/// How long the unmeasured rounds run: at least one round.
const WARM: Duration = Duration::from_secs(1);
/// The kernels, each with the sampler it samples through.
const KERNELS: [(&str, &str); 2] = [
("a runtime sampler", "xr_sample_runtime"),
("a constexpr sampler", "xr_sample_constexpr"),
];
/// The textures' formats, each with its bytes a texel.
const FORMATS: [(PixelFormat, u64); 2] =
[(PixelFormat::GBGR422, 2), (PixelFormat::RGBA8Unorm, 4)];
/// The sampler state's index, and the constexpr sampler's.
const SAMPLER: u32 = 1;
const CONSTEXPR: u32 = 2;
#[test]
#[ignore = "prints GPU times; run it on one device with --run-ignored only"]
fn time_a_linear_sample_of_a_1080p_frame() {
let Some(library) = library(&engine_dir().join("xr_samples.ll")) else {
return;
};
let n = WIDTH * HEIGHT;
let positions: Vec<u8> = (0..HEIGHT)
.flat_map(|y| (0..WIDTH).map(move |x| (x, y)))
.flat_map(|(x, y)| {
[
(x as f32 + 0.5) / WIDTH as f32,
(y as f32 + 0.5) / HEIGHT as f32,
]
})
.flat_map(f32::to_le_bytes)
.collect();
// Each output starts as NaNs, so a dispatch that wrote nothing fails the check.
let unwritten = vec![0xff; 16 * n as usize];
each_device("4:2:2 linear sample time", |name, _, device| {
let _grants =
[(IndexClass::Texture, 1), (IndexClass::Sampler, SAMPLER)].map(|(class, first)| {
(device.grant_indices(class, first, 2))
.unwrap_or_else(|error| panic!("{name}: {error}"))
});
let mut d = SamplerDescriptor::new();
d.min_filter = SamplerMinMagFilter::Linear;
d.mag_filter = SamplerMinMagFilter::Linear;
let sampler = (device.new_sampler_state(&d, SAMPLER))
.unwrap_or_else(|error| panic!("{name}: {error}"));
let states: Vec<ComputePipelineState> = (KERNELS.iter())
.map(|&(_, kernel)| {
let function = library.function(kernel).expect("the kernel");
let descriptor = ComputePipelineDescriptor::new(StageSource::Function(
FunctionDescriptor::new(function),
));
(device.new_compute_pipeline_state(&descriptor, |samplers| {
Ok(vec![CONSTEXPR; samplers.len()])
}))
.unwrap_or_else(|error| panic!("{name}: {kernel}: {error}"))
})
.collect();
let textures: Vec<(Texture, Buffer, String)> = (FORMATS.iter().zip(1..))
.map(|(&(format, texel), index)| {
let pitch = texel * u64::from(WIDTH);
let bytes: Vec<u8> = (0..pitch * u64::from(HEIGHT))
.map(|k| byte(k as u32))
.collect();
let buffer = buffer_of(name, &device, MemoryClass::Private, &bytes);
let mut d = TextureDescriptor::new(TextureType::Type2D, format, WIDTH, HEIGHT);
d.usage = TextureUsage::SHADER_READ;
let texture = (buffer.new_texture(&d, Some(index), 0, pitch))
.unwrap_or_else(|error| panic!("{name}: {format:?}: {error}"));
let form = match texture.copied_over() {
None => "in place".to_owned(),
Some((_, copy)) => format!("copied for {:?}", copy.kind.cause),
};
(texture, buffer, form)
})
.collect();
let uv = buffer_of(name, &device, MemoryClass::Private, &positions);
let outs: Vec<Vec<Buffer>> = (KERNELS.iter())
.map(|_| {
(FORMATS.iter())
.map(|_| buffer_of(name, &device, MemoryClass::Private, &unwritten))
.collect()
})
.collect();
let queue = device.new_command_queue(1).expect("a queue");
// One dispatch of `state` over `texture` into `out`, in a command buffer of its own:
// its GPU time in nanoseconds.
let time = |state: &ComputePipelineState, texture: &Texture, out: &Buffer| -> u64 {
let command_buffer = queue.command_buffer().expect("a command buffer");
let mut encoder = (command_buffer.compute_command_encoder(DispatchType::Serial))
.expect("an encoder");
encoder
.set_compute_pipeline_state(state)
.expect("the state");
encoder.set_texture(Some(texture), 0).expect("the texture");
(encoder.set_sampler_state(Some(&sampler), 0)).expect("the sampler");
encoder.set_buffer(Some(&uv), 0, 0).expect("the positions");
encoder.set_buffer(Some(out), 0, 1).expect("the output");
(encoder.dispatch_threads([n, 1, 1], [GROUP, 1, 1])).expect("the dispatch");
encoder.end_encoding();
command_buffer.commit().expect("a commit");
finished(name, &command_buffer);
assert_eq!(command_buffer.error(), None, "{name}");
(command_buffer.gpu_end_time()).saturating_sub(command_buffer.gpu_start_time())
};
// Each kernel's median over each texture, the four taking turns.
let round = || -> Vec<Vec<u64>> {
let mut times = vec![vec![Vec::with_capacity(RUNS); FORMATS.len()]; KERNELS.len()];
for _ in 0..RUNS {
for ((state, outs), times) in states.iter().zip(&outs).zip(&mut times) {
for (((texture, ..), out), times) in
textures.iter().zip(outs).zip(times.iter_mut())
{
times.push(time(state, texture, out));
}
}
}
(times.into_iter())
.map(|kernel| {
(kernel.into_iter())
.map(|mut runs| {
runs.sort_unstable();
runs[RUNS / 2]
})
.collect()
})
.collect()
};
let before = device.counters().metrics();
let warming = Instant::now();
let mut warm = 0;
while warm == 0 || warming.elapsed() < WARM {
round();
warm += 1;
}
println!(
"{name}: {warm} unmeasured rounds in {} ms",
warming.elapsed().as_millis()
);
for r in 0..ROUNDS {
for ((sampler, _), medians) in KERNELS.iter().zip(round()) {
let [(chroma, chroma_form), (plain, plain_form)] =
[0, 1].map(|f| (medians[f], &textures[f].2));
println!(
"{name}: round {r}: {sampler}: {:?} {chroma_form}: {chroma} ns; {:?} \
{plain_form}: {plain} ns; ratio {:.3}",
FORMATS[0].0,
FORMATS[1].0,
chroma as f64 / plain.max(1) as f64
);
}
}
let after = device.counters().metrics();
let contents = after.chroma_contents - before.chroma_contents;
let launches = after.chroma_launches - before.chroma_launches;
println!(
"{name}: chroma_contents +{contents}, chroma_launches +{launches}, \
translation_at_encode_max_nanos {}",
after.translation_at_encode_max_nanos
);
assert_eq!(
contents,
KERNELS.len() as u64,
"{name}: the contents lowered for the 4:2:2 texture"
);
let decoded = ((warm + ROUNDS) * RUNS * KERNELS.len()) as u64;
assert_eq!(launches, decoded, "{name}: the dispatches that ran them");
// Every value each kernel wrote over each texture.
let len = 16 * u64::from(n);
let block = (device.take_block(MemoryClass::Shared, len))
.unwrap_or_else(|error| panic!("{name}: {error}"));
let staged = (device.new_buffer(block.id, 0, len, None))
.unwrap_or_else(|error| panic!("{name}: {error}"));
for ((_, kernel), outs) in KERNELS.iter().zip(&outs) {
for ((format, _), out) in FORMATS.iter().zip(outs) {
let command_buffer = queue.command_buffer().expect("a command buffer");
let mut blit = command_buffer.blit_command_encoder().expect("an encoder");
(blit.copy_from_buffer_to_buffer(out, 0, &staged, 0, len))
.unwrap_or_else(|error| panic!("{name}: the read: {error}"));
blit.end_encoding();
command_buffer.commit().expect("a commit");
finished(name, &command_buffer);
assert_eq!(command_buffer.error(), None, "{name}: the read");
let contents = staged.contents().expect("a Shared buffer");
// SAFETY: the copy that wrote the buffer finished, and its writes reach the
// host; the buffer holds `4 n` floats.
let floats = unsafe {
std::slice::from_raw_parts(contents.as_ptr().cast::<f32>(), 4 * n as usize)
};
let wrong = (floats.iter()).position(|v| !(0.0..=1.0).contains(v));
assert_eq!(wrong, None, "{name}: {kernel} over {format:?}: a value");
}
}
});
}
}
@@ -50,6 +50,7 @@ pub(crate) mod on_device {
numbered: Vec::new(),
constexprs: Vec::new(),
reads_unbound: false,
handle_float_images: false,
writes_unbound: false,
unbound_storage: false,
has_effects: true,
@@ -9,10 +9,13 @@
//! and column among them; `cr_int` reads an `R32Sint` cube array of two cubes and two levels at
//! every texel of every face, cube and level. Each read is the texel uploaded there. `cr_float`
//! over an `RGBA8Unorm_sRGB` cube is compared with `cr_ref`'s read of a 2D array of six slices
//! holding the same bytes at the same levels: the device's sRGB decode, through a fetch. Each
//! kernel also reads past the level's extent on each axis (inside level 0's), at face 6 and past,
//! at the level count and past, at the cube count and past, and at `u32::MAX` on each operand:
//! each Metal's out-of-bounds texel, zero with alpha 1 for a format without alpha.
//! holding the same bytes at the same levels: the device's sRGB decode, through a fetch.
//! `cr_depth` reads a `Depth32Float` depth cube of three levels and `cr_depth_array` a depth cube
//! array of two cubes and two levels (`depthcube<float, access::read>`,
//! `depthcube_array<float, access::read>`), each read the depth uploaded there. Each kernel also
//! reads past the level's extent on each axis (inside level 0's), at face 6 and past, at the level
//! count and past, at the cube count and past, and at `u32::MAX` on each operand: each Metal's
//! out-of-bounds texel, zero with alpha 1 for a format without alpha, and zero for a depth.
//!
//! `llvm-as` assembles the kernels; without it the test skips visibly.
@@ -112,13 +115,53 @@ define void @cr_ref(ptr addrspace(1) %t, ptr addrspace(1) noundef %at, ptr addrs
ret void
}
define void @cr_depth(ptr addrspace(1) %t, ptr addrspace(1) noundef %at, ptr addrspace(1) noundef %out, i32 noundef %gid) {
%s = tail call ptr addrspace(2) @air.get_read_sampler()
%z = zext i32 %gid to i64
%i = shl i64 %z, 1
%pa = getelementptr inbounds <4 x i32>, ptr addrspace(1) %at, i64 %i
%a = load <4 x i32>, ptr addrspace(1) %pa, align 16
%xy = shufflevector <4 x i32> %a, <4 x i32> poison, <2 x i32> <i32 0, i32 1>
%f = extractelement <4 x i32> %a, i64 2
%l = extractelement <4 x i32> %a, i64 3
%r = tail call { float, i8 } @air.read_depth_cube.f32(ptr addrspace(1) %t, ptr addrspace(2) %s, i32 1, <2 x i32> %xy, i32 %f, i32 %l, i32 1)
%d = extractvalue { float, i8 } %r, 0
%v = insertelement <4 x float> zeroinitializer, float %d, i64 0
%po = getelementptr inbounds <4 x float>, ptr addrspace(1) %out, i64 %z
store <4 x float> %v, ptr addrspace(1) %po, align 16
ret void
}
define void @cr_depth_array(ptr addrspace(1) %t, ptr addrspace(1) noundef %at, ptr addrspace(1) noundef %out, i32 noundef %gid) {
%s = tail call ptr addrspace(2) @air.get_read_sampler()
%z = zext i32 %gid to i64
%i = shl i64 %z, 1
%pa = getelementptr inbounds <4 x i32>, ptr addrspace(1) %at, i64 %i
%a = load <4 x i32>, ptr addrspace(1) %pa, align 16
%j = or i64 %i, 1
%pb = getelementptr inbounds <4 x i32>, ptr addrspace(1) %at, i64 %j
%b = load <4 x i32>, ptr addrspace(1) %pb, align 16
%xy = shufflevector <4 x i32> %a, <4 x i32> poison, <2 x i32> <i32 0, i32 1>
%f = extractelement <4 x i32> %a, i64 2
%l = extractelement <4 x i32> %a, i64 3
%c = extractelement <4 x i32> %b, i64 0
%r = tail call { float, i8 } @air.read_depth_cube_array.f32(ptr addrspace(1) %t, ptr addrspace(2) %s, i32 1, <2 x i32> %xy, i32 %f, i32 %c, i32 %l, i32 1)
%d = extractvalue { float, i8 } %r, 0
%v = insertelement <4 x float> zeroinitializer, float %d, i64 0
%po = getelementptr inbounds <4 x float>, ptr addrspace(1) %out, i64 %z
store <4 x float> %v, ptr addrspace(1) %po, align 16
ret void
}
declare ptr addrspace(2) @air.get_read_sampler()
declare { <4 x float>, i8 } @air.read_texture_cube.v4f32(ptr addrspace(1), ptr addrspace(2), <2 x i32>, i32, i32, i32)
declare { <4 x i32>, i8 } @air.read_texture_cube.u.v4i32(ptr addrspace(1), ptr addrspace(2), <2 x i32>, i32, i32, i32)
declare { <4 x i32>, i8 } @air.read_texture_cube_array.s.v4i32(ptr addrspace(1), ptr addrspace(2), <2 x i32>, i32, i32, i32, i32)
declare { <4 x float>, i8 } @air.read_texture_2d_array.v4f32(ptr addrspace(1), ptr addrspace(2), <2 x i32>, i32, <2 x i32>, i32, i32)
declare { float, i8 } @air.read_depth_cube.f32(ptr addrspace(1), ptr addrspace(2), i32, <2 x i32>, i32, i32, i32)
declare { float, i8 } @air.read_depth_cube_array.f32(ptr addrspace(1), ptr addrspace(2), i32, <2 x i32>, i32, i32, i32, i32)
!air.kernel = !{!0, !10, !20, !30}
!air.kernel = !{!0, !10, !20, !30, !40, !50}
!air.version = !{!8}
!air.language_version = !{!9}
!0 = !{ptr @cr_float, !1, !2}
@@ -141,6 +184,12 @@ declare { <4 x float>, i8 } @air.read_texture_2d_array.v4f32(ptr addrspace(1), p
!30 = !{ptr @cr_ref, !1, !31}
!31 = !{!32, !4, !5, !6}
!32 = !{i32 0, !"air.texture", !"air.location_index", i32 0, i32 1, !"air.read", !"air.arg_type_name", !"texture2d_array<float, read>", !"air.arg_name", !"t"}
!40 = !{ptr @cr_depth, !1, !41}
!41 = !{!42, !4, !5, !6}
!42 = !{i32 0, !"air.texture", !"air.location_index", i32 0, i32 1, !"air.read", !"air.arg_type_name", !"depthcube<float, read>", !"air.arg_name", !"t"}
!50 = !{ptr @cr_depth_array, !1, !51}
!51 = !{!52, !4, !5, !6}
!52 = !{i32 0, !"air.texture", !"air.location_index", i32 0, i32 1, !"air.read", !"air.arg_type_name", !"depthcube_array<float, read>", !"air.arg_name", !"t"}
"#;
/// A texture's bytes and the words a read of each texel answers.
@@ -221,6 +270,21 @@ declare { <4 x float>, i8 } @air.read_texture_2d_array.v4f32(ptr addrspace(1), p
outside: [0, 0, 0, 1],
};
/// The depth of texel `(x, y)` of level `level` of layer `layer`: distinct, inside [0, 1], and
/// exact in `float`.
fn depth(layer: u32, level: u32, x: u32, y: u32) -> f32 {
(64 * layer + 16 * level + 4 * y + x + 1) as f32 / 1024.0
}
/// A depth read answers the depth in its first word; the kernels store zero in the others.
const DEPTH: Texels = Texels {
format: PixelFormat::Depth32Float,
size: 4,
bytes: |layer, level, x, y| depth(layer, level, x, y).to_le_bytes().to_vec(),
read: |layer, level, x, y| [depth(layer, level, x, y).to_bits(), 0, 0, 0],
outside: [0; 4],
};
/// The sRGB texture's reads are compared with the 2D array's, not with these words.
const SRGB: Texels = Texels {
format: PixelFormat::RGBA8UnormSRGB,
@@ -395,7 +459,7 @@ declare { <4 x float>, i8 } @air.read_texture_2d_array.v4f32(ptr addrspace(1), p
};
let library = Library::from_air(&bitcode).expect("the library");
each_device("cube_reads", |name, _, device| {
let _textures = (device.grant_indices(IndexClass::Texture, 1, 5))
let _textures = (device.grant_indices(IndexClass::Texture, 1, 7))
.unwrap_or_else(|error| panic!("{name}: {error}"));
let mut buffers = Buffers::sized(&device, 1 << 20);
let queue = device.new_command_queue(4).expect("a queue");
@@ -404,6 +468,8 @@ declare { <4 x float>, i8 } @air.read_texture_2d_array.v4f32(ptr addrspace(1), p
(1, "cr_float", TextureType::Cube, &FLOAT, 3, 1),
(2, "cr_uint", TextureType::Cube, &UINT, 3, 1),
(3, "cr_int", TextureType::CubeArray, &INT, 2, 2),
(6, "cr_depth", TextureType::Cube, &DEPTH, 3, 1),
(7, "cr_depth_array", TextureType::CubeArray, &DEPTH, 2, 2),
] {
let shape = (texture_type, texels, levels, 6 * cubes);
let t = texture(name, &device, shape, index);
+44 -27
View File
@@ -21,7 +21,9 @@
//! of a plane, the first included, names the general layout, with or without the call before it.
//! While the surface lives, the surface imports gauge holds its two planes; it has no buffer and
//! no export handle. Each plane's image takes the usage its texture's bind flags give and no
//! other: made rendered and sampled, no storage; made sampled alone, not rendered; and a texture
//! other, on every device: made rendered and sampled under a render target shaders read, copied,
//! sampled and rendered, with no storage and no attachment feedback loop usage, so a draw reads it
//! through its shadow; made sampled alone, not rendered; and a texture
//! over a plane whose uses ask storage is `Gap::SurfaceUsage`, where the device stores its
//! format. Planes made with `PixelFormatView` usage, an 8-bit luma, a chroma and a 10-bit luma,
//! list no format past their own, their texture's and that one's sRGB sibling (the 10-bit luma's
@@ -1066,14 +1068,17 @@ mod on_device {
});
}
/// Each plane's image takes the usage its texture's bind flags give and no other. Made
/// rendered and sampled (`D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE`, as a
/// video's planes are), it is copied and sampled, and rendered at most beside, with no
/// storage; made sampled alone, it is copied and sampled, and not rendered. A texture over
/// a plane whose uses ask storage (`ShaderWrite`) is `Gap::SurfaceUsage` of storage, where
/// the device stores the texture's format through a storage image without a format, as
/// Direct3D 11 made the texture without `D3D11_BIND_UNORDERED_ACCESS`; where it does not,
/// the uses ask no storage and the import is made.
/// Each plane's image takes the usage its texture's bind flags give and no other, on
/// every device. Made rendered and sampled (`D3D11_BIND_RENDER_TARGET |
/// D3D11_BIND_SHADER_RESOURCE`, as a video's planes are) under a texture of the consumer's
/// planes' uses (`ShaderRead | RenderTarget`), a render target shaders read, which a draw
/// may read in its own pass, it is copied, sampled and rendered (0x17), with no storage and
/// no attachment feedback loop usage, whether or not the device has the loop; made sampled
/// alone under a texture shaders read, it is copied and sampled (0x7), and not rendered. A
/// texture over a plane whose uses ask storage (`ShaderWrite`) is `Gap::SurfaceUsage` of
/// storage, where the device stores the texture's format through a storage image without a
/// format, as Direct3D 11 made the texture without `D3D11_BIND_UNORDERED_ACCESS`; where it
/// does not, the uses ask no storage and the import is made.
#[test]
fn every_device_makes_a_direct3d_11_plane_of_the_usage_its_bind_flags_give() {
each_device("import_d3d11_surface_usage", |name, _, device| {
@@ -1083,22 +1088,34 @@ mod on_device {
let copied = vk::ImageUsageFlags::TRANSFER_SRC | vk::ImageUsageFlags::TRANSFER_DST;
let read = copied | vk::ImageUsageFlags::SAMPLED;
let rendered = read | vk::ImageUsageFlags::COLOR_ATTACHMENT;
for (bind, given) in [(BOUND, rendered), (SHADER_RESOURCE, read)] {
let looped = device.core().feedback_loop;
for (bind, given, uses) in [
(
BOUND,
rendered,
TextureUsage::SHADER_READ | TextureUsage::RENDER_TARGET,
),
(SHADER_RESOURCE, read, TextureUsage::SHADER_READ),
] {
let textures = PLANES
.each_ref()
.map(|p| d3d.shared_texture(p.width, p.height, p.dxgi, bind));
let planes: Vec<D3d11Plane<'_>> = (textures.iter().zip(&PLANES))
.map(|(texture, plane)| D3d11Plane {
handle: texture.handle.as_handle(),
image_format: plane.image,
bind_flags: bind,
descriptor: TextureDescriptor::new(
.map(|(texture, plane)| {
let mut descriptor = TextureDescriptor::new(
TextureType::Type2D,
plane.view,
plane.width,
plane.height,
),
index: None,
);
descriptor.usage = uses;
D3d11Plane {
handle: texture.handle.as_handle(),
image_format: plane.image,
bind_flags: bind,
descriptor,
index: None,
}
})
.collect();
let surface = (device.import_d3d11_surface(&planes))
@@ -1110,20 +1127,19 @@ mod on_device {
);
let usage = texture.object().image_usage();
println!(
"d3d11-usage: {label}: the image's usage {:#x}, the flags give {:#x}",
"d3d11-usage: {label}: the image's usage {:#x}, the flags give {:#x}; \
the device has the attachment feedback loop: {looped}",
usage.as_raw(),
given.as_raw()
);
assert_eq!(
(usage & !given).as_raw(),
0,
"{label}: a usage the bind flags do not give, of {:#x}",
usage.as_raw()
usage.as_raw(),
given.as_raw(),
"{label}: the usage the bind flags give, and no other"
);
assert!(
usage.contains(read),
"{label}: copied and sampled: {:#x}",
usage.as_raw()
!texture.looped(),
"{label}: a draw reads the plane through its shadow, not the loop"
);
}
}
@@ -1433,8 +1449,9 @@ mod on_device {
held.contains(feature)
};
let imports = |usage: vk::ImageUsageFlags, list: &[vk::Format]| {
(import_query(core, format, usage, list)).is_ok_and(|(features, _)| {
features.contains(vk::ExternalMemoryFeatureFlags::IMPORTABLE)
(import_query(core, format, usage, list)).is_ok_and(|(external, _)| {
(external.external_memory_features)
.contains(vk::ExternalMemoryFeatureFlags::IMPORTABLE)
})
};
let wanted = vk::ImageUsageFlags::SAMPLED
Loaded 100 of 346 files, more files were not shown because too many files have changed in this diff. Show more