Commit Graph
18 Commits
Author SHA1 Message Date
Anees Iqbal b0b61ac179 Time a fault that later failing encoders follow as Metal's GPU reaches them
The steps this packet landed as, in order:
- Stop a running predicated loop at the GPU's recovery from a fault or a hang
- Resolve multisampled extended-range targets by Metal's measured rules
- Run the emulation's indirect mesh draws with an object function

Content: the tree of `development` at 60cf488339, unchanged.
2026-10-26 13:19:07 +02:00
Anees Iqbal 4da2c33f1a Zero a multisampled sparse texture's unmapped tiles by clears
The steps this packet landed as, in order:
- Say whether the multisampled sparse lane ran on a sparse image
- Answer per indirect command buffer whether its identifier is unmeasured
- Bump the semantics, artifact format and runtime versions for the ninth stack
- Pin the runtime sources of the ninth stack

Content: the tree of `development` at 9e2387685c, unchanged.
2026-10-26 13:19:06 +02:00
Anees Iqbal e69068885b Write a kernel's draw of a primitive type past Metal's five as points, as Metal's encoding does
The steps this packet landed as, in order:
- Give the private-writes fixture its golden printout and inventory rows
- Draw an indirect render command's private primitive types as the encoder's draws of them
- Count an injected page fault or hang toward a queue's revocation, as the error it stands for
- Drop a unit's ungated dispatches at its unbalanced first record, as Metal does

Content: the tree of `development` at 8e08f4d248, unchanged.
2026-10-26 13:19:06 +02:00
Anees Iqbal 027451fc5f Revoke a queue at its second caused GPU error, as Metal does
The steps this packet landed as, in order:
- Draw private types in a pulled list form where the indexed list differs from Metal

Content: the tree of `development` at d3fc3a5794, unchanged.
2026-10-26 13:19:06 +02:00
Anees Iqbal e323ba2f72 Run tile threadgroups of every even shape in Metal's thread layout
The steps this packet landed as, in order:
- Read the coverage after the early depth test for [[sample_mask, post_depth_coverage]]
- Copy a stencil view's texels by the CPU as plain Metal does
- Give multisampled fragment imageblocks a block per sample, and test before writes a test may drop

Content: the tree of `development` at becd3e74a9, unchanged.
2026-10-26 13:19:05 +02:00
Anees Iqbal 1400c9049f Resolve a NaN clear as Metal does in a pass whose draw calls draw nothing
The steps this packet landed as, in order:
- Leave a resolve texture untouched where Metal's tile is not stored into its format
- Take setDepthCleared, setStencilCleared and setVertexAmplificationMode as Metal does
- Run the private alpha test in the fragment function as Metal tests it
- Clamp depth comparison references as Metal's fragmentDepthCompareClampMask says
- Take vertexAmplificationMode and explicitVisibilityGroupID as Metal does
- Record no restricted depth range where the driver keeps depth values outside [0, 1]
- Draw Metal's private logic operation: copy and no-op everywhere, the rest through logicOp
- Leave the default alpha test and clamp mask out of the inputs encoding test's derived Debug
- Clamp the reference of a depth comparison the shader makes under the clamp mask
- Key each Vulkan logic operation's pipeline apart
- Refuse a multisampled extended-range resolve naming its format and Metal's rule

Content: the tree of `development` at 0231dbbd54, unchanged.
2026-10-26 13:19:05 +02:00
Anees Iqbal 766ba91b30 Keep a heap's two-plane array and mipmapped texture in the heap's bytes
The steps this packet landed as, in order:
- Give the 3D two-plane heap texture test a Private descriptor
- Lay a heap's depth and stencil textures out in Metal's tiles on MoltenVK
- Answer Metal's heap size for PVRTC textures and tile them under 27.0.1
- Lay a heap's Depth32Float_Stencil8 texture out in Metal's two tiled planes
- Make a host heap's uncompressed multisample texture in memory of its own
- List the two-plane array fixture in the engine inventory, with its printout
- Let the no-copy heap lane find a compressed texture's texels in Metal's tiles
- Name the depth heap lane's aspect list type for clippy
- Announce a device heap's textures whose bytes are not Metal's layout
- Lay a heap's X32_Stencil8 texture out in a Stencil8 texture's tiles

Content: the tree of `development` at b3c694ad82, unchanged.
2026-10-26 13:19:05 +02:00
Anees Iqbal ee21fca2f4 Write Metal's bytes in texture fills and two-plane buffer blits
The steps this packet landed as, in order:
- Hold RGB10A2Unorm_sRGB textures with Metal's conversions
- Name the runtime's gap, not a missing feature, for fetch on interlock devices
- Take clippy's forms in the RGB10A2Unorm_sRGB tests
- Fill multisample textures' samples as Metal's private fills write them
- Check fill units only for the formats the crate holds textures of
- Hold a two-plane texture's bytes between rows, which Metal's buffer blits read back
- Fill texture buffers as Metal does: bytes of the buffer, the pattern streamed
- Drop the multisample fill from apple_only's refusals, which fills it
- Meet the rows of a two-plane buffer blit into the texture in Metal's order
- Announce narrow two-plane row meetings across groups of 32 rows as one of Metal's

