Count this round's crossings, and measure the ones the pairs ledger cannot say
Content: the tree of `development` at e5730ba29c, unchanged.
This commit is contained in:
1 parent
fb509859c5
commit
80897130a4
6 files changed
+816
-101
No files matched your search
@@ -6,7 +6,7 @@ This is not [METAL-COVERAGE.md](METAL-COVERAGE.md), which says what we **impleme
|
||||
|
||||
It says it along **two axes**, because either one alone reads as more than it is. The **items** axis is reach: one call of a selector is enough, so a selector that takes an enum counts as exercised whatever value reached it. The **option space** axis is depth: of each Metal enum's and option set's values, which ones the suite compared. A high number on the first and a low one on the second is what a suite that touches everything shallowly looks like.
|
||||
|
||||
Both are **per value**, which is the limit the suite's own blind spot sits in: a side can be right about every value of two types alone and wrong about a cell of the two together. *By crossing* inside the option-space axis counts the pairs a case puts to Metal at once, from a declaration the generator checks. It is the only number here about interactions, and it is a floor by every crossing nobody declared.
|
||||
Both are **per value**, which is the limit the suite's own blind spot sits in: a side can be right about every value of two types alone and wrong about a cell of the two together. *By crossing* inside the option-space axis counts what a case puts to Metal at once, from declarations the generator checks: the pairs of the option space, and — counted apart and never added in — the crossings that are no pair of it. They are the only numbers here about interactions, and each is a floor by every crossing nobody declared.
|
||||
|
||||
## What this measures, and what it cannot
|
||||
|
||||
@@ -44,7 +44,8 @@ Its limits, measured rather than asserted:
|
||||
| distinct SDK items the Metal leg reaches, of any status | 797 |
|
||||
| of those, reached only where this cannot name the family | 7 |
|
||||
| ledger rows (a case whose gap is recorded) | 89 |
|
||||
| declared crossings of the option space (pairs put to Metal at once) | 15 |
|
||||
| declared crossings of the option space (pairs put to Metal at once) | 21 |
|
||||
| declared crossings that are no pair of it (a boolean or numeric field, or one type in two slots) | 15 |
|
||||
|
||||
A tolerance names a **site of a transcript**, not an item, so the last two rows are read as written: a case that loosens one site of its own transcript may compare every other field of it exactly, and this derivation cannot tell which of a case's fields came from which Metal call. Where the distinction matters, read the case.
|
||||
|
||||
@@ -69,7 +70,7 @@ What this axis cannot see, measured rather than asserted:
|
||||
- **A value a case states as a raw ordinal.** A case may hand the Metal leg an enum's ordinal as a number — a sweep over `0..n` rather than over named variants — and no reading of the text can say which value a computed number is. So *in effect*, and the *stated* column of the hand-modelled table below, are floors by every sweep written that way: a type they report short of its values may in fact be swept exhaustively, and the case is what says so. Read the case before taking a row of the work list as work.
|
||||
- **Which case put a value in effect.** The unit is the case module, as it is for the items axis: a value named anywhere in a module whose cases include a Metal run counts for that module, even where one of its cases names it and the rest do not.
|
||||
- **A value only the suite's shared sources name** — 25 of them. Some case puts it to Metal through the render or texture vocabulary, but which case is not a property of the text, so it is neither compared nor missing and has its own column.
|
||||
- **Combinations.** Every column here is per value. A type whose values are all compared says nothing about the pairs and triples of them, which is where most of the behaviour an implementation can get wrong lives. *By crossing* below counts the pairs a case states together, which is the measure of that and is a floor by every crossing nobody declared.
|
||||
- **Combinations.** Every column here is per value. A type whose values are all compared says nothing about the pairs and triples of them, which is where most of the behaviour an implementation can get wrong lives. *By crossing* below counts what a case states together, in two numbers kept apart: the pairs of this option space, and the crossings that are no pair of it — an enum with a boolean or numeric field, a type with itself in two slots. Each is a floor by every crossing nobody declared.
|
||||
- **Metal's API validation is excluded.** Its complaints name enumerators, and the suite records that leg and never compares it, so reading it would count Apple's prose as a comparison. So are the cost and timing tables: a site name there is what was measured, not an answer that was compared.
|
||||
- **A `#[cfg(test)]` item is excluded.** One of the suite's unit tests names four blend factors to assert that no case uses them; counting those would have this report the opposite of what the code says.
|
||||
|
||||
@@ -163,7 +164,7 @@ Counted apart from the gap above, because a gap is work and these are not. Each
|
||||
- **`MTLPixelFormat`**, 35 of 301: every MTLTextureDescriptor bearing it fails `-[MTLTextureDescriptorInternal validateWithDevice:]` with `has invalid pixelFormat` and the process ends on SIGABRT: measured over 350 shapes on an M3 Max / macOS 27.0.1 (all eight non-multisample texture types, both storage modes, newTextureWithDescriptor: and heapTextureSizeAndAlignWithDescriptor:), every one fatal and not one answering nil.
|
||||
Held by `cases/format_footprints.rs`: `MTLPixelFormatBGRA10Uint`, `MTLPixelFormatBGRA10Uint_PACKED`, `MTLPixelFormatBGRA10Unorm`, `MTLPixelFormatBGRA10Unorm_HLG`, `MTLPixelFormatBGRA10Unorm_PACKED`, `MTLPixelFormatBGRA10Unorm_PACKED_HLG`, `MTLPixelFormatBGRA10Unorm_PACKED_PQ`, `MTLPixelFormatBGRA10Unorm_PACKED_sRGB`, `MTLPixelFormatBGRA10Unorm_PQ`, `MTLPixelFormatBGRA10Unorm_sRGB`, `MTLPixelFormatBGRA10_XR_PACKED`, `MTLPixelFormatBGRA10_XR_PACKED_sRGB`, `MTLPixelFormatR10Uint_PACKED`, `MTLPixelFormatR10Uint_X6`, `MTLPixelFormatR12Uint_PACKED`, `MTLPixelFormatR12Uint_X4`, `MTLPixelFormatRG10Uint_PACKED`, `MTLPixelFormatRG10Uint_X12`, `MTLPixelFormatRG12Uint_PACKED`, `MTLPixelFormatRG12Uint_X8`, `MTLPixelFormatRGB10A8Uint_2P`, `MTLPixelFormatRGB16Bfloat`, `MTLPixelFormatRGB16Float`, `MTLPixelFormatRGB16Sint`, `MTLPixelFormatRGB16Snorm`, `MTLPixelFormatRGB16Uint`, `MTLPixelFormatRGB16Unorm`, `MTLPixelFormatRGB32Float`, `MTLPixelFormatRGB32Sint`, `MTLPixelFormatRGB32Uint`, `MTLPixelFormatRGB8Sint`, `MTLPixelFormatRGB8Snorm`, `MTLPixelFormatRGB8Uint`, `MTLPixelFormatRGB8Unorm`, `MTLPixelFormatX24_Stencil8`
|
||||
|
||||
### By crossing, which is depth in the pairs
|
||||
### By crossing, which is depth in the combinations
|
||||
|
||||
Every column above is per value, and the pairs are where most of the behaviour an implementation can get wrong lives: a side can be right about each value of two types alone and wrong about a cell of the two together. This counts the crossings, which is a third thing again — not reach, not per-value depth, but how many **pairs of the option space** a case puts to Metal at once.
|
||||
|
||||
@@ -173,18 +174,18 @@ What this axis cannot see, stated rather than implied:
|
||||
|
||||
- **Whether the expected answer needs both axes.** No reading of the text can say that: it is a property of the case's reasoning. The last column says it in words, for a reader to check against the case, and the refusals above check only that the claim is **stateable** — that the module varies both axes and the cell ran Metal.
|
||||
- **A crossing nobody declared.** Every number here is a floor by exactly that. A family that crosses two types and carries no row counts for nothing, so this axis grows by declaration and not by discovery.
|
||||
- **An axis that is not a Metal enum or option set.** A crossing of a type with a number — a stencil mask, a per-sample depth, a draw count — or with a grouping that is not a Metal type, such as a pixel format's class, is real depth this count does not hold. The option space is what it measures, as the columns above do.
|
||||
- **A type crossed with itself in two slots**, which the two stencil faces are: an axis may not be named twice, so such a cross is outside the count.
|
||||
- **An axis that is not a Metal enum or option set.** A crossing of a type with a boolean or numeric Metal field — `alphaToCoverageEnabled`, a LOD clamp, an extent, a reset range — and a type crossed with **itself in two slots**, which the two stencil faces are, are real depth and are no pair of this option space. They are **not** uncounted: they are declared in `other_crossings.tsv` and counted in their own table below, apart from these numbers and never added into them.
|
||||
- **An axis that is no Metal item at all.** A pixel format's class, the shape of a shader's output, whether a fragment writes its own sample mask: neither file can name one, because neither has anything to check such an axis against. That depth is in the suite and in no count here.
|
||||
- **A module that takes its value list from the suite's shared vocabulary** states none of those values itself, so its cross cannot be declared until the module names them. The per-value columns above hold such values in their own *shared only* column for the same reason.
|
||||
- **Which cell varies which axis.** The values are read from the **module's** text while the claim is about a cell of it, so a module whose cases each fix one axis reads as varying both. `family` says outright that the cross is read across the cases; a named cell is the one case the row's reasoning is read at.
|
||||
- **A triple told apart from three pairs.** A row of three axes counts as its three pairs, and an interaction no pair of its axes can see is not distinguished from them.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| crossings declared | 15 |
|
||||
| distinct pairs of Metal types crossed | 16 |
|
||||
| types in at least one crossing | 18 |
|
||||
| types with two or more values compared and in no crossing | 30 |
|
||||
| pairs of the option space declared | 21 |
|
||||
| distinct pairs of Metal types crossed | 20 |
|
||||
| types in at least one such pair | 21 |
|
||||
| types with two or more values compared and in no crossing of **either** table | 26 |
|
||||
|
||||
| case module | cell | crossed | what only the cross decides |
|
||||
|---|---|---|---|
|
||||
@@ -199,19 +200,65 @@ What this axis cannot see, stated rather than implied:
|
||||
| `fetch_ordered` | its cases | `MTLColorWriteMask` x `MTLPixelFormat` | which memory bytes a channel mask keeps, which the format's channel order decides: a side that wrote the attachment through a channel-swapped view without swapping the mask is exact on one format and divergent on the other |
|
||||
| `format_footprints` | its cases | `MTLPixelFormat` x `MTLTextureType` | which texture types Metal describes a texture of, which is the format's to decide: the one-plane `YCBCR*` and `RGB10A8_2P` formats answer a size and **no texture** for `Cube` and `CubeArray` and a texture for the other six types, while the padded and plain formats answer a texture for all eight |
|
||||
| `heap_metal_sizes` | `heap-sizes-block-writes-only` | `MTLTextureUsage` x `MTLPixelFormat` x `MTLTextureType` | whether Apple's private `BlockWritesOnly` usage bit changes a heap answer. Every shape is recorded with the bit and without it, so a side whose layout depends on the bit for one format or one texture type and not another diverges in a cell while the bit alone and each format alone are right |
|
||||
| `indirect_command_depth` | `indirect-render-commands-patch-draws` | `MTLIndirectCommandType` x `MTLTessellationControlPointIndexType` | whether an indirect patch draw reads its control-point indices from the command or from the pipeline that command holds. The buffer's descriptor declares both patch-draw types and each command carries its own pipeline, so the indexed type is the pipeline's and the index buffer is the command's argument: a side that encoded one command's type against the other's pipeline marks the grid the other owns, while the command types alone are a sweep and the index type alone is a direct draw's question |
|
||||
| `int_attributes` | `integer-vertex-attributes` | `MTLVertexFormat` x `MTLVertexStepFunction` | whether the conversion of an integer attribute is the same whichever step function fetched the record. Metal's constant step is a fetch no fixed-function vertex input can express, so a side whose shader-pulled path converts unlike its fixed-function one is right about every format and every step function alone |
|
||||
| `pixel_samplers` | its cases | `MTLPixelFormat` x `MTLSamplerMinMagFilter` x `MTLSamplerAddressMode` | what a pixel-coordinate sample reads at and past the texture's edge: the address mode decides which texel a tap outside falls on, the filter decides how many taps there are, and the format decides what their average rounds to. The family's sixteen cases are the cells |
|
||||
| `render_state` | `render-state-facing` | `MTLCullMode` x `MTLWinding` | which of a triangle and its reverse survives a draw: flipping the winding flips it and flipping the cull mode flips it back, so neither setting's own value decides anything and a side that reads one and not the other draws the wrong one of the pair |
|
||||
| `sampler_crossings` | its cases | `MTLSamplerBorderColor` x `MTLSamplerAddressMode` | whether a border-reading mode on one axis substitutes the border for a tap another axis put out of range. One case a border colour, and six address triples that put the border-reading mode on `s` alone, on `t` alone, on `r` alone and on all three: the sweeps that compared every colour read the border on `r` with `s` and `t` inside the texture, so no row of them asks which axis's mode the substitution follows |
|
||||
| `sampler_crossings` | its cases | `MTLSamplerMinMagFilter` x `MTLSamplerMipFilter` | which level a sampler reads when the LOD clamp raises the requested one, and with which of the two filters -- `NotMipmapped` ignores the clamp outright, and the two mip filters pick their level and then their filter. The filter sweep samples at texel centres where a linear footprint is one texel, and the mip sweep pins both filters to nearest and says so, so neither can tell the three rules apart |
|
||||
| `sampler_crossings` | `sampler-compare-filter-pairs` | `MTLCompareFunction` x `MTLSamplerMinMagFilter` | whether Metal filters the comparison's **results** or compares a filtered depth. Sixteen cells of every comparison against a nearest and a linear filter, sampled where four texels carry the footprint at weights of a quarter each and at 9/16, 3/16, 3/16 and 1/16: the comparison sweep samples at texel centres, where a linear footprint is one texel and all eight comparisons read the same under either rule |
|
||||
| `shader_stencil` | `stencil-output` | `MTLCompareFunction` x `MTLStencilOperation` | which operation a fragment's `[[stencil]]` output fires, under a state whose two faces carry different comparisons and different operations: a side that fired the pass operation where the comparison failed writes a byte the comparison alone and the operation alone both allow |
|
||||
| `texture_descriptor_pairs` | `texture-pairs-usage-crossings` | `MTLTextureUsage` x `MTLPixelFormat` | which crossings of a usage with a format Metal's texture descriptor takes, and what it makes of them. `ShaderWrite` on `BC1_RGBA`, on `ASTC_4x4_LDR` and on `Depth32Float` each answer a texture of usage 0x3 and `RenderTarget` on the two block-compressed formats one of 0x4, where `ShaderAtomic` is fatal on every format but `R32Uint`: so the descriptor is where a guess puts the refusal and the pair is what says Metal does not put it there |
|
||||
| `texture_descriptor_pairs` | `texture-pairs-usage-crossings` | `MTLTextureUsage` x `MTLTextureType` | whether a usage bit that bars lossless compression bars it in every texture type. A 1D texture of 5000 texels answers 32768 bytes under `ShaderRead` and under `ShaderRead | PixelFormatView` alike, because its height is 1 and no usage of it is ever compressed, where the same two usages part by 128 bytes on a 64 by 64 2D texture -- so the usage sweep in one type reads as the bit always moving the footprint |
|
||||
|
||||
#### Crossings that are not pairs of the option space
|
||||
|
||||
The table above counts pairs of two Metal **enums**, because that is what the per-value columns measure the depth of. A crossing of an enum with a Metal field that is a **boolean** or a **number**, and a crossing of one type with **itself in two or more slots**, is depth of the same kind and is no pair of that space. These are declared in `scripts/conformance-coverage/other_crossings.tsv`, in rows of the same four fields, and counted here. **The two counts are never added together**: one says how much of the option space's own grid a case puts to Metal, the other how much interaction the suite holds that the option space cannot express, and a sum of them would say neither.
|
||||
|
||||
An axis there is a Metal enum with a generated value list, which **may** be named more than once — that repetition is the type-in-two-slots crossing and the count of names is the count of slots — or one Metal item of one Metal type, spelled as the items axis keys it (`MTLRenderPipelineDescriptor.alphaToCoverageEnabled`, `MTLArgumentEncoder.setArgumentBuffer:offset:`).
|
||||
|
||||
**This document is not written** if such a row names a module no case of which ran Metal, a cell that is not one of that module's recorded cases, fewer than two axes, nothing that the cross decides, or an **enum** axis of which the module's own text states fewer than two values by name. Three refusals are this table's own:
|
||||
|
||||
- **a row every axis of which is a Metal enum named once.** That is a pair of the option space: it belongs in the table above, under the check that the module states two values of each axis, and a row parked here would be the same claim under a weaker rule;
|
||||
- **a field axis `objc2-metal` binds no such item for, or one this module's Metal leg reaches no call of.** The second is the items axis's own join, so a field axis names a call this document already reports as exercised rather than a word a row's author chose;
|
||||
- **a field axis whose call answers a Metal type with a generated value list.** Such a field is an enum under another name — `MTLTextureDescriptor.storageMode` is one — and naming it as a field would dodge the two-values check the enum spelling carries.
|
||||
|
||||
What **cannot** be checked for a field axis, and is therefore what only a reader can check: that the module put **two values** of the field to Metal. A boolean's two values and a number's range are nowhere in the text this reads and in no recording's transcript, so a field axis carries the field being Metal's and this module's leg setting it, and nothing about variation. An enum axis carries the two-values check here exactly as it does above, which is why a row's enum axes are the stronger half of it. The last column, as above, is for a reader against the case.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| crossings declared that are not pairs of the option space | 15 |
|
||||
| of those, naming a type in two or more slots | 4 |
|
||||
| of those, naming a Metal field that is a boolean or a number | 12 |
|
||||
| distinct Metal fields crossed | 17 |
|
||||
| distinct Metal types crossed with themselves | 3 |
|
||||
|
||||
The two *of those* rows are not a partition and do not sum to the first: a row may name both, as the sampler row crossing its two filter slots with a LOD clamp does.
|
||||
|
||||
| case module | cell | crossed | what only the cross decides |
|
||||
|---|---|---|---|
|
||||
| `alpha_coverage_pairs` | `a2c-on-4-alpha-50-mask-no-alpha` | `MTLRenderPipelineDescriptor.alphaToCoverageEnabled` x `MTLColorWriteMask` | whether the alpha the coverage is read from is the fragment's own or what survives the attachment's write mask. A mask that drops alpha leaves the coverage exactly as the same alpha gives with the mask absent and moves only the stored alpha: the mask's own sweep reads a stored channel and never a coverage, and the alpha sweep never meets a mask |
|
||||
| `alpha_coverage_pairs` | `a2one-on-1-blend-source-alpha` | `MTLRenderPipelineDescriptor.alphaToOneEnabled` x `MTLBlendFactor` | whether alpha-to-one replaces the alpha before or after the blend reads it. Under RGB factors of `SourceAlpha` and `OneMinusSourceAlpha` the field on stores the source alone and off stores it blended at 0.5, so the blend read 1 and not 0.5 -- where the field alone moves only the stored alpha and the blend alone gives the 0.5 answer at any setting |
|
||||
| `alpha_coverage_pairs` | its cases | `MTLRenderPipelineDescriptor.alphaToCoverageEnabled` x `MTLRenderPipelineDescriptor.rasterSampleCount` | whether the coverage an alpha gives is `floor(alpha * rasterSampleCount)` or a round to nearest. At four samples an alpha of 0.5 covers two under either rule; the one-sample row is where they part, and it covers **none**, so the destination survives untouched where rounding would have stored the fragment. Neither sample count alone says which rule it is |
|
||||
| `argument_encoder_crossings` | `argument-encoder-cross-offsets` | `MTLArgumentEncoder.setArgumentBuffer:offset:` x `MTLArgumentEncoder.setArgumentBuffer:startOffset:arrayElement:` | whether the two offsets compose or the second replaces the first. Over the 48-byte layout `(0, element 1)` writes word 6 and `(8, no element)` word 1, and `(8, element 1)` writes word 7 -- the cell neither call alone reaches. `constantDataAtIndex:` answers the constant's offset inside the arguments and so the same number at every cell, which is why the written mask is the site that reads it |
|
||||
| `argument_encoder_crossings` | `argument-encoder-cross-type-mixtures` | `MTLArgumentDescriptor.constantBlockAlignment` x `MTLDataType` | whether `constantBlockAlignment` aligns the constant's offset inside the arguments or the encoder's own alignment. A single `MTLDataTypeUInt` at a block alignment of 64 is 4 bytes aligned to 4 -- the field changes nothing, because offset 0 is aligned to anything -- and a texture in front of it moves that constant to offset 64 and the encoder to 72 bytes while its alignment stays 8. So the field is indistinguishable alone and load-bearing one argument later |
|
||||
| `argument_encoder_crossings` | `argument-encoder-cross-type-sizes` | `MTLDataType` x `MTLDataType` | whether a member's offset is a running sum of the members before it or a packing Metal may order. `char, char, float4, float4` is **48** bytes and `float4, char, float4, char` -- the same multiset -- is **64**, so a sweep of one type at a time sees two encoder lengths and only the permutation sees the layout |
|
||||
| `indirect_command_depth` | `indirect-compute-commands-reset-and-ranges` | `MTLIndirectCommandBuffer.resetWithRange:` x `MTLComputeCommandEncoder.executeCommandsInBuffer:withRange:` | which commands of a buffer wrote anything, which the two ranges decide together: a command is blank where the reset covers it and runs where the execution does. A side that reset the executed range, or executed the reset one, is right about each range's own bounds and writes another command's segment |
|
||||
| `indirect_command_depth` | `indirect-render-commands-inherited-state` | `MTLIndirectCommandBufferDescriptor.inheritBuffers` x `MTLIndirectRenderCommand.setVertexBuffer:offset:atIndex:` | which binding an executed command draws from when the parent encoder and the command have each bound one. With the field off the command's own binding is the only one there is, and with the command setting none the parent's is: each alone names a segment of the output, and only the pair says which of the two wins where both exist |
|
||||
| `indirect_command_depth` | `indirect-render-commands-under-the-pass-state` | `MTLRenderCommandEncoder.setScissorRect:` x `MTLIndirectRenderCommand.drawPrimitives:vertexStart:vertexCount:instanceCount:baseInstance:` | which pixels an indirect draw covers, which the parent encoder's scissor and the command's own vertex range decide together -- a render command may not set a scissor of its own, so a side that dropped the pass's state at the execution rasterizes each half of the draw in full while being right about the scissor alone and about the draw alone |
|
||||
| `sampler_crossings` | its cases | `MTLSamplerMinMagFilter` x `MTLSamplerMinMagFilter` x `MTLSamplerDescriptor.lodMinClamp` | which of the two filters reads the level `lodMinClamp` raised the requested one to. The two `(min, mag)` pairs whose filters agree answer the same under every rule, so only an unequal pair at a clamp above the sampled level parts Metal's rule from Vulkan's -- the magnifying filter at a level of zero or less, the minifying one above it -- and from a `NotMipmapped` sampler's, which ignores the clamp outright |
|
||||
| `sampler_crossings` | `sampler-axis-border-opaque-black` | `MTLSamplerAddressMode` x `MTLSamplerAddressMode` x `MTLSamplerAddressMode` | whether a border colour is substituted per **axis** or for the sample. On a lane whose `s` is inside the texture and whose `t` is a period out, a sampler whose `s` mode is `ClampToBorderColor` and whose `t` mode repeats reads either the border or the wrapped texel, and no sampler whose border-reading axis is itself the out-of-range one can part the two readings |
|
||||
| `sampler_crossings` | `sampler-axis-mode-triples` | `MTLSamplerAddressMode` x `MTLSamplerAddressMode` x `MTLSamplerAddressMode` | whether each axis's own mode decides that axis's wrap. Three **unequal** modes over a grid of one inside coordinate and four outside are what tell it from a decision taken on the coordinate as a whole, or from one axis's mode applied to all three: every sampler whose axes agree, and every sweep that moves one axis with the others repeating, reads the right texel under all three rules |
|
||||
| `texture_descriptor_pairs` | `texture-pairs-plain-contents` | `MTLTextureDescriptor.allowGPUOptimizedContents` x `MTLTextureUsage` | whether lossless compression is a **conjunction** of the flag with the usage or either one's doing. The flag off answers the uncompressed footprint at a usage that would have compressed, and at `ShaderRead | PixelFormatView` it moves nothing because the usage already barred it: so neither the flag's own sweep nor the usage's says which of the two switches moved the number |
|
||||
| `texture_descriptor_pairs` | `texture-pairs-type-levels-slices` | `MTLTextureType` x `MTLTextureDescriptor.mipmapLevelCount` x `MTLTextureDescriptor.arrayLength` | how many bytes a mip chain takes and how many levels Metal allows, both of which are the **type's** to decide. An 8 by 8 by 64 3D texture takes seven levels and its footprint saturates at four; a 2D array of one slice is 16512 bytes aligned to 16384 where the plain 2D of that extent is 16512 aligned to 128, and at seven levels they part to 33152 against 22528; a cube is six of the array's chain. A sweep over types at one level count, beside a sweep over level counts of one type, answers none of it |
|
||||
| `texture_descriptor_pairs` | `texture-pairs-usage-crossings` | `MTLTextureUsage` x `MTLTextureDescriptor.height` | whether a usage bit that bars lossless compression bars it at every extent. 16 by 16 answers 1152 bytes against 1024 and 16 by 15 answers 1024 against 1024, so one texel of height decides whether the usage moves the footprint at all -- and a usage sweep at one extent reads as the bit always moving it |
|
||||
|
||||
#### Types with per-value depth and no crossing
|
||||
|
||||
The work list of this axis, and the shape of the answer to *is the depth sufficient?*: each of these is a type the suite compared two or more values of and crossed with nothing. The number is the values compared. A row is a question and not a verdict — the type may be crossed by a family that declared no row, and a type whose values cannot interact with anything has nothing to answer — but a type deep on the per-value axis and absent here is where a cell of a pair is least likely to have been looked at.
|
||||
The work list of this axis, and the shape of the answer to *is the depth sufficient?*: each of these is a type the suite compared two or more values of and crossed with nothing in **either** table. The number is the values compared. A row is a question and not a verdict — the type may be crossed by a family that declared no row, and a type whose values cannot interact with anything has nothing to answer — but a type deep on the per-value axis and absent here is where a cell of a pair is least likely to have been looked at.
|
||||
|
||||
- **`MTLDataType`**, 79 of 97 compared
|
||||
- **`MTLAttributeFormat`**, 53 of 54 compared
|
||||
- **`MTLBindingType`**, 8 of 12 compared
|
||||
- **`MTLIndirectCommandType`**, 7 of 8 compared
|
||||
- **`MTLFunctionType`**, 6 of 7 compared
|
||||
- **`MTLFunctionOptions`**, 5 of 5 compared
|
||||
- **`MTLPrimitiveType`**, 5 of 5 compared
|
||||
@@ -226,10 +273,8 @@ The work list of this axis, and the shape of the answer to *is the depth suffici
|
||||
- **`MTLMutability`**, 3 of 3 compared
|
||||
- **`MTLPatchType`**, 3 of 3 compared
|
||||
- **`MTLPipelineOption`**, 3 of 4 compared
|
||||
- **`MTLSamplerMipFilter`**, 3 of 3 compared
|
||||
- **`MTLSamplerReductionMode`**, 3 of 3 compared
|
||||
- **`MTLSparsePageSize`**, 3 of 3 compared
|
||||
- **`MTLTessellationControlPointIndexType`**, 3 of 3 compared
|
||||
- **`MTLVisibilityResultMode`**, 3 of 3 compared
|
||||
- **`MTLDepthClipMode`**, 2 of 2 compared
|
||||
- **`MTLHeapType`**, 2 of 3 compared
|
||||
|
||||
@@ -11,7 +11,8 @@ one call of a selector is enough, so a selector that takes an enum counts as exe
|
||||
value reached it. The **option space** axis (`option_space.py`) is depth: of each Metal enum's and
|
||||
option set's values, which ones the suite actually compared, and — because a type whose values are
|
||||
all compared says nothing about the pairs of them — how many pairs of the option space a case puts
|
||||
to Metal at once, from the declarations in `crossings.tsv`.
|
||||
to Metal at once, from the declarations in `crossings.tsv`, and, counted apart, how much
|
||||
interaction it holds that is no pair of that space, from `other_crossings.tsv`.
|
||||
|
||||
Nothing here is a maintained list. Every number is derived, at the moment this runs, from four
|
||||
things already in the tree:
|
||||
@@ -479,6 +480,43 @@ def known_gaps() -> list[tuple[str, str]]:
|
||||
# The join
|
||||
|
||||
|
||||
def metal_items(
|
||||
index: dict[tuple[str, str], dict[str, str]],
|
||||
by_item: dict[tuple[str, str], dict[str, set[str]]],
|
||||
api: metal_leg.Api,
|
||||
) -> dict[tuple[str, str], option_space.Item]:
|
||||
"""Every Metal item a crossing may name as a field axis, from the sources already read.
|
||||
|
||||
The key is the items axis's own -- `(container, item name)` of `scripts/metal-coverage`'s map
|
||||
-- so a field axis names an item this document already has a row for rather than a word a
|
||||
row's author chose. Each carries the case modules whose Metal leg reaches it, and the Metal
|
||||
type its call answers, which is what tells a boolean or numeric field from an enum-valued one.
|
||||
|
||||
The answered type is `objc2-metal`'s, keyed by the selector it binds for the item: a property
|
||||
is bound under its own name, and an Objective-C `BOOL` property under `isName` as well, so
|
||||
both spellings are looked for and a property bound under neither answers nothing here. That is
|
||||
sound in the one direction this is used: an item whose answered type is unknown is **not**
|
||||
refused as an enum under another name, so the check can read short of the truth and never over
|
||||
it.
|
||||
"""
|
||||
answered: dict[tuple[str, str], str] = {}
|
||||
for (metal, rust), one in api.answers.items():
|
||||
selector = api.selector.get((metal, rust), rust)
|
||||
for spelling in (selector, rust):
|
||||
answered.setdefault((metal, spelling), one)
|
||||
if spelling.startswith("is") and len(spelling) > 2:
|
||||
tail = spelling[2].lower() + spelling[3:]
|
||||
answered.setdefault((metal, tail), one)
|
||||
out: dict[tuple[str, str], option_space.Item] = {}
|
||||
for key, row in index.items():
|
||||
if not key[0] or key[1] == key[0]:
|
||||
# A free function's empty container, and a container's own row, which names the type
|
||||
# and not a field of it.
|
||||
continue
|
||||
out[key] = option_space.Item(set(by_item.get(key, {})), answered.get(key, ""))
|
||||
return out
|
||||
|
||||
|
||||
def inventory():
|
||||
"""Everything the document states, derived."""
|
||||
api = metal_leg.Api.read(API)
|
||||
@@ -550,6 +588,10 @@ def inventory():
|
||||
# The second axis. A case whose answer Metal never ran puts no value to Metal, which is
|
||||
# the same gate the items axis applies to a call; the axis reads the values a module states
|
||||
# and the crossings a case declares, so it is handed the cases and joins them itself.
|
||||
#
|
||||
# `metal_items` is what a crossing over a Metal **field** is checked against: the items
|
||||
# axis's own join of item to the modules reaching it, and what each call answers. One
|
||||
# vocabulary, so a field axis names a call this document already reports as exercised.
|
||||
"option_space": option_space.inventory(
|
||||
ROOT,
|
||||
{
|
||||
@@ -557,6 +599,7 @@ def inventory():
|
||||
for module, family in families.items()
|
||||
for case in family["ran"]
|
||||
},
|
||||
metal_items(index, by_item, api),
|
||||
),
|
||||
}
|
||||
|
||||
@@ -581,19 +624,36 @@ def names_line(names: list[str]) -> str:
|
||||
|
||||
|
||||
def write_crossings(w, space) -> None:
|
||||
"""The third axis: the pairs of Metal types a case crosses, declared and checked."""
|
||||
"""The third axis: the crossings a case declares, in two counts that are never added.
|
||||
|
||||
*The pairs of the option space* is `crossings.tsv`: every axis a Metal enum, so the number is
|
||||
comparable with the per-value columns above. *The crossings that are not pairs* is
|
||||
`other_crossings.tsv`: a Metal enum crossed with a boolean or numeric Metal field, or one type
|
||||
crossed with itself in two slots. Both are declarations and both are floors; they measure
|
||||
different things and one headline of the two would measure neither.
|
||||
"""
|
||||
rows = space["rows"]
|
||||
held = space["crossings"]
|
||||
other = space["other_crossings"]
|
||||
pairs = sorted({pair for row in held for pair in row["pairs"]})
|
||||
crossed = sorted({axis for row in held for axis in row["axes"]})
|
||||
# The work list: a type the suite has real per-value depth in and crosses with nothing. One
|
||||
# compared value is not depth, so the floor is two.
|
||||
# An enum a row of the second file names is crossed too, so the work list below is read
|
||||
# against both. A field axis is no Metal enum and names none.
|
||||
crossed_at_all = set(crossed) | {
|
||||
axis for row in other for axis in row["axes"] if "." not in axis
|
||||
}
|
||||
slots = sorted({axis for row in other for axis in row["slots"]})
|
||||
fields = sorted({f"{ty}.{name}" for row in other for ty, name in row["fields"]})
|
||||
with_slots = sum(1 for row in other if row["slots"])
|
||||
with_fields = sum(1 for row in other if row["fields"])
|
||||
# The work list: a type the suite has real per-value depth in and crosses with nothing, in
|
||||
# either file. One compared value is not depth, so the floor is two.
|
||||
thin = sorted(
|
||||
(row for row in rows if len(row["compared"]) >= 2 and row["metal"] not in crossed),
|
||||
(row for row in rows if len(row["compared"]) >= 2 and row["metal"] not in crossed_at_all),
|
||||
key=lambda r: (-len(r["compared"]), r["metal"]),
|
||||
)
|
||||
|
||||
w("### By crossing, which is depth in the pairs")
|
||||
w("### By crossing, which is depth in the combinations")
|
||||
w("")
|
||||
w(
|
||||
"Every column above is per value, and the pairs are where most of the behaviour an "
|
||||
@@ -630,14 +690,18 @@ def write_crossings(w, space) -> None:
|
||||
"declaration and not by discovery."
|
||||
)
|
||||
w(
|
||||
"- **An axis that is not a Metal enum or option set.** A crossing of a type with a number — "
|
||||
"a stencil mask, a per-sample depth, a draw count — or with a grouping that is not a Metal "
|
||||
"type, such as a pixel format's class, is real depth this count does not hold. The option "
|
||||
"space is what it measures, as the columns above do."
|
||||
"- **An axis that is not a Metal enum or option set.** A crossing of a type with a boolean "
|
||||
"or numeric Metal field — `alphaToCoverageEnabled`, a LOD clamp, an extent, a reset range "
|
||||
"— and a type crossed with **itself in two slots**, which the two stencil faces are, are "
|
||||
"real depth and are no pair of this option space. They are **not** uncounted: they are "
|
||||
"declared in `other_crossings.tsv` and counted in their own table below, apart from these "
|
||||
"numbers and never added into them."
|
||||
)
|
||||
w(
|
||||
"- **A type crossed with itself in two slots**, which the two stencil faces are: an axis "
|
||||
"may not be named twice, so such a cross is outside the count."
|
||||
"- **An axis that is no Metal item at all.** A pixel format's class, the shape of a "
|
||||
"shader's output, whether a fragment writes its own sample mask: neither file can name "
|
||||
"one, because neither has anything to check such an axis against. That depth is in the "
|
||||
"suite and in no count here."
|
||||
)
|
||||
w(
|
||||
"- **A module that takes its value list from the suite's shared vocabulary** states none of "
|
||||
@@ -658,10 +722,13 @@ def write_crossings(w, space) -> None:
|
||||
w("")
|
||||
w("| | |")
|
||||
w("|---|---|")
|
||||
w(f"| crossings declared | {len(held)} |")
|
||||
w(f"| pairs of the option space declared | {len(held)} |")
|
||||
w(f"| distinct pairs of Metal types crossed | {len(pairs)} |")
|
||||
w(f"| types in at least one crossing | {len(crossed)} |")
|
||||
w(f"| types with two or more values compared and in no crossing | {len(thin)} |")
|
||||
w(f"| types in at least one such pair | {len(crossed)} |")
|
||||
w(
|
||||
"| types with two or more values compared and in no crossing of **either** table | "
|
||||
f"{len(thin)} |"
|
||||
)
|
||||
w("")
|
||||
if not held:
|
||||
w(
|
||||
@@ -677,15 +744,17 @@ def write_crossings(w, space) -> None:
|
||||
cell = "its cases" if row["cell"] == option_space.FAMILY else f"`{row['cell']}`"
|
||||
w(f"| `{row['module']}` | {cell} | {axes} | {row['why']} |")
|
||||
w("")
|
||||
write_other_crossings(w, other, slots, fields, with_slots, with_fields)
|
||||
w("#### Types with per-value depth and no crossing")
|
||||
w("")
|
||||
w(
|
||||
"The work list of this axis, and the shape of the answer to *is the depth sufficient?*: "
|
||||
"each of these is a type the suite compared two or more values of and crossed with "
|
||||
"nothing. The number is the values compared. A row is a question and not a verdict — the "
|
||||
"type may be crossed by a family that declared no row, and a type whose values cannot "
|
||||
"interact with anything has nothing to answer — but a type deep on the per-value axis and "
|
||||
"absent here is where a cell of a pair is least likely to have been looked at."
|
||||
"nothing in **either** table. The number is the values compared. A row is a question and "
|
||||
"not a verdict — the type may be crossed by a family that declared no row, and a type "
|
||||
"whose values cannot interact with anything has nothing to answer — but a type deep on "
|
||||
"the per-value axis and absent here is where a cell of a pair is least likely to have "
|
||||
"been looked at."
|
||||
)
|
||||
w("")
|
||||
for row in thin:
|
||||
@@ -693,6 +762,91 @@ def write_crossings(w, space) -> None:
|
||||
w("")
|
||||
|
||||
|
||||
def write_other_crossings(w, other, slots, fields, with_slots, with_fields) -> None:
|
||||
"""The crossings that are not pairs of the option space, counted apart from the pairs."""
|
||||
w("#### Crossings that are not pairs of the option space")
|
||||
w("")
|
||||
w(
|
||||
"The table above counts pairs of two Metal **enums**, because that is what the per-value "
|
||||
"columns measure the depth of. A crossing of an enum with a Metal field that is a "
|
||||
"**boolean** or a **number**, and a crossing of one type with **itself in two or more "
|
||||
"slots**, is depth of the same kind and is no pair of that space. These are declared in "
|
||||
"`scripts/conformance-coverage/other_crossings.tsv`, in rows of the same four fields, and "
|
||||
"counted here. **The two counts are never added together**: one says how much of the "
|
||||
"option space's own grid a case puts to Metal, the other how much interaction the suite "
|
||||
"holds that the option space cannot express, and a sum of them would say neither."
|
||||
)
|
||||
w("")
|
||||
w(
|
||||
"An axis there is a Metal enum with a generated value list, which **may** be named more "
|
||||
"than once — that repetition is the type-in-two-slots crossing and the count of names is "
|
||||
"the count of slots — or one Metal item of one Metal type, spelled as the items axis keys "
|
||||
"it (`MTLRenderPipelineDescriptor.alphaToCoverageEnabled`, "
|
||||
"`MTLArgumentEncoder.setArgumentBuffer:offset:`)."
|
||||
)
|
||||
w("")
|
||||
w(
|
||||
"**This document is not written** if such a row names a module no case of which ran Metal, "
|
||||
"a cell that is not one of that module's recorded cases, fewer than two axes, nothing that "
|
||||
"the cross decides, or an **enum** axis of which the module's own text states fewer than "
|
||||
"two values by name. Three refusals are this table's own:"
|
||||
)
|
||||
w("")
|
||||
w(
|
||||
"- **a row every axis of which is a Metal enum named once.** That is a pair of the option "
|
||||
"space: it belongs in the table above, under the check that the module states two values "
|
||||
"of each axis, and a row parked here would be the same claim under a weaker rule;"
|
||||
)
|
||||
w(
|
||||
"- **a field axis `objc2-metal` binds no such item for, or one this module's Metal leg "
|
||||
"reaches no call of.** The second is the items axis's own join, so a field axis names a "
|
||||
"call this document already reports as exercised rather than a word a row's author chose;"
|
||||
)
|
||||
w(
|
||||
"- **a field axis whose call answers a Metal type with a generated value list.** Such a "
|
||||
"field is an enum under another name — `MTLTextureDescriptor.storageMode` is one — and "
|
||||
"naming it as a field would dodge the two-values check the enum spelling carries."
|
||||
)
|
||||
w("")
|
||||
w(
|
||||
"What **cannot** be checked for a field axis, and is therefore what only a reader can "
|
||||
"check: that the module put **two values** of the field to Metal. A boolean's two values "
|
||||
"and a number's range are nowhere in the text this reads and in no recording's "
|
||||
"transcript, so a field axis carries the field being Metal's and this module's leg setting "
|
||||
"it, and nothing about variation. An enum axis carries the two-values check here exactly as "
|
||||
"it does above, which is why a row's enum axes are the stronger half of it. The last "
|
||||
"column, as above, is for a reader against the case."
|
||||
)
|
||||
w("")
|
||||
w("| | |")
|
||||
w("|---|---|")
|
||||
w(f"| crossings declared that are not pairs of the option space | {len(other)} |")
|
||||
w(f"| of those, naming a type in two or more slots | {with_slots} |")
|
||||
w(f"| of those, naming a Metal field that is a boolean or a number | {with_fields} |")
|
||||
w(f"| distinct Metal fields crossed | {len(fields)} |")
|
||||
w(f"| distinct Metal types crossed with themselves | {len(slots)} |")
|
||||
w("")
|
||||
w(
|
||||
"The two *of those* rows are not a partition and do not sum to the first: a row may name "
|
||||
"both, as the sampler row crossing its two filter slots with a LOD clamp does."
|
||||
)
|
||||
w("")
|
||||
if not other:
|
||||
w(
|
||||
"None are declared, so how much interaction the suite holds outside the option "
|
||||
"space's own pairs is measured at nothing."
|
||||
)
|
||||
w("")
|
||||
return
|
||||
w("| case module | cell | crossed | what only the cross decides |")
|
||||
w("|---|---|---|---|")
|
||||
for row in sorted(other, key=lambda r: (r["module"], r["cell"], r["axes"])):
|
||||
axes = " x ".join(f"`{axis}`" for axis in row["axes"])
|
||||
cell = "its cases" if row["cell"] == option_space.FAMILY else f"`{row['cell']}`"
|
||||
w(f"| `{row['module']}` | {cell} | {axes} | {row['why']} |")
|
||||
w("")
|
||||
|
||||
|
||||
def write_option_space(w, space) -> None:
|
||||
"""The second axis: of each Metal enum's and option set's values, which the suite compared."""
|
||||
rows = space["rows"]
|
||||
@@ -785,8 +939,10 @@ def write_option_space(w, space) -> None:
|
||||
w(
|
||||
"- **Combinations.** Every column here is per value. A type whose values are all compared "
|
||||
"says nothing about the pairs and triples of them, which is where most of the behaviour "
|
||||
"an implementation can get wrong lives. *By crossing* below counts the pairs a case states "
|
||||
"together, which is the measure of that and is a floor by every crossing nobody declared."
|
||||
"an implementation can get wrong lives. *By crossing* below counts what a case states "
|
||||
"together, in two numbers kept apart: the pairs of this option space, and the crossings "
|
||||
"that are no pair of it — an enum with a boolean or numeric field, a type with itself in "
|
||||
"two slots. Each is a floor by every crossing nobody declared."
|
||||
)
|
||||
w(
|
||||
"- **Metal's API validation is excluded.** Its complaints name enumerators, and the suite "
|
||||
@@ -1011,9 +1167,10 @@ def write(data) -> str:
|
||||
w(
|
||||
"Both are **per value**, which is the limit the suite's own blind spot sits in: a side can "
|
||||
"be right about every value of two types alone and wrong about a cell of the two together. "
|
||||
"*By crossing* inside the option-space axis counts the pairs a case puts to Metal at "
|
||||
"once, from a declaration the generator checks. It is the only number here about "
|
||||
"interactions, and it is a floor by every crossing nobody declared."
|
||||
"*By crossing* inside the option-space axis counts what a case puts to Metal at once, "
|
||||
"from declarations the generator checks: the pairs of the option space, and — counted "
|
||||
"apart and never added in — the crossings that are no pair of it. They are the only "
|
||||
"numbers here about interactions, and each is a floor by every crossing nobody declared."
|
||||
)
|
||||
w("")
|
||||
|
||||
@@ -1171,6 +1328,10 @@ def write(data) -> str:
|
||||
"| declared crossings of the option space (pairs put to Metal at once) | "
|
||||
f"{len(space['crossings'])} |"
|
||||
)
|
||||
w(
|
||||
"| declared crossings that are no pair of it (a boolean or numeric field, or one type in "
|
||||
f"two slots) | {len(space['other_crossings'])} |"
|
||||
)
|
||||
w("")
|
||||
w(
|
||||
"A tolerance names a **site of a transcript**, not an item, so the last two rows are read "
|
||||
|
||||
@@ -13,9 +13,12 @@
|
||||
# check is whether the expected answer needs both axes; that is what the last field is for, and a
|
||||
# reader checks it against the case.
|
||||
#
|
||||
# An axis is a Metal enum or option set. A cross with a number (a stencil mask, a per-sample
|
||||
# depth), with a grouping that is no Metal type (a format's class), or of a type with itself in
|
||||
# two slots (the two stencil faces) cannot be said here, and the document states that limit.
|
||||
# An axis is a Metal enum or option set. A cross with a Metal field that is a boolean or a number
|
||||
# (a stencil mask, a per-sample depth, an extent), or of a type with itself in two slots (the two
|
||||
# stencil faces), is no pair of the option space and cannot be said here: it is declared in
|
||||
# other_crossings.tsv and counted apart. A cross with a grouping that is no Metal item at all -- a
|
||||
# format's class, the shape of a shader's output -- can be said in neither, and the document states
|
||||
# that limit.
|
||||
# module cell axes what only the cross decides
|
||||
blend_interactions blend-interaction-mask-blend MTLColorWriteMask+MTLBlendOperation whether the write mask is applied before the blend reads the destination or after it. Only `Min` and `Subtract` can see the order: under `Add`, `Max` and `ReverseSubtract` a channel the mask drops stores the destination either way, which is the one blend the mask's own sweep was written with
|
||||
blend_interactions blend-interaction-mask-blend MTLColorWriteMask+MTLBlendFactor whether a mask that drops alpha changes what an RGB factor reads from the destination's alpha. Neither sweep can ask it: the mask sweep's blend reads no channel but its own, and the factor sweep's mask keeps every channel
|
||||
@@ -32,3 +35,9 @@ pixel_samplers family MTLPixelFormat+MTLSamplerMinMagFilter+MTLSamplerAddressMod
|
||||
render_state render-state-facing MTLCullMode+MTLWinding which of a triangle and its reverse survives a draw: flipping the winding flips it and flipping the cull mode flips it back, so neither setting's own value decides anything and a side that reads one and not the other draws the wrong one of the pair
|
||||
shader_stencil stencil-output MTLCompareFunction+MTLStencilOperation which operation a fragment's `[[stencil]]` output fires, under a state whose two faces carry different comparisons and different operations: a side that fired the pass operation where the comparison failed writes a byte the comparison alone and the operation alone both allow
|
||||
heap_metal_sizes heap-sizes-block-writes-only MTLTextureUsage+MTLPixelFormat+MTLTextureType whether Apple's private `BlockWritesOnly` usage bit changes a heap answer. Every shape is recorded with the bit and without it, so a side whose layout depends on the bit for one format or one texture type and not another diverges in a cell while the bit alone and each format alone are right
|
||||
indirect_command_depth indirect-render-commands-patch-draws MTLIndirectCommandType+MTLTessellationControlPointIndexType whether an indirect patch draw reads its control-point indices from the command or from the pipeline that command holds. The buffer's descriptor declares both patch-draw types and each command carries its own pipeline, so the indexed type is the pipeline's and the index buffer is the command's argument: a side that encoded one command's type against the other's pipeline marks the grid the other owns, while the command types alone are a sweep and the index type alone is a direct draw's question
|
||||
sampler_crossings family MTLSamplerBorderColor+MTLSamplerAddressMode whether a border-reading mode on one axis substitutes the border for a tap another axis put out of range. One case a border colour, and six address triples that put the border-reading mode on `s` alone, on `t` alone, on `r` alone and on all three: the sweeps that compared every colour read the border on `r` with `s` and `t` inside the texture, so no row of them asks which axis's mode the substitution follows
|
||||
sampler_crossings family MTLSamplerMinMagFilter+MTLSamplerMipFilter which level a sampler reads when the LOD clamp raises the requested one, and with which of the two filters -- `NotMipmapped` ignores the clamp outright, and the two mip filters pick their level and then their filter. The filter sweep samples at texel centres where a linear footprint is one texel, and the mip sweep pins both filters to nearest and says so, so neither can tell the three rules apart
|
||||
sampler_crossings sampler-compare-filter-pairs MTLCompareFunction+MTLSamplerMinMagFilter whether Metal filters the comparison's **results** or compares a filtered depth. Sixteen cells of every comparison against a nearest and a linear filter, sampled where four texels carry the footprint at weights of a quarter each and at 9/16, 3/16, 3/16 and 1/16: the comparison sweep samples at texel centres, where a linear footprint is one texel and all eight comparisons read the same under either rule
|
||||
texture_descriptor_pairs texture-pairs-usage-crossings MTLTextureUsage+MTLPixelFormat which crossings of a usage with a format Metal's texture descriptor takes, and what it makes of them. `ShaderWrite` on `BC1_RGBA`, on `ASTC_4x4_LDR` and on `Depth32Float` each answer a texture of usage 0x3 and `RenderTarget` on the two block-compressed formats one of 0x4, where `ShaderAtomic` is fatal on every format but `R32Uint`: so the descriptor is where a guess puts the refusal and the pair is what says Metal does not put it there
|
||||
texture_descriptor_pairs texture-pairs-usage-crossings MTLTextureUsage+MTLTextureType whether a usage bit that bars lossless compression bars it in every texture type. A 1D texture of 5000 texels answers 32768 bytes under `ShaderRead` and under `ShaderRead | PixelFormatView` alike, because its height is 1 and no usage of it is ever compressed, where the same two usages part by 128 bytes on a 64 by 64 2D texture -- so the usage sweep in one type reads as the bit always moving the footprint
|
||||
|
@@ -64,6 +64,43 @@ property of the case's reasoning, not of its text, so the row states it in words
|
||||
the count is of crossings declared, never of crossings proved. The document says so where it
|
||||
prints the number.
|
||||
|
||||
# The crossings that are not pairs of the option space
|
||||
|
||||
A crossing of a Metal enum with a **boolean** field (`alphaToCoverageEnabled`), with a **number**
|
||||
(an extent, a level count, an offset, a sample count), or of one type with **itself in two slots**
|
||||
(the two stencil faces, a sampler's three address modes, two members of an argument buffer) is real
|
||||
depth and is not a pair of the option space. `crossings.tsv` refuses every one of those, which left
|
||||
the shape of them stated as a limit and measured at nothing: a reader could not tell whether one
|
||||
such crossing or forty fell outside the count.
|
||||
|
||||
`other_crossings.tsv` is where they are declared, counted **apart** from the pairs and never added
|
||||
into one number -- the same separation `unreachable_values.tsv` keeps between a measured
|
||||
impossibility and a gap. Its rows take the same four fields, and the axes are of two kinds:
|
||||
|
||||
- a Metal enum or option set with a generated value list, which **may** be named more than once:
|
||||
that repetition is the type-in-two-slots crossing, and the count of slots is the count of names;
|
||||
- `MTLType.item`, one Metal item of one Metal type, spelled as the items axis keys it --
|
||||
`MTLRenderPipelineDescriptor.alphaToCoverageEnabled`,
|
||||
`MTLArgumentEncoder.setArgumentBuffer:offset:`.
|
||||
|
||||
What this second file refuses, beyond the shape checks the first one makes:
|
||||
|
||||
- a row every axis of which is a Metal enum named once, which is a pair of the option space and
|
||||
belongs in `crossings.tsv` under its checks, not here under weaker ones;
|
||||
- an `MTLType.item` axis `objc2-metal` binds no such item for, and one **this module's Metal leg
|
||||
does not reach** -- the same join the items axis makes, so a field axis names a call the suite
|
||||
is already measured to make;
|
||||
- an `MTLType.item` axis whose call **answers a Metal type with a generated value list**. Such a
|
||||
field is an enum under another name, and declaring it here would dodge the pairs file's check
|
||||
that the module states two of its values. `MTLTextureDescriptor.storageMode` is one.
|
||||
|
||||
What it cannot check, and what no reading of the sources could: that the module puts **two values**
|
||||
of a boolean or numeric field to Metal. The enum axes carry that check here as they do in the pairs
|
||||
file -- the module's own text must state two values by name -- and a field axis carries only that
|
||||
the field is Metal's and that this module's Metal leg sets it. So a field axis is a weaker
|
||||
declaration than an enum axis, which is why the two counts stay apart and why the document says
|
||||
which part only a reader can check.
|
||||
|
||||
# Why a value stated as a raw ordinal is not resolved, and must not be
|
||||
|
||||
Both numerators read **names**. A case may instead hand the Metal leg an enum's ordinal as a
|
||||
@@ -219,30 +256,55 @@ def read_unreachable(root: Path) -> dict[tuple[str, str], tuple[str, str]]:
|
||||
return out
|
||||
|
||||
|
||||
#: The declared crossings, relative to the tree's root.
|
||||
#: The declared crossings of the option space -- every axis a Metal enum -- relative to the
|
||||
#: tree's root.
|
||||
CROSSINGS = "scripts/conformance-coverage/crossings.tsv"
|
||||
|
||||
#: The declared crossings that are **not** pairs of the option space: one axis a boolean or
|
||||
#: numeric Metal field, or one type in two slots. Counted apart from the pairs, never added in.
|
||||
OTHER = "scripts/conformance-coverage/other_crossings.tsv"
|
||||
|
||||
#: What a row's `cell` field says where the cross is read **across** the family's cases -- one case
|
||||
#: a cell of it, or one axis fixed per case and the others swept inside each -- rather than inside
|
||||
#: one case that holds the whole grid.
|
||||
FAMILY = "family"
|
||||
|
||||
|
||||
def read_crossings(root: Path) -> list[tuple[str, str, tuple[str, ...], str]]:
|
||||
"""Every declared crossing as `(module, cell, axes, what only the cross decides)`.
|
||||
class Item:
|
||||
"""One Metal item a field axis may name: who reaches it, and what its call answers.
|
||||
|
||||
Built by `coverage.py` from the two sources it already reads -- `objc2_metal.tsv` for what
|
||||
`objc2-metal` binds and what each call answers, and the items axis's own join for which case
|
||||
modules' Metal legs reach the item. A field axis is checked against this and nothing else, so
|
||||
it names a call the suite is already measured to make rather than a word a row's author chose.
|
||||
"""
|
||||
|
||||
def __init__(self, modules: set[str], answers: str):
|
||||
#: The case modules whose Metal leg reaches this item, as the items axis joins them.
|
||||
self.modules = frozenset(modules)
|
||||
#: The Metal type the call answers, or `""`. A type with a generated value list here means
|
||||
#: the field is an enum under another name and belongs in `crossings.tsv`.
|
||||
self.answers = answers
|
||||
|
||||
|
||||
def _read_rows(
|
||||
path: Path, repeats: bool
|
||||
) -> list[tuple[str, str, tuple[str, ...], str]]:
|
||||
"""Every row of a crossings file as `(module, cell, axes, what only the cross decides)`.
|
||||
|
||||
The shape of the row and nothing about the suite: the caller checks it against the sources, the
|
||||
way `read_unreachable`'s caller checks that list. Refused here is only what the row itself gets
|
||||
wrong -- a field missing, a crossing of one axis, an axis named twice, a row declared twice, or
|
||||
a row that says nothing about what the cross decides.
|
||||
wrong -- a field missing, a crossing of one axis, a row declared twice, or a row that says
|
||||
nothing about what the cross decides.
|
||||
|
||||
A crossing of **one axis** is a sweep, which the per-value columns above already count, so a row
|
||||
with fewer than two axes is a mistake and not a smaller claim. An axis named twice is the same
|
||||
mistake spelled differently: a type crossed with itself in two slots -- the two stencil faces --
|
||||
is a real interaction and this file cannot say it, which the document states as a limit rather
|
||||
than taking `A+A` to mean it.
|
||||
with fewer than two axes is a mistake and not a smaller claim, in either file.
|
||||
|
||||
`repeats` is the one difference between the two files. An axis named twice in `crossings.tsv`
|
||||
is a type crossed with itself in two slots, which is not a pair of the option space and is
|
||||
refused there; in `other_crossings.tsv` that repetition **is** the claim, and the count of
|
||||
names is the count of slots.
|
||||
"""
|
||||
path = root / CROSSINGS
|
||||
out: list[tuple[str, str, tuple[str, ...], str]] = []
|
||||
if not path.exists():
|
||||
# A tree that declares none, which is every synthetic tree the self-test builds unless it
|
||||
@@ -264,10 +326,11 @@ def read_crossings(root: Path) -> list[tuple[str, str, tuple[str, ...], str]]:
|
||||
f"{path.name}: {module} {cell} crosses {axes!r}, which is one axis -- a sweep of "
|
||||
"one type is what the per-value columns already count"
|
||||
)
|
||||
if len(set(held)) != len(held):
|
||||
if not repeats and len(set(held)) != len(held):
|
||||
raise SystemExit(
|
||||
f"{path.name}: {module} {cell} names an axis twice in {axes!r}; a type crossed "
|
||||
"with itself in two slots is outside this count"
|
||||
f"with itself in two slots is no pair of the option space and is declared in "
|
||||
f"{Path(OTHER).name}"
|
||||
)
|
||||
if not why:
|
||||
raise SystemExit(
|
||||
@@ -281,13 +344,103 @@ def read_crossings(root: Path) -> list[tuple[str, str, tuple[str, ...], str]]:
|
||||
return out
|
||||
|
||||
|
||||
def read_crossings(root: Path) -> list[tuple[str, str, tuple[str, ...], str]]:
|
||||
"""Every declared pair of the option space, by its row's shape alone.
|
||||
|
||||
Every axis is a Metal enum, each named once: `crossings`, below, is what checks that against
|
||||
the generated value lists and the module's own text.
|
||||
"""
|
||||
return _read_rows(root / CROSSINGS, repeats=False)
|
||||
|
||||
|
||||
def read_other_crossings(root: Path) -> list[tuple[str, str, tuple[str, ...], str]]:
|
||||
"""Every declared crossing that is not a pair of the option space, by its row's shape alone.
|
||||
|
||||
An axis may repeat here, which is the type-in-two-slots crossing; `other_crossings`, below, is
|
||||
what checks the axes against the Metal items and the generated value lists.
|
||||
"""
|
||||
return _read_rows(root / OTHER, repeats=True)
|
||||
|
||||
|
||||
def _holds_the_cell(
|
||||
modules_ran: dict[str, set[str]], where: str, module: str, cell: str
|
||||
) -> set[str]:
|
||||
"""The module's recorded cases, with the row's cell checked to be one of them.
|
||||
|
||||
Refused: a module no case of which ran Metal, a cell that is not one of **that** module's
|
||||
recorded cases -- which is what catches a row left behind by a renamed or deleted case -- and
|
||||
`family` where the module has fewer than two recorded cases, since a cross read across the
|
||||
family's cases needs at least two of them.
|
||||
"""
|
||||
held = modules_ran.get(module)
|
||||
if not held:
|
||||
raise SystemExit(
|
||||
f"{where} declares {module} {cell}, and no case of {module} has a recording "
|
||||
"of an answer Metal ran -- a module that ran no Metal put no pair to it"
|
||||
)
|
||||
if cell == FAMILY:
|
||||
if len(held) < 2:
|
||||
raise SystemExit(
|
||||
f"{where} says {module}'s cross is read across its own cases, and it "
|
||||
f"has {len(held)} recorded case -- a cross across cases needs at least two"
|
||||
)
|
||||
elif cell not in held:
|
||||
raise SystemExit(
|
||||
f"{where} declares the cell {cell} of {module}, which is not a case of "
|
||||
f"{module} with a recording of an answer Metal ran -- a renamed or deleted case, "
|
||||
"or the wrong module"
|
||||
)
|
||||
return held
|
||||
|
||||
|
||||
def _varies_the_axis(
|
||||
types: dict[str, Type],
|
||||
effect: dict[tuple[str, str], set[str]],
|
||||
where: str,
|
||||
module: str,
|
||||
cell: str,
|
||||
axis: str,
|
||||
) -> None:
|
||||
"""That `module`'s own text states two values of the Metal enum `axis` by name.
|
||||
|
||||
The one check that bears on the claim, and it is the same check in both files. A module that
|
||||
states one value of an axis, or none, cannot vary it, so nothing in the text tells the claimed
|
||||
cross from a sweep of the other axis at a fixed cell -- a single-value falsification would
|
||||
satisfy the row. It is a check of what the text can state, never of what the case's expected
|
||||
answer needs.
|
||||
"""
|
||||
stated = [value for value in types[axis].names if module in effect.get((axis, value), ())]
|
||||
if len(stated) < 2:
|
||||
raise SystemExit(
|
||||
f"{where} says {module} {cell} crosses {axis}, and {module}'s own text "
|
||||
f"states {len(stated)} of its values by name -- a module that cannot vary an "
|
||||
"axis cannot cross it, so one value would falsify the row"
|
||||
)
|
||||
|
||||
|
||||
def _pairs(axes: tuple[str, ...]) -> list[tuple[str, str]]:
|
||||
"""Each unordered pair of a row's axes, so a three-axis grid holds three.
|
||||
|
||||
A pair is sorted, so two rows crossing the same two types in either order are one pair and not
|
||||
two, and a type crossed with itself contributes none: `(A, A)` is no pair of two types.
|
||||
"""
|
||||
return sorted(
|
||||
{
|
||||
tuple(sorted((one, other)))
|
||||
for i, one in enumerate(axes)
|
||||
for other in axes[i + 1 :]
|
||||
if one != other
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def crossings(
|
||||
root: Path,
|
||||
types: dict[str, Type],
|
||||
effect: dict[tuple[str, str], set[str]],
|
||||
ran_cases: dict[str, str],
|
||||
) -> list[dict]:
|
||||
"""The declared crossings, each checked against the sources it names.
|
||||
"""The declared pairs of the option space, each checked against the sources it names.
|
||||
|
||||
`ran_cases` is every case whose committed recording holds an answer Metal **ran**, to the
|
||||
module that declares its name -- the same join the items axis makes, and the same gate: a case
|
||||
@@ -297,72 +450,136 @@ def crossings(
|
||||
optimistic:
|
||||
|
||||
- a module no case of which ran Metal, or a cell that is not one of **that** module's recorded
|
||||
cases. This is what catches a row left behind by a renamed or deleted case;
|
||||
- `family` where the module has fewer than two recorded cases, since a cross read across the
|
||||
family's cases needs at least two of them;
|
||||
cases, and `family` where the module has fewer than two recorded cases
|
||||
(`_holds_the_cell`);
|
||||
- an axis with no generated value list, which is a typo or a Metal type outside this axis;
|
||||
- an axis of which the module's own text states fewer than **two** values by name. A module
|
||||
that states one value of an axis, or none, cannot vary it, so nothing in the text tells the
|
||||
claimed cross from a sweep of the other axis at a fixed cell -- a single-value falsification
|
||||
would satisfy the row. This is the one check that bears on the claim, and it is a check of
|
||||
what the text can state, never of what the case's expected answer needs.
|
||||
- an axis of which the module's own text states fewer than **two** values by name
|
||||
(`_varies_the_axis`).
|
||||
|
||||
What is **not** refused, because no reading of the text can see it: whether the expected answer
|
||||
is a function of both axes. A row's last field says that in words, for a reader to check against
|
||||
the case.
|
||||
"""
|
||||
where = Path(CROSSINGS).name
|
||||
modules_ran: dict[str, set[str]] = {}
|
||||
for case, module in ran_cases.items():
|
||||
modules_ran.setdefault(module, set()).add(case)
|
||||
out: list[dict] = []
|
||||
for module, cell, axes, why in read_crossings(root):
|
||||
held = modules_ran.get(module)
|
||||
if not held:
|
||||
raise SystemExit(
|
||||
f"crossings.tsv declares {module} {cell}, and no case of {module} has a recording "
|
||||
"of an answer Metal ran -- a module that ran no Metal put no pair to it"
|
||||
)
|
||||
if cell == FAMILY:
|
||||
if len(held) < 2:
|
||||
raise SystemExit(
|
||||
f"crossings.tsv says {module}'s cross is read across its own cases, and it "
|
||||
f"has {len(held)} recorded case -- a cross across cases needs at least two"
|
||||
)
|
||||
elif cell not in held:
|
||||
raise SystemExit(
|
||||
f"crossings.tsv declares the cell {cell} of {module}, which is not a case of "
|
||||
f"{module} with a recording of an answer Metal ran -- a renamed or deleted case, "
|
||||
"or the wrong module"
|
||||
)
|
||||
_holds_the_cell(modules_ran, where, module, cell)
|
||||
for axis in axes:
|
||||
if axis not in types:
|
||||
raise SystemExit(
|
||||
f"crossings.tsv crosses {axis}, which has no generated value list here"
|
||||
)
|
||||
stated = [
|
||||
value for value in types[axis].names if module in effect.get((axis, value), ())
|
||||
]
|
||||
if len(stated) < 2:
|
||||
raise SystemExit(
|
||||
f"crossings.tsv says {module} {cell} crosses {axis}, and {module}'s own text "
|
||||
f"states {len(stated)} of its values by name -- a module that cannot vary an "
|
||||
"axis cannot cross it, so one value would falsify the row"
|
||||
f"{where} crosses {axis}, which has no generated value list here"
|
||||
)
|
||||
_varies_the_axis(types, effect, where, module, cell, axis)
|
||||
out.append(
|
||||
{
|
||||
"module": module,
|
||||
"cell": cell,
|
||||
"axes": list(axes),
|
||||
"why": why,
|
||||
# Each unordered pair of the row's axes, so a three-axis grid holds three. A
|
||||
# pair is sorted, so two rows crossing the same two types in either order are one
|
||||
# pair and not two.
|
||||
"pairs": sorted(
|
||||
{
|
||||
tuple(sorted((one, other)))
|
||||
for i, one in enumerate(axes)
|
||||
for other in axes[i + 1 :]
|
||||
}
|
||||
"pairs": _pairs(axes),
|
||||
}
|
||||
)
|
||||
return out
|
||||
|
||||
|
||||
def other_crossings(
|
||||
root: Path,
|
||||
types: dict[str, Type],
|
||||
effect: dict[tuple[str, str], set[str]],
|
||||
ran_cases: dict[str, str],
|
||||
items: dict[tuple[str, str], Item],
|
||||
) -> list[dict]:
|
||||
"""The declared crossings that are not pairs of the option space, each checked the same way.
|
||||
|
||||
These are counted apart from the pairs and never added into them: a crossing of a type with a
|
||||
boolean or numeric field, or of a type with itself in two or more slots, is real depth and is
|
||||
**not** a pair of the option space, which is what the columns above and `crossings.tsv` measure.
|
||||
|
||||
`items` is every Metal item a field axis may name, keyed as the items axis keys it, holding the
|
||||
case modules whose Metal leg reaches it and the Metal type its call answers.
|
||||
|
||||
What is refused here that `crossings` does not refuse:
|
||||
|
||||
- a row every axis of which is a Metal enum named **once**. That is a pair of the option space:
|
||||
it belongs in `crossings.tsv`, under the check that the module states two values of each
|
||||
axis, and a row parked here would be the same claim under a weaker rule;
|
||||
- a field axis naming an item `objc2-metal` binds nothing for, and one **this module's Metal
|
||||
leg does not reach**. The second is the items axis's own join, so a field axis names a call
|
||||
the suite is measured to make rather than a word chosen here;
|
||||
- a field axis whose call answers a Metal type with a generated value list. Such a field is an
|
||||
enum under another name, and naming it as a field would dodge the two-values check that the
|
||||
enum spelling carries.
|
||||
|
||||
Everything `crossings` refuses is refused here too, by the same helpers: the cell must be one
|
||||
of the module's recorded cases, and an enum axis -- repeated or not -- must be one the module's
|
||||
own text states two values of.
|
||||
|
||||
What **cannot** be checked, for a field axis, is that the module put two values of the field to
|
||||
Metal. A boolean's two values and a number's range are nowhere in the text this reads, and
|
||||
nothing in a recording names them, so that part of a field row is what only a reader can check.
|
||||
The document says so where it prints the count.
|
||||
"""
|
||||
where = Path(OTHER).name
|
||||
modules_ran: dict[str, set[str]] = {}
|
||||
for case, module in ran_cases.items():
|
||||
modules_ran.setdefault(module, set()).add(case)
|
||||
out: list[dict] = []
|
||||
for module, cell, axes, why in read_other_crossings(root):
|
||||
if len(set(axes)) == len(axes) and all(axis in types for axis in axes):
|
||||
raise SystemExit(
|
||||
f"{where} declares {module} {cell} over {'+'.join(axes)}, every axis of which is "
|
||||
f"a Metal enum named once -- that is a pair of the option space and is declared "
|
||||
f"in {Path(CROSSINGS).name}, under its own checks"
|
||||
)
|
||||
_holds_the_cell(modules_ran, where, module, cell)
|
||||
fields: list[tuple[str, str]] = []
|
||||
for axis in axes:
|
||||
if axis in types:
|
||||
_varies_the_axis(types, effect, where, module, cell, axis)
|
||||
continue
|
||||
if "." not in axis:
|
||||
raise SystemExit(
|
||||
f"{where} crosses {axis}, which is neither a Metal type with a generated "
|
||||
"value list nor a `MTLType.item` naming one Metal item"
|
||||
)
|
||||
metal, name = axis.split(".", 1)
|
||||
held = items.get((metal, name))
|
||||
if held is None:
|
||||
raise SystemExit(
|
||||
f"{where} crosses {axis}, and `objc2-metal` binds no {name} on {metal} -- a "
|
||||
"typo, a renamed selector, or the wrong Metal type"
|
||||
)
|
||||
if held.answers in types:
|
||||
raise SystemExit(
|
||||
f"{where} crosses the field {axis}, whose call answers {held.answers}, which "
|
||||
f"has a generated value list -- cross {held.answers} itself, so the module is "
|
||||
"held to stating two of its values"
|
||||
)
|
||||
if module not in held.modules:
|
||||
raise SystemExit(
|
||||
f"{where} says {module} crosses {axis}, and {module}'s Metal leg reaches no "
|
||||
f"call of it -- the items axis attributes {name} to "
|
||||
f"{', '.join(sorted(held.modules)) or 'no module'}"
|
||||
)
|
||||
fields.append((metal, name))
|
||||
out.append(
|
||||
{
|
||||
"module": module,
|
||||
"cell": cell,
|
||||
"axes": list(axes),
|
||||
"why": why,
|
||||
# The pairs of **distinct** Metal enums this row holds, which is how a row that
|
||||
# crosses an enum with a field still reports the enums it names: a field axis is
|
||||
# no Metal type and is in no pair, so a row naming one enum and one field holds
|
||||
# none. These are reported and never counted into the option space's own pairs.
|
||||
"pairs": _pairs(tuple(axis for axis in axes if axis in types)),
|
||||
# The Metal fields the row names, and how many slots of one enum it crosses.
|
||||
"fields": fields,
|
||||
"slots": sorted(
|
||||
{axis for axis in axes if axis in types and axes.count(axis) > 1}
|
||||
),
|
||||
}
|
||||
)
|
||||
@@ -753,13 +970,21 @@ def by_hand(root: Path, types: dict[str, Type]) -> list[tuple[str, str, list[str
|
||||
return [(metal, rust, names) for metal, (rust, names) in sorted(out.items())]
|
||||
|
||||
|
||||
def inventory(root: Path, ran_cases: dict[str, str]) -> dict:
|
||||
def inventory(
|
||||
root: Path,
|
||||
ran_cases: dict[str, str],
|
||||
items: dict[tuple[str, str], Item] | None = None,
|
||||
) -> dict:
|
||||
"""The axis, derived: every type with its three sets of values, and the declared crossings.
|
||||
|
||||
`ran_cases` is every case whose committed recording holds an answer Metal **ran**, to the case
|
||||
module that declares its name. The module-level gate the per-value columns apply is that same
|
||||
fact read coarsely -- a module with at least one such case -- so there is one input and not two
|
||||
that could disagree.
|
||||
|
||||
`items` is every Metal item a field axis of `other_crossings.tsv` may name. A tree that passes
|
||||
none declares no field axis that can be checked, so any it declares is refused rather than
|
||||
taken on trust.
|
||||
"""
|
||||
ran = set(ran_cases.values())
|
||||
types = read_types(root)
|
||||
@@ -860,4 +1085,9 @@ def inventory(root: Path, ran_cases: dict[str, str]) -> dict:
|
||||
# The pairs axis. Checked against the sources each row names, and a floor by every crossing
|
||||
# the suite holds and nobody declared.
|
||||
"crossings": crossings(root, types, effect, ran_cases),
|
||||
# The crossings that are no pair of the option space: an axis that is a boolean or numeric
|
||||
# Metal field, or one type in two slots. A separate count, never added into the one above.
|
||||
"other_crossings": other_crossings(
|
||||
root, types, effect, ran_cases, items or {}
|
||||
),
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
# A crossing that is **not** a pair of the option space, and so cannot be declared in
|
||||
# crossings.tsv: one axis a Metal field that is a boolean or a number, or one Metal type crossed
|
||||
# with **itself** in two or more slots. The answer is still a function of the axes together and of
|
||||
# no one of them alone, which is what makes it a crossing; what it is not is a pair of two Metal
|
||||
# enums, which is what the per-value columns of docs/CONFORMANCE-COVERAGE.md and crossings.tsv
|
||||
# count. These rows are counted APART from the pairs and are never added into them.
|
||||
#
|
||||
# A row is ONE claim about ONE set of axes, at the cell where its falsification is read: a case of
|
||||
# the module, or `family` where the cross takes more than one of its cases.
|
||||
#
|
||||
# An axis is one of two things:
|
||||
#
|
||||
# MTLFoo a Metal enum or option set with a generated value list, which MAY be named
|
||||
# more than once -- that repetition is the type-in-two-slots crossing, and
|
||||
# the count of names is the count of slots;
|
||||
# MTLFoo.item one Metal item of one Metal type, spelled as the items axis keys it:
|
||||
# MTLRenderPipelineDescriptor.alphaToCoverageEnabled,
|
||||
# MTLArgumentEncoder.setArgumentBuffer:offset:.
|
||||
#
|
||||
# The generator FAILS on a row whose module ran no Metal, whose cell is not one of that module's
|
||||
# recorded cases, which crosses fewer than two axes, which says nothing about what the cross
|
||||
# decides, or whose module states fewer than TWO values of an ENUM axis by name. And on three of
|
||||
# its own: a row every axis of which is a Metal enum named once (that is a pair, and belongs in
|
||||
# crossings.tsv under its own checks); a field axis naming an item objc2-metal binds nothing for,
|
||||
# or one this module's Metal leg reaches no call of; and a field axis whose call answers a Metal
|
||||
# type with a generated value list, which is an enum under another name and must be crossed as
|
||||
# that enum.
|
||||
#
|
||||
# What the generator CANNOT check for a field axis is that the module put TWO values of the field
|
||||
# to Metal. A boolean's two values and a number's range are nowhere in the text this reads and in
|
||||
# no recording, so a field axis carries only that the field is Metal's and that this module's
|
||||
# Metal leg sets it. That, and whether the expected answer needs both axes, is what the last field
|
||||
# is for and what a reader checks against the case.
|
||||
#
|
||||
# A crossing with an axis that is no Metal item at all -- a pixel format's class, the shape of a
|
||||
# shader's output, whether a fragment writes a sample mask -- can be declared in neither file, and
|
||||
# the document states that limit.
|
||||
# module cell axes what only the cross decides
|
||||
alpha_coverage_pairs family MTLRenderPipelineDescriptor.alphaToCoverageEnabled+MTLRenderPipelineDescriptor.rasterSampleCount whether the coverage an alpha gives is `floor(alpha * rasterSampleCount)` or a round to nearest. At four samples an alpha of 0.5 covers two under either rule; the one-sample row is where they part, and it covers **none**, so the destination survives untouched where rounding would have stored the fragment. Neither sample count alone says which rule it is
|
||||
alpha_coverage_pairs a2c-on-4-alpha-50-mask-no-alpha MTLRenderPipelineDescriptor.alphaToCoverageEnabled+MTLColorWriteMask whether the alpha the coverage is read from is the fragment's own or what survives the attachment's write mask. A mask that drops alpha leaves the coverage exactly as the same alpha gives with the mask absent and moves only the stored alpha: the mask's own sweep reads a stored channel and never a coverage, and the alpha sweep never meets a mask
|
||||
alpha_coverage_pairs a2one-on-1-blend-source-alpha MTLRenderPipelineDescriptor.alphaToOneEnabled+MTLBlendFactor whether alpha-to-one replaces the alpha before or after the blend reads it. Under RGB factors of `SourceAlpha` and `OneMinusSourceAlpha` the field on stores the source alone and off stores it blended at 0.5, so the blend read 1 and not 0.5 -- where the field alone moves only the stored alpha and the blend alone gives the 0.5 answer at any setting
|
||||
argument_encoder_crossings argument-encoder-cross-offsets MTLArgumentEncoder.setArgumentBuffer:offset:+MTLArgumentEncoder.setArgumentBuffer:startOffset:arrayElement: whether the two offsets compose or the second replaces the first. Over the 48-byte layout `(0, element 1)` writes word 6 and `(8, no element)` word 1, and `(8, element 1)` writes word 7 -- the cell neither call alone reaches. `constantDataAtIndex:` answers the constant's offset inside the arguments and so the same number at every cell, which is why the written mask is the site that reads it
|
||||
argument_encoder_crossings argument-encoder-cross-type-mixtures MTLArgumentDescriptor.constantBlockAlignment+MTLDataType whether `constantBlockAlignment` aligns the constant's offset inside the arguments or the encoder's own alignment. A single `MTLDataTypeUInt` at a block alignment of 64 is 4 bytes aligned to 4 -- the field changes nothing, because offset 0 is aligned to anything -- and a texture in front of it moves that constant to offset 64 and the encoder to 72 bytes while its alignment stays 8. So the field is indistinguishable alone and load-bearing one argument later
|
||||
argument_encoder_crossings argument-encoder-cross-type-sizes MTLDataType+MTLDataType whether a member's offset is a running sum of the members before it or a packing Metal may order. `char, char, float4, float4` is **48** bytes and `float4, char, float4, char` -- the same multiset -- is **64**, so a sweep of one type at a time sees two encoder lengths and only the permutation sees the layout
|
||||
indirect_command_depth indirect-compute-commands-reset-and-ranges MTLIndirectCommandBuffer.resetWithRange:+MTLComputeCommandEncoder.executeCommandsInBuffer:withRange: which commands of a buffer wrote anything, which the two ranges decide together: a command is blank where the reset covers it and runs where the execution does. A side that reset the executed range, or executed the reset one, is right about each range's own bounds and writes another command's segment
|
||||
indirect_command_depth indirect-render-commands-inherited-state MTLIndirectCommandBufferDescriptor.inheritBuffers+MTLIndirectRenderCommand.setVertexBuffer:offset:atIndex: which binding an executed command draws from when the parent encoder and the command have each bound one. With the field off the command's own binding is the only one there is, and with the command setting none the parent's is: each alone names a segment of the output, and only the pair says which of the two wins where both exist
|
||||
indirect_command_depth indirect-render-commands-under-the-pass-state MTLRenderCommandEncoder.setScissorRect:+MTLIndirectRenderCommand.drawPrimitives:vertexStart:vertexCount:instanceCount:baseInstance: which pixels an indirect draw covers, which the parent encoder's scissor and the command's own vertex range decide together -- a render command may not set a scissor of its own, so a side that dropped the pass's state at the execution rasterizes each half of the draw in full while being right about the scissor alone and about the draw alone
|
||||
sampler_crossings family MTLSamplerMinMagFilter+MTLSamplerMinMagFilter+MTLSamplerDescriptor.lodMinClamp which of the two filters reads the level `lodMinClamp` raised the requested one to. The two `(min, mag)` pairs whose filters agree answer the same under every rule, so only an unequal pair at a clamp above the sampled level parts Metal's rule from Vulkan's -- the magnifying filter at a level of zero or less, the minifying one above it -- and from a `NotMipmapped` sampler's, which ignores the clamp outright
|
||||
sampler_crossings sampler-axis-border-opaque-black MTLSamplerAddressMode+MTLSamplerAddressMode+MTLSamplerAddressMode whether a border colour is substituted per **axis** or for the sample. On a lane whose `s` is inside the texture and whose `t` is a period out, a sampler whose `s` mode is `ClampToBorderColor` and whose `t` mode repeats reads either the border or the wrapped texel, and no sampler whose border-reading axis is itself the out-of-range one can part the two readings
|
||||
sampler_crossings sampler-axis-mode-triples MTLSamplerAddressMode+MTLSamplerAddressMode+MTLSamplerAddressMode whether each axis's own mode decides that axis's wrap. Three **unequal** modes over a grid of one inside coordinate and four outside are what tell it from a decision taken on the coordinate as a whole, or from one axis's mode applied to all three: every sampler whose axes agree, and every sweep that moves one axis with the others repeating, reads the right texel under all three rules
|
||||
texture_descriptor_pairs texture-pairs-plain-contents MTLTextureDescriptor.allowGPUOptimizedContents+MTLTextureUsage whether lossless compression is a **conjunction** of the flag with the usage or either one's doing. The flag off answers the uncompressed footprint at a usage that would have compressed, and at `ShaderRead | PixelFormatView` it moves nothing because the usage already barred it: so neither the flag's own sweep nor the usage's says which of the two switches moved the number
|
||||
texture_descriptor_pairs texture-pairs-type-levels-slices MTLTextureType+MTLTextureDescriptor.mipmapLevelCount+MTLTextureDescriptor.arrayLength how many bytes a mip chain takes and how many levels Metal allows, both of which are the **type's** to decide. An 8 by 8 by 64 3D texture takes seven levels and its footprint saturates at four; a 2D array of one slice is 16512 bytes aligned to 16384 where the plain 2D of that extent is 16512 aligned to 128, and at seven levels they part to 33152 against 22528; a cube is six of the array's chain. A sweep over types at one level count, beside a sweep over level counts of one type, answers none of it
|
||||
texture_descriptor_pairs texture-pairs-usage-crossings MTLTextureUsage+MTLTextureDescriptor.height whether a usage bit that bars lossless compression bars it at every extent. 16 by 16 answers 1152 bytes against 1024 and 16 by 15 answers 1024 against 1024, so one texel of height decides whether the usage moves the footprint at all -- and a usage sweep at one extent reads as the bit always moving it
|
||||
|
@@ -98,6 +98,7 @@ def tree(
|
||||
by_hand: str = "",
|
||||
unreachable: str = "",
|
||||
crossings: str = "",
|
||||
other: str = "",
|
||||
) -> Path:
|
||||
"""A repository-shaped tree of exactly these sources and recordings."""
|
||||
root = Path(tempfile.mkdtemp(prefix="option-space-selftest-"))
|
||||
@@ -129,6 +130,10 @@ def tree(
|
||||
crossed = root / option_space.CROSSINGS
|
||||
crossed.parent.mkdir(parents=True, exist_ok=True)
|
||||
crossed.write_text(crossings)
|
||||
if other:
|
||||
held = root / option_space.OTHER
|
||||
held.parent.mkdir(parents=True, exist_ok=True)
|
||||
held.write_text(other)
|
||||
for data in recordings:
|
||||
(suite / "recordings" / f"{data['case']}.json").write_text(json.dumps(data))
|
||||
return root
|
||||
@@ -825,5 +830,217 @@ class Crossings(unittest.TestCase):
|
||||
self.assertIn("is declared twice", str(refused.exception))
|
||||
|
||||
|
||||
#: The Metal items a field axis of the synthetic trees may name, as `coverage.py` hands them over:
|
||||
#: two fields of one type that answer no Metal type, one field whose call answers `MTLThing` --
|
||||
#: which is an enum under another name -- and a field of a type the `blends` module never touches.
|
||||
def items(reached: str = "blends") -> dict[tuple[str, str], option_space.Item]:
|
||||
return {
|
||||
("MTLWidget", "spun"): option_space.Item({reached}, ""),
|
||||
("MTLWidget", "setSpread:atIndex:"): option_space.Item({reached}, ""),
|
||||
("MTLWidget", "thing"): option_space.Item({reached}, "MTLThing"),
|
||||
("MTLGadget", "whirred"): option_space.Item({"others"}, ""),
|
||||
}
|
||||
|
||||
|
||||
class OtherCrossings(unittest.TestCase):
|
||||
"""A declared crossing that is no pair of the option space, and what that second file refuses.
|
||||
|
||||
It holds what `crossings.tsv` cannot say -- a Metal enum crossed with a boolean or numeric
|
||||
field, and a type crossed with itself in two slots -- so its rows are the weaker declaration
|
||||
of the two, and its worth is again what it refuses. Three refusals are its own: a row that is
|
||||
really a pair of the option space, a field axis that is not a Metal item this module's leg
|
||||
reaches, and a field axis whose call answers a Metal type with a value list, which is an enum
|
||||
under another name.
|
||||
"""
|
||||
|
||||
#: Two values of each type, which is what a cross naming either of them needs.
|
||||
PAIR = "fn go() { let a = [Thing::Beta, Thing::Gamma]; let s = Spread::LEFT | Spread::RIGHT; }"
|
||||
|
||||
def declared(
|
||||
self,
|
||||
text: str = "",
|
||||
cell: str = "blends-case",
|
||||
axes: str = "MTLThing+MTLWidget.spun",
|
||||
reached: str = "blends",
|
||||
ran: dict[str, str] | None = None,
|
||||
):
|
||||
"""The other crossings of a tree whose `blends` module states `text` and declares one row."""
|
||||
root = tree(
|
||||
{"blends": text or self.PAIR},
|
||||
other=f"# module\tcell\taxes\twhat only the cross decides\n"
|
||||
f"blends\t{cell}\t{axes}\tonly the two together say which\n",
|
||||
)
|
||||
held = option_space.inventory(
|
||||
root, ran or {"blends-case": "blends"}, items(reached)
|
||||
)
|
||||
return held["other_crossings"]
|
||||
|
||||
def test_an_enum_crossed_with_a_field_is_counted_apart_from_the_pairs(self):
|
||||
held = self.declared()
|
||||
self.assertEqual(len(held), 1)
|
||||
self.assertEqual(held[0]["axes"], ["MTLThing", "MTLWidget.spun"])
|
||||
self.assertEqual(held[0]["fields"], [("MTLWidget", "spun")])
|
||||
self.assertEqual(held[0]["slots"], [])
|
||||
# No pair of two Metal enums, so it adds nothing to the option space's own count.
|
||||
self.assertEqual(held[0]["pairs"], [])
|
||||
|
||||
def test_the_pairs_count_does_not_hold_these_rows(self):
|
||||
root = tree(
|
||||
{"blends": self.PAIR},
|
||||
other="blends\tblends-case\tMTLThing+MTLWidget.spun\tonly the two together\n",
|
||||
)
|
||||
held = option_space.inventory(root, {"blends-case": "blends"}, items())
|
||||
self.assertEqual(held["crossings"], [])
|
||||
self.assertEqual(len(held["other_crossings"]), 1)
|
||||
|
||||
def test_a_type_crossed_with_itself_names_its_slots(self):
|
||||
held = self.declared(axes="MTLThing+MTLThing")
|
||||
self.assertEqual(held[0]["slots"], ["MTLThing"])
|
||||
self.assertEqual(held[0]["fields"], [])
|
||||
# `(A, A)` is no pair of two types, so the pair count stays empty here too.
|
||||
self.assertEqual(held[0]["pairs"], [])
|
||||
|
||||
def test_three_slots_of_one_type_are_one_row(self):
|
||||
held = self.declared(axes="MTLThing+MTLThing+MTLThing")
|
||||
self.assertEqual(held[0]["axes"], ["MTLThing"] * 3)
|
||||
self.assertEqual(held[0]["slots"], ["MTLThing"])
|
||||
|
||||
def test_two_fields_and_no_enum_at_all_is_a_row(self):
|
||||
held = self.declared(axes="MTLWidget.spun+MTLWidget.setSpread:atIndex:")
|
||||
self.assertEqual(
|
||||
held[0]["fields"], [("MTLWidget", "spun"), ("MTLWidget", "setSpread:atIndex:")]
|
||||
)
|
||||
|
||||
def test_a_row_of_distinct_enums_also_holds_its_pair(self):
|
||||
# A row that crosses two enums **and** a field is no pair-only row, and the two enums it
|
||||
# names are still a pair of the option space: the shape is reported rather than dropped.
|
||||
held = self.declared(axes="MTLThing+MTLSpread+MTLWidget.spun")
|
||||
self.assertEqual(held[0]["pairs"], [("MTLSpread", "MTLThing")])
|
||||
|
||||
def test_a_tree_declaring_none_holds_none(self):
|
||||
root = tree({"blends": self.PAIR})
|
||||
held = option_space.inventory(root, {"blends-case": "blends"}, items())
|
||||
self.assertEqual(held["other_crossings"], [])
|
||||
|
||||
def test_a_row_that_is_really_a_pair_of_the_option_space_is_refused(self):
|
||||
# The refusal that keeps the two counts from overlapping, and keeps a pair from being
|
||||
# declared here to dodge the pairs file's two-values check.
|
||||
with self.assertRaises(SystemExit) as refused:
|
||||
self.declared(axes="MTLThing+MTLSpread")
|
||||
self.assertIn("that is a pair of the option space", str(refused.exception))
|
||||
|
||||
def test_a_field_objc2_metal_binds_nothing_for_is_refused(self):
|
||||
with self.assertRaises(SystemExit) as refused:
|
||||
self.declared(axes="MTLThing+MTLWidget.spunn")
|
||||
self.assertIn("binds no spunn on MTLWidget", str(refused.exception))
|
||||
|
||||
def test_a_field_of_a_type_outside_the_api_is_refused(self):
|
||||
with self.assertRaises(SystemExit) as refused:
|
||||
self.declared(axes="MTLThing+MTLNotAType.spun")
|
||||
self.assertIn("binds no spun on MTLNotAType", str(refused.exception))
|
||||
|
||||
def test_a_field_whose_call_answers_an_enum_is_refused(self):
|
||||
# An enum under another name: declaring it as a field would carry none of the two-values
|
||||
# check that the enum's own spelling carries.
|
||||
with self.assertRaises(SystemExit) as refused:
|
||||
self.declared(axes="MTLSpread+MTLWidget.thing")
|
||||
self.assertIn("whose call answers MTLThing", str(refused.exception))
|
||||
|
||||
def test_a_field_this_modules_metal_leg_does_not_reach_is_refused(self):
|
||||
with self.assertRaises(SystemExit) as refused:
|
||||
self.declared(axes="MTLThing+MTLGadget.whirred")
|
||||
self.assertIn("reaches no call of it", str(refused.exception))
|
||||
|
||||
def test_a_field_no_module_reaches_is_refused_by_name(self):
|
||||
with self.assertRaises(SystemExit) as refused:
|
||||
self.declared(reached="others")
|
||||
self.assertIn("attributes spun to others", str(refused.exception))
|
||||
|
||||
def test_an_axis_that_is_no_metal_item_is_refused(self):
|
||||
# The one kind of axis neither file can hold: a grouping that is no Metal item, so there is
|
||||
# nothing to check it against.
|
||||
with self.assertRaises(SystemExit) as refused:
|
||||
self.declared(axes="MTLThing+the fragment's own sample mask")
|
||||
self.assertIn("neither a Metal type with a generated value list", str(refused.exception))
|
||||
|
||||
def test_an_enum_axis_the_module_states_one_value_of_is_refused(self):
|
||||
# The pairs file's own check, applied here to the enum half of a row: a field axis carries
|
||||
# no such check, and an enum axis must not lose it by sharing a row with one.
|
||||
with self.assertRaises(SystemExit) as refused:
|
||||
self.declared(text="fn go() { let a = [Thing::Beta]; }")
|
||||
self.assertIn("states 1 of its values by name", str(refused.exception))
|
||||
|
||||
def test_a_slot_crossing_of_an_axis_with_one_value_stated_is_refused(self):
|
||||
with self.assertRaises(SystemExit) as refused:
|
||||
self.declared(text="fn go() { let a = [Thing::Beta]; }", axes="MTLThing+MTLThing")
|
||||
self.assertIn("states 1 of its values by name", str(refused.exception))
|
||||
|
||||
def test_a_cell_that_is_not_a_case_of_the_module_is_refused(self):
|
||||
with self.assertRaises(SystemExit) as refused:
|
||||
self.declared(cell="blends-renamed")
|
||||
self.assertIn("which is not a case of blends", str(refused.exception))
|
||||
|
||||
def test_a_module_that_ran_no_metal_is_refused(self):
|
||||
with self.assertRaises(SystemExit) as refused:
|
||||
self.declared(ran={"others-case": "others"})
|
||||
self.assertIn("no case of blends has a recording", str(refused.exception))
|
||||
|
||||
def test_a_family_of_one_recorded_case_is_refused(self):
|
||||
with self.assertRaises(SystemExit) as refused:
|
||||
self.declared(cell="family")
|
||||
self.assertIn("a cross across cases needs at least two", str(refused.exception))
|
||||
|
||||
def test_the_cells_may_be_the_familys_own_cases(self):
|
||||
held = self.declared(
|
||||
cell="family", ran={"blends-one": "blends", "blends-two": "blends"}
|
||||
)
|
||||
self.assertEqual(held[0]["cell"], option_space.FAMILY)
|
||||
|
||||
def test_a_row_of_one_axis_is_refused(self):
|
||||
with self.assertRaises(SystemExit) as refused:
|
||||
self.declared(axes="MTLWidget.spun")
|
||||
self.assertIn("which is one axis", str(refused.exception))
|
||||
|
||||
def test_a_row_saying_nothing_about_the_cross_is_refused(self):
|
||||
root = tree(
|
||||
{"blends": self.PAIR},
|
||||
other="blends\tblends-case\tMTLThing+MTLWidget.spun\t \n",
|
||||
)
|
||||
with self.assertRaises(SystemExit) as refused:
|
||||
option_space.inventory(root, {"blends-case": "blends"}, items())
|
||||
self.assertIn("says nothing about what only the cross decides", str(refused.exception))
|
||||
|
||||
def test_a_malformed_row_is_refused(self):
|
||||
root = tree(
|
||||
{"blends": self.PAIR}, other="blends\tblends-case\tMTLThing+MTLWidget.spun\n"
|
||||
)
|
||||
with self.assertRaises(SystemExit) as refused:
|
||||
option_space.inventory(root, {"blends-case": "blends"}, items())
|
||||
self.assertIn("is not `module", str(refused.exception))
|
||||
|
||||
def test_a_row_declared_twice_is_refused(self):
|
||||
root = tree(
|
||||
{"blends": self.PAIR},
|
||||
other=(
|
||||
"blends\tblends-case\tMTLThing+MTLWidget.spun\tonly the two together\n"
|
||||
"blends\tblends-case\tMTLThing+MTLWidget.spun\tthe same claim again\n"
|
||||
),
|
||||
)
|
||||
with self.assertRaises(SystemExit) as refused:
|
||||
option_space.inventory(root, {"blends-case": "blends"}, items())
|
||||
self.assertIn("is declared twice", str(refused.exception))
|
||||
|
||||
def test_a_tree_handed_no_items_can_declare_no_field_axis(self):
|
||||
# The default: a tree that passes no items has nothing to check a field against, so a
|
||||
# field axis is refused rather than taken on trust.
|
||||
root = tree(
|
||||
{"blends": self.PAIR},
|
||||
other="blends\tblends-case\tMTLThing+MTLWidget.spun\tonly the two together\n",
|
||||
)
|
||||
with self.assertRaises(SystemExit) as refused:
|
||||
option_space.inventory(root, {"blends-case": "blends"})
|
||||
self.assertIn("binds no spun on MTLWidget", str(refused.exception))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user