ca796ca5ff7c8e87cbcb960681ffd96e2ce96d2f
44
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f43cff7e76 |
METAL-COVERAGE: the sparse tile sizes and region conversions are sparse tiles, not tile pipelines
Six MTLDevice items were filed in the coverage map as tile render pipelines ("tile render
pipelines; metal2vulkan-runtime makes none", size L, group tile): sparseTileSizeInBytes,
sparseTileSizeInBytesForSparsePageSize:, the two sparseTileSizeWithTextureType:pixelFormat:
sampleCount: forms and convertSparsePixelRegions:toTileRegions:... and
convertSparseTileRegions:toPixelRegions:.... They answer a sparse texture's tile size and convert
regions between pixels and its tiles, and have nothing to do with tile render pipelines. They now
read "sparse tiles", size S, group sparse, as MTLTexture.firstMipmapInTail, tailSizeInBytes and
isSparse already do; that group's name, "placement sparse page sizes", becomes "sparse page and
tile sizes", which it held already with those three. The tile render pipeline group keeps its
other 20 items.
docs/METAL-COVERAGE.md is regenerated: missing by size S 178 -> 184 and L 313 -> 307, the sparse
group 5 -> 11 items, the tile group 26 -> 20; the status totals do not move.
Verified, on the CPU with no device: scripts/metal-coverage/coverage.py --check reads the document
current; the table's status counts, which the validation suite's
the_coverage_documents_totals_are_the_tables compares with the document, are unchanged, and every
missing row keeps a size and a group.
|
||
|
|
e9e52050d0 |
Runtime and translator: a compute encoder binds a buffer with its attribute stride, and a dynamic stage-in layout fetches at it
What:
- ComputeCommandEncoder gains three methods:
set_buffer_with_attribute_stride (setBuffer:offset:attributeStride:atIndex:;
setBuffers:offsets:attributeStrides:withRange: is a loop of it, as every
other range call of the runtime is), set_buffer_offset_with_attribute_stride
(setBufferOffset:attributeStride:atIndex:) and
set_bytes_with_attribute_stride (setBytes:length:attributeStride:atIndex:).
- Each buffer slot's binding (Slot::Buffer, Slot::Bytes) keeps the stride's
low 32 bits, so MTLAttributeStrideStatic is 2^32 - 1. A new
FieldValue::StageInStride(slot) pushes it. It is mapped from the
translator's PushField::StageInStride, and the interface accepts
RuntimeFact::StageInStride.
- set_buffer, set_buffer_offset and set_bytes bind a stride of 0, which
clears an earlier one. That includes set_buffer of the buffer and offset
the slot already holds, which used to return early.
- Translator: the identity domains accept PushField::StageInStride
(lower/select.rs), as they accept the vertex analogue
PushField::VertexBufferStride. Before, a dynamic layout was their typed
refusal, EncoderValue "StageInStride(1)". The translator test
a_fixed_layout_records_no_stride_and_a_dynamic_one_records_its_own now
makes the pipeline, which records RuntimeFact::StageInStride of layouts 1
and 2 and none for layout 3, the constant step.
- Deleted: StageInKind::DynamicStride, unbuilt_stage_in and its call at
state creation. Gap::StageIn now names only IndirectRegion.
- Conformance:
- The runtime side plays the four attributeStride steps and
setStageInRegion:.
- The four DynamicStride ledger rows of attribute-stride-buffer,
-buffer-offset, -inline-bytes and -plural-buffers are replaced by each
case's dispatchType row (case/outcome/dispatch_type, the consumer's own),
which every compute-pass case carries.
- CONFORMANCE-COVERAGE.md is regenerated.
- Regenerated:
- REFUSALS.md and error/basis.rs;
- METAL-COVERAGE.md and coverage.tsv (the four setters are implemented);
- api_signatures.tsv (three methods added, one variant removed).
- Docs:
- The runtime README's compute section and its known gaps.
- Validation's ToolingRequirement::DynamicStageInStride doc: the runtime
builds the layout, and the engine's candidate does not yet bind with the
stride form. Its classification is unchanged.
- Versions, renumbered at landing: RUNTIME_VERSION 2570 and
SEMANTICS_VERSION 2370, because the
translator's refusal becomes a pipeline. runtime-sources.sha256 does not
move: lower/select.rs, cache/mod.rs and the runtime crate are not among
its inputs.
Why: the planner ruled DynamicStride BUILD. The translator already lowered
the fetch at PushField::StageInStride. The runtime refused the state because
its compute encoder had no attributeStride setter and no field that pushed
the stride, and the identity domains refused that encoder value.
What a plain bind reads: Metal documents no answer for a plain bind of a
slot that a dynamic layout reads, and the debug layer answers differently.
Probe dynamic_stride_plain_binds.m, job m3-max-85456 (Apple M3 Max, macOS
27.0.1), read stride 0 for every plain bind, alone and after a stride bind
(setBuffer:offset:atIndex:, setBufferOffset:atIndex:,
setBytes:length:atIndex:). Its stride-8 control read stride 8. The planner
ruled to build that answer without pinning it against Metal: there is no
conformance row for it. The setter's doc says Metal documents no answer, and
the runtime device test below holds the runtime's own behaviour.
Consumer search (git grep -n -w DynamicStride in the consumer's checkout at
a34e93e4fa): 8 hits.
- Code that will no longer compile:
- rt_platform/diag.rs:3077 and :3085 name rt::StageInKind::DynamicStride
in a test.
- Tests that will fail:
- rt_platform/compute.rs:1394 expects the dynamic-stride state to be
refused (StageIn-DynamicStride).
- Docs and comments:
- rt_platform/compute.rs:18 and :1246.
- rt_platform/diag.rs:7 and :3081.
- docs/accuracy-ledger.md:129.
Per compute.rs:14, the consumer binds the attributeStride selectors as the
calls without them. It can now call these setters.
Tests: every_device_fetches_a_dynamic_stride_layout_at_the_stride_each_bind_gives
makes ten binds and dispatches:
- strides 40 and 80, 2^32 + 40 (reads at 40), and MTLAttributeStrideStatic
(thread 0's element, then zeros);
- set_buffer of the same buffer and offset after a stride bind (stride 0);
- set_buffer_offset after a stride bind (stride 0, one element on);
- set_buffer_offset_with_attribute_stride;
- set_bytes_with_attribute_stride;
- set_bytes after a bytes stride bind, and after a buffer stride bind
(stride 0).
Verified, at this tree (2f654e598c before the fold):
- Device tests, filtered test(stage_in) | test(dynamic_stride), 8 tests
each, every one passed; each card printed the dynamic-stride test's line:
- lavapipe, job m3-max-85611 (998 skipped);
- RX 7900 XTX (RADV, Mesa 26.2.6), job m3-max-85587, --cfg m2v_gpu;
- RTX 3090 (NVIDIA 620.70.06), job m3-max-85588, --cfg m2v_gpu;
- Iris Xe (ANV, Mesa 26.2.6), job m3-max-85601, --cfg m2v_gpu.
- Conformance replay of attribute-stride-buffer, -buffer-offset,
-inline-bytes and -plural-buffers on the same four devices, same jobs:
EXIT=0. Each case's one refusal is its dispatchType ledger row, with no
divergence, so every stride slot read the words the M3 recorded,
MTLAttributeStrideStatic and the 2^32-truncated strides included.
- Suites, job m3-max-85586:
- product: 3471 passed, 4 failed, 24 skipped. One failure is
golden_hashes_match_the_table (the SEMANTICS placeholder; golden tables
are re-blessed on development). The other three are the fixture tables
inventory_lists_every_fixture_in_order,
engine_fixtures_match_their_golden_printout and llvm_as::part_5_of_8.
All three fail on engine/dvw_depth_views, which development's
|
||
|
|
39423d92f1 |
ICB: a kernel's indexed patch draws into an indirect command buffer, executed through a layout of indexed patch draws
The owner's 3406 order, the planner's next indirect command kind: MTLIndirectCommandTypeDrawIndexedPatches. The records (pipeline::IndirectDrawLayout) grow by 8 bytes a command for every kind. The control-point indices' address is a third u64 that an execution pushes, and VUID 11103 asks each token's offset to be at or past the one before it, with the draw token last (VUID 11100). So the address cannot go after the draw; it lies past the index token's 16 bytes, at index() + 16. Every command's tail is now 16 + 8 + 4 + 20 = 48 bytes: the stride is index() + 48 (was + 40), the sequence index's place index() + 24 (was + 16), and the draw's arguments index() + 28 (the translator's DRAW_AT, was 20). The cost is 8 bytes a command in every buffer: 160 bytes for 7 vertex and 7 fragment slots (was 152, 5% more), 48 for none (was 40), 544 at most (was 536), which the floor's stride and token-offset limits are checked against. One record shape for every kind stays: a kernel cannot know a buffer's kind when it is translated, so it writes one shape whatever buffer it reaches. The main lane accepted this on the condition that the already-landed kinds' rows run again at the new layout. Translator (lower/access/icb.rs): a render_command's draw_indexed_patches writes what draw_patches writes (the draw's VkDrawIndirectCommand of patches, the factors' and the patch indices' Metal addresses) and the control-point indices' Metal address at the new place (CONTROL_POINTS_AT, IndirectDrawLayout::control_point_indices). Its operands are draw_patches's, with the control-point indices at operand 6. Runtime: Device::new_indirect_command_buffer takes DRAW_INDEXED_PATCHES alone (CommandDraw::IndexedPatches), refused as patch draws are on a device whose executions run no tessellation stage (TessellationStages). Its layout pushes the control-point indices' address where the control stage reads it (FieldValue::ControlPointIndices), holds no index buffer token, ends in TOKEN_DRAW and names the tessellation stages. An execution checks the state's control-point index type against the buffer's kind, as a direct draw checks it against the call: patch draws with a state of an index type are Refusal::PatchDrawWithIndexType, and indexed patch draws with a state of none Refusal::IndexedPatchDrawWithoutIndexType. This replaces the patch draws' check through an empty PatchReads. Docs: the runtime README's ICB section (records, tokens, refusals, floor limits); the API guide's section 1; METAL-COVERAGE (coverage.tsv); CONFORMANCE-COVERAGE and REFUSALS.md regenerated (the two refusals gain the draw site); the API signature table blessed for control_point_indices. Tests: the red commit's engine and runtime device tests; the layout's unit tests at the new offsets, the reset command's control-point place among them; a unit test of the indexed patch tokens. |
||
|
|
08447f8aff |
ICB: a kernel's patch draws into an indirect command buffer, executed through a layout of patch draws
The owner's 3406 order, the planner's next indirect command kind: MTLIndirectCommandTypeDrawPatches. Translator (lower/access/icb.rs): a render_command's draw_patches writes VkDrawIndirectCommand (the patch count, the instances, the patch start and the base instance) where a plain draw's goes, and in the index token's 16 bytes, which a buffer of patch draws does not read as a token, the tessellation factors' Metal address and the patch indices' (0 for the null pointer). The records stay one shape for every kind (pipeline::IndirectDrawLayout::factors and ::patch_indices name the two places). The control-point count is not read, as a direct patch draw does not read it; the factors' instance stride and the factor scale are read only under a per-instance step function or tessellationFactorScaleEnabled, which the runtime refuses at the pipeline state. A post-tessellation vertex function of a state made for indirect command buffers is compiled under LoweringInputs::indirect_range (pipeline/compile.rs), so each evaluation tests its command against the execution range as a plain vertex function does. Runtime: Device::new_indirect_command_buffer takes DRAW_PATCHES alone, the buffer's kind CommandDraw::Patches. Its command layout pushes the factors' and patch indices' addresses where the state's control stage reads them (FieldValue::TessellationFactors, FieldValue::PatchIndices), holds no index buffer token and ends in TOKEN_DRAW; the layout and each execution name the tessellation control and evaluation stages beside the vertex and fragment ones (dgc::PATCH_STAGES). An execution of patch draws draws a patch list with a post-tessellation state and reads no tessellation factor buffer of the encoder's; a state that is not post-tessellation is Refusal::PatchDraw, as is a post-tessellation state with a buffer of other draws, and a state of a control-point index type Refusal::PatchDrawWithIndexType, as for a direct patch draw. VUID-vkCmdExecuteGeneratedCommandsEXT-supportedIndirectCommandsShaderStages-11060 requires the bound stages in the device's supportedIndirectCommandsShaderStages, so the floor reads whether they hold the tessellation stages (IndirectCommandLimits::tessellation_stages) and a buffer of patch draws is refused without them, a new kind, IndirectCommandsKind::TessellationStages. Mesa's source answers VK_SHADER_STAGE_ALL_GRAPHICS on RADV and VK_SHADER_STAGE_ALL on lavapipe. Two draw kinds together, DRAW_INDEXED_PATCHES and the rest stay CommandTypes. Docs: the runtime README's ICB section and refusal line; the API guide's section 1; METAL-COVERAGE (coverage.tsv); CONFORMANCE-COVERAGE regenerated; the API signature table blessed for the new field, methods and variant. REFUSALS.md regenerated with no change. Tests: the red commit's engine test and runtime device test, with the device test's arm for the TessellationStages refusal; a unit test of the patch tokens; the floor's limits test reads the tessellation stages. |
||
|
|
21f0cae67b |
ICB: a kernel's plain triangle draws into an indirect command buffer, executed through a layout of plain draws
The owner's 3406 order, the planner's first indirect command kind: MTLIndirectCommandTypeDraw. Translator (lower/access/icb.rs): a render_command's draw_primitives of the constant triangle type writes VkDrawIndirectCommand (vertex count, instances, vertex start, base instance) where an indexed draw's VkDrawIndexedIndirectCommand goes, 20 bytes past the index token's place, and writes nothing else. Both kinds share the records (pipeline::IndirectDrawLayout), so an encoding writes one shape whatever buffer it reaches. A kernel cannot know a buffer's kind when it is translated, because it reaches the buffer through an argument buffer. A reset's draw of nothing reads as either kind's. Points and lines stay refused, as for indexed draws, because an execution draws one topology. Runtime: Device::new_indirect_command_buffer takes DRAW alone as well as DRAW_INDEXED alone, and the buffer keeps its kind (indirect::CommandDraw). An execution's command layout follows the kind. A layout of plain draws holds no index buffer token, which VUID-VkIndirectCommandsLayoutCreateInfoEXT-pTokens-11095 forbids there, and ends in TOKEN_DRAW. Its tokens are one fewer. The execution shapes' cache keys on the kind, and the reset templates serve both kinds. DRAW together with DRAW_INDEXED stays a typed refusal, CommandTypes, until the planner rules. A layout takes one draw token (VUID-...-11100), and no form found draws both kinds in command order at a bounded cost: two executions reorder the commands, an execution per command costs two a command, and identity indices hold only as many vertices as a bound buffer of them. The CommandTypes doc, the runtime README's ICB section and its refusal line say so. Docs: the README ICB section; METAL-COVERAGE (coverage.tsv: "plain or indexed triangle draws"); CONFORMANCE-COVERAGE regenerated for the new row's recording and ledger row. REFUSALS.md regenerated with no change. Not run on an Intel card: the Iris Xe lacks VK_EXT_device_generated_commands, so its ledger row is the Extension refusal; the four-card proof jobs are named in the hand-over. |
||
|
|
c50fd04219 |
rt: drawIndexedPatches, and patch draws through a patch index buffer
The runtime refused a patch draw through a patch index buffer
(Gap::Draw of DrawKind::PatchIndexBuffer) and had no indexed patch draw.
The viewer draws every patch with drawIndexedPatches, indirectly, through
a nil patch index buffer and a UInt32 control-point index buffer (reims's
walk at development
|
||
|
|
c1f999eb06 |
rt: pipeline states answer Metal's allocatedSize as their translated SPIR-V's bytes
ComputePipelineState::allocated_size and RenderPipelineState::allocated_size answer MTLAllocation's allocatedSize, which both Metal pipeline states adopt. The answer is our code's size, not the driver's compiled binary, which the runtime does not measure. A compute state answers its kernel's module, the one its interface is read from. A render state answers its stages' modules, summed. Both numbers are taken from the translation when the content is made and kept as a u64 in the content (a compute content's Answers, a field of RenderCompiled); no module is kept for them. Every device takes the same form. No variant counts: not the emulated-SIMD-group or partial-threadgroups variant lowered with a compute state, not one made at a dispatch (the emulated-partial variant), and not a render content made later for a pass. So the answer never changes once a state is made, and two states of one content answer one size. docs/API.md's accepted differences (Heaps and memory) gets the entry. MTLAllocation.allocatedSize stays missing in the coverage ledger: buffers, textures and heaps still lack it. Its note now names the pipeline states' answers, and docs/METAL-COVERAGE.md is regenerated. api_signatures.tsv is blessed with the two methods. Tests: - state_answers: a new test. block_scan (plain module) and sample_down (partial-threadgroups variant) answer non-zero. Each equals the bytes of the module the state keeps (a test-only Kernel::module_bytes). The render state of first_texel_fragment answers the sum of the translator's compile_render_pipeline stages' SPIR-V lengths. Two states of one content answer one size. - translate.rs: the ragged-grid test on emulated SIMD groups now also checks that a state's answer is the same after the dispatches that make the variant later. Verified: job m3-max-79929 on lavapipe, a check of this tree. - signatures --check, coverage --check, clippy (plain, m2v_gpu, m2v_cpu_icd), workspace doc and the runtime's private doc: all 0. - The runtime suite: 928 passed, 3 skipped. - The two tests rerun with output: both pass. On lavapipe the variant already emulates its SIMD groups, so the ragged test makes nothing at a dispatch there. No card run yet. |
||
|
|
b723c90272 |
rt: Device::default_sample_positions answers getDefaultSamplePositions:count:
The runtime answered no default positions (its README's known gap). Device::default_sample_positions answers a count with the positions a pass of that many samples that sets none rasterizes at: Vulkan's standard sample locations, which the floor's standardSampleLocations makes every such pass take, and which are plain Metal's answers at 1, 2 and 4 samples on an Apple M3 Max, macOS 27.0.1 (probes/default_sample_positions.m, m3-max-78953). supports_texture_sample_count answers at most 1, 2 and 4, so no other count is answered. A count it does not answer is Refusal::DefaultSamplePositions (basis metal-measured: plain Metal asserts "count (n) is not supported on this device." and ends the process, at 0, 3, 5, 6, 8, 16, 17, 32 and 33 on the M3). README (the device's answers; the sample-positions gap sentence), coverage.tsv (I), and the generated REFUSALS.md, basis.rs, api_signatures.tsv, METAL-COVERAGE.md and CONFORMANCE-COVERAGE.md. Verified on lavapipe, job m3-max-79650: clippy, doc and private doc EXIT=0; the runtime suite 923 passed, 3 skipped. Metal's answers: m3-max-78953 (Apple M3 Max). |
||
|
|
1c307b4608 |
Runtime: a pass rasterizes at the sample positions its descriptor sets, through VK_EXT_sample_locations
L168: a pass's custom sample positions were dropped while the guest could be told they are supported, so a non-default set rendered at the standard positions with no refusal. What changed: - VK_EXT_sample_locations joins the floor's OPTIONAL_EXTENSIONS (enabled where listed; it has no feature). Device::programmable_sample_positions_supported (programmableSamplePositionsSupported) is true where the device lists it with locations at every sample count above 1 it renders, a 1 x 1 grid, every sixteenth from 0 to 15/16 and variableSampleLocations; false elsewhere. No second form: a device that answers no refuses positions other than the defaults. - RenderPassDescriptor::sample_positions is checked as the pass begins (crate::positions): each coordinate is taken to the nearest sixteenth, a tie up, at most 15/16, and each sample past the positions given at the pixel's corner, as the conformance suite's sample_positions rows measured an Apple M4. A set that comes to Vulkan's standard locations (Metal's defaults at 1, 2 and 4 samples) rasterizes as an empty one on every device. - Refusal::SamplePositions (Count, Coordinate, OneSample, Unsupported) where Metal's validation stops the descriptor or the device answers no. Gap::RenderPass of SamplePositions for other positions beside a depth attachment (Vulkan needs a sample-locations-compatible depth image whose layout transitions name the last locations) or at a count the device's locations lack. Gap::Draw of SamplePositions for a draw in such a pass whose fragment module uses InterpolateAtSample (VUID-01524), read from the translator's GraphicsState. - A draw in such a pass takes a VkPipeline of its class made with sampleLocationsEnable and the locations as dynamic state (Raster::positions), one pipeline for every set; the encoder records vkCmdSetSampleLocationsEXT before the pass's first draw. Every coordinate handed to Vulkan is a sixteenth in [0, 15/16], which Vulkan's required 4 sub-pixel bits hold exactly, so no precision note. - The translator's description of a device that enables the extension states it (floor::shader_extension), as for every extension creation enables that the translator names; the translator reads none of its properties. tests::translator_fields gives GraphicsState::interpolates_at_sample its verdict (refused at custom positions). - The conformance rt side passes a case's positions to the runtime; the replay player sets them on the runtime's descriptor and drops its count of passes at other positions (docs/REPLAY-STREAM.md says so). - README (floor table, the device's answers, the known gap rewritten), REFUSALS.md and basis.rs, api_signatures.tsv, METAL-COVERAGE.md and CONFORMANCE-COVERAGE.md regenerated. Tests: the device test every_device_rasterizes_a_pass_at_its_sample_positions now gates on the device's answer and holds the answer to the extension's properties; new device tests every_device_refuses_the_positions_metal_refuses and a_draw_that_interpolates_at_a_sample_is_refused_at_custom_positions; new device-free tests (placed::) of the answer's gates (each count above 1 the device renders in sampleLocationSampleCounts, a 1 x 1 grid, a range holding 15/16, 4 sub-pixel bits, variable locations) and of the placement (every coordinate in [0, 1) on a sixteenth from 0 to 15/16, refusals, the corner, the standard sets, the count and depth gaps); the replay device test sample_positions_play_through_the_runtime_s_descriptor. Verification: the lane's jobs, named in the ledger commit that follows. |
||
|
|
3c52ee1cf1 |
Render pass: a colour attachment renders one depth plane of a 3D texture's level
What: RenderPassColorAttachmentDescriptor takes `depth_plane` (Metal's `depthPlane`). A 3D texture of RenderTarget usage is made 2D-array-compatible (VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT, in its image format query too: Plan::flags, from the image's type and its colour attachment usage, no query). attachment_view then takes the plane of a 3D texture's level as a 2D view of that one layer (base layer = depthPlane, at the level), checked against the level's depth (Refusal::AttachmentPlace past it). Every barrier on a 3D texture's image (its attachment's, its copies' and its moves', texture::barrier_layers) names the image's layers as 0 and VK_REMAINING_ARRAY_LAYERS, so each moves every plane of the level it names. Before, every such pass was Gap::RenderPass of RenderPassKind::TextureType. Still TextureType: a 3D texture in a layered pass (renderTargetArrayLength 2 or more), a depth or stencil attachment of a 3D texture, a 3D resolve texture, and a resolve's depth plane but 0. A draw that reads, through a shadow (a device without the attachment feedback loop), a 3D texture whose plane its pass renders is Gap::Draw of DrawKind::AttachmentRead: a shadow's copies are of layers. The floor asks a device that lists VK_KHR_portability_subset for imageView2DOn3DImage too (VUID-VkImageCreateInfo-imageView2DOn3DImage-04459), as it asks multisampleArrayImage. Why: a guest route meets the refusal. A browser's GL layer clears every 3D texture of an RGB-family format (RGB8, RGB16F) at creation through a pass on each plane, to set the alpha it emulates; it also renders into a plane for framebufferTextureLayer(TEXTURE_3D, k) then a clear or a draw, for a level sampled before a full upload, and for copyTexSubImage3D. The consumer's route showed the key at |
||
|
|
5a03a60b6c |
rt: Device::max_threadgroup_memory_length, Metal's maxThreadgroupMemoryLength less the vote word
The answer is the device's maxComputeSharedMemorySize less the 4-byte vote word a kernel's partial-threadgroups variant may take beside its threadgroup memory, rounded down to 16, and at most Metal's 32 KiB: 32,752 on a device of 32,768 bytes (AMD's drivers on the 780M, lavapipe, MoltenVK on the M3), where a Mac answers 32,768; 32,768 on RADV, NVIDIA and ANV. A guest that sizes its threadgroup memory from it (a length it sets, or source it compiles at run time) runs its ragged grids, where 32,768 is refused (Gap::PartialThreadgroups for static memory, Limit::ThreadgroupMemory for a length). The word is one constant, pipeline::VOTE_BYTES, which the module interface's vote word reads too. It changes only the answer: every dispatch is still checked against the device's own limit. An emulated SIMD group's scratch varies by kernel and is not counted; the runtime README records it with the refusal a kernel past the answer keeps, and the unaudited cost to a guest that rounds the answer down to a power of two. Tests: the scan test reads the answer and checks its formula; a kernel whose variant takes no vote word runs [25,1,1] and [1024,1,1] in [1024,1,1] with a length of 32 KiB, past the answer (every_device_runs_a_kernel_without_a_vote_word_at_a_length_past_its_answer). METAL-COVERAGE and the api_signatures table are regenerated. Not yet run. |
||
|
|
29e54794ca |
Runtime: a sampler state bound with LOD clamps of its own samples with them
A bind's LOD clamps (setSamplerState:lodMinClamp:lodMaxClamp:atIndex:, its
vertex and fragment forms and the range forms) that read otherwise than the
state's own were Gap::LodClamps. Metal takes the call; on the M3 Max
(conformance cases sampler-bind-lod-clamps-kernel and -fragment) the pair
replaces the state's clamps, a lower bound above the upper reads at the upper's
level, and a plain bind afterwards reads the state's own clamps again.
How: such a bind takes the state's variant of the pair, the state's descriptor
with the pair as its clamps, its device samplers from the shared sampler table,
placed at a variant element of set 1's sampler arrays. The three sampler arrays
grow from 4,000 to 8,000 elements in the runtime's layout; elements 4,000 to
7,999 are the variants'. Shaders declare the heap arrays unsized, so the
translator is unchanged: a slot's sampler index is the runtime's push, and an
argument buffer's sampler index of 4,000 or more still reads element 0, so no
program-written ID reaches a variant. A state keeps its 16 most recently bound
variants; a new one past them takes the place of the least recently bound one
no command buffer holds, and where work holds all 16 the new one is held by its
command buffer alone. Past 4,000 live variants a bind is
Limit::LodClampVariants { max: 4000 }. The lod_clamp_variants gauge counts the
live variants. A NaN bound, which Metal documents no answer for, binds the
state as it is.
The floor's sampler limits rise to 24,000 (maxPerStage and maxDescriptorSet
UpdateAfterBindSamplers) and 286,144 (maxUpdateAfterBindDescriptorsInAllPools);
the lab's least are 500,000 (MoltenVK on the M3 Max) and 1,048,576 (Intel UHD
Graphics 630 on Windows), and Vulkan requires 500,000 of each with
descriptorIndexing.
Gap::LodClamps goes; REFUSALS.md, basis.rs, the signature table, the Metal and
conformance coverage pages regenerate. The validation replay plays clamped
binds (no skipped_clamped_samplers). The ledger drops three rows the clamped
binds now answer (compute-plural-texture-and-sampler-binding steps 11 and 14,
render-state-unread-slots). The compute single clamp form's coverage row named
set_sampler_state; it names set_sampler_state_with_lod_clamps.
Tests: a kernel samples through the binds as Metal reads them; a state's 16
kept variants filled past that; the 4,000 variant elements filled past their
capacity; the gauge flat across a bind and retire loop and zero at device
drop. Verified: see the lane's report (jobs named there).
|
||
|
|
afbcfec9a7 |
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. |
||
|
|
d825e52482 |
Validation: the suite's pins for the table work
- runtime-sources.sha256: the runtime inputs include the translator's bind module, where function_table_header and function_table_entry_offset became public; they lay out the words the shader already read, and no run of an unchanged artifact does anything else, so RUNTIME_VERSION does not move. - public_linked_modules_resolve_by_hash_without_a_private_store lists the new public linked module visible_table_ops. - coverage.tsv: MTLFunctionHandle's counterpart is the translator's FunctionHandle (the runtime re-exports it), and visibleFunctionTableDescriptor is VisibleFunctionTableDescriptor's Default, as the coverage test finds items. The three failed in the validation suite at dabc455312 (m3-max-69738: 1291 passed, 3 failed). |
||
|
|
28e2b0e6ca |
Validation: a kernel case's visible-function tables run through the runtime
The runtime candidate makes each table the case binds of the pipeline state (newVisibleFunctionTableWithDescriptor: of its size, each authored entry set to the handle of its linked function made with the case's constants, as the Metal oracle sets it) and binds it at its buffer index. ToolingRequirement::KernelFunctionTable, which held such cases to Metal alone, is retired; a render stage's table stays the runtime's limit (RenderFunctionTable). ENGINE_EXECUTOR_ABI does not move: no recorded row ran a kernel table case (they were refused). The runtime README states the device answer, the encoder's bind, the state's handles and tables, and the known gaps (a table's 64 KiB block, a consumer-compiled kernel's handles, an argument buffer's table). The coverage table marks the compute items implemented; METAL-COVERAGE.md and CONFORMANCE-COVERAGE.md are regenerated. Adds the owned linked module visible_table_ops.metal, whose companions scripts/regen-air-fixtures writes on the Mac. Verified: the lane's jobs. |
||
|
|
da020e5d7b |
Runtime: a compute kernel that reaches an explicit imageblock gets its state; its dispatch is refused
A compute pipeline state whose kernel reaches an explicit imageblock was refused at its make as
Gap::KernelInput of KernelInputKind::RuntimeFact naming ImageblockSize, which every arm64 macOS
guest boot meets once. The state is now made, and what stays refused is the dispatch, where Metal
reads the extent setImageblockWidth:height: set, which the compute encoder does not have:
- interface() takes RuntimeFact::ImageblockSize, keeping its cell bytes as Interface::imageblock,
and leaves SpecKey::ImageblockWidth and ImageblockHeight at the module's default (0 by 0)
instead of refusing them as a specialization it does not set.
- encoder::decide, which the dispatch, prepare_dispatch, dispatch_variant and the main pipeline's
key all go through, refuses a kernel with an imageblock first, as Gap::KernelInput of
RuntimeFact naming the fact (RuntimeFact::name). So no VkPipeline of such a kernel is made:
finish_pipeline has no main key, and a pre-pass gets no key. A dispatch of such a kernel that
writes no memory records nothing and is not refused, as for any kernel without effects.
- imageblock_memory_length_for_dimensions keeps its typed answer, Gap::ImageblockLength, for a
kernel that declares an imageblock: the one recording of Metal's answer for such a kernel
(conformance pipeline-facts-compute-imageblock, M3 Max, 256 bytes at 8 by 4 by 3) settles no rule.
The translator is untouched. Gap and KernelInputKind keep their variants; the docs of
Gap::KernelInput, KernelInputKind::RuntimeFact and Specialization, Gap::ImageblockLength (and its
basis line), the dispatch and the state's make say where the refusal now is. docs/REFUSALS.md,
docs/METAL-COVERAGE.md (setImageblockWidth:height:'s note) and docs/CONFORMANCE-COVERAGE.md are
regenerated. The runtime README's state facts and its known gap are re-worded, with the counts and
jobs kept. The conformance ledger's pipeline-facts-compute-imageblock row moves from case/state to
the facts' label and device (the consumer's own, as for every state) and imageblock_memory_length
(Gap::ImageblockLength). Validation's KernelImageblock requirement doc and its acceptance test's doc
name the dispatch's refusal and the renamed device test.
Test: tests::kernel_input::an_explicit_imageblock_kernel_is_made_and_its_dispatch_refused_as_its_named_runtime_fact
(replacing an_explicit_imageblock_kernel_is_refused_as_its_named_runtime_fact) makes a4_imageblock_extent's
state, reads its imageblock length as Gap::ImageblockLength, gets no dispatch_variant key, and has
one 4 by 2 threadgroup's dispatch refused as Gap::KernelInput of RuntimeFact { fact: "ImageblockSize" }.
|
||
|
|
a916e61185 |
Runtime: a kernel's [[stage_in]] is fetched; the three forms not built are Gap::StageIn by kind
A compute pipeline state whose kernel reads [[stage_in]] attributes was refused at its creation as Gap::KernelInput of KernelInputKind::StageIn, which a guest met (a descriptor-form compute state, the app's context closed right after). The translator already fetches every attribute in the shader from the buffer slot at its layout's bufferIndex, through that slot's pushed address, by the stage-in and dispatch regions the encoder already pushes. Two things stood in the way, both in the runtime: - interface() refused any kernel whose PipelineInterface::stage_in is non-empty. The line goes. - The thread-position fetch's reach check reads SpecKey::StageInReach, which the runtime's constant loop refused as a specialization it does not set. The runtime now leaves it at the module's default (true): one pipeline, the check kept for every dispatch. What stays refused is a typed refusal naming its own form, Gap::StageIn of a new StageInKind: - IndirectRegion: setStageInRegionWithIndirectBuffer:indirectBufferOffset:, now the method ComputeCommandEncoder::set_stage_in_region_with_indirect_buffer, which always refuses (the conformance rt side calls it in place of its own Unavailable); - DynamicStride: an attribute the kernel reads through a thread-position layout of MTLBufferLayoutStrideDynamic (the compute encoder has no attributeStride setter), at the state's creation, before the translator's IdentityDomains refusal of StageInStride; - IndexedStepRate: an attribute it reads through an indexed step at a step rate past 1, at the state's creation. Both creation checks read the descriptor narrowed to the attributes the kernel reads (kernel_inputs_read), so an attribute it never reads, and a constant step of a dynamic layout, refuse nothing. KernelInputKind::StageIn is deleted. Consumer search: `git grep -n 'KernelInputKind'` in the reims-vgpu checkout at c8201ec2ba: 0 hits (nor any for `StageIn` as a refusal kind). Tests: the device test every_device_fetches_stage_in_by_each_step_function dispatches engine/kernel_stage_in's stage_in_fetch under ThreadPositionInGridX at rates 1 and 2, ThreadPositionInGridXIndexed and Constant, and checks every thread's four attributes (threads past the region read its last element); without the change the state is Gap::KernelInput. every_device_refuses_each_unbuilt_stage_in_form_by_its_kind holds the three kinds and the two states that are made. kernel_input's refusal test of StageIn goes; lowered and the harness's gap test take Slot. The conformance case stage-in-region-clamps carries on past a refused row (probe, as attribute_formats does), so its 27 other rows compare where the indirect one is refused. The ledger drops the 82 rows of the old refusal (stage-in-region-clamps 1, attribute-format-fetches 29, attribute-format-class-crossings 16, stage-in-unread-attributes 36), takes the indirect row's new refusal, and the four compute attribute-stride rows' DynamicStride refusal. The validation requirement KernelStageInput stays: the engine's run through the runtime passes no stage-input descriptor or region. README, REFUSALS.md, METAL-COVERAGE.md, CONFORMANCE-COVERAGE.md and the signatures table regenerated. |
||
|
|
817463704e |
rt: texture buffers are buffer views of their buffer's bytes in set 1's two texel-buffer arrays
What: Buffer::new_texture of a texture buffer's descriptor makes one VkBufferView of the bytes
shaders reach (a Managed buffer's device copy where it has one), from the offset, its width's
texels long: no image, no copy, no new push field. Set 1 gains two arrays of 65,536 elements,
binding 5 (uniform texel buffers, the read ones) and binding 6 (storage texel buffers, the written
ones), at the same index class as textures; a texture buffer's index is the same element of both,
and placing a texture or a texture buffer over the other's index nulls the other's elements. The
translator's identity domains classify a texture_buffer slot or argument-buffer member as a texel
buffer of that array (no TexelBufferRange fact, no swizzle under identity), so a pipeline that
declares one is no longer Unsupported{IdentityDomains}. SEMANTICS_VERSION 2258.
Metal's own refusals are typed: an offset off Device::minimum_texture_buffer_alignment
(minimumTextureBufferAlignmentForPixelFormat:, the device's texel-buffer offset alignment, the
larger of the uniform and storage ones, a single texel's size where the device says it suffices)
is Refusal::TextureBufferAlignment; a bytesPerRow below the row or texels past the buffer is
Refusal::BufferTextureLayout; a descriptor of more than one row, level, slice or sample, and a
swizzle with writes, as Metal refuses them. Device::new_texture (and every other make) of a texture
buffer's descriptor is Refusal::TextureBufferNotOverBuffer: the consumer places the bytes as it
places every buffer. Gap::TextureBuffer goes; a swizzled texture buffer (Gap::TextureBufferSwizzle),
a view of one, and a blit copy of one are recorded gaps. A format needs both texel-buffer usages in
its buffer features (Gap::TextureFormat otherwise): the view's buffer has both usages, and without
maintenance5 its usage is the buffer's.
The floor requires the six texel-buffer descriptor-indexing features (update-after-bind, dynamic
and non-uniform indexing, uniform and storage) and raises the limits the two arrays count against:
uniform texel buffers against the sampled-image limits, storage texel buffers against the
storage-image limits, both against maxPerStageUpdateAfterBindResources and the pools: sampled and
storage per stage and per set 131,072 (196,608 sampled with attachment reads' second elements),
resources 262,152 (327,688), pools 274,144 (339,680). Every recorded device fits: the 8 device dumps'
least are llvmpipe's 1,015,808 sampled/storage/resources and the UHD 630's 1,048,576 pools; all 12
devices there report the six features.
Why: six harvested guest functions declare a texture buffer, and a pipeline that declared one was
refused at creation.
Checked by: tests::texture_buffers (lavapipe: R32Uint read at a buffer offset and written, out of
bounds read zero and dropped, atomics through read_write, every refusal), engine_identity's
a_texture_buffer_is_the_texel_buffer_element_its_resource_id_names (L3 on lavapipe and moltenvk-m3),
the floor tests, the signatures table and REFUSALS.md regenerated; the lane's compile job reports
the runs.
|
||
|
|
b5ac9fd07b |
rt: visibility results, one precise occlusion query per mode, copied into the buffer at the pass's end
What: `setVisibilityResultMode:offset:` builds `Boolean` and `Counting`. Each such mode set is one segment counted by one precise occlusion query (`VK_QUERY_CONTROL_PRECISE_BIT`), begun in the pass's rendering before the segment's first draw and ended there at the next mode set or the encoder's end; a segment with no draw begins and ends its query as it ends, so its word is 0. After `vkCmdEndRendering` the pass copies the counts (`vkCmdCopyQueryPoolResults`, 64-bit, WAIT) straight into the visibility result buffer's `VkBuffer` at place+offset, one copy for each run of consecutive offsets in one pool, before the pass's second barrier (recorded or owed), which orders them before every later command; a Shared buffer's segment end barrier reaches the host, and a Managed buffer's write and a texture over the buffer in an image of its own are kept as a blit's write is. `Boolean` writes the count too, nonzero exactly where a sample passed (Metal documents a nonzero word; the M3 Max writes 1): an accepted difference in docs/API.md section 10, and the conformance cases compare a `Boolean` word as nonzero alone. A command buffer takes its queries from occlusion pools of 256 the device lends it (`crate::visibility`), each query reset on the host (`hostQueryReset`) as the command buffer retires or drops uncommitted; the device keeps at most 16 pools free and destroys the rest (`Gauges::occlusion_pools`). `occlusionQueryPrecise` joins the floor's required features (every venue's profile reports it; Roadmap 2022 requires it), with the README floor table, the runtime-floor profile's `m2v_runtime_floor` block and the regeneration script's list. Refusals: Metal's own, each where the mode is set, the encoder's mode unchanged: `Refusal::NoVisibilityResultBuffer`, `Refusal::VisibilityResultOffset` (not a multiple of 8, or past the buffer), `Refusal::VisibilityResultOffsetTaken` (Apple documents each offset as set once per pass; Metal's validation stops it), and `Refusal::ArgumentPlace` at alignment 8 for an offset at an allocation byte off a multiple of 8 (VUID-vkCmdCopyQueryPoolResults-flags-00823). Gaps, each counted and a README known gap: `DrawKind::AccumulatedVisibilityResults` (a mode in an `Accumulate` pass; `Metrics::accumulated_visibility_refused`) and `DrawKind::VisibilityResultInterrupt` (a command that would end the rendering while a query counts: a memory barrier after a writing draw, a draw that moves an attachment to the feedback layout, pays an owed barrier before an attachment read or copies into a shadow, and, bounded, a draw that looks at textures over a buffer in an image of their own or reaches a Managed buffer with textures over its device copy; `Metrics::visibility_interrupts_refused`). Every refusal is checked before the encoder changes state; a segment's first draw may still end the rendering, before its query begins. `DrawKind::VisibilityResults` is gone. `RenderPassDescriptor::visibility_result_type` (`VisibilityResultType`, Metal's `visibilityResultType`) is a field now. Translator: `PrecisionNote::DeviceOcclusionCount`, the static note of a `Boolean` or `Counting` result (`RenderCommandEncoder::VISIBILITY_NOTE`), quoting Vulkan's "Occlusion Queries" (precise counts differ between implementations: fragments killed before rasterization, counts multiplied per colour output) and "Fragment Operations" (`earlyFragmentMultisampleCoverageAfterSampleCounting`); its codec tag, ARTIFACT_FORMAT_VERSION 588, validation's allowance (unbounded, no tolerance), the conformance degradation `device-occlusion-count` among the native notes, and docs/API.md's catalogue. The dead `Feature::CountingVisibility` (no construction site) is removed with its reach row. The old runtime's `Device::new` is untouched; the runtime-floor test profile now states `occlusionQueryPrecise`, which re-keys that profile's fingerprint. Why: the visibility-cut ruling. A guest that sets a mode got a refusal; it now gets its results, or a typed, counted refusal where the cut does not build the shape (continuations and a combine are not built). Verified: cargo fmt; scripts/api-signatures --bless/--check, refusal_surface (0 without reach or basis), metal-coverage and conformance-coverage regenerated, check_device_profiles (0 findings). The compile job (fmt, signatures, clippy plain / --cfg m2v_gpu / --cfg m2v_cpu_icd, workspace Rustdoc -D warnings) and the lavapipe rt suite, with tests/visibility.rs (Boolean and Counting against the CPU's counts, pool reuse and the 16-pool bound past 17, Metal's refusals, Accumulate, the barrier and attachment-read interrupts), are named in the lane's report. |
||
|
|
22ae7df766 |
rt: indirect command buffers of indexed draws on VK_EXT_device_generated_commands
What: the first cut of Metal indirect command buffers, the runtime's half, in one commit: the device's extension, the buffer object, the executions, the reset and the pool depend on each other, and any part alone would be dead code. - The device enables VK_EXT_device_generated_commands with VK_KHR_maintenance5 together where both are reported (floor::INDIRECT_COMMANDS), and nothing else chooses a form. maintenance5 has one form here: rt takes nothing of it but the BufferUsageFlags2 a preprocess buffer needs, and its A8 format stays untaken. dgc.rs declares the extension's structures by hand, each size and offset checked at compile time against the spec's layout; it goes once ash binds the extension. - IndirectCommandBuffer, IndirectCommandBufferDescriptor and IndirectCommandType (Device::new_indirect_command_buffer): indexed draws that inherit the pipeline state and bind their own buffers, at most 31 a stage; records in a Private block, reset from the device's template at the next commit. gpuResourceID is the records' device address. - RenderCommandEncoder::execute_commands_in_buffer (a CPU range) and execute_commands_in_buffer_with_range (a range read from a buffer, executed at full capacity with the SEQUENCE_INDEX token): one PUSH_CONSTANT token a run of slot words, the index buffer token and the indexed draw, through the inherited pipeline; the push constants and the index buffer are pushed again after an execution. Every execution runs as one vkCmdExecuteGeneratedCommandsEXT a part of CHUNK = 64 commands, in order, on every device (the planner's ruling: one execution of more drew wrong on the XTX past ~4 MiB of generated commands and out of order on the 2080 past 64 sequences); each later part pushes its first command (PushField::IndirectBase) and takes its own preprocess offset in the execution's one region. A slot a command binds is pushed the widest bounds, unchecked, as a loaded pointer's access is (README, SlotBounds). - BlitCommandEncoder::reset_commands_in_buffer (copies from the template in regions) and optimize_indirect_command_buffer (no work); useResource of an indirect command buffer in the compute and render encoders, and RenderCommandEncoder::use_heap. - Preprocess memory: sized from vkGetGeneratedCommandsMemoryRequirementsEXT with the inherited pipeline per (content, raster state, record layout) at a part's 64 commands in a cache of SHAPES = 256; layouts LAYOUTS = 64; templates TEMPLATES = 16, each at most 64 KiB. Each a fill-past-capacity test. A new pool of regions (its own VkBuffer and VkDeviceMemory each, usage2 PREPROCESS | SHADER_DEVICE_ADDRESS, a memory type from the requirements' bits, device-local first, rounded to 64 KiB): one taken at record time per execution (an idle one at most twice its need, else one made), given back when its command buffer retires, the oldest idle ones freed past IDLE_BYTES = 128 MiB. At rest it holds idle regions up to 128 MiB, freed at device drop. No execution waits or is refused for the pool's sake. Not the block mechanism: blocks are made with the floor's one usage on every device, and adding the preprocess bit on DGC devices alone would be a second form; the memory types come from the driver's per-layout requirements. Gauges of the used and idle bytes: flat between iterations 100 and 200, zero at device drop (tested). - Typed refusals by name (Gap::IndirectCommandBuffers with IndirectCommandsKind): no extension, other command types, per-command pipelines (everywhere), inherited buffers, bind counts past 31, capacity, an unflagged state, a draw input the commands cannot carry, more tokens than the device takes; Refusal::CommandRange for ranges past the commands. - README: indirect command buffers and their known gaps (b1's two costs, the preprocess cost, lavapipe's preprocess size defect verbatim, the Iris, UHD 630 and Mac host lines, the parts and their measured cost), the extension rows; METAL-COVERAGE and REFUSALS regenerated; api_signatures blessed. GetDeviceProcAddr audit (verified by grep of the runtime's loads): every device function rt loads belongs to an extension enabled at the load. calibrated_timestamps is a floor extension; feedback_loop_dynamic_state loads only under the feedback loop; device_fault loads only where device creation enabled it; external_memory_fd, external_memory_win32 and external_memory_host load only where enabled(); Dgc::load runs only where INDIRECT_COMMANDS is enabled. Verified: see the lane's report (compile gate, lavapipe and GPU device tests). |
||
|
|
aed460e0da |
rt: indirect draws, of primitives, indexed primitives and patches
The render encoder builds Metal's three indirect draws:
`drawPrimitives:indirectBuffer:indirectBufferOffset:` (`draw_primitives_indirect`),
`drawIndexedPrimitives:indexType:indexBuffer:indexBufferOffset:indirectBuffer:indirectBufferOffset:`
(`draw_indexed_primitives_indirect`) and
`drawPatches:patchIndexBuffer:patchIndexBufferOffset:indirectBuffer:indirectBufferOffset:`
(`draw_patches_indirect`). Each is one `vkCmdDrawIndirect` or `vkCmdDrawIndexedIndirect` on the
buffer at its offset: Metal's argument structs lie as Vulkan's commands do, so the GPU reads
them as they are and nothing is copied. Before, the encoder had no such methods and the README
listed indirect draws as not built.
drawPatches indirect is built: rt's patch draw is vkCmdDraw(patch_count, instances, patch_start,
base), each patch one vertex of the state's patch list, so Metal's patch count is the indirect
command's vertex count unchanged. A patch index buffer stays `DrawKind::PatchIndexBuffer`, as
the direct draw's.
The arguments' buffer counts among the draw's reads as an index buffer does (draw_reaches,
Managed copies), and the command buffer keeps it until it retires. The pass's first barrier
(Reach::Commands, which has INDIRECT_COMMAND_READ) and the encoder's memory barrier make earlier
writes visible to the read. An offset not a multiple of 4 or without the arguments' 16 bytes (20
indexed) is Refusal::IndirectOffset; arguments at a block byte not a multiple of 4 are
Refusal::ArgumentPlace; an indexed draw's index offset must be a multiple of the index size and
inside the buffer. A device that takes firstInstance 0 alone under a divided step rate refuses
an indirect draw through such a state (DividedBaseInstance), since the GPU reads the base
instance.
Floor: drawIndirectFirstInstance joins REQUIRED (Vulkan 1.4 requires it), so Metal's base
instance is the device's own. The translator is not told. The venue dumps report it true on
every venue: m3-max-48727, 48728, 48729, 48730, 48731, 48736, 48737 and 61508. tests/floor.rs,
the README floor table, regen_device_profiles.py's RUNTIME_FLOOR and profiles/runtime-floor.json
add it. The translator's tests that read runtime-floor only see indirect_needs_arguments become
false more often, which none asserts the other way.
Known gap (README): an indexed indirect draw's index count is the GPU's, so a count past the
index buffer is not refused as a direct one is. Without robustBufferAccess2, which the floor does
not require, a count past the block's VkBuffer is outside valid usage
(VUID-vkCmdDrawIndexedIndirect-robustBufferAccess2-08798).
The encoder's doc no longer lists `useResource:` as not built (it is, since
|
||
|
|
7ba1cdbf30 |
rt: a blit copy between a buffer and a texture takes MTLBlitOption's plane options
copyFromBuffer:...:options: and copyFromTexture:...:toBuffer:...:options: are BlitCommandEncoder::copy_from_buffer_with_options and copy_from_texture_to_buffer_with_options, with a public BlitOption (None, DepthFromDepthStencil, StencilFromDepthStencil). A plane option copies the aspect it names, one vkCmdCopyBufferToImage or vkCmdCopyImageToBuffer region of that aspect, where the pixel format has it: the depth or the stencil of a combined format, and the depth of Depth16Unorm or the stencil of Stencil8 too, which Metal takes (the conformance crate's buffer-depth-samples rows put the option to Metal on those formats). The forms without an option are those of None. The unit is texture.rs's copy_unit of the named aspect, so a copy into a 32-bit float depth is Gap::FloatDepthUpload as Depth32Float's is, and a multisample texture stays Gap::TextureBytes; a plane option of a format without its aspect is Gap::TextureBytes. MTLBlitOptionRowLinearPVRTC is not offered: the runtime makes no PVRTC texture, and the conformance side keeps it unavailable. The private buffer_copy takes the direction and the option as one Way, which keeps it under clippy's argument count without an expect. Docs: the rt README's blit lines, Gap::TextureBytes's doc, REFUSALS.md (regenerated), the metal-coverage map (the two options selectors now name the options methods) and METAL-COVERAGE.md, the public signature table (6 records added, none moved). Tests: tests/blit_options.rs. On the host, each option's aspect and unit bytes in both directions, and each refusal. Under a device cfg, a pass clears a Depth32Float_Stencil8 texture to depth 0.25 and stencil 0x5a, a stencil region goes in from a buffer, and both planes come back out (the region with 0x5a around it, 0.25 at every texel); Depth16Unorm's depth and Stencil8's stencil go in and come back out bit for bit. |
||
|
|
62b3e5a250 |
rt: the render encoder's use_resource, and a draw after a declared write of a texture with no storage element is Gap::StorageElement
What: RenderCommandEncoder::use_resource is useResource:usage:stages:, its plural and their
deprecated forms without stages. The command buffer keeps the buffer or the texture until it
retires and nothing is recorded: every resource is resident to every function, and the pass's
barriers already order its draws. A usage that writes a texture (or a view of one) made for
shader writes with no storage element marks the encoder, and every later draw whose vertex or
fragment function may reach a texture through its storage image beyond its slots
(PipelineInterface::unbound_storage_textures: an argument buffer's write or read_write texture, a
resource ID) is Gap::StorageElement with no slot, as the compute encoder's dispatch already is.
Before this, such a draw ran and Vulkan dropped the writes Metal makes. The declaration
invalidates the encoder's held draw facts, so a draw of an unchanged state and bindings after it
is checked again.
Also: the three redundant explicit links in new_render_pipeline_state's docs (private rustdoc
-D warnings, from
|
||
|
|
4e3a6a3555 |
rt: layered rendering in one form, the vertex function storing Layer in every pass
`RenderPassDescriptor::render_target_array_length` is Metal's `renderTargetArrayLength`. A pass
of length N of 2 or more is one rendering of `layerCount` N: every attachment and resolve texture
is a view of its level and N slices from its own `slice` (a 2D array view; a cube's faces are its
slices), and the rendering's load, store and resolve cover every layer, with no per-layer loop.
At 0 and 1 the pass renders the attachment's slice alone, as Metal's does.
A vertex function's `[[render_target_array_index]]` has one form: the variant that writes
`Layer`, in every pass. Each draw pushes the pass's length, max(len, 1)
(`FieldValue::RenderTargetArrayLength` for the translator's `PushField::RenderTargetArrayLength`),
and the function stores 0 for an index at or past it, so at 0 and 1 every index renders the
attachment's slice. The fragment function reads the raw index through the flat varying the
translator carries. The runtime never asks for `VariantKey::dropped_vertex_layer`; a state whose
fact is `RenderTargetArrayLength { layer_dropped: true }` is refused as a draw input. What still
uses `dropped_vertex_layer`: the old binder (`bind/graphics.rs:905`, the variant it asks for at a
shape's length), stage_io's plan (`lower/stage_io/plan.rs:1600` and `:2305`, also the
non-layered amplification), and the validation crate's engine tests
(`candidate/engine/graphics/tests.rs:907`); it stays for cutxlate to delete.
`shaderOutputLayer` joins the floor's required features: every probed device reports it
(vulkaninfo, jobs m3-max-61359 on gem10: the 780M, the RX 550 and lavapipe; 61360 on um790: the
RX 7900 XTX, the RTX 2080, the 780M and lavapipe; 61361 on um870: the 780M, the RTX 3090 and
lavapipe; 61362: KosmicKrisp, Mesa 26.3.1; 61366: the UHD 630's Windows driver, Vulkan
1.3.215). A device without it gets the floor's refusal. The runtime-floor profile and its
generator gain it.
Refused, in the README's layered-rendering gap line: an attachment or resolve texture with fewer
slices from its own than the pass's length (`Refusal::AttachmentPlace`, naming the last slice); a
3D texture's depth planes (`TextureType`, as for every 3D attachment); a length past
`maxFramebufferLayers` (`RenderPassKind::ArrayLength`, new:
VUID-VkRenderingInfo-layerCount-07817); a draw that reads one of a layered pass's attachments
through a texture on a device without the feedback loop (`AttachmentRead`: a shadow holds one
layer); and a vertex function whose index the translator cannot show the same at every vertex of
a primitive, at creation, naming `LayeredRendering` and `geometryShader`: Vulkan requires one
`Layer` per primitive (VUID-VkPipelineShaderStageCreateInfo-stage-02596), the translator's other
form is a geometry stage device creation does not enable, and Metal calls a differing index
undefined. The feedback-loop move's ranges around the rendered layers (`around`) take the
attachment's layer count.
The conformance runtime side passes the length; the case `layered-render-target-array-length`
loses its ledger row. REFUSALS, METAL-COVERAGE and CONFORMANCE-COVERAGE regenerated; the API
table gains the field and the kind.
Test: `tests::layered`, on every device of the cfg's kind: a 2D array's slices 1 to 3 with an
index past the length, a cube's six faces, a pass of length 0 and one of length 1 whose vertex
function writes index 3 (rendering the attachment's slice, the fragment reading 3), every slice
read back; and `rt6_first_vertex`'s per-vertex index refused naming `LayeredRendering`.
|
||
|
|
9a1c8fe6dc |
metal2vulkan-rt takes the runtime's name: metal2vulkan-runtime, published
The cutover's last mechanical step. The old runtime is deleted, so its name is free: the crate moves to crates/metal2vulkan-runtime, its package is metal2vulkan-runtime and its library metal2vulkan_runtime, and every reference in the tree follows (sources, tests, scripts, CI, generated tables and docs). It is now a published crate, as AGENTS.md said it would be once it took the name: version 0.2.0 with the other two, the translator pinned exactly (=0.2.0, as the translator pins the AIR front end), documentation, keywords and categories, and copies of the repository's four license files, which the published-crates test now holds equal to the root's for three crates. CI packages it with the others. Prose that said it was unpublished, or counted two published crates, says three. AGENTS.md: facts only. The crate table row, the published-crates and version sentences, and the paragraph on the old runtime, whose name the runtime now carries (listed for the owner). Made by one script run on this tip. Verified by the job named in the landing note. |
||
|
|
a9acc24aa0 |
Coverage map: rows rt and the translator answer through their own calls, per-row sizes, refusals by rt's names
The fast switch to metal2vulkan-rt marked missing every runtime row whose old counterpart rt does not hold under the same name. rt's and the translator's Rustdoc answer more of them: - 28 runtime rows are implemented: the 9-argument texture and buffer-to-texture copies and the options form with no option, `enqueue`, `commandBufferWithUnretainedReferences` (the same call as `commandBuffer`), every `withRange:` setter of both encoders (a loop of the single setter), `useResources:count:usage:` and `useHeaps:count:`, both encoders' memory barriers, `newBufferWithBytesNoCopy` (Device::import_host_memory and a buffer in its block), `MTLCreateSystemDefaultDevice` (Device::new), `MTLCopyAllDevices` (Instance::physical_devices), a texture's `storageMode` through its descriptor, and `renderPassDescriptor` (RenderPassDescriptor's Default); - 23 translator rows are implemented: MTLLibrary and MTLFunction by the translator's Library and Function (from_metallib, function, functions, library_type, install_name, properties, function_constants_dictionary, reflection), and MTLFunctionDescriptor by FunctionDescriptor; - maxBufferLength and a texture descriptor's resourceOptions are the consumer's; - 53 missing rows take their own size and note: encoder calls (S for loops of existing calls and store action options, M for stride binds and indirect draws, L for vertex amplification), render pass fields, a texture buffer's descriptor and alignment, function options; - refusals are named by rt's types: Gap::IndirectCommandBuffers, Gap::KernelInput and Gap::DrawInput for function tables, RenderPipelineKind::VertexAmplification and Tessellation, RenderPassKind::TextureType and NoAttachment, Gap::TextureBuffer; - 629 notes no longer name the old runtime's items (RuntimeGap's variants, FeatureRow's rows, its compiled_reflection, function_handle, allocated_size, new_library_with_source and BlitOption). coverage.py's group names follow (buffers, encoder calls, command buffer options, function options). docs/METAL-COVERAGE.md and docs/CONFORMANCE-COVERAGE.md regenerated: implemented 593, missing 1118, out of scope 424. Verified: every implemented row resolves by the test's own rules in its crate's sources (a script run of them: runtime 237, translator 356, none missing); every `Type::name` a note names is held by rt or the translator (14 checked; the same check over the table before this commit finds 26 it does not hold). The compile job is named in the hand-off. |
||
|
|
220473aafd |
Coverage map: the runtime's counterparts are metal2vulkan-rt's, and the test reads rt's sources
The old runtime is being deleted, and the coverage map's 649 runtime rows named its items. Every runtime row now names metal2vulkan-rt's counterpart or none: - 180 rows whose counterpart rt holds under the same name keep it; - 29 take rt's name for it: DeviceProperties fields that are Device methods, the heap placements that are Device::new_heap_buffer and Device::new_heap_texture, the lod-clamp and stencil setters, the dispatch type taken by CommandBuffer::compute_command_encoder, and a texture's getters through Texture::descriptor; - 73 are out of scope as rt's README gives them to its consumer: labels, MTLHeap and its descriptor, MTLBinaryArchive and every descriptor's binaryArchives, a resource's options, a texture's parent and shareable getters, a library's and a function's device; - 367 are missing, each with a group, a size and a note: indirect command buffers (71), function tables, handles and dynamic libraries (38), mesh (33) and tile (26) pipelines and their calls, encoder calls (59), argument encoders (24), libraries and functions as runtime objects (25), and smaller groups. Their sizes are the group's, to be refined. coverage.py names metal2vulkan-rt as the runtime and gains the new groups; metal_coverage.rs reads crates/metal2vulkan-rt/src. docs/METAL-COVERAGE.md and docs/CONFORMANCE-COVERAGE.md regenerated from the table (implemented 542, missing 1171, out of scope 422). Verified: every implemented runtime row resolves in rt's sources by the test's own rules (a script run of them over the tree: 209 of 209); the compile job is named in the hand-off. |
||
|
|
0a4f4e87f2 |
Labels: command buffers and encoders take Metal's label, and a lost device's notice names the hang by them
A lost VkDevice's recovery notice named its hang only as "a command buffer (of queue `Q`)", so an Iris boot's GpuHang (46 victims) left nothing to tell which work hung. The runtime had no label for a command buffer or an encoder at all. CommandBuffer::label/set_label (MTLCommandBuffer.label) and label/set_label on the blit, compute, render and resource state encoders (MTLCommandEncoder.label) now keep what the program sets. A command buffer has one encoder open at a time, so the open encoder's label lives on the command buffer's state, and the encoder's record takes it as it ends: each EndedEncoder reports its label, in its place, a render encoder that ends on the lowering thread included. The recovery names its culprit from the command buffer's state as it fails the pending batches: its label and its queue's, then its first 32 ended encoders' places, kinds and labels, counting the rest, e.g. "command buffer `busy` of queue `relayed` (its 1 encoder: 0 blit `copies`) failed as the hang (`GpuHang`)". set_label and label are no calls in EncoderCall's numbering. The API table, the Metal and conformance coverage maps, docs/API.md's DeviceRecovered entry and the runtime README say so. The table's WorkCounts::spare_command_buffers_freed_past_recorded line moves to where the script sorts it. Verified: fmt only on this machine; tests::labels (both lowering policies) and tests::device_recovery's relayed-loss test, which asserts the named notice, run on lavapipe next. |
||
|
|
2b0b59061a |
Runtime sampler descriptor: lod_bias, read as an Apple9 GPU reads it
SamplerDescriptor gains `lod_bias: f32` (MTLSamplerDescriptor.lodBias, default 0, serde default), so a guest's bias is carried rather than having no field to land in. What Metal does with it, measured on the M3 Max (Apple9, macOS 27.0.1 26A434) with a throwaway Swift probe of runtime-compiled MSL (jobs m3-max-19665/19666): level L of a 7-level texture held L, so every sample read its own level of detail. Across 136 row groups no sample changed with the sampler's bias: fragment implicit, shader bias(), level(), gradient2d(), min_lod_clamp() and bias+min_lod_clamp; kernel default, level, gradient and bias; linear and nearest mip filters on float textures, both on uint ones; a NotMipmapped sampler's min/mag choice; clamps [1,3], [1.5,MAX], [0,2]; biases -1000 to 1000, 15.99, 16, 16.5, 17, NaN, +-inf. The probe saw levels move with the shader bias, the clamps, explicit levels and the NotMipmapped filter switch. With MTL_DEBUG_LAYER=1 every value made a sampler with no assertion and read back as set. Apple's tables list the bias under Apple10, which no runtime device claims. So the Vulkan sampler's mipLodBias stays 0 whatever the descriptor holds: no bias is past maxSamplerLodBias, and none needs a portability subset's samplerMipLodBias. The binding shape and the sampler word do not carry it either. The runtime's state key does: on the M3 (job m3-max-19683, with and without validation) biases 0 and 1, 1 and 1.0001, and 20 and 30 gave two states each, while 0 and -0, and two NaNs of one encoding, gave one. The key takes the bits of `bias + 0.0`. The Apple10 family row stays a gap, its reason now that the biased level of Apple10 is not built. The conformance suite's SamplerSpec states the bias too (tag 8, a word only where it is not 0, so no recording's fingerprint moves), and both legs set it. METAL-COVERAGE lists lodBias as implemented; CONFORMANCE-COVERAGE and the API signature table are regenerated. Tests: metal::sampler::a_lod_bias_makes_the_unbiased_sampler covers every committed profile, every mip filter, three filter pairs and four uses plus the unnormalized one, and 15 biases: the Vulkan sampler and the binding shape are the zero bias's. That includes MoltenVK, which withholds samplerMipLodBias, and biases past every device's limit. runtime_lane::lod_bias::a_sampler_s_lod_bias_reads_the_unbiased_level runs a kernel's biased samples through runtime sampler states of ten biases, under linear and nearest mip filters, and compares them bit for bit with the unbiased state's. It also checks the state-sharing rule. |
||
|
|
5e51dc6023 |
METAL-COVERAGE names the macOS 27.2 SDK its table was checked against
coverage.py's SDK line still said the macOS 27.0 SDK (Xcode 27.0, 27A266a), while the M3 has Xcode 27.2 (27B52) and its MacOSX27.2.sdk; the generated enum tables already name 27.2. The table needed no row change: on the M3, coverage.py --sdk against MacOSX27.2.sdk answered 'coverage.tsv names every SDK item (2135)', rc 0 (potluck job m3-max-13567). docs/METAL-COVERAGE.md regenerated (coverage.py), coverage.py --check current. (cherry picked from commit ca8424427caaa8636587eb5593e7b91b68afe9b1) |
||
|
|
b8f7b5a7f9 |
Answer minimumLinearTextureAlignmentForPixelFormat: from the device's images, per format
The query answered 16 for every format on every device, Metal's answer on an Apple GPU. On RADV a texture at 16 never goes in place over host pages: its linear images lay rows at multiples of 256 and align their memory to 256, and DRM explicit layouts take only multiples of 256. A guest that lays its buffers out by the answer then gets shadows where 256 would have given images in place. The answer is now the device's, worked out lazily at a format's first query. The runtime makes the images a 2D ShaderRead texture over host pages takes in place (in_place_unbound, the product's own maker: the driver's linear image made for host allocations at the texture's pitch, else the DRM_FORMAT_MOD_LINEAR one). It tries each power of two P from 16 to 4096, at widths of 1 to 1920 texels and 3 rows. The answer is the first P at which every width's image lies at roundup(width * texel, P) and its memory alignment divides P. Each image is released and never bound. - The first answer is kept for the device's life. - Each answer is recorded per driver, runtime and format in the shader cache's content directory. - A device that imports no host pages, a format no P brings in place, and a failed probe all answer Metal's 16. - New counts: WorkCounts::linear_alignments_probed and linear_alignments_recalled. Nothing new is refused. LINEAR_ALIGNMENT (16) stays the acceptance rule, and a texture under the answer is made as before: an image in place where the device takes its layout, else the announced shadow. The query moves from DeviceProperties to Device (Device::minimum_linear_texture_alignment_for_pixel_format), since it needs the device's images. DeviceProperties::minimum_linear_texture_alignment_for_pixel_format is removed. The private properties change as follows: - deviceLinearTextureAlignmentBytes and linearTextureAlignmentBytes are the largest per-format answer. - The iosurface pair stays 16. Supporting changes: - texture/in_place_image.rs's in_place_unbound becomes pub(super). - buffer_texture.rs's texel_bytes becomes pub(super). - The unit tests now hold Metal's rule (capabilities::linear_alignment_rule). Tests: - A record test. - runtime_lane::linear_alignments: - Every format's answer is printed. - A texture at the answer over host pages is in place wherever the check passed for reads. - A 64-byte-row texture is made, as a shadow, where the answer is larger. - A second device of the same driver reads the record and probes nothing. Regenerated: api_signatures, docs/REFUSALS.md, docs/METAL-COVERAGE.md (coverage.tsv mapping). Updated: RUNTIME-PORTING.md and the conformance device-queries docs. Verified: python generators only, so far. The builds, unit tests and the lanes on the M3, RADV, lavapipe and NVIDIA run next, and their results go with the tip. (cherry picked from commit d1510f5588e9e5c3ace5acb1622dcd6570408040) |
||
|
|
f118559e73 |
Binary archives: add mesh pipelines, and load a metallib as an empty archive
Two of the conformance ledger's every-venue rows, both of the runtime's archive surface. binary-archive-mesh-adder: BinaryArchive had three of Metal's four pipeline adders. add_mesh_render_pipeline_functions (addMeshRenderPipelineFunctionsWithDescriptor:error:) makes the state as new_mesh_render_pipeline_state does with the default options, answering its error, and keeps the descriptor's archive key (metal_key::mesh). A mesh creation compiles its pipeline whole and looks in no archive, so the add keeps no compiled artifact. Under FAIL_ON_BINARY_ARCHIVE_MISS a mesh creation, which every listed archive missed before, now hits an archive holding its key (binary_archive::mesh_missing). Which fields Metal keys a mesh pipeline by is not measured, so the key holds every field of the descriptor: a creation hits only an add of an equal descriptor, where Metal's hits too, and one differing in a field Metal does not key misses here where Metal's may hit, as the add's and new_mesh_render_pipeline_state's docs say. binary-archive-sources: Metal takes a metallib as an archive (the case's M3 Max recording); container::read refused it as no archive of ours. A file that parses as a metallib (Library::from_metallib, container tags alone) now loads as an archive holding nothing: its lookups miss and it serializes as one nothing was added to. What Metal's archive of a metallib holds is not measured; new_binary_archive's doc says so. The suite's runtime side answers the mesh add through the new call. The ledger's two rows go; api_signatures.tsv gains the method, and METAL-COVERAGE (coverage.tsv) marks the call implemented. Tests: unit tests the_mesh_key_holds_every_field_and_a_lookup_names_the_mesh_function and a_metallib_loads_as_an_archive_holding_nothing; lane test a_mesh_add_is_found_by_its_own_descriptor_and_a_metallib_loads_as_an_ empty_archive (hit, miss before the add and for another color format, the add's error, serialize and reload, the metallib's miss and nothing to serialize). Verified by those tests and a whole lavapipe conformance replay (see the tip report). (cherry picked from commit adadb73f7c2063341e1dbe54fe887a5ceddf86b7) |
||
|
|
570df3cc95 |
Answer maxArgumentBufferSamplerCount from the set-1 sampler array and the sampler limit
What: `DeviceProperties::max_argument_buffer_sampler_count`, Metal's `maxArgumentBufferSamplerCount`: one fewer than the smaller of a set-1 sampler array's elements and the device's maxSamplerAllocationCount (element 0 of the array, and one of the device's samplers, are the neutral sampler's; each state the array holds takes an element and a sampler of its own). The array's elements are a new public translator function, `pipeline::heap_sampler_capacity`: link's heap capacity for a heap of one sampler array with set 0 counting no sampler, the least of the handle table's 65536 entries (TABLE_CAPACITY) and the two update-after-bind sampler limits, 0 where a function cannot read a set-1 sampler array (the layout's features or the module's non-uniform sampled-image indexing). Link's heap_capacity now reads the same limit table (`heap_limits`) and arithmetic (`room`), and heap_set the same layout-feature check (`heap_layout_lacks`), so the sizing and the answer cannot drift. The runtime's `Device::sampler_array` (each state's creation-time check) now calls it too: it was the two update-after-bind limits without the handle table's reach, 500000 on MoltenVK where link makes 65536 elements, so a state past 65535 was not announced as it was made. The device's SamplerCount and the answer read one value, the identity's maxSamplerAllocationCount. Why: the consumer computed it as the least of the two update-after-bind sampler limits and maxSamplerAllocationCount; that misses the handle table's reach (500000 against our 65535 on the M3) and the neutral's element (32768 against 32767 on lavapipe, 4000 against 3999 on NVIDIA). Metal on the M3 Max (macOS 27.0.1) answers 500000 (a Swift query of MTLCreateSystemDefaultDevice, potluck job m3-max-2496), recorded in the field's docs and docs/API.md's accepted differences. Tests: engine_handles::an_argument_sampler_array_has_the_heap_sampler_capacity (link's array equals the function on every committed profile, follows lowered limits, 0 without the features); capabilities:: argument_buffer_samplers_are_one_fewer_than_the_array_and_the_sampler_limit (every committed profile, pinned venue values); the device test argument_sampler_count (the kernel's array, the device's count, the driver's limit and the answer agree; elements-1 states unannounced, the next announced). Verification follows in the branch's report. (cherry picked from commit 7a2b84f15a1dde81e35cbc0b9367962e54d8332f) |
||
|
|
c305c66a7f |
Give mesh pipelines Metal's descriptor limits, state queries and refusals
The mesh descriptor gains Metal's fields, with Metal's defaults:
max_total_threads_per_{object,mesh}_threadgroup, max_total_threadgroups_per_mesh_grid,
the two threadgroup-size-is-multiple-of-width flags, payload_memory_length,
max_vertex_amplification_count (1) and required_threads_per_{object,mesh}_threadgroup. The
descriptor key reads every one.
A compiled mesh pipeline carries MeshPipelineMetalInfo (RenderPipeline::mesh_info), and the
runtime's RenderPipelineState answers Metal's five mesh queries from it, plus the two required
sizes. Each thread limit is the descriptor's maximum, else the function's
[[max_total_threads_per_threadgroup(n)]], else 1024, held to the device's own limit where that is
lower: the task and mesh stages' invocations with VK_EXT_mesh_shader, the compute stage's where
both stages run as compute work. The widths are 32. The grid limit is the descriptor's, else the
object function's [[max_total_threadgroups_per_mesh_grid(n)]], else 2^20, held to
maxMeshWorkGroupTotalCount where mesh functions run natively. Without an object function the
object stage answers 0 and 0, where the M3 Max answers 3 and 32 (an accepted difference).
DeviceProfile::emulates_mesh_shading says how a device runs the stages, so a consumer no longer
copies the compile layer's rule; with the getters, no separate per-stage query is needed.
What Metal refuses is refused as Metal's rule, DescriptorError::MeshPipeline with a
MeshPipelineProblem, measured on the M3 Max (mesh_pipeline_limits.m, plain and under
MTL_DEBUG_LAYER): a required size with an axis of 0, past 1024 threads or past its stage's
maximum, or for an object stage without an object function (process ends); a maximum past 1024,
a function maximum other than the descriptor's, a mesh stage's required size of other threads
than its maximum, and a payload past 16384 bytes (creation errors, codes 3 and 2). An
amplification count of 0 is VertexAmplificationCount, as a render pipeline's; one above 1, which
Metal makes, is NotImplemented(VertexAmplification), recorded in FAST-PATHS' known gaps.
payloadMemoryLength widens the object and mesh functions' payload arena past the declared type
(LoweringInputs::object_payload now reaches the object stage too); an object stage compiled on
its own without it is NeedsInput(ObjectPayload). SEMANTICS_VERSION 1971 and
ARTIFACT_FORMAT_VERSION 488 for that and the new artifact field; the runtime's warm record
format 4 for the descriptor's fields.
Docs: the new_mesh_render_pipeline_state doc now says how each device runs mesh stages, and
what it refuses; API.md's accepted differences gain the mesh pipeline rows. api_signatures
blessed (it also records RuntimeFact::PartialObjectThreadgroups from the partial-threadgroup
commit), api_surface lists MeshPipelineMetalInfo and MeshPipelineProblem, REFUSALS.md,
METAL-COVERAGE.md and CONFORMANCE-COVERAGE.md regenerated.
Tests: engine_mesh's a_mesh_pipeline_answers_metals_mesh_queries_within_the_device and
a_mesh_descriptor_metal_refuses_is_refused_as_its_rule over every committed mesh and
emulating profile; the validation lane's
a_mesh_state_answers_metals_queries_and_refuses_what_metal_refuses on a device. Not yet built:
the next steps are the M3, lavapipe and RTX 5080 runs.
(cherry picked from commit d6934967fad363ca2185c49935204141f253b416)
|
||
|
|
61a9508e92 |
Build visibilityResultType: Accumulate takes a pass's results into the buffer's words
RenderPassDescriptor gains visibility_result_type (MTLVisibilityResultType: Reset, the default and today's behaviour, and Accumulate). Under Accumulate no query result is copied over its offset's word: every query of an offset, the first one too, is copied into the upload region the continuations already use, and the crate-owned combine takes them into the word as the buffer holds it. The combine already loaded the destination word as its accumulator, so Accumulate is the first query becoming one more source. A `Boolean` word ORs the device's results in; a `Counting` word is summed in through a new table mode of the combine, into the word's low 32 bits alone, wrapping there, its high 32 bits kept (ContinuedResult::low_half / in_low_half). That last part is what the M3 Max answered when recorded: 0xffff_fff8 plus 16 samples writes 8, and 0xffff_ffff_ffff_fff8 plus 16 writes 0xffff_ffff_0000_0008. A plain 64-bit sum was divergent there. An offset set with no draw after it keeps its word, because a query with no draw adds 0. Where a no-copy buffer's bytes start off a multiple of 8, so the results land in an upload region, the words are now copied into that region before the combine (Landing::inward). Reset records exactly what it did before. Conformance: RenderPass gains visibility_type (typed()), and words() appends it only where it is not Reset, so existing fingerprints read as before. Both sides set it. There are four new visibility cases, recorded on the M3 Max (macOS 27.0.1): visibility-counting-accumulate (two command buffers; words 100/5/7/0xffff_fff8/u64::MAX-7), visibility-counting-accumulate-one-command-buffer (two passes in one command buffer, read once), visibility-counting-accumulate-revisit, and visibility-boolean-accumulate (words 0/2/3 under covering and non-covering draws, an offset set with no draw, then a second command buffer). The family's acts key states the type, and a joined shape adds a command-buffer input. Cost and timing records for the new cases are not written here. Lane tests (runtime_lane): accumulated_counts_add_to_the_words, accumulated_booleans_or_into_the_words, and host_bytes::accumulated_visibility_results_land_where_their_bytes_lie. Unit tests: the combine's accumulated_counts_are_summed_into_the_low_half, its plan's table mode, and the type's raw values. Coverage: coverage.tsv marks MTLRenderPassDescriptor.visibilityResultType implemented (its unused "visibility" group is removed), and METAL-COVERAGE.md is regenerated. MTLVisibilityResultType joins the enum table, so metal_enumerators.tsv and CONFORMANCE-COVERAGE.md are regenerated. The API signatures are re-blessed. REFUSALS.md is regenerated: VisibilityResultType::from_raw is one more UndefinedValue site. The regeneration also picks up two bind/graphics.rs sites the committed file was missing. The degrade docs (landed results, Boolean) state Accumulate. Verified on the M3 Max under MoltenVK 1.4.2: - The 52 visibility-touching lane tests pass: visibility, host_bytes, depth_never, amplified_draws, degrade_notices and the framebuffer_fetch split pass. - The visibility family's replay is all announced (no divergence), after the low-half change. - Negative control with Accumulate forced to Reset: all three Accumulate lane tests fail, and all four new cases replay divergent. - Negative control with no inward copy: the landing test fails at 4 bytes past a page (2 read 0, 100 read 16). - Before the low-half change, visibility-counting-accumulate replayed divergent at words 3 and 4. - The combine's low-half test fails on the interpreter without the high-half select ([8, 1] for [8, 0]). clippy (plain and --cfg m2v_gpu), rustdoc and scripts/api-docs are clean. SEMANTICS_VERSION: no translated shader changes, but the owned combine module's words do (main's call). RUNTIME_VERSION and the runtime-sources pin are not touched here. (cherry picked from commit 1c172968ad6492cebcae2a568fc99e90565d4d11) (cherry picked from commit 9f47ebcf006920f7561a16a77f77e422de7201c1) |
||
|
|
81441ca877 |
Regenerate the surfaces for pull-model interpolation
- RUNTIME_VERSION 1719: the runtime answers supportsPullModelInterpolation and refuses a draw reading an interpolant at a sample at custom positions. - scripts/metal-coverage/coverage.tsv: supportsPullModelInterpolation implemented (DeviceProperties::supports_pull_model_interpolation); docs/METAL-COVERAGE.md and docs/CONFORMANCE-COVERAGE.md regenerated. - docs/REFUSALS.md regenerated: feature::PullModelInterpolation and gap::InterpolateAtSampleWithPositions (reach rows in reach.tsv). - crates/metal2vulkan/tests/api_signatures.tsv blessed: additions only but Query::ALL's length (8 to 9) and value. - crates/metal2vulkan-runtime/README.md: the query and what differs. - runtime-sources pin recomputed (pin-compute.py). Verified: refusal_surface.py --check, signatures.py --check, metal-coverage --check and conformance-coverage --check all current. (cherry picked from commit 2dcbbf39b6e5caeb3e87079d7f2f36540ceb0dd0) |
||
|
|
ceb666187a |
Answer Metal's supports32BitMSAA from the device's own textures
The runtime had no answer for supports32BitMSAA (METAL-COVERAGE listed it missing), so the consumer passed None through. Metal's answer promises a multisample texture of each 32-bit integer format and the resolve of each 32-bit float one; the M3 Max, a Radeon Pro 5300M and a UHD 630 all answer 1. What the runtime did before was read first: a multisample texture of each of the nine formats is planned as any texture is (image_plan), within the device's limits for the image (vkGetPhysicalDeviceImageFormatProperties2), and refused as a count its format lacks; draws and texture2d_ms reads of it, the float formats' AVERAGE resolves (Metal's own on MoltenVK, device-rounded-resolve elsewhere) and the refusal of an integer resolve (ResolveFormat, as Metal stops it) were all in place. The render pipeline, sample planes and interleave all take a format's own counts beside framebufferIntegerColorSampleCounts. Nothing was wrong; the query was missing. Device::supports_32bit_msaa answers yes where the device makes every texture and resolve the answer promises, each probed exactly as pixel_format_capabilities probes a capability (the probe closure of families::formats::answers is now a function both share): the texture sample counts hold 4, a 2D multisample RenderTarget|ShaderRead texture of each of the nine formats is made at every count above 1 the textures take, and each float format resolves (its Resolve capability). A device method, as supports_family is, because it reads the device's per-format limits: Vulkan floors an integer format at framebufferIntegerColorSampleCounts, one sample on RADV and lavapipe, while their 32-bit integer formats each take 1 to 8 (1, 4, 8 on lavapipe), as the venue profiles' captured per-format counts state. Tests: - runtime tests::msaa_32bit: every committed profile pinned, with the limits it states (a venue profile's own per-format color attachment counts, else Vulkan's floors). Yes on every venue (moltenvk-m3, both 780M RADV, both gate lavapipe, the ANV and NVIDIA ones) and on the Intel and NVIDIA profiles whose floors cover the counts; no on amd-rdna2/rdna3-radv, lavapipe, lunarg-desktop-baseline-2023, swiftshader and vk12-floor (R32Uint at the lowest count, naming FramebufferIntegerColorSampleCount), and roadmap-2022 (no 4 samples). A yes agrees with each format's Msaa and float Resolve capabilities; the rule needs 4 and every count, and a missing resolve texture says so. A negative control that probes 4 samples alone fails two of them. - validation runtime_lane::msaa_32bit (--cfg m2v_gpu): the answer is what the device makes; R32Uint and RGBA32Uint targets at 2 and 4 drawn at sample rate hold every bit, read back through texture2d_ms<uint> (Metal: every channel as written); an RG32Float 4-sample target keeps its samples and resolves to the probe's Metal texels, exact where the driver's average is Metal's; an RGBA32Uint resolve is refused. Verified: runtime tests msaa_32bit, families and capabilities, the metal_coverage and runtime-sources pin tests; on the M3 Max (MoltenVK 1.4.2, macOS 27.0.1) through the Mac GPU lock, runtime_lane msaa_32bit, families and capabilities 7/7: supports32BitMSAA true, counts [2, 4], nothing refused, 0 integer channels differ, 32 of 32 resolved channels as Metal's, device-rounded-resolve not announced. clippy with all features and with --cfg m2v_gpu, rustdoc -D warnings, refusal_surface --check (no refusal moved), api-signatures (one method added), METAL-COVERAGE and CONFORMANCE-COVERAGE regenerated (the item now implemented, not yet exercised by the suite). RUNTIME_VERSION 1718 (a new answer); runtime sources re-pinned. (cherry picked from commit 2376157b3bf7bf99221579f42a795ef351b8144c) |
||
|
|
9d783a4e3a |
Run the emulation's wrapped indirect object grids, reporting Metal's wrapped grid
Content: the tree of `development` at f976f1035d, unchanged. |
||
|
|
b0b61ac179 |
Time a fault that later failing encoders follow as Metal's GPU reaches them
The steps this packet landed as, in order: - Stop a running predicated loop at the GPU's recovery from a fault or a hang - Resolve multisampled extended-range targets by Metal's measured rules - Run the emulation's indirect mesh draws with an object function Content: the tree of `development` at 60cf488339, unchanged. |
||
|
|
1d494932f7 |
Clear the object-grid lane's targets to zero before reading them as drawn nothing
The steps this packet landed as, in order: - Run any object grid Metal runs, in pieces within the task stage's limits - Upload a folded object draw's fold when it launches nothing too - Run an unfolded object stage's direct grid as Metal does when its threads wrap - Bump the semantics, artifact format and runtime versions for the seventh stack - Pin the runtime sources of the seventh stack - Bless the golden hash tables over the seventh stack Content: the tree of `development` at a6f6b269ad, unchanged. |
||
|
|
54e399ca25 |
Draw indirect mesh grids as Metal does, through an arguments pass on mesh-shader devices
The steps this packet landed as, in order: - Regenerate the refusal surface after the indirect mesh draws - Read the task limits through the profile's public limits in the mesh draws lane - Name VK_EXT_post_depth_coverage in the candidate's enable list - Re-bless the opened chains, and let a late depth test behind an imageblock writer link - Withhold the mesh shader extension's features with it in the mesh lane Content: the tree of `development` at 3e1d7fbbe1, unchanged. |
||
|
|
787d92fdc2 |
Answer a heap texture's allocatedSize from the place that holds it
The steps this packet landed as, in order: - Answer a kept heap texture requirement before asking the device's limits - Answer whether a command buffer or submission uses given objects, cloning nothing - List devices' registry IDs without making devices, and open one by its ID - Give a made pipeline state's reflection from its compile, after its creation - Enable optional device extensions where each device can, and say which it enabled - Let a caller vouch for its host pages' write permission, skipping the kernel's answer - Import read-only host pages from the caller's dma-buf source, and say whether a device takes shared pointers - Hold a texture of Apple's private usage 0x8 alone to what Metal does with it - Measure RADV 26.2.4 on the RX 7900 XTX: its pointer imports follow their address - Free a no-copy buffer's dma-buf imports before its keep-alive goes - Measure a file's pages mapped under a live RADV pointer import, a known gap - Let what waits for a dma-buf import's free go as its fields drop Content: the tree of `development` at 0a38130573, unchanged. |
||
|
|
0175289314 |
Batch the development-fast round: tessellation without tessellationShader, primitive ids, mesh tooling, color groups, the vk12 floor, runtime timing and teardown fixes
One commit of the 247 on development-fast (720ef1ce9a..9f46fdf80d), squashed at the user's request. Translator: - Tessellation on a device without tessellationShader: Metal's tessellator emitted as SPIR-V, a one-workgroup scan placing each patch's triangles in Metal's order, and the post-tessellation function as a plain vertex stage (EmulatedTessellationDraws; SEMANTICS 1739, ARTIFACT_FORMAT 419). - [[primitive_id]] on a device without geometry or tessellation shaders, as a flat varying the vertex function writes; indexed lists, lines and points drawn de-indexed (RuntimeGap::PrimitiveIdIndices). - Fragment functions of more colors than the device draws at once, compiled in color groups (PrecisionNote::ColorAttachmentGroups). - Object functions' threadgroup memory from the render encoder; a kernel's mesh draws from an indirect command buffer; mesh payload sizing. - The Vulkan 1.2 floor profile (vk12-floor) and the gates it needs; Metal 27.0.1 answers as the M3 Max. - Overflow tests in the runtime-built modules by the product's high word (NVIDIA's compiler fails the division form), guarded crate-wide by tests::owned_divisions. Runtime: - Color-group passes replayed per group over twin depth/stencil; snapshot and copy-back cost cuts. - Command buffers finish on the queue waiter that saw them; the waiter holds no device handle, so a program's drop after its wait is the device's last. - Every object an encoder was handed held until its command buffer completes; deallocator order and announcements. - Driver defects recorded and announced: ANV counts a visibility sample once per color output (visibility-count-per-color); MoltenVK fails pending work when memory that held a device-address buffer is freed, so freed memory waits for the work in flight (host-deallocator-delayed). - RenderCommandEncoder::set_object_threadgroup_memory_length; Visibility::counting(). Validation: mesh tooling (object, mesh and ICB-mesh cases on both executors), the authoring census closed, the queue storm judged in Metal's unit, load-robust exits and indirect-census bounds, and the golden hashes, printouts, fixture inventory and authored compile census blessed. Docs: FAST-PATHS.md trimmed to a ledger of what is true now; API.md's catalogue and accepted differences, REFUSALS.md and METAL-COVERAGE.md current. Verified on development-fast before the squash: the full suites on the RTX 5080, RTX 3090, RX 7900 XTX, Radeon 780M, Iris Xe, lavapipe and the M3 (MoltenVK and the Metal oracle), lint in every configuration, rustdoc, doc tests, packaging and public case qualification; the timing and teardown lanes x5 on every venue; the authoring-capability census 16656/16656 with 0 unresolved, the vk12-floor translation census at 6139 translated with the slowest row 794 ms and peak 126 MiB. The tree is development-fast's at 9f46fdf80d. |
||
|
|
13b279df1b |
Squash 11203 commits of translator, runtime, and validation work
Rolls up everything since
|