Metal's simd_sum and simd_product of half operands combine the lanes as a tree. In round d
(1, 2, 4, 8, 16), each aligned block of 2d lanes holds its two halves' results combined and
rounded to half, and a lane that takes no part counts as the identity. Measured on an M3 Max
(macOS 27.0.1, our own MSL, fast math on and off alike):
- sums: potluck job m3-max-80839;
- products: m3-max-80879;
- sums and products over three masks of active lanes: m3-max-80890.
The tree matches every answer. The float result rounded once misses five of the eight sums,
four of the eight products and ten of the 48 masked results. The tree over the active lanes
packed together misses three masked sums.
metal2vulkan-devtools' half_simd_reductions holds two kernels of our own AIR, the operands and
Metal's answers:
- half_simd_reductions: eight simdgroups summing and multiplying their lanes in a uniform block;
- half_simd_reductions_masked: the same in blocks only a mask of lanes executes.
Three tests run them:
- engine_simd: the Direct tier at 32 lanes and the Cluster32 tier at 64, on the CPU
interpreter. Red: those tiers fold the f32-held values with OpGroupNonUniformFAdd or FMul
and round once.
- engine_simd_emulated: the emulated tier's pairwise tree at every width, on lavapipe's and
the floor's profiles. Its rounded combine is Metal's tree, so this test is expected green.
- the runtime's half_simd_reductions: under a device cfg, every device of the cfg's kind. It
prints the kernel subgroup sizes and each pipeline's precision notes.
Verified: none of these tests has run yet; their jobs follow. cargo fmt only on this host.
A vertex or fragment function that writes, at a slot it does not read, a texture whose storage
element is its UNORM twin's view was Gap::StorageElement at the draw. It now takes the form the
kernel took: the render encoder finds the texture slots each function the state lowers from its
AIR writes and does not read that hold a twin (TextureObject::encodes) beside the buffer slots it
holds to 4, and draws through the state's content for both (RenderPipelineState::for_draws, made
at the first such draw and kept in the device's map of contents under the descriptor's key with
the slots), which lowers those slots under LoweringInputs::srgb_storage, so each write there is
encoded by the MSL transfer through the device's conversion. KernelKey's srgb is a mask per stage
(the kernel's or the vertex function's, then the fragment function's). The facts skip a slot the
content encodes; read_write stays refused, and so does a twin at a slot of a function the
consumer compiled, which has no variant. A render state whose vertex or fragment function writes
a texture slot it does not read announces PrecisionNote::DevicePackConversion from its creation.
No new query and no second form: the twin's view and its query are the kernel's.
The runtime's README moves the draw out of the sRGB texture's known gap and names the content
among the makes at encode; docs/REFUSALS.md regenerated with no change (the StorageElement sites
are the same; refusal_surface.py --check exit 0). Proof jobs follow.
Metal's run on an Apple M3 Max with its validation layer (job m3-max-82183, record then times
--runs 8 --write): each fragment's write stores the same bytes the kernel case's writes store, all
four stored sites equal to srgb-storage-writes' recording. On the runtime at development's tip the
case's draw is Gap::StorageElement; the runtime's draw test is red on lavapipe (job m3-max-82181,
filtered, 3 tests: 2 passed, 1 failed, the new one, refused StorageElement Absent).
fpv_srgb_draw_storage's companions (regen-air-fixtures on the Mac, job m3-max-82169). The
conformance case srgb-storage-fragment-writes is the fragment twin of srgb-storage-writes: the same
values, formats, texture and layout, written by fpv_srgb_fragment_write and its half form behind
one triangle over a 256 by 2 RGBA8Unorm attachment. The runtime's test draws the fragment writers
and the vertex writer (rasterization off) onto RGBA8Unorm_sRGB and BGRA8Unorm_sRGB textures with
their twins' storage views, and expects the draw to run through the render state's sRGB variant:
the encode in the bytes, one make at encode, and the state's DevicePackConversion note. At
development's tip the draw is Gap::StorageElement, so the test is red; the Metal recording and the
lavapipe run follow.
Owned MSL for the draw-side sRGB storage lane: a cover vertex function, fragment writers of
float4 and half4 at their pixel, and a vertex writer at its vertex ID's place, each from buffer 0
in a row buffer 1 wide. The companions follow from regen-air-fixtures on the Mac.
The planner closed holding a format as words where its own view lacks the read without a
format (a whole-format move): on the Iris Xe it serves read_write but slows every other read of
those formats, and trades the refusal for another (a read through a sampler would be
Gap::TexelBufferOwnView). The read_write refusal stays the typed known gap
(Gap::StorageElement, ReadWithoutFormat).
The row now records, so nobody times it again:
- job m3-max-82136, Iris Xe (RPL-P), ANV (Mesa 26.2.6, read on the node by job
m3-max-82150): GPU p50 of texel_buffer_bgra8_read 11857.1 us as words against 9007.0 us as
its own view (+31.6%), texel_buffer_b5g6r5_read 12133.8 us against 9215.2 us (+31.7%); the
median of 8 rounds of 500 runs, the two builds alternating, the own view's build against
itself within 0.1%, every run's values checked against the CPU references;
- job m3-max-82025's listing: the committed ANV profiles (irisxe-rplp, irisxe, uhd770) answer
the same for seven formats (adding RG11B10Float, RGB10A2Unorm and RGB10A2Uint), and no other
committed profile does;
- the trigger: no further form is built; that changes on a guest's run or stream that meets the
refusal.
On the Iris Xe (RPL-P, ANV) the buffer features of BGRA8Unorm, B5G6R5Unorm,
BGR5A1Unorm and BGR10A2Unorm take a uniform texel buffer, a storage texel
buffer and the storage write without a format, so texel_buffer_form holds
them as their own views, but lack VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT.
A dispatch reading one through access::read_write is Gap::StorageElement
(ReadWithoutFormat): job m3-max-81883 failed the runtime test on B5G6R5Unorm,
BGR5A1Unorm and BGR10A2Unorm and the stream test on BGRA8Unorm there.
With that dispatch refused, the runtime test's reads and writes through handles now run on the
Iris for B5G6R5Unorm and BGR5A1Unorm as their own views, whose values are ANV's conversion: it
widens a 5- or 6-bit field by replicating its bits (job m3-max-82043: B5G6R5Unorm's texel 2 read
0.5176471 against the CPU's 16/31). The test takes a normalized format held as its own view within
PrecisionNote::DeviceTexelConversion's recorded bound (docs/API.md's catalogue: one f32 ulp, or
0.18 of a code of a 5- or 6-bit field and 0.015 of a code of a 10-bit one the device widens by
replicating its bits), as the stream test already did.
The ruled query stays. The runtime test and the replay stream test now expect
that refusal by name wherever the device's own view of the format lacks the
read without a format, and the runtime test still checks the format's reads
and writes through handles there. The runtime README records the refusal on
those four formats on the Iris as a known gap, naming the missing feature.
The predicate's docs name the three uses its checks cover (a read through the
uniform texel buffer, the storage texel buffer the view's usage takes, a write
through it without a format) instead of "every access".
runtime-sources.sha256 takes the runtime inputs' new hash: texel_words.rs, an input, changed in
its doc comments alone, which change no behaviour of a run.
Verified with this change on development ece306e521 (its tip then, ee46e48714):
- Iris Xe, job m3-max-82058: the stream test passed (BGRA8Unorm and B5G6R5Unorm play
their recorded IDs, then the read-written one is refused by name at the dispatch;
RGBA8Unorm, R8Unorm and RGBA16Unorm the CPU's texels and values); the runtime's
texture buffer tests 11 of 11 (B5G6R5Unorm, BGR5A1Unorm and BGR10A2Unorm answer
within the bound, their read_write refused by name);
- RTX 3090, job m3-max-82043 (976685a17e, before the bound, which its words do not
take): stream passed, runtime texture buffer tests 11 of 11;
- lavapipe and CPU, job m3-max-82057: clippy in the three configurations, rustdoc,
validation 1320 passed, conformance 1048 passed, the runtime's suite 964 passed
(4 skipped), texture buffer tests 13 of 13, the stream test passed.
The planner accepted the twin's read of a B5G6R5Unorm texture buffer held as words at 2.3% more
GPU time than the same words compiled with no stage constant (the per-format query's form) on
the RTX 3090, and let the known gap carry the row. The words-cost known gap now gives it, with
the RX 7900 XTX's 2.1%:
- RTX 3090, exclusive job m3-max-81336, 4 rounds rotating the arms, median of each round's GPU
p50: read 167.6 us (spread 1.01%) against 163.8 us (1.16%); write 312.0 us against 310.9 us.
- RX 7900 XTX (RADV), exclusive job m3-max-81364, the same: read 93.1 us (1.07%) against
91.2 us (0.88%); write 85.9 us against 86.0 us.
On both cards the device's profile holds B5G6R5Unorm as words; base refuses the format there.
Documentation only.
SEMANTICS_VERSION 2328 -> 2329: on a profile that holds a colour format's texture buffers as
words, a function reaching a texture buffer emits the words routines and declares
SpecKey::TexelBufferWords (its words twin), records RuntimeFact::TexelBufferWords and, for an
access the words do not build, RuntimeFact::TexelBufferOwnView, and records
DeviceTexelConversion, SrgbTexelDecode and DevicePackConversion where the words convert so; a
texture buffer's word keeps its border texels unless its format has a word layout.
ARTIFACT_FORMAT_VERSION 602 -> 603: RuntimeFact gains the TexelBufferWords and
TexelBufferOwnView variants (cache/codec.rs).
RUNTIME_VERSION 2554 -> 2555: the runtime holds a texture buffer of a format the device lacks for
one of its accesses as an R32_UINT view whose texels the shaders convert, runs a content's words
twin where a draw or dispatch binds one, sizes an indirect execution's shape per pipeline, and
refuses a texture buffer held as words at a slot an own-view access reaches (the runtime gap).
The validation crate's runtime inputs take metal/format/texel_words.rs (build.rs): the runtime
decides each texture buffer's form and word layout through it (texel_buffer_form), and the
runtime-sources guard found metal/format/mod.rs, an input, reaching it unlisted.
runtime-sources.sha256 holds the inputs' new hash, computed as the build script computes it (the
same computation gives development 3ecfe8f034's committed b5a8df0e75...).
The golden tables, the engine fixture inventory and its llvm_as part, are blessed on
development: the semantics bump and the new fixture tb_word_formats move them.
The pipeline-keyed shape (the previous fix) holds for every layout the execution draws with: a
content of patch draws (DRAW PATCHES' CommandDraw::Patches, a post-tessellation vertex function,
PATCH_LIST) has a words twin beside its patch pipeline where a stage reaches a texture buffer, and
an execution through the twin takes the preprocess requirements of the twin.
The shape test now sizes both pipelines of two contents, each with tb_word_fragment: plain
draws (TRIANGLE_LIST, CommandDraw::Plain) as before, and patch draws (icb_merged_patch_vertex,
PATCH_LIST, CommandDraw::Patches) on a device whose executions run tessellation stages, saying
so where they do not.
An execution shape holds the preprocess requirements vkGetGeneratedCommandsMemoryRequirementsEXT
answers for the pipeline the execution binds, and VUID-VkGeneratedCommandsInfoEXT-preprocessSize-
11071 asks an execution's preprocess size of the requirements of its matching inputs, that
pipeline among them. The shape cache keyed a shape on the content's id and the raster state, which
chose the content's pipeline until the words twin: under one raster state a content now has two,
the plain one and its twin, and an execution that ran the twin took the shape the plain pipeline
sized.
The key now holds the pipeline itself in place of the raster state: one per class and raster
state, the twin's apart from the plain one's. A content's pipelines live as long as it does and
its id is never another's, so no stale shape matches. Indirect::shape takes (content, pipeline);
the draw and the execution part pass the pipeline they bind. The runtime README's line on the
shapes the device keeps says so.
Red/green: the test of the previous commit asks for two shapes from the plain pipeline and the
twin of a content that reads a texture buffer; the device run is in the hand-over checks.
An indirect command buffer's execution shape (indirect::Shape) holds its command layout and the
preprocess requirements vkGetGeneratedCommandsMemoryRequirementsEXT answers for the pipeline the
execution binds, and VUID-VkGeneratedCommandsInfoEXT-preprocessSize-11071 asks the execution's
preprocess size of the requirements of the matching inputs, the pipeline's among them. The shape
cache keys a shape on the content's id and the raster state, so an execution that runs a
content's words twin reuses the shape the plain pipeline of the same raster state sized.
The test makes a content whose fragment function reads a texture buffer (tb_word_fragment), for
indirect command buffers, takes its plain pipeline and its words twin at the default raster
state, and sizes a shape for each: it asks for two. Red here on a device with indirect command
buffers that holds a format as words (one shape); it skips, saying so, on a device without them.
On the Iris Xe (ANV, Mesa 26.2.6; job m3-max-81344, and its diagnostic m3-max-81378),
texel_buffer_b5g6r5_read failed its check in every arm, base 2bfb9b5bd3 included, which holds
B5G6R5Unorm through its own view there: "buffer 1: 959978 values differ; the first, [0], is
41.34902, not 41.343575 +- 0.0009765625". The row sums 16 texels' four channels against the
CPU's c / (2^b - 1) within 1/1024, but ANV widens a 5- or 6-bit channel by replicating its bits,
which the translator records as PrecisionNote::DeviceTexelConversion with a recorded bound of 0.18
of a code (docs/API.md). The row's tolerance now adds that bound for each 5- or 6-bit channel of
the 16 texels a sum reads: 16 x 0.18 x (2/31 + 1/63), about 0.23. Other formats' rows keep 1/1024
(an 8- or 16-bit code's one ulp is inside it). On the RTX 3090 and the RX 7900 XTX the row runs
through the words (base refuses the format there), bit for bit, and passed.
Verification pending: the row on the Iris Xe with this harness.
The runtime's Draws gained own_views in 5f5a42681f; the indirect tests' literal lacked it (E0063,
job m3-max-81152's clippy). It names none, as the content reads nothing else.
Verified: not yet built; job of the next dispatch.
The planner's ruling on (A)'s read-through loss, option (ii). Under the identity domains on a
profile that holds some format's texture buffers as words, words::wrap refused the whole module
for a texture buffer access its routines do not build: a read through a sampler, one that
observes residency, one in another numeric class, an sRGB code read, a write of another class or
of fewer than four lanes. The ceilings run (job m3-max-81042) lost three fixture rows that compile
on the base, development 530fb4ea4c: kernel_read_through's rt_buffer, rt_buffer_ow and
rt_arg_buffer, on lavapipe and on the runtime floor.
Such an access now keeps its strategy, the texture's own view, as on a profile that holds no
format as words, and the stage records RuntimeFact::TexelBufferOwnView { stage, texture }: the
slot, or None for a texture buffer reached through a handle. The fact's mechanism is a plan-time
check. The runtime's kernel interface and a render content's draws read it, and a dispatch or
draw that binds a texture buffer held as words at such a slot is Gap::TexelBufferOwnView of the
slot and its format; through a handle, any such dispatch or draw while a texture buffer held as
words is live (the gauge the words twin's handles test reads). Binding no texture buffer held as
words there changes nothing.
Tests: engine_identity's a_read_through_a_sampler_of_a_texture_buffer_takes_its_own_view compiles
the three entries under the identity domains on lavapipe and moltenvk-m3, passes L3, and checks
the fact where the profile holds a format as words and nowhere else (red before this: lavapipe's
compile refused). The runtime's a_read_through_a_sampler_refuses_a_texture_buffer_held_as_words
runs rt_buffer_ow over six formats. Each held directly answers its texels and Metal's white
border: three without a word layout, and three with one, whose border comes from the code. Each
held as words is refused at its dispatch with the gap of slot 0 and its format, and the same
state's next dispatch runs.
docs/REFUSALS.md and the error basis are regenerated. The runtime README's known gaps state the
refusal. api_signatures gains the fact's and the gap's variants.
Verified: not yet built; the ceilings, the gate, lavapipe device tests and the read-through-buffer
conformance replay follow.
The words change cleared bits 0-11 of every texture buffer's word, on the premise that no texture
buffer is read through a sampler. Metal 4.1 reads one so (`read(sampler, x)`, the fixture
kernel_read_through's rt_buffer, rt_buffer_ow and rt_arg_buffer, the conformance case
read-through-buffer), and under the identity domains such a read takes the border texel from
those bits. So every texture buffer read through a bordered sampler read a zero border on every
device, and one of a format with a word layout read its fields as border texels. The base,
development 530fb4ea4c, kept the bits; found by reading, before any run.
Now TextureWord::of_texture_buffer is the texture word, border texels included, for a format
without a word layout, which is the base's word. A format with a word layout sets bit 13
(TextureWord::TEXEL_BUFFER_LAYOUT, 0 in every other word) and carries its fields in bits 0-10 on
every device. The words' held test requires bit 13, since a plain word's bits 2-7 are border
texels; a handle carries 14 bits of the word (HANDLE_WORD 0x3fff). A slot's read through a
sampler of a texture buffer takes the border texels from bits 0-11 where bit 13 is clear, else
from its format's code (words::border_texels, a choice among the values the word layouts'
formats have, grouped from WORD_FORMATS and metal::sampler::border_texels).
RESOURCE-ID.md and resource_words.tsv state the new word: the texture buffer lines of a word
layout gain bit 13, the others carry their border texels (the texture line's word at the default
swizzle).
Consumer search, the consumer's development 2221a41c20 (git grep -w over *.rs, *.c, *.h, *.m,
*.mm, *.cpp, *.py, *.tsv, *.md): TextureWord, of_texture_buffer, resource_word, resource_words,
BORDER_TEXELS, TEXEL_BUFFER, border_texels, OUT_OF_BOUNDS_ALPHA_ONE, PIXEL_FORMAT_SHIFT: 0 hits
each. The consumer takes each texture's ID from the runtime's gpu_resource_id.
Verified: not yet built. The unit test words::each_code_takes_its_format_s_border_texels holds
each code to its format's border texels; the runtime test and the lavapipe replay of
read-through-buffer come with the next commit.
The public function's doc linked VIEW_USES and NATIVE_USES, which are private: rustdoc with
-D warnings failed on the three links (the rebased branch's gate, job m3-max-81050, doc step
EXIT=101). The doc now states the uses in words: a uniform texel buffer, a storage texel buffer
and a storage texel buffer written without a format.
Verified: not yet built; the next gate's doc step checks it.
The planner's ruling for (A): the twin's per-state compile cost is the form's known gap for a
program that binds a texture buffer. On lavapipe (job m3-max-80997, the texture buffer stream
test's tb_word_formats state over five formats) the twin's make took 16.9 to 23.5 ms
(Metrics::word_pipeline_nanos) and the plain pipeline's create at least 2.9 to 5.3 ms
(pipeline_creation_nanos less the twin's), about 4 to 7 times. The five recorded guest streams
declare the constant in no state (job m3-max-80975): 0% of their boots' compile time.
The test took an own view's values within one ulp with nothing behind the number. The value
is the device's conversion of each code, which the translator records as
PrecisionNote::DeviceTexelConversion; the test now asserts the fixture's state records that
note, and takes an own view's values within the note's recorded bound (docs/API.md): an 8- or
16-bit code within one f32 ulp, a channel of 6 bits or fewer within one ulp or 0.18 of a code
where the device replicates its bits (ANV, NVIDIA). Words stay bit for bit.
Not yet rerun.
The handles dispatch passed the read-written values (a Vec<f32> by then) at slot 2, which the
kernel does not use, so the runtime's device tests did not build (job m3-max-80971 on
lavapipe, E0308); it binds the values buffer there. The texture buffer stream compared an own
view's values bit for bit with the CPU's c / (2^n - 1); lavapipe's conversion multiplies by
the reciprocal and lands one f32 ulp off for RGBA8Unorm, R8Unorm and BGRA8Unorm (80971). The
device's own conversion is the answer (the owner's rule 1), so an own view's values are taken
within one ulp; words, our own decode, stay bit for bit (B5G6R5Unorm matched exactly).
Not yet rerun.
Interface gained `words` (the kernel's reach of word-held texture buffers) with the words
twin; the device tests' hand-made Interface (tests/compute.rs, compiled only under m2v_gpu or
m2v_cpu_icd) still lacked it, so the runtime's device tests did not build (job m3-max-80900,
nextest exit 101). Its kernels declare no texture buffer: None.
Not yet built: the lavapipe check reruns as a potluck job.
The two B5G6R5Unorm rows grew the harness's list past its declared 45, which stopped the
harness from compiling (the XTX arms build, job m3-max-80896, E0308). The texture buffer
replay stream passed each descriptor inline, which the player refuses for
newTextureWithDescriptor:offset:bytesPerRow: (job m3-max-80900 on lavapipe: "argument 0 ...
not an object"); it now records each with m2v.textureDescriptor first, as the other
texture-over-buffer streams do.
Not yet built: both checks rerun as potluck jobs.
The owned fixture tb_word_formats gains tb_word_fragment, which colours the pixel at x with texel
x % 5 of its texture buffer (regenerated with the macOS Metal toolchain and LLVM 21). The
runtime's draw test reads an R8Unorm and a B5G6R5Unorm texture buffer through it, checks every
pixel against the CPU's decode within one code, and that the draw ran the twin exactly where the
device holds the format as words.
Not built yet.
Metrics::word_contents counts the compute and render contents whose module declares
SpecKey::TexelBufferWords; the replay player prints it. A count of the dispatches and draws that
ran a words twin, for the device tests alone, shows which pipeline ran.
The owned fixture tb_word_formats gains tb_word_formats_args, which reads and writes the texture
buffers through an argument buffer's handles (regenerated with the macOS Metal toolchain and
LLVM 21). The runtime's words test runs it after the slots' kernel and checks its values, and
that the slots' dispatch ran the twin exactly where the device holds the format as words, and the
handles' dispatch there too.
Not built yet.
AGENTS rule 2's texture buffer form and the runtime's README name the stage constant, the words
twin made in the same make as each plain pipeline, what picks it, and its second compile and
memory as the form's known gap; docs/API.md and RESOURCE-ID.md name the gate.
The replay player prints the word pipelines' and word-held texture buffers' gauges and the
twins' makes and time beside pipeline_creation_nanos.
The harness's texel_buffer_b5g6r5_write and texel_buffer_b5g6r5_read rows time a format the lab's
cards hold as words, a 2-byte texel written by two atomics and read through the words' routine,
checked against the CPU's exact conversion and decode.
Not built yet.
SpecKey::TexelBufferWords { stage, handles }, a bool, false by default, which a stage declares
under the identity domains on a profile that holds some format's texture buffer as words, where
it reads, writes or queries a texture buffer. It gates each site's word test, the word bits a
handle carries and the element mask that drops them: false, they are dead code at pipeline
creation and each access is its view's alone.
The runtime makes each kernel variant's and each render content's words twin in the same make
as its plain pipeline, and a dispatch or draw runs it where a texture buffer held as words is
bound at a texture buffer slot a function declares, or, for a stage that reaches one through a
handle, while one lives on the device. Twins and word-held texture buffers are gauged, the
twins' makes counted with their time.
This commit alone was not built; the series is checked at its tip.
Blessed by job m3-max-80671 (bless_resource_words, then the resource_word tests: 2 passed): a
texturebuffer line for every pixel format with a texture buffer word at width 1, and at widths 2
to 4 where its padding changes the word, 251 lines; no texture or sampler line moved.
The site test read the codes from the module's declarations, which do not hold them; it reads
the plan's. The player compared a texture buffer's recorded ID with TextureWord::of, whose border
texels a texture buffer's word does not carry; it takes TextureWord::of_texture_buffer of the
descriptor's format and width, as RESOURCE-ID.md and REPLAY-STREAM.md now say. rt_replay gains a
stream of texture buffers of five formats (RGBA8Unorm, R8Unorm, BGRA8Unorm, B5G6R5Unorm,
RGBA16Unorm) over a Shared buffer, read, written and read-written by tb_word_formats with the IDs
the program saw recorded, each played on the cfg's device: no id line, the CPU's texels and
values, and each format's form on that device printed. Unbuilt.
Additions only (50 signature records): metal::format's TexelWords, WordLayout, TexelField,
FieldKind, TexelBufferForm, WORD_FORMATS and its functions, and TextureWord's texture buffer
fields and of_texture_buffer. scripts/api-signatures/signatures.py --bless reports no record
removed or changed. The runtime's texture buffer words test reads each format's form from the
device's profile and names it on each line.
metal::format::texel_buffer_form is the one place that decides, per format and device: the
format's own view where the device holds it directly as a uniform texel buffer, a storage texel
buffer and a storage texel buffer written without a format; else words where it has a word
layout; else its own view of the first two (whose writes the runtime refuses). The resource ID
word is unchanged and the same on every device; a module takes the codes its profile holds as
words (texel_buffer_word_codes) and tests a word's code against them, emitting nothing of the
words where the profile holds none so. The routines' cases and the precision notes follow those
codes. The runtime's texel_form takes the same answer. AGENTS.md rule 2 gains the fourteenth
form; the runtime's README records the words' cost (7.3x the own view's GPU time for an R8Unorm
texture buffer written on an RTX 3090, job m3-max-80580).
This commit alone was not built; the series is checked at its tip.
RESOURCE-ID.md gains the texture buffer word (TextureWord::of_texture_buffer: bits 0-1 padding,
2-7 the code, 8-9 texels per word, 10 a texel of two words; the 39 codes in order) and drops its
stale line that a texture buffer has no index. The runtime's README says which formats a texture
buffer holds as words and which it still refuses; the KosmicKrisp BGRA8Unorm gap is gone. API.md
and PrecisionNote's docs say a texture buffer held as words records SrgbTexelDecode and
DevicePackConversion for its float reads and writes, and that its other conversions are exact.
tests/resource_words.rs writes texture buffer lines (format, width, word); the table is blessed
in a later commit. REFUSALS.md regenerated (one more TextureFormat site).
A texture buffer of one of 39 colour formats with a word layout (metal::format::texel_words)
is viewed as R32_UINT over its bytes, and shaders convert each texel themselves: the translator's
words routines (lower/texture/words.rs) read, write and ask the width of such a texture buffer,
and a write of a texel of one or two bytes is an atomic AND then an atomic OR on its word, which
keep its neighbours' bits. The texture word of a texture buffer (TextureWord::of_texture_buffer)
carries the format's code, its packing and padding; a handle carries those bits, and the element
mask drops them. The runtime makes the R32_UINT view, its last word ending inside the buffer's
block, and the required-formats test names the formats Vulkan requires as storage texel buffers.
This commit alone was not built; the series is checked at its tip.
The harness makes a texture buffer over a plan buffer (plan::TextureSource::Buffer,
ComputeDevice::new_texture_buffer): texel_buffer_r8_write writes 2^24 R8Unorm texels, one a
thread, and texel_buffer_{r8,r16,rgba16,bgra8}_read read 2^24 texels, 16 a thread, each checked
against the CPU's decode. The workloads time a texture buffer's accesses, as the translation of
the formats the runtime holds as words is weighed against their own views.
Metal makes texture buffers of A8Unorm, the four 8-bit sRGB formats, RGB9E5Float, the
four packed 16-bit formats, BGR10A2Unorm and the four extended-range formats, for reading,
writing and both (M3 Max, macOS 27.0.1, jobs m3-max-79872 and m3-max-79879). The runtime
refuses each as Gap::TextureFormat on some or all devices, because Vulkan offers no
texel-buffer format for them.
The owned fixture tb_word_formats reads, writes, and reads then writes texture buffers of
five texels with eight threads. The new device test checks each format's answers against
the CPU's decode of the bytes:
- reads in bounds, exact, or within 2^-12 through the sRGB transfer;
- writes of each texel's value store its code, with neighbouring texels in one word kept;
- past the width, the zero texel is read and nothing is written, the rest of the last
word included;
- the widths are 5.
This is the red half: every format is expected to fail at Buffer::new_texture
(Gap::TextureFormat). The run that shows it is in the handover.
The player moved every written word whose value lies in a buffer noted
escaped (AddressMap::move_noted), whatever the buffer it was written into.
In rec-m3-max-80463 it moved 3 RG8 mask words of no-copy buffer #1960,
which the program reads only as texels through texture #1962 over it. Each
play wrote its own host address there, so two plays read different texels
(audit lane, m3-max-81898 and m3-max-81914).
Now the move is decided by the stream's structure:
- read_ahead, which already walks the whole stream, notes each buffer's
life, keyed by the object and its making's position (as recorded_ids
is):
- whether a texture is made over it (it receives
newTextureWithDescriptor:offset:bytesPerRow:, the tiled form or the
linear form);
- whether any call names it as an argument, at any depth of lists and
maps, but a copy between a buffer and a texture (copyFromBuffer:...
toTexture:..., copyFromTexture:...toBuffer:...), whose bytes are texels.
A buffer with a texture over it and no such naming is reached only as
texels.
- At an object's making the play marks it live as such, or unmarks the id.
- place_words takes the write's target (none for set*Bytes data). Into a
buffer reached only as texels, the words move_noted would move play as
recorded and are counted as texel_only_words (AddressMap::count_noted,
which shares move_noted's pass). The census is unchanged.
- Unchanged: a buffer with no texture over it, including one the stream
never names (the existing noted-word test), set*Bytes data, and any
buffer bound, encoded, used, copied buffer to buffer or added to a
residency set.
texel_only_words is a new stream counter: in FIXED, frame and group lines,
and the report's addresses line. Docs: REPLAY-STREAM.md section 5's
noted-word paragraph and section 10's counts and addresses line. The
counter lists the replay tests spell out gain it.
Two lavapipe plays of rec-m3-max-80463 differ (audit lane, jobs
m3-max-81898 and m3-max-81914). In frame 3 the player moves 3 words of the
stream's write into no-copy buffer #1960, at offsets 24344, 73104 and
74240. They are RG8 mask bytes whose value falls inside an escaped
buffer's recorded range, and AddressMap::move_noted rewrites them to each
play's own address. #1960 is read only as texels, through texture #1962
over it, so the texture reads other bytes in each play. A shader loads an
address only from memory its command reaches as a buffer: bound, encoded
into an argument or indirect command buffer, or made resident by
useResource:, useHeap: or a residency set. Each of those calls names the
buffer.
New test in replay/tests.rs,
a_noted_word_in_a_buffer_reached_only_through_a_texture_over_it_plays_as_recorded:
- An authored stream makes a buffer, a texture over it
(newTextureWithDescriptor:offset:bytesPerRow:), notes the buffer escaped
(kind 0) and writes into it a word inside its own range.
- Reached only through the texture, the word is to play as recorded, and
be counted as texel_only_words, not noted_words.
- The same buffer also bound by setBuffer:offset:atIndex: still moves the
word.
Expected red: today the word moves in both arms.
The engine inventory, the golden hash table and the air_input printouts, re-blessed at
3ecfe8f034 on the M3 (potluck job m3-max-82095: inventory=0, golden=0, printouts=0, and the
metallib half of committed_air_fixtures_parse_and_link un-skipped, linkhalf=0). The draw
patches and indexed draw patches work since the last bless added the icb_merged_patches and
icb_merged_ipatches fixtures and moved SEMANTICS_VERSION to 2328, so the four bless-due tests
(engine_fixtures_match_their_golden_printout, inventory_lists_every_fixture_in_order,
golden_hashes_match_the_table, llvm_as part 8) read red until this commit.
Files: golden_hashes.tsv, public_fixture_expectations_engine.tsv, and the two new printouts
air_input/icb_merged_patches.txt and air_input/icb_merged_ipatches.txt. Nothing else.
a3fb852de3 (a heap makes texture buffers in place) sizes a heap's texture buffer through the
format's texel form, which takes a format whose buffer features hold both the uniform and the
storage texel buffer. On the Iris Xe, whose ANV holds A4R4G4B4_UNORM_PACK16 so, the heap's size
and alignment of the format-footprints-plain-stragglers BGRA4Unorm texture buffer now answers
(Metal's 128 at 16), and the case reaches its makes-texture site, which the runtime's side refuses
as Refusal::TextureBufferNotOverBuffer, the consumer's contract. The ledger's one row for every
venue refused the size-and-align site, so the Iris's conformance replay went red at pin M
(m3-max-82006: an unlisted makes-texture refusal) while the RTX 3090's held (m3-max-82034).
Now:
- the size-and-align row is one per venue whose device lacks the storage texel buffer of both of
the format's Vulkan formats (NVIDIA, RADV, llvmpipe, Apple M3 Max, UHD Graphics 630), naming
a3fb852de3;
- the Iris Xe has a makes-texture row with the consumer's-contract reason the other texture
buffers' rows carry, naming a3fb852de3;
- each says Metal's validation layer refuses this format for a texture buffer, so what such a
texture reads is outside documented Metal and no value comparison is owed for it;
- the runtime's README says a texture buffer's answer, the heap's size included, follows the
format's texel-buffer features: the devices differ by query, not by form.
docs/CONFORMANCE-COVERAGE.md regenerated (scripts/conformance-coverage/coverage.py; --check
clean), as are the metal-coverage and refusal-surface checks.
On a device that keeps two copies of a Managed buffer, the runtime now takes a range named by
didModifyRange to the device copy at the first commit whose encoders name the buffer (a slot, a
declaration, an indirect, index or other draw buffer, a blit's buffer, a texture over it), not at
the next commit, and a buffer's first bytes at the next commit whatever it names. A run of an
unchanged artifact may therefore submit and record other copies under an unchanged key. None of
the validation crate's runtime inputs changed, so runtime-sources.sha256 holds. SEMANTICS_VERSION
does not move: nothing compiled changed. 2553 is taken by another row landing beside this one.
Verified: the value alone changes; the gate at this tip follows.
`conformance times --runs 8 --write` over the five cases, built --release at a2f2cad217, on the
Apple M3 Max, macOS 27.0.1 (26A434), job m3-max-81954 (the build: job m3-max-81941). Each
recording gained one time record (native Metal, 8 rounds), a recorded hole whose stopped reason
is the cases' own: the oracle keeps one copy of a Managed buffer, so its leg is forbidden. A
comparison of the JSON before and after shows `times` the one key added and every other key
equal. This is what times::every_case_is_timed::every_case_carries_its_timing asked of the new
cases (it failed in m3-max-81916 at c098a9848e). docs/CONFORMANCE-COVERAGE.md, regenerated,
does not change.
Each recording holds the case's carried answer as record mode writes a carried case's: the
transcript of the reader's content as an AMD Radeon Pro 5300M under macOS 26.7.1 read it, 8
rounds a reader (jobs 81602 and 81644), measured_on amd-radeon-pro-5300m, validated not run. The
compute slot, the declaration, the vertex slot and the blit source read the bytes as of the
reader's commit; the reach through the address alone reads the bytes the GPU's copy last took.
The oracle's own run is forbidden by the cases (one copy), so nothing here ran on Metal.
They were written by record::carried and record::write, the calls record mode makes for a
carried case, through a scratch test of a CPU-only job's own workspace (job m3-max-81916, at
c098a9848e), never committed. docs/CONFORMANCE-COVERAGE.md is regenerated with them
(scripts/conformance-coverage/coverage.py): 192 case modules, 1347 recordings, 85 carried.
Verified: in the same job the conformance suite ran 1050 tests, 1048 passed; the two failures are
the coverage document, regenerated here, and the cases' missing Metal time records, which the
oracle's times run adds next.
Clippy named the chunks_exact of a constant 4 (as_chunks reads each word as an array, with no
conversion that can fail) and the unused import of call.
Verified: clippy of the conformance crate in job m3-max-81909 (CPU-only build) failed on both;
the next job runs it again.
Clippy's drain_collect named the collect of the made entries into a vector of their own; the loop
now drains them directly, its other borrows being of the change list's other fields.
Verified: clippy of the conformance crate's dependencies in job m3-max-81865 (CPU-only build)
failed on it; the clippy job follows.
A commit takes its named ranges through Seconds::take, which answers none where its command
buffer named no buffer with a range, so nothing calls named. The release build of the player warned
of it as dead code.
Verified: the warning is in the player's release build of the frame-396 play job m3-max-81847
(lavapipe); no caller in the tree (grep of seconds' calls). The clippy job follows.
The reader's own helper took the name of the side's kernel stage helper, a duplicate definition
on RtSide. It is now compute_state, built on that helper, and the render reader takes its two
stages through it as well.
Verified: the recording job m3-max-81836 (a CPU-only build, at the commit before the rebase)
failed to compile the conformance crate on the duplicate; the next job compiles it.
Watching forwards every Side method, so a watched run of the managed-named cases answers what the
side it wraps answers rather than Unavailable. The suite's test that compares Side's methods with
Watching's forwards names the missing one without it.
Verified: expected from the forwarding test's name sets. The conformance suite run follows.
The test every_device_places_a_managed_buffer_s_device_copy_where_the_consumer_says named the
whole buffer, then read the block through a commit that kept only another buffer over the
Private block. Under the rule that a named range is taken at the first commit whose encoders
name the buffer, that commit takes nothing, so the two-copy form read the old bytes. The read's
commit now names the Managed buffer as well.
Verified: lavapipe rt suite job m3-max-81780 at f864a75d35 failed this test alone (958 of 959
passed, 4 skipped) at the copy-in assertion; the rerun follows.
Five cases, one a reader, each of the same sequence: a Managed buffer's red
contents written, named and taken by a blit; green written and named, then a
commit of a blit that fills another buffer; the reader encoded, blue written
with no second name, the reader's command buffer committed. The site holds
which of the three the reader read. Readers: a compute slot
(scale_and_offset), useResource: (ab_address), the address alone (ab_address,
no declaration), a vertex slot with a draw (colored_vertex), a blit copy's
source.
Metal's answer is carried from an AMD Radeon Pro 5300M table under macOS
26.7.1, 8 rounds a reader (jobs 81602 and 81644): the readers that name the
buffer read the bytes as of their commit (blue), the address-only reader the
bytes the GPU copy last took (red). The oracle keeps one copy, so record mode
may not replace the table (carried_only), and the case names the chip
(recording::AMD_RADEON_PRO_5300M; the known-families list in
a_carried_answer_taken_on_another_chip_names_it grows by managed-named-).
The runtime's side runs the sequence in the form the device's memory-type
query picks. On a device that keeps one copy the address-only row answers the
venue's gap (a device copy of each Managed buffer), as that row asks what a
second copy holds; the other rows read the bytes as of their commit in either
form, as the 5300M and the one-copy UHD Graphics 630 (jobs 81603, 81645) did.
Recordings follow from a record job on the oracle. Not yet compiled.