RUNTIME 2382: a heap's decoded-format texture on a shadow route keeps a decoded twin

Under DevicePolicy::exact_answers (HeapAnswerPolicy::Metal) a heap's PVRTC or ETC2 texture on RADV
PHOENIX misses Metal's answer (its BC1 carrier image takes 4096 B @ 4096, Metal answers 128 @ 128
or 2048 @ 128), so it lies in memory of its own as a shadow of the heap's bytes (MemoryShadow;
Shadow or Tiled where those serve). heap_texture_at gave a decoded twin only to the Direct,
HostTransfer, Linear and Hidden routes, so its sampled view fell to the carrier, which has no
sampled usage, and every kernel read and sample was refused, Unsupported(Format) (8 of 8 cases in
m3-max-33467), where Metal samples it and the device can decode it.

A heap's PVRTC, ETC2 or EAC texture on a shadow route (not over the caller's host pages, not
detached) now gets its decoded twin. ShadowCopy::record_gated records the shadow's decode
(ShadowCopies::decode) after a copy in that moved texels, and only then (record_moves answers
whether it moved any); the pass is set at making (Image::decode_after_copies_in) and its kernel is
made in ShadowCopies::prepare at first use, so no making compiles. WorkCounts::shadow_twin_decodes
counts the decodes. 4:2:2 heap shadows stay twinless; heaps over the caller's host pages stay the
documented copies-alone gap. Docs: decoded_twin.rs, pvrtc.rs, etc.rs, degradation.rs, docs/API.md,
docs/FAST-PATHS.md (heap shadows of decoded formats are no longer for copies alone). New device test
runtime_lane/heap_carried_reads.rs. Public surface: WorkCounts (for the lanes) gains
shadow_twin_decodes, blessed in api_signatures.tsv.

Verified: PHOENIX m3-max-33568 (carried binary of the lane tip d5bf9cac82): heap_carried_reads,
a_carried_heap_texture_reads_its_bytes_with_no_commit, pvrtc_texels_read_as_metal_s and
etc_texels_read_as_metal_s pass. Under HeapAnswerPolicy::Metal all 8 cases shadowed; a use takes 1
copy and 1 decode, a second encoder in the same command buffer 0 and 0; kernel reads, samples, blit
out and getBytes equal the texture outside a heap, and samples follow a blit and a replaceRegion.
Under HeapAnswerPolicy::Device: not shadowed, 0 copies, 0 decodes, equal. Without the fix
(33467 at the test commit) all 8 reads were refused. lavapipe (msi 33535): the 4 tests pass. Clippy
x3 running in 33569.
This commit is contained in:
Anees Iqbal committed 2026-11-15 13:46:15 -08:00
1 parent dc77ffbb55
commit d62e1d2bd9
23 files changed
+741 -58

No files matched your search

+7 -2
View File
@@ -3793,7 +3793,10 @@ bound.
the linear and sRGB forms); an ASTC sRGB texture's, its own 8-bit codes, read the same way; an
ASTC HDR texture's, Metal's halves, exact (its error blocks' NaN included).
It is decoded after each write into it (a PVRTC texture's whole levels, since each texel's
colors come from the blocks around it). An ASTC texture's first view in its other colour
colors come from the blocks around it); a heap's such texture whose image is a shadow of the
heap's bytes (where its carrier asks more of the heap than Metal's answer it is held to, as
under `HeapAnswerPolicy::Metal`), its whole twin after each copy in that moves its blocks
(`WorkCounts::shadow_twin_decodes`), and not after a use that copies nothing in. An ASTC texture's first view in its other colour
space (its sRGB form as LDR, or the other way) gives it a second twin of that form's decode, kept
in step by GPU passes its command buffers' submissions record. Also a texture of a 4:2:2 format
(`GBGR422`, `BGRG422`) on every device, whose Vulkan formats are viewed only through a sampler
@@ -3813,7 +3816,9 @@ bound.
two for an ASTC texture viewed in both
colour spaces, and a decode after each write into it: a pass on
the GPU for a blit, a copy from a texture or a CPU copy through a submission; on the CPU, on the
device's decode thread, where its CPU copies go on the host or the staging queue.
device's decode thread, where its CPU copies go on the host or the staging queue; and a pass on
the GPU after each copy in that moves the blocks of a heap's texture whose image shadows the
heap's bytes.
- `metal2vulkan-degrade-decoded-texel-precision` (precision). `DecodedTexelPrecision`: A texture
with an ASTC LDR decoded twin of 8-bit codes, or an EAC 11-bit one (`R11`, `RG11`) of 16-bit
normalized codes; or a 4:2:2 texture (`GBGR422`, `BGRG422`) whose twin holds the device's own