Content: the tree of `development` at 9d3447dec9, unchanged.
2026-10-26 13:19:05 +02:00
Anees Iqbal c83dcdd384 Give the predication step ops that drop, hold and resume a range, and check a unit's end
The steps this packet landed as, in order:
- Answer command predication as Metal does on an M3 Max under macOS 27.0.1
- Probe Metal's command predication from the validation crate's Metal platform
- Wait for the predication probe's command buffers through the bounded wait
- Name the record a predication block left open came from in its command buffer's failure
- Refuse a run's first indirect dispatch of another dispatch type at Metal level 26.7
- Read an encodeEndDoWhile's word only where it closes a live DoWhile
- Run command predication on devices without buffer device addresses
- Nest predicated loops to any depth, their copies bounded by what they lay down
- Read a predication word past its buffer as Metal reads it
- Halt a predication unit where a loop runs past its copies
- Name the lane's fixed loop case type, which clippy found too complex

Content: the tree of `development` at ef8b74ec1b, unchanged.
2026-10-26 13:19:05 +02:00
Anees Iqbal 0d9e71903b Read VK_EXT_provoking_vertex: provokingVertexLast and provokingVertexModePerPipeline
The steps this packet landed as, in order:
- Write the index rewrite pass's primitives in either provoking vertex order
- Draw Apple's last provoking vertex: a last-vertex pipeline, else lists led by it
- Test Apple's provoking vertex modes against Metal's on the device
- Describe the provoking third way as pipeline-dependent; fix the table test
- Check the last provoking vertex through a geometry stage; key its slice notice on stages
- Test that executions keep the first vertex; scale the weights check by the values
- Register rt6_provoking in the engine inventory and golden printouts
- Add host_ab's provoking workload: flat-shaded draws at provoking vertex modes 0 and 1
- Add the index gather pass: one dispatch for a run of direct draws' lists
- Gather direct indexed draws' lists in runs: one dispatch per run, not three per draw
- Add the rotated-weights variant: Metal's barycentric weights from a rotated triangle
- Count private lists' gathers under a last-vertex pipeline; take the open runs whole
- Draw listed triangles' barycentric weights through the rotated-weights variant
- Draw every provoking vertex mode past 1 the third way, its top bit set or not
- Announce nothing for a provoking-mode draw that makes no primitive

Content: the tree of `development` at 91b1df7b21, unchanged.
2026-10-26 13:19:05 +02:00
Anees Iqbal 9adc8a867a Draw Metal's private primitive types 5 to 8 as the lists Metal draws
The steps this packet landed as, in order:
- Test the private primitive types' draws against Metal's lists on the device
- Check the private draws through the weights' geometry stage too
- Use is_multiple_of and as_chunks in the private lists
- Fail a draw of primitive type 9 as Metal's GPU does
- Give the private-types fixture its golden printout and inventory rows
- Discard what a hang's queue schedules during it, and time the hang as measured
- Regenerate REFUSALS for the type-9 runtime changes
- Read Metal's quad primitive ID under private quads and quad strips
- Read a type-9 hang's Scheduled at Metal's time, not at its held last batch
- Schedule a hang's queue's command buffers from the hang's Scheduled on
- Stop a hang's thread waiting on a failed command buffer; keep storage-form commits on their last batch
- Hold a hang's joined command buffers behind a closure, so Rustdoc ends

Content: the tree of `development` at 5441a97bda, unchanged.
2026-10-26 13:19:05 +02:00
Anees Iqbal 7b8ebc5b3e Use AtomicU64::try_update, the name fetch_update now has
The steps this packet landed as, in order:
- Refuse buffer-texture copy layouts whose rows pass u64::MAX instead of wrapping
- Wait without a deadline for a timeout past the host's clock, and test copies at the buffer's edge
- Place a multisampled buffer copy's rows where plain Metal does, staging off-texel rows
- Say that Metal copies the multisampled layouts the runtime still refuses
- Count the rows a compressed-texture blit rewrites, and test a copy out off the texel

Content: the tree of `development` at e5ff75b136, unchanged.
2026-10-26 13:19:05 +02:00
Anees Iqbal 7bc5866f45 Draw a multisampled 32-bit float depth copy, announced, where the driver's fragment depth is unmeasured
On a driver whose fragment depth is unmeasured, a multisampled Depth32Float copy is drawn and
announced rather than refused.

