What: tests::floor's a_device_with_no_cached_coherent_type_opens_where_the_floor_chooses_its_types
and tests::coherence's view test (renamed from every_gpu_read_as_the_refused_device_... to
every_device_opened_under_the_view_flushes_and_invalidates_the_shared_memory_work_reaches) share
one helper beside open_each_device, tests::command::on_device::each_device_under_the_view. For each
device of the cfg's kind it reads the buffer bits from a device made with no view, takes the
floor's choice (floor::choose) over the viewed memory properties, and makes the device through the
view: where the choice refuses, the make must refuse with exactly BelowFloor { missing } from that
choice, and one line names the device and the refusal; where it chooses, the device must open with
the chosen types and the test's body runs on it, settled and with its gauges checked at drop as
open_each_device does (its per-device steps are now run_settled, which both use). The floor test's
`if cfg!(m2v_cpu_icd)` guard is gone, and the coherence test's #[cfg(m2v_gpu)] with it: both run
under every device cfg. The doc comments state the structure: a device whose one host-visible,
host-cached buffer type also holds the parameter ring is refused under the view, with its refusal.
Why: round efd7dbcd4d-1125-1433, leg mac:rt (job m3-max-74110), KosmicKrisp 26.3.1 on the M3: both
tests failed with "below the runtime's floor: it lacks a memory type with DEVICE_LOCAL |
HOST_VISIBLE | HOST_COHERENT for buffers (the device offers buffers: type 0 with DEVICE_LOCAL |
HOST_VISIBLE | HOST_CACHED)". That device's one buffer type also holds the parameter ring, as
lavapipe's does, so the view leaves no ring type and the floor refuses it, as it should. The floor
test took the refusal arm by the device's kind; the coherence test had none.
Test-only; the runtime's behaviour is unchanged. docs/VALIDATION.md's m2v_shared_view note checked:
nothing in it is false, unchanged.
Verified: cargo fmt only; the quick check, the KosmicKrisp rt leg on the M3 and the Iris view leg
follow.
What: the known gap for a draw that reads its own target over a buffer in place keeps what is true
now (refused on every device as AttachmentRead; no play of the replay streams met it) and drops the
sentence naming the forms ruled for it should a stream meet it.
Why: a README says what is true now. That sentence's second form, unified image layouts with a
LINEAR feedback image, needs a unifiedImageLayouts query, which would be a twelfth form under
AGENTS.md rule 2 and is the owner's word alone. The forms stay on file in the planner's plan,
outside the tree.
Verified: docs only; no other file quotes the sentence (grep over *.md, *.rs, *.py, *.tsv).
The whole-workspace docs check runs with development's checks at this tip.
What: no change. This notes the evidence for 358a78fcf3..ca3d489bcd, whose own message ends
"Verified so far" before the gates read. Published history is never amended.
Verified:
- The new test reads heap_moves as (at the host write, at the later GPU write) for three later
writes: generateMipmaps, a blit into another region, a pass that loads the texture.
- Base 358a78fcf3, lavapipe, job m3-max-74235: (0, 1) in all three, red.
- Tip ca3d489bcd, lavapipe, job m3-max-74248: (1, 0) in all three, green; 18 of 18 alias,
heap_alias and heap tests passed.
- The runtime's device suite at ca3d489bcd, from one m2v_gpu archive (m3-max-74252):
XTX (RADV) m3-max-74254, Iris Xe (ANV) m3-max-74255, RTX 3090 (NVIDIA 620.70.06) m3-max-74256;
751 of 751 passed on each, the new test (1, 0) in all three rounds, the region kept.
- Quick check m3-max-74249: signatures, clippy plain and under each device cfg, rustdoc, lavapipe's
rt suite 748 of 748, the conformance replay with 0 ledger drift lines. Suites check m3-max-74251:
product 3641 of 3641, golden matches, validation 1307 of 1307, conformance 1040 of 1040, doctests.
- No budget job: no harness row times uploads.
The texel loss itself was seen on no device. The base ran only on lavapipe, where the host-written
region read back intact after the move from undefined. The real cards ran only at the tip. The
heap_moves count, its place and its value, carries the proof.
What: Texture::replace_region into a heap texture that takes part in
crate::alias settles the alias state in the upload's own command buffer,
under the work lock, ahead of its copy (alias::host_write). A stale
texture moves from undefined in alias::record's barrier, after every
earlier command's writes, counted in heap_moves and barriers. Its
staleness clears and its texture links turn stale. That state change is
Placement::written, which alias::stage now shares: one write path. A
texture in no heap, or one that takes no part, pays one test and records
nothing. A linked texture that is not stale records no command. No state
is added beyond what the alias module holds.
Why: a host write marked nothing, so a texture that a write over its bytes
had left stale stayed stale through it. Its next GPU write (its mipmaps, a
blit into another region, a pass that loads it, a draw's or a dispatch's
write) then moved its whole image from undefined, and the texels the host
wrote were lost, where Metal keeps them. upload_region reaches no heap
texture (it has no named bytes; the test asserts the refusal), and no
other work.upload caller writes one.
Ordering, by reading submit.rs: three things hold the work lock: the
call's settle, a segment's staging (alias::stage in WorkState::step,
where its checks read the staleness and its writes store it), and the
close of the submission that takes the upload (take_uploads). The upload
is numbered N, the next commit. It runs ahead of every segment of the
first submission whose last leading command buffer has seq >= N, or of
the next submission after a flush.
1. X committed after the call (seq >= N): staged after the settle, and
run after the upload. Its checks see the host write. Right.
2. X committed before the call and submitted before it, which includes
every X the program waited for: staged before the settle, and run
before the upload. The settle sees its stores. Right.
3. X committed before the call, not submitted when the call is made, and
writing T or a resource over T's bytes:
(a) staged before the settle, in a held group that a later commit
joins or a flush sends: the upload runs ahead of X, X overwrites
the host's texels, and T's next write misses its move;
(b) staged after the settle, and submitted alone before the upload's
submission: X runs first. The settle missed X's store, so where T
was fresh its copy goes in with no move after X's write. X's store
lands after the clear, so T's next write moves T;
(c) staged after the settle, in the upload's submission or a later
one: the upload runs ahead of X, X overwrites the texels, and T's
next write moves it.
In 3a to 3c, X has not completed at the call. Apple's page for
replace(region:mipmapLevel:slice:withBytes:bytesPerRow:bytesPerImage:),
as fetched on 11-25 and relayed by main: "This method runs on the CPU
and immediately copies the pixel data into the texture. It doesn't
synchronize against any GPU memory operations to the texture. Ensure all
operations that write or render to the texture complete before reading
the texture's contents..." So order 3 is the program's race on a Mac too,
and owner rule 1 does not emulate it. The docs state it as the program's
race and say what the runtime does then. The other side, ordering the
upload after earlier commits, was ruled out: it changes the order of
every upload, or adds a second form for heap ones, and blocks the host on
queue room. When a Mac reuses a heap's bytes is unaudited.
Docs: the alias module's "A use that writes" paragraph,
Metrics::heap_moves, replace_region's doc, and the runtime README's heap
paragraph. No refusal or public item changed.
Verified so far: the new test fails at the base on lavapipe (job
m3-max-74235, msi-laptop, llvmpipe): heap_moves (host write, GPU write)
= (0, 1) for mipmaps, blit and load, against (1, 0) wanted. The tip's
lavapipe run, the gates and the device suites are reported to main as
they read.
A heap texture that a write of a buffer over its bytes left stale stays
stale through a replace_region: the host write marks nothing in
crate::alias, so its next GPU write moves its whole image from undefined
and the texels the host wrote are lost, where Metal keeps them.
The test places T (64 x 64 RGBA8Unorm, two levels) and then B, a heap
buffer over its bytes. Each round fills B by a blit, writes a 16 x 16
region of T's first level by replace_region, then writes T on the GPU
elsewhere: its mipmaps, a blit from a buffer into another region of its
first level, and a pass that loads its first level. It asserts heap_moves
+1 at the host write and +0 at the GPU write, and reads back only the
region the host wrote. It also asserts that upload_region refuses a heap
texture (no named bytes), so replace_region is the one host write that
reaches one.
Expected to fail at the base: heap_moves +0 at the host write, +1 at the
GPU write. Verified by the lavapipe run reported with the fix.
What: corpus/authored-compile.tsv gains case 884ad7d75a22's row (the AIR 1.8 sampling case of
f4f6fd32cf), compiled on all 9 profiles. No other row and no artifacts_at line moves: the
translator's inputs at efd7dbcd4d equal db3a88526b's.
Why: the pin at efd7dbcd4d records the census at its tip.
Verified: census job m3-max-74099 on the M3 at efd7dbcd4d: 2348 cases over 9 profiles, 21132
cells, the 9 new cells compiled, 0 failed, 1 difference (the new case), 0 regressions.
What: crates/metal2vulkan/tests/golden_hashes.tsv gains the rows of engine/air_1_8_sampling.air.ll
and engine/air_1_8_sampling.ll (function a18_sample_fs), the fixture the authored AIR 1.8 case
added (85a39d3ab1..f4f6fd32cf). No existing cell moves.
Why: the pin at efd7dbcd4d gets its bless at that tip. Development's suites read "bless due (stale
cells only, keys changed)" for these rows from f4f6fd32cf on (m3-max-74029, 74090, 74102).
Verified: bless job m3-max-74098 on the M3 at efd7dbcd4d. The inventory, golden and printout
blesses exit 0, and the patch is these two added rows (2850 bytes).
Device::new's hook for `--cfg m2v_shared_view` (device.rs) was gated on
`cfg(all(test, m2v_shared_view))`, but the `DeviceOptions::memory` field it sets and
`tests::cached_types_incoherent` exist only under a device cfg (`m2v_gpu` or `m2v_cpu_icd`).
`cargo test --cfg m2v_shared_view` with no device cfg therefore failed to compile, while
docs/VALIDATION.md says the cfg means nothing alone. The hook is now gated on
`cfg(all(test, m2v_shared_view, any(m2v_gpu, m2v_cpu_icd)))`. The `cfg!(m2v_shared_view)` reads
in tests/coherence.rs sit in its device-cfg'd `on_device` module and need nothing.
Verified: cargo fmt; a CPU job builds the runtime's tests under `--cfg m2v_shared_view` alone,
and clippy runs under `--cfg m2v_gpu --cfg m2v_shared_view` (the job named with this sha).
The owner chose this form, Telegram 2963, verbatim: "Correction, a-narrow sorry". That answers
the planner's question whose A-narrow option named the eleventh form; it replaces 2961. This
commit lands with the form's code (the commits before it), so development never holds the form
without its rule.
AGENTS.md, rule 2 only: "for ten only" becomes "for eleven only", the list's final "and" moves
before the new entry, and the entry names the query (the host-coherent flag of the memory type
Shared takes), the second form (on the cached type without coherence, what is flushed before
the GPU reads it and what is flushed then invalidated before the host reads it), and its known
gap (no device the tests run on shows a missed range; the flush's cost grows with the Shared
bytes a submission reaches). The planner accepted the wording with two changes, both applied.
Nothing else in AGENTS.md changes.
crates/metal2vulkan-runtime/README.md, the known gaps of memory blocks: a submission's flush
names every Shared range its command buffers reach, written or not, merged, so its cost grows
with the Shared bytes a submission reaches, not with what its commands wrote.
The cost on devices whose Shared type is host-coherent, as measured at 890f6580ac against
development 8f74582eb3, three alternated passes, each job alone on its node: 74045, Radeon RX
7900 XTX: every row passes, +43.1 user-space instructions per command buffer on burst_2000;
74046, Radeon 780M: burst_2000 1.0062 (+152.1 per command buffer) and frame_5cb 1.0115, a loss
by the planner's reading rule; +2 instructions per draw, 0 per dispatch, on both. The form
lands on the owner's word with those figures before him.
Checks: cargo fmt. The prose matches the code (coherence.rs, submit.rs, texture.rs, fill.rs,
command.rs, complete.rs, event.rs). docs/REFUSALS.md and error/basis.rs are unchanged under
refusal_surface.py. The quick and suites checks run at the rebased tip.
The planner's form A after the XTX budget job 74002 read burst_2000 as a loss (+139 user-space
instructions a command buffer at 3363435164). A device whose Shared type is host-coherent now
moves 8 bytes of coherence state with each command buffer and each batch instead of 40 and 48,
and three further items are development's own code again.
What a coherent device's command buffer did that development's does not, before this commit
(at 3363435164), with its cost and what this commit does:
- command.rs:300 `Gpu::coherence: Option<coherence::Recorded>`, 40 bytes (atom 8, the Writes
Vec 24, reach 8), inside `Building` too. With one compute encoder a command buffer moves it
by value about 14 times: into its Arc at the make (command.rs:413), open_encoder's take into
the encoder (command.rs:470, encoder.rs:476), the encoder's take at its end (encoder.rs:1053),
close_encoder (command.rs:484), the commit's take (command.rs:690), `Pending { gpu }`
(command.rs:719), `Work::commit` into its entry (submit.rs:1604), `group.finished`
(submit.rs:1999), the completion's `Retiree { Item::Command { gpu } }` (complete.rs:340) and
its pop, and `retire(gpu)` (command.rs:1782). That is about 2-4 instructions a move for 40 more
bytes. NOW `Option<Box<Recorded>>` (command.rs:301), one pointer, `None`; the box is made at
the make on a device that is not coherent (command.rs:410, `Coherence::recording`). It is made
at the make, not at the first write: a lazy box would need each recording site to read the
device's coherence through its core, or an atom kept outside the box, and the commit still
finds a reach from kept buffers with no write.
- submit.rs:546 `Batch::flushes: Option<Flushes>`, 48 bytes (two Vecs), moved with each batch.
NOW `Option<Box<Flushes>>` (submit.rs:548), one pointer, `None`, boxed at the batch's first
reach or copy-in (submit.rs:1924, 2068).
- counters.rs:661 the five coherence counters sat after `submit_infos`, moving every later
counter 40 bytes from its place in development, including the submit thread's
`submit_call_nanos` and the lock-wait counters (a layout change, no instruction). NOW they
follow every other counter (counters.rs:892), so every development counter keeps its offset.
- encoder.rs:1223 and render_encoder.rs:2466, the dispatch's and the draw's facts: two tests
(the encoder's recording, then its coherence) where development tested nothing. NOW
development's `facts.host` is tested first (encoder.rs:1225, render_encoder.rs:2468), so a
kernel or draw that writes no memory the host reads takes that one test.
- command.rs:1806 the retire: one test of the `None`, then its drop glue at the destructure, a
second test. NOW the field moves out once (command.rs:1813) and the one `if let` takes it, so
a `None` is tested once; `Gpu::is_empty`'s body is `nothing_for_the_gpu` over the segments, so
the retire reads them past that move.
Left on a coherent device, each development's code behind one test of a `None` pointer: the
make (command.rs:410), the commit (command.rs:671), each command site (blit.rs:250, 495, 623,
745, 902, 1118; render_encoder.rs:901, 1618, 2041; encoder.rs:880; and the facts sites above),
the segment join (submit.rs:1923), each copy-in (submit.rs:2067), the submission
(submit.rs:2713), the retire (command.rs:1813) and each completion wake with listeners
(complete.rs:766); about 2-3 instructions each. The 8-byte pointer in `Gpu` (and so in
`Building`) and in `Batch` moves with them. Not per command buffer: each event's `settled`
field and a staged span's memory and size.
On a device that is not coherent the calls and ranges are as before; each command buffer
allocates its box at its make, and each batch at its first reach or copy-in.
Verified: cargo fmt. Not built when committed; the build job and the device and budget jobs
that follow name it.
On a device whose Shared type is host-coherent, the per-command-buffer path is development's
own code behind one test of an Option; nothing is built for the absent state.
Built per command buffer before, on a coherent device:
- an empty `coherence::Writes` and an `Option<Arc<Ranges>>` of `None` in its `Gpu`, built at its
creation, carried to its retirement and dropped there;
- at every command that names a Shared write (each blit, render pass attachments, a render
encoder's Shared buffer store, a dispatch's or a draw's facts, `use_resource`), a read of the
device's `nonCoherentAtomSize` through the device's core; in both `use_resource`s a range
slot in the declaration's tuple, filled through `Option::and_then`, and a call that tested it
and returned;
- in each submission group and empty batch, two empty lists (the ranges of the command buffers
reached and those of the copy-ins), destructured at submission, the first dropped there;
- on the completion thread, a tuple of two tests at each wake that fires listeners;
- in a shared event's `signaledValue` and wait, development's code restructured: the lock
taken and dropped before the counter's read, and a call that tested the device's Option.
Left on a coherent device:
- the `Gpu` holds one `Option<coherence::Recorded>`, `None`, from one test of the device's
coherence at the command buffer's creation; each command site tests it once
(`Building::coherence`, a field of the recording), each `use_resource` keeps development's
tuple and tests it once after the access;
- the commit, each segment that joins a group and the retirement test it once; a batch holds
one `Option<Flushes>`, `None`, tested once at submission; each copy-in tests the device's
coherence once;
- the completion thread tests the device's coherence once per wake that fires listeners;
- `signaledValue` and the wait are development's code behind one test of the device's
coherence (`let`-`else`, `match`); each event keeps an 8-byte `settled` field, 0 and never
read;
- not per command buffer: a staged copy's span carries its allocation's memory and size, and
`replace_region`, `upload_region` and `get_bytes` test the device's coherence once each; the
zero source's make takes one flag.
A device whose type is not host-coherent records into `coherence::Recorded` what the two
fields held, and a batch builds its `Flushes` only where one of its command buffers or copy-ins
reaches Shared memory; the calls and their ranges are as before.
Test: the device test of each device's coherence state now asserts that a new command buffer
holds the state exactly where its device does.
Verified: cargo fmt. Not built when committed: no build runs on this host; the build job and
the device jobs that follow name it.
What: VALIDATION.md's m2v_shared_view entry gains the planner's sentence: under the view a card
whose host-pointer and dma-buf queries offer only its cached types refuses every import; run it
with the import families filtered.
Why: on the RX 7900 XTX (RADV) the host-pointer query offers type 5 alone (0x20) and the dma-buf
query types 5 and 10 (0x420); the view leaves neither coherent, so import.rs's rules refuse
every import there: 17 tests of the view's suite failed on that alone (job m3-max-73943). The
planner's ruling keeps the view and import.rs unchanged and filters those tests in the leg's
command line.
Verified: docs only.
What: tests::floor's a_device_with_no_cached_coherent_type_opens_where_the_floor_chooses_its_types
takes the floor's refusal under the view only under m2v_cpu_icd (a match guard), so a GPU refused
under the view falls to the arm that fails with its refusal; the assert!(cfg!(m2v_cpu_icd)) is
gone.
Why: clippy job m3-max-73942 (--cfg m2v_gpu --cfg m2v_shared_view, e1907acf0f) failed with
clippy::assertions_on_constants, "this assertion has a constant value", and it holds under every
device cfg.
Verified: not yet run (cargo fmt only); clippy in the device cfgs follows.
What: a test-only cfg, m2v_shared_view, declared in metal2vulkan-runtime's check-cfg list beside
m2v_gpu_hazards and added to docs/VALIDATION.md's cfg table. Under it, Device::open gives every
device the tests make with no memory view of its own the refused device's view through the
landed seam: options.memory.or(Some(crate::tests::cached_types_incoherent)), which takes
HOST_COHERENT from every host-visible, host-coherent, host-cached type. A test that sets its own
view keeps it. The existing device suite then runs, unchanged, with Shared in a cached type that
reads not coherent, so it runs Shared memory's flushes and invalidates on memory that is coherent
in fact, which Vulkan allows. tests::coherence's every-device test asserts, under the cfg, that
every device builds the coherence state, and prints the Shared type and the calls.
Why: the planner's condition for A-narrow's proof on lab cards, which have no cached type that is
not coherent: a test that sets the option, no second suite, no env var.
Verified: not yet run (cargo fmt only).
What: tests::floor's seam test becomes
a_device_with_no_cached_coherent_type_opens_where_the_floor_chooses_its_types. Through the
refused device's view (crate::tests::cached_types_incoherent) every device answers at its make as
floor::choose over the view does. Every GPU opens: Shared takes the first cached type, which the
view left not coherent, and the device holds the coherence state. A device the choice refuses is
refused with that refusal: lavapipe, whose one memory type holds the parameter ring too and is left
with no coherent type. A GPU refused under the view fails the test.
Why: with Shared's floor item host-visible and host-cached, the user's shape (no type both cached
and coherent) no longer refuses a GPU; this test is that fix seen on our cards.
Verified: not yet run (cargo fmt only).
What: Device::new reads the HOST_COHERENT flag of the memory type floor::choose took for Shared
once, at the make (Coherence::of). Core::coherence is now an Option<Coherence>, built only where
that type lacks the flag. A device whose Shared type is coherent keeps no ranges and makes no
flush or invalidate: every site of the flush form asks the Option first (Building::atom now
answers Option<u64>), so a commit finds no Ranges, a retirement, a submission, a shared event's
signal seen, replace_region, upload_region, get_bytes and the zero source's make each make no
call, and the encoders name no write. flush and settle are now methods of Coherence, so only a
device that holds one can make them. The type rule stays sharedflush's: the first host-visible,
host-cached type, a coherent one first. Where the type is not coherent the form is unchanged.
The flush and invalidate on a coherent type are legal (vkspec 1.4.366, "Host Access to Device
Memory Objects"): "If the memory object was created with the VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
set, vkFlushMappedMemoryRanges and vkInvalidateMappedMemoryRanges are unnecessary and may have a
performance cost." The VkMappedMemoryRange VUIDs name no type flag: memory-00684, size-00685,
size-00686, offset-00687, size-01389 and size-01390 (offset and size at multiples of
nonCoherentAtomSize or the allocation's end, inside the mapped range). So the device suite can
run the form on memory that is coherent in fact, through the test-only memory view.
tests::coherence: every device holds a coherence state exactly where its Shared type is not
coherent, and its work's calls follow (zero calls where it holds none); every GPU read through
the refused device's view (crate::tests::cached_types_incoherent) holds it and makes sharedflush's
counted calls. README, the Metrics docs, floor::SHARED_MEMORY and MemoryClass::Shared say the
calls happen only where the type is not coherent; the known gaps say no lab device can show a
missed flush, only a device whose Shared type is cached and not coherent can.
Why: sharedflush's form, with its calls on every device, cost 1.038 to 1.047 of the runtime's
instructions on four harness rows on the 780M (m3-max-73790). This is A-narrow, offered to the
owner beside B: an eleventh form, so it does not land without his word.
Verified: not yet run (cargo fmt only).
What: blit.rs names crate::coherence::Range by its path and drops the import, since the module
already imports std::ops::Range.
Why: build job m3-max-73781 (8178f7796a) failed with E0252, the name Range defined twice.
Verified: not yet run (cargo fmt only).
What:
- BufferObject::shared_range (and shared_span) answers None for a Managed buffer with a device
copy. Its commands reach the copy, so neither a command buffer's reach at submission nor its
writes at completion name the block of the buffer's bytes. Two calls touch that block: a
copy-in (did_modify_range), whose submission flushes the bytes it reads
(CopyIn::shared_ranges), and a synchronize (read_back), which now names the block's bytes
itself (Range::of_block of the held block) as a write, so its command buffer's completion
flushes and invalidates them. Each of the two flushes or invalidates its own bytes there,
which is why the GPU reach can leave the block out.
- Writes holds a Vec, not a HashSet: no hashing, and no RandomState per command buffer. A range
named again right after itself is held once, and the ranges are merged in place each time
their count reaches a power of two from 64.
- merge() sorts and merges in place (Vec::dedup_by) in place of merged()'s second Vec.
- flush and settle build their VkMappedMemoryRange array on the stack for up to 8 ranges.
settle builds it once for both calls and sums the bytes once.
- A submission of one command buffer and no copy-in flushes that command buffer's ranges,
already merged at its commit, with no new Vec.
- README and module doc: the submission's reach leaves out a Managed buffer with a device copy.
Why: job m3-max-73772 (RX 7900 XTX, c030b1b4bd against 4fb7684a62, three alternated passes)
put the runtime's own instructions per timed run 4.7 to 6.7% over the before arm on the frame
and burst rows, about 1,300 to 1,600 instructions a command buffer, past the 1.03x gate. Job
m3-max-73773 (Iris Xe) put them about 1,650 to 1,700 a command buffer over. Most of that was
heap allocation and hashing per command buffer, and on a discrete GPU a Managed buffer's host
block counted as reached. Same form: every call is still made on every device, with no branch
on the type's flags.
Verified: not yet run (cargo fmt only). The alternated job is re-run on the 780M first, then
the XTX.
What: tests::coherence makes its 4x4 texture with Device::new_texture_for_views, which takes no
index, in place of new_texture with no index.
Why: on lavapipe (job m3-max-73732, ef7f03df3f) new_texture refused a texture that shaders read
with no index (Refusal::TextureIndex), before the test reached its copies. The other assertions
of the test ran no further, so they are still unverified.
Verified: not yet run (cargo fmt only).
What: Coherence::signal_seen now settles the written ranges of the command buffers in flight
while it holds the flight list's lock. A retiring command buffer calls Coherence::retired, which
takes the same lock and drops its entry, after its own settle and before it lets go of its blocks
or lowers the pool's in-flight count.
Why: signal_seen took strong references to the ranges, released the lock, then flushed and
invalidated. A command buffer that retired in that window gave its blocks back, so a call could
name memory the command buffer no longer held: an allocation the block-maker may free, or a
range another take now owns.
Verified: not yet run (cargo fmt only).
What: shared_storage_takes_a_cached_type_a_coherent_one_first's last case, a buffer that cannot
use the coherent cached type, gave choose() no device-local, host-visible, host-coherent type, so
choose() refused it for the missing ring type rather than answering the Shared index. The list now
has one (type 3), and the buffer's usable bits take types 0, 1 and 3.
Why: job m3-max-73726 (9589aa5b0c, lavapipe) failed the test with
Err([MemoryType { flags: DL | HV | HC, .. }]) against Ok(1).
Verified: not yet run (cargo fmt only); the next quick check runs it.
What: the README's memory section gets "Shared memory's coherence": where each flush and
invalidate falls, what a command buffer may write, the atom widening, the counters, and the
consumer's contract (a range reached only through an address with no declaration is neither
flushed nor invalidated where the Shared type is not host-coherent; the consumer's own host
accesses are its own). The known gaps of memory blocks name three things on such a device: the
calls' time as its cost (unmeasured, since no lab device has such a type), a host write racing
the GPU's in an atom it writes (quoting Vulkan's invalidate-without-flush sentence and the
nonCoherentAtomSize definition), and a buffer reached only through a residency set. The floor's
memory table row for Shared becomes HOST_VISIBLE and HOST_CACHED, with a coherent type first.
Texture::upload_region now flushes the named bytes it copies, from the region's first byte to
the end of its last at the place's pitches (Transfer::extent, BufferObject::shared_span). The
first commit missed this GPU read of host-written Shared memory: it is part of no command buffer
and is not a copy-in.
New device test tests/coherence.rs, under the device cfgs. The zero source is flushed at its
make. A fill into a Shared buffer counts [2 flushes, 2 x atoms, 1 invalidate, atoms, 0
failures], and its bytes read back. A fill into a Private buffer makes no call. replace_region
flushes once and get_bytes flushes and invalidates once, and the texels round-trip.
The api_signatures table gets the five new Metrics fields (signatures.py --bless).
docs/REFUSALS.md regenerated with no change: the floor's Missing text holds no flag names.
Verified: not yet run (cargo fmt only). The quick check and device legs follow.
What: the floor's Shared item becomes host-visible and host-cached; Shared storage takes the
first such type a buffer can use, a host-coherent one first (floor::choose). A new module,
coherence, makes the flushes and invalidates Vulkan asks of a type without
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, on every device, never reading the type's flags:
- before each submission, a flush over the Shared memory its command buffers keep (buffers,
textures over buffers, heap blocks) and the ranges its Managed copy-ins read;
- before the host can see GPU progress, a flush then an invalidate over what a command buffer
may write: as it retires (before its status, waits and completed handlers), and over every
command buffer in flight before a shared event's GPU-raised value reaches a listener,
signaledValue or a wait. What it may write: blit destinations, written bindings of the
function's interface, use_resource with a write, render attachments, the visibility buffer,
synchronize targets, every used heap's Shared block, textures over Shared buffers in images
of their own;
- the runtime's own accesses: replace_region's staging span flushed after the rows are
written, get_bytes's span settled before it is read, the zero source flushed at its make.
Ranges are widened to nonCoherentAtomSize inside the whole-mapped pool blocks. Imports are
unchanged (their type is host-coherent; Vulkan maps none of them). Exported blocks and surfaces
take the Private type and have no host mapping (export.rs, surface.rs), so they are never
flushed. Metrics gains shared_flushes, shared_flushed_bytes, shared_invalidates,
shared_invalidated_bytes and shared_coherence_failures.
Why: a Meteor Lake device on Mesa's Intel driver with the i915 kernel driver lists
[DL|HV|HC, DL|HV|HCached] and has no host-visible, host-coherent, host-cached type, so the
floor refused it at device creation. The lab's lists all have an HV|HC|HCached type, which
choose() still takes first: their index is unchanged.
Verified: not yet run (cargo fmt only). Still to come in later commits: README, the generated
refusal surface and signatures table, a device test of the counters, and the device legs. The
flush's effect on that device is unaudited until the user boots it.
corpus-vulkan (job m3-max-73981, venue intel-irisxe-rplp-anv: Intel Iris Xe Graphics (RPL-P),
Mesa 26.2.6) runs case 884ad7d75a22 through the runtime under the validation layer: Match, the
candidate's output 7d65bff73d82 equal to Metal's bytes on the M3 under macOS 27.0.1.
scripts/qualify-public-cases runs case 884ad7d75a22 against its committed Metal row. Run by hand
under the same operator environment (ci-lavapipe, job m3-max-73980 on lavapipe 23.1.1): Match,
candidate output 7d65bff73d82, Metal's bytes.
corpus-metal (job m3-max-73969, Apple M3 Max, macOS 27.0.1 26A434) qualifies case 884ad7d75a22:
its three executions agree, and the 4x4 target holds (x + 1, y + 1, 4y + x, 0.5) at every pixel,
the value the case's rationale derives (checked against the recorded bytes).
The authored case over engine/air_1_8_sampling (case 884ad7d75a22, installed by
corpus-case-check --manifest --install in job m3-max-73936): a 4x4 rgba32_float target whose
pixels take their position over 4 as the coordinate, a texel center of the 4x4 rgba32_float
texture, so the nearest plain sample and the gradient sample (derivatives exactly 0.25, level 0)
read one texel, and the output (a + b) * (0.5, 0.5, 0.5, 0.25) is exact on every device. It runs
the AIR 1.8 forms an old library declares (the sample without a minimum level-of-detail clamp or
access operand, the buffer with a size and no address space, the render target with the
attachment alone) on Metal and on Vulkan.
Not yet qualified at this commit: the Metal run and the Vulkan candidate follow.
Blessed with bless_engine_inventory (job m3-max-73940 on the M3, which has every assembler): the
fixture's one entry, a18_sample_fs, compiles (ok) on all 15 profiles from both its typed .air.ll
and its .ll; no other row moved.
The .ll (llvm-dis 21.1.8 of the AIR) and the typed .air.ll that xcrun metal wrote for the
fixture's source (Apple metal 32023.922, macOS SDK 27.2), and its TOOLCHAIN line. Generated by
job m3-max-73924 on the M3. The module is AIR 1.8 (triple air64_v18-apple-macosx10.11.0) and
declares air.sample_texture_2d.v4f32 with 7 parameters and air.sample_texture_2d_grad.v4f32 with
7, its buffer with air.buffer_size and no air.address_space, and air.render_target with the
attachment alone.
The owned MSL source of an AIR 1.8 fixture whose fragment samples through an argument sampler,
plainly and with a gradient, reads a constant buffer and writes one render target: the forms an
AIR 1.8 library declares before AIR 2.0 (the sample without a minimum level-of-detail clamp or
access operand, the buffer with a size and no address space, the render target with the
attachment alone). Its companions follow from scripts/regen-air-fixtures on the M3.
What: corpus/authored-compile.tsv's artifacts_at line names the product at db3a88526b
(e81e0423...). No case's row moves.
Why: the pin at db3a88526b records the census at its tip. legacybc's reader (c5cedb39b3) changes
what the AIR front end accepts, and stencilclass (db3a88526b) changes validation's candidate
executor.
Verified: census job m3-max-73999 on the M3 at db3a88526b: 2347 cases over 9 profiles, 21123 cells,
19539 compiles, 18829 compiled, 2294 refused, 0 failed, 0 differences, 0 regressions.
What: crates/metal2vulkan/tests/golden_hashes.tsv's semantics line goes from 2303 to 2304, the
SEMANTICS_VERSION that legacybc's reader commit set (b6b940fd5f). Every golden hash cell is equal.
Why: the pin at db3a88526b gets its bless at that tip, so the golden test's class check reads the
SEMANTICS value of the last pin.
Verified: bless job m3-max-74000 on the M3 at db3a88526b. The inventory, golden and printout blesses
exit 0, and the bless patch is this one line (678 bytes).
The runtime's BitDraws rule refuses a draw through a [[stencil]] output drawn by bits in two
places: a face whose compare is other than Always and Never (DrawDepthStencil::
stencil_reference_face reads it), and, where the state replaces a stencil bit, a draw inside a
Counting visibility result's segment. The second needs a visibility result mode, and the case
schema has no way to state one:
- crates/metal2vulkan-validation/src/case.rs:19-21, AuthoredCase: #[serde(deny_unknown_fields)],
and none of its fields is a visibility result mode, offset or buffer;
- src/case.rs:1819-1821, Draw (primitive, vertex_start, vertex_count, instance_count,
index_buffer, base_vertex, base_instance): deny_unknown_fields, no visibility field;
- src/case.rs:1388-1390, DepthStencilResource, and src/case.rs:1406-1408,
DepthStencilStateLiteral: deny_unknown_fields, no visibility field;
- neither executor sets a mode or gives its pass a visibility result buffer: no "visibility" in
src/metal/ or src/candidate/ (grep -rni visibility), and runtime_render.rs's Targets::pass
(line 661) builds the pass from its attachments, array length and default size alone.
A manifest naming such a field is refused at parse, so no case's draw is in a segment and the
classifier carries no clause for it. When the schema grows a visibility result mode, the clause
belongs beside the compare rule, with its own classification test. The doc comment of
stencil_reference_face and docs/VALIDATION.md now say this instead of "a case sets no mode".
Verified at this commit: cargo fmt; doc comment and docs only, no code changed.
Fix-forward of 522914946b, whose build failed (job m3-max-73916, E0597): the array of face
references was a temporary of the method's tail expression, which outlives the local Vulkan state
it borrowed under edition 2021's drop order. The faces are Copy, so the array holds them by value;
the rule is unchanged.
Verified at this commit: cargo fmt only; the next build job compiles it.
What: the engine's render route through the runtime now reads, from the case's own structure, the
draws the runtime refuses on a device without VK_EXT_shader_stencil_export, and records them as the
device's refusal (NotSupported::NotEnabled, not_supported{not_enabled}, class device) naming the
extension, the face and its compare function, instead of drawing them and failing on the runtime's
Gap::Draw { kind: StencilOutput }.
- RenderCase::stencil_output: the case's own fragment function writes a live [[stencil]] output,
read from its AIR outputs' roles (executor_contract::depth_stencil_test), false for a vertex case.
- DrawDepthStencil::stencil_reference_face (executor_contract/depth_stencil.rs): the first face
whose stencil test the output decides. It is the runtime's rule, depth_stencil::BitDraws::of, on
the same Vulkan state (metal::state::depth_stencil_state of the same descriptor): None where the
stencil test is off; otherwise a face whose compare op is other than ALWAYS and NEVER, whatever
its operations and masks (BitDraws::of returns None before it reads the replaced bits).
- runtime_render::run: once the state is made, a case with a stencil output, on a device whose
translator profile lacks fragment.stencil_export (the bit the translator chose the bit-draws form
by), under a state with such a face, is NotEnabled. After the make, so the product's own refusals
at creation (a colour beside the output: StencilExport) keep their records.
The runtime's second refusal, a draw that replaces a bit inside a Counting visibility segment,
meets no authored case: the case schema and the executor set no visibility result mode, so no
draw is in a segment. The doc comment and docs/VALIDATION.md say so.
Why this form and not the runtime limit: a ToolingRequirement with Limit::Runtime stops the engine
on every device, and lavapipe, RADV and ANV list the extension and run and match these cases. The
refusal holds only on a device without the extension, which is what a device's NotEnabled records.
Before the stencil form (5a722b5c3f) such a case was the device's refusal on NVIDIA too, through the
translator's StencilExport. Round 733b14ed24's RTX 3090 public leg failed 14 such cases
(stencil-output-reference-* and stencil-output-at-*-rate-*: "the runtime refused a case its
structure classifies as one it runs (Draw { kind: StencilOutput })").
Versions: none move. The authoring-capability census classifies by ToolingRequirement, which this
does not touch, so no census or index version. ENGINE_EXECUTOR_ABI stays: on a device with the
extension nothing changes, and on one without it every case this refuses failed at the base with
no row and no refusal recorded, so no recorded row observes the change (engine.rs's rule for a
bump).
Tests: runtime_render's a_stencil_output_needs_the_extension_where_it_decides_its_test, on the
committed profiles nvidia-rtx5080-laptop (no extension) and gate-lavapipe (the extension): every
pair of the eight compare functions on the two faces under Keep and Replace, 120 refused naming
the face and its function, the 8 of Always and Never drawn; a function with no stencil output and
a device with the extension draw every state. The graphics mapping tests assert stencil_output for
fragment_depth_stencil and its absence for fragment_varying_color. Without this change the case
reaches the runtime's draw and fails, as on the 3090.
Verified at this commit: cargo fmt only. The jobs that check it (the validation suite, the 3090
public leg, lavapipe's public leg) report to the orchestrator.
No code change. This commit carries what the reader change (be0718e716) and its fix (d8e42b5e8c)
were verified by, since published history is not amended.
- The six forms (METADATA_STRING_OLD, METADATA_KIND in the METADATA block, METADATA_OLD_NODE,
INBOUNDS_GEP_OLD, and LOAD and CALL without their types) follow LLVM's reader at
llvmorg-23.1.2. Its BitcodeReader.cpp and MetadataLoader.cpp are byte-identical to
llvmorg-23.1.5's, the release of the llvm-dis and llvm-as the differential used.
- The real file (the guest's library, which stays on our hosts), job m3-max-73898 on um870 at
d8e42b5e8c, release CLI, runtime-floor profile: each of the 7 modules alone passes the reader
(f0 and f1, the vertex functions, compile; f2 to f6 get the CLI's "fragment compiles in a render
pipeline" usage answer). The 6 pipelines Metal makes (f0+f2, f1+f2 to f1+f6) compile and
spirv-val accepts them, as it does f0 and f1 alone. The 4 pairs Metal refuses (f0+f3 to f0+f6)
are refused as UnmatchedVarying, as Metal refuses them for a fragment input the vertex function
does not write. Every run takes under 0.01 s and peaks at 15 MiB. The largest public fixture
(engine/wps_shuffles.ll, 10 kernels) takes 0.01 to 0.02 s per kernel and peaks at 17 to 18 MiB.
- The differential, the same job m3-max-73898: each module rewritten by llvm-dis of 23.1.5, then
read by the existing path through llvm-as (llvm-link joining a pair's two modules), gives word
for word the SPIR-V of the new reader: f0 and f1 alone and the 6 pipelines. The 4 refused pairs
are refused both ways.
- The ABI check against Metal's reflection on the M3 (job m3-max-73835): the 6 pipelines' bindings
are equal in stage, kind, index, access, texture type and data type, and sampler. Today's rule,
not this change's: a buffer slot's window is the byte range the shader can touch, not the
declared size, so f2's buffer 0 reads 16 B where Metal reflects the 48 B struct.
The reserve borrowed value_type_ids mutably while its own length was an argument (E0502 at
be0718e716, jobs m3-max-73885 and 73886). The count is taken first.
Verified: not yet run at this commit; the lane's check jobs follow.
What: SEMANTICS_VERSION 2303 -> 2304.
Why: the reader change before this commit changes the output for an input under an unchanged
key. A module with METADATA_STRING_OLD, METADATA_KIND in the METADATA block, METADATA_OLD_NODE,
INBOUNDS_GEP_OLD, or a LOAD or CALL without its type was refused InvalidInput(Unsupported(
BitcodeRecord or Instruction)), and it now decodes and its functions may compile. docs/HOWTO.md
section 4 lets a consumer keep a non-transient error as the answer for that input and device, so
without the bump a cached refusal would outlive the fix. A module that decoded before decodes to
the same tables, except that a METADATA_KIND record with fewer than 2 operands or a kind id stated
twice is now malformed, as LLVM's reader refuses it. The golden table reports a bless due; it is
re-blessed on development.
Verified: not yet run at this commit; the lane's suite job follows.
A game launcher's metallib (AIR 1.8, language 1.1) parses since the container fix, but each
of its 7 functions stopped in the bitcode reader at METADATA_STRING_OLD. A structure-only census
of its 7 modules (job m3-max-73828) found six refused forms in all and nothing else unknown:
METADATA_STRING_OLD, METADATA_KIND inside the METADATA block, METADATA_OLD_NODE,
FUNC_INBOUNDS_GEP_OLD, LOAD without its type, and CALL without the explicit-type flag.
Each is now read as LLVM's reader reads it at llvmorg-23.1.2:
- STRING_OLD (MetadataLoader.cpp:2424-2433): one MDString of the operands as bytes, the next
metadata id. Its llvm.vectorizer. loop-key upgrade (AutoUpgrade.cpp:6979-7026) renames keys
the IR keeps in neither spelling, so the decoded loop hints are unchanged.
- KIND in the METADATA block (2457, parseMetadataKindRecord 2631-2643): the METADATA_KIND
block's record. Both places now refuse a record with fewer than 2 operands and a kind id
stated twice, as LLVM does.
- OLD_NODE (1401-1428): a uniqued node of (type, value) pairs. A metadata-typed operand is a
metadata id, a void one is null, and any other is the module value of that type and id, as
ValueAsMetadata. LLVM numbers no id for such a value; the arena keeps one Md::Value entry per
value after the block's own ids, and MdIds moves every id LLVM numbers later (later module
blocks, function blocks, attachments, call operands) past them.
- INBOUNDS_GEP_OLD (BitcodeReader.cpp:5383-5450), LOAD (6418-6436) and CALL (6886-6964)
without their types: the source element, loaded or function type is the pointer operand's
contained type. The reader follows LLVM's type ids (getContainedTypeID, 1510;
getVirtualTypeID, 1532) for every value: TypeIds keeps the virtual ids for pointers made by
alloca, GEP and the module's globals and functions, shuffles and cmpxchg; each instruction's
result takes the id LLVM's reader gives it.
Still refused, by name: METADATA_OLD_FN_NODE; KIND and OLD_NODE in a function's block; an
OLD_NODE value in a module block after one whose old nodes kept values; a load atomic without
its type; GEP_OLD (not inbounds) and STORE_OLD. None is in the file. A typed-pointer load, call
or GEP whose operand has no contained type (an opaque pointer, a non-pointer) is BadType or a
malformed record.
Tests: typed_pointer_records_without_their_types_read_as_with_them decodes one typed-pointer
module in both spellings (a struct field, an array element, a loaded pointer, a cast, an
argument, and a function whose record names a pointer to its type) and asserts the tables are
equal, plus the refusals. legacy_metadata_records_read_as_their_modern_twins decodes the
function-test module with its metadata in the old records, asserts the body equals the modern
twin's, the arena's layout, and the shifted ids in a second module block and in a function
block, plus each refusal. Both fail without the fix: the old records were refused. The tests
that asserted those refusals now assert the remaining ones (OLD_FN_NODE).
docs/REFUSALS.md regenerated. Not yet run at this commit: the suite job follows.
b7ec03d37a added the row; the generated coverage document counts ledger rows (7983 -> 7984) and lists the case.
Development's suites at a551bbed9f (m3-max-73870) failed the_conformance_coverage_document_is_what_the_sources_derive
on it. Regenerated with scripts/conformance-coverage/coverage.py; no other change.
What: the seam's real-use test's view moves out of
a_device_with_no_cached_coherent_type_is_refused_naming_its_types into
crate::tests::cached_types_incoherent (under the device cfgs), which the test now calls. The
view takes HOST_COHERENT from every type that is host-visible, host-coherent and host-cached, so
no type is both cached and coherent, the shape of the user's Meteor Lake GPU under Mesa's Intel
driver and i915; every other type keeps its flags. It now asks HOST_VISIBLE too, which every
cached or coherent type has.
Why: the planner rules one view for both lanes on that regression (anarrow and sharedimport),
whose builds run the device suite through it; one function holds it.
Verified: not yet run (cargo fmt only). A lavapipe and a real-card run of the test follow.
What: DeviceOptions gains a test-only field beside `maker` and `described`, under the same cfg
(all(test, any(m2v_gpu, m2v_cpu_icd))): `memory: Option<fn(&mut vk::PhysicalDeviceMemoryProperties)>`.
Device::open applies it to the floor's capabilities.memory right after physical.check(), before
anything reads them: floor::memory_types -> choose, arena::budget, the device-local bits and
Imports::new. The floor's check of the physical device still reads the device's own answers.
floor::buffer_memory_bits is the memoryTypeBits question floor::memory_types already asked, now
its own function so the test asks it too.
Its use: tests::floor::a_device_with_no_cached_coherent_type_is_refused_naming_its_types, under
the device cfgs. For every device of the cfg's kind, the view takes HOST_COHERENT from each type
that is both host-cached and host-coherent, so the device lists its types as the user's Meteor
Lake GPU does under Mesa's Intel driver and i915. The device is refused at its make, and the
refusal equals the floor's choose() over the view with the buffer bits a device made without the
view answers: it names the Shared flags and the types the device offers a buffer.
Why: no lab card lists a host-cached type that is not coherent (vulkaninfo, jobs m3-max-73858 to
73861), so the floor's answer for such a device can only be reached through a view of a real
device. Lanes on that regression run the device suite through it. No product path changes: the
field and its application exist only in the device test builds; no env var, no switch.
Verified: not yet run (cargo fmt only). The build and the lavapipe and real-card runs follow.
Before the stencil form (5a722b5c3f), NVIDIA's replay refused this case at its pipeline for lacking
VK_EXT_shader_stencil_export: lacks-feature (round 0c9db49765, 3090 replay m3-max-73622). With the form, that refusal
is gone, and the case reaches the refusal every other venue's row names: a render pipeline state with
DepthStencilFormats (separate depth and stencil formats) is not built, Gap::RenderPipeline. The NVIDIA replays of
round 733b14ed24 stopped on the missing row on the 3090 (m3-max-73826), the 2080 (73831) and the 5080 (73829).
The row is the RADV row's text with the venue NVIDIA. No product change.
SEMANTICS_VERSION moved 2302 -> 2303 with the metallib format 2.2 reader (25945236d1). Every golden cell is
unchanged (0 moved cells); only the semantics line follows. Engine inventory and air_input printouts unchanged.
Verified: bless job m3-max-73854 on the M3 at 9df5c5a8ac (inventory=0, golden=0, printouts=0; patch is this one line).
What: name: *name became the field shorthand; clippy's explicit_auto_deref
refused the deref in all three configurations (quick check m3-max-73798).
Verified: the next quick check.
What: SEMANTICS_VERSION 2302 -> 2303.
Why: the container fix (c9b08b08f5) changes the output for an input under
an unchanged key: a format 2.2 library, whose entries carry no MDSZ and
which has no extended header, was refused InvalidInput(Container(
MissingTag)), and it now parses and its functions compile. docs/HOWTO.md
section 4 lets a consumer keep a non-transient error as the answer for
that input and device, so without the bump a cached InvalidInput would
outlive the fix. A library that parsed before parses to the same
functions, so no other output changes. The validation censuses key on
SEMANTICS_VERSION (the translation census and the authored-compile
census through the product's census key) and move with it. Harvest
carves the modules of a library the reader refuses and keys nothing on
the reader, so no census, index or harvest version needs a bump of its
own. The golden table reports a bless due; it is re-blessed on
development.
Verified: the lane's quick check and suites at this commit.
What: the compiled function's artifact holds its words in module.words;
the test now compares them and the whole artifact (m3-max-73786 did not
compile the spirv field).
Verified: the next build job.
What: the closure returning the parsed functions' borrowed fields did not
compile (lifetime may not live long enough, m3-max-73782); a nested fn
names the library's lifetime.
Verified: the next build job.