Runtime: the compute encoder's imageblock size; a kernel's explicit imageblock is dispatched
ComputeCommandEncoder::set_imageblock_size is Metal's setImageblockWidth:height:. The encoder keeps the size, 1 by 1 until a call sets one (Metal's size for an encoder that never sets one), and a dispatch of a kernel that reaches an explicit imageblock runs at it: the translator's SpecKey::ImageblockWidth and ImageblockHeight are specialized per VkPipeline (Constant::Imageblock), as a threadgroup memory length is. The dispatch's refusal (Gap::KernelInput naming RuntimeFact::ImageblockSize) goes. - encoder: Sizes carries the encoder's threadgroup memory lengths and imageblock size to decide() and threadgroup_memory(); Lengths holds the imageblock size for a kernel that reaches one (0 by 0 otherwise, so other kernels keep one pipeline whatever the encoder set), and its cells (w x h x cell bytes, rounded to 16) count in Limit::ThreadgroupMemory with the lengths. - pipeline: Variant keeps its Lengths (the key is ([u32; 3], &Lengths, bool)); an imageblock kernel has no main pipeline, as a kernel that takes a threadgroup memory length has none; keeps_plain counts the imageblock as encoder-sized memory. - Refusal::ImageblockSize: a side that is not a power of two (0 included) or more than 1024 cells, whatever the state's maxTotalThreadsPerThreadgroup, as Metal's validation layer stops them at the call (probe crates/metal2vulkan-conformance/probes/imageblock_size_rules.m, job m3-max-70002, M3 Max, macOS 27.0.1). - prepare_dispatch and dispatch_variant take the imageblock size as a fourth argument ([1, 1] where the encoder set none); a size the encoder would refuse makes nothing and answers None. The consumer's two call sites take the argument (planner, through main). - Validation: the engine candidate sets a case's explicit imageblock size and passes it to prepare_dispatch; KernelImageblock narrows to a tile pass's implicit imageblock (the runtime builds no tile function). No executor ABI bump: no recorded row ran an explicit imageblock case, which the requirement refused. The replay player plays setImageblockWidth:height:, and the pre-pass passes each dispatch's size. Form (step 0, jobs m3-max-69983, m3-max-69984): Metal compiles nothing for a new size (a new size's first dispatch 202-312 us median against 205-228 us second use and 222 us at the control size, a state's make 15-20 ms); a pushed size would size the Workgroup arena at Metal's 1024 cells on every dispatch. A new size here is one VkPipeline make at its first dispatch, a known gap. Tests: tests::imageblock (replacing tests::kernel_input): a dispatch never sized runs 1 by 1; one encoder runs 4 by 2 and 4 by 4, each read back, two first-use variant waits and no main pipeline; the setter's refusals.
This commit is contained in:
1 parent
f016ff5098
commit
afbcfec9a7
30 files changed
+677
-269
No files matched your search
@@ -10,12 +10,12 @@ Every public item of the macOS 27.2 SDK (Xcode 27.2, 27B52)'s Metal headers, by
|
||||
|
||||
| Status | Items | Of which deprecated |
|
||||
|---|---|---|
|
||||
| implemented | 636 | 29 |
|
||||
| missing | 1075 | 34 |
|
||||
| implemented | 637 | 29 |
|
||||
| missing | 1074 | 34 |
|
||||
| out of scope | 424 | 5 |
|
||||
| all | 2135 | 68 |
|
||||
|
||||
Implemented by the runtime: 279; by the translator's values: 357. Missing by size: S 182, M 204, L 313, XL 376.
|
||||
Implemented by the runtime: 280; by the translator's values: 357. Missing by size: S 182, M 203, L 313, XL 376.
|
||||
|
||||
## Missing, in build order
|
||||
|
||||
@@ -33,7 +33,7 @@ Cheap items a plain app calls first, then medium pieces by how often a plain app
|
||||
| a buffer made with bytes | S | 1 | `MTLDevice.newBufferWithBytes:length:options:` |
|
||||
| pipeline creation forms (from a function, with a completion handler) | S | 6 | `MTLDevice.newRenderPipelineStateWithDescriptor:options:completionHandler:`, `MTLDevice.newComputePipelineStateWithFunction:error:`, `MTLDevice.newComputePipelineStateWithFunction:options:reflection:error:`, ... |
|
||||
| render pass descriptor fields | S/M/L | 8 | `MTLRenderPassAttachmentDescriptor.depthPlane`, `MTLRenderPassAttachmentDescriptor.storeActionOptions`, `MTLRenderPassDescriptor.imageblockSampleLength`, ... |
|
||||
| encoder calls (stride setters, indirect draws, store action options, a render encoder's heap uses) | S/M/L | 24 | `MTLBlitCommandEncoder.synchronizeTexture:slice:level:`, `MTLBlitCommandEncoder.copyFromTexture:sourceSlice:sourceLevel:toTexture:destinationSlice:destinationLevel:sliceCount:levelCount:`, `MTLBlitCommandEncoder.copyFromTexture:toTexture:`, ... |
|
||||
| encoder calls (stride setters, indirect draws, store action options, a render encoder's heap uses) | S/M/L | 23 | `MTLBlitCommandEncoder.synchronizeTexture:slice:level:`, `MTLBlitCommandEncoder.copyFromTexture:sourceSlice:sourceLevel:toTexture:destinationSlice:destinationLevel:sliceCount:levelCount:`, `MTLBlitCommandEncoder.copyFromTexture:toTexture:`, ... |
|
||||
| `textureBarrier` and queue-stage barriers | S/M | 2 | `MTLCommandEncoder.barrierAfterQueueStages:beforeStages:`, `MTLRenderCommandEncoder.textureBarrier` |
|
||||
| a pipeline state's reflection after creation | S | 2 | `MTLComputePipelineState.reflection`, `MTLRenderPipelineState.reflection` |
|
||||
| function handles by name, and a handle's type and ID | S | 6 | `MTLComputePipelineState.functionHandleWithName:`, `MTLFunctionHandle.functionType`, `MTLFunctionHandle.name`, ... |
|
||||
@@ -1243,7 +1243,7 @@ Cheap items a plain app calls first, then medium pieces by how often a plain app
|
||||
| `MTLComputeCommandEncoder.setSamplerState:lodMinClamp:lodMaxClamp:atIndex:` | method | implemented | `ComputeCommandEncoder::set_sampler_state` (runtime) |
|
||||
| `MTLComputeCommandEncoder.setSamplerStates:lodMinClamps:lodMaxClamps:withRange:` | method | implemented | `ComputeCommandEncoder::set_sampler_state_with_lod_clamps` (runtime): a loop of it |
|
||||
| `MTLComputeCommandEncoder.setThreadgroupMemoryLength:atIndex:` | method | implemented | `ComputeCommandEncoder::set_threadgroup_memory_length` (runtime) |
|
||||
| `MTLComputeCommandEncoder.setImageblockWidth:height:` | method | missing | M: explicit imageblocks; a kernel that reaches one is made and its dispatch refused (`Gap::KernelInput`) |
|
||||
| `MTLComputeCommandEncoder.setImageblockWidth:height:` | method | implemented | `ComputeCommandEncoder::set_imageblock_size` (runtime): a specialization: a new size makes a pipeline at its first dispatch |
|
||||
| `MTLComputeCommandEncoder.setStageInRegion:` | method | implemented | `ComputeCommandEncoder::set_stage_in_region` (runtime) |
|
||||
| `MTLComputeCommandEncoder.setStageInRegionWithIndirectBuffer:indirectBufferOffset:` | method | implemented | `ComputeCommandEncoder::set_stage_in_region_with_indirect_buffer` (runtime): always refused: a stage-in region the GPU reads is not built (`Gap::StageIn`) |
|
||||
| `MTLComputeCommandEncoder.dispatchThreadgroups:threadsPerThreadgroup:` | method | implemented | `ComputeCommandEncoder::dispatch_threadgroups` (runtime) |
|
||||
|
||||
+4
-2
@@ -31,7 +31,7 @@ Columns:
|
||||
| Rate maps the compile layer does not compile | 5 | 5 | 0 | 0 | 4 | 1 | 0 |
|
||||
| The translation deadline | 1 | 1 | 0 | 0 | 0 | 1 | 0 |
|
||||
| Devices below the runtime's floor | 8 | 8 | 0 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Refusal` | 84 | 84 | 0 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Refusal` | 85 | 85 | 0 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Limit` | 17 | 17 | 0 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Gap` | 32 | 32 | 0 | 0 | 0 | 0 | 0 |
|
||||
|
||||
@@ -44,7 +44,7 @@ Columns:
|
||||
| Rate maps the compile layer does not compile | 0 | 0 | 0 | 0 | 5 | 0 | 0 | 0 |
|
||||
| The translation deadline | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
|
||||
| Devices below the runtime's floor | 0 | 0 | 0 | 8 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Refusal` | 22 | 25 | 0 | 0 | 37 | 0 | 0 | 0 |
|
||||
| The runtime's `Refusal` | 23 | 25 | 0 | 0 | 37 | 0 | 0 | 0 |
|
||||
| The runtime's `Limit` | 0 | 0 | 0 | 13 | 4 | 0 | 0 | 0 |
|
||||
| The runtime's `Gap` | 0 | 0 | 0 | 3 | 29 | 0 | 0 | 0 |
|
||||
|
||||
@@ -256,6 +256,7 @@ Columns:
|
||||
| `SamplerIds` | A consumer's answer to `Device::new_compute_pipeline_state`'s numbered samplers with another count of indices | every device (a public call's own check of its arguments) | `ours`: each numbered sampler takes one index | 1: `crates/metal2vulkan-runtime/src/pipeline.rs (number_samplers)` | `-` |
|
||||
| `NoBufferAtIndex` | `setBufferOffset` at an index where no buffer is bound, or a draw whose vertex descriptor reads a vertex buffer index where none is bound | every device (a public call's own check of its arguments) | `ours`: there is no buffer whose offset to change, and none whose vertices the draw reads; Metal's validation stops such a draw | 3: `crates/metal2vulkan-runtime/src/encoder.rs (set_buffer_offset)`, `crates/metal2vulkan-runtime/src/render_encoder.rs (find)` (+1) | `-` |
|
||||
| `ThreadgroupSize` | A threadgroup of no threads, or of more than Metal's `maxTotalThreadsPerThreadgroup` for the kernel (a required size's threads, where the... | every device (a public call's own check of its arguments) | `metal-documented`: a threadgroup's threads total at most the state's `maxTotalThreadsPerThreadgroup` | 2: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch)`, `crates/metal2vulkan-runtime/src/encoder.rs (size_checked)` | `-` |
|
||||
| `ImageblockSize` | An imageblock size (`ComputeCommandEncoder::set_imageblock_size`) whose width or height is not a power of two, 0 included, or whose cells are more... | every device (a public call's own check of its arguments) | `metal-measured`: an Apple M3 Max, macOS 27.0.1, probe `imageblock_size_rules.m` in the conformance crate, job m3-max-70002: Metal's validation layer stops each at the call, `width(24) must be a power of 2.`, `height(12) must be a power of 2.`, `width(0) must be a power of 2.` and `width(64)*height(32) must be less than or equal to 1024`; it takes 16 by 16, 1024 by 1, 1 by 1024, 16 by 16 for a state of 64 threads, and a size set before the pipeline state | 1: `crates/metal2vulkan-runtime/src/encoder.rs (imageblock_checked)` | `-` |
|
||||
| `IndirectOffset` | An indirect dispatch's or draw's argument offset that is not a multiple of 4, which Metal's `indirectBufferOffset` must be... | every device (a public call's own check of its arguments) | `metal-documented`: MTLComputeCommandEncoder.h for `dispatchThreadgroupsWithIndirectBuffer:indirectBufferOffset:threadsPerThreadgroup:`, and MTLRenderCommandEncoder.h for the indirect `drawPrimitives` and `drawIndexedPrimitives`: "indirectBufferOffset must be a multiple of 4"; Apple's page for the indirect `drawPatches` sends its offset to the feature set tables, whose minimum constant buffer offset alignment is 4 bytes | 2: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch_threadgroups_with_indirect_buffer)`, `crates/metal2vulkan-runtime/src/render_encoder.rs (indirect)` | `-` |
|
||||
| `IndirectArgumentsPastEnd` | An indirect dispatch's or draw's arguments, at an offset that is a multiple of 4, that run past the buffer's end | every device (a public call's own check of its arguments) | `ours`: `vkCmdDispatchIndirect`, `vkCmdDrawIndirect` and `vkCmdDrawIndexedIndirect` read their arguments inside the buffer, `VUID-vkCmdDispatchIndirect-offset-00407`, `VUID-vkCmdDrawIndirect-drawCount-00487` and `VUID-vkCmdDrawIndexedIndirect-drawCount-00539` | 2: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch_threadgroups_with_indirect_buffer)`, `crates/metal2vulkan-runtime/src/render_encoder.rs (indirect)` | `-` |
|
||||
| `BufferOffsetAlignment` | A dispatch whose kernel, or a draw whose vertex or fragment function, reaches a buffer bound where its address, the buffer's `gpuAddress` plus the... | every device (a public call's own check of its arguments) | `metal-documented`: Metal's API validation refuses the bind offset: "must be a multiple of 4 but was set to 2" for a `uint *` argument bound at offset 2, an Apple M3 Max, macOS 27.0.1, `probes/vector_access_placement.m` in the conformance crate | 1: `crates/metal2vulkan-runtime/src/encoder.rs (check_alignment)` | `-` |
|
||||
@@ -546,6 +547,7 @@ Each refusal's sites, with the function that builds it.
|
||||
- `rt:Refusal::SamplerIds`: `crates/metal2vulkan-runtime/src/pipeline.rs (number_samplers)`
|
||||
- `rt:Refusal::NoBufferAtIndex`: `crates/metal2vulkan-runtime/src/encoder.rs (set_buffer_offset)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (find)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_buffer_offset)`
|
||||
- `rt:Refusal::ThreadgroupSize`: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch)`; `crates/metal2vulkan-runtime/src/encoder.rs (size_checked)`
|
||||
- `rt:Refusal::ImageblockSize`: `crates/metal2vulkan-runtime/src/encoder.rs (imageblock_checked)`
|
||||
- `rt:Refusal::IndirectOffset`: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch_threadgroups_with_indirect_buffer)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (indirect)`
|
||||
- `rt:Refusal::IndirectArgumentsPastEnd`: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch_threadgroups_with_indirect_buffer)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (indirect)`
|
||||
- `rt:Refusal::BufferOffsetAlignment`: `crates/metal2vulkan-runtime/src/encoder.rs (check_alignment)`
|
||||
|
||||
Reference in new issue
Block a user