Folds in:
- Draw a multisampled 32-bit float depth copy, announced, on a driver whose fragment depth is
  unmeasured

Verified by each folded change's own checks; the tree this series ends on is the one verified
at the tip on six GPUs, the CPU suites and lint (see the tables commit).
2026-10-19 00:16:00 +03:00
Anees Iqbal 930d746df7 Read ASTC, ETC2/EAC, PVRTC and 4:2:2 textures the device lacks through twins of Metal's decode
On a device without a texture's compressed or chroma format, the runtime now makes the texture and
reads it as Metal does. Before, such a texture was refused at its making (ASTC, ETC2/EAC) or at its
first read (PVRTC, 4:2:2, held for copies alone). The consumer's guest on the RTX 5080 stopped at
ASTC_8x8_LDR, PVRTC_RGB_2BPP and EAC_R11Unorm. NVIDIA, RADV and lavapipe have none of these formats,
and Vulkan's 4:2:2 formats need a sampler Y'CbCr conversion whose chroma reconstruction is the
implementation's.

What changes:
- The store. The blocks lie in a carrier image of the same block bytes and shape (a compressed
  format the device copies: BC1, BC4, BC7, BC3, BC2, BC5, ETC2, EAC or ASTC 4x4; R8G8 for 4:2:2).
  replace_region, get_bytes, blits, fills and texture copies move Metal's blocks unchanged.
- The twin. Reads go to a decoded twin holding Metal's decode, kept in step on the GPU as a BC
  texture's twin is: a decode pass after a blit, a texture copy or a submitted CPU copy, and a CPU
  decode on the device's decode thread after a host write. No write costs a GPU-to-CPU round trip.
  A write's decode covers whole levels for PVRTC and whole rows for 4:2:2, whose texels read their
  neighbours. A new texture's twin starts at the decode of zero blocks (magenta for ASTC's error
  block), not at zeros.
- The decoders, our own, written from the Khronos ASTC specification, the Khronos Data Format
  Specification's ETC2 and EAC chapters, and Metal's measured answers for PVRTC1 and 4:2:2:
  bind::AstcDecode, EtcDecode, PvrtcDecode and ChromaDecode, with their GPU kernels
  astc_decode_module, etc_decode_module, pvrtc_decode_module and chroma_decode_module on the block
  decode's bindings (new api_surface rows, with AstcTexels, EtcTexels and DecodedTexelsPolicy).
- Metal's decode, matched: an ASTC LDR channel is (C >> 4) / 4095 of the 16-bit interpolated C;
  an 8-bit ETC2/EAC channel c / 255, an 11-bit one c / 2047 (signed c / 1023); PVRTC upscales
  colours A and B from the four block centres around a texel and blends them by its index; a 4:2:2
  texel takes its own green, and red and blue (3c + n + 2) >> 2 of its pair and the pair beside it.
- sRGB forms. The ASTC, PVRTC and ETC2/EAC sRGB formats read their twin's codes raw through an
  R8G8B8A8_UNORM view and decode them through Metal's table, as the 8-bit and BC sRGB formats do:
  reads, nearest samples and gathers exact, with no precision notice. Linear samples keep the
  device's sRGB filter (the exact sum under SamplingPolicy::Exact). A device that has the ASTC
  block keeps its own sRGB decode. The linear PVRTC and 8-bit linear ETC2/EAC formats take BC1 to
  BC3's Argb8 texel class, so under TexelConversionPolicy::Exact their reads are Metal's c / 255.
- The switch: DevicePolicy::decoded_texels, DecodedTexelsPolicy { Compact (default), Exact };
  exact_answers() selects Exact. Compact holds an ASTC LDR twin in 8-bit codes nearest Metal's
  12-bit value (at most 1/510 off) and an EAC 11-bit twin in the nearest 16-bit codes, announced
  decoded-texel-precision. Exact holds their floats. PVRTC, the 8-bit ETC2/EAC formats, the ASTC
  sRGB formats and 4:2:2 are exact under both. Tested by fast_paths; a FAST-PATHS row.
- Views in the other colour space. An ASTC texture viewed in its other colour space reads a second
  twin, made at the first such view: Metal reads that view exactly as a texture of the view's
  format over the same blocks, and the two forms widen endpoints apart, so one twin cannot serve
  both. Its decodes are queued on the device and recorded by the next batch with work. Counted by
  WorkCounts::second_twins, second_twin_checks and second_twin_decodes. PVRTC and 8-bit ETC2/EAC
  views of the other colour space share the one twin.
- Copies between a compressed texture and an uncompressed one whose texel is the block's bytes
  (BC1 or ETC2 with RG32Uint, BC7 or ASTC with RGBA32Uint) run with Metal's rule: every coordinate
  in the destination's texels, a block per texel. They were refused as formats of different units.
