394b4db3f64fbd95b35aab2901fbe76dca8bde28
190
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
1edd55cb98 |
Read a stage-in layout bound with MTLAttributeStrideStatic as Metal does
Plain Metal on the M3 Max (macOS 27.0.1) answers each of the compute encoder's four stride forms bound with MTLAttributeStrideStatic, under a [[stage_in]] layout of MTLBufferLayoutStrideDynamic, with the element at the bind offset for the first element and zero for every element past it (the attribute-stride-* recordings). That is a fetch at the constant's low 32 bits, 2^32 - 1, by the same truncation every other stride takes: element 1 lies 2^32 - 1 bytes on, past the buffer (an ICB command read the real byte there in a buffer that holds it). Ours mapped the constant to "no stride" and read every element at stride 0 (three divergent rows), and refused the inline-bytes form (one refused row). - Runtime: a compute table's stride forms hold the argument's low 32 bits, the constant included (argument_table::per_bind_stride); the plain setters still set none (stride 0), and a render stage's table is unchanged. fetch_reach then sees the constant's real reach. - Bind layer: PushField::StageInStride pushes inline bytes' stride as a buffer's; the NotImplemented(KernelStageIn) refusal for bytes at u32::MAX is gone (REFUSALS.md regenerated). - Translator: a kernel stage-in read that steps by thread position decides exactly whether its bytes lie in the first 2^32 bytes from the bind offset (e * stride + offset + size <= 2^32, without the u32 wrap; fetch::within_reach), and in a view whether the bind residual plus the displacement still fits; past it the read takes the bind offset and yields zero bytes on every device (access::pulled::prepare_within). Before, the wrapped displacement landed back inside the buffer (element 1 at 2^32 - 1 + 4 read byte 3). Removes the four attribute-stride-* rows of known-gaps.tsv. SEMANTICS_VERSION 1981 (the orchestrator's number). Tests: engine_kernel_stage_in::an_element_past_four_gigabytes_reads_zero (every profile, with and without robustness: the constant on both layouts, beside a stride of its own, and a stride of 2^32 - 8 whose element 2 wraps to 2^32 - 16); tests::argument_table:: the_static_constant_is_a_compute_tables_widest_stride. (cherry picked from commit f4d8011ccd1fe723c5192dd58e6b2eef7553fb37) |
||
|
|
2e8e0353b2 |
Regenerate REFUSALS.md for the input-form shadow's refusals
lower/fragment/input_shadow.rs refuses FramebufferFetch where the device lacks the interlock, fragment stores, multisampled storage or the shadow's storage format, and NotImplemented for the shapes it cannot keep Metal's answer in (python3 scripts/refusal-surface/refusal_surface.py). (cherry picked from commit 8a9d1405ec2dc326f1d78fd8831065ac75276e70) |
||
|
|
ba7ed4d150 |
Bless the API signatures and regenerate the refusal surface for the submission checks and HostRam's dma-bufs
Removed: DriverFact::PointerImportsFollowTheirAddress and DriverFact::SubmissionsWithoutSignalsMerge (in metal2vulkan::device and the runtime's re-export). New: HostRam::with_dma_buf, Device::pointer_imports_follow_their_address, the doc(hidden) Device::submissions_merge, fresh_pages_pay, settle_submit_checks and submit_check_report, and WorkCounts submit_checks_run, submit_checks_recalled, submit_check_calls, host_ram_dma_buf_imports and host_ram_pointer_imports_failed. REFUSALS.md: Problem::DmaBuf gains its site in ram_span_as_dma_buf. Verified: scripts/api-signatures/signatures.py --bless and scripts/refusal-surface/refusal_surface.py (both read source only). (cherry picked from commit 027b38e988e93373d58a26b388d0989a98809b33) |
||
|
|
c559ed6f84 |
Docs: the half shadow holds at more than one sample; REFUSALS for the merge's refusals
The extended-range-blends-stored-codes notice (its declaration and the docs/API.md catalogue entry) now says where it is not announced: a color whose half shadow the runtime holds, in a pass of one layer on a device that orders fetch through the pixel interlock alone, at one sample or more, from the pass's clear or (at one sample) its load; and where the codes stay: over lavapipe's input attachments, in a multisampled pass that loads the color, and after a draw the shadow cannot follow. docs/FAST-PATHS.md's word attachment row no longer says an extended-range color keeps its codes at more than one sample. docs/REFUSALS.md regenerated (scripts/refusal-surface/refusal_surface.py): link's second extended_write_mask site and fetch::unordered_extended_fetch. How verified: refusal_surface.py wrote the table with 0 variants without a reach mark or a basis; the catalogue test runs with the runtime suite next. (cherry picked from commit 70691da1d131573dac3a3c4ae4e6436ad48283f3) |
||
|
|
b43ba48ee2 |
Regenerate the signature table and REFUSALS.md
What: api_signatures.tsv gains ComputePipelineProblem, its two variants and DescriptorError::ComputePipeline; REFUSALS.md's RequiredThreads row says only what creation refuses. Why: the new public refusal and the corrected problem doc. Verified: signatures.py --bless and refusal_surface.py on msi (job m3-max-2689). (cherry picked from commit 301047b4dc4f5f4f3a4d1725c9966e152f5b4fb0) |
||
|
|
ee4a6c5b52 |
Bound texture ID placement by the handle table's reach
What: the runtime's set-1 image array capacity (resource_ids.rs `texture_arrays`, which texture placements and texture reservations are checked against) is now the least of the handle table's 65536 entries (bind::HANDLE_TABLE_CAPACITY, within which link sizes every heap array) and the update-after-bind image limits. Before, it was the limits alone. Each array carries what bounds it (`ArrayBound`): a device limit, named in the refusal as before, or the table. An ID past the table is refused Unsupported(ArgumentBufferTextures, NotImplemented), since no heap array on any device reaches it. `texture_arrays` and `check_capacity` are now free functions over the compile profile, so a test reaches them without a device. Why: this is the same gap `sampler_array` had before the samplercount work. MoltenVK reports 1,000,000 update-after-bind sampled and storage images, lavapipe 1,015,808, RADV 8388606, and ANV and NVIDIA more, so a texture reservation between 65536 and those limits was accepted. Yet no set-1 array holds such an ID: a texture placed there reads the neutral through its ID. Placements are unaffected in practice, since Metal's placement limit (16381) lies below the table's reach. Reservations of 65536 and more are now refused where they were taken. Tests: resource_ids::texture_arrays_reach_no_further_than_the_handle_table checks every committed profile: each array is at most the reach, the ID below its count is taken, and the ID at its count is refused naming its bound. It pins MoltenVK, lavapipe, RADV, ANV and NVIDIA to the table and the desktop baseline to its 128 sampled and 8 storage images a stage. Without the fix, the pins fail (moltenvk-m3: 1000000). A new device test, runtime_lane::resource_ids::a_texture_reservation_at_the_handle_table_s_reach_is_refused, reserves texture ID 65536 (refused, not implemented, where the device's limits reach past it) and 65535 (taken), printing a TEXTURE_RESERVATION line. REFUSALS.md is regenerated (check_capacity, 2 sites). Verification runs follow in the branch report. (cherry picked from commit 9629f473e25790aa573b03d6c4419d99127f33ce) |
||
|
|
7d813def6f |
Regenerate the derived tables at stack 35's picks
The private-doc-link mend shortened the degradations! macro's note link and a refusal's doc link to in-scope paths, which moves the macro's template in api_signatures.tsv and one row of docs/REFUSALS.md; no item's signature changed for a consumer. The mesh change runs a partial object threadgroup, so the two mesh-object-draws-partial-threadgroup cases leave the conformance ledger (1378 rows to 1376) in docs/CONFORMANCE-COVERAGE.md, whose conflict the pick resolved to the earlier text. Verified: signatures.py --check, refusal_surface.py --check and conformance-coverage --check pass on this tree; metal-coverage is current. |
||
|
|
c305c66a7f |
Give mesh pipelines Metal's descriptor limits, state queries and refusals
The mesh descriptor gains Metal's fields, with Metal's defaults:
max_total_threads_per_{object,mesh}_threadgroup, max_total_threadgroups_per_mesh_grid,
the two threadgroup-size-is-multiple-of-width flags, payload_memory_length,
max_vertex_amplification_count (1) and required_threads_per_{object,mesh}_threadgroup. The
descriptor key reads every one.
A compiled mesh pipeline carries MeshPipelineMetalInfo (RenderPipeline::mesh_info), and the
runtime's RenderPipelineState answers Metal's five mesh queries from it, plus the two required
sizes. Each thread limit is the descriptor's maximum, else the function's
[[max_total_threads_per_threadgroup(n)]], else 1024, held to the device's own limit where that is
lower: the task and mesh stages' invocations with VK_EXT_mesh_shader, the compute stage's where
both stages run as compute work. The widths are 32. The grid limit is the descriptor's, else the
object function's [[max_total_threadgroups_per_mesh_grid(n)]], else 2^20, held to
maxMeshWorkGroupTotalCount where mesh functions run natively. Without an object function the
object stage answers 0 and 0, where the M3 Max answers 3 and 32 (an accepted difference).
DeviceProfile::emulates_mesh_shading says how a device runs the stages, so a consumer no longer
copies the compile layer's rule; with the getters, no separate per-stage query is needed.
What Metal refuses is refused as Metal's rule, DescriptorError::MeshPipeline with a
MeshPipelineProblem, measured on the M3 Max (mesh_pipeline_limits.m, plain and under
MTL_DEBUG_LAYER): a required size with an axis of 0, past 1024 threads or past its stage's
maximum, or for an object stage without an object function (process ends); a maximum past 1024,
a function maximum other than the descriptor's, a mesh stage's required size of other threads
than its maximum, and a payload past 16384 bytes (creation errors, codes 3 and 2). An
amplification count of 0 is VertexAmplificationCount, as a render pipeline's; one above 1, which
Metal makes, is NotImplemented(VertexAmplification), recorded in FAST-PATHS' known gaps.
payloadMemoryLength widens the object and mesh functions' payload arena past the declared type
(LoweringInputs::object_payload now reaches the object stage too); an object stage compiled on
its own without it is NeedsInput(ObjectPayload). SEMANTICS_VERSION 1971 and
ARTIFACT_FORMAT_VERSION 488 for that and the new artifact field; the runtime's warm record
format 4 for the descriptor's fields.
Docs: the new_mesh_render_pipeline_state doc now says how each device runs mesh stages, and
what it refuses; API.md's accepted differences gain the mesh pipeline rows. api_signatures
blessed (it also records RuntimeFact::PartialObjectThreadgroups from the partial-threadgroup
commit), api_surface lists MeshPipelineMetalInfo and MeshPipelineProblem, REFUSALS.md,
METAL-COVERAGE.md and CONFORMANCE-COVERAGE.md regenerated.
Tests: engine_mesh's a_mesh_pipeline_answers_metals_mesh_queries_within_the_device and
a_mesh_descriptor_metal_refuses_is_refused_as_its_rule over every committed mesh and
emulating profile; the validation lane's
a_mesh_state_answers_metals_queries_and_refuses_what_metal_refuses on a device. Not yet built:
the next steps are the M3, lavapipe and RTX 5080 runs.
(cherry picked from commit d6934967fad363ca2185c49935204141f253b416)
|
||
|
|
5080707c8c |
Document the surface shapes and BC textures the runtime makes
linear_plan.rs gains **Block-compressed surfaces** and **Beyond the plane's rows** (the probe's measurements and what the runtime holds); new_texture_with_iosurface_plane names the new shapes and the SurfacePlaneShape refusal; TexelsPastBufferLength records where the M3 Max puts rows past a surface's end and that the x86 Macs' are unmeasured; FAST-PATHS.md's known gaps record the refused shapes and the taller-than-plane divergence on the x86 Macs, which IoSurfacePlane cannot hold as it carries no plane height. Regenerated docs/REFUSALS.md and api_signatures.tsv (RuntimeGap::SurfacePlaneShape). Verified: refusal_surface.py (0 variants without reach or basis); signatures.py --bless. Rustdoc runs in the next M3 job. (cherry picked from commit d3bb1dfa2aab94728518529a0b2020da4a3e76aa) |
||
|
|
a0bebe78f1 |
runtime: copy runs of a guest RAM to and from a buffer on the GPU, from the chunk imports
`BlitCommandEncoder::copy_from_host_ram(ram, runs, destination, destination_offset)` gathers runs
of a `HostRam` the device uses into consecutive bytes of a buffer, and
`copy_to_host_ram(source, source_offset, ram, runs)` scatters them back (a runtime extension:
Metal has none). A surface that is a scatter of guest pages is copied straight from the RAM's
64 MiB chunk imports, with no view mapped per surface (one mmap per run) and no import made per
surface.
How: adjacent ascending runs merge, descending neighbours stay apart; runs are cut at chunk ends;
the 4 KiB pages become a table in the command buffer's upload arena, and each chunk the runs touch
takes one dispatch of the new `bind::pages_copy_module` (more only past the storage-buffer range
or the workgroup count). A chunk not imported yet is imported, or its pending import waited for,
as an object over it does.
Ordering: each chunk a copy uses gets a resource key placed over the chunk's host bytes in the
host-alias placements, the way no-copy buffers and heaps are placed, so the copy's chunk uses
(joined to at most 16 ranges per chunk) order against other copies and against every no-copy
object over the RAM's own addresses, in one encoder and across encoders; the buffer side is
tracked like any blit. A scatter's writes reach the RAM's dirty log as the GPU's in place, so a
copied backing over those pages takes them in at its next commit. Objects made over another
mapping of the pages (a view resolved through `with_runs`) are not ordered against the copies.
Refused with `Problem::HostRam`: an empty run, one off 4 KiB, one outside the RAM, a RAM the
device does not use, buffer bytes off a 4-byte word; no host import is `Unsupported`; bytes past
the buffer are `RangeOutOfBounds`. Replayed at rebinds (`BlitCall::HostRamCopy`). New counters
`host_ram_copies`, `host_ram_copy_bytes`, `host_ram_copy_dispatches`. README, HOWTO, the
API signature rows and docs/REFUSALS.md updated.
Verified:
- On this M3 Max (MoltenVK), --cfg m2v_gpu under nextest: the five new device tests
(`tests::host_ram_copy_device`: round trips byte for byte over ascending, descending, adjacent,
repeated and chunk-crossing runs into Shared and Private buffers; CPU writes before the commit
gathered and a scatter's bytes in the pages after completion; the two hazard cases in one
encoder and across encoders; a copied backing over the pages taking a scatter at the next
commit; the refusals) and the ten `tests::host_ram_device` tests: 15 passed.
- Negative controls, each a saved build: merging descending neighbours fails
`adjacent_ascending_runs_merge_and_descending_ones_stay_apart` and
`a_gather_and_a_scatter_move_every_runs_bytes_in_order` ("the gathered bytes"); not placing the
chunk keys over the host bytes fails
`copies_are_ordered_against_a_no_copy_buffer_over_the_same_pages` ("a later reader sees the
scatter"). The first control found the test pattern repeating every 1 KiB, so a page swap
went unseen; the pattern now differs per page.
- The `host_ram::copy` unit tests (merge, refusals, chunk cuts, the plan, the joined uses) and
`consumer_auto_traits`; clippy --workspace --all-targets --all-features -D warnings, plain and
--cfg m2v_gpu; rustdoc -D warnings; `signatures.py --check` after the bless; the refusal
surface `--check`.
- The ignored release bench `tests::host_ram_copy_bench` on the M3, a 3840x2054 BGRA8 surface
(31,549,440 bytes, 31,551,488 in whole pages) scattered over 1 GiB of shared RAM: 7703 4 KiB
runs (5490 descending neighbours, 7279 runs after the merge) take 16 dispatches, 0.35 ms of CPU in the call, 0.59 ms of GPU and 0.64 ms from commit to completion
for a gather (scatter 0.37 / 0.58 / 0.64). The view path at the host's 16 KiB page (1926 runs:
a view mapped run by run, a buffer `with_runs`, a buffer-to-buffer copy, the release) takes
1.58 ms to map, 2.36 ms to make the buffer, 0.99 ms commit to completion and 0.78 ms to
release; the gather of the same 1926 runs takes 0.14 ms CPU and 0.60 ms commit to completion.
Ported onto gate/stack27, where the device's thread imports a window of chunks ahead of the
objects (paced, with the memory lock released, short of maxMemoryAllocationCount and giving back
what no object took). The conflict was `RamOnDevice`'s fields alone: the copies' `ChunkKeys` sit
beside the window and its wake, and the old cursor is gone. The copy still takes each chunk
through `RamOnDevice::chunk(.., By::Object)`, the objects' own path, which now moves the window
past it, wakes the thread and clears the chunk's untaken mark; there is no second import path. The
copy module docs and HOWTO say so. The ignored release bench waited for every chunk imported
ahead, which the window never does; its warm-up copy now imports the chunks the runs touch.
The verification above was on the old base; this tree's is in the commit that follows.
(cherry picked from commit 923718777c198bef526dd07f701fc71a71e07b00)
(cherry picked from commit fa00224f7b29ab0359c8305a47da9c9273fc5d37)
|
||
|
|
61a9508e92 |
Build visibilityResultType: Accumulate takes a pass's results into the buffer's words
RenderPassDescriptor gains visibility_result_type (MTLVisibilityResultType: Reset, the default and today's behaviour, and Accumulate). Under Accumulate no query result is copied over its offset's word: every query of an offset, the first one too, is copied into the upload region the continuations already use, and the crate-owned combine takes them into the word as the buffer holds it. The combine already loaded the destination word as its accumulator, so Accumulate is the first query becoming one more source. A `Boolean` word ORs the device's results in; a `Counting` word is summed in through a new table mode of the combine, into the word's low 32 bits alone, wrapping there, its high 32 bits kept (ContinuedResult::low_half / in_low_half). That last part is what the M3 Max answered when recorded: 0xffff_fff8 plus 16 samples writes 8, and 0xffff_ffff_ffff_fff8 plus 16 writes 0xffff_ffff_0000_0008. A plain 64-bit sum was divergent there. An offset set with no draw after it keeps its word, because a query with no draw adds 0. Where a no-copy buffer's bytes start off a multiple of 8, so the results land in an upload region, the words are now copied into that region before the combine (Landing::inward). Reset records exactly what it did before. Conformance: RenderPass gains visibility_type (typed()), and words() appends it only where it is not Reset, so existing fingerprints read as before. Both sides set it. There are four new visibility cases, recorded on the M3 Max (macOS 27.0.1): visibility-counting-accumulate (two command buffers; words 100/5/7/0xffff_fff8/u64::MAX-7), visibility-counting-accumulate-one-command-buffer (two passes in one command buffer, read once), visibility-counting-accumulate-revisit, and visibility-boolean-accumulate (words 0/2/3 under covering and non-covering draws, an offset set with no draw, then a second command buffer). The family's acts key states the type, and a joined shape adds a command-buffer input. Cost and timing records for the new cases are not written here. Lane tests (runtime_lane): accumulated_counts_add_to_the_words, accumulated_booleans_or_into_the_words, and host_bytes::accumulated_visibility_results_land_where_their_bytes_lie. Unit tests: the combine's accumulated_counts_are_summed_into_the_low_half, its plan's table mode, and the type's raw values. Coverage: coverage.tsv marks MTLRenderPassDescriptor.visibilityResultType implemented (its unused "visibility" group is removed), and METAL-COVERAGE.md is regenerated. MTLVisibilityResultType joins the enum table, so metal_enumerators.tsv and CONFORMANCE-COVERAGE.md are regenerated. The API signatures are re-blessed. REFUSALS.md is regenerated: VisibilityResultType::from_raw is one more UndefinedValue site. The regeneration also picks up two bind/graphics.rs sites the committed file was missing. The degrade docs (landed results, Boolean) state Accumulate. Verified on the M3 Max under MoltenVK 1.4.2: - The 52 visibility-touching lane tests pass: visibility, host_bytes, depth_never, amplified_draws, degrade_notices and the framebuffer_fetch split pass. - The visibility family's replay is all announced (no divergence), after the low-half change. - Negative control with Accumulate forced to Reset: all three Accumulate lane tests fail, and all four new cases replay divergent. - Negative control with no inward copy: the landing test fails at 4 bytes past a page (2 read 0, 100 read 16). - Before the low-half change, visibility-counting-accumulate replayed divergent at words 3 and 4. - The combine's low-half test fails on the interpreter without the high-half select ([8, 1] for [8, 0]). clippy (plain and --cfg m2v_gpu), rustdoc and scripts/api-docs are clean. SEMANTICS_VERSION: no translated shader changes, but the owned combine module's words do (main's call). RUNTIME_VERSION and the runtime-sources pin are not touched here. (cherry picked from commit 1c172968ad6492cebcae2a568fc99e90565d4d11) (cherry picked from commit 9f47ebcf006920f7561a16a77f77e422de7201c1) |
||
|
|
51c7059a40 |
Regenerate docs/REFUSALS.md: KernelStageIn's site and the rebind_slots range refusals
python3 scripts/refusal-surface/refusal_surface.py on this tree. Two rows move: - KernelStageIn's runtime site is indirect_execute.rs's dispatch now, where the kept recordings of unchanged indirect commands moved the refusal (two commits back), not record; - BufferRange and DescriptorRangeExceeded gain bind/graphics.rs's rebind_slots, a site the base had added without regenerating the table. The device replay's ReplayFaults::ADDRESS was no refusal, so its removal moves no row; tests/api_surface.rs names ReplayFaults alone, and api_signatures.tsv dropped the constant with it (scripts/api-signatures --check passes). Needs no version bump: a generated document. (cherry picked from commit 07d7e05255a3d15ba98094389a680e96440eefa0) (cherry picked from commit 3d66d7436109ffbd80c5e6adf0ef1d92b26d70e5) |
||
|
|
510e0c0cca |
Share VkQueues between command queues where the GPU idles at each switch, with an unshared opt-out
What: a new DevicePolicy switch, queue_sharing: QueueSharingPolicy { Adaptive (default),
PerQueue }; exact_answers() selects PerQueue. Under Adaptive, on a device whose own self-check
finds its GPU idle when consecutive work comes from another VkQueue, a command queue chooses its
VkQueue again each time it makes a command buffer while it holds no other uncompleted one (the
slot take with held.all == 1, under its slots lock): it joins the busy VkQueue of its family
whose oldest batch has run under 0.5 ms, the most batches in flight first, then the latest
submission (Device::pick_vk_queue: one pass of atomics over the round robin's VkQueues, no lock).
A queue whose batch ran over 2 ms as its VkQueue's oldest is marked long by the waiter that saw
it complete, under the completion's pending lock, before the turn that finishes it
(command_buffer/completion.rs); no queue joins a long queue's VkQueue, and the long queue moves
once more at its next idle point, to the least recently used idle VkQueue no long or unshared
queue holds. Its mark moves with it and a dropped queue subtracts its marks. Presenting queues and
a queue that lent its VkQueue (with_vk_queue, pinned from then on) never move. A queue's vk_queue
is now an atomic; everything that reads it does so between a command buffer's make and its
completion, when no move can happen.
The self-check (queue_switch_check.rs) is the runtime's own, kept like the in-place check's, not
a DriverFact row: on a thread of its own, once per driver, release and runtime, 24 rounds of two
timestamp-only batches held behind one host-signalled gate on two same-family VkQueues against
24 on one; the switch cost is the difference of the median gaps; Idles above 20 us, DoesNotIdle
below, Unchecked where the device has no calibrated timestamps, no two VkQueues of one family, or
a run failed. Its verdict is written as one record in the shader cache's content directory and
read back as the next device of the same driver, release and runtime is made. Before the verdict,
every queue keeps the VkQueue it took at creation.
Device::new_command_queue_unshared(count): a queue that never moves and that no adaptive queue
joins; a queue already on its VkQueue leaves at its next idle point. Placement where the device
shares: a round-robin VkQueue no command queue holds, least recently used first; else one no
long or unshared queue holds, the fewest queues first; else the round robin's next. Why that
order: an empty VkQueue gives isolation at once, with no wait for another queue's idle point; of
the empty ones the least recently used is the one least likely to hold a moving queue's work in
flight (a queue that just left it may still have batches there, and the unshared queue would
wait behind those); where none is empty, the least held one has the fewest queues to move off,
each at its own next idle point, so isolation arrives soonest, and a VkQueue a long or unshared
queue holds is never taken since that would put the opt-out behind exactly the work it opts out
of. A queue's claim of a VkQueue and an unshared queue's are ordered so that two at once never
both succeed: each counts itself there first, then reads the other's count (SeqCst both sides).
Under PerQueue, and where the device does not share, it is
new_command_queue_with_max_command_buffer_count. A count of 0 and a lost device are refused.
Why: NVIDIA 615.71.09 on the RTX 5080 Laptop GPU leaves the GPU idle 56 to 62 us whenever its
next work comes from another VkQueue, so one VkQueue per command queue, round robin, capped eight
threads' one-draw command buffers at 25,800 to 29,500 a second (GPU idle 60% of its time at the
switches), where one VkQueue ran 54,700 to 58,700 (the audit that set this design). Moving only
at idle points keeps every queue's own order without a cross-queue fence. The cost is the
runtime Degradation kind QueueSharing ("queue-sharing", performance), announced once per device
at the first join, in CommandQueue::command_buffer on the making thread: the first long command
buffer of a queue that shared holds the command buffers committed behind it on its VkQueue for
its whole length. The opt-out exists so a compositor never pays even that one stall.
Counted: WorkCounts::queue_moves, queue_joins, queues_gone_long, long_queue_settles,
queue_moves_off_unshared, joins_withheld_from_unshared, queue_switch_checks_run and
queue_switch_checks_recalled. The policy keys no profile (tests::fast_paths), so
SEMANTICS_VERSION does not move. Docs: FAST-PATHS row, docs/API.md (the policy and the notice
catalogue), the runtime README (the opt-out, with_vk_queue's pin), queue.rs's module doc on
isolation; REFUSALS regenerated (the new site of MaxCommandBufferCount); api_surface and
api_signatures (additions only). The example queue_share runs the workloads under either policy.
Verified: cargo clippy --workspace --all-targets --all-features -D warnings, and the runtime and
validation crates with --cfg m2v_gpu; RUSTDOCFLAGS=-D warnings cargo doc --workspace
--all-features --no-deps; nextest of tests::queue_share (the choice, settling, the unshared order,
the record), tests::fast_paths, tests::degradation*, api_surface, work_counts: 66 passed. On the
RTX 5080 Laptop GPU (release) the check answered Idles at 51.3 us, and its form measured 49.0 to
50.7 us in five more runs, where a chained form measured 53.2 to 59.3 us. The device tests
(tests::queue_share_device, runtime_lane::command_queues::a_queue_joining_...) are not yet run
on a GPU in this commit.
(cherry picked from commit a2f17a5132faf0312fb3953d634e21c927cde62e)
(cherry picked from commit 862b2cb49a9481d0a2a19fb1bc3acec79932d1bd)
|
||
|
|
888dbbbf2f |
Refuse each constants-block record outside the typed model by LLVM's name
What: `Feature::Constant { code: u32 }` becomes
`Feature::Constant { record: ConstantRecord }`, in the front end and the
translator, which re-exports the new `ConstantRecord`. ConstantRecord is
non-exhaustive, one variant per LLVM name:
- Select, ExtractElement, InsertElement, Compare;
- ShuffleVector (CE_SHUFFLEVEC and CE_SHUFVEC_EX);
- BlockAddress, UnaryOp, DsoLocalEquivalent, NoCfi, GepWithInrange;
- PtrAuth (PTRAUTH and PTRAUTH2), Byte (BYTE and WIDE_BYTE);
- PtrToAddr: a CE_CAST of `CAST_PTRTOADDR`.
Each record is matched from its code (`codes::cst_unsupported`). A code
LLVM does not define stays `UnknownRecord`.
A refusal now reads `Constant { record: Select }` where it read
`Constant { code: 13 }`. The names and codes come from
`LLVMBitCodes.h` of the local LLVM 21.1.8 and 23.1.4 toolchains
(`ConstantsCodes`, `CastOpcodes`).
WIDE_INTEGER stays malformed, on purpose, with a comment that says why.
LLVM writes it only for an integer wider than 64 bits. The type table
already refuses those types (`Feature::Type`). So a WIDE_INTEGER that
reaches the constants block has a type of at most 64 bits, which LLVM
never writes.
Why: a refusal should name what it refuses. The inline assembly record
(code 30) reached a consumer as a bare `Constant { code: 30 }`; it now
decodes, and this names the rest of the class.
Verified (debug):
- metal2vulkan-air suite passes, including `constant_errors_are_typed`:
- each of the 15 refused codes yields its name;
- CE_CAST opcode 13 yields PtrToAddr, opcode 14 is malformed;
- WIDE_INTEGER of an i32 is malformed;
- code 60 is UnknownRecord.
At the base the test does not compile (no ConstantRecord), and the
refusal there was the bare code.
- The translator's api_surface, api_signatures (blessed: the new enum,
its variants, the changed variant) and refusal_surface tests pass.
- clippy -D warnings, workspace, all targets, plain and --cfg m2v_gpu.
- docs/REFUSALS.md regenerated (the row's doc text).
The census changes no outcome: no private-corpus row was refused with a
constants-block code at d3e66f9415 or after the bit-manipulation change
(nvidia-rtx5080-laptop and moltenvk-m3).
SEMANTICS_VERSION 1954 -> 1956 (a refusal's class changes): the lane's
value plus one after f19e887e4a takes 1955.
Golden tables: none move (no fixture holds such a record).
(cherry picked from commit 2af3e7891ee1ce7893107ff69f32ea879a06a56c)
(cherry picked from commit 94412279d2b277a2b9cfc11a83fc1e231ef91ecb)
(cherry picked from commit 3f5560c3fd7da0edab9a10d6b951986d8fcc6f80)
|
||
|
|
1e44dcf8da |
Drop the call of MSL's empty inline assembly at decode: asm sideeffect "", "" of void ()
What: decode drops a call whose callee is the inline assembly expression `asm sideeffect "",
""` at the call type `void ()`, the way it drops the markers: the call takes a record number
but no instruction. The match is structural and exact:
- the call type is `void ()`, not vararg, with no arguments;
- the template and the constraint string are empty (no operand, result or clobber);
- `sideeffect` is the only flag (no alignstack, inteldialect or unwind).
Any other inline assembly stays an indirect call through its constant. post_check refuses it
as InlineAsm by name where an entry reaches it.
Why: MSL accepts exactly one asm statement, an empty `asm("")` / `asm volatile("")`. A
template, an operand or a clobber is "illegal asm statement" (Metal 32023.922). That statement
always compiles to this call, attributes {convergent nounwind}. It assembles to no
instruction and names nothing it reads or writes. Its `sideeffect` only constrains Metal's
optimizers: they may not remove it or move a memory access across it, and a loop holding it
is kept. A shader generator writes it into loop bodies for that reason. No value a race-free
program computes depends on it. The decode-only refusal of the previous commit still ended
the consumer's VM, so the drop is what fixes their S1. Refusing it would refuse every
pipeline whose generator writes it.
The edge, documented in docs/API.md's accepted differences ("Inline assembly"): a racy spin
loop over plain (non-atomic) memory could tell the barrier is gone, and MSL's memory model
leaves that loop undefined. A loop with a visible effect runs every iteration either way.
The drop records no note and no degrade: it is no precision difference, no value changes.
Fixture: engine/kernel_inline_asm's asm_in_loop now stores every partial sum, the final sum
and its iteration count. The trip count comes from a buffer. All three entries translate.
REFUSALS.md is regenerated: InlineAsm's doc and its reach mark, now `none`, since only
hand-written AIR can hold another asm.
Verified (M3, macOS 27):
- engine_inline_asm, through both llvm-as and xcrun metal-as:
- asm_in_loop, asm_in_helper and asm_free translate, link and validate on all 19 committed
profiles;
- asm_in_loop on the CPU interpreter with n = 6 over 4 threads writes every expected word
in both scheduling orders: every iteration stored;
- synthetic modules with "nop", "~{memory}", an "=r" result, no sideeffect, and alignstack
each refuse as InlineAsm naming the expression; the empty one translates.
- Negative control: with the drop disabled, all three engine tests fail.
- metal2vulkan-air suite: 492 pass.
- metal2vulkan: the air_input, air_canon and air_abi sweeps and the api surface and
signatures checks pass. The text-shape sweep discounts the dropped call, as it does the
markers.
- clippy -D warnings in both configurations.
- Golden printout of kernel_inline_asm re-blessed: only that file.
Still owed a bless on development, new rows only:
- golden_hashes.tsv: the fixture's cells, all new;
- public_fixture_expectations_engine.tsv: 2 fixtures.
SEMANTICS_VERSION stays 1950, landing together with the previous commit.
(cherry picked from commit 53c6faaf4d2215fc3e629b39803f47979d71f765)
(cherry picked from commit f9361582833d1f5ca0c151d42d68e3cfa7e228af)
|
||
|
|
6e67fd2a08 |
Decode inline assembly constants; refuse a reached call of one as InlineAsm
What: the bitcode reader now decodes CONSTANTS_BLOCK record 30 (INLINEASM, LLVM 13+, which
names its function type) and the older spellings 18, 23 and 28 (typed by their pointer's
pointee) into a new constant, Const::InlineAsm, which keeps the template, the constraint
string and the four flags as written. A call through it stays Callee::Indirect. Canon's
post_check refuses such a call that an entry reaches as Unsupported(InlineAsm), not
implemented, naming the expression (`asm sideeffect "", ""`). An entry that reaches none
translates, even when other functions of its module call assembly.
- The verifier holds the constant to LLVM's rules: a `ptr` in address space 0, never another
constant's operand or a global's initializer, and only ever a call's callee.
- A record that does not fit its spelling is MalformedRecord: an undefined flag bit, a
function type that is none, a string past the record, a byte above 255, a trailing operand,
or an old spelling over an opaque pointer.
- Feature::InlineAsm is new in both crates (REFUSALS.md regenerated, reach mark `app`).
- The validation AIR writer spells the constant back.
- The constant interner charges the strings to the ledger.
Why: the consumer's sweep refused a whole render pipeline as `Constant { code: 30 }` (a
WebGPU deferred-rendering page in Safari), so the pass drew nothing. The record was refused
as it was read, so every entry of the module was lost, whether or not it called the assembly.
MSL accepts exactly one asm statement: an empty template with no operands and no clobbers.
`asm("nop")`, `asm volatile("" ::: "memory")` and `asm volatile("" : "+r"(x))` are all
"illegal asm statement" (Metal 32023.922). It always compiles to `call void asm sideeffect
"", ""()`, attributes `convergent nounwind`.
Fixture: engine/kernel_inline_asm, our own MSL, holds three entries.
- asm_in_loop: the statement in a loop body.
- asm_in_helper: the statement in a noinline helper.
- asm_free: no assembly of its own.
Its .ll and .air.ll are from scripts/regen-air-fixtures (LLVM 21), and its golden printout
is blessed (tests/air_input/kernel_inline_asm.txt, only that file changed).
Verified (M3, macOS 27):
- New reader tests: every spelling decodes, every malformed form is typed, and an aggregate
holding the asm fails verification.
- New engine tests, through both llvm-as and xcrun metal-as: asm_free translates, links and
validates on all 19 committed profiles; asm_in_loop and asm_in_helper refuse as InlineAsm by
name.
- Negative control: with record 30 refused as before, all four tests fail.
- metal2vulkan-air suite: 492 tests pass.
- metal2vulkan: the air_input, air_canon and air_abi sweeps and the api surface and
signatures checks pass.
- metal2vulkan-validation fixture, writer and audit tests: 74 pass.
- clippy -D warnings in both configurations, plain and --cfg m2v_gpu.
Tables owed a bless on development, new rows only:
- golden_hashes.tsv: 114 new cells, 3 entries x 19 profiles x 2 spellings.
- public_fixture_expectations_engine.tsv: 2 new fixtures.
SEMANTICS_VERSION 1950: refusals change class (Constant -> InlineAsm, or a translation).
api_signatures.tsv is blessed: additive (the InlineAsm struct and variants). A consumer that
matches Const or Feature exhaustively must add the new variants.
On the lane: SEMANTICS_VERSION is 1953 here, after the specialization folding's 1952.
(cherry picked from commit 8b418fbd6c)
(cherry picked from commit c8a7e910204a6cedad2b257a10cb095d83c213e3)
|
||
|
|
fd7c93af53 |
Run a command buffer's completion-seen handlers where its completion is seen
What: `CommandBuffer::add_completion_seen_handler`, a runtime extension with no Metal counterpart. Its handlers run as the command buffer's transition to `Completed` or `Error` runs, right after its status, error and GPU times are final, before its completed handlers and before `wait_until_completed` returns. A transition with completion-seen handlers and no completed handler runs where seen (`Transition::where_seen`, `Run::runs_where_seen`), on the queue's waiter, as a plain one does: no handler-pool turn. Where the transition is posted (a completed handler, an earlier transition of the queue in its context, a deallocator of the program's held), the handlers run in it on the handler thread, so they keep the queue's commit order against every completed handler. A wait in one for what has not happened is refused with the new `DeadlockCause::CompletionSeenHandler`, as a submission handler's is, wherever it runs. `Contexts::run_here` takes the predicate its caller may run: the waiters and the scheduler (`exit_guard::serving_completion`) run where-seen items, any other thread plain ones only. Why: the consumer's per-command-buffer completion pays a handler-pool wake after the waiter (about 100 us from an idle CPU on the RTX 5080 laptop, and its p90 tail). Its completed handler is short and posts a record; moved into a completion-seen handler, the command buffer finishes on the waiter with one wake fewer. Order choice: the handler runs inside its transition, never ahead of it, so a command buffer's completion-seen handler cannot run before an earlier command buffer's completed handler on the same queue's context; it runs at the turn only where that context holds nothing else. Counted: `WorkCounts::completion_seen_handlers_run` and `completion_seen_handlers_where_seen`. Verified (M3 Max, MoltenVK, under the GPU lock): `tests::completion_here` (the new `a_completion_seen_handler_runs_where_the_completion_is_seen`: 20 of 20 ran on `metal2vulkan-queue-wait-*`, status `Completed`, GPU end positive, own completion wait refused, own scheduling wait returned; with a completed handler 0 of 20 where seen, each before the completed handler), `tests::own`, `tests::contexts` (the new where-seen run_here test): 24 passed. Negative control: with completion-seen handlers making the transition not where-seen, the new test fails (0 of 20). Workspace clippy (all targets, all features) and runtime clippy under `--cfg m2v_gpu` clean. api_signatures blessed, docs/REFUSALS.md regenerated. (cherry picked from commit bb7fd805045a9903a3a1ae06595e264ad771049c) |
||
|
|
66d39ceb8e |
Regenerate the refusal surface for buffer_into_texture's sites
What: docs/REFUSALS.md regenerated (python3 scripts/refusal-surface/refusal_surface.py). Three refusals' sites (OverlappingSurfaceRows, MultisampledBufferCopy, Copy) now name blit_texture.rs's buffer_into_texture, where the previous commit moved copy_from_buffer_to_texture's body so a fill's row copies share it. Why: the generated surface names each refusal's building function; no refusal, RuntimeGap or basis changed (0 variants without a reach mark, 0 without a basis). (cherry picked from commit ead4b73a198ad597b502de5f20b246c64c9424c2) |
||
|
|
9613166920 |
Document the video plumbing; regenerate the refusal surface and the signatures table
- crates/metal2vulkan-runtime/README.md: the extra_queues option, the feature structures the
listed video extensions take, DeviceHandles' extra queues and the sharing rule for them, the
shared event's semaphore (signal-index counter, vk_wait, reserve_vk_signal), plane textures
over the consumer's VkImage and their refusal, and Buffer::vk_host_memory.
- docs/REFUSALS.md regenerated (python3 scripts/refusal-surface/refusal_surface.py) for
RuntimeGap::VkImagePlaneCopy and WrappedImageProblem::{Plane, PlaneFormat}; reach.tsv marks
the gap `none` (a runtime extension's path). 0 variants without a reach mark or a basis.
- crates/metal2vulkan/tests/api_signatures.tsv blessed: 28 added records (ExtraQueue,
VkEventWait, VkEventSignal, VkHostMemory, the new fields, methods and variants), none removed
or changed.
- The extra-queue device test prints the video features enabled through the runtime's own
query (listed_structures, listed_reported) and asserts each required one is on where its
extension is enabled.
docs/METAL-COVERAGE.md and docs/CONFORMANCE-COVERAGE.md check current.
(cherry picked from commit bb2a4c2c6101458026253461402ac463c1bcb323)
|
||
|
|
bd264821bf |
Regenerate REFUSALS.md for the draw-shape sites
The per-draw changes moved RenderState's scissor check from set_scissors to scissor_rects, and the cross-encoder shape memo's layout view now builds TileAtSampleCount too. refusal_surface.py --check passed with the old site lists (it does not compare them), so the table went stale. Regenerated with python3 scripts/refusal-surface/refusal_surface.py; the diff is the six site-list lines alone. (cherry picked from commit ed08da17f6ca8d1f7714f76e02053c8ae68d6583) |
||
|
|
1210972f03 |
Hold multisampled word-format textures in their word's format
Metal makes 2- and 4-sample textures of R8Unorm_sRGB (11), A1BGR5Unorm (41), ABGR4Unorm (42) and RGB9E5Float (93) for every usage, memoryless included (our probe msaa_word_formats.m, M3 Max, macOS 27.0.1). The RTX 5080 samples these formats but renders none, so Vulkan states one sample for their images and the runtime refused each at creation (TextureSampleCount, FramebufferColorSampleCount(4)). What changes: - image_plan::word_samples: where the device samples the format, renders it at no count and renders the word's format (R8_UINT, R16_UINT, R32_UINT), a multisampled texture's image is the word's format, mutable to the format's sampled view (and an 8-bit sRGB format's UNORM twin, for its resolve). Every sample holds Metal's word by construction: the existing word lowering writes it, clears write Metal's clear word, reads decode through the format's view, copies are bitwise. Shader writes stay unavailable (Metal writes no multisampled texture from a function). A device that renders the format keeps its native image. - The resolve of such an attachment is the crate-owned one: Metal's for RGB9E5Float and 8-bit sRGB, a near-equivalent within one code for the packed formats, announced as the new Degradation::WordResolve (word-resolve). The NotImplemented(Format) refusal of word resolves in resolve.rs is gone; an attachment that takes neither input attachment usage nor the copy is still refused. - DeviceOptions::withheld_attachment_formats (doc hidden, a test hook): a device made with formats' color attachments withheld, so the word path runs on MoltenVK, which renders all four. - RUNTIME_VERSION 1721. Docs: API.md (word bullets, the multisampled word paragraph, the word-resolve catalogue entry), FAST-PATHS known gaps (word resolves no longer refused), word.rs, image_plan.rs and resolve.rs module docs; runtime-sources pin recomputed. Routes over the committed profiles (tests::word_samples, pinned): the word for all four formats at 2 and 4 on NVIDIA's three profiles, for R8Unorm_sRGB and RGB9E5Float on ANV's four, and RGB9E5Float at 4 on the gate's lavapipe; native on MoltenVK and RADV; refused where the word's format renders one sample or the textures take no such count (swiftshader, lavapipe's profile, the floors). Verified: - cargo nextest run -p metal2vulkan-runtime --all-features: 1188 pass (the three word_samples planning tests among them). - Device lane runtime_lane::word_samples_msaa on the M3 Max through MoltenVK (--cfg m2v_gpu, maclock), new owned fixture wsm_samples: the device as it is (each format natively) and with the four attachments withheld (each held in its word, printed per format). On the word path every stored sample is Metal's word (all 32 or 64 per shape), reads decode them, the sRGB and RGB9E5 resolves are Metal's in every pixel, the packed resolves within a code (7-9 of 16 pixels exact after a draw, 13-16 after a load), a packed blend's words Metal's in every sample. word-resolve and shader-resolve announced. Negative control: with word_samples disabled the lane fails. - clippy -D warnings (default and --cfg m2v_gpu), rustdoc -D warnings, private intra-doc links at their ceilings, refusal_surface --check, api_signatures --bless (DeviceOptions field, Degradation::WordResolve added), METAL-COVERAGE and CONFORMANCE-COVERAGE --check current. Not in this change: the golden tables for the new fixture (golden_hashes, the engine inventory, the air_input printout) are re-blessed on development. Blends of an 8-bit sRGB or RGB9E5Float word stay refused as the device lacking the format, as they are at one sample. (cherry picked from commit ad8b94cd840f3d0bf4bb9552904fbdf2f253b9af) |
||
|
|
81441ca877 |
Regenerate the surfaces for pull-model interpolation
- RUNTIME_VERSION 1719: the runtime answers supportsPullModelInterpolation and refuses a draw reading an interpolant at a sample at custom positions. - scripts/metal-coverage/coverage.tsv: supportsPullModelInterpolation implemented (DeviceProperties::supports_pull_model_interpolation); docs/METAL-COVERAGE.md and docs/CONFORMANCE-COVERAGE.md regenerated. - docs/REFUSALS.md regenerated: feature::PullModelInterpolation and gap::InterpolateAtSampleWithPositions (reach rows in reach.tsv). - crates/metal2vulkan/tests/api_signatures.tsv blessed: additions only but Query::ALL's length (8 to 9) and value. - crates/metal2vulkan-runtime/README.md: the query and what differs. - runtime-sources pin recomputed (pin-compute.py). Verified: refusal_surface.py --check, signatures.py --check, metal-coverage --check and conformance-coverage --check all current. (cherry picked from commit 2dcbbf39b6e5caeb3e87079d7f2f36540ceb0dd0) |
||
|
|
b3d483fd72 |
Draw triangles' wide edges as bands, and refused bands at the nearest width
Metal draws a triangle in fill mode Lines at a width other than 1 as its three edges, each the line parallelogram, facing as the triangle does and culled by it, its flat inputs from the provoking vertex (the probe's `edges` case, committed with the lane before this). The runtime drew those edges with the device's lines, at the nearest width they draw (1 pixel on MoltenVK), announced. Translator: the band variant takes a primitive (`BandPrimitive`, in `VariantKey::line_band`, `LineBandState::primitive`, `BindState` and `BindShape::line_band`). A triangle's patch is its three vertices in the quad domain at outer levels (11, 1, 6, 1) and inner levels (3, 2): the inner ring degenerates to a segment, so the spec's deterministic fans from its two vertices cover the u = 0 and u = 1 edges, and the evaluation stage places those fans' vertices at the corners of the edges' parallelograms (from the vertex of the largest w, which never moves at the near plane), every other triangle degenerate. The band faces as the triangle (the sign of its homogeneous determinant, a zero-area one back) by turning the minor axis, so the draw's own cull mode, front face and depth bias apply. `LineBandState::PATCH_CONTROL_POINTS` gives way to `BandPrimitive::patch_control_points`. A pure test checks the fan tables against the spec's triangulation: every triangle is degenerate or one of the nine that cover the parallelograms once, and each winds as a line's band, turned by the facing. Runtime: a triangle's edges (lists, strips, fans, Metal's private triangle types) route as lines do: the device's lines where they draw the width, else the band, on every device with tessellationShader; strips are listed, the last provoking vertex read from the list led by it. The band's depth bias is the device's per band triangle: announced (new `Degradation::WideEdgeDepthBias`) under a slope factor or a constant over a float depth. A pipeline state whose band variant the translator refuses (barycentric weights, a selected slice or viewport, synthesized geometry, multiview, too many outputs) now draws its lines and edges at the nearest width, announced with the refusal as the reason, instead of failing the draw: the state's first band compiles the variant of its base key and remembers a refusal per primitive (`Unrouted::Refused`). Mesh draws and tessellated patches keep the nearest width. Docs: line_width.rs, band.rs, the runtime README, FAST-PATHS (row and known gap), API.md (band variant, catalogue), REFUSALS.md regenerated; api_signatures blessed (BandPrimitive added, LineBandState::PATCH_CONTROL_POINTS removed, the three line_band fields now carry the primitive). SEMANTICS_VERSION 1940, RUNTIME_VERSION 1716; runtime sources re-pinned. Verified (M3 Max, MoltenVK, --cfg m2v_gpu, maclock and memcap): runtime_lane::line_widths 7/7 pass under both policies; 148 cases, 145 drawn as Metal's pixel for pixel, 28 of the 31 wide edge cases (facing, culling, zero-area, strips, flat IDs and primitive IDs at both provoking modes, depth across an edge, 4 samples), the other 3 the depth-bias edge cases, announced (two differ from Metal, by slope and by exponent; the uniform-depth one matches); 93 draws as bands, 0 at the nearest width. Before this commit the same lane failed 4 of 7 (31 edge cases at the nearest width, refused bands refused). Also: engine_line_band and the band's fan tests, golden_hashes_match_the_table and the engine inventory parts unchanged (no bless), runtime line_width tests (the route table for lines and edges on every profile under both policies, refused rows), api_surface, api_signatures, refusal_surface --check, clippy with all features and with --cfg m2v_gpu, rustdoc with -D warnings. (Carried to development from steelbrain/reims-graphics-kext be2d725fdb.) |
||
|
|
b5e18d8fb3 |
Document the nearest-width line route; name its cause in the notice
Follows the previous commit, which drew at the nearest width what neither line route draws. Its nearest width is Metal's drawn width: w', and 1/16 at w' = 0 (Metal draws 0 as 1/16, the width-0 commit this rebased onto), clamped into lineWidthRange where the device enables wideLines, else 1. - line_width.rs: module docs for the Nearest route and what still refuses (a strip's band whose segment list cannot be drawn; the band variant's forms the translator does not build). The lines-at-nearest-width notice's object names the edges or lines drawn, its reason the width drawn, lineWidthRange (or no wideLines) and the cause. - The runtime README's line widths, FAST-PATHS.md's wide_lines row (counter nearest_width_line_draws) and its known gap (what is drawn at the nearest width, announced, instead of refused), RUNTIME-PORTING's SetLineWidth row. - refusal_surface reach.tsv: gap WideLines now reaches only a strip's band list; feature WideLines only the translator's band forms. REFUSALS.md regenerated (gap::WideLines sites 5 -> 1, the runtime's Unsupported(WideLines) site gone). - api_signatures blessed: Degradation::LinesAtNearestWidth, WorkCounts::nearest_width_line_draws. - RUNTIME_VERSION 1715 (a refusal became a run, a new announcement); runtime-sources pin recomputed on this tree (pin-compute.py, which reproduces 9ada26c9fa's pin on that tree). Verified: refusal_surface.py --check exit 0; cargo nextest run -p metal2vulkan-runtime -p metal2vulkan --all-features -E 'test(/line_width|degradation|api_signatures|api_surface|refusal_surface|apple_only|error_kinds|draw_shape|call_checks/)' 27 passed; cargo clippy --workspace --all-targets --all-features -D warnings clean. (Carried to development from steelbrain/reims-graphics-kext 7aed54b621.) |
||
|
|
815c8af707 |
Re-pin the runtime sources at the branch tip
The previous commit changed runtime-sources inputs (the runtime's pipeline sources), so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs with pin-compute.py on the tree rebased onto 7cf79c50ed. REFUSALS.md regenerated on the same tree: beside nothing of this branch, it picks up the base's rename of `line_width.rs`'s `line_route` to `route`, which the base left out of the generated document. (Carried to development from steelbrain/reims-graphics-kext 6fd1ce74b1.) |
||
|
|
b2bbc86339 |
Answer linked binary functions as plain Metal does
Measured on this M3 Max under macOS 27.0.1 (binary_function_linking.m, plain
and with MTL_DEBUG_LAYER=1, source libraries and metallibs alike), the runtime
now answers what plain Metal answers rather than what its validation layer
stops:
- One name in `functions` and `binary_functions`, or twice in
`binary_functions`, one function or two: made, where the runtime refused
`Invalid(DuplicateLinkedFunction)`. `duplicate_linked_name` keeps only a name
`functions` repeats, which plain Metal's creation fails ("error: duplicated
symbol", code 3). With the previous commit, a call calls the `functions` one
and a table holds each.
- A function only `binary_functions` holds that a stage calls directly:
`Compile(NeedsInput(LinkedFunction))`, as Metal fails with code 3, where the
runtime linked it (previous commit).
- A function not compiled to a binary in a stage's `binary_functions`: plain
Metal fails the creation once the stage links, code 2 ("Internal error
during compute pipeline creation", "... tile pipeline creation", an empty
description for render and mesh-fragment stages), after a reference it
leaves unresolved (code 3 first). The runtime answered
`Invalid(BinaryFunctions(NotPrecompiled))` before the compile; it now
answers `Error::MetalError` with that problem, the M3 Max's domain and
Metal's code and text, right after the compile (`additions::check_precompiled`).
Added to a made state's stage: `MetalError` code 1 ("Failed to allocate a new
pipeline"). Added to a stage the state lacks: taken, as plain Metal makes it
(it was refused).
- A mesh pipeline's object or mesh stage linking binary functions ends plain
Metal's process ("Binary linked functions are not supported for object and
mesh shaders"): `Invalid(BinaryFunctions(ObjectOrMeshStage))`, a new problem,
where the runtime made the state.
The module docs of `pipeline/additions.rs` record the measurements, the error
and README docs follow, REFUSALS.md and the API signatures are regenerated.
RUNTIME_VERSION 1713: creation answers change class.
Verified on this Mac (MoltenVK, --cfg m2v_gpu, under maclock and memcap):
runtime_lane::tests::a_kernel_runs_the_functions_its_descriptor_links and
runtime_lane::function_tables::{binary_functions_link_as_plain_metal_links_them,
binary_functions_and_required_threads_answer_as_metal_s_do,
functions_added_to_a_stage_a_drawing_state_lacks_are_left_out} pass; each
asserts an answer the previous runtime gave otherwise. The runtime unit test of
`duplicate_linked_name` passes.
(Carried to development from steelbrain/reims-graphics-kext 580daa4338.)
|
||
|
|
eb41a55e82 |
Draw every width Apple's setLineWidth: takes, as Metal draws it
RenderCommandEncoder::set_line_width refused every width but 1 (AppleOnly::LineWidth). Measured on the Apple M3 Max under macOS 27.0.1 (probes/line_widths.m): each encoder starts at 1 and the width holds across draws and pipeline states; Metal draws w' = floor(16 w) / 16 clamped to [0, 16] (NaN and negatives as 0, infinity as 16); at w' = 1 its ordinary diamond-exit lines; at every other w' Vulkan's non-strict parallelogram (major axis the larger extent, x on a tie; minor-axis edges through the endpoints, w' long and centred; ends not extended; centres inside, top-left ties; the width not rounded); at 0 exactly the pixel centres on the segment; one parallelogram per strip segment with no joins; triangles in fill mode Lines draw their edges so; at 4 samples every width is the parallelogram at the sample positions. The runtime (render/line_width.rs) keeps the quantized width in the encoder state and routes each draw at w' != 1: - the device's own lines (lineWidth w', no Bresenham mode) where it enables wideLines and w' lies in lineWidthRange above 0: exact where strictLines is unset, nonStrictWideLinesUseParallelogram set, w' > 1 and on lineWidthGranularity; elsewhere announced device-wide-lines under the default DevicePolicy::wide_lines = WideLinePolicy::Device, and the band under WideLinePolicy::Exact (exact_answers() selects it); - the pipeline's band variant otherwise (no wideLines, MoltenVK among them; w' outside the range; w' = 0 at half a width of 2^-subPixelPrecisionBits): cull none, the band's front face, fill mode, a PATCH_LIST of two points, viewport 0's half extent pushed with the half width; strips and loops listed as their segments (ListGap::WideLines), flat inputs under the last provoking vertex read from the list led by the last vertex, which covers the same pixels. Refused: Unsupported(WideLines) needing tessellationShader where neither route draws a line; NotImplemented(RuntimeGap::WideLines) for a triangle's edges or a mesh draw's lines the device's lines do not draw, an amplified band, a rate-mapped pass and an execution's commands. Counted: WorkCounts::device_wide_line_draws, line_band_draws. The lane test runtime_lane::line_widths draws the probe's cases through owned fixtures and compares every pixel with Metal's answers (line_widths_m3_max.txt, the probe's output), checks each wide draw took a route, and that every fragment is front-facing; its site WIDE_LINES holds the new kind in the lane's degrade-notice closure. Docs: FAST-PATHS.md's row for wide_lines and a known-gap bullet (edges and mesh lines on devices without wideLines, near-plane cuts, band fragments' inputs uncompared, width 1 on multisampled targets off MoltenVK); API.md's policy bullet and degrade catalogue; the runtime README's Line widths; RUNTIME-PORTING's row; REFUSALS.md regenerated (reach rows for feature and gap WideLines, apple LineWidth gone). Validation: the line limits the device description gained describe execution and are not compared in a profile's subset check; the generator's CORE_PROPERTIES and roadmap-2022's m2v_layer_presentation state them at the reader's absent values; opened_chains reblessed (one member more, wide_lines, on every device with it); golden_hashes' profile fingerprints reblessed (no output cell moved); api_signatures and api_surface name WideLinePolicy and LineBandState. RUNTIME_VERSION 1712; the runtime-sources pin rewritten. Verified on the M3 Max under MoltenVK 1.4.2 through maclock with the validation layer: runtime_lane::line_widths, 4 tests pass. Default and exact policies each: 102 cases, 100 matched pixel for pixel, 2 refused (the two fill-mode Lines cases at width 4, NotImplemented(WideLines)), 0 announced; 46 draws took the band, 0 the device's lines (MoltenVK has no wideLines). a_band_needs_tessellation (tessellationShader withheld: width 0 refused needing it, width 2 refused, width 1 matches) and the_lane_s_maps_tell_the_widths_apart pass. Negative control: the band widened by 1/16 of a pixel fails both runs at LANE lines 0.5. Also cargo clippy --workspace --all-targets --all-features -D warnings, plain and with --cfg m2v_gpu; nextest of metal2vulkan, -air, -runtime and -devtools (4954 run, the one failure the missing lane site, now declared), of metal2vulkan-validation (the failures the profile rules, chains and pin fixed here, rerun green) and of metal2vulkan-conformance (1007 pass). Not run: lavapipe, RADV, ANV and NVIDIA lanes, which take the device route. (Carried to development from steelbrain/reims-graphics-kext b16d03150c.) |
||
|
|
e54a2c12aa |
Refuse a pipeline of an unspecialized function that declares constants
Since functions whose constants are left undefined compile (a2e34a9d2f),
the runtime made a pipeline state of a function made by
newFunctionWithName: whose function declares function constants. Plain
Metal ends its process there, at every creator's descriptor validation
(probes/undefined_function_constant_values.m, new cases <how>:<shape>,
on the M3 Max under macOS 27.0.1, MTL_DEBUG_LAYER unset, exit 134):
"Compute Pipeline Descriptor Validation / function ko cannot be used to
build a pipeline state. Use newFunctionWithName:constantValues:... to get
the specialized function"; the render and mesh creators name
vertexFunction, fragmentFunction, objectFunction and meshFunction, and
the tile creator says "without setting constant values first". It does
so for an optional constant read only where is_function_constant_defined
says (ko) and for a constant that only gates arguments (kg). Made: a
function made by name that declares none (kn, plain, tile-plain,
mesh-plain), and every shape made with constant values that hold none or
by newFunctionWithDescriptor: without them (each then answers an empty
functionConstantsDictionary; ko stored 7, kn 9).
- metal2vulkan: FunctionDescriptor gains `specialized` (false by default,
a function made by name; a descriptor with constant values is
specialized whatever it says) and with_specialized, and
needs_specialization(budget, entries) answers whether Metal makes no
state of the stage: not specialized and a non-empty
functionConstantsDictionary. A module function's constants are read
through the StageEntries' module decodes (constants_dictionary_with),
which the stage's compile copies, so the check decodes nothing the
compile does not. The compile itself is unchanged.
- metal2vulkan-runtime: Function::function_descriptor marks the stage
specialized where the function was made with constant values or by
descriptor. pipeline/unspecialized.rs refuses before anything is
compiled, Invalid with the new Problem::UnspecializedFunction { stage,
name }: compute and tile states (of_kernel), render states (vertex,
fragment) and mesh states (object, mesh, fragment). A linked function
keeps its own rule (LinkProblem::UnresolvedConstant).
- Pipeline records carry the stage's specialized flag, RECORD_FORMAT 3:
without it every specialized stage's record read back unspecialized
and went unrecorded.
- The owned fixture engine/unspecialized_stage_functions (the probe's
shapes at every stage); its golden rows, inventory and printout are
new rows only (11 functions by 2 forms in each table).
- docs/API.md ("Function constants"), the FunctionConstantValues and
creators' docs, the runtime README, docs/REFUSALS.md regenerated, the
signatures blessed (FunctionDescriptor.specialized, with_specialized,
needs_specialization, Problem::UnspecializedFunction).
Verified:
- metal2vulkan tests::engine_unspecialized 2/2 (every declaring function
of the fixture needs specialization made by name, no free one does,
and the eleven answers read one module decode, (1, 10); specialized or
valued, none does, decoding nothing).
- On MoltenVK (M3 Max) through maclock, --cfg m2v_gpu:
runtime_lane::unspecialized_functions 3/3 (by name: guarded and gate
kernels, vertex, fragment, tile, mesh and object refused; free kernel
stores 9; plain render state made; empty-valued and descriptor-made
guarded kernels store 7, gate kernels made, render states made; tile
and mesh states of them not refused as unspecialized) and
runtime_lane::linked_functions 2/2.
- metal2vulkan-runtime suite 1177/1177; tests::warm_record 4/4.
- metal2vulkan and metal2vulkan-air: 3748 of 3753 before blessing, the 5
failures the new fixture's table rows; after blessing they and the
signature and surface tests pass.
- Negative controls: needs_specialization answering false fails
engine_unspecialized's by-name test; function_descriptor without the
specialized flag fails all three lane tests (the empty-valued and
descriptor-made functions refused); the stage flag removed from the
record's writes and reads fails the four warm_record tests.
(Carried to development from steelbrain/reims-graphics-kext 116efd0dfe.)
|
||
|
|
bf3ce3813c |
Read Core Image kernel libraries and split whole aggregate accesses
A Core Image kernel library (metal -fcikernel, metallib -cikernel) is a
metallib of file type 1 whose kernels (!air.ci) are listed as function
TYPE 5 over one shared module. The container refused the file type
(Unsupported LibraryKind(1)), so newLibraryWithData: failed where Metal
succeeds; the consumer's graphics-kext lane hit it on Core Image's own
helper library in a macOS 26 guest, so every Core Image path stopped
there.
What Metal answers, measured with kernels written from scratch on an M3
Max under macOS 27.0.1 (probe programs over Metal's API and objc's message
log of a CIColorKernel render):
- newLibraryWithData: takes it as MTLLibraryTypeExecutable; functionNames
is empty; the private externFunctionNames lists the kernels in the
reverse of the table's order (libraries of two and four kernels);
- newFunctionWithName:, newFunctionWithDescriptor: and the private
newExternFunctionWithName: make each kernel with functionType 4 (no SDK
enumerator; its description prints "Unknown"); newExternFunctionWithName:
answers as newFunctionWithName: for any library, a kernel of an
executable one included, and nil for a missing name;
- a compute pipeline made from an extern function fails ("Function tint
was not found in the module");
- Core Image fetches each kernel and its own helpers with
newExternFunctionWithName: and links them on the CPU, in Metal.framework's
base device class, into an ordinary executable library holding one
kernel, ciKernelMain, of which it builds a plain compute pipeline.
So now:
- container: file type 1 is read (executable; its functions may share one
bitcode range, hashed once, as a dynamic library's); TYPE 5 is the new
FunctionStage::Extern, no stage: the ABI cross-check refuses it as a
mismatch, Library::Function compiles it as no entry (EntryNotFound,
available 0). Unobserved file types stay LibraryKind refusals.
- FunctionType gains the private enumerator Extern = 4
(regen-metal-enums PRIVATE); reflection maps Extern to it.
- runtime Library: function_names leaves extern functions out;
extern_function_names (reverse table order) and
new_extern_function_with_name are new.
ciKernelMain itself was refused next: Lowering(Arith) at its first
load, `load [4 x <4 x float>], ptr addrspace(2)`, a whole array loaded
from the constant buffer and passed by value to a helper. Lowering reads
and writes buffer and threadgroup memory a scalar or vector at a time.
The new canon pass `aggregates` (after SCCP, beside the other expansions)
replaces each non-volatile, non-atomic load or store of a pointer-free
array or struct in device, constant or threadgroup memory by its members'
accesses in layout order (a getelementptr i8 at the member's distance, the
access's alignment lowered to what the distance allows, joined by
insertvalue or split by extractvalue), at most 256 members, 8 deep.
Thread memory, pointer-holding aggregates (handles), volatile accesses
and larger types stay whole as before. The same-type pointer bitcast
beside the load was never the problem (verified alone).
Public surface: metal2vulkan-air FunctionStage::Extern; metal2vulkan
FunctionStage::Extern and FunctionType::Extern; runtime
Library::extern_function_names and new_extern_function_with_name
(api_signatures blessed: 5 added, none changed or removed). devtools
gains core_image_metallib. The metal-enum generation now records the
macOS 27.2 SDK (the host's Xcode); no SDK value changed, only Extern was
added. LibraryKind's doc and reach note name what it refuses now.
No cache version moves: file type 1 and aggregate accesses outside thread
memory were refused before, so no key reached them, and
golden_hashes_match_the_table passes unchanged (every public fixture
assembled: this Mac's Xcode 27.2 now has its Metal toolchain). The
runtime-sources pin moves (runtime library.rs): re-pinned here to
23766690fd75227c5333e976bfc1fdfafa6ff78f43e0c5ba8fa5183574cd9371.
Verified (M3 Max, macOS 27.0.1):
- Metal versus this tree's runtime on MoltenVK: Core Image's linked
ciKernelMain for a tint color kernel and for a sampler kernel (both
from-scratch CI kernels; the linked libraries captured from Metal in
scratch and deleted after), same constant buffer, source texture and
sampler, 4x4 RGBA32Float target: byte-identical texels, the early-out
column untouched on both. The parent tree answers FALLBACK (Lowering
Arith) for both. Release CLI: 0.01-0.03 s, 11 MiB each.
- Release CLI, parent vs this tree, largest public fixtures
(hfb_filter_bank render pair, tns_mm_flags), three runs each:
0.12-0.13 s vs 0.12-0.16 s and 0.05-0.06 s vs 0.04-0.05 s, 27 MiB both
(runs beside a test suite; the same within noise).
- New tests: canon aggregates (split loads, stores with nested arrays and
lowered alignments, threadgroup; volatile, pointer-holding and
300-element aggregates stay whole), an engine test running a
ciKernelMain-shaped kernel on the CPU interpreter on three profiles,
core_image_libraries (container types, stages, shared hash, functionType
4, EntryNotFound), and a runtime device test on MoltenVK (names, extern
names, both lookups, pipeline refusal, an executable library's kernel
through the extern lookup). Negative controls: the split and execution
tests fail with the pass disabled; the library tests fail with file
type 1 refused.
- cargo nextest -p metal2vulkan -p metal2vulkan-air -p metal2vulkan-runtime
-p metal2vulkan-devtools --all-features: 4927 passed (golden hashes and
the metal-as fixture parts included); -p metal2vulkan-validation
-p metal2vulkan-conformance: 2369, all passed after the re-pin; doctests
ok; clippy --workspace --all-targets --all-features -D warnings and the
runtime's under --cfg m2v_gpu: clean; rustdoc -D warnings and
scripts/api-docs: clean; REFUSALS, METAL-COVERAGE and
CONFORMANCE-COVERAGE re-derived (MTLFunctionTypeExtern is listed as not
yet compared by a conformance case). Not run: a corpus translation
census, and the device suites beyond the new runtime test.
|
||
|
|
97116bb420 |
Keep pages the kernel cannot pin from NVIDIA's driver, and copy them as a failed import is copied
On NVIDIA's driver (615.71.09, RTX 5080 Laptop), a failed host-pointer
import of pages the kernel cannot pin breaks the process's later
host-visible allocations. The consumer's device-creation probe hit this, so
no guest RAM chunk imported afterwards. The runtime now asks the kernel
first on that driver, refuses such pages itself with the answer Vulkan
requires, and never hands them to the driver. The object then goes its
other ways: the dma-buf source, else a copy.
Cause, measured on msi's 5080 through runtime device tests that logged each
call's VkResult and errno, the fd table and the process's maps:
- The consumer's probe makes no dma-buf import on NVIDIA. Its 1025-page view
is past udmabuf's list_limit, so its source refuses. What fails is the
runtime's import of the view's pointer, a VM_PFNMAP mapping of a udmabuf:
vkGetMemoryHostPointerPropertiesEXT succeeds (types 2 and 3), then
vkAllocateMemory answers ERROR_OUT_OF_DEVICE_MEMORY on both.
- After that, vkAllocateMemory answers ERROR_OUT_OF_DEVICE_MEMORY to every
host-pointer import measured:
- memfd pages from 8 KiB to 8 MiB at any offset;
- anonymous pages;
- RAM 512 MiB away;
- 40 retries over 3 s;
- a second VkDevice.
It also fails a plain 64 KiB host-visible allocation. Device-local
allocations still work. The chunk import fails in vkAllocateMemory, not
in the properties query or the requirements check.
- Not the cause: a failed udmabuf import itself (the next 8 chunk imports
bind, and NVIDIA closes the handed clone: F_GETFD EBADF), the properties
query alone, mapping a udmabuf, address reuse, the fd table, VmPin/VmLck,
the kernel log.
Vulkan (vkspec 1.4.366, 11.2.6): such a restriction "must fail the memory
import operation with the error code VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR";
and (Return Codes) "VK_ERROR_OUT_OF_*_MEMORY errors do not modify any
currently existing Vulkan objects."
Fix:
- RuntimeDriverDefect::UnpinnablePagesBreakHostMemory (NVIDIA_PROPRIETARY,
no GPU probed clean, per the defect table's rule).
- On such a device, Device::refuse_unpinnable runs before a no-copy
object's, heap's or rebind's own import and before a guest RAM chunk's
import. It walks the mappings over the pages (PROCMAP_QUERY, or the maps
lines before Linux 6.11) and reads one byte of each through
process_vm_readv. The kernel refuses a whole VM_IO/VM_PFNMAP mapping, so
one read per mapping answers for all its pages.
- Pages it cannot pin get its own Unsupported/HostMemory refusal naming the
defect. That refusal sends the object to the dma-buf source; with none,
or where the source's import fails, the object is a copy, announced as
copied-host-pages and counted as a failed import. This holds for buffers,
heaps and rebinds. A RAM chunk over such pages is not imported, and the
objects over it end in the copy. Pages not mapped readable keep their
refusal. The new refusal reaches a caller only where pages remapped after
their first import are imported again (docs/REFUSALS.md regenerated).
- Counted: WorkCounts::host_imports_unpinnable.
- Every other driver, and every OS but Linux, asks nothing and keeps its
path.
- Docs: driver_defects.rs (the measurement), FAST-PATHS known gaps, HOWTO
section 6 and its copy causes, the runtime README, copied.rs,
CopiedHostPages and its API.md entry.
- RUNTIME_VERSION 1704.
Verified:
- RTX 5080 Laptop, NVIDIA 615.71.09, --cfg m2v_gpu: the runtime filter
host_ram_device|copied_device|rebind|dma_buf|host_residency|
driver_defects|host_memory|host_import|copied passes 97/97 on the
committed tree.
- New: a_chunk_is_imported_after_a_refused_import_of_a_dma_buf_mapping
failed without the fix ((0, 0) where (1, 2) is expected) and passes
with it.
- New: pages_refused_before_the_driver_with_no_source_are_copied: a
buffer, a heap and a rebind over a udmabuf mapping with no gate and no
source give 3 refusals before the driver and 3 copies. The GPU reads
the right bytes, and a chunk then imports with 2 buffers bound.
- The consumer's repro, with its device probe in front
(os::linux::host_ram::tests::a_buffer_over_one_run_of_the_ram_is_bound_in_its_chunk,
built from a read-only copy of their 2cb3c8f91): passes. It fails against
development 2e2e238346.
- M3 Max, MoltenVK 1.4.2: the same filter 83/83; runtime unit tests 1161;
API, refusal-surface and fast-paths tests 34; rustdoc -D warnings clean.
Clippy -D warnings is clean on the Mac (plain and --cfg m2v_gpu) and on
msi (plain and --cfg m2v_gpu).
Left: RADV and ANV refuse such pages themselves, so an object there with no
source is still refused (not run there). A failed chunk import is not kept,
so the kernel is asked again for each object over that chunk (cost not
measured).
Lane commits: ws/chunkfix-lane (a2420020ea, a56fa43f2b).
One work packet, landed as 2 commits on archive/development-linear-2026-10-29: a0a1ea79d4, then 22fa5003db (the re-pin).
|
||
|
|
c0617d796e |
Rebinds take the copy where the gate refuses: heaps, images in place, moved bytes, one-run chunks
The NVIDIA RAM route's rebind part, with RunResolver's doc saying a rebind asks it. One work packet, landed as 4 commits on archive/development-linear-2026-10-29, in order: * Rebinds take the copy where the gate refuses: heaps, images in place, moved bytes, one-run chunks (c0e37e8984) The NVIDIA RAM route's rebind part (consumer spec, part 4). A buffer's rebind with an image in place over it, and a heap's rebind, now take the copy of the new pages (copied_pages) where the caller's gate refuses their import or the admitted import fails, instead of refusing NotImplemented(RebindTextures) or failing the call. Heap rebinds ask the gate like any import. A buffer's rebind to bytes at another offset in their page, under a texture planned at the old offset, takes a copy laid out at the old offset (the gate unasked: nothing is imported) instead of refusing. - The copy's memory, where images will bind in it, holds the window's whole pages from a multiple of the import's unit. The heap's textures bound to its bytes and the images in place over the buffer are made again over the copy: in memory the device allocates, as linear images that start PREINITIALIZED, whose first move keeps the copy's bytes (Vulkan: "the transition away from this layout will preserve that data"). - Where images in place ride on the copy, it lies in fresh pages the runtime maps and imports by pointer (Device::fresh_page_buffer), and each image is made as over the caller's pages for host allocations, under the device's in-place check for fresh pages (PagesClass::Fresh, else RebindTextures). On the RTX 5080 the driver's own linear image does not lie at Metal's 256-byte pitch, so the first form still refused there. - The run resolver at rebind (ram1's route_runs and bind_in_chunk): asked once with the new window, on the calling thread with no runtime lock held, before the gate. One run inside one chunk binds in the chunk's import (no import, no gate); any other answer takes the gate, then the import or the copy. The runs are kept with the new pages, copies included; bytes moved in their page are never chunk-bound. - Metal's rebind order is unchanged: the pending check runs before the gate, and committed-not-submitted command buffers are encoded again over the copy. - RebindTextures stays, for a device that makes no image over the copy at the texels' pitch, memory type or alignment, and for drops-writes buffers (option bit 24) whose bytes moved. WorkCounts (new): copied_rebind_pages_moved (a third cause within copied_host_buffers_made) and copied_rebind_images_made. No new Error variant. heap_raw_image takes (memory, at) and a memory-type check. RUNTIME_VERSION 1702. Docs: HOWTO copied host buffers and guest RAM, API.md copied-host-pages, FAST-PATHS (the heap and in-place rebind exception removed from the known gap), the runtime README, ImportGate, HostMemory::with_runs and with_import_gate, rebind.rs, copied.rs module docs, RebindTextures; REFUSALS.md and api_signatures.tsv regenerated. Verified: - RTX 5080 Laptop, NVIDIA 615.71.09 (msi, one hold): runtime copied_device|host_ram_device|rebind|in_place 48/48; the image over the copy is made (copied_rebind_images_made asserted 1) in the gate-refused, moved and ordering tests. Validation rebinds|dma_buf_imports 28/30: the two failures (ycbcr planes over chunks "off the grid", dma-buf in place "one run") also fail at development 2cfd8d6ef9 on the same GPU. - M3 Max, MoltenVK 1.4.2, --cfg m2v_gpu under maclock: runtime host-memory filter 157/157; validation rebinds|dma_buf|copied|no_copy|host_memory 75/75; at the final tip copied_device|host_ram_device|rebind 40/40. Here textures over buffers are shadows, so only the heap image over the copy runs (1 per heap test). - 7 new device tests: gate-refused buffer rebind with a texture over it, moved bytes, heap rebind gate-refused and import-failed, ordering with a held and an uncommitted command buffer, resolver at rebind (one run binds in the chunk; two runs go gate then copy). - Focused non-device tests 76/76; clippy plain and --cfg m2v_gpu clean; rustdoc -D warnings clean for the runtime. - Not covered by one venue: both images over a copy at once. Lane commits: ws/ram3-lane (d3945d0d9d, 7a114b599e, b93a6c1eac, 8b9fa5fb46). * Re-pin the runtime sources at the landing tip (7f76090454) * Say that a rebind asks the run resolver, as c0e37e8984 made it (8dcba47435) RunResolver's doc still said a rebind to new pages does not ask it. Since c0e37e8984 a buffer's or heap's rebind asks it once with the new window, before the gate, except where the bytes moved in their page under a texture, which take a copy without asking (with_runs' and Buffer::rebind_bytes_no_copy's docs already say so). Doc only. * Re-pin the runtime sources at the landing tip (17896b4366) |
||
|
|
20287666c0 |
Blend extended-range attachments in the device's arithmetic; drop the 32-bit float Metal blend
Rule 1 (owner, 10-29): where the device has a native form, it is the only form.
An extended-range attachment's raw codes are something no blend unit reads, so the
shader still blends it (capability), inside the pixel interlock or over lavapipe's
input attachment. Its arithmetic used to be Metal's compiler's: lerps, common
factors, fusing by factor rank, half rounding at every step, a separate float4
model and computed-output tables. Now it is a blend unit's arithmetic: S*Fs op D*Fd
in float, in the order of the blend equation, with the source, second source and
blend color clamped to the form's range first (`extended_range::blend::native`).
- computed.rs is deleted. blend_color.rs keeps only the two source ranges.
- input_blend.rs and fetch.rs call native().
- The blend color is pushed as raw f32 bits (HalfBlendColor), so
PushField::BlendColor is gone.
- Every blended extended-range output that stores a channel now records
ExtendedRangeBlendSource (half) or ExtendedRangeFloatBlendSource (float).
- The refusals ConstantColorDifference, SrgbForm and FloatOutput are gone, as is
the fast-math DualSource refusal for extended range. Every factor, operation
and mask is built; only outputs other than four half or float lanes are
still refused (Output).
The 32-bit float storage-form blend (`Blend::float32`, `fetch::float32_blended`)
computed Metal's fused forms in float. Every committed profile except
roadmap-2022 and vk12-floor sets COLOR_ATTACHMENT_BLEND on R32/RG32/RGBA32_SFLOAT,
so that form copied Metal's bits where the device blends natively. It is removed:
- a fetched 32-bit float attachment takes the generic float blend
(UnmeasuredFetchBlend);
- one that is not fetched gets the device's blend after the pass splits.
The float4-output paths of the half/unorm8 model (Atom::Sf, Arith::Kept,
round_inner, Blend::float/narrow/takes_float) were dead after this and are pruned.
Removed:
- the Metal blend-table validation lane (extended_range_blend_table.rs)
- devtools xr_blends
- the xr_blend_table*.txt fixtures
- lower/arith/tests/blend32.rs
- the extended_range tests that pinned Metal's forms
Added:
- every_blend_is_the_devices_arithmetic: every form, 19 factors, 5 operations,
rotating masks and adversarial sources, bit-exact against a float model of
S*Fs op D*Fd
- every_blend_is_built_but_a_placeholder
Docs:
- FAST-PATHS: the "Metal's rounding per shape" fast row is removed. The
extended-range blend is now a device-gaps row with the two notes. The
32-bit float row and the interlock section are fixed.
- artifact.rs note docs and the API.md catalogue are rewritten.
- REFUSALS is regenerated, reach.tsv updated and api_signatures blessed
(removed ExtendedRangeBlend::{ConstantColorDifference, FloatOutput, SrgbForm},
PushField::BlendColor).
- Conformance: the two notes join replay::NATIVE_NOTES, and 16 Apple M3 Max
known-gaps rows hold the xr-blend add/premul sites the device's arithmetic
moves: one code, two at the sRGB premultiplied sites.
- SEMANTICS_VERSION 1923, ARTIFACT_FORMAT_VERSION 479.
Size: a premultiplied half4 fill into RGB10A8_2P_XR10 on moltenvk-m3 goes from
3275 to 1937 SPIR-V words (the blend itself from 2133 to 795). The float4 fill
goes from 3435 to 1951 words, and BGRA10_XR_sRGB premultiplied from 7992 to 6654.
Verified:
- metal2vulkan lib, touched modules: 511/511.
- Sabotage: rounding the source to half in native() fails
every_blend_is_the_devices_arithmetic; restored, it passes.
- clippy, plain and with --cfg m2v_gpu; rustdoc -D warnings.
- M3 Max conformance replay of 25 cases: half-output-blends-*,
blend-interaction-format-float32 and xr-blend-*-one-zero are justified; the 16
xr-blend add/premul sites are held by the new rows.
The replay exits 0 with the ledger held exactly. The conformance crate
passes 1007/1007, CONFORMANCE-COVERAGE is regenerated, and runtime
degradation/catalogue and api_signatures/api_surface/refusal_surface pass.
- M3 device tests (memcap + maclock, --cfg m2v_gpu): 11/11 of
runtime_lane::extended_range_blends and framebuffer_fetch::generic_blend.
The renamed blends_of_half_outputs_into_extended_range_texels asserts
Metal's bytes for one-zero and prints the 16 add/premul outputs the device's
arithmetic moves.
One work packet, landed as 2 commits on archive/development-linear-2026-10-29: 808143ef80, then 18431ee908 (the re-pin).
|
||
|
|
442a9fd538 |
Bind no-copy objects over one run of guest RAM in the device's chunk import
The NVIDIA chunk route's API (HostRam, Device::use_host_ram, HostMemory::with_runs), the chunk
source and one-run route, and a chunk-bound buffer's out-of-bounds writes held to the device's
own containment (a device test and a known gap).
One work packet, landed as 7 commits on archive/development-linear-2026-10-29, in order:
* Add HostRam, Device::use_host_ram and HostMemory::with_runs (d3617f7e1d)
The API of the NVIDIA chunk route (guest RAM imported whole): the types the
chunk source, the GPU copy and the rebind lanes build on.
- HostRam (unsafe new(ranges, keep_alive)): the consumer's guest RAM ranges,
checked as non-empty, whole host pages, within the address space and apart;
a typed refusal otherwise (Invalid, Problem::HostRam). with_dirty_pages
takes one DirtyPages log for the whole RAM whose offsets are host addresses
(the log's pointer is 0), so one stamp per commit can serve every copy. The
keep-alive is dropped with the HostRam (forgotten while the process exits).
- Device::use_host_ram(&Arc<HostRam>) -> HostRamUse: a guard, since runtime
devices live for the process while a lease promises its RAM for one guest
device's life. Dropping the guard ends the use; a later RAM may be used
after. Several RAMs whose ranges are apart may be used at once; one whose
ranges meet a used RAM's (itself among them) is refused as misuse
(Invalid, Problem::HostRam). A device without VK_EXT_external_memory_host
is refused (Unsupported, naming it).
- HostMemory::with_runs(RunResolver): RunResolver is
Arc<dyn Fn(start, len) -> Option<Vec<Range<u64>>> + Send + Sync>, asked with
the import window, answering host addresses in the RAM's ranges. Stored
here; the routing that calls it comes in a later commit.
No Metal counterpart for any of it; the doc comments say so. The chunk import
itself (lazy 64 MiB chunks) and the routing in buffer_over_host_memory follow.
Verified: cargo clippy -p metal2vulkan-runtime --all-targets --all-features
-D warnings (Mac); host_ram unit tests 4/4 (range checks, refusals,
keep-alive drop); api_signatures and refusal_surface 7/7 after the re-bless
and regeneration; rustdoc -D warnings for the runtime crate.
* Re-pin the runtime sources at the landing tip (22c47609a9)
* Bind no-copy objects over one run of guest RAM in the device's chunk import (7f07d19b3d)
What: the chunk source and the one-run route (host_ram.rs).
- Chunk source: a device that uses a HostRam imports it by host pointer in
64 MiB chunks (CHUNK_BYTES), never across a range's end, lazily. Each chunk
is imported the first time an object over it is made, on that thread, once,
under a lock of its own (ChunkSlot). It goes through the existing
Memory::import_host: a coherent type, and the device-address flag where
bufferDeviceAddress is on. A whole-chunk VkBuffer is kept for the runtime's
own copies only, never named by a Metal buffer, root entry or binding.
- Chunk lifetime: chunks are never released while idle (they are no
HostImport, so host_residency never sees them). Once the HostRamUse is
dropped, a chunk is freed when nothing holds it: Placement gains ram_chunk,
so every buffer bound in a chunk holds it, and every command buffer that
used one does too. The RAM, and so its keep-alive, goes after the free
(release_then's after), dropped as the program's. Exiting leaves it all to
the process's end.
- Routing in buffer_over_host_memory: a buffer that lies in a live import of
the same bytes is unchanged. Otherwise, where the device uses a RAM and the
memory has a resolver, the resolver is asked once with the import window, on
the calling thread with no lock held, before the writability query and the
gate. Memory whose GPU writes bit 24 drops is never routed.
- One run inside one chunk: Device::bind_in_chunk makes the VkBuffer with
host_buffer against the object's own window, checks it with binds_in
against that window, and binds it at run offset + binds_in offset in the
chunk's memory. That offset must be a multiple of the buffer's alignment,
and the buffer must allow the chunk's memory type. Its placement
(Placement::ram_chunk) holds the chunk and maps the caller's pointer, so
contents stays the pointer. The buffer gets no import of its own, the gate
is not asked, and buffer_of keeps the import fixed (no Again).
- Several runs, a run crossing a chunk's end, a chunk that cannot be imported
or a buffer that cannot bind exactly: today's gate path (import, or copy
where the gate refuses).
- The RAM and runs are kept on HostPages (ram_runs) until rebind or release,
for the GPU copy lane.
- An answer that is not whole pages of one used RAM totalling the window is
refused: Invalid, Problem::HostRam.
- Heaps over host memory take the same routing (of_heap goes through
buffer_over_host_memory).
- rebind_host_pages only ignores the new HostParts.runs (`runs: _`). The
rebind lane asks the resolver there with Device::route_runs and
bind_in_chunk.
- New WorkCounts: host_ram_chunks_imported, host_ram_chunk_bytes,
host_ram_chunks_live (a gauge), chunk_bound_buffers_made.
- Docs: HOWTO "Guest RAM imported whole", the runtime README's extension list.
RUNTIME_VERSION 1697 -> 1698.
Why: the NVIDIA route (the consumer's spec). On a device that refuses
dma-buf views, each import of scattered guest pages takes a kernel mapping per
page, past vm.max_map_count at 4K. One-run objects bound in chunks take none.
How verified (this Mac, M3 Max, MoltenVK, under memcap + maclock):
- host_ram unit tests 8/8: chunk spans and lookup; one run in a chunk, a
chunk's last pages and a range's short last chunk; several runs and a run
crossing a chunk (gate path); broken answers refused.
- New device tests tests::host_ram_device 6/6. The path ran: the log prints
"chunks imported 1, chunk-bound buffers 2".
- One run binds in the chunk: 1 chunk import of 64 MiB, 0 pointer imports,
gate not asked, contents == pointer, the GPU reads the bytes, a fill
reaches them, a second buffer in the chunk imports nothing.
- Containment: a 1.5-page buffer's copy reach <= its 2-page window, and a
fill of all of it leaves the sentinel page before and the bytes after it
unchanged.
- A no-copy heap binds in the chunk.
- None, two runs and a crossing run ask the gate once and import; short and
outside answers are refused.
- A command buffer held behind an event keeps the chunk (live gauge, and
the keep-alive not dropped) after the buffer, the use and the RAM are let
go of; once it completes the chunk is freed and the keep-alive dropped.
- The same RAM twice and an overlapping RAM are refused, a RAM apart is
taken, and a new RAM over the same ranges is taken after the first use
and imports again.
- Regression on the same Mac: 249/249 for
host_|copied|dirty|rebind|heap|no_copy|dma_buf|in_place|detach|alias|
degradation|profile (copied_device, dirty_pages_device and the
host-import tests among them).
- clippy -D warnings plain and --cfg m2v_gpu (runtime, all targets, all
features); rustdoc -D warnings for the runtime; api_signatures 3/3 after
the re-bless.
Not run here: NVIDIA (msi 5080) and lavapipe; dma-buf devices' own tests
beyond the Mac's.
RUNTIME_VERSION 1699 at landing.
* Re-derive the generated documents at the landing tip (a9c042f142)
They are generated from the whole case set, and the set grew on `development`
while this branch was in flight, so the copy committed here counted a smaller
one.
Verified: regenerating at this tip leaves no change beyond the `Generated at`
stamp.
* Re-pin the runtime sources at the landing tip (2cfd8d6ef9)
* Hold a chunk-bound buffer's out-of-bounds kernel writes to the device's own containment (1b09d84fad)
What: a device test (tests::host_ram_device) whose kernel, the owned fixture's
scale_and_offset, writes three pages of words through a one-page buffer bound
in a chunk of guest RAM. It asserts that the page before the buffer and the
pages after it keep a sentinel, and that the kernel wrote the buffer itself.
The page-after assertion applies wherever the device keeps the same write,
through a one-page buffer of its own, out of the buffer made after it: the
chunk binding is held to the device's own containment, measured in the same
test. A known gap in docs/FAST-PATHS.md records the device that does not
contain such writes.
Why: containment (c) of the route. A chunk-bound VkBuffer ends at the
object's last page, but the chunk's memory goes on past it, so containment
rests on the device's buffer robustness or in-shader checks, not on the
import's end as a per-object import does.
Found and how verified:
- RTX 5080 laptop (NVIDIA 615.71.09), msi, one hold 06:00-06:02, strict form
(no device check): host_ram_device 7/7. The chunk's pages after the buffer
were untouched.
- lavapipe (linux-gate, slot lava, arm64), strict form: 7/7.
- M3 Max (MoltenVK 1.4.2), this form: 15/15 host_ram tests. It prints that
out-of-bounds writes changed 32720 bytes of the device's own next buffer and
32720 bytes of the chunk's next pages. A control run (not committed) showed
that a no-copy pointer import of one page changed 0 bytes past its page. So
MoltenVK's gap is within an allocation; it predates the route, which
inherits it.
- clippy --cfg m2v_gpu -D warnings (runtime, all targets).
Also: the RunResolver doc no longer says rebinds ask it; they do not until rebinds are routed (af9f1e057d).
* Re-pin the runtime sources at the landing tip (60c300198f)
|
||
|
|
0a1851164d |
Copy a no-copy buffer, heap or rebind whose import the caller's gate refuses or that fails, announced
A new HostMemory::with_import_gate(ImportGate) asks the caller once,
holding no lock of the runtime's, just before a no-copy buffer, a
no-copy heap or a buffer rebind imports its pages, passing an
ImportRequest with the pages the import would map. If the gate answers
false, or an import the device and the gate admitted then fails
(OutOfMemory, another Vulkan error), the object is made over a copy of
the pages instead of failing. The default stays import-first. The copy
is host-visible memory owned by the runtime; `contents` stays the
caller's pointer. Each commit copies in the bytes the CPU changed since
the last sync, and each batch's completion merges back the bytes the GPU
changed (CPU wins where both wrote), byte by byte, before events,
waiters and handlers see it. Every copy is announced
(`copied-host-pages`) and counted. Pages the process cannot read are
never copied (the first copy reads through the kernel:
process_vm_readv / mach_vm_read_overwrite). A copied heap's buffers lie
in the copy and its textures are shadows. A rebind's copy is laid out as
its import would be. A rebind over an in-place image is refused
(NotImplemented(RebindTextures)) and a heap's rebind still imports
without asking. A caller's DirtyPages log stays attached to the copy as
to an import. The in-place check's pointer class skips copied buffers.
Ports dev-perf's fff961b7e5, 630d1b0174, 33d7aa5e98 and 9b4d4190f5 onto
a smaller coherence design: every live copy is compared in full at each
commit and completion, instead of dev-perf's log-driven,
encoder-collected copies (dev-perf's copied.rs, 79301a2515 and its
fixes, sat on a page log development has replaced). Also brings
789fa3d294's unreadable-page rule, 5190983470's lane site, and
1c7d49f788's copied-buffer skip. A driver that refuses the pointer
still fails the call (dev-perf copied there too; not taken). Known gaps
in FAST-PATHS: the compare costs O(size) per commit and completion, a
byte both sides wrote keeps the CPU's value, and a shared event's value
can be seen before the merge (c5db2d1b8a not ported). RUNTIME_VERSION
1690. Runtime-sources pin recomputed.
Public API: ImportGate, ImportRequest { start, length }
(#[non_exhaustive]), HostMemory::with_import_gate,
Degradation::CopiedHostPages, Device::fail_next_host_imports (test
hook), and the WorkCounts fields host_imports_refused_by_host,
copied_host_buffers_{made,refused,degraded}, copied_copy_in_bytes,
copied_merge_back_bytes, copied_rebind_pages_made, copied_heaps_made.
Verified on the M3 Max (MoltenVK, m2v_gpu): 11 new device tests
(tests::copied_device: buffer, rebind and heap, gate refusal and failed
admitted import, unreadable pages, a heap texture round trip) and 167
tests in the touched device filters pass; the counters move as
expected ([1,1,1,0,0] for a refusal, [0,1,0,1,0] for a failed import)
and the announcement is heard; on a 64 KiB copy 4079 bytes copied in and
4080 merged back for a 4 KiB CPU write and a 4 KiB fill, checked
exactly. Sabotage: ignoring the gate and removing the merge fails the 3
buffer tests; ignoring the rebind gate fails both rebind tests (no heap
sabotage). 249 host tests pass. Workspace clippy plain and
--cfg m2v_gpu, and rustdoc, clean; clippy re-run clean on the landing
merge. Not run on Linux.
|
||
|
|
bd3c50d741 |
Take the device's own Depth16 bias and its store of an extended-range, padded or bfloat attachment's untouched texels
The device's depth bias unit on every format, and the device's store of untouched texels in
place of the unused-bits load pass (deleted with its capture machinery); the NaN depth
discard documented as capability. SEMANTICS 1910, RUNTIME 1682.
One work packet, landed as 7 commit(s) (88bcfeaea8..6aec9db4e9 on archive/development-linear-2026-10-28-evening), in order:
* Take the device's depth bias on a Depth16Unorm depth
Rule 1: the device's depth bias is its native form, so it is the only one. A
constant bias (or a slope alone) on a Depth16Unorm depth was recorded through
VK_EXT_depth_bias_control's depthBiasExact as Metal's own rule, c + 1 units of
1/65535 for c of 0 or more and c - 1 below (one unit for a slope alone), in
depth (floatRepresentation) or in 2^-16. Now `metal::state::depth_bias` hands
Metal's constant to vkCmdSetDepthBias in the device's own unit r on every depth
format; Vulkan leaves a fixed-point format's r to the implementation, at most
2 x 2^-16 ("Depth Bias", primsrast.adoc).
Deleted, nothing reading them any more: `depth16_units`, `DepthBiasUnit` and
`DepthBias::unit`, the `depth_format` parameter of `depth_bias` and of the
runtime's `vk_depth_bias`; the runtime's vkCmdSetDepthBias2EXT path
(`DepthBiasCommand`, `depth_bias_command`, the record's pinned representation,
the device's command, its priming and `DEPTH_BIAS_CALLS`, the exit guard's and
recorder's `CmdSetDepthBias2`, `Logged::SetDepthBias2` and its thunk, so
`CommandsReplayed::cmd_set_depth_bias2` goes). VK_EXT_depth_bias_control is
still described but no longer consumed, so the core recommends enabling neither
it nor its three features.
RADV on the 780M no longer takes DriverDeviation::MetalDepth16BiasedStores: it
was measured through the exact unit. MoltenVK keeps it (it hands Metal its
constant, by construction). Elsewhere `unorm-depth-bias` announces the device's
bias; its cost text, docs/API.md's entry, the deviation and property docs and a
new FAST-PATHS device-gap row state it.
Tests: `metal::state::a_unorm_depth_bias_is_metals_constant_in_the_devices_unit`
(the constant as given on lavapipe, NVIDIA and MoltenVK, which have
depthBiasExact or not); the recommendation test leaves the extension and its
features out; the driver-facts test drops RADV's row; the exit-guard tests lose
the priming group and render_state.rs as a keeper of the device's functions.
api_signatures blessed (DepthBiasUnit, DepthBias::unit, depth_bias's signature);
the refusal surface is unchanged. Not bumped here: RUNTIME_VERSION (the versions
commit) and the runtime-sources pin (landing).
Verified: cargo clippy -p metal2vulkan -p metal2vulkan-runtime
-p metal2vulkan-validation --all-targets --all-features -D warnings; nextest of
metal::state, device::tests::{enables,driver_facts,profile}, tests::fast_paths,
api_surface, api_signatures, exit_guard, render_state, degradation_catalogue,
draw_shape_notices and ash_interop: 159 passed.
* Cite the spec that leaves a NaN fragment depth undefined, which makes its discard capability
The native-arithmetic audit asked whether `clamp_depth`'s discard of a positive NaN
depth, on every profile, emulates Metal where the device has a native form. It does
not: Vulkan defines no answer for such a depth. "Depth Clamping and Range
Adjustment" (fragops.adoc, 35.10.1): "If zf is not in the range [zmin, zmax],
then zf is undefined following this step", with or without depthClampEnable, and a
NaN lies in no range; only depthClampZeroOne, which no profile enables, keeps a
float depth unchanged (and then the comparison of a NaN would still pass ALWAYS
and NOT_EQUAL, where Metal's fails every test). So the discard stays, as
capability, and the comment says why, so a later audit does not re-raise it.
Docs only (a doc comment); no behaviour changes.
Verified: cargo fmt --all.
* Drop the cube's unmeasured gradient route from the anisotropic tests' profile comment
The route was deleted with the native cube gradients; the comment still named it as a second
home of the anisotropic emulation. Only a profile without samplerAnisotropy emulates it now.
Verified: comment only; git grep finds no other mention of the unmeasured gradient route.
* Keep the device's store of an extended-range, padded or bfloat attachment's untouched texels
What: a render pass that loads and stores a color attachment of an extended-range, padded
10-bit or bfloat format now keeps the bytes its draws do not write, the device's own load and
store (VK_ATTACHMENT_STORE_OP_STORE of a loaded attachment), on every device. The runtime no
longer reproduces Metal's tile store: the load pass that rewrote the texels' unused bits before
the pass (render/unused_bits_load.rs, bind::unused_bits_module), the capture replay that found
the tiles a pass's draws reach for it (render/capture.rs, bind::capture_assembly_module,
capture_settle_module, tile_reach_module, the translator's capture form
LoweringInputs/VariantKey::captured_positions, CaptureForm, RuntimeFact::CapturedPositions,
PushField/PushHole::CaptureAddress, Feature::TileReach, StatusBits::CAPTURED_REACH_UNMEASURED,
StatusReport::captured_reach_unmeasured) and the pipeline states' capture forms are deleted, with
ExtendedRange::load_code, Degradation::UnreachedTilesRewritten and the WorkCounts fields
unused_bits_load_passes, unused_bits_load_texels and capture_reach_*. Every draw in such a pass
announces extended-range-bits-kept, naming the attachments (render/tile_store.rs, the renamed
module); its catalogue entry, the FAST-PATHS device-gap row and the format docs state what
differs: the unused bits, BGRA10_XR's alpha clamp, a padded sRGB twin's table and a bfloat code
through half, which Metal's pass rewrites in each tile a draw reaches. snorm-minimum-kept and
shared-exponent-kept are unchanged (TileStoreIsMetals still says where the device's store is
Metal's).
The de-indexed and private list forms keep the index read the capture form shared
(PushField::CaptureIndexAddress, CaptureLayout, CapturedIndex); the binder's de-indexed draw no
longer goes through the capture draw, and the vertex function's strip restart return, which only
the capture form's layout could take (a de-indexed strip is NotImplemented(PrimitiveId)), is
gone.
Why: the owner's rule 1. The device has a native load and store; reproducing Metal's tile store
emulated Metal's bits where the device has a native form. The difference is recorded and
announced (rule 2).
Verified: cargo clippy -D warnings, all targets and features, over metal2vulkan,
metal2vulkan-runtime, metal2vulkan-validation and metal2vulkan-conformance, plain and with
--cfg m2v_gpu: clean. api_signatures blessed, REFUSALS.md regenerated. The test runs (translator
and runtime suites, the touched validation lanes on lavapipe and on the M3 Max's MoltenVK) follow
this commit and are reported with the lane.
* Bump the semantics and runtime versions for the device's tile store and depth bias
What: SEMANTICS_VERSION 1907 -> 1908 and RUNTIME_VERSION 1681 -> 1682.
Why: SEMANTICS_VERSION, because the translator's output changes under unchanged keys: the
de-indexed and private list vertex forms no longer carry the strip restart return, and the
capture form, its runtime fact and its push field are gone. RUNTIME_VERSION, because runs of
unchanged artifacts now do something else: a Depth16Unorm depth takes the device's depth bias
(no depthBiasExact or unit rescale), and a pass that loads an extended-range, padded or bfloat
attachment keeps its untouched texels' bytes (no unused-bits load pass, no capture replay) and
announces extended-range-bits-kept. ARTIFACT_FORMAT_VERSION stays: the codec tags variants by
name, and the removed ones (CaptureForm, PushField::CaptureAddress,
RuntimeFact::CapturedPositions) leave their tags unused, so an old entry holding one is a miss.
Verified: the constants alone change; the golden tables and the runtime-sources pin are
re-blessed at landing.
* Hold the lanes and the fact census to the device's store of untouched texels
What: three runtime lanes still expected Metal's tile store after 5e710fb988 made the device's
store the only form, and the mechanism test still counted the deleted
RuntimeFact::CapturedPositions.
- extended_range_blends::a_pass_of_extended_range_and_padded_colors_names_each_loaded_color:
the padded colors, which the function does not write, keep their bytes (all ones), where
Metal's pass leaves each word 0xffc0.
- extended_range_blends::a_fetched_two_plane_attachment_written_unblended_stores_metals_write:
color 2, loaded and unwritten, keeps its bytes, where Metal's pass zeroes its color words' top
two bits.
- extended_range_blend_table::a_memoryless_color_2_blends_as_a_stored_color_does: the stored
color 0's bands are compared with the unused bits as Metal's pass leaves them
(as_metal_leaves), the codes exactly, as the table's other passes already are.
- device::tests::mechanism: the variant census is 0..89 (MergedDraws takes the freed index).
Why: the lanes held the deleted exact form; the device's store is now the contract and
extended-range-bits-kept announces the difference.
Verified: on the M3 Max (MoltenVK, --cfg m2v_gpu, under maclock and memcap) the three lanes and
the rest of extended_range_blends pass (11 of 11, with waiter_submits, which failed once under a
load of 40 and passed on its rerun); on plain, device::tests::mechanism and tests::fast_paths
pass (12 of 12); clippy -D warnings clean, plain and --cfg m2v_gpu, over the four crates.
* Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
|
||
|
|
7cce610704 |
Delete the shader-side dropped-store mask
One work packet, landed as 5 commits (a31d02e99a..46c3156d42 on archive/development-linear-2026-10-28), in order: * Delete the shader-side dropped-store mask What. The per-stage mask of buffer slots whose stores the shader drops goes, with everything that existed only for it: - translator: the store-dropping lowering (lower/access/sink.rs; the guarded stores in emit, psb, pulled, dynamic, atomic and blob; the write-only store-sink binding and the OpSelect of two storage-buffer pointers that chose it, with its VariablePointers requirement), the specialization key, the stage-table field and their codec tags; - runtime: argument_table's dropped_store_buffers and its refresh, Buffer::drops_writes (now unused), the two variable-pointer enables, and SetZeroChoice.store_sinks (now the layout's set-0 bindings); - tests: engine_dropped_stores, engine_dropped_store_sink, the sink cases of neutral_zeros_shared, and dynamic_multi_variable's two encoders_plain tests, whose only binding of several variables was the sink. The narrow-unit kernel now runs at its buffers' starts and at moving offsets: the moved run checks that a dynamic offset reaches every variable of its three-variable binding, and no dispatch at a moved offset reuses its predecessor's set in either form, since a slot read to its buffer's end has a range that moves with its offset; - the Apple M3 Max known-gaps row for host-page-writes-kernel-store-read-only at case/bytes-in-the-same-command-buffer-bytes, which this fixes. Removed public items: - metal2vulkan::bind::StageTable::dropped_store_buffers (field) - metal2vulkan::bind::StageShape::dropped_store_buffers (field) - metal2vulkan::pipeline::SpecKey::DroppedStoreSlots(Stage) - metal2vulkan::pipeline::SyntheticBinding::StoreSink - metal2vulkan::device::VkFeature::VariablePointers - metal2vulkan::device::VkFeature::VariablePointersStorageBuffer (the two features were asked for only by the sink's pointer select) Why. The mask was set only from Buffer::drops_writes, which is true only for host pages imported through a read-only view, and only macOS makes one (VIEWS_DROP_WRITES; ReadOnlyView::of is None elsewhere, and no_copy_options keeps the private bit off it). No other path set it: Linux writable imports, dma-buf imports (excluded where writes drop), heaps (the same import) and argument buffers (which name no slot). On that memory the view already takes the GPU's writes nowhere, so the shader-side drop was redundant there. It was also wrong: a later command of the same command buffer reads the stored words back from the GPU's caches on Metal (8 runs of 8 on the M3 Max), and the shader-side drop made it read the pages' own bytes. Versions, placeholders for the landing to renumber: SEMANTICS_VERSION 2000, ARTIFACT_FORMAT_VERSION 500 (the codec loses four tags), RUNTIME_VERSION 1840. api_signatures.tsv re-blessed, docs/REFUSALS.md and docs/CONFORMANCE-COVERAGE.md regenerated, the runtime sources re-pinned. FAST-PATHS: the read-only-memory known gap now says what is true (writes reach the pages off macOS), and the dynamic multi-variable row is scoped to bindings whose range stays as their offset moves. Verified: - metal2vulkan suite: 3329 of 3330 pass. golden_hashes moves 3391 cells (every module with a device store loses its guard); the table is re-blessed on development. - clippy -D warnings clean, plain and with --cfg m2v_gpu; rustdoc -D warnings clean for the four touched crates. - MoltenVK 1.4.2 on the M3 Max: conformance replay of the four host-page-writes cases exits 0, both kernel-store cases exact (the visibility pair "announced", the fast-math notice, as before). The host-page, read-only and private-bit lanes and argument_table, neutral_zeros_shared and dynamic_multi_variable pass. - lavapipe (arm64, linux-gate): full conformance replay exits 0, its 891 gap rows exactly the ones the ledger expects on the venue (none unlisted, none stale); the same lanes pass. * Lane: a kernel's stores into private-bit memory reach only its own command buffer What. runtime_lane::degrade_notices gains a_kernel_s_stores_into_private_bit_memory_reach_only_its_own_command_buffer. It dispatches a4_index_word into no-copy memory of an anonymous mapping, filled with 0xab and made with Metal's private option bit 24, bound 512 bytes in, then copies the first 1024 bytes in the same command buffer and in a later one, and reads them from the CPU. Why. It holds Metal's measured answer where the runtime gives it: the same command buffer's copy reads the stored words, everywhere; on macOS, where the pages come through a read-only view, the later command buffer and the CPU read the pages' own bytes and nothing is announced; elsewhere they read the stores, announced once as the private-option notice. Every byte the stores do not name keeps 0xab at every site. Verified: MoltenVK 1.4.2 on the M3 Max prints "drops writes true; same command buffer stored true, later command buffer stored false, CPU stored false" and passes; lavapipe (arm64) prints "drops writes false; ... true, true, true" and passes. * Number SEMANTICS_VERSION 1907, ARTIFACT_FORMAT_VERSION 475 and RUNTIME_VERSION 1681, past development's The dropped-store mask's deletion took the placeholders 2000, 500 and 1840; development is at 1906, 474 and 1680. * Re-bless the golden tables after the dropped-store mask's deletion Every module with a device store loses its read-only guard (a31d02e99a), so bless_golden_hashes moves 1330 rows of golden_hashes.tsv; bless_engine_inventory, bless_engine_goldens and tests::air_input wrote nothing new. Verified: the three bless runs and air_input exit 0 at 623f8d2170. * Re-bless the authored compile census after the dropped-store mask's deletion corpus-triage --audit authored-compile --bless over 2253 cases and 21 profiles: 0 differences, 0 regressions, 0 failed, 20159 artifacts moved by hash alone (the store guard's words). Slowest compile 586 ms, slowest case across all profiles 18.5 s, peak worker RSS 231 MB. Verified: the census run above at 623f8d2170. |
||
|
|
12cd1535a8 |
Keep the device's copy for blits through a texture Metal compresses
One work packet, landed as 9 commits (62c7d7a9f5..378d636d2f on archive/development-linear-2026-10-28), in order:
* Keep the device's copy for blits through a texture Metal compresses
Metal's GPU blit into or out of a texture it keeps losslessly compressed
writes three families' texels in its compressor's canonical encoding:
BGRA10_XR (and its sRGB twin) with each field's low six bits cleared and
the alpha code clamped, RG11B10Float with a NaN made the quiet NaN, and
RGB9E5Float with the shared exponent lowered. The runtime reproduced that
with a crate-owned compute rewrite of the copied rows (bind::CompressedBlit
and its module) after every such blit.
That is Metal's compressor's encoding, not the format's: Metal's own
uncompressed texture of the format keeps the bytes through the same blit,
and every rewritten texel reads the same value either way. The device's
copy, which keeps the bytes, is now the only form. A blit through such a
texture announces the note of the encoding it keeps, once per device:
extended-range-bits-kept (BGRA10_XR), device-nan-encoding (RG11B10Float)
and shared-exponent-kept (RGB9E5Float), each existing kinds; no new kind.
Where the device's own copy already writes Metal's encoding (MoltenVK,
RuntimeDriverDefect::CompressedImageCopiesRewriteTexels) nothing is
announced; the defect's PixelFormatView usage, which keeps CPU copies
byte-exact there, stays.
Removed public items: bind::CompressedBlit, bind::CompressedBlitModule,
bind::compressed_blit_module, WorkCounts::compressed_rows_rewritten.
RUNTIME_VERSION 1740. The conformance recordings' runtime cost records
that count compressed_rows_rewritten (compressed-blits-*, fresh-pattern-*,
xr-clear-routes-*, xr-draw-*) move at the next re-bless.
The compressed-blits lane now asserts the bytes are kept and each format's
note is announced; the conformance case declares the note where it is not
one of the suite's native notes.
Verified: cargo clippy --workspace --all-targets --all-features -D warnings;
RUSTFLAGS='--cfg m2v_gpu' cargo check of runtime and validation; nextest
of blit_plan, degradation, degradation_catalogue, conformance
compressed_blits, unused_bits, fast_paths, owned_divisions, api_surface,
api_signatures and refusal_surface (77 passed). Device lanes and replay
run after the whole series.
* Resolve a fetching pass's sample planes by the device's average
A color attachment whose sample planes held its samples as the pass ended
(framebuffer fetch in the pixel interlock on a device without multisampled
storage images: ANV, MoltenVK) was resolved from the planes by the
crate-owned resolve, which computes Metal's closed rules for every unorm,
snorm, sRGB, 32-bit float, half, packed 16-bit, RG11B10Float and
RGB9E5Float format. Every other color attachment resolves by the device's
AVERAGE. The average is the device's native answer, so it is now the only
form here too: the planes merge back and one more instance of no draws
resolves the attachment, announced device-rounded-resolve where the
driver's average is not measured to be Metal's (on MoltenVK it is,
DriverFact::ColorResolveAverageIsMetals, so nothing is announced there).
The crate-owned resolve keeps the two resolves no device's average writes:
into the attachment's format's sRGB twin (the 8-bit unorm and sRGB rules)
and of an extended-range attachment. Its rules for every other format, and
their tests, are deleted. ColorResolveFormat::of names the twin's eight
formats; sample planes are read only for an extended-range form, and a
module of a twin format from planes is refused.
Removed public items: ResolveRule::{HalfUnorm, Snorm, Float32, Float16,
SmallFloat, SharedExponent}, ResolveRule::bits, ResolveRule::resolves,
ColorResolveFormat::resolves; ResolveRule::Unorm loses its bits field.
Cost: such a pass now merges its planes back and resolves in one more
render pass instance, where it drew one resolve pass from the planes; a
memoryless attachment the pass only fetches and resolves needs a backing.
The ColorResolveAverageIsMetals docs, the shader-resolve and
device-rounded-resolve entries (degradation.rs, docs/API.md) now say what
resolves where. The fetch lanes expect no shader-resolve for a fetched
attachment.
Verified: cargo check --workspace --all-targets --all-features; the GPU
cfg check of runtime and validation; nextest of color_resolve,
sample_planes, degradation, driver_facts, fast_paths, api_surface,
api_signatures, refusal_surface (84 passed). Device lanes run after the
series.
* Clear a float attachment to the clear color as the device converts it
A render pass's Clear of a normalized, sRGB, packed 16-bit, half, float or
small-float color attachment computed Metal's texel on the CPU (its
rounding, its trip through half for the packed 16-bit formats, its
truncated small-float and shared-exponent mantissas) and handed the device
a value that converts back to it; a Depth16Unorm clear took a quarter step
above Metal's truncated code. The conversion is the device's native
answer, so the clear value is now the color (or depth) as a float, which
the device converts.
Where the device's conversion can stand a code from Metal's it is
announced, once per device: device-color-conversion where a normalized
channel's scaled value lies within 1/1024 of a midpoint between two codes
(a packed 16-bit channel's within Metal's half step too), an sRGB channel
lies inside (0, 1), or a half, small float or shared exponent does not
hold the value exactly; unorm-depth-rounding where a Depth16Unorm depth's
scaled value lies at or above a midpoint, which Metal truncates and a
device rounding to nearest takes up. Vulkan asks for rounding to nearest
and leaves ties, sRGB encodes and float rounding to the device. A NaN in a
normalized or RGB9E5Float channel still clears as 0 (Vulkan states no such
conversion); integer, extended-range, word and YCbCr attachments keep
Metal's conversion, which no device makes for them.
Metal's measured conversion moves into the tests as the model they compare
with. The renders lane accepts a device texel a code from Metal's where
the note is announced and prints it; the cleared sRGB resolve lane
compares the resolve with the device's own 1x clear.
UnormDepthRounding's docs and cost, PrecisionNote::DeviceColorConversion's
docs and both docs/API.md entries say so.
Verified: cargo clippy --workspace --all-targets --all-features -D
warnings; the GPU cfg check of validation; nextest of clear_value,
heap_tiled, fresh, nan_clear and degradation (55 passed). Device lanes and
replay run after the series.
* Expect the device's clear conversion in the lanes that clear at a tie
Since 5925c303f8 a clear converts the clear color (and a 16-bit depth)
the device's way, announcing device-color-conversion where a channel
lies at a rounding question (0.5 on an 8-bit unorm channel is 127.5
codes, a tie; any sRGB channel's encode) and unorm-depth-rounding where
a Depth16Unorm clear's fraction reaches the midpoint (Metal truncates).
Lanes that hold exact notice sets or Metal's truncated depth codes now
expect them:
- dont_care_stores: every pass clears through color_pass or earlier()
at 0.5; clear_tie() adds the note to each expected set (MoltenVK's
pipelines record no color-conversion note, so it showed there first).
- resolves: the depth stand-in clears Depth16Unorm to 0.5 (32767.5
codes): Metal's 0x7fff or the device's 0x8000, and the note announced
exactly for that format.
- buffer_depth_samples: the 16-bit clear to 0.25 (16383.75 codes)
announces unorm-depth-rounding.
- buffer_texture_blits: the planar depth clears (0.375, 0.625, 0.875)
hold Metal's truncated code or the one above it, the note's bound.
Verified: the four lanes' failing tests on lavapipe (linux-gate
halfnative) failed before these edits; on MoltenVK (Apple M3 Max,
maclock) dont_care_stores, resolves' depth stand-in,
buffer_depth_samples and the planar depth lane pass with them.
* Merge a fetched attachment's sample planes back before its twin resolve
A pass whose last draws fetch a multisampled attachment through sample
planes (the pixel interlock without multisampled storage images: ANV,
MoltenVK) left the planes unmerged after it under MultisampleResolve
wherever the crate-owned resolve drew the attachment's resolve, on the
reading that that resolve reads the planes. A resolve into the
attachment's sRGB twin is crate-owned but reads the attachment itself
(color_resolve.rs filters its planes out), so it resolved samples the
pass never wrote: on MoltenVK a 4x RGBA8Unorm attachment cleared to 0,
fetched once and resolved into RGBA8Unorm_sRGB read all zeros, where
the same pass stored too resolves (255, 225, 0, 0).
The planes steps now skip the merge only for a resolve that reads the
planes, an extended-range attachment's (the flag is renamed
planes_resolve to say so); a twin resolve merges first, as a stored
attachment does.
Test: runtime_lane::framebuffer_fetch::planes::
a_twin_resolve_of_a_fetched_attachment_reads_its_samples holds the
MultisampleResolve answer to the StoreAndMultisampleResolve one.
Verified on MoltenVK (Apple M3 Max, maclock): the test failed without
the fix (zeros) and passes with it, beside the planes, memoryless,
kept_resolves and twin-resolve lanes (18 passed); the runtime's
sample_planes unit tests pass.
* Expect the clear note in color_reformat's passes, through one helper
color_reformat's passes clear to (0.5, 0.25, 0.75, 1.0), whose red is a
tie in an 8-bit unorm channel, so the device's conversion of the clear
announces device-color-conversion at the device's first such pass.
Lavapipe's pipelines record the note already; MoltenVK's record none
(VkProperty::MetalColorWrites), so its exact notice sets failed there.
degrade_notices::tie_cleared() names that note for every lane whose
passes clear at a tie; dont_care_stores' local helper moves there.
Verified on MoltenVK (Apple M3 Max, maclock): color_reformat and
dont_care_stores pass (they failed in the full runtime_lane run before
this change).
* Hold the kept compressed-blit encodings to the ledger, and declare their notes
Since 01f733c6f0 a blit through a texture Metal keeps losslessly
compressed is the device's copy, which keeps the bytes Metal's
compression rewrites into the canonical encoding. The lavapipe replay
then read 46 rows the ledger did not expect:
- 28 value sites of compressed-blits-{bgra10xr,bgra10xr-srgb,rg11b10f,
rgb9e5f}: the device's bytes against Metal's canonical encoding. Each
is now a known-gaps.tsv row (venue llvmpipe) naming the note that
records it: extended-range-bits-kept, device-nan-encoding,
shared-exponent-kept, whose bound (the same value, another encoding)
covers it. Nothing is open: rule 1 rules out writing Metal's encoding.
- 18 notice sites of fresh-pattern-{552,553,93}, xr-draw-bgra10xr*
and xr-clear-routes-bgra10xr*: their read-backs blit out of such a
texture and announce the note, every value exact. They now declare
it through compressed_blits::kept_encoding_notice, the one table of
which format announces which note (device-nan-encoding is native and
declared for every case already). fresh_contents' row-notice test
counts the three pattern rows' second allowance.
docs/CONFORMANCE-COVERAGE.md regenerated (the ledger's row count).
Verified: conformance replay --cpu on lavapipe (linux-gate halfnative,
arm64): exit 0, 751 rows, exactly the ledger's (723 before the series
plus these 28), 0 unlisted and 0 stale; cargo nextest -p
metal2vulkan-conformance (1005 passed); clippy -D warnings.
* Format owned_divisions' bind import after the rebase
The rebase onto development dropped both CompressedBlit (this series)
and BlockDecode (development's BC twin removal) from the import, which
rustfmt now joins onto one line. No behaviour changes.
Verified: cargo fmt --all --check.
* Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
|
||
|
|
8acf6ae154 |
Sample a BC texture's own image through the device's decode, keeping no twin
One work packet, landed as 3 commits (d8bb73078f..862d4c13a1 on archive/development-linear-2026-10-28), in order: * Sample a BC texture's own image through the device's decode, keeping no twin Under the native-arithmetic rule a device that has a BC format decodes it itself: its decode is the answer, recorded where it can differ from Metal's. The BC1 to BC5 decoded twin emulated Metal's 6-bit-weight decode on drivers not measured to make it (lavapipe, NVIDIA, ANV, RADV's BC4/BC5), at the cost of a second image 4 to 8 times the blocks and a decode after every write. It goes, and with it every piece only it used: - the translator's `bind::BlockDecode` and `bind::block_decode_module` (Metal's fitted BC1 to BC5 decode, its kernel and its tests); `bind/block_decode.rs` keeps only what the carriers' decode modules share (`BlockDecodeModule`, the bindings, `table`, `decode_module`); - the runtime's `TwinDecode::Block`, `Device::twin_decode`, the twin's announcement `decoded-block-twin` (`Degradation::DecodedBlockTwin`, removed), the view-decode notice for a view of another decode (`degrade_view_decode`, `degrade_device_decode`), and the device-test-only `Scheduler::decodes_pending`, which only the BC twin's CPU decodes needed. A BC texture (BC1 to BC7, the sRGB forms too) is now its own BC image on every device, and on a device whose driver lacks the format's fact (`ColorBlockDecodeIsMetals`, `ChannelBlockDecodeIsMetals`, `Bc6hBlockDecodeIsMetals`, `Bc7BlockDecodeIsMetals`) announces `compressed-texel-decode`, now also for a sparse texture and a texture over the caller's `VkImage`, which announced nothing before. The facts still decide the note. The carriers' twins (ASTC, PVRTC, ETC2/EAC, 4:2:2) and their CPU decode thread are unchanged; a carrier whose twin's format the device cannot sample is now refused typed instead of read as its carrier (no conformant device lacks those formats). The sRGB forms' read through Metal's table is unchanged here (another change replaces it). Lanes and suite: - `runtime_lane::compressed_decode` reads the device's decode: exact where the driver has the fact (within `device-texel-conversion`'s ulp off Metal's sampler), else within the note's stated per-format bound, with the note announced; no write makes a decode pass or CPU decode. - `cpu-block-decode` keeps a lane site in `astc_textures` (`astc_cpu_writes_decode_on_the_cpu`, the CPU decode thread's ordering behind work in flight), and `chroma_pairs` holds its notice to the CPU decodes on every device. - conformance: `compressed-texel-decode` joins `replay::NATIVE_NOTES`; the BC cases declare no twin notices; 40 llvmpipe rows in known-gaps.tsv, one per BC1 to BC5 round, each within the note's lavapipe bound. The cross-check `every_recorded_texel_is_the_lanes_fitted_rule` still holds the M3 Max's recorded texels to the case's own model of Metal's decode. - new device test `tests::bc_own_image`: every BC format, `Shared` by `replaceRegion`, `Private` by a blit and a heap's, has no twin, keeps its blocks, makes no decode, and announces the note exactly where the fact is missing. Docs: API.md's `compressed-texel-decode` entry and cost (lavapipe's BC4/BC5 bound widened to 2.4/255, signed 0.022, as measured below), `decoded-block-twin` removed; a FAST-PATHS.md device-gap row; REFUSALS.md, api_signatures.tsv, api_surface and CONFORMANCE-COVERAGE.md regenerated. RUNTIME_VERSION 1669 -> 1710 (renumbered at landing). SEMANTICS_VERSION stays: no translation changes, so the golden hashes do not move. The runtime-sources pin is not re-pinned here. Verified: - clippy `--workspace --all-targets --all-features -D warnings`, plain and `--cfg m2v_gpu`; rustdoc with `-D warnings`; the refusal, signature, Metal and conformance coverage checks. - macOS, no device: metal2vulkan-runtime + metal2vulkan-conformance 2139 passed; metal2vulkan's fast_paths, owned_divisions, bind, api_surface, api_signatures, driver_facts and cache tests 568 passed; conformance again after the ledger rows, 1007 passed. - lavapipe (linux-gate arm64, `--cfg m2v_cpu_icd`): 145 tests of the touched families passed (bc_own_image, compressed_decode, astc_textures, chroma_pairs, pvrtc/etc textures, degrade_notices, texture_blits/fills, cpu_copy_layouts, image_plan, first_moves, the degradation tests). Largest differences from Metal: BC1/BC2 2/255, BC3 3/255, BC4 2.28/255 (signed 0.0172), BC5 2.31/255 (signed 0.0212); BC6H has its fact there, BC7 announces. `conformance replay --cpu`: the only unlisted gaps were these 40 BC rounds, no stale row. - MoltenVK on the M3 Max (maclock, memcap): 43 tests passed, every BC1 to BC5 channel exactly Metal's, no `compressed-texel-decode`; the replay of 105 touched cases left all 41 BC cases exact (one unrelated divergence, `read-write-tier-held`'s `set-past-layout-support` notice). * Count the ASTC CPU-write lane's behind-work decodes from before the making `astc_cpu_writes_decode_on_the_cpu` failed once on lavapipe after the rebase onto cb759a4c4a: "ASTC4x4LDR Event: 2 CPU decodes, not 1". The cause is the test's window, not a second decode. `WorkCounts::cpu_block_decodes` counts a write's decode when the device's decode thread finishes it (`Image::finish_twin_decode`). The case writes the old blocks, commits the reader, and only then took `before`. In the Busy case `scheduled(&reads)` waits for the reader's batch, which the scheduler holds until the old blocks' decode finished, so `before` already holds it. In the Event case nothing waits, so the old blocks' decode could land after `before` and be counted with the new ones'. Each write queues exactly one job, and the thread takes them in order, so 2 is the old write plus the new. Now the case counts from before the texture's making and expects exactly two CPU decodes (its two writes) where the copies go on the host or the staging queue, and none elsewhere. The count is read after the later reader completed. That reader's batch waits for the new write's decode, the thread finished every earlier job by then, and it counts each job before it releases the batches that wait for it. Every earlier case's decodes landed before its own later reader completed too. No sleep, and no looser bound. Verified: clippy of the validation crate under `--cfg m2v_gpu`; on lavapipe (linux-gate arm64, `--cfg m2v_cpu_icd`), the test 20 times and the families bc_own_image|cpu_copy_layouts|compressed_decode|degrade_notices|astc|etc_textures|chroma_pairs| event_round_trips|grouped_submissions|waiter_submits|scheduler. The 20 runs all passed: each of the 80 behind-work cases (two formats, Busy and Event) counted exactly 2 CPU decodes, 0 cases wrong; 13 Busy cases were void (the reader ran before the write) and 2 to 4 cases a run held. The families: 86 tests passed. * Re-pin the runtime sources at the landing tip The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
5d09f454b4 |
Make the mipmap compute filter a plain bilinear filter in float
One work packet, landed as 4 commits (87ed7f903a..1af72fc0d8 on archive/development-linear-2026-10-28), in order: * Make the mipmap compute filter a plain bilinear filter in float The owner's decision for generate_mipmaps: the device's blit chain is the answer wherever the device blit-filters the format, and a compute filter runs only where it cannot (extended-range formats, formats without blits or linear filtering). That filter is a plain bilinear (trilinear in 3D) filter at texel centres in float, not a model of Apple's datapath. bind::mipmap_filter keeps its planning, scratch layout and first-level fetch, and drops the exact machinery: the measured answer tables, the reciprocal and tail models, the soft-float arithmetic and MipmapRule. The kernel decodes each field to float (Metal's 8-bit sRGB and extended-range sRGB tables, the packed floats and RGB9E5 exactly), sums the taps a linear sampler takes at the texel centres in tap order with no contraction, and encodes to nearest even. It needs no 64-bit integers. cpu.rs is the same filter on the CPU, the kernel's reference. The runtime still names the removed items; it follows in the next commit. Verified: cargo nextest run -p metal2vulkan --all-features --lib -E 'test(/mipmap_filter/) | test(/owned_divisions/)', 9 passed: every kernel validates on every committed profile, and the kernel run in the SPIR-V interpreter equals the CPU filter byte for byte over 38 formats and 9 shapes (arrays, cube, 3D, strips) and over 39 fetched first levels. * Make generate_mipmaps the device's filter: its blits, else the compute filter The owner's decision for generate_mipmaps: the device's blit chain (vkCmdBlitImage, VK_FILTER_LINEAR) is the answer for every format its blits filter, and the compute filter only where they cannot. No refusal for accuracy; refusals stay for what cannot run or what Metal refuses. mipmap_plan::plan_mipmaps now plans Blits, Picks or Filter. A filtered format takes the blit chain where the image's format has BLIT_SRC, BLIT_DST and SAMPLED_IMAGE_FILTER_LINEAR and the image takes transfers; it takes the compute filter where they lack (an extended-range format, an 8-bit sRGB texture held as its UNORM twin, a format without blits or linear filtering) and the filter computes the format in an image of its bytes. Otherwise the refusal names what the blits lack. The 1D refusal is gone (Metal makes 1D textures of one level, which are left as they are). Removed: the per-format first-use check against mipmap_answers.txt (mipmap.rs keeps only the blit recorder), mipmap_answers.txt, MipmapVerdict and Device::mipmap_generation, metal_release::MIPMAP_RULE, the texture facts' check cache, new_runtime_texture (only the check used it), and the degradation kinds mipmaps-within-spread and mipmap-tie-rounding. One kind replaces them: device-filtered-mipmaps (precision), announced once per device on both paths. WorkCounts::mipmaps_filtered counts compute-filter chains; image_blits_recorded counts the chain's blits. The filter kernel now decodes normalized, sRGB-step and extended-range codes by a product with a reciprocal rounded once to f32 instead of a division, so every operation is one Vulkan has a device round correctly and the CPU model is the device's answer on a device keeping f32 subnormals. The validation lane mipmaps_exact becomes mipmap_chains: the blit chain (work counts, each halving level within a code of the float filter, announced), every format the filter computes (the device's blits or the filter, the filter's levels byte for byte the CPU's), an extended-range texture announced as the filter, the picks, and the in-place fetch. texture_blits' every-format lane prints each format's way. Docs: API.md's catalogue, FAST-PATHS.md (a device-gaps row; the BGRA4Unorm gap's text), the runtime README, REFUSALS.md regenerated, api_signatures blessed, api_surface's table. RUNTIME_VERSION 1665 -> 1666 (mipmap behaviour changed) and the runtime-sources pin. Verified: cargo clippy --workspace --all-targets --all-features -D warnings, plain and with --cfg m2v_gpu; rustdoc -D warnings for metal2vulkan and the runtime; the runtime's whole suite plus the translator's surface, fast paths, refusal and mipmap tests (1180 passed); the runtime-sources guard. On lavapipe (scripts/linux-gate, arm64, --cfg m2v_cpu_icd), 13 passed: mipmap_chains (5), texture_blits' every-format lane, read_through_views' mipmaps, memoryless_uses (4), rgbx_textures' refusals and degrade_notices' site list. There the blits made 29 of the 38 formats the filter computes (87 chains), the compute filter made R8Unorm_sRGB, RG8Unorm_sRGB, RG11B10Float, RGB9E5Float, BGR10A2Unorm and the four XR formats (27 chains), each the CPU's byte for byte, and device-filtered-mipmaps was announced once. * Hold the device's filtered mipmaps among the conformance suite's native notes generate_mipmaps is now the device's filter (its blit chain, else the compute filter) and announces device-filtered-mipmaps: the device's own filtering, which rule 1 names, so it joins replay::NATIVE_NOTES beside device-sampling. Values still compare field by field. Verified on the merged tree (5a1a62bb0e + the mipmap commits): clippy --workspace --all-targets --all-features clean; nextest -p metal2vulkan-conformance -p metal2vulkan-runtime: 2140 passed. * Re-pin the runtime sources at the landing tip The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
7e86900912 |
Leave half-float texel writes to the device: drop the half-bits paths
One work packet, landed as 4 commits (a6e81074ae..77a585c009 on archive/development-linear-2026-10-28), in order: * Leave half-float texel writes to the device: drop the half-bits paths Under the native-arithmetic ruling the device's own write is the answer for a half-float texture's stored NaN, recorded as DeviceNanEncoding (or MetalHalfTexelWrites / MetalHalfStorageNans where measured). Two paths existed only to store Metal's half NaN bits: - the half-texel write route through the texture's unsigned integer alias (StorageImageClass::HalfBits), which a slot that writes a half-float texture took on a device without MetalHalfTexelWrites, with its alias view (metal::format::half_bits_view), its read and write conversions, its imageblock-slice bits leaf, the read note it recorded, and the own-format-views fact a wrapped image without MUTABLE_FORMAT needed to opt out of it (TextureFacts::own_format_views, TextureShape's field, storage_choice_viewed); - the heap twin: StorageFormatClass::HalfBits and its neutral and heap class, the twin's element view, the own-view heap class indices (heap_own_view_index, HALF_BITS_FORMATS, heap_half_bits_indices), the twin write and its class test, RuntimeFact::HeapHalfTexelWrites, bind::heap_write_nans_converted, metal::format::half_write_nans_converted, and the runtime's NanResidue and its draw-time announcement. What a device needs to write such a texture at all is unchanged: a half-float slot is the format's own Identity choice on every profile. The heap write path now records its notes statically: a float write's rounding and NaN as MetalHalfStorageWrites/MetalHalfStorageNans or DeviceColorConversion/DeviceNanEncoding, a half write's NaN as DeviceNanEncoding. Tests follow the behaviour: the format test asserts Identity for every use, the heap texel write test asserts one storage class and the note, the half-slice test asserts the device's widened halves, the half moves and half texel write tests drop the alias case (the latter now checks a declared RGBA16Float on every profile), and the twin-only tests go. Docs the deletion made false are fixed; REFUSALS.md and api_signatures.tsv are regenerated. SEMANTICS_VERSION 1883, ARTIFACT_FORMAT_VERSION 466, RUNTIME_VERSION 1665. Verified so far: cargo check --workspace --all-targets --all-features is clean; conformance-coverage --check and refusal_surface pass. * Drop the half-bits exact form from the llvmpipe half-texel rows The llvmpipe half-texel-nans rows named the read side of the StorageImageClass::HalfBits aliasing as the exact form behind a policy switch; that aliasing is gone under the native-arithmetic ruling, so the sentence describing it is false. The rows' verdicts and the device-nan-encoding sentence stay. Verified: scripts/conformance-coverage/coverage.py --check passes. * Fix the two tests the half-bits deletion left stale device::tests::mechanism numbers every RuntimeFact densely; with HeapHalfTexelWrites gone the last tag moves into its place. merged_argument_buffer_textures_share_one_heap_class bounded the module at 1,600 words (2,300 with word ids) plus the twin's write words where the profile took the twin. Without the twin the bound shows what that allowance covered: on a device that holds an A8Unorm texture's alpha in red (metal::format::alpha_in_red), the heap write's class-index read and conversion, 87 words on RADV RDNA2/RDNA3, ANV ARL/Iris Xe, lavapipe and NVIDIA, 1,591 words elsewhere. The bound now names that allowance. Verified: both tests pass under cargo nextest; clippy -p metal2vulkan --all-targets --all-features -D warnings is clean. * Re-pin the runtime sources at the landing tip The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
79166a74b1 |
Leave NaN bits and min/max picks to the device
One work packet, landed as 6 commits (a6e97e7f93..3919c8c94a on archive/development-linear-2026-10-28), in order: * Leave NaN bits and min/max picks to the device On the owner's ruling to promise the GPU's native arithmetic with no exact emulation, delete the NaN and minimum/maximum switch and every form that only it, or Metal's NaN bits, kept. What goes: - DevicePolicy::nan_and_min_max and NanMinMaxPolicy (exact_answers line, serde, ExactFormsOverCompilerLimit::nan_and_min_max, the fit leg). - The module's selects of Metal's NaN: NanEncoding::Device, ArithStrategy::Nan and lower/arith/nan.rs down to its answer classes. A NaN Metal answers that the device is not measured to answer records NativeNanEncoding. - Metal's operand pick in fmin, fmax, min3, max3, clamp and saturate (metal_min_max, metal_saturate, MinMaxRoute): NMin, NMax and NClamp on every profile, NativeMinMax where MetalMinMax is not taken. - Metal's texel NaN rule (TexelNanRoute, the 0x7e00 keeps, the half texel NaN keep, the NaN classes of reads, samples and gathers). - NaN canonicalization before colour and storage writes: StorageImageClass::HalfQuietNan and SmallFloatQuietNan, the half write NaN classes (HalfNans), the quieted heap small floats, the colour lanes that chose 0x7fc00000, the 16-bit colour outputs (StageIo and StageModule half_bit_colors, IoType::bits, Degradation:: ShaderHalfColorBits), PushField::TextureHalfChannels, RuntimeFact::StorageTextureHalfChannels and the slot word behind it. Such writes record DeviceNanEncoding where the stored NaN may not be Metal's (heap and formatless writes, 32-bit and packed float channels). - The narrow-float vertex fetch's canonical NaN: noted instead. - The runtime's colour NaN clears (nan_clear::NanClears and its texel computation, the inline-first NaN clear refusal, WorkCounts:: passes_not_inline_actions_nan_clear): the device's clear, announced as DeviceNanEncoding. The depth NaN clear and the bit-exact copies stay. - FAST-PATHS rows for the switch, the half texel keep and the half from bits under float controls; the known gap of RADV's sampler NaN; the API.md passages and catalogue entries. Kept: the notes that describe the native answer (NativeNanEncoding, NativeMinMax, DeviceNanEncoding), the measured deviations they read, the copy and depth paths, keeps_nan_sign, the heap half-bits twin, the half rounding and the blended snorm NaN of other lanes. Versions: SEMANTICS_VERSION 1871, ARTIFACT_FORMAT_VERSION 454, RUNTIME_VERSION 1652. docs/REFUSALS.md regenerated. Verified: cargo clippy --workspace --all-targets --all-features -D warnings, plain and with --cfg m2v_gpu; RUSTDOCFLAGS='-D warnings' cargo doc --workspace --all-features --no-deps; nextest of metal2vulkan filtered to the touched modules, fast_paths, catalogue, degradation, api_surface and profile (see the report for counts), and of the runtime, validation and conformance unit tests touched. No device test was run. * Re-bless the API signatures after the NaN and min/max deletion The table loses the public items the previous commit removed: NanMinMaxPolicy and its variants, DevicePolicy::nan_and_min_max, ExactFormsOverCompilerLimit::nan_and_min_max, PushField:: TextureHalfChannels, RuntimeFact::StorageTextureHalfChannels, StorageImageClass::HalfQuietNan and SmallFloatQuietNan, StageModule::half_bit_colors, Degradation::ShaderHalfColorBits and WorkCounts::passes_not_inline_actions_nan_clear. Verified: python3 scripts/api-signatures/signatures.py --bless; nextest of the api_signatures, api_surface, refusal_surface and feature_vocabulary binaries (21 passed); the previous commit's filtered metal2vulkan run, 1056 passed, plus runtime (53), validation (83 of 84; the failing c3 venue-identity test names the Apple M4 and touches no file of this change) and conformance (38) filtered runs. * Fix the tests the rebase onto development left broken The rebase of the NaN and min/max deletion onto development left two test compile errors: the extended-range samples still round through `half_toward_zero`, which the resolution had dropped with the storage-slot test that used it, and the RGBX storage cases named `HalfQuietNan`, which both sides' deletions removed (a half-float twin is `Identity` now). Verified: cargo clippy --workspace --all-targets --all-features -D warnings, plain and with --cfg m2v_gpu; RUSTDOCFLAGS='-D warnings' cargo doc. * Drop a dead dot form and let formatless half slots note conversion twice select_float_fn still computed dot's scalar result form, which only the removed NaN canonicalization read. The half-float storage test asserted that a formatless slot notes DeviceColorConversion exactly when the profile does not round Metal's way; a formatless slot may also reach a normalized image, whose conversion is the device's on every profile, so the note is only required one way there. Verified: cargo check --workspace --all-targets --all-features is clean. * Leave the fast division's NaN to the device in its test The float-maths lane's a_fast_division_answers_metals_nans_on_every_profile asserted Metal's canonical NaN after the device's OpFDiv where the profile does not take MetalCanonicalNans. Under the native-arithmetic ruling the module selects no NaN: the fast division is the device's OpFDiv on every profile, noted NativeNanEncoding where the device is not measured to answer Metal's. The test, now a_fast_division_leaves_its_nans_to_the_device, checks that the module is the same on both sides of the fact, the note where the fact is absent, the device's arithmetic, division and denormal notes on every committed profile, never DeviceNanEncoding, a NaN for each NaN case and 6 / 3 exactly. Verified: cargo nextest -E 'test(/engine_arith::a_fast_division/)' passes (2 tests); the previous form failed on amd-780m-hawkpoint-radv for fast_one_by_negative_nan (0xffc00000, the device's). * Re-pin the runtime sources at the landing tip The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
b7a62be64b |
Drop the exact tile store: a loaded snorm or RGB9E5Float attachment keeps the device's load and store
One work packet, landed as 7 commits (c18e40911e..53fcb867b4 on archive/development-linear-2026-10-28), in order:
* Drop the exact tile store: a loaded snorm or RGB9E5Float attachment keeps the device's load and store
The owner's ruling (2026-10-27): the GPU's native answers are the contract,
with no exact emulation. TileStorePolicy and DevicePolicy::tile_store go,
with the load pass's rewrite of a signed normalized attachment's minimum
codes and an RGB9E5Float attachment's unnormalized words, and the
unused-bits module's two rules that served only it. The load pass keeps the
extended-range, padded and bfloat attachments, whose raw codes no device
holds as Metal's (capability). snorm-minimum-kept and shared-exponent-kept
still announce the native answer at each such draw; DriverFact::TileStoreIsMetals
still keeps them quiet on MoltenVK.
Docs: the ledger row and docs/API.md's policy bullet go; the catalogue
entries and the notices' docs drop the switch. The validation lane tests the
one form.
Verified: cargo clippy --workspace --all-targets --all-features -D warnings;
nextest of bind::unused_bits, tests::fast_paths, tests::owned_divisions,
api_surface and the runtime's degradation and catalogue tests (49 passed).
* Drop the exact color resolve: the device's average resolves every attachment it can
The owner's ruling (2026-10-27): the GPU's native answers are the contract.
ResolvePolicy and DevicePolicy::resolve go, with the crate-owned resolve
drawn after the pass for a format of Metal's rules on a device whose average
is not measured to be Metal's. The device's AVERAGE in the pass is the one
form there, announced device-rounded-resolve as before. The crate-owned
resolve keeps the resolves no device's average can write: an extended-range
attachment's raw codes, a resolve into the attachment's format's sRGB twin
(VUID-VkSubpassDescription-pResolveAttachments-00850), and a fetching pass's
sample planes, read in place of merging them back.
Docs: the ledger row and docs/API.md's policy bullet go; the shader-resolve,
device-rounded-resolve and unmeasured-resolve entries describe what remains
(unmeasured-resolve's cost text with them).
Validation: the lanes ran under exact_answers, so their expectations follow
the device's resolve: resolve_kind is device-rounded-resolve wherever the
average is not measured to be Metal's; the exact form's tests
(color_resolves_against_metals_rules, the caller's-image copy path, its cost
scout) go; the Maps-form and probe-6 resolves hold Metal's texels where the
fact holds and the announced bound elsewhere; shader-resolve's lane site
moves to the extended-range resolve lane.
Verified: cargo clippy --workspace --all-targets --all-features -D warnings,
plain and under --cfg m2v_gpu; nextest of fast_paths, the degradation and
catalogue tests, the runtime's resolve, sample-plane, framebuffer-fetch and
stand-in tests, and api_surface (129 passed). The device lanes were not run.
* Drop the depth twin: every Depth32Float texture is its D32_SFLOAT depth image
The owner's ruling: promise the GPU's native arithmetic, no exact emulation.
A Depth32Float texture the program only reads was held in an R32_SFLOAT
image with a D32_SFLOAT twin for comparisons, on a driver not measured to
keep every float in a depth image (plan_depth_twin), and a multisampled one
in R32_SFLOAT under MultisampleDepthTwinPolicy::Exact. Both forms exist only
to keep Metal's texel bits; the native form is the depth image, whose
possible clamp or denormal flush the existing notices already announce at
the write (restricted-depth-upload, depth-denormals).
Removed:
- MultisampleDepthTwinPolicy and DevicePolicy::multisample_depth_twin, its
FAST-PATHS row, its known-gap paragraph and its fast_paths choice.
- image_plan::plan_images, plan_depth_twin, holds_depth_in_colour,
holds_multisample_depth_in_colour, ImageFacts::depth_loss and
ImageFacts::multisample_depth_twin.
- The twin image of a texture (Image::twin), its copies in replace_region,
blits and host copies, Owner::HeapTwin and the heap plan's twin (heap_extent
now takes the image alone; check_heap_base the route alone; Mine is gone).
- The depth-twin degrade kind (Degradation::DepthTwin) and its docs/API.md
catalogue entry.
- The bind side: TextureFacts::depth_twin, TextureShape::Texture::depth_twin,
ImageViewDesc::twin and sampled_view's twin argument.
- A sparse Depth32Float texture is no longer refused for needing a twin.
- copy_unit refuses any depth format held in colour (none is now).
Tests: the twin tests are replaced by one that holds a Depth32Float texture
in its D32_SFLOAT image on every committed profile (single-sampled,
array, cube, render target, 2 and 4 samples); the heap and copy-plan unit
tests follow the one-image forms. The validation lanes that expected a twin
(texture_blits' upload lane, clear_reach, resolves' read-only depth pass,
texture_fills, heap_textures) now expect the depth image and its notices;
conformance's fill cases allow Depth32Float's digest unchecked where
restricted-depth-upload fires, as Depth32Float_Stencil8's already is.
RUNTIME_VERSION 1656: what a run of an unchanged pipeline does with such a
texture changes.
Verified: cargo clippy --workspace --all-targets --all-features -D warnings,
plain and with --cfg m2v_gpu; nextest of the translator and runtime
image_plan, heap, copy_plan, texture_facts, families, texture, degradation,
catalogue, fast_paths, profile, api_surface, bind and driver_facts tests
(973 passed). Device lanes not run.
* Drop the magnitude stand-in and the sign strip: a stored signed depth is tested natively
On the owner's ruling to promise the GPU's native arithmetic, a render target's
32-bit float depth that may hold a negative value or a NaN is no longer
switched on to render over a magnitude stand-in, and no pass strips the signs
of the words it did not write. The device's depth test compares the stored
value as it is and its pass keeps every bit; the runtime announces that
answer.
What goes:
- texture/signed_depth.rs, with the switch-on flags, the stand-in plans, the
write-backs and the sign strips in render.rs and render_pass.rs;
- Cause::Magnitude in attachment_stand_in.rs;
- the translator's DepthMagnitudeModule (bind/depth_magnitude.rs) and the
DepthStencilCopy::{DepthMagnitude, MagnitudeBits} draws;
- OwnedModule::DepthMagnitude;
- copy_plan's holds_unlike_its_stand_in;
- WorkCounts' signed_depth_switch_ons, magnitude_stand_in_passes,
magnitude_write_backs and sign_strips (and their counters).
What stays, describing the native answer:
- signed-depth-test is announced where a write (a host upload, a blit, a copy,
a written NaN clear, a new target's pattern loaded) may store such a value in
a render target's Depth32Float or Depth32Float_Stencil8 depth on a device
that keeps it and whose test is not Metal's (no
DriverFact::DepthTestComparesMagnitudes);
- where the device's test is Metal's own (MoltenVK), signed-depth-test is
announced only at a pass that loads and stores the depth and sets a state
with depth writes but draws under none, which keeps the signs.
The denormal notice no longer mentions the stand-in.
Docs:
- FAST-PATHS drops "A stored negative or NaN depth is tested by its magnitude"
and the matching known gap;
- FAST-PATHS also drops "A Depth16Unorm depth whose code the fragment stage
writes is tested after the stage" (the shader write is the translator's to
remove);
- API.md's depth-denormals and signed-depth-test entries now state the native
answer;
- doc comments the earlier steps left past 100 columns are reflowed, and the
remaining depth-twin mentions (bind docs, fast_paths' comment, three
conformance known-gap todos) are dropped.
Validation:
- depth_denormals' lanes check every read, sample and comparison against
Metal's, the depth tests only where the device's test is Metal's own, and
the notices where they now fall;
- the sign-strip lane is deleted;
- texture_blits expects signed-depth-test at the render-target upload.
Verified: clippy with all targets and all features, plain and with
--cfg m2v_gpu, across the workspace; rustdoc with -D warnings; the runtime's
nextest suite (1150 passed); the translator's touched tests (fast_paths,
catalogue, degradation, api_surface, depth_stencil_copy, owned_divisions,
profile, driver_facts, bind, policy: 671 passed); validation and conformance
non-device tests in the touched areas (230 passed). Device lanes were not run.
* Re-bless the API signatures and regenerate the refusal surface
The lane's removals leave the public surface without:
- MultisampleDepthTwinPolicy, TileStorePolicy and ResolvePolicy, with their
DevicePolicy fields;
- TextureFacts::depth_twin, TextureShape::Texture's depth_twin and
ImageViewDesc::twin;
- DepthMagnitudeModule and depth_magnitude_module;
- DepthStencilCopy::{DepthMagnitude, MagnitudeBits};
- Degradation::DepthTwin;
- WorkCounts' signed_depth_switch_ons, magnitude_stand_in_passes,
magnitude_write_backs and sign_strips.
The refusal surface loses four sites:
- the sparse depth-twin refusal (SparseHeaps, texture.rs plan_sparse_texture);
- the host heap's twin refusal (HeapTextureMemory, heap.rs host_heap_plan);
- the heap twin's DetachTextures site (heap.rs heap_texture_at);
- the sign strip's SeparateMultisampledDepthStencil site
(signed_depth.rs sample_strip).
Verified: python3 scripts/api-signatures/signatures.py --bless and
python3 scripts/refusal-surface/refusal_surface.py, then the api_signatures,
refusal, api_surface, published_crates, fast_paths and degradation_catalogue
tests (81 passed).
* Format the policy import lists after the half switches' removal
The rebase onto development (where the half-precision lane removed three policies) kept both lanes' removals; cargo fmt re-flows the shortened lists.
Verified: clippy (workspace, all targets, all features) clean; 709 touched tests (fast_paths, api_surface, api_signatures, catalogue, degradation, profile, bind, image_plan, published_crates, policy) pass.
* Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
|
||
|
|
ec72c052dd |
Answer as one macOS release, 27.0.1, on every host
The owner's ruling: the runtime imitates the latest measured release
only, not the history of releases. Capabilities (GPU family, features,
limits) still follow the GPU; every answer that differs by release is
macOS 27.0.1's (build 26A434, measured on an Apple M3 Max), on every
host, whatever release it runs.
What changed:
- metal_level.rs becomes metal_release.rs: the public const
MACOS_RELEASE ("27.0.1") and the release's answers in one place
(heap block placement per family, the nil-texture stack alignment,
the mipmap rule, a depth/stencil state's resource ID below Apple10).
The pixel-format table and the private properties hold 27.0.1's
answers alone.
- Removed the MetalLevel enum and its 26.7 row, the host-release read
and the level choice, DeviceOptions::metal_level,
RawDevice::metal_level and DeviceProperties::metal_level.
- Removed what existed only for 26.7: the indirect-dispatch-of-another-
type refusal and its predication tracking, the depth/stencil resource
ID refusal, the M3 Max GPU row counting for heap blocks, PVRTC's
unmeasured heap placement, and the M4 mipmap stand-in emission.
- Problem::HostReleaseUnmeasured (the Unproven site),
Problem::IndirectDispatchOfAnotherType and
Problem::DepthStencilResourceId are gone. The Unproven type is
untouched.
- Degradations metal-level-below-host, metal-level-not-macos and
mipmaps-as-apple-m4 are retired (RETIRED_CODES, the retired section
of docs/API.md); mipmap-tie-rounding's trigger and cost drop the 26.7
clauses.
- Conformance: the recordings keep their "metal_level": "27.0.1" key as
a fact about the recording; record and replay compare it with
MACOS_RELEASE. Venue no longer carries a level.
- Validation's runtime_lane tests run on the default device, with the
26.7-only tests and level loops removed.
- A runtime unit test now holds the block-compressed kind on ASTC 4x2,
its one remaining trigger, in place of PVRTC at 26.7.
Docs: docs/API.md, docs/FAST-PATHS.md, docs/RUNTIME-PORTING.md and the
runtime README; docs/REFUSALS.md and docs/METAL-COVERAGE.md
regenerated (CONFORMANCE-COVERAGE.md regenerated, unchanged); the
signature table re-blessed with scripts/api-signatures/signatures.py.
Carried onto development from the parked development-performance branch
(a23f8181d9 there). The three conflicts were that branch's pipeline-record
hook (RawDevice and DeviceOptions fields and their Debug impls), which
development lacks: development's side is kept, without the release field.
Verified: cargo check --workspace --all-targets --all-features, plain and
with --cfg m2v_gpu; refusal_surface.py, signatures.py --check and the two
coverage generators leave the committed files unchanged.
Originally 79bb9749d3 (archive/development-linear-2026-10-28).
|
||
|
|
54a8b32154 |
Bind a memoryless texture as plain Metal does, and fail what uses it
One work packet, landed as 2 commits (6c0070d57d..a759d0e88f on archive/development-linear-2026-10-28), in order: * Bind a memoryless texture as plain Metal does, and fail what uses it A memoryless texture bound at a texture slot was refused at the setter (`StorageMode`), as Metal's API validation layer refuses it. Plain Metal takes the binding, so a program that binds one died here at `setFragmentTextures:withRange:` where it runs on Metal. Seen on an RX 580 under RADV, where the device is told framebuffer reads are unsupported. Measured on an M3 Max under macOS 27.0.1, plain Metal (probes committed under crates/metal2vulkan-conformance/probes/memoryless_*.m): - Every setter returns. A command that uses the texture fails the command buffer with MTLCommandBufferErrorInvalidResource (9). That covers a draw, a dispatch or a tile dispatch whose function statically uses the slot, an empty one included, and one that reads the slot only behind a branch that is never taken. It also covers useResource of the texture, with or without a later command, and a blit into or out of it (a zero-size copy included), and generateMipmaps of more than one level. - Nothing fails for a slot no function uses, a slot rebound before the draw, a pass with no draw, a memory barrier, the optimize hints, synchronizeResource, a copy of no slices, or the mipmaps of one level. - Granularity: the submission that holds the command runs nothing, as Metal splits the command buffer (a render pass alone, a run of blit or compute encoders with no event command between them). Neither does anything after it, and its signals do not fire. The submissions before it run and their signals fire. The queue runs on. - The CPU calls of a memoryless 2D texture move nothing; a memoryless texture buffer's fault the process. Every view of one is nil. The runtime now: - binds it; - fails the command buffer with the new CommandBufferError::InvalidResource from the first encoder of the Metal submission (State::fail_submission_from, checks::submission_start); - records nothing for the failing command; - moves nothing in the CPU calls, still refusing the texture buffer's; - answers nil (`Nil`, `StorageMode`) for views. The check per command is one emptiness test of a per-table set of the slots that hold a memoryless texture. An execution's command whose function uses such a slot is the runtime's gap: Metal's answer there is not measured. That is IndirectRenderCommands for render, and CommandReplay for an inherited compute table. RUNTIME_VERSION 1646. The runtime-sources pin moves with it. docs/REFUSALS.md is regenerated, api_signatures is blessed for the new variant, and the degrade catalogue's memoryless-texture-buffer entry is updated. Verified on MoltenVK over this M3 Max under the validation layer: - runtime_lane::memoryless_uses: draw shapes (read, empty, branch never taken, earlier draw, use_resource, unused, rebound, rebound to nil, no draw); the probe's encoder sequences (CcC, BbB, CbC, BcB, BSbB, bSB, CSc); compute and blit uses; CPU access and views. - runtime_lane::memoryless, and the runtime's unit suite (plain cfg). - tests::command_buffer::a_memoryless_use_fails_from_its_submission_s_first_encoder. - Negative controls: - failing per encoder instead of per submission fails the sequence and blit/compute tests; - dropping the draw check fails the draw test (the draw is refused). - Clippy in both cfgs, rustdoc -D warnings for the runtime, and the pin guard. Not run: lavapipe, RADV, and the full validation and conformance suites. * Re-pin the runtime sources at the landing tip The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
87994746ea |
Take IdPlacement::Outside for a texture over the caller's VkImage
One work packet, landed as 2 commits (6e5d7acfc7..6c8a857d8b on archive/development-linear-2026-10-28), in order:
* Take IdPlacement::Outside for a texture over the caller's VkImage
`Device::new_texture_with_vk_image` now accepts `IdPlacement::Outside`,
the runtime extension `Device::new_texture` already takes for a caller's
helper texture: the placement check is skipped for Outside, and
`Texture::made` (already handed `IdUse::Program(placement)`) takes no ID
and holds no slot. The wrapped path otherwise behaves as before; it still
takes no device sampler ID at any placement.
Why: the consumer wraps its swapchain images with this call. Refused at
Outside, it had to give them `Any`, so they took texture resource IDs and
a guest's textures' `gpuResourceID` and `uniqueIdentifier` started past
them while a window was open: the guest's answers depended on whether a
window existed. At Outside the program's textures are numbered as with
no window.
Docs: `IdPlacement::Outside`, the resource-ID module docs,
`check_texture_placement`, `Problem::OutsidePlacement`,
`TextureDescriptor::placement`, the call's own doc (which now says it is
a runtime extension and how it places the texture), docs/API.md and the
runtime README. docs/REFUSALS.md regenerated (the OutsidePlacement row's
wording). No public signature moved (`signatures.py --check` passes).
RUNTIME_VERSION 1647: a call that was refused now makes a texture, which
the version's rule ("a refusal or its class") counts as a behaviour
change. runtime-sources.sha256 follows the edited runtime files.
Test: `presenting::a_callers_image_placed_outside_takes_no_id` (device
lane). After a reservation of 20000, a plain texture takes 20001 on a
device with no caller's texture; a caller's texture placed Any takes
20001 itself and moves the plain texture to 20002; one placed Outside
answers 0 and the plain texture takes 20001. Placed Outside before the
reservation it starts no space (the plain texture still takes 20001),
and a clear of it is what a blit copy of it reads.
Verified, on this Mac (Apple M3 Max, MoltenVK, --cfg m2v_gpu, under
the shared GPU lock): the new test passes and prints "the plain texture
after a reservation of 20000 answers 20001 with no caller's texture;
(Some(20001), 20002) after one placed Any; (Some(0), 20001) after one
placed Outside". With the old unconditional placement check put back it
fails: new_texture_with_vk_image returns
Invalid(OutsidePlacement). Also passing in the same run: every
presenting test, resource_ids::an_outside_texture_takes_no_id, and the
runtime-sources guard. clippy -D warnings for metal2vulkan-runtime
(all targets, all features) plain, and for metal2vulkan-runtime and
metal2vulkan-validation under --cfg m2v_gpu; runtime rustdoc with
-D warnings; the refusal_surface, api_surface and api_signatures tests.
* Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
|
||
|
|
675a3ee122 |
Take sampled textures over host pages in place where the device's check passes
One work packet, landed as 2 commits (86ec320bae..8485bc6865 on archive/development-linear-2026-10-28), in order:
* Take sampled textures over host pages in place where the device's check passes
A 2D texture (or array) over host pages is now a linear image aliasing those pages, with no shadow,
when all of these hold:
- its declared usage only samples or reads it (no RenderTarget, ShaderWrite or ShaderAtomic);
- the pages are a no-copy buffer's, imported by their pointer or as dma-bufs, or a buffer the
runtime placed in fresh pages;
- a startup check shows that, on this device, the image's first move keeps every byte while the
CPU writes beside it.
Vulkan makes such an image start UNDEFINED (VUID-VkImageCreateInfo-pNext-01443) and lets the move
read and write every byte bound to it. Relying on the driver here, once checked, is the owner's
ruling ("In place, trusting the driver"): a deliberate, scoped exception, recorded in FAST-PATHS.
The switch is DevicePolicy::host_page_textures:
- HostPageTexturePolicy::InPlace is the default.
- HostPageTexturePolicy::Shadow is the exact form, which exact_answers() selects. Under it every
such texture stays a shadow and no check runs.
The check (in_place_check.rs):
- It runs on a thread of its own, started by the first texture that asks, per class of pages:
pointer imports, fresh pages and dma-buf imports. On a Unix target the dma-buf class uses an
exported allocation of the device's own.
- Each class tries 11 shapes, 3 rounds each, through the product's own Buffer::new_texture:
- packed rows of 1, 2, 4, 8 and 16-byte texels;
- rows with bytes between them, for the same texel sizes;
- one 3840x2160 surface.
A shape the device makes no image of is skipped, as the product makes none either.
- A writer thread writes the pattern's complement through texels, the bytes between rows and the
bytes after the image while the move runs. Every byte is then compared.
- The pattern is a 4099-byte prime period, so it lines up with no row, page or texel. The window
is filled by copies and compared written bytes first, then a period at a time. That makes the
33 MB surface cost about 11 ms a round in release.
The verdicts are kept as one record in the shader cache's content store:
- The record is named by vendor, device, driver ID, version, name and info, the UUID, the check's
kind and version, and RUNTIME_VERSION.
- It is checksummed. A bad, partial or other-version record counts as none: the check reruns and
overwrites it.
- With no cache directory, the check runs once per process.
- A forced failure (DeviceOptions::fail_in_place_check, a hidden test hook) keeps nothing.
Every texture that still takes a shadow announces why (shadowed-texture) and is counted by cause:
- the policy;
- usage that renders or writes;
- check pending, failed or unchecked;
- refused: rows, detached, image, pitch, placement, the dma-buf source, other dma-buf reasons.
WorkCounts also counts the in-place textures by class and pitched images, and the check's runs and
verdicts.
How an image in place is made, used and visible:
- Pointer and fresh pages take a linear image made for host allocations at Metal's pitch, or a
DRM_FORMAT_MOD_LINEAR image at an explicit pitch over the host allocation where the driver makes
one. Dma-buf pages take the modifier image over a dma-buf of the texture's own pages.
- A rebind remakes these images like the others.
- A write or pass beyond the declared usage goes through the existing usage shadow and attachment
stand-in.
- A CPU write reaches the image's commands as it reaches the buffer's (Host Write Ordering
Guarantees).
RUNTIME_VERSION 1643 -> 1644. The runtime-sources pin is left for the landing.
Check duration, Apple M3 Max on MoltenVK 1.4.2:
- 75-78 ms in release: Pointer and Fresh passed; DmaBuf unchecked, as there are no dma-bufs on
macOS.
- 1.76 s in a debug build.
- The first version took 4.1-4.2 s in debug, almost all of it the 3840x2160 shape's per-byte
hashed fill (240 ms) and compare (461 ms) per round, times 3 rounds and 2 classes; the GPU move
itself took 0.15-3 ms.
- Nothing was dropped from the check. The 64x64/256 shape became 64x16/256, and packed shapes of
each texel size were added, because MoltenVK takes no padded pitch: the first version made only
4-byte images there.
Verified on the M3 Max (debug lanes, --cfg m2v_gpu):
- in_place_textures, all five tests:
- the path follows the check, and an event-held CPU write after the commit is read;
- a kernel write and a pass beyond the usage go through their shadows and keep the image;
- a forced failure keeps the shadow and no record; the next device runs the check, and the one
after recalls three verdicts and checks nothing;
- the costs.
- first_use_writes under both settings: 1920x1080/7680 in place, 0 of 542 writes undone.
- no_copy_textures read/write under both settings: ShaderRead-only textures in place at packed
rows, the rest shadows.
- pitched_surfaces, including the new _in_place variants of the only-reads and read-only-pages
tests.
- The runtime and translator suites passed (4971 tests), with clippy plain and under --cfg m2v_gpu.
Cost on the M3 Max, release, median GPU time per command buffer, in place against shadow:
- 3840x2160, one pass reading a 32-row strip: 492 against 553 us.
- 1920x1080 strip: 457 against 452 us.
- 1920x1080 whole: 393 against 466 us.
- 1920x1080, three whole passes: 566 against 545 us.
Untested here: RADV, lavapipe and the dma-buf class, which follow; ANV and NVIDIA have no venue
now.
* Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
|
||
|
|
fc6e726daa |
Write no zeros into a region of a chunk that reads zero unwritten
The steps this packet landed as, in order: - Re-derive the generated documents at the landing tip - Re-pin the runtime sources at the landing tip Content: the tree of `development` at b5b8bb0770, unchanged. |
||
|
|
ca74ea24d4 |
Send a dropped store through a descriptor view to a sink binding, not around a branch
The steps this packet landed as, in order: - Select the sink's place only where the store needs no word atomic, and re-bless - Account for the sink's descriptor in the tests it moved, and read coherence through the selection - Set the two variable-pointer features through their Vulkan 1.1 members - Name the two variable-pointer members in validation's feature table - Flatten the one-entry by-name copy and write the runtime-sources pin - Re-pin the runtime sources onto the twin-resolve landing Content: the tree of `development` at 55117cdfe4, unchanged. |
||
|
|
939e9d6e4a |
Keep the samples a resolve drawn after the pass reads, as Metal keeps them
The steps this packet landed as, in order: - Record what the kept samples' negative control actually read - Read an extended-range attachment's samples back after its resolve too - Re-pin the runtime sources after the kept-samples change - Re-derive the generated documents at the landing tip - Bless the public surface the shader-cache landing added Content: the tree of `development` at 60ff6f9405, unchanged. |
||
|
|
3cb648543f |
Take the indexed draw a buffer of DRAW alone runs as nothing
The steps this packet landed as, in order: - Re-derive the generated documents at the landing tip - Record the runtime sources' hash after the indexed draw on a DRAW-only buffer Content: the tree of `development` at 4d0b93e5a3, unchanged. |