1e583d5e0cae4ebce7b6d2bd2f969d4c05bc2926
392
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
37adfb0756 |
rt surface docs: the guide's exported surfaces, the dma-buf copy-form gap, the refusals and the API table
The README says in one place what each handle needs for in place, the layout rule, the copy form's reasons and the one consumer contract. REFUSALS.md and api_signatures.tsv regenerated by their scripts. |
||
|
|
407b5a1078 |
rt: a fence orders encoders across queues; Gap::FenceOtherQueue goes
A fence used on a second queue was refused (Gap::FenceOtherQueue): 18 refusals in a live boot on a 780M, every one a fence update on a second queue. The rule was ours, from a replay census in which no fence crossed queues, not Metal's contract: the headers say a fence update and wait are each "evaluated at kernel submission to maintain global order and prevent deadlock", and MTLFence.h says nothing about queues. What Metal does, measured (probe cross_queue_fence_held_update.m, M3 Max, macOS 27.0.1, jobs m3-max-52186, m3-max-52188, m3-max-52194, plain and under the validation layer): a wait on queue B waits for an update on queue A submitted before it (untracked buffers: B starts 0.3-1 us after A ends and reads all its words; with no fence B runs beside A and reads none); a wait with no work after it waits too (its handler 0.11-0.16 ms after A's GPU end); an update in a command buffer Metal holds, at an MTLSharedEvent or MTLEvent wait, behind one held so, or behind an uncommitted enqueue, is not waited for (B completes in 0.2-3.5 ms without A's writes, A still Committed). Every rt queue submits to the device's one VkQueue and each segment ends with a barrier, so a wait sees every update submitted before it. B passes A in four places: (i) A's head held at an event wait, (iii) behind an uncommitted enqueue, both Metal's own behaviour per the probe, so no hold and no gap; (ii) A's command buffer in a group the submit thread holds while A's submissions run, and (iv) held groups released in FIFO order rather than commit order, both rt's own. For those: each command buffer keeps the fences its encoders wait on and update (empty, nothing allocated, when it uses none); before a segment of a command buffer that waits on a fence is staged, the submit thread sends first any other queue's held group (member or partial head) that updates one, by send_through as a host wait does. A command buffer with nothing for the GPU that waits on a fence retires no earlier than the last submission carrying an update of it (the fence keeps that progress value, set in close). Same-queue fence use is unchanged in submissions; no fence: one empty-Vec test per staged segment. Tests: the two other-queue cases turned to accept; a new device test with A held in a group behind the busy gate: (1) B's wait committed after reads A's fill, (2) B's wait held at a shared event, released after A's later update joined the group, reads it, (3) B's fence-only wait does not complete before A's update; and a corner test: a wait on B runs while A's update is held at an event wait or behind an enqueue, without its write, then A runs once let go. Docs: fence.rs, the three encoder sites, the rt README, REFUSALS regenerated, api_signatures.tsv loses the variant. |
||
|
|
4231c5ba25 |
rt, translator: a declared write of a texture with no storage element refuses the argument-buffer dispatch
What: bug 4's held path. A compute encoder's use_resource with a usage that writes a texture (or a view of one) made for shader writes with no storage element (Texture::unstored) now makes every later dispatch of that encoder whose kernel may reach a texture through its storage image beyond its bound slots Gap::StorageElement, with no slot and the texture's format. A kernel without such an access dispatches whatever is resident, and use_heap declares nothing (Apple's header: useHeap declares the heap's resources read only through an argument buffer), so a write through a resource ID with no write-usage use_resource stays dropped, outside documented Metal. How: the translator had no fact for that access (writes_unbound_resources with texture_writing_stages would also refuse a kernel that writes a bound texture and a buffer through an argument buffer), so StageInterface and PipelineInterface gain unbound_storage_textures, decided in compile/unbound.rs beside the read and write facts: a texture write or atomic, or a read of a texture the operation declares access::write or access::read_write, on a handle that may come from memory, an integer or a call; an intersection or a call the entry cannot see into counts; indirect-command and acceleration-structure operations touch no texture. Gap::StorageElement's slot becomes Option<u32>. The render encoder builds no useResource:, so the draw half has no trigger; the README says it waits for it. SEMANTICS_VERSION 2190 -> 2191 and ARTIFACT_FORMAT_VERSION 547 -> 548 (one field in StageInterface and PipelineInterface). docs/REFUSALS.md regenerated; api_signatures gains the field and the variant's new shape; docs/API.md states the fact; the rt README's known gap says what is refused and what stays dropped. Tests: the translator's unbound-facts test states the new fact (an argument buffer's texture write and a read_write read count, a sample and a read do not); storage_element gains every_device_refuses_a_declared_write_of_a_texture_with_no_storage_element over RGBA8Unorm_sRGB, BGRA8Unorm_sRGB, A8Unorm and an sRGB view of an RGBA8Unorm texture, and the same formats in a heap under use_heap alone. Verified so far: cargo fmt; refusal_surface.py, signatures.py --check and metal-coverage --check give no further diff. The build, the suites and the device legs follow in potluck jobs. |
||
|
|
cce95596b4 |
rt: a threadgroup within Metal's limit for the kernel and past this device's is the device's Limit, not Metal's refusal
A compute state answers the least of Metal's maxTotalThreadsPerThreadgroup for the kernel and
this device's limits for it (maxComputeWorkGroupSize, its subgroups' count, and for emulated SIMD
groups their scratch beside maxComputeSharedMemorySize). A dispatch past that answer was
Refusal::ThreadgroupSize, which states that Metal itself refuses the threadgroup: on lavapipe
compute-threadgroup-simd-scratch's 1024 threads, which Metal runs, were refused as "past the
state's 256" and the suite counted our refusal where the old runtime reports the device's lack
(MaxComputeSharedMemorySize 32768 against 57344).
The interface keeps Metal's own answer beside the state's
(ComputePipelineMetalInfo::metal_max_total_threads_per_threadgroup, or a required size's
threads). A threadgroup past Metal's answer stays Refusal::ThreadgroupSize; one within it and past
the state's is the new Limit::ThreadgroupThreads { size, max }, basis device. The conformance
crate's rt side reads that limit as the venue's lack, as it reads the translator's device gaps.
REFUSALS.md and api_signatures.tsv regenerated.
Verified at this commit: cargo fmt, refusal_surface.py, signatures.py --bless and coverage.py
--check; the build, the suites and the lavapipe replay (where the case should read lacks-feature)
run in the lane's check job.
|
||
|
|
b683148a41 |
rt, translator: the identity domains give a SIMD-group's threads no lockstep order
What: under the identity domains (the new runtime's profile) the translator no longer inserts the barriers that make Apple's SIMD-group lockstep explicit (`lockstep::order`): `OrderKey::of` is `None` there and `ordered_entry` takes the specialized entry as it is. The resident-table domains (the old runtime's) keep the order until the cutover. With no lockstep barrier on the new runtime's path, its one-row machinery is dead and deleted: `Compiled::rows`, `pipeline::one_row`, `encoder::Module::Rows`, `keeps_rows` and `choose`'s `rows`, the `OneRow` and `RowLockstep` arms, and the translator's `CompiledFunction::runs_lockstep_barriers_in_rows` with `KernelFacts::lockstep_in_rows` (the API signature table; the version numbers rise in the branch's last commit). Why: documented Metal orders the threads of a SIMD-group only through barriers and atomics; the Metal Shading Language calls two of them that conflict between barriers a data race. The order was an emulation of undocumented Apple-GPU behaviour (owner's rule 1). Its barriers made 1,443 of 5,368 distinct kernels of the recorded streams observe their threadgroup partition, every pair of them unproven, and they stopped partial-threadgroup dispatches the variant cannot run (rt's frame-320 and frame-335 refusals of the 30-wide kernels). docs/API.md's accepted differences gain one entry, the conformance case `simdgroup_lockstep` leaves its output words unchecked against it, and CONFORMANCE-COVERAGE.md and REFUSALS.md are regenerated. Tests: the identity-profile one-row test becomes `the_identity_domains_order_no_lockstep_pair` (barriers under the default domains, none under the identity domains, the partial variant in tiles); the harness's cells test keeps the old domains' one-row facts and adds the identity domains' none; rt's one-row tests and the row-lockstep tree test go, and `row_cells` runs every grid on its tiles' pipeline made with the state. Verified: cargo fmt; coverage.py and refusal_surface.py regenerated. Clippy and the suites run on the check job named when the branch is handed over. |
||
|
|
42f9e9137f |
rt: a pass keeps its visibility result buffer; Disabled is the visibility mode built
The two tessellation streams' render passes set a visibility result buffer and enable no mode; rt skipped every such encoder (Unheld(visibilityResultBuffer)). On an Apple M3 Max (macOS 27.0.1, job m3-max-51220) a pass with the buffer and no mode leaves the buffer's bytes as they were under Reset and under Accumulate, so the planner's minimal form is exact and carries no note. - RenderPassDescriptor.visibility_result_buffer: checked for its device (Refusal::OtherDevice) and kept by the command buffer until it retires, as Metal's pass holds it. It declares no access and joins no hazard set: no command of the pass reaches it. - RenderCommandEncoder::set_visibility_result_mode: Disabled at any offset is a no-op; Boolean and Counting are Gap::Draw of the new DrawKind::VisibilityResults. - visibilityResultType is not a field: it decides only what an enabled mode writes. - Device test: the pass draws, the buffer's gauge holds after the test's handle is gone and falls once the command buffer retires, its bytes are unchanged, and the pass takes the submissions, barriers and passes of one without it. - Conformance: the rt side passes the buffer and the mode; new cases visibility-disabled-reset and visibility-disabled-accumulate (no mode in one pass, Disabled at both words in the next); recordings follow from the M3. - Player: setPass's visibilityResultBuffer goes into the new field (a skipped buffer still marks the pass unheld). - rt README, api_signatures and docs/REFUSALS.md regenerated. Verified: cargo fmt only so far; builds, clippy and device legs follow as potluck jobs. |
||
|
|
f811bb4716 |
rt: a blit encoder releases an exported block to the other API, in its command buffer
The read direction of an export: another API (a video encoder) reads what a blit wrote into an exported block. BlitCommandEncoder::release_to_external(&buffer), which Metal has no counterpart of, records one buffer barrier into the encoder's command buffer after every earlier command: the whole block's release from rt's queue family to the acquire's other family (EXTERNAL for an opaque handle, FOREIGN_EXT for a dma-buf), src ALL_COMMANDS / MEMORY_WRITE. No submission of its own, nothing on the submit thread, no wait. It is a write use of the buffer for the encoder's ordering: textures over a buffer in the block copy back first, and since Vulkan ignores a release's second scope and only ALL_COMMANDS waits for it, the barrier after it is owed (Building::release_command, beside owe_pass; the flag owed_pass is now owed_all), paid by the next command or the command buffer's end barrier. Counted in Metrics::external_releases and Metrics::barriers. A buffer whose block is not exported is Refusal::NotExported (its doc and Display now name the release too). Release after release without an acquire is the spec's own case (7.7.6 NOTE: "It is valid to never call the acquire operation after a release, and instead simply start using the resource on any queue (even the releasing queue), but the contents should be reinitialized before being read"), so the next frame's blit needs no acquire. The README and the acquire's doc state the read direction's contract: the other API reads from the command buffer's completion; from the call until the consumer's next write through the runtime, the runtime reads nothing of the block and the consumer encodes no read of it. The export device test now releases through the call, twice in two command buffers with no acquire between (fill, release, fill, release), and the second device reads the second fill's bytes; a release of a buffer in a taken block is NotExported; external_releases grows by 2. REFUSALS.md and the API signature table regenerated; the replay's metrics name external_releases. Verified: build and device legs follow (job ids in the lane's report). |
||
|
|
0ecac16dd3 |
rt: a render state answers Metal's imageblock sample and memory lengths; one imageblock gap
The consumer asked for RenderPipelineState's imageblockSampleLength and
imageblockMemoryLengthForDimensions:. Metal's render answer is not 0 without an explicit
imageblock: it counts the color attachments' texels (measured on an M3 Max and an M4, and kept
by the translator as metal::format::imageblock_sample_length: [R8Unorm, R32Float] is 8). rt makes
no state whose fragment function reaches an imageblock (RenderPipelineKind::Imageblock), so a
state's sample is its colors alone, computed once per content from the descriptor's color
formats; the memory length is that times the width, the height and the raster sample count, none
rounded, as the old runtime answers it from the same measurements. A color format with no
measured place in Metal's record answers the gap.
The gap is one variant for both states: Gap::ImageblockMemoryLength { dimensions } becomes
Gap::ImageblockLength, which the compute state answers for a kernel that declares an imageblock
it never reaches (or whose compile kept no reflection to tell) and the render state for an
unmeasured color format. The compute state's imageblock_memory_length_for_dimensions answers u64,
as the render state's does.
Test: every_device_answers_a_state_s_metal_answers also makes a render state of R8Unorm and
R32Float colors: 8 bytes a sample, 512 for 8 by 8 pixels of one sample. README (render states;
the compute paragraph's gap name), api_signatures.tsv and REFUSALS.md regenerated.
Verified at this commit: cargo fmt only. The build and device legs run on the lane's tip.
|
||
|
|
c57b0436c8 |
rt: a compute state answers Metal's static threadgroup memory, execution width and imageblock length
The consumer counts each Metal answer rt holds but does not give. ComputePipelineState now
answers three more, each from its whole module's translation, kept per content (Answers):
- static_threadgroup_memory_length(): staticThreadgroupMemoryLength, the translator's
ComputePipelineMetalInfo::static_threadgroup_memory_length (rounded up to 16 as Metal reports
it); the threadgroup memory rt adds beside it is not counted.
- thread_execution_width(): threadExecutionWidth, the translator's thread_execution_width, 32 on
every device (the old runtime answers the same value from the translator): a kernel that
observes its SIMD group runs it 32 wide, and one that does not cannot tell its width.
- imageblock_memory_length_for_dimensions(dimensions): 0 for a kernel that declares no
imageblock. rt makes no state for a kernel that reaches an imageblock (the translator records
RuntimeFact::ImageblockSize on its first use, which the interface refuses as Gap::KernelInput),
but the translator plans only used parameters, so a kernel that declares an imageblock it never
reaches does get a state. For it, and where the compile kept no reflection to tell, the answer
is the new Gap::ImageblockMemoryLength { dimensions }: no authored case measures Metal's length.
Whether the kernel declares one is read once per content from the reflection its compile kept
(ComputePipelineDescriptor::reflection over StageSource::Compiled, decoding nothing).
Test: every_device_answers_a_state_s_metal_answers (device cfgs): the harness's block_scan
answers 1024 bytes of static threadgroup memory (256 words), sample_down 0; both 32 wide and an
imageblock length of 0. README (compute states), api_signatures.tsv and REFUSALS.md (26 -> 27
gaps) regenerated.
Verified at this commit: cargo fmt only. The build (clippy of rt under both device cfgs) and the
device legs run on the lane's tip.
|
||
|
|
18c52e7a8c |
rt: a heap's resources take one id in the hazard sets, the heap's
What: every buffer and texture placed in one heap takes the heap's id in the compute encoders' hazard sets, whatever its tracking mode and whatever bytes it reaches. A heap is the one at its offset in its block (`HeapRange`); `HeapIds` maps each to an id that lives while a resource of the heap does, the entries of gone heaps dropped once the map doubles (at least 64). Textures placed by `new_heap_texture` take it at once. Buffers take it through the new `Device::new_heap_buffer(heap, offset, length)`, `MTLHeap`'s `newBufferWithLength:options:offset:` (a buffer past the heap's end is `Refusal::HeapBufferPlace`); a buffer placed by `new_buffer` is no heap's and keeps its own id. Views take their parent's; a texture in place over a heap buffer takes the buffer's. Only the hazard sets read it: the copies over buffers and a pass's attachments keep naming resources by their own ids (`Accesses::each(interface, tracked)`). The player places a stream heap's buffers with `new_heap_buffer` and a stream block's with `new_buffer`; the conformance crate's heap buffers take `new_heap_buffer`. Why: Metal tracks a heap's resources as one, "tracking is done at the granularity of the heap" (MTLHeap.h, hazardTrackingMode), and the old runtime keys a heap buffer's and a heap texture's hazard identity by its heap (metal2vulkan-runtime heap.rs, tracker.rs). rt keyed them by resource, so inside one encoder, or after an encoder that only read, a write through one heap resource and a use of another over the same bytes got no barrier. Tests: `every_device_orders_a_heap_s_resources_as_one`: two heap buffers over the same bytes take a barrier between a write and a use and the second sees the first's words; two apart in one heap take one too; two heaps' none; a buffer past its heap's end is refused; 200 heaps that come and go leave at most 64 entries. docs/REFUSALS.md and the API signature table regenerated (two records added: the method and the refusal). Verified: cargo fmt; refusal_surface.py and signatures.py --bless. Build, clippy and the device suites on the check job named when the branch is handed over. |
||
|
|
608e084db1 |
rt: Block::external_writes_done, the acquire of another API's writes into an exported block
A decoder writes a frame into an exported block through its import of the handle; the
runtime's commands may read it only after the block's ownership comes back from the other
API's queue family. Vulkan's external memory requires that transfer whatever the sharing mode
(section 7.7.6, "Resources shared with external APIs or instances using external memory must
also explicitly manage ownership transfers between local and external queues").
Block::external_writes_done() records the acquire: one buffer barrier of the whole block, from
VK_QUEUE_FAMILY_EXTERNAL for an opaque handle (same device and driver) or from
VK_QUEUE_FAMILY_FOREIGN_EXT for a dma-buf (another driver), to the runtime's family, visible to
every later command. It goes in the upload, as zero_block_range's fill does: submitted ahead of
every command buffer committed after the call, holding the block until it completes, with no
wait for the GPU. The consumer calls it after its own wait on the decoder. A dma-buf names the
foreign family, which VUID-VkBufferMemoryBarrier2-srcQueueFamilyIndex-09099 allows only with
VK_EXT_queue_family_foreign enabled; new_exported_block already refuses a dma-buf export where
it is not (Limit::ExportType { listed: None }), so every exported dma-buf block can name it.
No release back to the other API is recorded. Section 7.7.6: "If an application does not need
the contents of a resource to remain valid when transferring from one queue family to another,
then the ownership transfer should be skipped." A decoder that overwrites the whole block needs
nothing the runtime left in it, so only the decoder-to-runtime direction is a transfer. The
contract, in the rt README beside the two calls: between external_writes_done and the other
API's next write of the whole block, the other API does not access the block, to read or to
write. The old runtime records the same acquire and no release.
Metrics::external_acquires counts the acquires (each also one of Metrics::barriers); the
replay report prints it. A block that is not exported is Refusal::NotExported. memory::Own's
Export carries the handle, which names the family.
docs/REFUSALS.md regenerated; api_signatures blessed.
Tests (src/tests/export.rs, device cfgs): after the second device has read rt's bytes, it fills
the whole block and releases it to the external family; external_writes_done is counted, and a
blit then reads the second device's bytes. An acquire of a taken block is refused typed.
Verified at this commit: cargo fmt only. The lane's build and device legs run on the tip that
carries it.
|
||
|
|
ea9b65a972 |
rt: Device::new_exported_block, one dedicated exportable allocation per block
The consumer's video path shares decode surfaces with a hardware decoder: the decoder imports
rt's memory and writes decoded frames into it. Metal has no counterpart, as it has none of
presenting.
The form is one on every device: an allocation of its own in the Private memory type,
dedicated to the one buffer that spans it (VkMemoryDedicatedAllocateInfo), exportable as the
handle the consumer names, never a range of a pooled allocation. Vulkan lets a driver require a
dedicated allocation for an export (VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT), so the
dedicated form is the one every driver takes, and what exportable memory costs each submission
falls on these allocations alone.
- ExportHandle: OpaqueFd (unix), DmaBuf (unix), OpaqueWin32 (Windows). A handle is offered
where the device lists its extensions and vkGetPhysicalDeviceExternalBufferProperties says its
buffers export it; elsewhere Limit::NoExport, before anything is allocated.
- A dma-buf's other side is another driver, which an ownership transfer names as
VK_QUEUE_FAMILY_FOREIGN_EXT; without VK_EXT_queue_family_foreign that family may not be named
(VUID-VkBufferMemoryBarrier2-srcQueueFamilyIndex-09099), so a dma-buf export there is
Limit::ExportType { listed: None }. A buffer whose memory requirements do not list the
Private type is Limit::ExportType { listed: Some(bits) }.
- Export carries the new handle (the consumer's to close), the allocation's size and its memory
type, which an import of an opaque handle names again
(VUID-VkMemoryAllocateInfo-allocationSize-01742, and the dedicated import of
VUID-VkMemoryDedicatedAllocateInfo-buffer-01879).
- The extensions stay out of the floor: VK_KHR_external_memory_win32 and
VK_EXT_queue_family_foreign join the optional list, enabled where listed.
- Gauges::exports counts exported blocks whose memory is not yet freed; the block-maker thread
frees them as it frees imports (memory::Own).
- No image is made in an exported block's memory, which is dedicated to its buffer
(VUID-vkBindImageMemory-memory-10926): a texture over a buffer in it takes the counted copy,
as over an import, and a heap texture in it is Gap::HeapTexture.
docs/REFUSALS.md regenerated; api_signatures blessed; the rt README has the call, its
extensions and its known gap.
Tests (src/tests/export.rs, device cfgs): every offered handle exports, is written by rt,
released by the test's own barrier and read back through a second device's import of the
handle, with the gauge back after the free; every other handle is refused typed; an exported
block holds no image; and the submit cost with 64 live exports against none, printed.
Verified at this commit: cargo fmt only. The lane's build (clippy plain and under both device
cfgs, Rustdoc, signatures, refusals) and device legs run on the tip that carries it.
|
||
|
|
4521865fe5 |
rt: a stored slot bound to a texture with no storage element is Gap::StorageElement
A draw or dispatch whose function writes a texture slot, or reads one through
its storage image (access::read_write), bound to a texture made for shader
writes that has no storage element, dropped the writes and read zeros. Such a
texture is one whose format the device does not store through a storage image
without a format (the 8-bit sRGB formats, RGB9E5Float or BGR10A2Unorm where the
device lacks their storage), or holds through a view of another (A8Unorm in
red, the extended-range formats).
That draw or dispatch is now refused with Gap::StorageElement { slot,
pixel_format }, found where the swizzled read_write gap is found: at the
dispatch's bind check and at the draw's Facts::find. Which slots count is the
bound function's own access (a write, or a storage read), not the texture's
ShaderWrite usage bit. A texture made without ShaderWrite (and not of Metal's
unknown usage) is outside documented Metal when written, and is not refused.
A texture an argument buffer reaches by its resource ID is not seen at the
bind; its writes stay dropped, recorded in the runtime README's known gaps.
The refusal stands until the alias storage element lands: a view of the
nearest format whose storage Vulkan requires of every device, with the
translator's conversion.
docs/REFUSALS.md regenerated; api_signatures gains the variant.
Test: storage_element::every_device_refuses_a_stored_slot_bound_to_a_texture_
with_no_storage_element binds a 2x2 RGBA8Unorm_sRGB texture to a write slot
and a read_write slot, and expects the gap exactly where the device's optimal
tiling lacks STORAGE_IMAGE with STORAGE_WRITE_WITHOUT_FORMAT, a dispatch
elsewhere, and a read slot dispatching everywhere.
|
||
|
|
4a393990fa |
rt: a presenting command buffer is scheduled once its submission passed vkQueueSubmit2
What: the planner's change to the presenting design, and its additions. - Scheduled means, for a command buffer that presents a drawable, that its submission has passed vkQueueSubmit2: the submit thread no longer schedules it as its last segment joins the group (the group goes at once anyway), but in submit(), between queue_submit2 and core.done.submitted, which is where the completion thread first learns of the batch (complete.rs, Done::submitted). Its status, kernel times, scheduled handlers and wait_until_scheduled all follow the call, with no window and no wait across threads, and its scheduled handlers still run before its completed handlers. A failed submission schedules nothing: its handlers run as it retires, as an ended command buffer's do. The split wait (CbState::signal_unsubmitted) is gone. - A present from the command buffer's own scheduled handler is valid now; the docs still say to present from the consumer's thread, as the handler runs on the submit thread. - Several drawables in one command buffer each signal their own semaphore; the same semaphore twice is Refusal::DrawableSemaphoreRepeated (new), the same drawable twice Refusal::DrawableNotAcquired. - The Safety texts of the three unsafe calls name the Vulkan rules the runtime cannot check (the image is that swapchain's; `ready` unsignalled with no signal or wait pending; the swapchain not destroyed while in use). - The README's "Destroying a swapchain": which completions and drops come first (VUID-vkDestroySwapchainKHR-swapchain-01282); views may outlive the image, as Vulkan's object lifetime rules let a child of the device outlive the image it views. Tests: the render test's second frame presents from the scheduled handler, the first and third from the test's thread beside a handler that sleeps 100 ms; both drawables' teardowns follow the guide, destroying the stand-in image before the views go; a new test presents two drawables from one command buffer and checks the two refusals. Not yet run: potluck jobs next. |
||
|
|
e5157492d7 |
rt: drawables' textures over a swapchain's images, their acquire, and a present that signals the consumer's semaphore
What: the two presenting pieces the new runtime lacked, so a consumer can present on the runtime's own device. - Device::new_drawable_texture (unsafe): a texture over an image of the consumer's swapchain, checked against the swapchain's create info (2D, one level, its extent and one layer; the format the runtime holds the pixel format in; usage holding the texture's, transfer included). Its home layout, views, set 1 elements and hazards come from the existing plan (form()). The image is never destroyed by the runtime: Backing::Drawable, and the reaper frees only the views. - Texture::drawable_acquired (unsafe): re-arms the existing homing, so the upload of the next submission moves the image home ahead of every later commit; from UNDEFINED the first time and from PRESENT_SRC_KHR after a present (texels kept). - CommandBuffer::present_drawable (unsafe): at commit the last segment's end barrier also moves the image home -> PRESENT_SRC_KHR, and that segment's submit info signals the consumer's binary semaphore beside the progress semaphore; the group goes at once, as an event signal's does. - wait_until_scheduled of a presenting command buffer returns once its submission passed vkQueueSubmit2: rt marks a command buffer Scheduled, and runs its scheduled handlers, before the submit, so a present made after the wait could otherwise wait on an unsubmitted binary signal (VUID-vkQueuePresentKHR-pWaitSemaphores-03268), on the shared and on the reserved present queue. - Refusals with their basis: DrawableDescriptor, DrawableFormat, DrawableUsage, NotDrawable, DrawableAcquired, DrawableNotAcquired. docs/REFUSALS.md regenerated, api_signatures blessed (9 records added, none removed or changed). The README's presenting section replaces the "not built yet" lines, with its known gaps (no acquire semaphore; no present from the presenting command buffer's own scheduled handler; a presenting command buffer that never runs leaves the image acquired). Tests (src/tests/present.rs, device cfgs, validation layer): an image made as a swapchain's stands in for one; three frames of acquire, pass, present and a stand-in present that waits on the semaphore on the presenting queue and copies the image out of PRESENT_SRC_KHR, for a render-target and a shader-read drawable; the presenting command buffer's sleeping scheduled handler must have returned before wait_until_scheduled does; each refusal. Not yet run: built and run in potluck jobs next. |
||
|
|
feec58e2f5 |
rt: a texture over a buffer in an imported block is the counted copy, on every device
replay's census C: the window server (b3) makes 425 textures over its no-copy buffers, and every no-copy buffer is now an import, so refusing them (Gap::TextureOverBuffer in d335594515) would refuse the window server's textures. They take rt's existing copy form instead: an image of its own, which the device copies the buffer's bytes into before the submissions that use it and back after a command writes it, counted in Metrics::over_copies. The buffer stays the import itself. The runtime makes no image in imported memory. Such an image would be made for the import's handle (VUID-vkBindImageMemory-memory-02728), so in the undefined layout (VUID-VkImageCreateInfo-pNext-01443). An acquire from VK_QUEUE_FAMILY_FOREIGN_EXT is not used: it needs a matching release (7.7.6), which host writes do not make (host memory imported by its address is shared with the host as host access), and it leaves an aliasing resource's contents undefined (7.7.6). Whether an in-place form exists stays open with the planner until the copy's cost is measured. - check_over answers the copy for a buffer in an imported block; Gap::TextureOverBuffer's doc goes back to its old cases; new_texture's doc and the README say how such a texture is made, and the README records it as a known gap. - Tests: the import device tests run on every platform (host memory from std::alloc; the shared-file mapping test unix-only), so the Windows UHD leg runs them. A texture over imported host memory is copied on every device, reads the host's own bytes, its writes reach the host, and both copies count in over_copies. - REFUSALS regenerated for the import limits (the rebase took development's at d335594515). Verified: nothing yet; the check job and the device legs follow. |
||
|
|
4454b23eb4 | rt: patch draws in the player, README and refusals (work in progress) | ||
|
|
4196a258ec |
Re-derive the generated documents at the landing tip
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. |
||
|
|
f6d308a628 |
rt tests: the indirect-place and given-back tests read the pool's one VkBuffer per allocation
What: - compute::every_device_reads_indirect_arguments_only_at_a_multiple_of_4_of_their_block expects Refusal::ArgumentPlace's place as the arguments' byte of the block's allocation (the block's offset there plus their place in the block). Vulkan reads indirect arguments at a multiple of 4 of the VkBuffer, which now spans the allocation, so that is the byte the check reads. The refusal's docs, dispatch_threadgroups_with_indirect_buffer's and draw_indexed_primitives' say so; docs/REFUSALS.md regenerated. - large::every_device_takes_no_block_an_encoded_uncommitted_command_buffer_holds asserted that the next take of a given-back length gets that range again. The pool takes a zeroed range first, so it need not. The test now asserts what it is for: the pool does not hold the block while the encoded command buffer holds it, and holds it once the command buffer is dropped. Why: both expected the per-block VkBuffer that 96340f0f9d deleted. The legs on 96340f0f9d's archives failed exactly these two on lavapipe (49447), the Iris (49459), the 2080 (49460), the 3090 (49462) and the M3 (49463); nothing else of the pool failed there. Verified: nothing yet for this commit; its check and legs follow. |
||
|
|
4df69ca062 |
rt: generateMipmapsForTexture:, the device's linear blit of each level, under a static note
web3d calls generateMipmapsForTexture: once in each stream, which the player skipped and counted (mipmaps 1). It is built as Apple defines the call: each level below the texture's first made from the level above it, over each slice, a view's levels and slices its own. - BlitCommandEncoder::generate_mipmaps: one vkCmdBlitImage a level with VK_FILTER_LINEAR, the first level read and the rest written whole (their old contents discarded) behind the copy's first barrier, one barrier between each level and the next, and the last bringing every level home, the last level's writes visible to every later command. A texture of one level records nothing. - Refusal::MipmapFormat for a format Apple defines no mipmaps of (a depth or stencil, compressed, YCbCr or integer one: not colour-renderable and filterable); Gap::MipmapFilter where the device's format query lacks blits from and to the image's format or its linear filtering, where the image holds the pixel format through a conversion, and for a view in another format than its image's, whose blit would filter the image's. - PrecisionNote::DeviceFilteredMipmaps, the static note BlitCommandEncoder::GENERATE_MIPMAPS_NOTE carries: the filter is the device's, where Apple states none. The old runtime announces it as its existing device-filtered-mipmaps kind; validation allows it unbounded; codec and ARTIFACT_FORMAT_VERSION 541, fast_paths' list, API.md's catalogue entry. - The conformance rt side plays Step::GenerateMipmaps and announces the note; the replay player plays the call and its skipped_mipmaps counter is gone (REPLAY-STREAM.md). - Test: an 8x8 RGBA8Unorm texture of four levels, each level below the first within one code of the box of the four texels it halves in the level above as the device left them, its first level kept, one submission and the chain's four barriers besides the segment's end; one level records nothing; RGBA8Uint is Refusal::MipmapFormat. REFUSALS and api_signatures regenerated. |
||
|
|
899270a674 |
rt: the pool is free ranges with a zero mark; hooks per allocation; one VkBuffer per allocation
What:
- One mechanism. A block given back is a free range of its allocation at once. The kept list, the
returned fast path, unkeep and the take's wait for the block-maker thread are deleted.
- A take is the first free range that fits whose bytes are all zeroed, else the first that fits,
in the order the allocations were made. It runs under the pool's lock, with no Vulkan call and
no hook (Metrics::takes_from_free_ranges).
- A long allocation, which a take longer than 16 MiB made for itself, serves only takes of exactly
its length. Metrics::shared_long_reuses and private_long_reuses count such takes after the
first. Gauges::shared_long_reused_bytes and private_long_reused_bytes count the bytes of long
allocations that hold one.
- The block-maker thread zeroes free Shared bytes that are not clean in 256 KiB steps, the
allocations in the order they were made (Metrics::free_bytes_zeroed, free_zeroing_nanos). It
starts no step while a consumer memset runs (Pool::fill, Metrics::zero_steps_held), the rule of
|
||
|
|
a75366dccb |
rt: the compute encoder pushes the stage-in region a kernel reads
set_stage_in_region (setStageInRegion:) accepted the region and changed nothing, on the reading that no kernel rt dispatches reads it. That reading missed [[grid_origin]] and [[grid_size]]: they read the region without a [[stage_in]] argument. A recorded stream makes a compute state whose kernel reads both, and the old runtime plays it; rt refused the state (Unsupported{IdentityDomains}) until the translator admitted the field. The encoder now keeps the region as its push field's 32 bytes, the origin and the size each a uvec4 with a zero w, as the binder writes them. Every later dispatch writes those bytes where the kernel's StageInRegion field sits (FieldValue::StageInRegion). The interface takes RuntimeFact::StageInRegion. A dispatch of a kernel that reads the region on an encoder that set none is the new Gap::NoStageInRegion: what Metal's kernel reads then is not established, as the binder's MissingStageInRegion says. A [[stage_in]] fetch stays Gap::KernelInput.
The player plays setStageInRegion: on rt. The conformance rt side sets each direct region before its dispatch; the indirect form stays unavailable.
README, the gap's docs, api_signatures and docs/REFUSALS.md updated.
Only a kernel that reads the region copies it into its parameters; any other dispatch passes the encoder's region by reference and copies nothing.
Test: translate's every_device_pushes_the_stage_in_region_a_kernel_reads runs engine/kernel_stage_in's stage_in_region_short. A dispatch before any region is set is Gap::NoStageInRegion. Two dispatches under two regions each store their own origin and size at every thread, and nothing past the grid. The sampling device test still sets a region its kernel ignores. compute's every_device_counts_no_instructions_for_a_stage_in_region_a_kernel_does_not_read counts the user-space instructions of a dispatch of a kernel that does not read the region, with no region set and with the setter called before each, less the setter's own: they agree within 2% and 16 instructions.
Verified: check 49270 (msi): the clippy, rustdoc and host suites above clean; rt's device suite on lavapipe 294/294 (3 skipped), each dispatch reading the region set before it. From its archive, the two stage-in device tests on the RTX 3090 (49414) and the Iris Xe (49415) pass with no validation error; user-space instructions a dispatch of a kernel that does not read the region (a debug build): 3090 40190 with no region, 44013 with the setter before each, of which the setter alone 3942 (so 40071); Iris Xe 36082, 40057 and 4058 (35999).
|
||
|
|
72152b3d29 |
rt: pixel-format views over mutable images that list Metal's formats
newTextureViewWithPixelFormat: and its forms of another pixel format were a
gap. glbench makes 1,524 (780M stream) and 2,970 (3090 stream)
BGRA8Unorm_sRGB textures' BGRA8Unorm views; Metal views a texture as its sRGB
sibling with no usage asked (MTLTextureUsage.pixelFormatView: "Don't set this
option if your texture view only converts between linear space and sRGB"), and
with PixelFormatView usage as any colour format of the same bit length
(makeTextureView(pixelFormat:)).
The translator states Metal's rules: metal::format::srgb_sibling (srgb_raw_twin
both ways, ASTC's LDR and sRGB forms, the extended-range pairs),
views_without_usage (itself, the sibling, a combined format's stencil) and
views_with_usage (those, and uncompressed colour formats of the same bytes a
texel by byte_format).
An image lists, its own format first, the formats Metal views its texture as
that the device holds for the usage in a viewed form of the image format's
compatibility class: the sibling always, and with PixelFormatView every such
format. Such an image is MUTABLE_FORMAT with a VkImageFormatListCreateInfo, in
its creation, its format queries (optimal and linear) and its heap size query;
any other image is unchanged. plan() splits into form() (what a texture holds
in its views) and the image's own part, so a view takes form() alone, with no
image query.
A view of another format is built where the image lists it, else
Gap::TextureView{PixelFormat}; a format Metal does not view the texture as is
Refusal::TextureViewFormat, which no longer refuses the sRGB sibling of a texture
without PixelFormatView usage. Its image views take the image's usage that the
view format's features hold (VkImageViewUsageCreateInfo,
VUID-VkImageViewCreateInfo-usage-02274/02275/08931): it has a storage element
only where the image has storage usage, and renders where its format holds an
attachment, else Gap::TextureFormat at the pass.
Tests: the translator's sibling is mutual over every format and its view rules
take and refuse as Apple's pages say; on devices, an sRGB view of a texture
without PixelFormatView usage and an R32Uint view of one with it each read
their parent's bytes, and R16Float and BC1 views are refused.
|
||
|
|
f3f13c87ab |
Re-derive the generated documents at the landing tip
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. |
||
|
|
b7ef04ae97 |
rt: a sampler state binds with LOD clamps that read as its own; others are Gap::LodClamps
The replay streams bind sampler states with Metal's bind-time LOD clamps (`setFragmentSamplerStates:lodMinClamps:lodMaxClamps:withRange:`): web3d on the 780M makes 2,635 such calls and on the 3090 2,627, every one over a state made with clamps (0, FLT_MAX), half of them binding (0, FLT_MAX) and half (0, 1000); glbench makes none (replay's census). rt had no such form, so the player skipped and counted the second kind. A sample's level is clamped into the clamps and then to the texture's levels, at most 14 (Metal's largest textures have 15 levels), and a level below 0 is level 0. So two clamps read alike where each bound held to [0, 15] (the translator's LAST_WORD_LEVEL) is equal: in Metal's sampler, in the device sampler `vk_sampler` makes (Vulkan clamps into [minLod, maxLod] and then to the view's levels) and in the sampler word. The translator states the rule (`metal::sampler::lod_clamps_read_alike`); rt's compute encoder (`set_sampler_state_with_lod_clamps`) and render encoder (`set_vertex_sampler_state_with_lod_clamps`, `set_fragment_sampler_state_with_lod_clamps`) bind the state as it is where the clamps read as its own, which covers every call the streams make at no cost, and refuse others as the new `Gap::LodClamps`, binding nothing (no stream makes one; a variant or a shader clamp is built when one does). Each range form is a loop of its single form. Tests: the translator's unit test pins the rule (1000 and infinity over FLT_MAX, -1 over 0 alike; 14, a raised lower bound and NaN not) and that every alike pair gives the descriptor's word, query level and device lods; a device test binds on the three forms and gets the gap on each; the sampling test binds its state with (0, 1000) and checks its samples as before. REFUSALS.md regenerated; the signature and surface tables take the new items. Verified in the job named in the landing message. |
||
|
|
aab68d6253 |
rt: a read_write slot a function only reads is the swizzled-texture gap too
The gap was found from the slot's hazard access, which the translator gives by use: a read_write slot the function only reads is a read there, so a swizzled view bound to it passed the check and its read answered the texel unswizzled. The device test caught it on lavapipe (49090: the read_write read of the view returned no gap). The translator now states the declared side: TextureSlot::storage, true where the function declares the slot write or read_write and so reaches a storage image, whose view maps each channel to itself. rt keeps the slots read through one (storage with a read) for kernels and for draws, and the gap is found from that list. The cache encoding carries the field (ARTIFACT_FORMAT_VERSION 540); api_signatures gains the field; REFUSALS regenerated. Verified: to follow in the build, tests and touched stages. |
||
|
|
2012b832c0 |
rt: a read_write slot bound to a swizzled texture is a typed gap at the bind
Apple defines the swizzle for reads and samples. A write through a swizzled
view, and a render pass into one, store the texels unswizzled: Metal's
documented answer, so that half leaves the README's known gap. A read() of an
access::read_write slot reads through the texture's storage element, which
maps each channel to itself as Vulkan requires of a storage image
(VUID-VkWriteDescriptorSet-descriptorType-00336), and would answer the texel
unswizzled where Metal reads it through the swizzle: a wrong answer, which no
static note covers.
Such a draw or dispatch is now Gap::SwizzledReadWrite { slot }, found with the
bind-time facts (the draw's Facts::find, the dispatch's alignment check), so
the test runs once per pipeline-state or binding change and only for the
translated interface's read-write texture slots. The players count it as they
count every gap.
Test (tests/swizzle.rs, on devices, the owned fixture rrp_swizzled_storage):
an access::read read through a [B,G,R,1] view of (10,20,30,40) answers
(30,20,10,255); an access::write write through it stores (0.2,0.4,0.6,0.8)
unswizzled at each texel; the read_write kernel bound to the view is
Gap::SwizzledReadWrite { slot: 0 } and over the texture itself reads its
texel.
|
||
|
|
1440a93e6c |
rt: swizzled texture views, the view's swizzle over its parent's
newTextureViewWithPixelFormat:textureType:levels:slices:swizzle: is Texture::new_texture_view_with_swizzle. The view's swizzle combines with the parent's as Apple states it (each channel the view takes from red, green, blue or alpha is the parent's as the parent's swizzle reads it; Apple's example [R,G,A,B] over [R,1,1,G] is [R,1,G,1]), so a view of a swizzled texture is built too and TextureViewKind::Swizzle goes. The view's descriptor holds the combined swizzle and its resource ID that swizzle's TextureWord. Metal takes the call whatever the parent's usage: glbench-780m-r1's 128 non-identity views are of textures of shader-write, and most of render-target, usage. A view takes its descriptor's checks but the swizzle-with-writes refusal, which Metal makes of a texture's own descriptor alone (prepare's checks split into checked()). The sampled element takes the combined swizzle; the storage element and attachment views map each channel to itself, as Vulkan requires (VUID-VkWriteDescriptorSet-descriptorType-00336, the rendering attachments' identity VUIDs). A read of an access::read_write texture and a write through such a view therefore reach the texels unswizzled where Metal swizzles them (and, recorded by swizzled-storage-*, undoes the swizzle on writes): a known gap in the README. The rt player maps the selector and its resourceIndex form; the conformance rt side makes the requested swizzled views instead of answering unavailable. Tests: the combination (Apple's example, identity on either side, constants, a rotation twice); on devices, a view's descriptor and word for Apple's example, a view without a swizzle keeping the parent's, and a swizzled view of a shader-write, render-target texture made. |
||
|
|
9c40b3cd83 |
rt: depth tests, writes and bias as dynamic state, under static notes; an unknown store action stores
The render-state lane's depth step (the planner's step 1). - A depth-stencil state's depth test, write and compare operation are dynamic state, recorded where they changed; DrawKind::DepthTest is gone. A pipeline bakes the depth format alone, so a change of depth-stencil state or bias makes no pipeline. In a pass without a depth attachment Vulkan skips the test, where Metal's documentation states no answer. - set_depth_bias (setDepthBias:slopeScale:clamp:): the bias and slope scale as given, enabled for a draw of triangles where either is not zero and never for lines (Metal biases triangles alone). A clamp other than 0 is Gap::Draw of DepthBiasClamp (no stream sets one). - Static notes, carried by the operation: PrecisionNote::DeviceDepthBias (RenderCommandEncoder::DEPTH_BIAS_NOTE: the slope measure, and a fixed-point attachment's unit, are the device's; Apple states neither; read from Vulkan's Depth Bias section and Apple's setDepthBias page), and PrecisionNote::DepthDenormals (DepthStencilState::precision_note, a state that tests or writes depth: every driver measured but MoltenVK on an M4 compares a denormal depth otherwise than Metal; RADV and ANV store one as zero). The old runtime maps DepthDenormals to its own depth-denormals kind and takes device-depth-bias as a note kind; codec, fast_paths, validation's allowance (Unbounded), API.md and ARTIFACT_FORMAT_VERSION 539 follow. No signed-depth note: no clear, viewport or upload gives rt a negative or NaN depth, and Vulkan leaves a depth past the viewport's range undefined. - MTLStoreActionUnknown stores (Vulkan fixes the store as the rendering begins); the encoder's set_color_store_action, set_depth_store_action and set_stencil_store_action change nothing the device does and refuse a resolving action (Resolve). On a tile-based device this stores a target Metal would have discarded (README). - set_triangle_fill_mode, set_depth_clip_mode, set_viewports and set_scissor_rects take Metal's defaults (Fill, Clip, one viewport or rectangle) as nothing and refuse the rest, typed (FillMode, DepthClamp, Viewports): replay found every stream at the defaults. - The conformance rt side plays the depth bias, fill, clip and viewport-count steps and announces the encoder's notes; the replay player maps setDepthBias:slopeScale:clamp:, the three store action setters, setTriangleFillMode: and setDepthClipMode:. - Tests: a depth attachment cleared to 0.5 with its store action unknown, tested under Less with writes, failing at 0.375, passing Greater by its bias alone, every mode setter's refusal, and no pipeline made by the state changes; the instructions a depth-tested draw retires beside a plain one, printed. REFUSALS.md regenerated, the API table blessed. |
||
|
|
3070737d28 |
translator: a kernel that encodes indirect commands is refused for that feature under the identity domains
Under the identity domains an encoder operation was refused only at the domains' admission check, as Unsupported{IdentityDomains, NotImplemented}: its plan pushes the resident set's root table and the execution status, which the identity domains do not take. The refusal now names the feature the kernel uses: the encoder operation's own check (encode.rs, needs) refuses it as Unsupported{GpuEncodedIndirectCommands, NotImplemented} under those domains. The new runtime already answers a state for indirect command buffers with Gap::IndirectCommandBuffers; its README says the translator refuses a kernel that encodes into one. docs/REFUSALS.md regenerated.
Verified: the new engine_identity test fails before the change (IdentityDomains) and passes after; job named with the sha.
|
||
|
|
f9633bf18d |
rt: a pass's depth attachment is loaded, cleared and stored, untested; a pipeline state takes its depth format
The render-state lane's first feature. A replay stream's 478 depth passes (depth census
m3-max-48544, the one stream with any) are a shader-read Depth32Float texture with no stencil
attachment beside it, a Clear of 1 (476) or a Load (2) and a Store, drawn under Metal's default
depth-stencil state (compare Always, no write) by four pipeline states of depthAttachmentPixelFormat
Depth32Float. rt refused all of them: the pass by RenderPassKind::DepthAttachment, the states by
RenderPipelineKind::DepthAttachment.
- pass.rs: Pass holds the depth attachment as it holds the stencil one: a format with depth
(else Refusal::AttachmentFormat, as Metal's validation stops it), the texture's view of the
level and layer, Metal's load and store actions as for a colour, its clear depth a float.
`vkCmdBeginRendering` takes it as pDepthAttachment. With a stencil attachment beside it the two
are one view (VUID-VkRenderingInfo-pDepthAttachment-06085): two others are
RenderPassKind::DepthStencilViews. A Clear outside [0, 1] or NaN is RenderPassKind::ClearDepth
(VUID-VkClearDepthStencilValue-depth-00022; the floor has no VK_EXT_depth_range_unrestricted).
Pass::targets yields each image once, so a combined texture's one view is moved, kept and
barriered once.
- render.rs: the descriptor's depth format is no refusal. Fixed holds the translator's depth
format (vk_format over the device's format query: a format the device does not render depth
in is the translator's typed refusal), the VkPipeline renders into it, and renders_into holds
it to the pass's depth attachment, as the colour and stencil formats are.
- The draw keeps DrawKind::DepthTest for a state that tests or writes depth; the encoder's
dynamic depth state stays off, which is what the default state means.
- error.rs: RenderPassKind::DepthAttachment and RenderPipelineKind::DepthAttachment go;
DepthStencilViews and ClearDepth come. Their docs, the bases and Refusal::AttachmentFormat's
doc say what is built.
- README: the render pass and encoder sections and their known gaps.
- docs/REFUSALS.md regenerated; the API signature table blessed (two variants out, two in).
- tests:
- draw.rs every_device_clears_loads_and_stores_a_depth_attachment_its_draws_do_not_test: a
shader-read Depth32Float attachment cleared to 0.25, then loaded, each pass one submission,
three barriers, one pass, no byte copied; the colour drawn; the depth read back 0.25; a state
without the pass's depth format, one with it in a pass without depth, and a Less test are
each their gap.
- pass.rs: the depth refusal is replaced by a depth attachment of a colour format, a depth and
a stencil of two textures, and a clear depth of 2 and of NaN.
- render.rs: the depth attachment leaves the pipeline refusal list.
Verified: nothing yet; the next check job compiles and runs it.
|
||
|
|
0a0ce8e29b |
rt: a cube array texture is a typed gap, so no view needs imageCubeArray
rt made VK_IMAGE_VIEW_TYPE_CUBE_ARRAY views without the imageCubeArray feature, which its floor (Vulkan 1.3) does not require: the conformance whole set's layer leg on lavapipe (job m3-max-48531) logged VUID-VkImageViewCreateInfo-viewType-01004 ten times once the rt side made the cases' cube array textures. No replay stream makes a cube array texture or view (cube census over every stream, jobs listed in the landing message), so by the planner's scope rule a cube array is a typed gap until one does, and the floor is unchanged. - error.rs: Gap::CubeArrayTexture, basis ours. - texture.rs: prepare refuses a CubeArray descriptor, which every texture and every view of one passes through, so no cube array view is made; the descriptor's and new_texture's docs name it. - README: the texture section's gaps. - docs/REFUSALS.md regenerated; the API signature table blessed (one variant added). - tests/texture.rs: a cube array texture is the gap on every device of the cfg. Verified: nothing yet; the next check job compiles and runs it. |
||
|
|
795c834ded |
Re-derive the generated documents at the landing tip
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. |
||
|
|
4fbe03c3a0 |
rt: maxColorAttachments of 8 joins the floor, and the pass's colour-attachment limit goes
The floor now requires maxColorAttachments of at least 8, Metal's eight colour attachments
(MAX_COLOR_ATTACHMENTS, the render pass descriptor's slots). Vulkan 1.3 requires only 4: the
spec's Required Limits table (Table 76, vkspec 1.4.366) lists maxColorAttachments as "4 (Vulkan
Core) 7 (Vulkan Roadmap 2022) 8 (Vulkan Roadmap 2024, Vulkan 1.4)", min. A device below 8 is now
named below the floor at creation ("maxColorAttachments 7, below 8"), so a pass's colour
attachments, at most the descriptor's eight slots, never reach past the device's. The check in
pass.rs and its refusal, Limit::ColorAttachments, could no longer fire and are deleted.
Breaking, intended: the public variant metal2vulkan-rt::Limit::ColorAttachments { count, max } is
removed (api_signatures.tsv loses that one line, blessed). docs/REFUSALS.md is regenerated (the
new runtime's Limit goes from 10 to 9 variants). The README's limits table gains the row and the
Limits paragraph the spec's minimums; the render pass passage says a pass may use all eight.
The floor test's low-limit cases go from 16 to 17 with the maxColorAttachments case.
|
||
|
|
518800af99 |
rt: a wait in a handler or a listener for what its own thread does next is a typed refusal
The completion thread runs a device's completed handlers and listeners, and it is the thread that marks a command buffer completed, an event's GPU value observed, and a queue's place free. A wait there for any of those not yet done could only end by that thread's next step, so it hung by construction. Each is now Refusal::WaitOnOwnThread, and a wait already met answers at once: - wait_until_completed: Ok for a command buffer completed or ended, the handler's own among them, else the refusal; nothing is sent. - wait_until_scheduled: the refusal for one not yet scheduled. - SharedEvent::wait_until_signaled_value: Ok(true) for a value reached, else the refusal. - CommandQueue::command_buffer on a queue whose maximum count are made and not yet completed: the refusal on the completion thread and on the submit thread (a scheduled handler), whose next steps free the place. The condition is the program's own state (what it committed, what has completed), never a ring's fill. Outside a handler every wait answers as before. Test: every_device_refuses_in_a_handler_each_wait_its_own_thread_would_have_to_end checks 15 answers in a scheduled handler, a completed handler and a listener. REFUSALS.md regenerated and the signatures table blessed: Refusal gains WaitOnOwnThread (a new variant of a non-exhaustive enum; no consumer breaks). |
||
|
|
ea8e7843b7 |
rt: scheduled handlers run on the submit thread, before their submission, and wake no thread
The consumer adds a scheduled handler to every command buffer. The submit thread handed each command buffer's scheduled handlers to the completion thread (Done::scheduled), and where that thread waited on the GPU the hand-over was a host vkSignalSemaphore of its wake timeline, on every submission. On NVIDIA a host signal per submission measured 103-117 us of CPU a command buffer on an RTX 3090 (the waits probe's rt arm, job 47928), against 2.9-3.5 us for every single wait form, rt's own steady-state WAIT_ANY included. Now the submit thread, which already marks a command buffer scheduled as it joins a submission, runs its scheduled handlers itself once it has dropped its lock, in queue order, before that submission goes to the driver and before any of those command buffers is handed on as ended. So the status reads Scheduled and the kernel times are set in the handler, a command buffer that ends before it joins a submission runs none, as before, and the scheduled handlers run before the completed ones by construction. Done::scheduled, its list and the completion thread's branch for it are deleted. A handler on the submit thread may not call what waits for that thread to submit. The four internal sites that do (Work::room, Work::capture, Work::stage and the readback's flush and Done::wait) give the public entries that reach them; each is now Refusal::InScheduledHandler in a scheduled handler, on every device and whatever the runtime holds: commit; wait_until_scheduled, wait_until_completed and SharedEvent::wait_until_signaled_value; replace_region, upload_region, get_bytes and zero_block_range; new_managed_buffer, and new_buffer zeroing a buffer in a Private block. The one consumer's scheduled handler makes none of these calls, and a guest's addScheduledHandler block runs in the guest. Quiesce in a scheduled handler answers false at once (neither the submit thread nor the completion thread, which the submit thread stops as it ends, is waited for), and a device whose last handle drops there tears down on the reaper, as from a completed handler. For a consumer: CommandBuffer::wait_until_scheduled and wait_until_completed now return Result<(), Error>, and SharedEvent::wait_until_signaled_value returns Result<bool, Error> (api_signatures.tsv blessed); docs/REFUSALS.md regenerated; the README's contract says where each kind of handler runs, what a scheduled handler may do, and that it holds its queue's later submissions while it runs. Tests: every_device_tears_down_from_a_scheduled_handler, every_device_answers_false_to_a_quiesce_in_a_scheduled_handler, and every_device_refuses_each_call_that_waits_for_the_submit_thread_in_a_scheduled_handler (each refused entry by name, the allowed calls, the status and kernel times in the handler, and the same calls answering once it has returned). Verified by the next jobs. |
||
|
|
a914d524ea |
Re-derive the generated documents at the landing tip
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. |
||
|
|
9be118cb5b |
rt: a take answers its zero mark, and the consumer asks for a Private range's zeros
The zero mark (BlockInfo::zeroed): how many of a block's first bytes the runtime itself zeroed and nothing held since, as the take found them. They read zero; bytes outside the mark are the consumer's to zero where Metal owes zeros. Nothing is inferred from the driver, the memory type or a fresh allocation: the runtime zeroes from the front only, on the block-maker thread. - Each Shared allocation made ahead of need is zeroed whole before it joins the pool (each device's first in its making), and its bytes are the allocation's clean ranges; a block carved there takes the clean run at its offset as its mark. - A Shared block given back is zeroed again from its first byte, in steps of 256 KiB, while it is kept; a take of it between two steps waits at most for the step that runs (the thread starts none while a take waits) and gets the mark as it stands. A kept block's zeroed bytes given back to its allocation stay clean. A block given back has mark 0 until then: the consumer may have written any byte. - Device::new_buffer zeroes only a Shared buffer's bytes past the block's mark, and every placement lowers the mark to its offset (new_managed_buffer's bytes too). - Private blocks carry no mark. Device::zero_block_range(block, offset, length) zeroes a range of one the consumer holds by a GPU fill on the upload path new_buffer's Private zeroing uses, ahead of every later commit; it never waits and is never done at a take. Refusal:: ZeroRangePastBlock and Refusal::ZeroRangeShared (REFUSALS.md regenerated). - Metrics: allocations_zeroed, allocation_zeroing_nanos, kept_bytes_zeroed, kept_zeroing_nanos, zeroed_bytes_taken, zeroed_bytes_freed (zeroed bytes an idle free gave back before any take), block_zero_fills, block_zero_fill_bytes; the replay player keys them; api_signatures blessed. - README: the consumer contract and the zeroing of kept blocks under the consumer's mappings. Tests: Ranges' run_at and cut; a Shared block of the made-ahead allocation is marked and reads zero whole; written, given back and kept, a take after three steps answers three steps' bytes, zero, the rest as written; a zeroed buffer then zeroes only past the mark and lowers it; given back again it is zeroed to its end. A Private block written by a kernel, kept and taken again, zero-filled over its first half, reads zero there to the next command buffer's kernel and the kernel's words past it; the refusals and NoSuchBlock. The three tests that check kept Shared bytes stay as written hold the zeroing. Verification: the check job and device legs run on this commit. |
||
|
|
9f2ca244ff |
rt: attachment reads through a copy into a shadow, on a device without the feedback loop
A device whose descriptor limits hold set 1's second elements but that does not report attachmentFeedbackLoopLayout and attachmentFeedbackLoopDynamicState (the UHD 630 on Windows, driver 101.2145) refused every draw that reads an attachment of its own pass through a texture. It now reads through a copy: the one form left on that device, recorded as a known gap. The query: floor::Capabilities::attachment_reads is the descriptor room alone, and the new feedback_loop is the room plus both extensions and features; device creation enables the extensions, features and dynamic-state loader only where feedback_loop holds, so the extension device test's expected list (core().feedback) follows the query unchanged. The form (crate::shadow): an image a draw may read so gets one shadow, same format, extent, levels and layers, made at its first reading draw, homed by the next submission's upload, freed with the image (Free::Shadow) and counted in Gauges::shadows and shadow_bytes. A texture reaching the rendered level and layer reads its own view of the shadow at its second element (index + 65,536), written under the owner rule (Arrays::place_shadow); one reaching neither reads the image at home. The points are the feedback form's: the pass's first reading draw, and a reading draw after a memory barrier after draws (which leaves every shadow holding nothing). At any reading draw the planner copies what the shadow does not hold, as one area per read where what is new is one, with no look-ahead: an own-pixel slot reads the scissor a pixel wider each way, clamped; any other every level and layer its texture reaches. The copy ends the rendering, records one barrier (a global memory barrier, the image's copied ranges to transfer source from the attachment layout or home, the shadow's to transfer destination), the copies and one barrier back, and begins again. Each copy counts in Metrics::attachment_read_copies and attachment_read_copy_bytes, and in bytes_copied. Docs: the rt README (set 1's second elements, the render encoder's copy form, the floor's attachment reads and extension table, the chosen-by-a-query note, and the known gap with the UHD cost: 39.0 to 53.5 us a MiB plus 3 to 8 us a copy, about 12 to 16.5 ms a frame for r3 and 4 to 5.5 ms for b3, from the census's 298.0 and 93.4 MiB a frame), DrawKind::AttachmentRead, REFUSALS.md regenerated and the public signatures blessed. Tests: host unit tests of the planning (tests::shadow) and of the floor's two answers; the device test of attachment reads now runs the copy form where the device has it, asserting its barriers (7), copies (2) and bytes, the live shadow, and the texels, and printing the counters; the level test runs it too, one copy a level. Checks are run on the potluck legs after this commit. |
||
|
|
fd916e7f99 |
rt: an index has one owner, the texture or sampler placed there last
The consumer's program places a texture at an index a live texture of its own still holds, and releases the older one later (179 placements in one recorded stream, 92 in another). Metal takes it: the later texture takes the ID. rt refused it (IndexInUse). Now Grants keeps one owner word per held index (a HashMap per class, the word given at placement and never again on the device; no list of holders, no refcount, no second bitset). A placement at a granted index always succeeds and makes the placed object the owner; a release vacates the index and empties its elements only where the releaser still owns it, so a displaced object's going touches nothing. Placement and element writes happen under the grants lock in one step (Arrays::place_texture, place_samplers, add_samplers, vacate_texture, vacate_samplers), so the elements always belong to the owner. Where a placement displaces another object, a texture with no storage view writes its storage element null and a sampler writes the arrays it does not use back to their defaults, so nothing stale answers. The descriptor-slot gauge counts held indices: a displacing placement adds none. The same occupancy serves textures, sampler states and constexpr samplers. Constexpr samplers are kept by (index, state words), each with its owner word; a later pipeline state of the same words adds its arrays where the constexpr sampler still owns the index. Refusal::IndexInUse is deleted: nothing Metal refuses remains. A texture now takes its index after its image and views are made, so an index not granted is refused after the image is made and freed at once. The duty: no work in flight reads a displaced object through its ID, as Metal's. rt does not check it. RESOURCE-ID.md and the rt README state the rule and the duty. The harness takes the next index round each class's range (its workloads make far fewer objects than a range holds). The replay player keeps the object placed last per index: a named index an object holds is taken, and the earlier object's release leaves it; with no index free for a constexpr sampler it answers IndicesNotGranted past the range. Tests: grants' an_index_has_one_owner_the_object_placed_there_last (both classes); sampling::every_device_gives_an_index_to_the_texture_placed_there_last (a storage-capable D at 3, a sampled-only A over it, whose placement empties D's storage element: a write through 3 is dropped and D keeps its texels; B storage-capable over A, A dropped; sampling through 3 reads B, writing through 3 writes B; B dropped, sampling through D's ID reads zero; the slot gauge counts 3 once); the sampler states' test places a state over a live one; replay's indices test. REFUSALS.md regenerated, api_signatures loses IndexInUse. |
||
|
|
cc9ab54b86 |
rt: one texture index class, 1 to 65,535, and a storage array as long as the sampled
The consumer hands each guest process texture IDs from one pool (1 to 16,320) and places every texture at its own ID whatever its usage. rt split textures into two index classes by usage (StorageTexture 1..4095 with shader-write usage, Texture 4096..65535 without), so every named sampled-only texture below 4,096 and every storage-capable one above it was refused (IndicesNotGranted), where Metal takes them: 4,818 makings in one recorded stream and 5,707 in another. Now there is one texture class, IndexClass::Texture, 1 to 65,535, with one grant bitset and one occupancy; IndexClass::StorageTexture is deleted. Set 1's storage-image array (binding 1) is as long as the sampled-image array, 65,536 (floor::TEXTURES replaces SAMPLED_IMAGES and STORAGE_IMAGES). A texture with a storage view writes both elements at its index; any other writes its sampled element alone and its storage element stays null; a texture that goes writes both null. Samplers keep their class. Why every floor device holds it: Vulkan's Required Limits (vkspec 56.1, Table 75 and Table 76) give maxPerStageDescriptorUpdateAfterBindStorageImages, maxDescriptorSetUpdateAfterBindStorageImages, the two SampledImages limits, maxPerStageUpdateAfterBindResources and maxUpdateAfterBindDescriptorsInAllPools a minimum of 500,000 on a device that supports descriptorIndexing. The floor's own sums become 2 * 65,536 + maxColorAttachments (131,080 at 8) and 2 * 65,536 + 3 * 4,000 = 143,072, both below 500,000. Every lab capture (2080, 3090, XTX, 780M x2, HawkPoint, RX 550, Iris Xe, UHD 630, lavapipe) reports descriptorIndexing and 1,015,808 or more for each of the six limits. The floor's limit check stays the one gate: no query-chosen size, no second form. Translator: link.rs's identity set 1 sizes binding 1 by IDENTITY_TEXTURES (65,536), the same constant as binding 0, so rt's of_the_device check still matches it. Nothing else in the pipeline interface, binding plan or resource-ID decode assumes a storage index below 4,096: the identity handle is the low word (masked only of bit 31 where the alpha flag rides it), indexing each array's runtime-array variable. The identity domains are reached only from Device::from_queries' profile (rt sets PointerDomain::Identity; the old runtime never does), so Device::new's modules, refusals and notes do not change. SEMANTICS_VERSION 2173: the identity set 1 layout is a binding-plan fact that changed under unchanged keys. Consumers in the tree: the harness and the replay player grant and place every texture in the one class; the player reserves a texture ID in it. Docs: RESOURCE-ID.md's class table (nil, texture, sampler), the rt README (set 1, grants, textures, the fault paragraph, the floor's limits table), IndicesNotGranted's doc (an object at an index not granted, as well as a release) and IndexRange's basis; REFUSALS.md regenerated; api_signatures loses the variant. Tests: sampling::every_device_makes_a_texture_of_any_usage_at_any_index grants the whole texture range, makes a shader-read texture at 2 and a shader-write one at 5,000, and checks one sample_down dispatch against the CPU mean. arrays' fill-past-capacity fills every texture index (a storage texture at 1, views of it at 2..65,535, 128 made again). |
||
|
|
da02260f2b |
Re-derive the generated documents at the landing tip
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. |
||
|
|
b527ae9f68 |
rt, translator: a step above 1 on a device without supportsNonZeroFirstInstance runs from base instance 0
Vulkan's divisor needs firstInstance 0 where the device does not report supportsNonZeroFirstInstance
(VUID-vkCmdDraw-pNext-09461): lavapipe and the UHD 630 among the lab's devices. The translator
refused the step there under the identity domains, as a Metal draw may carry a base instance, so
those devices lost every draw through such a state, base instance 0 included. The WebGL divisor
stream draws 462 times through its two stepped states, every draw at base instance 0 (it calls no
baseInstance form and draws nothing indirectly).
Now, under the identity domains, fetch_as takes the divisor wherever the profile has
vertexAttributeInstanceRateDivisor and the rate is within maxVertexAttribDivisor; outside them the
step is pulled where the property is missing, as before, so the old runtime's path is unchanged.
divided() names the feature or the limit; its not-implemented arm had no caller left and is gone.
The new runtime marks such a state where the device lacks the property
(Draws::first_instance_zero) and refuses a draw through it at a base instance other than 0,
Gap::Draw { DividedBaseInstance }, before anything is recorded; a draw of no vertices or instances
still records nothing. Indirect draws are not built in the new runtime.
Tests: from_queries_divides_an_instance_step_where_the_divisor_feature_is_enabled (lavapipe and
moltenvk-m3 profiles, with and without the property: an instance-rate binding of divisor 2, both
modules L3-valid; rate 5 past a limit of 4 refused naming it). The device test
every_device_with_the_step_rates_fetches_per_instance_at_rate_2_from_the_base_instance draws from
base instance 0 on every device with the step rates (every texel the first mark) and from base
instance 1 where the property is reported (the second mark), expecting DividedBaseInstance where it
is not, and prints which path ran.
docs/REFUSALS.md regenerated (scripts/refusal-surface/refusal_surface.py): VertexStepRate has one
site. The rt README names the draw refusal on those devices; docs/API.md the identity-domain rule.
|
||
|
|
cecc252f26 |
rt: refuse indirect arguments and indices a placement puts off Vulkan's multiple
The consumer places buffers at any byte of a block, so a buffer's place in its block's VkBuffer
plus a Metal-valid offset can miss the multiple Vulkan reads at. Metal's own rules (an indirect
offset a multiple of 4, an index offset a multiple of the index size) assume a buffer that starts
at an aligned address, as every Metal buffer does; here the absolute offset is what Vulkan sees:
- VUID-vkCmdDispatchIndirect-offset-02710: the offset in the VkBuffer is a multiple of 4.
- VUID-vkCmdBindIndexBuffer-offset-08783: the offset plus the base of the memory range backing
the VkBuffer is a multiple of the index size. A block's VkBuffer is bound at a multiple of the
pool's granule (64 KiB) or at 0 of its own allocation, so the place in the VkBuffer decides it.
dispatch_threadgroups_with_indirect_buffer and draw_indexed_primitives now check the place in the
block (the device copy's, for a Managed buffer with one, which is what the GPU reads) after
Metal's own checks and refuse with the new Refusal::ArgumentPlace { place, alignment }, basis
ours. Nothing is copied to an aligned place: a copy is not a design answer here.
Tests (device cfg): every_device_reads_indirect_arguments_only_at_a_multiple_of_4_of_their_block
places a buffer 2 bytes into a Shared block and shows offsets 0 and 16 refused at places 2 and 18,
then dispatches from a buffer placed at byte 4100 and checks the result;
every_device_takes_indices_only_at_a_multiple_of_their_size_in_their_block places indices 2
bytes into a block and shows 32-bit indices at offset 0 refused (place 2, alignment 4) before
anything is recorded, then draws 16-bit indices from there and checks the texels and the pass's
counts. README's placement contract names the rule; docs/REFUSALS.md regenerated; the API table
gains the variant.
|
||
|
|
c459695b88 |
rt: the consumer places a Managed buffer's device copy, in a Private block it holds, at any byte offset
new_managed_buffer(bytes, copy, length, copied) takes both placements from the consumer: the bytes as (block, offset) in a block the host maps, and on a device that keeps a device copy (has_unified_memory false) the copy as (block, offset) in a Private block the consumer holds, at any byte offset; gpu_address is that block's address plus the offset. rt chooses no layout any more: its copy blocks, COPY_ALIGN, the first fit and the device's copies place list are deleted, and so is the Private block of the copy's own that the copy took where device-local memory had no room. Placement, and so the slack past a buffer's length, is the consumer's: rt writes the copy's length and no byte past it. New typed refusals: ManagedCopyMissing (no copy where the device keeps one), ManagedCopyOnUnified (a copy where it keeps none) and ManagedCopyNotPrivate (a copy in a block that is not Private); a copy range past its block is BufferPastBlock, as for any buffer. managed_spilled_bytes is now per buffer: a copy the consumer placed in a spilled Private block counts its length while the buffer lives. new_buffer shares the range check (placed). The harness places a Managed buffer's device copy as it places a Private buffer of its length and frees both with the buffer. The player places the GPU copy through its places at their current rule, as a Private buffer of the buffer's length: a buffer in a place of its own keeps the copy's place beside its own and gives both back with the same users; a buffer in a stream's block or heap holds the copy's place as its one place. REPLAY-STREAM.md says so. Tests: the two-copy rule places its device copy 4 KiB into a Private block the consumer takes and checks gpu_address there (and, under the spill test, in a consumer take that spills, counted in managed_spilled_bytes); a new device test places the copy at byte 4099 of a Private block filled with 0xA5 and checks the whole block after the copy's creation and after a copy-in of the whole buffer: the copy's bytes at 4099..5099 alone, the consumer's slack write at 5100..5200 and every other byte unchanged; and the four refusals. Every other Managed test places its copy at the start of a Private block of its own (tests::managed::on_device::new_managed). Regenerated docs/REFUSALS.md (scripts/refusal-surface); api_signatures.tsv by hand. |
||
|
|
12b113fa5a |
Re-derive the generated documents at the landing tip
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. |
||
|
|
212bba29c6 |
rt: Metal's constant step is a vertex-rate binding of stride 0, on every device
Under the identity domains (Device::from_queries' profile, the new runtime's), Metal's
MTLVertexStepFunctionConstant was refused as Unsupported{VertexStepRate}, needing
vertexAttributeInstanceRateDivisor and vertexAttributeInstanceRateZeroDivisor, which the floor
does not enable. The constant step needs no divisor: it is now a vertex-rate binding of stride 0,
one form, no query, every device.
Vulkan permits it. The specification's "Vertex Input Address Calculation" (28.4) gives a
vertex-rate attribute's address as bufferBindingAddress + vertexIndex * stride +
attribDesc.offset, so a stride of 0 reads the layout's first element for every vertex and every
instance, whatever the base instance: what Metal's constant step reads. A binding's stride has no
lower bound outside the portability subset: VUID-VkVertexInputBindingDescription-stride-00619
bounds it above (maxVertexInputBindingStride) and is the only other rule on it, and
VUID-vkCmdBindVertexBuffers2-pStrides-06209 names 0 among the strides a bind may set. Under the
portability subset (VUID-VkVertexInputBindingDescription-stride-04456: at least
minVertexInputBindingStrideAlignment) link refuses the stride of 0 as
Unsupported{VertexInputLayout}, as it refuses any stride the subset forbids.
Translator, under the identity domains only (lower::access::identity), so Device::new's profile
and the old runtime are unchanged:
- metal::vertex::fetch_as answers Constant with VERTEX rate, divisor 1;
- pipeline::link::vertex::binding_stride emits stride 0 for any fixed-function fetch of a
constant-step layout, keyed on the layout's step rather than on a divisor of 0 (on Device::new's
profile the only such fetch is the divisor-0 one, so its bindings are the same);
- link's check that an attribute the vertex function lists as alike at every vertex of a
primitive is fetched once per instance also takes a constant step's binding, which reads one
element at any rate.
- The per-instance refusal (rate above 1) names exactly what the profile lacks:
vertexAttributeInstanceRateDivisor, else the maxVertexAttribDivisor the rate passes. Its old
text, and Feature::VertexStepRate's, claimed the constant step needed the divisor; both now name
the per-instance step alone.
Docs: docs/API.md (identity-domain vertex input), the rt README's vertex lines, REFUSALS.md
regenerated (the VertexStepRate row and its reach mark no longer name the constant step).
Tests:
- engine_identity_render from_queries_fetches_a_constant_step_at_vertex_rate_with_stride_zero:
on lavapipe (no buffer robustness, no divisor, no supportsNonZeroFirstInstance) ima_vertex's mark
layout at the constant step links to a VERTEX-rate binding of divisor 1 and Static(0), both
modules L3-valid; on moltenvk-m3 (portability subset, minVertexInputBindingStrideAlignment 1) it
is Unsupported{VertexInputLayout}. Fails without this commit (VertexStepRate on both).
- rt draw every_device_fetches_a_constant_step_attribute_for_every_vertex_and_instance: two
instances of a triangle from vertex 1 at base instance 1, the uint mark at the constant step over
four distinct marks: every texel holds the first mark, provoking vertex 1, and its instance (1
above, 2 below). Points are a gap of rt's draws, so the draw is of triangles; the provoking
vertex is vertex 1, so a vertex-rate stride other than 0 would read the second mark, and an
instance step the second and third.
- The Device::new-path tests stay as they were: a_constant_step_links_to_a_zero_divisor_binding_of_
zero_stride, fetch_is_fixed_function_only_when_exact,
a_constant_step_is_a_zero_divisor_only_where_a_zero_stride_is_legal.
|
||
|
|
70dffca0c2 |
Deep threadgroups run as one row: SpecKey::DeepThreadgroup on from_queries, rt keys it on the size
Metal allows 1024 threads along z; a device's maxComputeWorkGroupSize[2] may hold 64 (NVIDIA's), so rt refused a kernel's threadgroup of 1x1x320 (Limit::ThreadgroupShape) and could not play a recorded stream past its frame 216 on any NVIDIA card. One form serves every shape on every device: a threadgroup deeper than DEEP_THREADGROUP (64) runs as one row of its threads. Translator, on Device::from_queries' profile only (ProfileFacts::deep_threadgroups, OneRow; Device::new keeps Axes and is byte-equal): a kernel whose workgroup is its threadgroup (LocalSizeForm::Spec, no compute derivatives) declares the boolean SpecKey::DeepThreadgroup. Its WorkgroupSize is (Deep ? sx*sy*sz : sx, Deep ? 1 : sy, Deep ? 1 : sz), OpSpecConstantOp selects (the WorkgroupSize rule now takes spec-constant operations whose defaults are positive), and its position in the threadgroup Deep ? LocalInvocationIndex unflattened over (sx, sy) : LocalInvocationId. The linear index, workgroup and grid builtins keep their values, so group counts, regions and indirect buffers are untouched. The binder sets it for a region deeper than 64 and checks that region as the flattened tiers' are. MetalDeviceProperties on that profile reports the capped invocations on every axis (1024 on every floor device) instead of the device's per-axis sizes. SEMANTICS_VERSION 2172, ARTIFACT_FORMAT_VERSION 536. rt: the key is a function of the variant's size (size[2] > DEEP_THREADGROUP), so it adds no pipeline and no cache key. choose() takes no device limit: an image-only kernel's deep tile runs whole as one row on every device (it ran whole on RADV/ANV and in tiles on NVIDIA). fits(), ComputeLimits::max_group_size and Limit::ThreadgroupShape are deleted: every workgroup is within the floor by construction (a const assertion). A module that neither flattens nor declares the key is a creation gap. README: the deep form, worst-case pipeline counts, the 50-pipeline line. REFUSALS.md regenerated; API.md; api_signatures blessed; api_surface pins DEEP_THREADGROUP. Tests: the translator runs a barrier-exchange kernel at 1x1x320, 2x3x100, 1x4x256 (deep) and 4x4x4 on the interpreter, checks the evaluated WorkgroupSize, no key on Device::new, the binder's setting on an NVIDIA profile, and the reported maxima; rt's choice tests drop the device limit; the observing-kernel device test adds deep whole, ragged and indirect dispatches; the square test adds a column 256 deep. Verified: built and tested under the check job named in the report. |
||
|
|
0d1a32436b |
vertex input under the identity domains: every attribute in fixed function, no pulled form
Planner ruling 11-18 (final): fixed-function vertex input for every attribute on every device,
the form native Vulkan uses and the fastest measured on every device, one form. Nothing of the
pulled form is taken on Device::from_queries' profile. Before this, the translator's
containment rule (contain::encoding is Check::InShader without buffer robustness) moved every
[[stage_in]] attribute into the shader, a form that reads through a descriptor the identity
domains refuse, so every rt render state with a vertex descriptor was refused as
Unsupported(IdentityDomains).
Translator (metal::vertex::fetch_as, pipeline::link::vertex::resolve), under the identity domains
only (lower::access::identity), so Device::new's profile and the old runtime are unchanged:
- the containment rule no longer moves an attribute: the device bounds the fetch as it bounds
any (no buffer robustness: a fetch outside its buffer reads what the device gives);
- an unnormalized signed-integer format (Char*, Short*, Int*) is fetched in fixed function into
a variable declared int, VertexFetch::SignedFixedFunction (new): Vulkan's numeric-type match
lets a SINT format feed only a signed variable, and the device sign-extends as Metal does. The
module reads the variable's bits by OpBitcast. Elsewhere such an attribute is still pulled and
sign-extended in the shader;
- every case that pulled is a typed refusal by what it needs, never a second fetch form.
Metal's vertex descriptor on the rt floor:
- Maps directly:
- formats: every Metal vertex format to the Vulkan format of its layout and conversion, by the
device's VERTEX_BUFFER format query. 8/16-bit integer formats read into float attributes go
through USCALED/SSCALED, signed integer formats into int variables, UChar4Normalized_BGRA is
B8G8R8A8_UNORM, the 10:10:10:2 formats are A2B10G10R10, and FloatRG11B10 is
B10G11R11_UFLOAT_PACK32. The validation crate's profiles of RADV (780M x2, RDNA3), ANV (Iris
Xe, UHD 770), NVIDIA (Pascal, RTX 50) and lavapipe report VERTEX_BUFFER for all of them but
FloatRGB9E5;
- steps: PerVertex is VERTEX rate; PerInstance at rate 1 is INSTANCE rate;
- offsets and strides: the descriptor's, baked into the VkPipeline.
- No fixed-function equivalent on the floor, so a typed refusal:
- PerInstance rate > 1 and Constant: Unsupported{VertexStepRate}, by query. They need
VK_KHR_vertex_attribute_divisor's vertexAttributeInstanceRateDivisor (plus ZeroDivisor for
Constant) and supportsNonZeroFirstInstance, which the floor does not enable, so it is
refused on every rt device today. Its needs name the missing feature, or the
maxVertexAttribDivisor limit;
- a format the device does not report for VERTEX_BUFFER: Unsupported{Format} with that format
usage, by query;
- FloatRGB9E5: Unsupported{Format}, not implemented, by need. Of the profiles above only
lavapipe's reports it, and its fetch answers 0 for the fourth component, where Metal and
Vulkan give 1;
- an offset or stride off the format's component alignment (Metal takes any byte multiple on
Apple5+), and an offset, stride, attribute count or layout count past
maxVertexInputAttributeOffset, maxVertexInputBindingStride, maxVertexInputAttributes or
maxVertexInputBindings: Unsupported{VertexInputLayout}, with the limit where one is passed;
- PerPatch and PerPatchControlPoint: Unsupported{Tessellation}, as before.
rt: RenderPipelineKind::StepRate is deleted: the translator's VertexStepRate refusal comes first
on every rt device, so no pipeline states a divisor. README: the vertex input bullets, their
refusals, and the known gap that a vertex fetch outside its buffer returns what the device gives.
docs/API.md: the identity domains' vertex input. REFUSALS.md regenerated, with reach marks for the
two new features (VertexStepRate app, VertexInputLayout rare); api_signatures blessed.
Tests:
- engine_identity_render from_queries_fetches_every_attribute_in_fixed_function (lavapipe and
moltenvk-m3 profiles with buffer robustness and the divisor withheld): ima_vertex's float2
and short attributes are R32G32_SFLOAT and R16_SINT, nothing pulled, L3-valid; a rate-2 layout
is VertexStepRate needing vertexAttributeInstanceRateDivisor. It fails without this commit (the
attributes were pulled, then refused as IdentityDomains);
- rt draw every_device_fetches_a_signed_attribute_in_fixed_function: a short of -2 reaches the
fragment's uint output as 0xFFFFFFFE on every texel; a rate-2 layout is refused as
VertexStepRate. The existing stage-in test (vertex buffer and set_vertex_bytes) now makes its
pipeline.
Verified: the next lint job and the device legs on every device.
|
||
|
|
2aabffabb0 |
rt draws: a buffer bound off its argument's alignment is refused before the draw records anything, by the dispatch's shared check
Identity's Refusal::BufferOffsetAlignment (
|