- Notices: carried-decoded-twin (Performance) on every twinned texture; decoded-texel-precision
  (Precision) only for an ASTC LDR or EAC 11-bit twin under Compact.
- Typed refusals: RuntimeGap::DecodedHeapTexture (a heap's ASTC texture, a sparse heap's carried
  texture; the heap size query refuses alike); views of the ASTC HDR form, of another footprint or
  PVRTC block, and of an EAC 11-bit format as its other signedness (Unsupported(TextureView));
  copies between PVRTC and an uncompressed format, between two compressed formats of one block size
  and different extents, and level or slice copies between compressed and uncompressed formats
  (NotImplemented(Format)). A device with the native format keeps the direct path.
- Docs: the API.md catalogue entries, the FAST-PATHS decoded_texels row and known gaps, and the
  module docs of astc.rs, etc.rs, pvrtc.rs, chroma_pairs.rs and decoded_twin.rs.

Why: Metal makes, reads and samples these textures on Apple GPUs, and the consumer's guest uses
them; the desktop Vulkan drivers have no such formats.

Verified:
- Metal's answers, probed on an M3 Max under macOS 27.0.1: ASTC (seeded random blocks, all 14
  footprints, linear and sRGB, read as float and half) bit for bit, digests pinned by
  seeded_blocks_read_as_metal_read_them; ETC2/EAC (4096 random blocks of each of the ten formats)
  digests equal; PVRTC (all eight formats) every digest equal; 4:2:2 every read, sample and gather
  bit for bit what an RGBA8Unorm texture of the decoded codes answers; the copy rule on every listed
  pair both ways.
- On the CPU SPIR-V interpreter each GPU kernel writes the CPU decode on every texel: ASTC on every
  footprint, linear and sRGB, Float and Unorm8, with blocks covering all 16 endpoint modes, every
  partition count, dual plane and void extent; ETC on every decode and both texel forms; PVRTC on
  every format. The kernels are valid on every committed profile.
- Runtime unit filters 63 passed and translator unit filters 183 passed (ETC2/EAC); the runtime's
  unit suite 952 of 953 (the one failure the recorder's module-list test, fixed with the recorder).
- On lavapipe: chroma_pairs, pvrtc_textures, the mipmap, fill, buffer-texture and degrade-notice
  lanes, 45 passed; format_copies, the whole module. A lavapipe batch caught PVRTC codes read one
  ulp high under exact answers, fixed by the Argb8 class.
- clippy -D warnings (plain, m2v_gpu, m2v_cpu_icd) and rustdoc on ms01 and gem10.
2026-10-19 00:15:59 +03:00
Anees Iqbal 0175289314 Batch the development-fast round: tessellation without tessellationShader, primitive ids, mesh tooling, color groups, the vk12 floor, runtime timing and teardown fixes
One commit of the 247 on development-fast (720ef1ce9a..9f46fdf80d), squashed at the user's request.

Translator:
- Tessellation on a device without tessellationShader: Metal's tessellator emitted as SPIR-V, a
  one-workgroup scan placing each patch's triangles in Metal's order, and the post-tessellation
  function as a plain vertex stage (EmulatedTessellationDraws; SEMANTICS 1739, ARTIFACT_FORMAT 419).
- [[primitive_id]] on a device without geometry or tessellation shaders, as a flat varying the
  vertex function writes; indexed lists, lines and points drawn de-indexed (RuntimeGap::PrimitiveIdIndices).
- Fragment functions of more colors than the device draws at once, compiled in color groups
  (PrecisionNote::ColorAttachmentGroups).
- Object functions' threadgroup memory from the render encoder; a kernel's mesh draws from an
  indirect command buffer; mesh payload sizing.
- The Vulkan 1.2 floor profile (vk12-floor) and the gates it needs; Metal 27.0.1 answers as the M3 Max.
- Overflow tests in the runtime-built modules by the product's high word (NVIDIA's compiler fails
  the division form), guarded crate-wide by tests::owned_divisions.

Runtime:
- Color-group passes replayed per group over twin depth/stencil; snapshot and copy-back cost cuts.
- Command buffers finish on the queue waiter that saw them; the waiter holds no device handle, so
  a program's drop after its wait is the device's last.
- Every object an encoder was handed held until its command buffer completes; deallocator order
  and announcements.
- Driver defects recorded and announced: ANV counts a visibility sample once per color output
  (visibility-count-per-color); MoltenVK fails pending work when memory that held a device-address
  buffer is freed, so freed memory waits for the work in flight (host-deallocator-delayed).
- RenderCommandEncoder::set_object_threadgroup_memory_length; Visibility::counting().

