Commit Graph
4129 Commits
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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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