b96e61afa38bd61bc2c8e2fc31931d4171995fa2
1555
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b96e61afa3 |
docs: VALIDATION.md's matrix says a harness time is host time and a ceiling is only ruled
The `time` record kind is what a program waits on, timed on the host (commit-to-complete where the workload times it, else the wall time a run adds), since the harness's matrix_time change on this branch; the harness budget lists no ceiling now, and one is given only by a ruling after the work on its row. The doc said GPU time and measured-ratio ceilings. Verified: the text only; python3 scripts/matrix/test_results.py, 28 OK on this branch. |
||
|
|
80bd8ca764 |
rt: pooled blocks are 16 MiB of Shared memory and 64 MiB of Private
A pooled block's length is now per memory class, MemoryClass::block_len: 16 MiB Shared and 64 MiB Private on every device. It replaces the one 256 MiB BLOCK_LEN. take_block gives a pooled block up to the class's length and a dedicated one past it. Textures are placed in texture blocks up to the Private length. The harness and the replay player's places take blocks of the class's length. Why: a driver may hold the device's other calls for the whole of a block's vkAllocateMemory, and the hold grows with the bytes, so the length sets how long one hold lasts. On an RTX 3090 (NVIDIA's Linux driver, probe at 70d7cae48e, jobs 44050 and 44053 with the RTX 2080), a pipeline creation beside a Shared block's making took 40-45 ms at 256 MiB and 6-8 ms at 16 MiB (3-4 ms settled). 16 MiB is the largest piece a guest's allocator takes. Private holds less: 3.4-4.6 ms beside a 64 MiB block, at most 1 ms more than beside a 32 MiB one. At 64 MiB, a texture or a Managed buffer's device copy of 32 MiB takes a pooled block. Tests: every_device_pools_16_mib_shared_and_64_mib_private_blocks covers the lengths, the dedicated block past each, and a 32 MiB texture placed in a texture block. The memory, command, places, spill and upload tests use the class's length. The memory test reads a Private block back a Shared block's length at a time. API table re-blessed (the BLOCK_LEN const goes, MemoryClass::block_len comes). |
||
|
|
4b88203551 |
rt: a texture over a Managed buffer's device copy that the device's linear image does not take is copied at Metal's Managed events
Where the device's linear image does not hold a texture over a Managed buffer's device copy in
place (another pitch, an offset off the image's memory alignment, a format or usage the linear
tiling lacks), the texture was refused (Gap::TextureOverBuffer). It is now an optimal image of
its own, copied from and to the device copy only at Metal's own Managed events, with no tracking
of commands:
- in, from the device copy, by the upload that leads the next submission using the texture,
where a did_modify_range met its range (after the upload's copy of that range) or submitted
device work wrote the buffer (a binding whose compiled interface writes it: the translator's
uses, not the declared access; a blit or fill into it) or another texture over a range that
meets its;
- back, where device work wrote the texture, before the next reader of the device copy (a
binding that reaches the buffer, a blit from or into it, a copy into another texture over a
range that meets its, a synchronize_resource, a did_modify_range over it). A reader recorded
after the write takes it in its own commands; the upload that leads a submission, which runs
before the submission's commands, takes it only once the write's segment was submitted
(Segment::managed_wrote; the segment's submission settles each write it made).
The buffer keeps each such texture's entry (ManagedOvers). A texture released while its copy
back is owed leaves its image with the buffer until a reader takes it or the buffer is released;
a lookup by id skips a released entry, whose id a texture made since may hold. The Shared rules
(crate::over's per-submission copies) now apply only to textures over a buffer of no device copy
(copied_shared). The planner ruled that Managed keeps its device side; this is that side's copy
form.
Tests (device cfg): the Managed device test (100 uses copy in once; a modify over the range
copies once, one outside it not at all; a kernel's write owes one copy, a read none; a written
texture read through its buffer by a blit; a synchronize; two textures over one range; a
released texture whose buffer goes copies nothing back and frees its image; one released before
a kernel reads its buffer goes back first), and a kernel that declares a Managed buffer
read-write and never touches it owes no copy. README, Gap::TextureOverBuffer's doc and
docs/REFUSALS.md follow.
Verified: lint m3-max-44117 and device legs m3-max-44136 (780M HawkPoint, 3090), 44137 (RX 550),
44138 (XTX, 2080, 780M Phoenix, lavapipe), 85/85 each with the validation layer on, on the same
tree based on
|
||
|
|
f1c73d60bc |
A dispatch of a kernel that writes no memory records nothing
The translator states on a pipeline's interface whether some stage writes memory another invocation or a later command can read (PipelineInterface::writes_memory, the union of the stages' StageInterface::writes_memory: a store to a buffer or through a device address, a texture write or an atomic update, in the entry or any function it calls; the ExecutionStatus words are the product's and do not count). The cache's artifact format and semantics versions move with the new field. rt reads it into the compute state's interface. A dispatch of a kernel without it, direct or indirect, is checked as Metal checks it and then records nothing: no bind, no push, no vkCmdDispatch, and the indirect buffer is not kept or read. Metrics gains dispatches_without_effects, which counts them. Such a kernel has no effect a program can observe, so the only difference is less GPU and encode time than Metal's. Tests: the translator's a_compute_pipeline_states_whether_its_kernel_writes_memory (a kernel that returns at once, one that only reads, one that writes only its own thread's array: no; a store behind a branch, a noinline callee's store: yes, on the function and the linked pipeline, each validated), and rt's every_device_records_nothing_for_a_dispatch_of_a_kernel_without_effects (a direct, an indirect and an unbound dispatch of a kernel the interface says writes nothing leave the buffer unchanged and count three). |
||
|
|
3fd4b72b2c | replay: the report counts the recorded ranges a newer one met in part (parted), on both backends; the rt backend counts the compute pipeline IDs it cannot give as a typed gap (gap_pipeline_ids), summed on a gaps line | ||
|
|
ad33c4269f |
replay: the rt backend plays fences on compute and blit encoders (rt's Fence, 05ce4db691); a render encoder's fence calls stay skipped with it
|
||
|
|
d0b7ead2c3 | replay: a recorded range that meets a live one in part ends the older range, as the program reused that memory; gb's stream places a buffer over one still live in its block (m3-max-44056, 44065) | ||
|
|
5733e58c4e | replay: the rt backend answers a compute pipeline state's resource ID as none, reported as differing, where the play stopped (gb, lavapipe, m3-max-44039) | ||
|
|
1ada6e8b1c |
rt: a texture over a buffer of no device copy that the device's linear image does not take is copied between the buffer and an image of its own
Where the in-place linear image does not hold a texture over a Shared buffer (or a Managed one without a device copy) for its pitch, place, memory type or format features, the texture is now an optimal image of its own instead of a Gap::TextureOverBuffer. The device copies the buffer's bytes into it and back, one vkCmdCopyBufferToImage or vkCmdCopyImageToBuffer region a texture, with no CPU copy (crate::over): - in, once a submission: the upload that leads it copies into every such texture a segment uses before any command of the segment wrote the buffer; inside a segment, a use after a write of the buffer copies in again first; a segment leaning on the leading copy for a buffer an earlier segment of the held group wrote leads a new group; - back, after a write of the texture: before the next command of the segment that reaches the buffer, and at the segment's end, whose end barrier then reaches the host. Commands track what they write only while such a texture lives (a device count); a command recorded while none lived counts as a write through an unbound address, so a texture made later never leans on a copy that could precede it. Each copy counts in Metrics::over_copies and its bytes in bytes_copied. The accepted difference (a CPU write between two held members' commits races an uncompleted command buffer, which Metal leaves undefined) is stated at the rule and in the README. A texture over a Managed buffer's device copy that the linear image does not take stays a Gap::TextureOverBuffer: the Managed branch waits on the measurement of whether a Managed buffer keeps a device side at all. Tests: tests::copy_over (every device under the device cfgs): a render target over a Shared buffer at one alignment past the device's pitch copies in once per command buffer and takes the host's writes; a fill then a use in one command buffer copies once, after the fill; a fill and a use in two command buffers committed back to back takes the filled bytes; a blit's write to the texture is in the buffer once the command buffer completes. A view of such a texture shares its parent's image and id, so it is tracked and copied as its parent; the live count counts the parent alone. An ended segment keeps its tracking, cut to the textures that lean on the leading copy, for the submit thread to read in place. |
||
|
|
9a9135b4c9 |
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. |
||
|
|
05ce4db691 |
rt: Fence, MTLFence, whose updates and waits on compute and blit encoders record nothing
A command buffer's encoders run in order and a queue's command buffers in commit order, each encoder's writes reaching the commands after it through the barrier at its end or its segment's end, so a wait after an update already sees them. A fence keeps the first queue whose encoder uses it; a use on another queue is Gap::FenceOtherQueue, as Metal's fence orders one queue and MTLEvent orders queues. Another device's fence is Refusal::OtherDevice. Test: every_device_orders_a_wait_after_an_update_and_records_nothing_for_either fills a buffer in one command buffer and updates the fence from a blit and a compute encoder, waits in a second committed before the first completes and copies the buffer out, and counts the same submissions, barriers, bytes copied and passes with the fence calls as without; a second queue's compute and blit encoders get the gap. REFUSALS.md and api_signatures.tsv regenerated. |
||
|
|
d2fa098f0c | replay: a message to nil (receiver 0, no result, no class named) plays nothing, as Objective-C does nothing for it; gb's stream holds such a replaceRegion | ||
|
|
231a0cc003 |
rt: a texture over a Managed buffer lies in its device copy; blits and dispatches that write a texture over a Shared buffer reach the host
The in-place linear image binds in the bytes shaders reach: a Managed buffer's device copy where it has one, so replace_region writes the consumer's bytes and copies the rows' span into the copy as did_modify_range does, and get_bytes reads the consumer's bytes as Metal reads a Managed texture's CPU copy. A blit or dispatch that writes a texture over a Shared buffer marks its segment's end to reach the host, as a write to the buffer does. The device test (tests/over.rs) checks the alignment answer, the in-place texture over a Shared and a Managed buffer (nothing allocated or staged, the image the buffer's bytes as the host changes them, replace_region and get_bytes, a blit's write reaching the host), the layout refusals and the gap. |
||
|
|
53b6e17487 | replay: the rt backend plays block buffers, synchronizeResource and the optionless buffer-to-texture blit; skips texture views, surface and tiled textures, pass descriptors, source libraries and what is made of a skipped object; a backend may decline the player's snapshots (rt does), counted unsnapshotted | ||
|
|
0a39715cf8 |
rt: texture views, a texture over levels and slices of its parent's image with image views of its own
Texture::new_texture_view(pixel_format, texture_type, levels, slices, index) is newTextureViewWithPixelFormat:textureType:levels:slices: (and, with the texture's own type and every level and slice, newTextureViewWithPixelFormat:). A view is a TextureInner over its parent's image: its own sampled and storage image views of the subresource range, its own index and elements of set 1, no image, memory or copy. It keeps its first parent (a view of a view composes the ranges), shares the parent's resource id so hazards between them are one texture's, and reports Metal's view descriptor: the extent of its first level, its levels and slices (probe texture_view_rules.m, job m3-max-43677: width 4 for levels 1..3 of an 8-wide texture, arrayLength 2 for slices 1..3). place() takes the texture's base level and layer, so blit copies, replace_region and get_bytes through a view reach the parent's levels and slices under it. The view's image views go to the reaper (Free::Views) when it drops; Gauges::textures counts views until then. Built, from replay's compute-bound views (gb 18, b2 19): the parent's own pixel format over every slice in its type, a slice subrange of a 1D or 2D array, one slice of a 2D array as a 2D texture, each over any level subrange. Refused as Metal's validation stops them (job m3-max-43677): Refusal::TextureViewRange (empty or past ranges) and Refusal::TextureViewFormat (another format without PixelFormatView usage). Not built: Gap::TextureView naming the kind (TextureViewKind: PixelFormat, TextureType, Slices, Swizzle). Test (device cfgs): tests::view::every_device_views_levels_and_slices_of_a_texture: six views and a view of a view report Metal's descriptor and read Metal's bytes (the probe's FNV-1a 64 of each view's level 0 copied out), each view costs 0 submissions, 0 blocks and 0 bytes copied; the three range refusals, the format refusal and four gap kinds; views outlive their parents' handles and every gauge falls to zero. The blit tests' Side carries the base. README, REFUSALS.md and the signatures table updated. |
||
|
|
647c186ec8 |
replay: placement heaps laid out for the runtime's sizes and alignments
A stream's heap offsets and heap sizes are the recording device's answers. On another device a texture can be larger: b2 on an NVIDIA GPU stopped at a heap texture whose image the old runtime makes 7.47 MB in a 5.9 MB heap. A live program lays its heap out by the device's heapTextureSizeAndAlignWithDescriptor: and heapBufferSizeAndAlignWithLength:options:, so the player now does the same: before it plays, it reads every placement in each placement heap ahead, asks the backend the size and alignment of each (a texture's of its descriptor as its making call and setters left it), and moves each offset up until the resources below it end and it is aligned, growing the heap to hold them. Resources at one offset still share it; where every answer fits the stream's layout, nothing moves. The report says what moved (`relaid HEAPS moved OFFSETS grown BYTES`). The backend gains heap_size_and_align; the old runtime's answers through its own queries, with the texture descriptor's making and setters shared with its play of those calls. Verified: not yet built; a unit test on the keeping backend covers a texture larger than its room (the buffer above it moves, the heap grows), a texture made again at its offset, a heap where every answer fits, and the descriptor calls the backend is asked with. |
||
|
|
b37339a609 |
rt: a blit encoder synchronizes a Managed buffer, one copy of its device copy into the consumer's bytes
BlitCommandEncoder::synchronize_resource is synchronizeResource:. Of a Managed buffer with a device copy (Shared memory not device-local) it records one vkCmdCopyBuffer of the copy into the consumer's bytes between the two barriers a fill records, and marks the segment so its end barrier reaches the host: the host reads the GPU's writes before the call once the command buffer completes or it sees an event signaled after it. A buffer without a device copy is read by the host where shaders write it, and a texture has no bytes the host reads apart from its image (no texture has named bytes on development yet): for those the call records nothing. Every call is counted in the new Metrics::synchronizations and is no submission of its own. Metal's validation stops a synchronize of a Shared or Private buffer or texture (probe blit_synchronize_rules.m, job m3-max-43632: "synchronizeResource: only applies when ... == MTLResourceStorageModeManaged"); rt keeps no storage mode for those and records nothing, as the old runtime does. The probe's Managed buffer, filled 4..12 with 0xab and synchronized, hashes 5d28bc84b408472d, the bytes the test asserts. The barrier after a blit's write into a buffer is one helper now (fill, buffer copy, synchronize); a buffer copy's source stage widens from COPY to ALL_TRANSFER. Tests (device cfgs): every_device_synchronizes_a_managed_buffer (a fill alone leaves the host's bytes where the buffer has a device copy; fill + synchronize gives Metal's bytes at 1 submission, 5 barriers with a device copy and 3 without, 0 bytes copied, 1 synchronization, 1 host reach; a texture's synchronize records no barrier) and every_device_reaches_the_host_only_after_a_blit_writes_shared_memory (the wrote_host invariant for blit encoders: fills and copies into Private memory or a texture reach no host, into a Shared buffer they do). README, REFUSALS.md and the signatures table updated; the README drops the line that said synchronizeResource comes with blit encoders, and names synchronizeTexture:slice:level: as not built (no recorded stream calls it). |
||
|
|
594b86d1f2 |
rt: the floor asks the created device for support of the runtime's set layouts
vkGetDescriptorSetLayoutSupport is Vulkan's answer to whether a set layout can be made; the
limits the floor checks do not promise it. MoltenVK 1.4.2 on an M3 Max reports set 1's layout
(65,536 sampled images, 4,096 storage images, three arrays of 4,000 samplers, update after bind)
unsupported, and the validation layer then names VUID-vkCreateDescriptorSetLayout-support-09582
at device creation (probe job m3-max-43634).
Arrays::make asks it for the empty set 0 and for set 1 before making either; an unsupported one
refuses the device with Error::BelowFloor and the new Missing::SetLayout { set }. Vulkan answers
it only for a created device, so PhysicalDevice::check cannot. Set 1's layout is built in one
place, with_arrays_layout, for the query and the creation.
Tests: every_device_supports_the_runtimes_set_layouts (each device of the cfg's kind supports
both), a_set_layout_the_device_does_not_support_is_named. README floor section, REFUSALS.md and
api_signatures.tsv regenerated.
|
||
|
|
e9f43bb855 |
rt: blit buffer copies and fills reach a buffer through its device range, and keep the buffer
Development's Managed buffers (
|
||
|
|
2cb7ea189d |
rt: a blit encoder fills a range of a buffer, one vkCmdFillBuffer between two barriers
fill_buffer (fillBuffer:range:value:) records vkCmdFillBuffer of the byte four times over in each word against the buffer's own range of its block, between the two barriers a copy records (the second from every transfer stage's writes to every later command), and a fill of a Shared buffer marks the segment so its end barrier reaches the host. Probe blit_fill_rules.m on an Apple M3 Max, macOS 27.0.1: Metal's validation stops an empty range and one past the buffer's end (job m3-max-43573), Refusal::FillRange; it takes ranges of no whole words (job m3-max-43571), which vkCmdFillBuffer cannot write: Gap::FillAlignment until a replay stream makes one. Tests: the range checks (offset from the buffer's place in its block, empty, past the end, reversed, unaligned start, length or block offset); a device test filling 4..12 of a 64-byte Shared buffer with 0xab, its bytes plain Metal's FNV-1a 64 (job m3-max-43571), at one submission, three barriers, no byte of the runtime's own. |
||
|
|
8e39e812e5 |
rt: a blit encoder copies between a buffer and a texture, one copy command an image of the region
copy_from_buffer (copyFromBuffer:sourceOffset:sourceBytesPerRow:sourceBytesPerImage:sourceSize: toTexture:destinationSlice:destinationLevel:destinationOrigin:) and copy_from_texture_to_buffer (copyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toBuffer:destinationOffset: destinationBytesPerRow:destinationBytesPerImage:) record vkCmdCopyBufferToImage or vkCmdCopyImageToBuffer against the buffer's own range of its block, nothing staged, between the two barriers a texture copy records. One region per image of the region, each at its own offset (offset + image x bytesPerImage), so an image stride of no whole number of rows copies too; bufferRowLength is bytesPerRow in texels, 0 for one row. The second barrier also makes a buffer write visible to every later command, and a write into a Shared buffer marks the segment, whose end barrier reaches the host. BufferLayout carries the offset and the two strides. Refusals follow probe blit_buffer_copy_rules.m on an Apple M3 Max, macOS 27.0.1 (jobs m3-max-43541, m3-max-43545): Metal's validation stops an offset or a row stride of no whole texels, rows or images closer than the region's and a region past the buffer's end (Refusal::BufferCopyLayout); it takes an R8Unorm offset of 2, a row stride of 0 for one row, image strides of no whole rows, and bytesPerImage on 2D and 1D-array copies. Where Metal takes bytes a copy command cannot address (a depth or stencil offset not a multiple of 4, as a 16-bit depth at 2; a compressed offset or row stride of no whole blocks, as BC1 rows 20 apart, which Metal takes) it is Gap::BufferCopyAlignment. TextureBytes and FloatDepthUpload now name the blit copies too. Tests: pure checks of the regions (padded rows, one row, a 3D region's images at their own offsets, a 1D array slice, BC1 blocks) and of each refusal and gap; a device test copying into a mipmap level, out of an array slice and a 3D region at padded strides, into a 1D array slice and BC1 blocks, each result held to plain Metal's FNV-1a 64 (probe blit_copy_layouts.m, job m3-max-43555, plain and under the validation layer), and one copy into a Shared buffer alone at one submission, three barriers, no byte of the runtime's own. |
||
|
|
2105fa114e |
rt: heap textures, bound at the consumer's offsets in a heap's range of a Private block
A heap is a range of a Private block the consumer took at the heap's creation (HeapRange: block, offset, length), as the plan decided: one Private range per heap, resources at the offsets the guest's first-fit allocator picks. Device::heap_texture_size_and_align answers heapTextureSizeAndAlignWithDescriptor: with this device's image requirements (vkGetDeviceImageMemoryRequirements of the same create info new_texture uses), never Metal's: the size rounded up to and the alignment raised to bufferImageGranularity, so a buffer placed by the same answers never shares a granularity page with the image. Replay showed why: one vendor's image for a recorded heap texture is larger than the recording device's (7.47 MB in a 5.9 MB heap), so the guest places by this answer. Device::new_heap_texture binds the image at the heap offset: no allocation and no texture block, bytes not zeroed (as Metal's heap textures), aliasing allowed. A placement past the heap's end, an offset in the block off the image's alignment, or a heap range past its block is Refusal::HeapTexturePlace at creation; the image is never bound outside its heap. A Shared block, or an image that requires an allocation of its own or does not take the Private type, is Gap::HeapTexture (every optimal image measured takes the Private type). The image holds the block, so a released block returns to the pool only once its heap textures' images are gone. new_texture's checks move into Device::prepare, shared with the size query, and the image's create info into image_info. README: heap textures leave the not-built line; REFUSALS.md and the signatures table updated. Test: tests::heap::every_device_places_heap_textures_at_the_consumer_s_offsets (answer equals the image's own size rounded to granularity; first-fit placements allocate nothing and keep their own bytes; an alias; refusals for past the end, off the alignment, a heap past its block, and a Shared block). |
||
|
|
8fc4064da5 |
rt: Managed textures, an image and the consumer's named bytes, uploaded by a device copy
A Managed texture is a Private image plus a range the consumer names, on every device. Device::new_managed_texture takes a Shared buffer and, per level and slice, a BytesPlace (offset, bytes per row, bytes per image) laid out as the consumer chooses; rt never picks the layout. Places that a buffer-to-image copy cannot read in place (rows not whole texel blocks apart, images not whole rows apart, a first byte off the block's bytes or off 4 for depth/stencil, a level leaving the buffer, a wrong count, a buffer the host does not reach) are refused with Refusal::ManagedTextureBytes. Texture::upload_region(region, level, slice) records one vkCmdCopyBufferToImage from the named place into the image in the upload, ahead of every command buffer committed after the call on every queue, as did_modify_range copies a Managed buffer: no CPU copy, no staging. On such a texture replace_region writes the named bytes (Metal's CPU copy) and uploads them; get_bytes reads the named bytes with no submission. The texture copy's record() now takes a buffer and region, so staging and named copies share it. README, the API.md accepted difference (the copy reads the bytes when the GPU reaches it), REFUSALS.md and the signatures table updated. Test: tests::managed::every_device_copies_a_managed_texture_s_named_regions (whole-level uploads, a sub-region upload with an unmarked change outside it, get_bytes reading the named bytes, replace_region writing them, six refusals). |
||
|
|
60fe8aacaf |
rt: TextureCopyMismatch quotes Metal's messages as code
Rustdoc read "[destinationTexture sampleCount](1)" as a link and failed -D warnings (job m3-max-43474). |
||
|
|
f10ed213a0 |
rt: the blit device test holds each copy's expected bytes to plain Metal's
Each expected result's FNV-1a 64 is the hash probe blit_copy_layouts.m printed on an Apple M3 Max, macOS 27.0.1 (job m3-max-43464, at 31f5a93c4b), plain and under the validation layer alike: a level into an array slice, a cube face into a 3D slice, a 3D slice into 2D, slice to slice and BC1 blocks. The format-pair probe's sample-count case ran too (job m3-max-43465): Metal's validation stops four samples into one with "[sourceTexture sampleCount](4) must equal [destinationTexture sampleCount](1)", which Refusal::TextureCopyMismatch's basis now cites. |
||
|
|
42d274f91a |
rt: a blit texture copy takes one pixel format and one sample count, as Metal's validation does
Metal's validation layer stops copyFromTexture between any two pixel formats (Apple M3 Max, macOS 27.0.1, probe blit_copy_format_pairs.m, job m3-max-43433): RGBA8Unorm into sRGB, Uint, R32Uint and BGRA8Unorm, R32Uint into R32Float, Depth32Float into R32Float and BC1 into RG32Uint all fail with "[sourceTexture pixelFormat] must equal [destinationTexture pixelFormat]"; the same format is taken. So Refusal::TextureCopyMismatch is now every pair of two formats (basis metal-measured, was metal-takes), and the rules for copying between formats of one unit's bytes are gone: no alpha special case, no block, aspect or unit comparison. What stays a gap: a multisample texture, depth and stencil both, a 1D texture with another type, one subresource into itself, and, new, one pixel format held in two Vulkan formats by the textures' usages, whose texels may sit in two layouts. The device test's array is RGBA8Unorm now (the copy into it was RGBA8Unorm into R32Uint), and the slice-past-the-array check copies into a texture of its format: on 7f2a3c5cb1 it met the format check first on every device (legs m3-max-43406, 43407, 43408: RX 550, 780M HawkPoint, 3090, XTX, 2080, 780M Phoenix, lavapipe; every assertion before it passed, validation errors 0). The probes add the sample-count case and make the layout probe's array RGBA8Unorm; their runs follow. |
||
|
|
247ed69da0 |
rt: a blit encoder copies a region of one texture into another, one vkCmdCopyImage between two barriers
CommandBuffer::blit_command_encoder (blitCommandEncoder) and BlitCommandEncoder::copy_from_texture (copyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toTexture:destinationSlice: destinationLevel:destinationOrigin:, the only texture-to-texture selector the compute recordings use: 2,736 copies in one, 3 in the other, none multisample, compressed or within one texture). The copy is recorded at once into the current segment: no staging and no byte beyond the region. The first barrier moves each texture's level and slice from home to its transfer layout and carries the global barrier (every earlier write visible to every later command), so it pays what an encoder owed and the hazard sets start again; the second moves them home with the copy's writes visible to every later command. A command buffer of one copy is one submission and three barriers (the segment's end among them), and Metrics::bytes_copied does not move. Bytes move as they are between formats whose units have the same bytes; a compressed region is whole blocks or reaches the level's edge on both sides; a 3D image copies to and from a 2D slice. Refusal::TextureCopyMismatch for units of different bytes or different sample counts (Metal stores its GPU's own layout there); Gap::TextureCopy for what one vkCmdCopyImage in the floor does not make (multisample, depth and stencil both, depth or stencil with another format, compressed with another block extent, A8_UNORM with another format, 1D with another type, one level and slice into itself). The texture's region check is shared with replace_region and get_bytes (texture::place). Tests: tests::blit (the rules, no device) and on every device of the cfg's kind tests::blit::on_device::every_device_copies_between_textures (bytes of a level into an array slice of another format, a cube face into a 3D image, a 3D image into a 2D texture, one array slice into another, BC1 blocks where made; 1 submission, 3 barriers, 0 bytes copied, 1 pass for one copy; an owed barrier paid by the copy: 3 barriers, 4 without the fold). |
||
|
|
4732ce6cd7 |
rt: a buffer bound off its argument's alignment runs at the address rounded down to it
The binder (ComputeCommandEncoder::fill_parameters) pushes each bound buffer's address, its gpuAddress plus the bind offset, rounded down to a multiple of the alignment the kernel takes it to have (FieldValue::BufferAddress's mask, from RuntimeFact::AddressAlignment: the argument's air.arg_type_align_size, at most 16), for every slot. Refusal::MisalignedBuffer and the dispatch it skipped are deleted, so fill_parameters cannot fail. Why: Metal's API validation refuses such a bind offset, and without validation an Apple M3 Max (macOS 27.0.1) reaches each element at its address rounded down to the smaller of the element's alignment and 4, for loads, stores and pointers stored in a buffer alike. The probe that measured it is committed as crates/metal2vulkan-conformance/probes/misaligned_buffer_binds.m. The two agree at alignments 2 and 4 and for 8- and 16-byte arguments bound 1 to 3 bytes off a multiple of 4; an 8- or 16-byte argument bound at a multiple of 4 that is not a multiple of its alignment is reached at the rounded address where the M3 reaches it exactly there, a bind Metal's validation rejects. docs/API.md section 10 lists that as an accepted difference. Tests: rt's every_device_rounds_a_bound_address_down_to_its_alignment steps a buffer bound off each alignment (2, 4, 8 and 16; 15 binds) through the step kernel with the mask set, and checks the words stepped start at the rounded address; at the 8- and 16-byte binds 4, 8 or 12 bytes off, an unrounded bind would step other words on any device. an_argument_bound_off_its_alignment_runs_at_the_address_rounded_down binds vector_word_phases' vwp_words 1 and 3 bytes and vwp_vec16 4 and 12 bytes off their alignment and expects Metal's words for the rounded binds. They replace an_argument_bound_off_its_alignment_is_refused and a_misaligned_dispatch_refused_leaves_its_encoder_and_command_buffer_usable. Docs: REFUSALS.md and api_signatures.tsv regenerated (the variant's row goes), the rt README's compute encoders say what the binder pushes, the translator's RuntimeFact::AddressAlignment doc and the mechanism comment say the binder rounds. |
||
|
|
ee7c4a5173 |
rt: Managed buffers, a device copy where Shared memory is not device-local
newBufferWithLength:options: and newBufferWithBytes:length:options: with Managed storage over a range of a Shared block the consumer names: Device::new_managed_buffer(block, offset, length, copied). The device's memory-type query picks the form. Where the Shared type is device-local the buffer is its bytes, as a Shared buffer is, and didModifyRange does nothing. Elsewhere shaders reach a device copy in Private memory, as Metal keeps one on a Mac with a discrete GPU. The device copy is a place in a copy block: a Private block of the pool, or a dedicated one past BLOCK_LEN, in a set apart from the texture blocks, so no buffer lies beside an optimal image. Its first `copied` bytes are copied from the consumer's and the rest zero-filled, in the upload. Buffer::did_modify_range(start, length) marks a range changed: the upload, which goes ahead of every command buffer committed after the call on every queue, copies it from the consumer's bytes into the device copy as it is submitted, one vkCmdCopyBuffer per buffer with its ranges merged where they overlap or touch, after a counted barrier that puts the upload's earlier fills first. No CPU copy, no staging, nothing sized by the call. Each change is one of the upload's 4,096 calls, so changes past them submit it and wait. The copy reads the bytes when the GPU reaches it, which docs/API.md records as an accepted difference. A command buffer keeps each device copy it uses, and an upload each one it copies into, until it retires; the copy's place is freed then. An indirect dispatch reads its arguments from the device copy. Places take a core and give a block back once it empties where it is dedicated or another pooled block of the set is empty; Core::take_memory chooses a pooled or dedicated block for both take_block and the places. Refusals: ManagedBlockNotShared (a Private block) and ModifiedRange (a range past the buffer), both ours; docs/REFUSALS.md and the signatures table regenerated. Tests: changed ranges merge where they overlap or touch; on every device, in the form its query picks, the device copy holds the first bytes and zeros, a changed range reaches it at the next submission and an unmarked change does not, changes past the upload's calls submit it (none without a copy), both refusals, and every gauge zero after teardown. |
||
|
|
bf3d3c1ebb |
rt: GPU times placed by calibrated timestamps on one host clock, the anchor deleted
VK_EXT_calibrated_timestamps joins the floor's device extensions under that one name, and the floor requires the device to calibrate its own clock (VK_TIME_DOMAIN_DEVICE_EXT) with the host clock's domain, HOST_DOMAIN: CLOCK_MONOTONIC on Linux and other Unix systems, CLOCK_MONOTONIC_RAW on macOS, the performance counter on Windows. A device that does not is below the floor (floor::Missing::TimeDomain). host_time() reads that same clock, so a command buffer's GPU times and its kernel times are on one clock with no bridge; on macOS it counts while the system sleeps, where Metal's mach_absolute_time does not, which host_time()'s doc and the README state. The completion thread calibrates once as the device starts, and again at a completion once 100 ms (CALIBRATION_PERIOD) have passed since the last: one vkGetCalibratedTimestampsEXT call of the two domains, no deviation loop, never per command buffer. Each completed command buffer's two timestamps are placed by the last calibration, the tick difference taken signed within the valid bits. The anchor estimate, which took the host time a completion was seen as an end and moved later only by the least lateness of 64 passes, is deleted with its rule. Tests: the times test now holds each command buffer's GPU start and end between host_time() read before its commit and the host time its completed handler reads; a new test holds that the device calibrated at start, not while idle for 150 ms, and once at the first completion of a 32-buffer burst plus at most one per 100 ms it ran; a floor test names a missing host or device time domain. No conformance or harness check compares rt's GPU times with Metal's in absolute terms (conformance relates the old runtime's times; the harness compares durations and spans). |
||
|
|
f34c4a22d2 |
rt: every memory allocation counts against the device's maxMemoryAllocationCount, refused before the driver past it
rt never counted its vkAllocateMemory calls, so it could pass the device's
maxMemoryAllocationCount, which VUID-vkAllocateMemory-maxMemoryAllocationCount-04101
forbids: blocks, each texture's own memory, each staging buffer of replace_region
and get_bytes, the parameter ring's blocks and the zero source.
Every allocation now goes through memory::allocate, the one vkAllocateMemory call.
The live count is the blocks gauge, which already counted exactly these
allocations: allocate raises it only while it is below the device's count, else
returns Limit::MemoryAllocations { max } without calling the driver, and gives the
count back where the driver fails. Each site's own rise of the gauge after its
allocation is gone; the texture's and the staging buffer's failure paths after the
allocation now lower it as they free it.
Device::new is Device::open with the device's limits as queried; a test opens a
device with maxMemoryAllocationCount answered as 8. With the zero source and the
two ready blocks live, five 4x4 textures are made and the sixth is refused with the
typed limit, the gauges unchanged; a replace_region then is refused the same way
for its staging buffer; once a texture is dropped and its memory freed, a texture
is made again; every gauge reads zero after teardown.
The Err docs of Device::new, take_block, new_texture, replace_region (get_bytes
takes its list), set_bytes and the dispatches name the limit, and the runtime's
README states what counts and the limits measured: about 4.29 billion on RADV,
NVIDIA's Linux driver and ANV, 8,401,685 on Intel's Windows driver for the UHD
Graphics 630, 4,096 at Vulkan's minimum. docs/REFUSALS.md and the API signature
table are regenerated for the new Limit variant.
|
||
|
|
76ddb7ed45 |
matrix: a harness row over its budget is re-timed in its leg, three alternating pairs, judged by the median
The matrix at
|
||
|
|
f3c0008bac |
translator: a slot held to its narrow unit is reached from its address as it is
Under the identity domains a buffer argument whose alignment is below 4 (a uchar or ushort buffer, air.arg_type_align_size 1 or 2) took the word form: each access rounded its 64-bit address down to the word below it. Where every access of the slot is one narrow unit no wider than its alignment (an i8 access of a uchar buffer, an i16 one of a ushort buffer, on a profile with that width's storage access), the unit lies at its own address, so the slot now takes the direct form, as a slot held to 4 does. AccessPlan::reach records the granularity each slot's static-root accesses reach: a OneWord leaf of a narrow unit the profile has, its size; any other leaf, a copy's endpoint and an atomic, 4. A slot is reached from its address as it is where its alignment is at least that (capped at 4). address_alignment now answers 1 for an argument with no alignment or one of 1; the AddressAlignment fact is still stated only from 2 up. engine_narrow_direct checks buffer_end_byte_load, buffer_end_byte_store and buffer_end_half_load on every identity profile: no 64-bit and (the word form's rounding) where the profile has the unit, the word form where it does not, L3 passes, and the narrow access claims its unit's alignment. SEMANTICS_VERSION 2167. |
||
|
|
4232d4ed9b |
translator: every slot held to 4 is reached from its address as it is
Under the identity domains a device-address slot whose argument's alignment is at least 4 now takes the direct form whatever its window: each access is the slot's address plus its 32-bit byte offset from the bind address, sign-extended. The runtime makes no buffer longer than 2 GiB (MAX_BUFFER_LENGTH), so every byte of a buffer lies within 2^31 bytes of each bind address in it and the sign extension is exact. The window no longer picks the form, and the offset is taken from the bind address rather than the window's start, so the start's 64-bit add and 32-bit subtract go and the start need not be a multiple of 16 (the alignment proofs are from the bind address). DIRECT_WINDOW and direct_window are deleted, and so is the test of accesses past 2 GiB, which the 2 GiB cap puts outside every buffer; the interpreter test of accesses up to 2 GiB stays. Slots held to less than 4 keep the word form. The word-phase alignment test now expects one uvec4 in every slot held to 16, its Whole window included. SEMANTICS_VERSION 2166: identity-domain modules change. |
||
|
|
d48c2bfc78 |
rt: the longest buffer is 2 GiB
MAX_BUFFER_LENGTH drops from 4 GiB to 2 GiB, so every byte of a buffer lies within 2^31 bytes of each bind address in it, which lets the translator read a buffer argument's 32-bit offsets as signed for every slot. A buffer of 2 GiB is made; one a byte longer is refused with BufferTooLong. The consumer states Metal's maxBufferLength no larger than this. The device test is renamed to its 2 GiB length (a 2 GiB Private block, made where a block allows it, then 2 GiB and a byte refused, gauges zero at drop), and the interpreter test now loads and stores up to the last word below 2 GiB of the bind address and checks that each lands at its own word. REFUSALS.md and api_signatures.tsv regenerated. |
||
|
|
661b97c6e8 |
rt: a buffer longer than 4 GiB is refused
A shader reaches a buffer argument's bytes by 32-bit offsets from its bind address: every access form adds the u32 Metal offset to the slot's 64-bit address, so an access 4 GiB or more past the bind offset lands 4 GiB below, inside the buffer, with no fault. Device::new_buffer now refuses a length past MAX_BUFFER_LENGTH (4 GiB, one constant) with Refusal::BufferTooLong, before the block's range is looked at; heap buffers and a consumer's no-copy placements go through the same call. Metal answers nil past a device's maxBufferLength, which the consumer states no larger than this (the README's contract line). Tests: rt's every-device memory test refuses 4 GiB and a byte and u64::MAX on a pooled block, typed; a test of its own makes a buffer of exactly 4 GiB in a Private block of that length where the device has one (skipping visibly where its largest block or memory is smaller), refuses one a byte longer, and ends with every gauge at zero. The translator's interpreter test loads and stores up to the last word below 4 GiB through a Whole window under the identity domains, each landing at its own word. REFUSALS.md and api_signatures.tsv regenerated. |
||
|
|
0a82834fd2 |
rt: a kernel that does not observe its threadgroup partition runs its grid in fitted tiles, with no division
A kernel that does not observe its threadgroup partition reads only thread_position_in_grid and threads_per_grid, so only the set of positions matters. Its partial-threadgroups variant used to answer Metal's partial threadgroups in rt's tiles (256x1, or the grid's width rounded down to a power of two): each thread rebuilt its position by UDiv/UMod of its index by the threads left, and tiles fitted only by width launched 1.68x to 4x the grid's threads on 3D grids of 8x8 threadgroups. On the RX 550 such rows ran up to 3.67x the old runtime's time. On Device::from_queries' profile under the identity domains (ProfileFacts' new ObliviousEdge, Grid there, Partial on Device::new's, whose modules stay byte-equal), such a variant states RuntimeFact::GridTiles and runs its grid in tiles: - Under MultiRegion 1 its workgroup of GRID_TILE_THREADS (256) is one tile whose power-of-two sides the region's nominal size gives. Its position is ((base + WorkgroupId) << s) + (idx & m.x, (idx >> s.x) & m.y, idx >> (s.x + s.y)), with m = L - 1, s = bitCount(m), and idx = LocalInvocationIndex: masks and shifts of uniform values, no division, nothing new pushed. - Where the region is flagged NONUNIFORM, an invocation past the grid returns before the body. On the RX 550 the driver folds the flag into the exit's exec mask, so the three compares issue on every wave; the prologue to that exit is 10 VALU (7 for the position, 3 compares) and 18 SALU, where the old runtime's is 14 VALU. One pipeline and one form: no second pipeline for whole grids. - Under MultiRegion 0 (an indirect dispatch) it runs at its pipeline's size, as a plain kernel: the specialization folds the tile and the exit away. pipeline::grid_tile(threads) picks the tile from the grid's extents alone, with no device input: sides 2^a, 2^b, 2^c with a + b + c = 8, the first in one total order over those 45 tiles: 1. the fewest threads launched; 2. then the fewest tiles partly past the grid; 3. then the shallowest (z side 1 first); 4. then, where the grid has two rows or more, the height nearest 2 (|b - 1| smallest); 5. then the widest. A one-row grid takes 256x1 by its waste. Why this order: among tiles of equal waste the shape measured within 3% of the best everywhere is 128x2. On the UHD 630, the slowest GPU, 256x1 was first on every image row and 64x4 cost 5% to 10%; 128x2 stayed within 3% of 256x1 on every such row. On the 780M avoiding wide tiles helped (sampling 1.028 of the old runtime), and on the RX 550 having more than one row did (texture_write 1.024). The measured rows are its budgets: the RX 550's 21 rows of 3D grids of 8x8 threadgroups, waves, sample_down and sample_up, and the texture rows on the 780M, 3090 and RX 550. grid_tile's paths: - Where the powers of two that divide the extents reach 256 it takes the first tile that divides the grid. - Where one tile holds the grid it takes the first tile that holds it. - Otherwise it tries the 45 tiles in the order, computing each tile's counts as it goes. It passes over a depth 2^c whose bound, ceil(z / 2^c) * ceil(x*y / 2^(8 - c)), exceeds the fewest tiles found so far. 24x24x252 and 8x8x360 take 8x8x4 with no waste, 8x8x22 8x8x4 (1.09x), 304x304 16x16, 1024x1024 128x2, 5600x4200 32x8, a row 256x1 and a column 1x256. rt runs every direct dispatch of such a kernel on one VkPipeline (256x1x1, MultiRegion 1, made with the state), each region carrying its tile. The indirect pipeline is made at the state's first indirect dispatch, a first-use wait, and is counted in the pipeline gauge. The translator's binder plans a GridTiles kernel's Threads and Threadgroups dispatches the same way, and a ThreadgroupRange at its own size with MultiRegion 0. Tests: - lower::dispatch: the rule's table (whole and ragged square, wide, tall, deep, one-row and one-tile grids, each with its tile), and grid_tile against the order taken over every tile on 12,850 grids. - engine_identity: on the interpreter, ragged-in-3D, whole, z-ragged, row and column grids store each of Metal's positions once and nothing past the grid; an indirect dispatch runs at its own size; from_queries' module divides by no run-time value, Device::new's still does. - rt translate: the narrow threadgroup dispatch now shares the tiles' pipeline. The tiles test's indirect dispatch makes one more pipeline by one first-use wait, and every gauge, pipelines included, is zero at the device's drop. SEMANTICS_VERSION 2166; ARTIFACT_FORMAT_VERSION 533 (the new fact). |
||
|
|
eea1ef870e |
matrix: harness first uses compile cold on a fresh driver cache, and warm on a second run
The matrix at |
||
|
|
0f854aef98 |
translator: the direct form adds the sign-extended offset in 64-bit integers, with no pointer bitcast
A bounded slot's access was a byte array's element at its 32-bit offset, the element pointer bitcast to a pointer to the unit's one-member Block. The UHD 630's Windows driver (Vulkan 1.3.215) ends the process in that shape (exit 139, every kind), and passes the integer address with OpConvertUToPtr to the same Block. Each access is now the slot's address plus its offset sign-extended (OpSConvert), then one OpConvertUToPtr: the integer form of the access chain's signed index, which RADV lowers alike (iadd of an i2i64), with no zero-extended offset for GFX11 to split into a scalar base and a vector offset. The window is at most 2 GiB (direct_window, tested at 2^31 and one byte past), so the sign extension is exact. The byte array and its element place (device_byte_place, device_element) have no other user and are deleted, and the identity domains no longer need storageBuffer8BitAccess. |
||
|
|
643271b319 |
rt: refuse a dispatch whose buffer address breaks its argument's alignment
A kernel states RuntimeFact::AddressAlignment for each buffer argument with an alignment of 2
or more, and reaches one of 4 or more from its address as it is. Metal's API validation refuses
such a bind offset (measured on an Apple M3 Max by the conformance crate's
vector_access_placement probe: "must be a multiple of 4 but was set to 2" for a uint *
argument, "of 16 but was set to 4" for a float4 *). The pipeline records each such slot's mask
with its BufferAddress field, and fill_parameters tests address & mask where it forms the pushed
address, refusing the dispatch with Refusal::MisalignedBuffer { index, address, align } before
any work is recorded.
The test an_argument_bound_off_its_alignment_is_refused binds a float4 argument at offset 4
(refused, naming index 0, align 16 and the address) and 16 (runs), and a uint argument at 2
(refused, align 4) and 4 (runs). docs/REFUSALS.md is regenerated and the api_signatures table
gains the variant.
|
||
|
|
28f9b1db27 |
translator: identity slots aligned by their argument are reached from their address as it is
Under the identity domains every buffer slot access rounded its address down to a word
(64-bit add, and 3, sub, subb per access) and moved 8- and 16-byte values as words. On the
RX 550's one-wave dispatches that rounding is about 20 scalar instructions per wave.
Metal's API validation refuses a buffer bound at an offset that is not a multiple of its
argument type's alignment (air.arg_type_align_size): measured on an Apple M3 Max by the
conformance crate's vector_access_placement probe, "must be a multiple of 4 but was set to 2"
for a uint * argument (constant too, and a struct of two uints), "of 16 but was set to 8" (and
4) for a float4 *, "of 2 but was set to 1" for a ushort *; a uint * at 4, a ushort * at 2 and a
uchar * at 1 pass. So each plain buffer argument with an alignment of 2 or more states
RuntimeFact::AddressAlignment { slot, align } (at most 16), for a binder to refuse what Metal
refuses. Where that alignment is at least 4 and the slot's window starts at a multiple of 16,
the slot's address is a word memory's base as it is: each access is the 32-bit byte offset
m - start from address + start, through a PhysicalStorageBuffer byte array whose element
pointer is bitcast to a pointer to a one-member Block of the unit (NonWritable for an unwritten
slot's load), then member 0; nothing is rounded, and an 8- or 16-byte access at an offset proven
a multiple of its size is one uvec2 or uvec4. OpBitcast between PhysicalStorageBuffer pointers
is valid SPIR-V (SPV_KHR_physical_storage_buffer). Every other identity slot (no alignment, 1
or 2, a buffer-table element, an argument buffer) keeps the word below each access, as before.
Atomics take their word place the same way. The default policy, so Device::new and the old
runtime, is unchanged.
The identity domains now need storageBuffer8BitAccess (in the new runtime's floor).
SEMANTICS_VERSION and ARTIFACT_FORMAT_VERSION are bumped for the new output and fact.
Measured before this change on the scratch forms (the same SPIR-V shape, the byte view at the
pushed address, no rounding, no anchor):
- the constant-reads probe's 13 columns, against the identity form before it (geomean / worst
column): RX 7900 XTX -4.3% / +0.5%, RX 550 -6.6% / +0.1%, RTX 3090 -54.2% / 0.0%. The
64-bit add without rounding failed the XTX by 8.9%;
- short-wave rows on the RX 550 (ladder job 42427, emulated module, against the old runtime):
k130 2.567x -> 2.295x, k106 1.656x -> 1.537x, k109 1.377x -> 1.233x, k171 1.342x -> 1.315x,
waves 2.461x -> 2.377x.
|
||
|
|
fe9dd3d6da |
matrix: a listed row's ceiling has parity's 3% allowance; a row the old runtime failed is named and not compared
Two follow-ups to the harness budget.
The allowance. A ceiling is the row's ratio when it was listed, so run-to-run spread put rows just
past it: over the runs one commit before the seeds (08ff6ed59c), five rows came 0.1 to 3% past
their ceilings. A listed row now fails its leg only past its ceiling times HARNESS_BUDGET, the same
3% allowance parity gets. The ceilings stay the measured ratios and only go down.
Old-runtime failures. The old runtime is frozen and its regressions are parked, but a workload it
failed (on the UHD 630 at
|
||
|
|
37f0bf51f8 |
rt encoder arms: textures, sampler states and constexpr samplers by pushed index
ComputeCommandEncoder::set_texture (128 slots, Refusal::TextureArgumentIndex past them) and set_sampler_state (16 slots, Refusal::SamplerArgumentIndex) bind as Metal's calls do, and use_resource takes a texture as it takes a buffer. A dispatch pushes, for each texture and sampler slot its kernel reads, the bound object's gpuResourceID (0 for none), whose index names its elements of set 1; for a texture slot an integer write saturates through, the channel widths of the bound texture's format (metal::format::integer_channels_word, now public); and for each constexpr sampler, the index the consumer gave it. Nothing is written into set 1 at bind or dispatch time, and every texture stays in its home layout. A texture's sample and read are reads in the hazard sets, a texture one resource, with a hazard id from core's ids. Each command buffer binds set 1 (vkCmdBindDescriptorSets, firstSet 1) once, before its first pipeline; without it the lavapipe run reported VUID-vkCmdDispatch-None-08600. The command buffer keeps each texture and sampler state an encoder binds or declares, in command.rs's Gpu next to its blocks and pipelines, dropped with them at retire, so their elements stay theirs while work may read them. Device::new_compute_pipeline_state takes sampler_ids: the samplers the kernel numbers, in Metal's order (NumberedSampler: each constexpr sampler, then one for a texture read and one for a texture write), answered with an index each from the consumer's sampler grants (Refusal::SamplerIds for another count). A constexpr sampler takes, before the call returns, the device sampler of each use the kernel has (CombinedSampler::constexpr_sampler, canonical, shared by create info with sampler states') at its index of the three sampler arrays; states that number one constexpr sampler at one index share it, another sampler there is Refusal::IndexInUse, and the last of them writes the defaults back and frees the index. Set 1's layout is checked against the translator's (IdentityArray bindings). A kernel whose texture or sampler the translator would take from the bound object rather than its resource ID stays Gap::KernelInput. The harness grants its own texture and sampler indices on the new runtime and numbers constexpr samplers by their words, so constexpr_sampling runs on it. README: the encoder's texture and sampler arms, the numbering paragraph, the KernelInput gap. REFUSALS.md regenerated; api_signatures and api_surface carry integer_channels_word and the new refusals. Verified: - m3-max-42749 (msi), this tree: clippy of metal2vulkan-rt plain, --cfg m2v_gpu and --cfg m2v_cpu_icd green; rustdoc -D warnings green; nextest 37 of 37; the device tests on lavapipe under the validation layer 79 of 79, 0 validation errors (tests::sampling: sample_down through a runtime sampler, then sample_up through a constexpr sampler, against the linear filter's answers; the constexpr index shared, refused to a sampler state and freed with the last state). - The same change on the sampler landing before development's region commits (tree ed71d2de2e): m3-max-42714 (780M, radv) and m3-max-42716 (3090), its archive under the validation layer, 76 of 76 each (the three source-reading tests skipped off the building machine), 0 validation errors, every gauge zero at drop; m3-max-42735 (UHD 630, Windows), its cross-built archive, 79 of 79, every gauge zero at drop. - m3-max-42638 (msi), tree ed71d2de2e: clippy of metal2vulkan-harness plain and --cfg m2v_gpu green; the api_signatures and api_surface tests green. |
||
|
|
bbf8fbb29a |
matrix: the harness budget, new over old per row on each GPU at most 1.03, with the rows over it held to ceilings
results.harness_budget compares the two runtimes within one leg. For every harness row timed on both runtimes in the leg (harness-new/<row> and harness-old/<row>), the new runtime's time over the old's is at most HARNESS_BUDGET, 1.03. HARNESS_CEILINGS lists the rows over it, per GPU, each with its ratio as its ceiling. A listed row past its ceiling fails its leg, and a listed row within it is named on the leg's line (with the parked items), so an open row can neither hide nor grow. A fix lowers its row's ceiling, and a row within 1.03 is named as leaving the list. This rule is separate from TIME_OUTLIER and PARKED_RECORDS, which judge a time against its base commit's across GPUs and park the old runtime's outliers. The budget reads the old runtime's times as its reference. It ends with the cutover, with the old runtime. A time recorded more than once has no single value to judge: twice in one suite, where parse_suite keeps the first and now lists the key in `duplicated`, or once each by two suites, where leg_records keeps the later. Such a row is a problem of the budget's own, named and not compared, beside the record problem the leg already has. The matrix's harness suite now runs one job per GPU. Each job holds its node alone (--exclusive) and times that one GPU. Before, one exclusive job per node timed the node's GPUs in turn. docs/VALIDATION.md says both. Ceilings: one run per GPU of the harness's full set, both runtimes, as the matrix runs it, two passes, each run an exclusive job timing one GPU, at development |
||
|
|
66a5a2c9ab |
translator: on from_queries' profile a kernel reads its region's base on every dispatch and its size by MultiRegion
Under the identity domains a kernel that reads a grid builtin decoded its dispatch region on every dispatch: the base and Metal's threadgroup size were selected by a test of the region's grid (region[1].xyz != 0), and the size was unpacked from region[0].w. On the RX 550 that decode is 19 scalar instructions per wave on k130 against the old runtime's 1, and making the region constants saved 5.65 ms of k130's 2.57. A new profile fact, IdentityRegion, gives the form. Device::new keeps Grid, today's form, so its modules are byte-equal. Device::from_queries takes Sized: - the base is region[0].xyz on every dispatch: 0 where the dispatch is not split, and for an indirect one, which pushes a zero region; - the kernel declares MultiRegion (default 0): at 0, L is the pipeline's WorkgroupSize, a constant the driver folds; at 1, L is the region's packed nominal size. This is the form for a region whose workgroup size is not Metal's, as the binder's edge regions are; - the grid builtins' single-region form for an indirect dispatch is still chosen by the region's grid. The binder is public and runs on any device's plan, a from_queries one included, and it sets MultiRegion 1 on every region whose workgroup size or base is not the dispatch's. So the constant stays rather than the decoded path being dropped. The new runtime pushes the pipeline's own size on every launch, so it leaves MultiRegion at its default: its constant mapping skips the key. SEMANTICS_VERSION 2163. Docs: API.md (the identity domains' region) and the runtime README. Test: engine_identity's from_queries_reads_every_regions_base_and_its_size_by_multi_region. On from_queries' profile the grid kernel declares MultiRegion with default 0. On the CPU interpreter, the whole, split (base [0,1,0]) and indirect dispatches at 0 store Metal's answers, and so does a ragged 7x6 grid split as the binder splits it: a region of 4x2 at 0, and an edge of 3x2 at base [1,0,0] at 1. |
||
|
|
4f8a7db4c8 |
rt sampler states: device samplers shared by create info at the consumer's index
Device::new_sampler_state is newSamplerStateWithDescriptor: at an index of a live Sampler grant. Each state takes the device sampler of each use it can be used in, from the translator's metal::sampler::vk_sampler with its create info chained by ash_interop::sampler_create_info: the plain one always, the comparison one where its compare function is not Never, and the integer-texture one (nearest, the integer border colour). It writes them into set 1's three sampler arrays at its index before the call returns; the comparison array keeps its default where the state has no compare function. Device samplers are shared by create info across uses and states (SamplerTable), and a border colour no address mode reads is no part of a create info (canonical), so a state whose integer-texture use reads as a plain sampler shares it: a nearest state takes one sampler, and a linear compare state two more beside it. The table holds at most maxSamplerAllocationCount minus the arrays' two defaults; past it a state is Limit::DeviceSamplers. Gauges::samplers and Gauges::device_samplers count them. When the last handle goes, the state's elements read the defaults again, its index is free, and each device sampler no other state holds goes to the reaper (Free::Sampler). A cubic filter is Gap::CubicSampler. samplerAnisotropy joins the floor's features (every lab device and capture has it). SamplerState::gpu_resource_id is the index and the translator's SamplerWord. IndexInUse and IndicesInUse now name sampler states too. README: a "Sampler states" section and the floor's feature row. REFUSALS.md regenerated; api_signatures blessed. Verified: - m3-max-42632 (msi), this tree: clippy of metal2vulkan-rt plain, --cfg m2v_gpu and --cfg m2v_cpu_icd green; rustdoc -D warnings green; nextest 37 of 37; the device tests on lavapipe under the validation layer 78 of 78, 0 validation errors. - m3-max-42611 (780M, radv) and m3-max-42612 (3090), the same sampler change on the textures tip before the rebase onto development, its archive under the validation layer: 75 of 75 each, 0 validation errors; every gauge zero at drop. - `python3 scripts/api-signatures/signatures.py --check` and `python3 scripts/refusal-surface/refusal_surface.py --check` clean. |
||
|
|
21a01acb33 |
rt textures: device images at the consumer's index, their bytes in and out
Device::new_texture is newTextureWithDescriptor: at an index of a live grant: an optimal image in device-local memory of its own (the first memoryTypeBits type that is DEVICE_LOCAL), usage the descriptor's plus transfer source and destination, so any texture can be replaced, read back or blitted as in Metal. Its home layout is GENERAL where it has a storage element, SHADER_READ_ONLY_OPTIMAL for shader read alone, the attachment layout for render target alone, GENERAL otherwise; the first move from UNDEFINED goes through core's Work::upload, ahead of every command buffer committed after the call. The sampled view's components are Metal's swizzle composed over the format mapping; a depth or stencil format's view takes depth, else stencil. The storage element exists where the format's emulation is Direct and the device stores it through a storage image without a format. Size, layer and sample limits come from vkGetPhysicalDeviceImageFormatProperties2. Admitted emulations: Direct, SwizzledView, AlphaInRed, RotatedView, XChannel, DepthInCombined, StencilInCombined; any other format is Gap::TextureFormat. Texture::gpu_resource_id is the index and the translator's TextureWord, so the guest computes it. replace_region and get_bytes copy through a staging buffer per call (Shared memory type, counted in Metrics::bytes_copied); get_bytes submits at once (Work::flush, carried in the commit before this one and landing with it) and waits (Done::wait). get_bytes's read of the staging buffer is in readback.rs with its bound, under the readback rule test. An upload into a 32-bit float depth is Gap::FloatDepthUpload (the planner's ruling): Metal keeps any float there, Vulkan copies no depth outside [0, 1] without VK_EXT_depth_range_unrestricted, which the Intel captures lack so the floor cannot take it, and no recorded stream uploads one. get_bytes still reads such a texture. The index frees at the last Texture handle's drop (its elements written null, the index vacated), and grants now track occupancy: Refusal::IndexInUse and Refusal::IndicesInUse. The Vulkan objects are an Image the uploads hold, freed by the reaper (Free::Texture) once the last upload that moves or copies it retires. Gauges::textures and Gauges::descriptor_slots count them, back to zero at drop. Refusals carry Basis lines; docs/REFUSALS.md regenerated; api_signatures blessed. The README's "Textures" section and its known gaps say the contract. Verified: - m3-max-42550 (msi), this tree: clippy of metal2vulkan-rt plain, --cfg m2v_gpu and --cfg m2v_cpu_icd green; rustdoc -D warnings green; nextest 36 of 36; the device tests on lavapipe under the validation layer 76 of 76, 0 validation errors. - m3-max-42601 (780M, radv) and m3-max-42602 (3090), this tree's archive under the validation layer: 73 of 73 each (the three source-reading tests skipped off the building machine), 0 validation errors; every gauge zero at drop. - Not yet run on Intel: the UHD 630 (Windows) build, m3-max-42551, is running without the GPU lease; its run follows. - `python3 scripts/api-signatures/signatures.py --check` and `python3 scripts/refusal-surface/refusal_surface.py --check` clean. |
||
|
|
b78f8163f9 |
translator: a half fma is the device's 16-bit Fma on from_queries' profile under the 16-bit float controls
On every device the new runtime makes, Metal's fma on half was the device's float Fma on the operands held in float, rounded to half by the controlled conversion pair (two OpFConvert decorated NoContraction). On a chain of 1,024 dependent half4 fmas over 2^19 threads, the device's 16-bit Fma took 437.5 against 1,818-1,832 us on an RTX 3090, 284 against 377-389 us on an RX 7900 XTX, and 22.0 against 114.2 ms on a UHD 630 (probe jobs 42069, 42068, 42070). The translator: a new profile fact, HalfFma. Device::new keeps Measured, the routes it took (the measured 16-bit Fma on MoltenVK, OpFmaKHR on 16 bits under the controls where shaderFmaFloat16 is enabled, else the float Fma rounded), which ROWS renders as nothing, so every Device::new fingerprint and module is unchanged. Device::from_queries takes Native: a half fma is fma::Route::F16Native, the device's GLSL.std.450 Fma on 16-bit floats, wherever the profile computes half under the 16-bit float controls (shaderFloat16, with 16-bit RoundingModeRTE, DenormPreserve and SignedZeroInfNanPreserve); spirv::half_hold then removes its exact conversions, so the kernel carries no NoContraction pair for it. Elsewhere today's float Fma rounded to half stays: on the RX 550, without shaderFloat16, and on lavapipe, which does not preserve 16-bit denormals. OpFmaKHR is not taken on that profile: shaderFmaFloat16 is not one of the queries that may choose a second form, and the new runtime does not enable VK_KHR_shader_fma. The note is PrecisionNote::NativeFma, the float fma's. It is per operation, not per width: it already covers both formats with a bound for each, and Vulkan gives the 16-bit Fma the precision of the 32-bit one (a multiply and an add, each rounded), so its float bound holds in half. A half twin would add a Degradation kind to the frozen old runtime and a row to the conformance suite's native notes for the same statement. Every half fma on from_queries' profile records it, on either route, and none requires VkProperty::MetalHalfFma. RADV (Mesa 26.2.6, RX 7900 XTX) does not round the 16-bit Fma once: 1,622,016 lanes of that chain ended up to 9 half ulp from Metal's (42068). NVIDIA's driver on an RTX 3090 and Intel's Windows driver on a UHD 630 matched Metal in every lane (42069, 42070). The new runtime's README lists it among the known gaps of pipeline states. Tests: engine_arith's a_half_fused_multiply_add_is_the_devices_16_bit_fma_on_from_queries compiles a half fma through Device::from_queries on five captures: on RADV's, ANV's and NVIDIA's it is one 16-bit Fma with no NoContraction decoration, no MetalHalfFma requirement and NativeFma recorded, rounding once on the interpreter; on lavapipe's and vk12-floor's it is the float Fma rounded, NativeFma recorded, rounding twice. The profile facts test covers HalfFma and its fingerprint; the fused emit test takes the new route. docs/API.md's native-fma entry and PrecisionNote::NativeFma's doc state the 16-bit form and its bound. |
||
|
|
1b97a620c8 |
rt: set 1 and index grants
Every pipeline of the new runtime takes set 1, one descriptor set the device makes at creation: 65,536 sampled textures (binding 0), 4,096 storage-capable textures (binding 1) and 4,000 samplers of each use, plain, depth comparison and integer texture (bindings 2, 3 and 4), each partially bound, updated after bind and while unused elements are pending, seen by every stage. Set 0 is empty. The pipeline layout is made once from it, in Device::new, and every pipeline and dispatch uses that layout. Every element no object owns is defined: a texture element is a null descriptor (VK_EXT_robustness2 nullDescriptor, which joins the floor; the robust buffer and image access beside it stay off), and a sampler element is its array's default sampler, nearest and clamped to the edge, the comparison array's comparing with NEVER. The device writes every element at creation and holds the two default VkSamplers (Gauges::device_samplers). The translator is told of VK_EXT_robustness2, so its profile has nullDescriptor. Device::grant_indices(class, first, count) grants the consumer the range it names, so the IDs it picks reproduce in replay: storage-capable textures 1 to 4,095, other textures 4,096 to 65,535, samplers 1 to 3,999, 0 nil and never granted (IndexClass, IndexGrant). Limit::IndexRange, Refusal::IndicesGranted and Refusal::IndicesNotGranted, with Basis lines; docs/REFUSALS.md regenerated. The floor's sampler limits are now three arrays' (12,000 samplers per stage and set, 81,632 update-after-bind descriptors in all pools). README: "Set 1 and index grants", and the floor's extension, feature and limit rows. Device::new output is unchanged: no translator source changes. Verified: - m3-max-42273 (msi): clippy -p metal2vulkan-rt --all-targets --all-features, plain, --cfg m2v_gpu and --cfg m2v_cpu_icd, green; rustdoc -D warnings green; rt tests 33/33; every device test on lavapipe with the Khronos validation layer, 0 validation errors; making a second set 1 takes 106 ms there. refusal_surface.py --check clean. - m3-max-42305 (Radeon 780M, RADV, gem10) and m3-max-42306 (RTX 3090, um870), validation layer on: every device test passes with 0 validation errors, gauges zero at drop; a second set 1 takes 15.1 ms on the 780M and 4.6 ms on the 3090. The three tests that read the source tree fail on those nodes only because the carried archive names msi's paths; they pass on msi. |
||
|
|
100b92d608 |
identity: constexpr samplers by a pushed index into set 1's sampler arrays
Under the identity domains a texture slot sampled through a constexpr sampler takes the sampler
from the set-1 sampler array of its use (binding 2 plain, 3 compare, 4 integer texture) at an
index the consumer pushes: PushField::ConstexprSampler(CombinedSampler), one u32. The consumer
makes the device sampler that the new public CombinedSampler::constexpr_sampler(profile)
describes, places it at an index of that array, and pushes the index. The index is a push word,
not a specialization constant: an index allocated at run time would key the driver's and the
pipeline cache's entries. Link's immutable sampler for the default domains now goes through the
same method, with the same result.
Under the identity domains every device sampler is normalized: a constexpr pixel sampler's
coordinate is scaled in the shader, as a runtime sampler's is, never handed to the device's
unnormalized sampler. A linear sample or gather through it records
PrecisionNote::PixelSamplerScaling, which is static. No address-mode-map variant applies there
(no binder picks a variant), so the sampler keeps its own modes and the slot records no
ConstexprSampled fact.
Still refused as Unsupported{IdentityDomains}: an argument buffer's sampler, arrays of samplers,
bicubic and anisotropy emulation. The refusal test now uses engine/a2_bicubic_weights.
Translation output changes only under the identity domains (Device::from_queries). Device::new
output is unchanged: golden_hashes_match_the_table passes at this tip (job m3-max-42192), with no
"changed under an unchanged key" and no "profile changed:" line.
Public surface: PushField::ConstexprSampler and CombinedSampler::constexpr_sampler are added
(api_signatures blessed); nothing is removed or changed.
SEMANTICS_VERSION 2162: identity-domain modules of constexpr-sampling kernels change.
ARTIFACT_FORMAT_VERSION 531: PushField gains a variant.
Verified:
- m3-max-42097 (msi), this change on
|