Validation: mesh tooling (object, mesh and ICB-mesh cases on both executors), the authoring
census closed, the queue storm judged in Metal's unit, load-robust exits and indirect-census
bounds, and the golden hashes, printouts, fixture inventory and authored compile census blessed.

Docs: FAST-PATHS.md trimmed to a ledger of what is true now; API.md's catalogue and accepted
differences, REFUSALS.md and METAL-COVERAGE.md current.

Verified on development-fast before the squash: the full suites on the RTX 5080, RTX 3090,
RX 7900 XTX, Radeon 780M, Iris Xe, lavapipe and the M3 (MoltenVK and the Metal oracle), lint in
every configuration, rustdoc, doc tests, packaging and public case qualification; the timing and
teardown lanes x5 on every venue; the authoring-capability census 16656/16656 with 0 unresolved,
the vk12-floor translation census at 6139 translated with the slowest row 794 ms and peak 126 MiB.
The tree is development-fast's at 9f46fdf80d.
2026-10-16 11:12:03 +03:00
Anees Iqbal 3dd70970df Reach the execution status through a binding where the device addresses no buffer
The execution-status work packet: where the device addresses no buffer, the command buffer's status
words are reached through a binding the plan asks for (WriteSource::ExecutionStatus), bound by the
runtime and by both Vulkan executors, documented, with the refusal surface regenerated.

What: a stage that writes the command buffer's ExecutionStatus (an absent argument's read, a
seq_cst fence, an argument buffer's cubic-sampler test) reaches it by device address where the
device addresses buffers (bufferDeviceAddress and shaderInt64), as before, and elsewhere through
a set-0 storage buffer of its own: ResourceSlot { stage, Synthetic(ExecutionStatus), 0 }, a
storage word view the status words are written through. absent::state_status states the form;
the binding counts once in the stage's storage-buffer descriptors, so the per-stage limit check
in lower::select sees it. The ExecutionStatus fact's mechanism is SyntheticBinding on such a
device, PushConstant elsewhere. Profiles that address buffers produce the same modules as before.

Two needs, two answers past a limit (absent::StatusBinding):
- Required (an absent read, a fence): a stage past its storage-buffer limit with the binding is
  refused as DescriptorCount, naming MaxPerStageDescriptorStorageBuffers.
