Under the identity domains a texture slot sampled through a constexpr sampler takes the sampler
from the set-1 sampler array of its use (binding 2 plain, 3 compare, 4 integer texture) at an
index the consumer pushes: PushField::ConstexprSampler(CombinedSampler), one u32. The consumer
makes the device sampler that the new public CombinedSampler::constexpr_sampler(profile)
describes, places it at an index of that array, and pushes the index. The index is a push word,
not a specialization constant: an index allocated at run time would key the driver's and the
pipeline cache's entries. Link's immutable sampler for the default domains now goes through the
same method, with the same result.
Under the identity domains every device sampler is normalized: a constexpr pixel sampler's
coordinate is scaled in the shader, as a runtime sampler's is, never handed to the device's
unnormalized sampler. A linear sample or gather through it records
PrecisionNote::PixelSamplerScaling, which is static. No address-mode-map variant applies there
(no binder picks a variant), so the sampler keeps its own modes and the slot records no
ConstexprSampled fact.
Still refused as Unsupported{IdentityDomains}: an argument buffer's sampler, arrays of samplers,
bicubic and anisotropy emulation. The refusal test now uses engine/a2_bicubic_weights.
Translation output changes only under the identity domains (Device::from_queries). Device::new
output is unchanged: golden_hashes_match_the_table passes at this tip (job m3-max-42192), with no
"changed under an unchanged key" and no "profile changed:" line.
Public surface: PushField::ConstexprSampler and CombinedSampler::constexpr_sampler are added
(api_signatures blessed); nothing is removed or changed.
SEMANTICS_VERSION 2162: identity-domain modules of constexpr-sampling kernels change.
ARTIFACT_FORMAT_VERSION 531: PushField gains a variant.
Verified:
- m3-max-42097 (msi), this change on cd5a76a757: clippy -p metal2vulkan --all-targets
--all-features and rustdoc -D warnings green; nextest all() of metal2vulkan, 3,689 of 3,693
passed. The four failures were development's own (the new pad_simd_shape and
vector_word_phases fixtures had no table rows), re-blessed at 74669c0552.
- m3-max-42098 (msi): clippy --cfg m2v_gpu and --cfg m2v_cpu_icd green.
- m3-max-42192 (msi), this tip on the samplers landing on 58891b9ce5: golden_hashes_match_the_table,
public_fixtures_engine inventory and llvm_as part 8, and air_input's engine golden printouts
pass.
- engine_identity a_constexpr_sampler_is_the_set_1_element_its_pushed_index_names: sample_up and
the same kernel through a linear pixel sampler link and pass L3 on every profile and on
moltenvk-m3 without robustImageAccess2. Their push fields are the two texture IDs and
ConstexprSampler(c) of the normalized use, with no spec constant but LocalSize, no immutable
sampler and no ConstexprSampled fact; set 1 bindings 0, 1 and 2 are used; constexpr_sampler
gives a normalized device sampler. PixelSamplerScaling is recorded for the pixel kernel under
identity, and under the default domains, which hand that kernel the unnormalized sampler, it is
not.
Under the identity domains a kernel samples a texture slot through a runtime sampler slot. The
texture is its class's set-1 element at the index of its pushed gpuResourceID, as a read's is.
The sampler is the element of a set-1 sampler array at the index of the sampler slot's pushed
gpuResourceID (SlotGuestBase of the sampler slot), joined to the texture by OpSampledImage. The
array is picked by the use: binding 2 for a plain sample, 3 for a depth comparison, 4 for a
texture of an integer format; 4,000 SAMPLER descriptors each, PARTIALLY_BOUND |
UPDATE_AFTER_BIND | UPDATE_UNUSED_WHILE_PENDING, every stage, the same set 1 for every pipeline.
The sampler's word (pixel coordinates, a nearest pixel sampler) is read from the ID's high word,
so no specialization constant and no SamplerReduction, SamplerCoordinates, CubicSampler or
ConstantLanes fact remains; every precision note is static. An integer write to a storage slot
without a format saturates to the channel widths the consumer pushes
(PushField::TextureIntegerChannels, a u32), with no fact.
Still refused as Unsupported{IdentityDomains}: constexpr samplers (next change: a pushed index),
an argument buffer's sampler, arrays of samplers, bicubic and anisotropy emulation, a slot's
minimum level.
Translation output changes only under the identity domains (Device::from_queries). Device::new
output is unchanged: golden_hashes_match_the_table passes at this tip (job m3-max-42189), with no
"changed under an unchanged key" and no "profile changed:" line.
For the runtime's side (the planner's three facts):
a. The runtime must dedupe device samplers by create info across the three arrays' uses.
Exhausting maxSamplerAllocationCount (4,000 on the 2080, 3090 and UHD 630; 32,768 on
lavapipe; 65,536 on the others) must be a typed refusal, with a fill-past-capacity test.
b. The update-after-bind limits for 65,536 sampled images, 4,096 storage images and 12,000
samplers hold on all nine profiles (the smallest is lavapipe's 1,015,808); the floor must
check them by query.
c. The count of cubic sampler descriptors is asked of the replay lane; if any exist it goes back
to the planner before step 5 closes.
SEMANTICS_VERSION 2161: identity-domain modules of sampling kernels and integer writes change.
Verified:
- m3-max-42094 (msi), this change on cd5a76a757: clippy -p metal2vulkan --all-targets
--all-features and rustdoc -D warnings green; nextest all() of metal2vulkan and metal2vulkan-rt,
3,719 of 3,723 passed. The four failures were development's own (the new pad_simd_shape and
vector_word_phases fixtures had no table rows), re-blessed at 74669c0552.
- m3-max-42096 (msi): clippy --cfg m2v_gpu and --cfg m2v_cpu_icd green.
- m3-max-42189 (msi), this tip on 58891b9ce5: golden_hashes_match_the_table,
public_fixtures_engine inventory and llvm_as part 8, and air_input's engine golden printouts
pass.
- engine_identity: sample_down links and passes L3 on every profile and on moltenvk-m3 without
robustImageAccess2, with set 1 bindings 0, 1 and 2 used, no spec constant but LocalSize, and no
sampler fact; an integer write of (300, 70000, 5, 2^31) stores (255, 255, 5, 255) under the
RGBA8Uint word and the raw lanes under word 0, on the CPU interpreter.
The recordings bind small constant arguments from Managed buffers
(216,574 dispatches in one, against 94 Shared-backed), so the frame,
burst_160, burst_2000 and burst_2000x5 rows now keep their increment in
a Managed buffer, written through contents and flushed with
didModifyRange:. burst_160_shared keeps it Shared, for the record.
The harness gains Storage::Managed and Buffer::did_modify_range. The old
runtime makes a real Managed buffer. The new runtime has no Managed
storage, so its harness keeps the GPU copy in a Private buffer, written
as a Private one is (through a Shared buffer and the copy kernel), as
didModifyRange: updates a Managed buffer GPU copy on a Mac with a
discrete GPU.
The translator gives a loop LoopControl only from its AIR hints (#pragma unroll,
#pragma nounroll) or DontUnroll for a loop it writes itself; every other loop leaves
unrolling to the driver, and we add no hint in either direction to steer it. The known
gap records what that costs on one driver.
Measured with the constant-reads probe (steelbrain/item-a-probe, not landed), read
divergent, 4096 groups of 64, 128 iterations, two processes x 50 samples, rows shuffled
per round: RX 7900 XTX, RADV Mesa 26.2.6, job m3-max-42107. 64 KiB: 105.5 us rolled
(today's word form), 112.9 us rolled (one 16-byte load, DontUnroll), 207.5 / 209.3 us
unrolled (today's form with Unroll / the 16-byte load as RADV unrolls it). 16 KiB:
unrolled 6.7-8.0% faster; 256 KiB: 15.6-16.8% faster. RADV's dump (jobs 42055, 42107)
shows the unrolled kernel issuing 128 global_load_b128 in 13 clauses against one per
iteration rolled.
The engine inventory, the golden hash table and the air_input printouts gain the rows of the two
fixtures that landed since the last bless (vector_word_phases, pad_simd_shape): 6 golden rows, 6
inventory rows, two printouts. Additions only: no existing cell or fingerprint moved.
Blessed on the M3 by job m3-max-42118 at 53f4a44df7.
The landing of wide_bindings (1cc0212231) met the harness lane's new
Plan field per_encoder (87e049f422) in the rebase, and the workload
list's conflict was resolved without it, so development's harness
did not compile (E0063, missing field `per_encoder`, authored.rs).
wide_bindings records every dispatch in one encoder, as before: None.
Verified: the harness built at development cd5a76a757 failed with
E0063 at authored.rs:524 (job m3-max-42099); this commit's clippy and
harness tests are in the job named in the hand-off.
The fixture pad_simd_shape (simd_shape: simdgroup index, lane, simd_sum(1u) and index in the
threadgroup per thread) with its companions, regenerated by scripts/regen-air-fixtures on the M3
Max (m3-max-41884). Metal's answer, measured there (m3-max-41877, macOS 27.0.1) at threadgroups of
80, 1, 32, 64 and 40 threads: thread i is lane i % 32 of simdgroup i / 32, which holds
min(32, n - 32 (i / 32)) threads; 80 falls 32, 32 and 16. The device test runs the five sizes on
every device and holds each module that runs one (the whole module, padded, or emulated) to it.
A kernel whose tier runs each SIMD group as a 32-lane cluster of a wider subgroup (a device of
64-lane subgroups that cannot pin 32) runs only workgroups of whole subgroups. A direct dispatch
whose threadgroup is whole 32-thread SIMD groups but not whole subgroups (32 threads on such a
device) now runs on the kernel's partial-threadgroups variant in a workgroup of the next whole
subgroup, with its region flagged NONUNIFORM even on a whole grid: the variant answers each
threadgroup's threads from the region's nominal size L, min(L, grid - group * L) per axis, and
an invocation whose lane index (from the subgroup IDs: SubgroupId * SubgroupSize +
SubgroupLocalInvocationId) is at or past their product does not exist. It returns before the
body, or in a body with workgroup barriers walks it predicated, reaching each barrier and running
nothing else, so it loads and stores nothing. Each SIMD group of the threads is one whole cluster
and keeps the native subgroup operations. The workgroup is specialized apart from Metal's size
(Variant::threads, the flattened size), within maxComputeWorkGroupSize, maxComputeWorkGroupInvocations
and maxComputeWorkgroupSubgroups. Any other threadgroup that is not whole subgroups (80 or 1
thread, an indirect dispatch, a kernel without the variant) runs the emulated module.
The handler-teardown test failed once on the 3090 (matrix job m3-max-41909 at 03a3741772): the
block was unmapped on the test thread, not the reaper. commit() cloned a device handle for the
call and dropped it, and the command buffer's own handle, only as it returned, after the
command buffer was handed to the submit thread. A command buffer that completed and ran its
handler before commit() returned left the call's handle as the last one, so the teardown ran in
commit() on the consumer's thread.
The contract stands (teardown runs on the thread that drops the last handle, or on the reaper
where that is a handler or a listener), and every path now honours it:
- commit() holds the core, not a handle, and gives the command buffer's handle up before the
hand-off (Device::release: Arc::into_inner, so a handle that is not the last is let go under
the lock and the last one is dropped once no lock is held, ending the device in the call only
where the consumer holds no other handle).
- The consumer's unmap hook runs in the halt, on the thread that tears down, after the other
threads are joined, at teardown as at quiesce. The memory is freed and the VkDevice destroyed
where the core's last reference is released, which a call can still hold for a moment as it
returns (commit's core, a queue's last drop); that runs no consumer code, and the gauges still
reach zero only after it.
Test: the handler records how many handles exist as it drops its own: one, as commit gave its
handle up before the command buffer could complete; the unmap is on the reaper.
Under the identity domains the emulated tier's scratch holds two regions, each exchange and vote
taking the next, only where that costs the kernel nothing a Metal program can observe: two regions
of one simdgroup fit beside the kernel's threadgroup memory under maxComputeSharedMemorySize (with
an emulated object or mesh entry's wrapper words and payload), as many simdgroups fit beside it as
with one region up to Metal's 1024 threads, so the pipeline reports as many threads per threadgroup
and every threadgroup one region runs still runs, and the kernel binds no [[threadgroup(n)]] region,
whose length the encoder sets at each dispatch. Elsewhere the kernel keeps one region and closes
each exchange with a barrier, as before rule 1. The choice reads only the limit query and the
kernel's own plan (workgroup::two_regions_fit).
SEMANTICS_VERSION 2160: an identity-domain emulated module whose threadgroup memory leaves no room
for two regions changes back to one.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
Gate 41971: a kernel of 33 buffers is invalid input (SlotPastTable): Metal binds 31. The test now
pushes a kernel's 21 and 31 slot addresses through from_queries' 256-byte window with no block;
the spill past it stays covered by push.rs and the new runtime's 30-buffer device test, whose
dispatch region takes 32 bytes.
scripts/regen-air-fixtures/regen-air-fixtures.sh --dir harness on the M3 (job 41966, LLVM 21 as
TOOLCHAIN pins it): the new kernel, and the other kernels' metadata renumbered around it.
A kernel's push window held 128 bytes, what Vulkan guarantees: a dispatch region and 12 buffer
addresses. A kernel of more buffers put the rest in a parameter block that the new runtime writes
into its ring on every dispatch, and whose address the window holds.
The translator: a new profile fact, PushWindow. Device::new keeps Guaranteed (a 128-byte kernel
window, the value ROWS renders as nothing, so every Device::new fingerprint and module is
unchanged); Device::from_queries takes Floor, a 256-byte kernel window: a dispatch region and 28
buffer addresses. lower::push::{window, place, spills} take it; the render windows are the same on
both. The push range is still the function's own need, and a module whose block passes 128 bytes
requires maxPushConstantsSize to cover it, as before.
The new runtime: the floor requires maxPushConstantsSize >= 256 (every captured device reports
256), a typed refusal below it; its pipeline layout declares 256 bytes, and a dispatch pushes the
kernel's own bytes. A new metric, Metrics::ring_writes, counts each parameter block and each
set_bytes copy written into the ring. README: the floor's limit row and the parameters paragraph.
The harness gains wide_bindings: 256 small dispatches of a kernel that binds 24 buffers.
Tests: push.rs places a region and 28 addresses in the floor window and spills a 29th, with the
first 12 placed as the guaranteed window places them; engine_identity's many-buffer kernel on
from_queries pushes all 21 addresses with no block, and one of 33 slots spills 2, both answering
on the interpreter; the floor tests move to 256; the profile facts test covers the new fact; an rt
device test dispatches a 24-buffer kernel with no ring write and a 30-buffer one with one a
dispatch. The signatures table gains Metrics::ring_writes.
The 160-command-buffer frame is renamed burst_160 for what it is, a burst
of small command buffers. burst_2000 is the burst a recording commits
most: 2,000 command buffers of one compute encoder of one lcg_step
dispatch, committed with no wait between and waited for once.
burst_2000x5 is that burst at five compute encoders a command buffer
(a plan now cuts a command buffer into encoders by per_encoder). frame
stays the desktop session shape, one command buffer of four dispatches.
A run is now waited for as a program waits for a burst: its last command
buffer first, then the rest (each then complete), rather than each in
order, which woke the waiter once per command buffer.
The recorded desktop sessions commit a median of one command buffer a
frame (two at the 90th percentile) with a few dispatches each, not 160.
frame is now that shape in compute alone, one command buffer of four
lcg_step dispatches a run; the form it had, 160 command buffers of two
dispatches, stays as frame_stress, a stress row judged only where a
recording commits at that rate. Both bind as before: the words and a
Shared increment by setBuffer, no setBytes.
Under the identity domains the emulated simdgroup tier's scratch holds two regions, and each
exchange and vote takes the next by a per-invocation turn (a Private u32 from 0 that each flips;
every invocation executes the same exchanges, so it is workgroup uniform). An exchange writes the
region the one before it did not; every lane read this region's last words before the barrier
that opened the exchange in between, and that barrier orders those reads before this exchange's
writes. So no exchange or vote closes with a barrier: a shuffle or broadcast is one barrier, a
five-round reduction or scan five (from ten), a vote or ballot two (from three), a matrix
multiply-add one (from two), a predicated loop's workgroup vote two (from three).
Vulkan's memory model: a control barrier with release and acquire semantics makes each
invocation's release synchronize with every invocation's acquire after it ("If A is a release
barrier, B is an acquire barrier, and C is a control barrier ... then A synchronizes-with B"), and
a read is location-ordered before a non-private write it happens before, so it does not see it.
The scratch takes twice its bytes per simdgroup (RuntimeFact::SimdgroupEmulation), so a kernel
whose threadgroup memory is near maxComputeSharedMemorySize reports fewer threads per threadgroup
or is refused where one region fit. The default domains (Device::new) keep one region and every
closing barrier.
SEMANTICS_VERSION 2159: the emulated modules of the identity domains change.
Clippy: Lowered::Made held a Kernel beside three small variants (large_enum_variant), and the
reaper's end drained the queue into a new one (drain_collect).
A kernel whose tier runs each SIMD group as one subgroup (a pinned subgroup of 32, the device's
own 32, or half of a 64-lane subgroup) runs only threadgroups of whole groups of that width. Such
a state now has its emulated-SIMD-group variant (LoweringInputs::emulated_simdgroups), which the
reaper lowers once new_compute_pipeline_state has returned, through the cache directory like
every lowering (a refusal is kept too). A dispatch whose threadgroup is not whole groups runs that
module at its own size; one that comes before the reaper is done waits for the lowering, which the
reaper takes next (Reaper::hurry), counted as a first-use wait. Nothing translates on an encoding
thread. A state made after quiesce, or whose lowering the reaper's end leaves, is marked not
lowered (Error::Quiesced at such a dispatch).
The emulated module's threadgroup memory is its arena (metal2vulkan::pipeline::arena_bytes, now
public) holding the lengths set, the scratch of each SIMD group, and a vote word: the dispatch's
total is checked against maxComputeSharedMemorySize (Limit::ThreadgroupMemory).
ComputePipelineState::precision_notes returns the emulated module's notes too once it is lowered.
Gap::PartialSimdgroups stays for a state with no emulated module: a kernel the consumer compiled,
or one whose emulated variant the translator refuses. A ragged dispatchThreads grid at such a size
is Gap::PartialThreadgroups: the partial-threadgroups variant does not take the emulated tier.
M3 bless job m3-max-41933 (every assembler) at development f29eb171a4, after the four
old-runtime regression fixes (d5a475f1a0, e0f567a8bc, aa8d6ac6f5, 8ec8cbbc20).
Against this morning's table (5c47b9c867, before the shared-path changes that moved the old
runtime): 3,412 rows kept, 0 cells changed on every one of the 19 profiles, 20 rows new (the
widest-pin shuffle fixture). Every profile's fingerprint differs from 5c47b9c867's: they are the
values 6f5bd20321 gave them when the profile lost its 16-bit-output field, which the restore
carries as a profile fact the fingerprint does not render for Device::new. A fingerprint is a
cache key, so a cached artifact of the old runtime misses once; no output differs.
The matrix at a17eb26a6b failed harness-new/frame/command_buffers
flatness: 63 at run 100 against 60 at run 200 on the Hawk Point, 62
against 64 on the RX 550. The new runtime's command_buffers gauge counts
command buffers made and not yet retired: the work in flight when it is
read, which moves with completion timing. The harness now waits for the
runs committed so far before it reads the gauges at runs 100 and 200, so
they count what the runs left behind; a leak still grows between them.
8ec8cbbc20 (a half color output 16-bit again under Device::new) and 45da84cc5a (NonWritable
loads under the identity domains) each raised SEMANTICS_VERSION from 2156 to 2157 on separate
branches; the identical edits merged without a conflict, so a cached artifact made at
8ec8cbbc20 would be keyed the same as the output of the NonWritable change. One more bump
separates them. No output changes.
Under the identity domains, a slot the module never writes (an unaliased
device buffer no store or atomic reaches) and every constant-address-space
slot are loaded through a PhysicalStorageBuffer block whose member is
NonWritable. Default-domain output is unchanged.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
6f5bd20321 removed the 16-bit `half` color output form on every device. That moved Device::new's
output, which the old runtime builds on: 111 golden cells on each RADV, ANV and MoltenVK profile
(5c47b9c867 -> bfe63b5097). The form comes back for Device::new alone, as a profile fact:
ProfileFacts::half_outputs is HalfOutputs::Sixteen in Device::new's facts (ROWS) and
HalfOutputs::Widened in Device::from_queries' (EVERY). Under Sixteen a `half` color output is
declared with 16-bit `float` lanes where the profile enables storageInputOutput16 and
shaderFloat16, as before 6f5bd20321. storageInputOutput16 is not one of the queries rule 2 lets
choose a second form, so the new runtime keeps one 32-bit form for every stage output. The fact
renders into no ROWS fingerprint, so Device::new's profile keys do not move.
- lower::stage_io: plan::half_variable (now reading the fact and the enabled feature),
IoObject::User::half, the 16-bit store and io_elem's width are back. StageIo::half_outputs and
the link contract's 16-bit lanes are back.
- The HalfOutputPrecision and HalfOutputFastMathBlend note texts, docs/API.md's degrade
catalogue, docs/FAST-PATHS.md and the half-output-blends case say what they said for the old
path, each scoped to Device::new, with Device::from_queries handing every device the `float`.
- known-gaps.tsv: the 52 MoltenVK rows for the M3 Max's half-output-blends-r16f, -rg16f and
-rgba16f go, as before 6f5bd20321: with the 16-bit output MoltenVK stored Metal's codes there.
docs/CONFORMANCE-COVERAGE.md is regenerated (3,783 -> 3,731 ledger rows).
- The Iris Xe's 62 half-output rows (6769c2eaaf) were measured with the 32-bit form on ANV, which
gets the 16-bit form again under Device:🆕 they are owed a re-run with it.
- SEMANTICS_VERSION 2157 (the 111 cells per profile change under unchanged keys) and
ARTIFACT_FORMAT_VERSION 530 (the artifact codec has StageIo::half_outputs again).
- The engine_stage_io test is back. It also checks that the profile from Device::from_queries is
HalfOutputs::Widened and keeps the output 32-bit on MoltenVK, RADV and lavapipe, with no
StorageInputOutput16.
Verified at 8e0e199a12 on 00ca405504, whose tree is this commit's but for SEMANTICS_VERSION (2156
there; development took it meanwhile) and development's later commits (03a3741772 and the
harness's), which touch none of this commit's files:
- msi 41897: golden_hashes_match_the_table with every difference listed, compared with the
tables at 5c47b9c867 and bfe63b5097. All 504 stage-io cells on the .ll rows that Linux compares
(56 on each of the 4 RADV, 4 ANV and MoltenVK profiles) are back at their 5c47b9c867 values,
none elsewhere. On ANV and MoltenVK those are the only cells that moved (280, under unchanged
keys). The RADV and NVIDIA columns are stale under profile fingerprints that development's
e0f567a8bc moved back before this commit (12,705 cells, the table not yet blessed for it); in
them only the stage-io cells above and 185 cells on each of nvidia-rtx50-linux and
nvidia-rtx5080-laptop (e0f567a8bc's NVIDIA restore) moved. No ROWS fingerprint moved with
this commit. The 55 stage-io cells per profile on .air.ll rows need metal-as and wait for the
M3 bless.
- msi 41813: clippy -p metal2vulkan --all-targets --all-features -D warnings, rustdoc
-D warnings, nextest -p metal2vulkan -p metal2vulkan-conformance in full: 4,719 of 4,722 pass.
The failures: golden_hashes_match_the_table, for the bless above;
the_public_signatures_are_the_committed_table, development's degradations! row, fixed since by
489bc24c4e; the_authored_4096_step_kernel_compiles_inside_the_budget, which passed alone on
the same build (41862) and is not in this commit's scope.
- msi 41814: clippy under --cfg m2v_gpu and --cfg m2v_cpu_icd.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
A narrow integer (i8, i16) is held zero-extended in a 32- or 64-bit container, and an add,
subtract, multiply or shift left not marked nuw, a signed divide or remainder and an arithmetic
shift right mask their result back to the width. The bits within the width depend only on the
operands' bits within it, so where no use reads the bits above it the mask is work no answer
depends on.
A new profile fact, NarrowWrap, says which results keep the mask: Device::new's profile keeps
every one (NarrowWrap::Every, its rendering unchanged, so every Device::new fingerprint and module
is byte-identical); Device::from_queries' masks only the read ones (NarrowWrap::Read). On that
profile a pass after selection (lower::arith::demand) classifies each use from its instruction and
selected strategy: another wrapping operation, a truncation, a sign extension and a narrow freeze
read only the low bits; a select's values, a phi, a copy, a constant-lane extract or insert, a
shuffle, a bitwise and/or/xor and a nuw operation pass the bits on; every other use reads them. A
worklist marks the results whose high bits are read; the strategies of the rest keep wrap false,
and ops::int_binary leaves them unmasked.
Tests: an interpreter test runs every wrapping operator unwrapped on operands holding junk above
the width, masked after, against LLVM's answer at widths 5, 8, 16 and 40; engine_narrow_wrap
checks, on every committed profile and both constructors, which of an owned kernel's 19 narrow
operations mask, translates and validates them, and runs both modules on the interpreter against
LLVM's words; the profile facts test covers the new fact.
On lavapipe the new runtime's translator refused the sampling kernel
(IdentityDomains) before the runtime was asked for a texture: a failure
rather than the typed refusal the runtime gives for textures. A plan's
textures and sampler states are now made first, so a runtime that makes
none refuses the plan for that.
The harness timed no sampling kernel. Plans now make textures (2D,
RGBA16Float, one level, Private, ShaderRead|ShaderWrite), bind them with
setTexture:atIndex:, and bind sampler states (linear or nearest,
normalized, clamped to the edge) made once per plan. The harness fills
a texture from a Shared buffer and reads one back with its own kernels
(texels_in, texels_out), made only for a plan with a texture, so a
session that runs none makes the pipelines it made before.
Two workloads: sampling, a 2x downsample of a 2048x2048 texture through
a runtime sampler, and constexpr_sampling, a 2x upsample of a 1024x1024
texture through a constexpr sampler; each one sample and one texture
write a thread. Their inputs are sixteenths below 4, so under weights of
halves and quarters every result is exact in half; the CPU reference
allows two last-place steps of a half for the device's own filter and
conversion.
The old runtime runs both. The new runtime makes no texture or sampler
state yet: its texture and sampler types have no value, and both
workloads are typed refusals.
Under the identity domains, each workgroup barrier the emulated simdgroup tier emits for its
exchanges and votes (Emu::barrier, the emulated vote) opens a block that a branch on 1 < N
enters, N the threadgroup's threads: an OpSpecConstantOp ULessThan of the local-size constants,
so the specialization decides it and every invocation takes the same arm. A threadgroup of one
thread exchanges with itself alone, in program order, and executes none of those barriers.
The default domains (Device::new) emit the barriers unconditionally, as before. A Metal
simdgroup_barrier that the tier widens to a workgroup barrier is the kernel's own and stays.
SEMANTICS_VERSION 2156: the emulated modules of the identity domains change.
a17eb26a6b's matrix run did not report OLD PATH MOVED although its golden test counted 7260
cells under a changed profile fingerprint (the stage-bound change): the check commit's own
message quotes "old-runtime regression fix", and the rule looked for the phrase anywhere in a
message since the last bless. It now takes only a subject that starts with it, as each fix's
does.
Tests: scripts/matrix/test_results.py, 17 pass; the old-path test now also feeds a message that
quotes the phrase in its body and expects the problem to stand.
aa8d6ac6f5 mapped PrecisionNote::DeviceReconvergence onto the old runtime's existing
ImplementationDefinedReconvergence kind and deleted the extra kind, which changed the
degradations! macro's expansion; the public-signature table still held the old row. The row is
the one core's bless observed at 7798a599e9 (built on aa8d6ac6f5); nothing else moves.
Verified: the_public_signatures_are_the_committed_table passes at this change (job m3-max-41854,
um790; 41853 ran out of its 10 GiB building).
The frame workload set its increment with setBytes on every dispatch, so
on rt each dispatch wrote the parameter ring, a host write across the
link on an externally attached GPU. The recorded streams bind with
setBuffer:offset:atIndex: and make no setBytes call. frame now keeps the
increment in a 16-byte Shared buffer written once at fill and binds it
like the words; the kernel, the dispatches and the expected words are
unchanged. dispatch_chain still measures setBytes.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
6e08f5aaef made every stage of implementation-defined reconvergence
record PrecisionNote::DeviceReconvergence on the shared translator
path. The old runtime (Device::new) then announced a second kind,
Degradation::DeviceReconvergence ("device-reconvergence"), for a
tangled stage on a device without maximal reconvergence. Before that
commit it announced ImplementationDefinedReconvergence alone, from the
stage's reconvergence field.
Route (a) of the planner's two: the note is a third profile fact.
- ProfileFacts gains reconvergence_note: ReconvergenceNote::Field for
Device::new (ROWS), ReconvergenceNote::Noted for
Device::from_queries (EVERY).
- pipeline::compile records the note only where the profile notes it.
- A Device::new stage again carries the field alone, its notes as
before 6e08f5aaef.
- The fingerprint renders the facts only off ROWS, so no Device::new
fingerprint moves.
The old runtime's Degradation::DeviceReconvergence kind is deleted: no
Device::new stage records the note. Its catalogue entry in API.md and
its API-table row go with it. from_precision_note maps the note, which
none of its stages hold, onto ImplementationDefinedReconvergence, as the
closed match requires. The note stays in the translator's vocabulary,
codec and validation allowance for metal2vulkan-rt, which forwards it
through ComputePipelineState::precision_notes.
Tests:
- engine_simd's reconvergence_follows_the_profile and
uniform_control_flow_mode_without_maximal_reconvergence assert the
field alone through Device::new and the note through
Device::from_queries; the guaranteed stage records none.
- the_profiles_facts_follow_its_constructor covers the third fact.
SEMANTICS_VERSION 2155.
07e62aa306 deleted DriverWorkaround::HalfConversionPairFolded (NVIDIA)
and HalfConversionFusedWithArithmetic (RADV) on the shared translator
path. That changed the old runtime's modules:
- NVIDIA's moved from the Converted form to the Controlled one: 333
golden cells each on nvidia-rtx50-linux and nvidia-rtx5080-laptop,
bless 7fa6662170.
- The NVIDIA and RADV fingerprints moved (six profiles).
- Every controlled module gained NativeHalfConversion.
Restored for Device::new, as before 07e62aa306: both identity rows,
narrow::quantize_form's fold check (NVIDIA takes Converted),
narrow::rounds_arithmetic, and the note on a controlled pair only where
RADV's row fuses f32 arithmetic into the narrowing. The validation lanes
(half_conversions, native_maths) and the translator's tests go back to
their text before 07e62aa306.
rt keeps what landed, carried with no switch. The note's form is a
second profile fact beside the stage bound:
- device::profile::ProfileFacts holds { stage_bound, half_pair_note }.
- Device::new builds ProfileFacts::ROWS (Defects, Fused).
- Device::from_queries builds ProfileFacts::EVERY (Every, Every).
- pipeline::compile reads half_pair_note: Every records the note on
every module that keeps a controlled pair. Fused is the old rule.
- from_queries profiles name neither row, so quantize_form gives them
Controlled on every device with the controls, NVIDIA's included.
- The fingerprint renders the facts only when they differ from ROWS, so
Device::new's NVIDIA and RADV fingerprints return to their values
before 07e62aa306.
Tests:
- The identity tests are back.
- New from_queries_half_rounding_follows_the_queries_alone and
from_queries_notes_every_controlled_pair.
- The facts test covers both facts.
Docs: PrecisionNote::NativeHalfConversion, API.md's degrade catalogue
and HOWTO.md name both paths; the API table regains the two variants.
SEMANTICS_VERSION 2154.
576a7348bc put one stage bound on every device on the shared translator
path, so the old runtime (Device::new) newly refused what it compiled
before: on the UHD 630 and on every committed profile without maximal
reconvergence, 6 corpus modules (12 rows) went from compiled (emulated
simdgroups, entry weights 104,424 to 188,554) to Needs::StageBound.
Measured on gem10 through Device::new at 9cb90de8cc (job m3-max-41747).
Restored for Device::new, as before 576a7348bc:
DriverWorkaround::SerializedStageWrapsLargeModules and
CompilerMemoryGrowsWithStageSize on ANV's identity row, their bounds
(786,432 and 99,109), the re-plan keeping the widest pin, and the
refusal as Needs::DriverDefect naming the defect; no bound elsewhere.
The old runtime's heap-trim test, warm-refusal kinds and their tests go
back to their text before 576a7348bc.
rt keeps what landed, carried with no switch. The bound is a fact of
the profile (device::profile::StageBound): Device::new builds
StageBound::Defects (the bounds of its rows), Device::from_queries
builds StageBound::Every (99,109 on every device, refused as
Needs::StageBound). stage_bound::emit reads that one field. The
fingerprint renders the fact only when it is Every, so every
Device::new fingerprint is byte-identical to before 576a7348bc. Every
from_queries fingerprint moves, so an rt profile is never one of the
old path's.
Tests:
- The pre-576a7348bc ANV tests are back (both defects' bounds, and the
same profile without them emitting under every bound).
- New every_stage_from_queries_keeps_the_widest_pin_or_is_refused:
re-planned, then StageBound; the serialized bound is none there; RADV
through Device::new is unbounded.
- the_stage_bound_fixture_keeps_the_pin_or_is_refused covers both
paths. Iris pinned through both. Without maximal reconvergence:
StageBound through from_queries, DriverDefect on ANV through
Device::new, and emitted emulated through Device::new under Intel's
Windows driver (the UHD 630's case).
- New the_stage_bound_is_a_fact_of_the_profile checks every committed
profile.
Docs:
- FAST-PATHS' known gap is ANV's again.
- The rt README's known gaps gain the every-device bound.
- API.md and the Needs::StageBound and Feature::StageSize docs name
both paths.
- REFUSALS.md regenerated; the API table regains the two variants.
SEMANTICS_VERSION 2153.
Under the identity domains an argument buffer's texture handle is the gpuResourceID its member
holds: the handle is the ID's index, the element of the class's set-1 array (0 is nil, the null
descriptor), with no handle table, no search and no descriptor. Where the shader checks a read
itself (no robustImageAccess2) the handle carries the word's missing-alpha bit (word bit 12) at
HANDLE_ALPHA_ONE, so the handle form is Lookup::Element or Lookup::Flagged{alpha} only.
The handle tables' variant forms are off under these domains (`texture::tabled`): reads of a
member of another numeric class, raw-texel decodes, storage conversions (red-blue, sRGB alias),
A8 alpha-in-red, unreadable-storage nulls, YCbCr write marks, and the HeapCrossClassNeutral,
HeapStorageReads and HeapResidency facts. A slot and a member of one class index one array, so
the class's volatility now merges the slots' uses with the groups'. The admission takes heap
groups whose declaration is their identity class with no plain, raw or cross classes; anything
else stays Unsupported{IdentityDomains}.
Translation output changes only under the identity domains: the default domains plan and emit
as before (no golden re-bless needed). SEMANTICS_VERSION 2153.
The test kernel `tex` gains an argument-buffer form (`texture_kernel(true)`), checked on
lavapipe, moltenvk-m3 and moltenvk-m3 without robustImageAccess2: same answers at the same
elements, set 0 empty, and the handle form Element or Flagged{alpha} as the profile checks reads.
Verified (this commit's tree, as 657e2245c2 on 2872c419e0):
- msi 41756: clippy -p metal2vulkan --all-targets --all-features -D warnings, rustdoc
-D warnings, nextest -p metal2vulkan -p metal2vulkan-rt in full: 3,701 of 3,702 pass; the one
failure is golden_hashes_match_the_table, stale under development's own profile change.
- msi 41800: that golden test with every difference listed: 7,260 cells under a changed profile
fingerprint (development's at 2872c419e0; this commit changes no profile field), no cell whose
value moved, no cell changed under an unchanged key. Fixtures that need metal-as (macOS) are
not compared there.
- msi 41757: clippy under --cfg m2v_gpu and --cfg m2v_cpu_icd.
- msi 41712, 41713 and 41752: the same at 160a3c5bae on 9cb90de8cc (SEMANTICS 2152 there), the
golden test matching 1,815 rows x 19 profiles.