- CubicMark (only the argument samplers' cubic test): absent::finish gives the binding back and
  the stage states no cubic reach, as a fragment stage does. The mark is a may-need: only a cubic
  sampler a command later lists in the argument buffer needs it, and that sampler then meets the
  planner's typed refusal (SamplerBicubicFilter), so nothing is dropped silently. Refusing the
  stage instead would refuse every stage near its limit that samples through an argument
  buffer, cubic sampler or not, all of which compile today.

FunctionConstantArgument and SeqCstFence are now refused only where the stage lacks its stores
and atomics (a vertex or fragment stage without them), no longer for want of buffer addresses.

Why: on vk12-floor, vk12-bare, lunarg-desktop-baseline-2023, roadmap-2022 and swiftshader every
absent read and seq_cst fence was refused (on vk12-floor's census, 22 FunctionConstantArgument
and 9 SeqCstFence rows), though the device can write a storage buffer.

Tests: the absent-read, threadgroup, function-constant, seq_cst and atomics tests compile on
every profile and assert the status's reach per profile (testing::status_reach_on); a floor
interpreter run of device_fence_store binds the status by slot (word 0 is 42);
an_absent_reads_binding_counts_against_the_storage_buffer_limit (vk12-floor at its count less
one: DescriptorCount on MaxPerStageDescriptorStorageBuffers);
the_cubic_tests_binding_gives_way_to_the_storage_buffer_limit (lunarg, the limit lowered step by
step: the binding given back below the kernel's own count, every compile within the limit and
L3-valid); the kernel tests its argument samplers for a cubic filter on every heap profile.

Verified on msi-laptop (Linux, debug, LLVM 21) on this change with the binder, runtime and
validation commits that follow: clippy --workspace --all-targets --all-features -D warnings clean
by default, under --cfg m2v_cpu_icd and under --cfg m2v_gpu; rustdoc -D warnings clean; the
focused tests (engine_absent*, engine_seq_cst, engine_atomics, engine_dispatch, engine_handles,
engine_binder, engine_function_constant*, mechanism) 122/122; the metal2vulkan, air, runtime and
devtools suites 4592/4598, the 6 reds the table moves below.

Moves (blessed elsewhere, on macOS): public_fixture_expectations_engine.tsv, .ll rows, exactly 50
cells, 10 rows x the 5 profiles above, none on a profile that addresses buffers: 42 from
Unsupported{FunctionConstantArgument|SeqCstFence} to ok, and 8 to
NeedsInput{StorageTextureFormat} (absent_texture_reads_zero, fc_kernel_absent_resources,
fc_kernel_absent_sampler, fc_kernel_sampler_select on roadmap-2022 and vk12-bare: the next gate
there, which the refusal hid). golden_hashes.tsv: 104 cells, those 50 plus 54 hash changes, 18
argument-sampler rows (msf_runtime_samplers, tail_argument_samplers,
tail_argument_cube_gradient, unv_runtime_levels) on lunarg-desktop-baseline-2023, roadmap-2022
and swiftshader, which now test the cubic bit; no cell of a profile that addresses buffers.
Expected, not run here (metal-as needs macOS): the .air.ll rows of function_constant_interface
and rfs_absent_reads.

Plan the execution status's binding as WriteSource::ExecutionStatus:
What: a compute or render plan writes a stage's SyntheticBinding::ExecutionStatus binding as the
new WriteSource::ExecutionStatus: the command buffer's ExecutionStatus buffer, the one every
command of it writes, ExecutionStatus::BYTES bound. The bind module docs say how a command
reaches the status on each kind of device. WriteSource is #[non_exhaustive] and not encoded, so
neither the cache codec nor the api_surface table changes.

Why: the previous part binds the status on devices that address no buffer; the planner
refused such a binding as internal ("a compute binding ExecutionStatus").

Tests: a_seq_cst_fence_reaches_the_status_by_binding_or_address_as_the_device_allows runs
dispatch_builtins' device_fence_store through the binder harness on vk12-floor and
lunarg-desktop-baseline-2023 (one ExecutionStatus write, no status push hole) and moltenvk-m3
(the push hole, no write): each of the 24 threads increments StatusWord::SeqCstFences of the one
status (24), and the store after the fence lands (42).

Verified on msi-laptop (Linux, debug, LLVM 21) with the change's other commits: the test passes
among the 122 focused tests; clippy clean in the three cfgs; rustdoc -D warnings clean.

Bind the command buffer's status words where a plan asks for them:
What: the runtime's descriptor writer binds WriteSource::ExecutionStatus to the command buffer's
status words (command_buffer::State::status_words), the buffer whose address it pushes on a device
that addresses buffers, whole. The command buffer reads and reports it on completion as before.

Why: on a device that addresses no buffer a stage with an absent read, a seq_cst fence or an
argument-sampler cubic test now binds the status (the translator commit before); the runtime has
to bind the same buffer it reads.

Verified on msi-laptop (Linux, lavapipe, --cfg m2v_cpu_icd, debug) with the validation commit
that follows: runtime_lane::absent_reads, 3/3, on the device as it is (the status reached by
address), without shaderInt64 and restricted to vk12-floor by VK_LAYER_KHRONOS_profiles (both by
binding): each of rfs_absent_query, rfs_absent_read and rfs_absent_sampler reads zero at flag 1,
its command buffer completes with no error, and its status report states the absent read.

Bind the execution status in the Vulkan executors and prove the bound form on lavapipe:
What: the candidate executors (compute, its replays, render) hand plan_resources the status
buffer they already keep (Guest::status), and plan_resources binds WriteSource::ExecutionStatus
to it, ExecutionStatus::BYTES; device replay has none. runtime_lane::absent_reads checks, for
each of rfs_absent_query, rfs_absent_read and rfs_absent_sampler, the reach the executed pipeline
took (Ran's Reach: a SyntheticBinding::ExecutionStatus binding in its layout or the status
address in its push fields) at both flags, besides reading zero, the command buffer completing
and the report stating the absent read at flag 1. Three tests: the device as it is (address where
it addresses buffers, binding elsewhere), the device without shaderInt64 (binding), and the
device restricted to vk12-floor by VK_LAYER_KHRONOS_profiles (binding; it prints RESTRICTED and
skips visibly without the layer). device::lane_restriction (tests only) builds that restriction
for a committed profile stem, through the same restricting() runtime_restriction now uses.

Why: the translator now binds the status on devices that address no buffer; the executors must
bind it, and the evidence has to show the binding was the path that ran.

Verified on msi-laptop (Linux, lavapipe llvmpipe LLVM 23.1.1, --cfg m2v_cpu_icd, debug,
LP_NUM_THREADS=1): runtime_lane::absent_reads 3/3 with --no-capture: ABSENT-READ-COMPLETED
"reached Address" for the device as it is, "reached Binding" for the other two, RESTRICTED printed
for vk12-floor; clippy --workspace --all-targets --all-features -D warnings clean by default,
under --cfg m2v_cpu_icd and under --cfg m2v_gpu. The whole validation suites run after the
rebase onto the round.

Document the execution status's binding and regenerate the refusal surface:
What: docs/API.md section 5 says how a stage reaches the command buffer's ExecutionStatus (its
device address where the device addresses buffers, else a set-0 storage buffer of its own,
SyntheticBinding::ExecutionStatus, which counts against the stage's storage-buffer limits), and
what happens past a limit: an absent read or a fence is refused as DescriptorCount, and a stage
that would bind it only for the cubic test binds nothing, so the plan refuses a cubic sampler
listed beside it (SamplerBicubicFilter). Section 6's Status bullet says to bind the same status
buffer where a plan asks for WriteSource::ExecutionStatus. reach.tsv's SeqCstFence line now
reads "a seq_cst fence in a vertex or fragment stage without its stores and atomics".
docs/REFUSALS.md is regenerated at 43578ea93: FunctionConstantArgument and SeqCstFence no longer
list devices without buffer device addresses, and lose the sites that refused them; the rest of
the diff is the line moves since the table's last generation (f28f418da).

Verified on msi-laptop: scripts/refusal-surface/refusal_surface.py regenerates the table, then
--check and --missing-reach pass, at 43578ea93 with these docs.

Versions: SEMANTICS_VERSION 1696 -> 1698 and RUNTIME_VERSION 1203 -> 1204. SEMANTICS_VERSION moves:
absent reads and seq_cst fences compile where they were refused, and argument-sampler stages test
the cubic bit through the status. RUNTIME_VERSION moves: the status's binding is planned and bound.
ARTIFACT_FORMAT_VERSION stays: no encoded type or codec changed (WriteSource is not encoded;
SyntheticBinding::ExecutionStatus and Mechanism::SyntheticBinding already existed).
ENGINE_EXECUTOR_ABI stays: the executors bind WriteSource::ExecutionStatus only where a plan asks
for it, and no plan an earlier row recorded asks for it, so running those rows is unchanged.
crates/metal2vulkan-validation/runtime-sources.sha256 holds
d92b3692f9ec6dd09aa276901b3e5e2ca89520a9fe474835a57c7a22aeb4b85e, the hash of this tree's runtime
inputs (runtime-pin.py, which reproduces build.rs's). Version numbers quoted above are the values
the work's branch built with. Each part's Verified lines name the tree it ran at.
2026-10-14 20:17:39 +03:00
Anees Iqbal ecb80e019d Place heap textures needing up to 256 KiB alignment instead of refusing them
A heap's memory started at a multiple of 64 KiB of the runtime's block, and a
heap texture whose image needed a coarser alignment was refused
NotImplemented(HeapTextureAlignment), by heapTextureSizeAndAlign and
newTexture alike. On an RX 7900 XTX that refused nearly every depth texture a
program puts in a heap: four runtime-lane tests failed there on every run,
each with `alignment: 131072`, while the Radeon 780M in the same machine,
under the same driver, passed them.

Measured with a raw Vulkan probe on homelab-um780 (vkGetImageMemoryRequirements,
optimal tiling, attachment|sampled|transfer usage, 11 formats, sides 1 to
16384, 1/2/4/8 samples, one level or full mips), RADV under Mesa 26.0.8:
- RX 7900 XTX: 128 KiB for D16, D32F and D32FS8 images of 8 x 8 texels or
  more; 256 KiB for multisample depth, stencil and color images from about
  128 x 128 texels; single-sample color, storage and BC1 images at most
  64 KiB. Nothing past 256 KiB.
- Radeon 780M: at most 64 KiB for every shape.

The base is now 256 KiB (HEAP_BASE_ALIGNMENT), the largest alignment measured.
The check moves into check_heap_base, which a GPU-free test can reach, and the
typed refusal stays for anything past the base. A heap over host pages
already starts at offset 0 of its own import, which meets any alignment.

Whole units of the base would have pushed the largest heaps past one
allocation: heap_size admits a heap up to maxMemoryAllocationSize in whole
16 KiB, and where that limit is no whole number of 256 KiB the largest heaps
asked more than the device allocates. RADV (4 GiB less 4 bytes) asked a 4 GiB
allocation for every heap from 4 GiB less 240 KiB, with a block's buffer of
addresses past maxBufferSize; MoltenVK (41,747,087,360 on the M3 Max,
9,534,832,640 on the M4, multiples of 128 KiB but not 256 KiB) would have
asked 128 KiB past the limit for its largest 128 KiB of sizes. So a buffer
past half a pooled block (32 MiB) now keeps its own size (buffer.rs's
`placed`). Such a buffer always takes a block of its own, where nothing
follows it; whole units exist only so the next placement in a pooled block
starts where the last ends. Buffers up to half a block still take whole
units, and half a block is a whole number of 256 KiB.

Cost: a heap of up to 32 MiB now starts at a multiple of 256 KiB of its pooled
block and takes whole 256 KiB units of it, up from 64 KiB units, so a small
heap can hold up to 240 KiB more of its block, on every device. A heap or
buffer past 32 MiB takes exactly its size, no longer rounded up. Programs see
no change where their images need 64 KiB or less. On the 7900 XTX the shapes
past 64 KiB now answer 128 or 256 KiB, are placed, and announce
heap-texture-larger-than-metal.

RUNTIME_VERSION 1179 -> 1181: heapTextureSizeAndAlign and newTexture answer
and refuse differently on such devices, heap buffers lie at other offsets in
the runtime's blocks, and every buffer and heap past half a pooled block
allocates its own size (WorkCounts::device_memory_allocated answers it).
runtime-sources.sha256 is re-pinned. docs/REFUSALS.md is regenerated, and the
reach mark's text says 256 KiB.

Tests:
- tests::heap::every_image_alignment_measured_fits_a_heap_s_base (GPU-free):
  the measured alignments fit the base, and one past it is refused typed.
  With the constant back at 64 KiB it fails (Err(NotImplemented(
  HeapTextureAlignment { alignment: 131072 }))).
- tests::heap::the_largest_heap_asks_one_allocation_of_its_device (GPU-free):
  every committed profile's largest heap asks at most one allocation and one
  buffer. With `placed` rounding every size it fails on amd-780m-radv
  (4,294,950,912 bytes asking 4294967296).
- runtime_lane::heaps::the_largest_heap_lies_in_one_allocation: where the
  largest heap is at most 4 GiB, making it grows the runtime's memory by at
  least its size and at most one allocation, with no validation message.
  Without the size fix it failed on the 7900 XTX ("the largest heap,
  4294950912 bytes, took 4294967296 bytes, past one allocation of
  4294967292"). It reserves the memory without touching it: on Iris Xe a 4 GiB
  heap took 0.04 s and a 53 MiB peak RSS; on lavapipe (debug) a 2 GiB heap
  took 127 MiB.

Verified (release, --cfg m2v_gpu, one GPU pinned):
- The heap set (`test(/heap/) | test(/rebind/) | test(/no_copy/) |
  test(/alias/)`, metal2vulkan-validation and metal2vulkan-runtime), before ->
  after: RX 7900 XTX (RADV, Mesa 26.0.8) 176/180 -> 183/183 (the four
  refusals pass); Radeon 780M (same host and Mesa), RTX 3090 and RTX 5080
  Laptop (NVIDIA 615.71.09) and Iris Xe RPL-P (ANV, Mesa 26.2.4) 180/180 ->
  183/183; lavapipe (--cfg m2v_cpu_icd, debug) 134/134. No kernel GPU
  messages.
- Apple M3 Max (MoltenVK 1.4.1): the heap set plus `test(/buffer/)`. Every
  failure fails identically at the base: heap_textures_answer_and_place_as_
  metal_s_do, argument_buffer_intersection_table_is_encoded_at_reflected_field,
  frees_while_the_gpu_is_busy_fail_no_command_buffer and
  every_case_of_buffers_alone_runs_from_a_command_as_its_dispatch_2.
- Full GPU suites: RX 7900 XTX 3528/3531 and RTX 3090 3526/3531. Every
  failure fails at the base or passes on rerun: on the XTX,
  float_denormals_read_as_metal_reads_them and the two generated_executions
  tests, which fail on the 780M too; on the 3090,
  render_commands_and_render_states_run_as_the_executor_compiles_them and
  the_runtime_probe_measures_the_test_device_consistently fail at the base,
  and three timing tests pass on rerun.
- On the 7900 XTX, the heap lane's output shows answers and placements at
  0x20000 and 0x40000 alignment and no HeapTextureAlignment.
- The runtime crate's GPU-free suite: 856/856. Clippy (workspace, all
  targets, all features, and --cfg m2v_gpu) and rustdoc are clean,
  refusal_surface.py --check passes, and the runtime-sources guard passes.
2026-10-12 20:57:59 +03:00
Anees Iqbal 13b279df1b Squash 11203 commits of translator, runtime, and validation work
Rolls up everything since 43c46ac8 into a single commit. Its tree is
identical to the tree of private master at
b3c77f2d2b20a432be10591a2129547c10b1c24b.

- A Cargo workspace of five crates under crates/: metal2vulkan (the
  translator and the metal2vulkan command), metal2vulkan-runtime (the
  Metal API on Vulkan), metal2vulkan-air (the AIR front end),
  metal2vulkan-validation and metal2vulkan-devtools.
- Dual license: GPL-2.0-or-later OR LGPL-3.0-or-later.
- docs/: API, architecture, fast paths, how-to, Metal coverage,
  refusals, runtime porting and validation guides.

Private-Commit: b3c77f2d2b20a432be10591a2129547c10b1c24b
2026-10-11 20:09:13 +03:00