Leave half-float texel writes to the device: drop the half-bits paths
One work packet, landed as 4 commits (a6e81074ae..77a585c009 on archive/development-linear-2026-10-28), in order: * Leave half-float texel writes to the device: drop the half-bits paths Under the native-arithmetic ruling the device's own write is the answer for a half-float texture's stored NaN, recorded as DeviceNanEncoding (or MetalHalfTexelWrites / MetalHalfStorageNans where measured). Two paths existed only to store Metal's half NaN bits: - the half-texel write route through the texture's unsigned integer alias (StorageImageClass::HalfBits), which a slot that writes a half-float texture took on a device without MetalHalfTexelWrites, with its alias view (metal::format::half_bits_view), its read and write conversions, its imageblock-slice bits leaf, the read note it recorded, and the own-format-views fact a wrapped image without MUTABLE_FORMAT needed to opt out of it (TextureFacts::own_format_views, TextureShape's field, storage_choice_viewed); - the heap twin: StorageFormatClass::HalfBits and its neutral and heap class, the twin's element view, the own-view heap class indices (heap_own_view_index, HALF_BITS_FORMATS, heap_half_bits_indices), the twin write and its class test, RuntimeFact::HeapHalfTexelWrites, bind::heap_write_nans_converted, metal::format::half_write_nans_converted, and the runtime's NanResidue and its draw-time announcement. What a device needs to write such a texture at all is unchanged: a half-float slot is the format's own Identity choice on every profile. The heap write path now records its notes statically: a float write's rounding and NaN as MetalHalfStorageWrites/MetalHalfStorageNans or DeviceColorConversion/DeviceNanEncoding, a half write's NaN as DeviceNanEncoding. Tests follow the behaviour: the format test asserts Identity for every use, the heap texel write test asserts one storage class and the note, the half-slice test asserts the device's widened halves, the half moves and half texel write tests drop the alias case (the latter now checks a declared RGBA16Float on every profile), and the twin-only tests go. Docs the deletion made false are fixed; REFUSALS.md and api_signatures.tsv are regenerated. SEMANTICS_VERSION 1883, ARTIFACT_FORMAT_VERSION 466, RUNTIME_VERSION 1665. Verified so far: cargo check --workspace --all-targets --all-features is clean; conformance-coverage --check and refusal_surface pass. * Drop the half-bits exact form from the llvmpipe half-texel rows The llvmpipe half-texel-nans rows named the read side of the StorageImageClass::HalfBits aliasing as the exact form behind a policy switch; that aliasing is gone under the native-arithmetic ruling, so the sentence describing it is false. The rows' verdicts and the device-nan-encoding sentence stay. Verified: scripts/conformance-coverage/coverage.py --check passes. * Fix the two tests the half-bits deletion left stale device::tests::mechanism numbers every RuntimeFact densely; with HeapHalfTexelWrites gone the last tag moves into its place. merged_argument_buffer_textures_share_one_heap_class bounded the module at 1,600 words (2,300 with word ids) plus the twin's write words where the profile took the twin. Without the twin the bound shows what that allowance covered: on a device that holds an A8Unorm texture's alpha in red (metal::format::alpha_in_red), the heap write's class-index read and conversion, 87 words on RADV RDNA2/RDNA3, ANV ARL/Iris Xe, lavapipe and NVIDIA, 1,591 words elsewhere. The bound now names that allowance. Verified: both tests pass under cargo nextest; clippy -p metal2vulkan --all-targets --all-features -D warnings is clean. * Re-pin the runtime sources at the landing tip The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh.
This commit is contained in:
1 parent
adef203530
commit
7e86900912
44 files changed
+226
-1320
No files matched your search
@@ -114,9 +114,9 @@ format-footprints-two-plane-ten-bit * refused case/MTLPixelFormatRGB10A8_2P/Type
|
||||
# (its `storageMode` 3 on an M3 Max) and `new_buffer` refuses the mode, which no Vulkan buffer
|
||||
# has. The heap size query's memoryless gap is closed -- it answers Metal's uncompressed model
|
||||
# (`texture/heap.rs`'s `memoryless_answer`) -- so only the creator's rows are left.
|
||||
half-texel-nans-r16f RADV divergent case/words/nearest-sample 515 elements differ (U16), the largest difference 33279 Metal's `texture2d<half>` never widens, so a 16-bit float texel's NaN comes back as its own bits (verified: this case's own recording of plain Metal on an M3 Max, macOS 27.0.1). Ours reads the image as `f32` lanes and rounds them (`lower::texture::metal_texel_nans` keeps the device's decode for a half-channel class, which is exact only on a device that widens a half texel exactly), and this device's **sampler** canonicalizes a 16-bit float texel's NaN to 0xFFC00000, its own negative quiet NaN, so every NaN lane of a nearest sample reads 0xFE00 where Metal reads the texel's code. Its image **loads** keep the texel's bits, so `case/words/read` and `case/words/read-through-sample` are exact here, where all three sites differ on MoltenVK. The runtime announces `device-nan-encoding` for it. Open: read a 16-bit float texture's `half` result through an unsigned-integer alias of the image, the read side of the `StorageImageClass::HalfBits` write path, so no device decode sees the texel; on the orchestrator's todo list.
|
||||
half-texel-nans-rg16f RADV divergent case/words/nearest-sample 1025 elements differ (U16), the largest difference 33279 Metal's `texture2d<half>` never widens, so a 16-bit float texel's NaN comes back as its own bits (verified: this case's own recording of plain Metal on an M3 Max, macOS 27.0.1). Ours reads the image as `f32` lanes and rounds them (`lower::texture::metal_texel_nans` keeps the device's decode for a half-channel class, which is exact only on a device that widens a half texel exactly), and this device's **sampler** canonicalizes a 16-bit float texel's NaN to 0xFFC00000, its own negative quiet NaN, so every NaN lane of a nearest sample reads 0xFE00 where Metal reads the texel's code. Its image **loads** keep the texel's bits, so `case/words/read` and `case/words/read-through-sample` are exact here, where all three sites differ on MoltenVK. The runtime announces `device-nan-encoding` for it. Open: read a 16-bit float texture's `half` result through an unsigned-integer alias of the image, the read side of the `StorageImageClass::HalfBits` write path, so no device decode sees the texel; on the orchestrator's todo list.
|
||||
half-texel-nans-rgba16f RADV divergent case/words/nearest-sample 2045 elements differ (U16), the largest difference 33279 Metal's `texture2d<half>` never widens, so a 16-bit float texel's NaN comes back as its own bits (verified: this case's own recording of plain Metal on an M3 Max, macOS 27.0.1). Ours reads the image as `f32` lanes and rounds them (`lower::texture::metal_texel_nans` keeps the device's decode for a half-channel class, which is exact only on a device that widens a half texel exactly), and this device's **sampler** canonicalizes a 16-bit float texel's NaN to 0xFFC00000, its own negative quiet NaN, so every NaN lane of a nearest sample reads 0xFE00 where Metal reads the texel's code. Its image **loads** keep the texel's bits, so `case/words/read` and `case/words/read-through-sample` are exact here, where all three sites differ on MoltenVK. The runtime announces `device-nan-encoding` for it. Open: read a 16-bit float texture's `half` result through an unsigned-integer alias of the image, the read side of the `StorageImageClass::HalfBits` write path, so no device decode sees the texel; on the orchestrator's todo list.
|
||||
half-texel-nans-r16f RADV divergent case/words/nearest-sample 515 elements differ (U16), the largest difference 33279 Metal's `texture2d<half>` never widens, so a 16-bit float texel's NaN comes back as its own bits (verified: this case's own recording of plain Metal on an M3 Max, macOS 27.0.1). Ours reads the image as `f32` lanes and rounds them (`lower::texture::metal_texel_nans` keeps the device's decode for a half-channel class, which is exact only on a device that widens a half texel exactly), and this device's **sampler** canonicalizes a 16-bit float texel's NaN to 0xFFC00000, its own negative quiet NaN, so every NaN lane of a nearest sample reads 0xFE00 where Metal reads the texel's code. Its image **loads** keep the texel's bits, so `case/words/read` and `case/words/read-through-sample` are exact here, where all three sites differ on MoltenVK. The runtime announces `device-nan-encoding` for it.
|
||||
half-texel-nans-rg16f RADV divergent case/words/nearest-sample 1025 elements differ (U16), the largest difference 33279 Metal's `texture2d<half>` never widens, so a 16-bit float texel's NaN comes back as its own bits (verified: this case's own recording of plain Metal on an M3 Max, macOS 27.0.1). Ours reads the image as `f32` lanes and rounds them (`lower::texture::metal_texel_nans` keeps the device's decode for a half-channel class, which is exact only on a device that widens a half texel exactly), and this device's **sampler** canonicalizes a 16-bit float texel's NaN to 0xFFC00000, its own negative quiet NaN, so every NaN lane of a nearest sample reads 0xFE00 where Metal reads the texel's code. Its image **loads** keep the texel's bits, so `case/words/read` and `case/words/read-through-sample` are exact here, where all three sites differ on MoltenVK. The runtime announces `device-nan-encoding` for it.
|
||||
half-texel-nans-rgba16f RADV divergent case/words/nearest-sample 2045 elements differ (U16), the largest difference 33279 Metal's `texture2d<half>` never widens, so a 16-bit float texel's NaN comes back as its own bits (verified: this case's own recording of plain Metal on an M3 Max, macOS 27.0.1). Ours reads the image as `f32` lanes and rounds them (`lower::texture::metal_texel_nans` keeps the device's decode for a half-channel class, which is exact only on a device that widens a half texel exactly), and this device's **sampler** canonicalizes a 16-bit float texel's NaN to 0xFFC00000, its own negative quiet NaN, so every NaN lane of a nearest sample reads 0xFE00 where Metal reads the texel's code. Its image **loads** keep the texel's bits, so `case/words/read` and `case/words/read-through-sample` are exact here, where all three sites differ on MoltenVK. The runtime announces `device-nan-encoding` for it.
|
||||
sample-fills-d32-2 RADV divergent case/samples/d32-2 1 line differs: Metal "after s0 y1: | 3e800000 3e800000 | 00000001 3f800000 | 00000001 3f800000 | 3e800000 3e800000 | 3e800000 3e800000", ours "after s0 y1: | 3e800000 3e800000 | 00000000 3f800000 | 00000000 3f800000 | 3e800000 3e800000 | 3e800000 3e800000" Metal's fill stores every depth value as given, a denormal included, so sample 0 of texel (1,1) holds 0x00000001 (verified: the carried probe `ms.m` on an M3 Max, macOS 27.0.1, which this case replays). Ours stores 0x00000000: this driver stores a denormal a GPU write gives a `D32_SFLOAT` depth image as a zero and keeps only a CPU store's, which is why it has no `DriverFact::DepthImageKeepsDenormals` (`runtime_lane::depth_denormals`, measured 2026-10-10 on the Radeon 780M and reproduced on the RX 7900 XTX 2026-10-24), and a multisampled image takes no CPU store, so the fill has no exact form on this device. The runtime announces `depth-denormals` for the write, which the case declares at its notices site; the depth words still compare exactly there, which is what this row records.
|
||||
sample-fills-d32-4 RADV divergent case/samples/d32-4 1 line differs: Metal "after s0 y1: | 3e800000 3e800000 3e800000 3e800000 | 00000001 3f800000 00000000 3e800000 | 00000001 3f800000 00000000 3e800000 | 3e800000 3e800000 3e800000 3e800000 | 3e800000 3e800000 3e800000 3e800000", ours "after s0 y1: | 3e800000 3e800000 3e800000 3e800000 | 00000000 3f800000 00000000 3e800000 | 00000000 3f800000 00000000 3e800000 | 3e800000 3e800000 3e800000 3e800000 | 3e800000 3e800000 3e800000 3e800000" Metal's fill stores every depth value as given, a denormal included, so sample 0 of texel (1,1) holds 0x00000001 (verified: the carried probe `ms.m` on an M3 Max, macOS 27.0.1, which this case replays). Ours stores 0x00000000: this driver stores a denormal a GPU write gives a `D32_SFLOAT` depth image as a zero and keeps only a CPU store's, which is why it has no `DriverFact::DepthImageKeepsDenormals` (`runtime_lane::depth_denormals`, measured 2026-10-10 on the Radeon 780M and reproduced on the RX 7900 XTX 2026-10-24), and a multisampled image takes no CPU store, so the fill has no exact form on this device. The runtime announces `depth-denormals` for the write, which the case declares at its notices site; the depth words still compare exactly there, which is what this row records.
|
||||
sample-fills-d32s8-4 RADV divergent case/samples/d32s8-4 1 line differs: Metal "after s0 y1: | 3e800000 3e800000 3e800000 3e800000 | 00000001 3f800000 00000000 3e800000 | 00000001 3f800000 00000000 3e800000 | 3e800000 3e800000 3e800000 3e800000 | 3e800000 3e800000 3e800000 3e800000", ours "after s0 y1: | 3e800000 3e800000 3e800000 3e800000 | 00000000 3f800000 00000000 3e800000 | 00000000 3f800000 00000000 3e800000 | 3e800000 3e800000 3e800000 3e800000 | 3e800000 3e800000 3e800000 3e800000" Metal's fill stores every depth value as given, a denormal included, so sample 0 of texel (1,1) holds 0x00000001 (verified: the carried probe `ms.m` on an M3 Max, macOS 27.0.1, which this case replays). Ours stores 0x00000000: this driver stores a denormal a GPU write gives a `D32_SFLOAT` depth image as a zero and keeps only a CPU store's, which is why it has no `DriverFact::DepthImageKeepsDenormals` (`runtime_lane::depth_denormals`, measured 2026-10-10 on the Radeon 780M and reproduced on the RX 7900 XTX 2026-10-24), and a multisampled image takes no CPU store, so the fill has no exact form on this device. The runtime announces `depth-denormals` for the write, which the case declares at its notices site; the depth words still compare exactly there, which is what this row records.
|
||||
@@ -305,15 +305,15 @@ half-output-blends-rgba32f NVIDIA GeForce RTX 5080 Laptop GPU divergent case/ble
|
||||
half-output-blends-rgba32f llvmpipe (LLVM 23.1.1, 256 bits) divergent case/blended/ba-1mba 267 elements differ (U32), the largest difference 68 Metal's stored blend result and ours differ at this site, and the row's count and bound are this run's. The cause is established and is not half precision: Metal's compiler folds the attachment's blend and its format conversion into the fragment function under fast math, rounding the SOURCE product to the attachment's precision and carrying the DESTINATION product into the sum unrounded -- `round(round(Sf*S) + Df*D)` -- where we leave the blend to the device's fixed-function unit and so compute the mirror image, and the pipeline records `PrecisionNote::HalfOutputFastMathBlend` for it (crates/metal2vulkan/src/pipeline/color_writes.rs, `StageIo::half_fast_colors` in pipeline/stage_io.rs). That rule was measured word by word on an Apple M3 Max (macOS 27.0.1) from this family's own committed recordings, and the file's Apple M3 Max rows carry the measurement. The fix is to fold the blend into the fragment function as Metal's compiler does, computing the attachment's own precision inside the shader; that needs the destination value in the module and moves every such pipeline, so it is translator and pipeline work. `half-output-fast-math-blend`'s own definition in pipeline/artifact.rs says validation derives no tolerance from it, so a tolerance here would be the suite overruling the contract under test and the row stays divergent. Folding no blend is ours on every device, but the codes a given device's blend unit produces are its own, which is why the row names this venue and why its numbers are not the Apple rows'. On this venue the bound at `zero-1msa` and `sas-1msa` is exactly the sign bit (32768 at 16-bit words, 2147483648 at 32-bit ones), which is a zero of the other sign rather than a code of difference; which side holds which sign is NOT established by this run, because the report's bound names the magnitude and not its direction. Open: translator and pipeline work, on the orchestrator's todo list.
|
||||
half-output-blends-rgba32f llvmpipe (LLVM 23.1.1, 256 bits) divergent case/blended/bc-1mbc 358 elements differ (U32), the largest difference 106 Metal's stored blend result and ours differ at this site, and the row's count and bound are this run's. The cause is established and is not half precision: Metal's compiler folds the attachment's blend and its format conversion into the fragment function under fast math, rounding the SOURCE product to the attachment's precision and carrying the DESTINATION product into the sum unrounded -- `round(round(Sf*S) + Df*D)` -- where we leave the blend to the device's fixed-function unit and so compute the mirror image, and the pipeline records `PrecisionNote::HalfOutputFastMathBlend` for it (crates/metal2vulkan/src/pipeline/color_writes.rs, `StageIo::half_fast_colors` in pipeline/stage_io.rs). That rule was measured word by word on an Apple M3 Max (macOS 27.0.1) from this family's own committed recordings, and the file's Apple M3 Max rows carry the measurement. The fix is to fold the blend into the fragment function as Metal's compiler does, computing the attachment's own precision inside the shader; that needs the destination value in the module and moves every such pipeline, so it is translator and pipeline work. `half-output-fast-math-blend`'s own definition in pipeline/artifact.rs says validation derives no tolerance from it, so a tolerance here would be the suite overruling the contract under test and the row stays divergent. Folding no blend is ours on every device, but the codes a given device's blend unit produces are its own, which is why the row names this venue and why its numbers are not the Apple rows'. On this venue the bound at `zero-1msa` and `sas-1msa` is exactly the sign bit (32768 at 16-bit words, 2147483648 at 32-bit ones), which is a zero of the other sign rather than a code of difference; which side holds which sign is NOT established by this run, because the report's bound names the magnitude and not its direction. Open: translator and pipeline work, on the orchestrator's todo list.
|
||||
half-output-blends-rgba32f llvmpipe (LLVM 23.1.1, 256 bits) divergent case/blended/bc-1msa 274 elements differ (U32), the largest difference 192 Metal's stored blend result and ours differ at this site, and the row's count and bound are this run's. The cause is established and is not half precision: Metal's compiler folds the attachment's blend and its format conversion into the fragment function under fast math, rounding the SOURCE product to the attachment's precision and carrying the DESTINATION product into the sum unrounded -- `round(round(Sf*S) + Df*D)` -- where we leave the blend to the device's fixed-function unit and so compute the mirror image, and the pipeline records `PrecisionNote::HalfOutputFastMathBlend` for it (crates/metal2vulkan/src/pipeline/color_writes.rs, `StageIo::half_fast_colors` in pipeline/stage_io.rs). That rule was measured word by word on an Apple M3 Max (macOS 27.0.1) from this family's own committed recordings, and the file's Apple M3 Max rows carry the measurement. The fix is to fold the blend into the fragment function as Metal's compiler does, computing the attachment's own precision inside the shader; that needs the destination value in the module and moves every such pipeline, so it is translator and pipeline work. `half-output-fast-math-blend`'s own definition in pipeline/artifact.rs says validation derives no tolerance from it, so a tolerance here would be the suite overruling the contract under test and the row stays divergent. Folding no blend is ours on every device, but the codes a given device's blend unit produces are its own, which is why the row names this venue and why its numbers are not the Apple rows'. On this venue the bound at `zero-1msa` and `sas-1msa` is exactly the sign bit (32768 at 16-bit words, 2147483648 at 32-bit ones), which is a zero of the other sign rather than a code of difference; which side holds which sign is NOT established by this run, because the report's bound names the magnitude and not its direction. Open: translator and pipeline work, on the orchestrator's todo list.
|
||||
half-texel-nans-r16f llvmpipe divergent case/words/nearest-sample 215 elements differ (U16), the largest difference 512 Metal's `half` result of a 16-bit float texel hands back the texel's own NaN code, with its sign, its payload and its signalling bit kept (verified: this case's own committed recording of plain Metal on an M3 Max, macOS 27.0.1), and ours answers a canonicalized code. The cause is that our `half` texel access reads the image as `f32` lanes and converts them back: `lower/texture/half.rs` takes the image instruction's `f32` texel through `narrow::round_texel`, so whatever the device's half-to-float decode canonicalizes is already gone before our conversion sees it. On this venue 215 words a channel differ at EACH of the three access sites with a bound of 512, which is a narrower loss than the Apple venue's (515 words at a bound of 33279, the sign bit among them) and a wider reach than RADV's (where the image loads keep the bits and only the nearest sample moves): this device's decode keeps the sign of every NaN and some of the payload, and all three access paths lose the rest. Exactly which codes survive here is NOT established by this run -- it was read off the report's per-site counts and bound, not off a word-by-word comparison, and a word-by-word read of this venue's own transcript is the first step. The exact form is the one the other venues' rows name: read a half-float texture through its 16-bit integer alias and assemble the `half` from its bits, the read side of the `StorageImageClass::HalfBits` aliasing the translator already has for half texel writes (`lower/texture/slice.rs`), which changes the slot's view and costs per-access work, so by the owner's fast-default rule it belongs behind a `DevicePolicy` switch with its docs/FAST-PATHS.md row. Announced as `device-nan-encoding`, whose own definition in pipeline/artifact.rs says validation derives no tolerance from it, so the row stays divergent. Open: translator work, on the orchestrator's todo list.
|
||||
half-texel-nans-r16f llvmpipe divergent case/words/read 215 elements differ (U16), the largest difference 512 Metal's `half` result of a 16-bit float texel hands back the texel's own NaN code, with its sign, its payload and its signalling bit kept (verified: this case's own committed recording of plain Metal on an M3 Max, macOS 27.0.1), and ours answers a canonicalized code. The cause is that our `half` texel access reads the image as `f32` lanes and converts them back: `lower/texture/half.rs` takes the image instruction's `f32` texel through `narrow::round_texel`, so whatever the device's half-to-float decode canonicalizes is already gone before our conversion sees it. On this venue 215 words a channel differ at EACH of the three access sites with a bound of 512, which is a narrower loss than the Apple venue's (515 words at a bound of 33279, the sign bit among them) and a wider reach than RADV's (where the image loads keep the bits and only the nearest sample moves): this device's decode keeps the sign of every NaN and some of the payload, and all three access paths lose the rest. Exactly which codes survive here is NOT established by this run -- it was read off the report's per-site counts and bound, not off a word-by-word comparison, and a word-by-word read of this venue's own transcript is the first step. The exact form is the one the other venues' rows name: read a half-float texture through its 16-bit integer alias and assemble the `half` from its bits, the read side of the `StorageImageClass::HalfBits` aliasing the translator already has for half texel writes (`lower/texture/slice.rs`), which changes the slot's view and costs per-access work, so by the owner's fast-default rule it belongs behind a `DevicePolicy` switch with its docs/FAST-PATHS.md row. Announced as `device-nan-encoding`, whose own definition in pipeline/artifact.rs says validation derives no tolerance from it, so the row stays divergent. Open: translator work, on the orchestrator's todo list.
|
||||
half-texel-nans-r16f llvmpipe divergent case/words/read-through-sample 215 elements differ (U16), the largest difference 512 Metal's `half` result of a 16-bit float texel hands back the texel's own NaN code, with its sign, its payload and its signalling bit kept (verified: this case's own committed recording of plain Metal on an M3 Max, macOS 27.0.1), and ours answers a canonicalized code. The cause is that our `half` texel access reads the image as `f32` lanes and converts them back: `lower/texture/half.rs` takes the image instruction's `f32` texel through `narrow::round_texel`, so whatever the device's half-to-float decode canonicalizes is already gone before our conversion sees it. On this venue 215 words a channel differ at EACH of the three access sites with a bound of 512, which is a narrower loss than the Apple venue's (515 words at a bound of 33279, the sign bit among them) and a wider reach than RADV's (where the image loads keep the bits and only the nearest sample moves): this device's decode keeps the sign of every NaN and some of the payload, and all three access paths lose the rest. Exactly which codes survive here is NOT established by this run -- it was read off the report's per-site counts and bound, not off a word-by-word comparison, and a word-by-word read of this venue's own transcript is the first step. The exact form is the one the other venues' rows name: read a half-float texture through its 16-bit integer alias and assemble the `half` from its bits, the read side of the `StorageImageClass::HalfBits` aliasing the translator already has for half texel writes (`lower/texture/slice.rs`), which changes the slot's view and costs per-access work, so by the owner's fast-default rule it belongs behind a `DevicePolicy` switch with its docs/FAST-PATHS.md row. Announced as `device-nan-encoding`, whose own definition in pipeline/artifact.rs says validation derives no tolerance from it, so the row stays divergent. Open: translator work, on the orchestrator's todo list.
|
||||
half-texel-nans-rg16f llvmpipe divergent case/words/nearest-sample 428 elements differ (U16), the largest difference 512 Metal's `half` result of a 16-bit float texel hands back the texel's own NaN code, with its sign, its payload and its signalling bit kept (verified: this case's own committed recording of plain Metal on an M3 Max, macOS 27.0.1), and ours answers a canonicalized code. The cause is that our `half` texel access reads the image as `f32` lanes and converts them back: `lower/texture/half.rs` takes the image instruction's `f32` texel through `narrow::round_texel`, so whatever the device's half-to-float decode canonicalizes is already gone before our conversion sees it. On this venue 215 words a channel differ at EACH of the three access sites with a bound of 512, which is a narrower loss than the Apple venue's (515 words at a bound of 33279, the sign bit among them) and a wider reach than RADV's (where the image loads keep the bits and only the nearest sample moves): this device's decode keeps the sign of every NaN and some of the payload, and all three access paths lose the rest. Exactly which codes survive here is NOT established by this run -- it was read off the report's per-site counts and bound, not off a word-by-word comparison, and a word-by-word read of this venue's own transcript is the first step. The exact form is the one the other venues' rows name: read a half-float texture through its 16-bit integer alias and assemble the `half` from its bits, the read side of the `StorageImageClass::HalfBits` aliasing the translator already has for half texel writes (`lower/texture/slice.rs`), which changes the slot's view and costs per-access work, so by the owner's fast-default rule it belongs behind a `DevicePolicy` switch with its docs/FAST-PATHS.md row. Announced as `device-nan-encoding`, whose own definition in pipeline/artifact.rs says validation derives no tolerance from it, so the row stays divergent. Open: translator work, on the orchestrator's todo list.
|
||||
half-texel-nans-rg16f llvmpipe divergent case/words/read 428 elements differ (U16), the largest difference 512 Metal's `half` result of a 16-bit float texel hands back the texel's own NaN code, with its sign, its payload and its signalling bit kept (verified: this case's own committed recording of plain Metal on an M3 Max, macOS 27.0.1), and ours answers a canonicalized code. The cause is that our `half` texel access reads the image as `f32` lanes and converts them back: `lower/texture/half.rs` takes the image instruction's `f32` texel through `narrow::round_texel`, so whatever the device's half-to-float decode canonicalizes is already gone before our conversion sees it. On this venue 215 words a channel differ at EACH of the three access sites with a bound of 512, which is a narrower loss than the Apple venue's (515 words at a bound of 33279, the sign bit among them) and a wider reach than RADV's (where the image loads keep the bits and only the nearest sample moves): this device's decode keeps the sign of every NaN and some of the payload, and all three access paths lose the rest. Exactly which codes survive here is NOT established by this run -- it was read off the report's per-site counts and bound, not off a word-by-word comparison, and a word-by-word read of this venue's own transcript is the first step. The exact form is the one the other venues' rows name: read a half-float texture through its 16-bit integer alias and assemble the `half` from its bits, the read side of the `StorageImageClass::HalfBits` aliasing the translator already has for half texel writes (`lower/texture/slice.rs`), which changes the slot's view and costs per-access work, so by the owner's fast-default rule it belongs behind a `DevicePolicy` switch with its docs/FAST-PATHS.md row. Announced as `device-nan-encoding`, whose own definition in pipeline/artifact.rs says validation derives no tolerance from it, so the row stays divergent. Open: translator work, on the orchestrator's todo list.
|
||||
half-texel-nans-rg16f llvmpipe divergent case/words/read-through-sample 428 elements differ (U16), the largest difference 512 Metal's `half` result of a 16-bit float texel hands back the texel's own NaN code, with its sign, its payload and its signalling bit kept (verified: this case's own committed recording of plain Metal on an M3 Max, macOS 27.0.1), and ours answers a canonicalized code. The cause is that our `half` texel access reads the image as `f32` lanes and converts them back: `lower/texture/half.rs` takes the image instruction's `f32` texel through `narrow::round_texel`, so whatever the device's half-to-float decode canonicalizes is already gone before our conversion sees it. On this venue 215 words a channel differ at EACH of the three access sites with a bound of 512, which is a narrower loss than the Apple venue's (515 words at a bound of 33279, the sign bit among them) and a wider reach than RADV's (where the image loads keep the bits and only the nearest sample moves): this device's decode keeps the sign of every NaN and some of the payload, and all three access paths lose the rest. Exactly which codes survive here is NOT established by this run -- it was read off the report's per-site counts and bound, not off a word-by-word comparison, and a word-by-word read of this venue's own transcript is the first step. The exact form is the one the other venues' rows name: read a half-float texture through its 16-bit integer alias and assemble the `half` from its bits, the read side of the `StorageImageClass::HalfBits` aliasing the translator already has for half texel writes (`lower/texture/slice.rs`), which changes the slot's view and costs per-access work, so by the owner's fast-default rule it belongs behind a `DevicePolicy` switch with its docs/FAST-PATHS.md row. Announced as `device-nan-encoding`, whose own definition in pipeline/artifact.rs says validation derives no tolerance from it, so the row stays divergent. Open: translator work, on the orchestrator's todo list.
|
||||
half-texel-nans-rgba16f llvmpipe divergent case/words/nearest-sample 852 elements differ (U16), the largest difference 512 Metal's `half` result of a 16-bit float texel hands back the texel's own NaN code, with its sign, its payload and its signalling bit kept (verified: this case's own committed recording of plain Metal on an M3 Max, macOS 27.0.1), and ours answers a canonicalized code. The cause is that our `half` texel access reads the image as `f32` lanes and converts them back: `lower/texture/half.rs` takes the image instruction's `f32` texel through `narrow::round_texel`, so whatever the device's half-to-float decode canonicalizes is already gone before our conversion sees it. On this venue 215 words a channel differ at EACH of the three access sites with a bound of 512, which is a narrower loss than the Apple venue's (515 words at a bound of 33279, the sign bit among them) and a wider reach than RADV's (where the image loads keep the bits and only the nearest sample moves): this device's decode keeps the sign of every NaN and some of the payload, and all three access paths lose the rest. Exactly which codes survive here is NOT established by this run -- it was read off the report's per-site counts and bound, not off a word-by-word comparison, and a word-by-word read of this venue's own transcript is the first step. The exact form is the one the other venues' rows name: read a half-float texture through its 16-bit integer alias and assemble the `half` from its bits, the read side of the `StorageImageClass::HalfBits` aliasing the translator already has for half texel writes (`lower/texture/slice.rs`), which changes the slot's view and costs per-access work, so by the owner's fast-default rule it belongs behind a `DevicePolicy` switch with its docs/FAST-PATHS.md row. Announced as `device-nan-encoding`, whose own definition in pipeline/artifact.rs says validation derives no tolerance from it, so the row stays divergent. Open: translator work, on the orchestrator's todo list.
|
||||
half-texel-nans-rgba16f llvmpipe divergent case/words/read 852 elements differ (U16), the largest difference 512 Metal's `half` result of a 16-bit float texel hands back the texel's own NaN code, with its sign, its payload and its signalling bit kept (verified: this case's own committed recording of plain Metal on an M3 Max, macOS 27.0.1), and ours answers a canonicalized code. The cause is that our `half` texel access reads the image as `f32` lanes and converts them back: `lower/texture/half.rs` takes the image instruction's `f32` texel through `narrow::round_texel`, so whatever the device's half-to-float decode canonicalizes is already gone before our conversion sees it. On this venue 215 words a channel differ at EACH of the three access sites with a bound of 512, which is a narrower loss than the Apple venue's (515 words at a bound of 33279, the sign bit among them) and a wider reach than RADV's (where the image loads keep the bits and only the nearest sample moves): this device's decode keeps the sign of every NaN and some of the payload, and all three access paths lose the rest. Exactly which codes survive here is NOT established by this run -- it was read off the report's per-site counts and bound, not off a word-by-word comparison, and a word-by-word read of this venue's own transcript is the first step. The exact form is the one the other venues' rows name: read a half-float texture through its 16-bit integer alias and assemble the `half` from its bits, the read side of the `StorageImageClass::HalfBits` aliasing the translator already has for half texel writes (`lower/texture/slice.rs`), which changes the slot's view and costs per-access work, so by the owner's fast-default rule it belongs behind a `DevicePolicy` switch with its docs/FAST-PATHS.md row. Announced as `device-nan-encoding`, whose own definition in pipeline/artifact.rs says validation derives no tolerance from it, so the row stays divergent. Open: translator work, on the orchestrator's todo list.
|
||||
half-texel-nans-rgba16f llvmpipe divergent case/words/read-through-sample 852 elements differ (U16), the largest difference 512 Metal's `half` result of a 16-bit float texel hands back the texel's own NaN code, with its sign, its payload and its signalling bit kept (verified: this case's own committed recording of plain Metal on an M3 Max, macOS 27.0.1), and ours answers a canonicalized code. The cause is that our `half` texel access reads the image as `f32` lanes and converts them back: `lower/texture/half.rs` takes the image instruction's `f32` texel through `narrow::round_texel`, so whatever the device's half-to-float decode canonicalizes is already gone before our conversion sees it. On this venue 215 words a channel differ at EACH of the three access sites with a bound of 512, which is a narrower loss than the Apple venue's (515 words at a bound of 33279, the sign bit among them) and a wider reach than RADV's (where the image loads keep the bits and only the nearest sample moves): this device's decode keeps the sign of every NaN and some of the payload, and all three access paths lose the rest. Exactly which codes survive here is NOT established by this run -- it was read off the report's per-site counts and bound, not off a word-by-word comparison, and a word-by-word read of this venue's own transcript is the first step. The exact form is the one the other venues' rows name: read a half-float texture through its 16-bit integer alias and assemble the `half` from its bits, the read side of the `StorageImageClass::HalfBits` aliasing the translator already has for half texel writes (`lower/texture/slice.rs`), which changes the slot's view and costs per-access work, so by the owner's fast-default rule it belongs behind a `DevicePolicy` switch with its docs/FAST-PATHS.md row. Announced as `device-nan-encoding`, whose own definition in pipeline/artifact.rs says validation derives no tolerance from it, so the row stays divergent. Open: translator work, on the orchestrator's todo list.
|
||||
half-texel-nans-r16f llvmpipe divergent case/words/nearest-sample 215 elements differ (U16), the largest difference 512 Metal's `half` result of a 16-bit float texel hands back the texel's own NaN code, with its sign, its payload and its signalling bit kept (verified: this case's own committed recording of plain Metal on an M3 Max, macOS 27.0.1), and ours answers a canonicalized code. The cause is that our `half` texel access reads the image as `f32` lanes and converts them back: `lower/texture/half.rs` takes the image instruction's `f32` texel through `narrow::round_texel`, so whatever the device's half-to-float decode canonicalizes is already gone before our conversion sees it. On this venue 215 words a channel differ at EACH of the three access sites with a bound of 512, which is a narrower loss than the Apple venue's (515 words at a bound of 33279, the sign bit among them) and a wider reach than RADV's (where the image loads keep the bits and only the nearest sample moves): this device's decode keeps the sign of every NaN and some of the payload, and all three access paths lose the rest. Exactly which codes survive here is NOT established by this run -- it was read off the report's per-site counts and bound, not off a word-by-word comparison, and a word-by-word read of this venue's own transcript is the first step. Announced as `device-nan-encoding`, whose own definition in pipeline/artifact.rs says validation derives no tolerance from it, so the row stays divergent. Open: translator work, on the orchestrator's todo list.
|
||||
half-texel-nans-r16f llvmpipe divergent case/words/read 215 elements differ (U16), the largest difference 512 Metal's `half` result of a 16-bit float texel hands back the texel's own NaN code, with its sign, its payload and its signalling bit kept (verified: this case's own committed recording of plain Metal on an M3 Max, macOS 27.0.1), and ours answers a canonicalized code. The cause is that our `half` texel access reads the image as `f32` lanes and converts them back: `lower/texture/half.rs` takes the image instruction's `f32` texel through `narrow::round_texel`, so whatever the device's half-to-float decode canonicalizes is already gone before our conversion sees it. On this venue 215 words a channel differ at EACH of the three access sites with a bound of 512, which is a narrower loss than the Apple venue's (515 words at a bound of 33279, the sign bit among them) and a wider reach than RADV's (where the image loads keep the bits and only the nearest sample moves): this device's decode keeps the sign of every NaN and some of the payload, and all three access paths lose the rest. Exactly which codes survive here is NOT established by this run -- it was read off the report's per-site counts and bound, not off a word-by-word comparison, and a word-by-word read of this venue's own transcript is the first step. Announced as `device-nan-encoding`, whose own definition in pipeline/artifact.rs says validation derives no tolerance from it, so the row stays divergent. Open: translator work, on the orchestrator's todo list.
|
||||
half-texel-nans-r16f llvmpipe divergent case/words/read-through-sample 215 elements differ (U16), the largest difference 512 Metal's `half` result of a 16-bit float texel hands back the texel's own NaN code, with its sign, its payload and its signalling bit kept (verified: this case's own committed recording of plain Metal on an M3 Max, macOS 27.0.1), and ours answers a canonicalized code. The cause is that our `half` texel access reads the image as `f32` lanes and converts them back: `lower/texture/half.rs` takes the image instruction's `f32` texel through `narrow::round_texel`, so whatever the device's half-to-float decode canonicalizes is already gone before our conversion sees it. On this venue 215 words a channel differ at EACH of the three access sites with a bound of 512, which is a narrower loss than the Apple venue's (515 words at a bound of 33279, the sign bit among them) and a wider reach than RADV's (where the image loads keep the bits and only the nearest sample moves): this device's decode keeps the sign of every NaN and some of the payload, and all three access paths lose the rest. Exactly which codes survive here is NOT established by this run -- it was read off the report's per-site counts and bound, not off a word-by-word comparison, and a word-by-word read of this venue's own transcript is the first step. Announced as `device-nan-encoding`, whose own definition in pipeline/artifact.rs says validation derives no tolerance from it, so the row stays divergent. Open: translator work, on the orchestrator's todo list.
|
||||
half-texel-nans-rg16f llvmpipe divergent case/words/nearest-sample 428 elements differ (U16), the largest difference 512 Metal's `half` result of a 16-bit float texel hands back the texel's own NaN code, with its sign, its payload and its signalling bit kept (verified: this case's own committed recording of plain Metal on an M3 Max, macOS 27.0.1), and ours answers a canonicalized code. The cause is that our `half` texel access reads the image as `f32` lanes and converts them back: `lower/texture/half.rs` takes the image instruction's `f32` texel through `narrow::round_texel`, so whatever the device's half-to-float decode canonicalizes is already gone before our conversion sees it. On this venue 215 words a channel differ at EACH of the three access sites with a bound of 512, which is a narrower loss than the Apple venue's (515 words at a bound of 33279, the sign bit among them) and a wider reach than RADV's (where the image loads keep the bits and only the nearest sample moves): this device's decode keeps the sign of every NaN and some of the payload, and all three access paths lose the rest. Exactly which codes survive here is NOT established by this run -- it was read off the report's per-site counts and bound, not off a word-by-word comparison, and a word-by-word read of this venue's own transcript is the first step. Announced as `device-nan-encoding`, whose own definition in pipeline/artifact.rs says validation derives no tolerance from it, so the row stays divergent. Open: translator work, on the orchestrator's todo list.
|
||||
half-texel-nans-rg16f llvmpipe divergent case/words/read 428 elements differ (U16), the largest difference 512 Metal's `half` result of a 16-bit float texel hands back the texel's own NaN code, with its sign, its payload and its signalling bit kept (verified: this case's own committed recording of plain Metal on an M3 Max, macOS 27.0.1), and ours answers a canonicalized code. The cause is that our `half` texel access reads the image as `f32` lanes and converts them back: `lower/texture/half.rs` takes the image instruction's `f32` texel through `narrow::round_texel`, so whatever the device's half-to-float decode canonicalizes is already gone before our conversion sees it. On this venue 215 words a channel differ at EACH of the three access sites with a bound of 512, which is a narrower loss than the Apple venue's (515 words at a bound of 33279, the sign bit among them) and a wider reach than RADV's (where the image loads keep the bits and only the nearest sample moves): this device's decode keeps the sign of every NaN and some of the payload, and all three access paths lose the rest. Exactly which codes survive here is NOT established by this run -- it was read off the report's per-site counts and bound, not off a word-by-word comparison, and a word-by-word read of this venue's own transcript is the first step. Announced as `device-nan-encoding`, whose own definition in pipeline/artifact.rs says validation derives no tolerance from it, so the row stays divergent. Open: translator work, on the orchestrator's todo list.
|
||||
half-texel-nans-rg16f llvmpipe divergent case/words/read-through-sample 428 elements differ (U16), the largest difference 512 Metal's `half` result of a 16-bit float texel hands back the texel's own NaN code, with its sign, its payload and its signalling bit kept (verified: this case's own committed recording of plain Metal on an M3 Max, macOS 27.0.1), and ours answers a canonicalized code. The cause is that our `half` texel access reads the image as `f32` lanes and converts them back: `lower/texture/half.rs` takes the image instruction's `f32` texel through `narrow::round_texel`, so whatever the device's half-to-float decode canonicalizes is already gone before our conversion sees it. On this venue 215 words a channel differ at EACH of the three access sites with a bound of 512, which is a narrower loss than the Apple venue's (515 words at a bound of 33279, the sign bit among them) and a wider reach than RADV's (where the image loads keep the bits and only the nearest sample moves): this device's decode keeps the sign of every NaN and some of the payload, and all three access paths lose the rest. Exactly which codes survive here is NOT established by this run -- it was read off the report's per-site counts and bound, not off a word-by-word comparison, and a word-by-word read of this venue's own transcript is the first step. Announced as `device-nan-encoding`, whose own definition in pipeline/artifact.rs says validation derives no tolerance from it, so the row stays divergent. Open: translator work, on the orchestrator's todo list.
|
||||
half-texel-nans-rgba16f llvmpipe divergent case/words/nearest-sample 852 elements differ (U16), the largest difference 512 Metal's `half` result of a 16-bit float texel hands back the texel's own NaN code, with its sign, its payload and its signalling bit kept (verified: this case's own committed recording of plain Metal on an M3 Max, macOS 27.0.1), and ours answers a canonicalized code. The cause is that our `half` texel access reads the image as `f32` lanes and converts them back: `lower/texture/half.rs` takes the image instruction's `f32` texel through `narrow::round_texel`, so whatever the device's half-to-float decode canonicalizes is already gone before our conversion sees it. On this venue 215 words a channel differ at EACH of the three access sites with a bound of 512, which is a narrower loss than the Apple venue's (515 words at a bound of 33279, the sign bit among them) and a wider reach than RADV's (where the image loads keep the bits and only the nearest sample moves): this device's decode keeps the sign of every NaN and some of the payload, and all three access paths lose the rest. Exactly which codes survive here is NOT established by this run -- it was read off the report's per-site counts and bound, not off a word-by-word comparison, and a word-by-word read of this venue's own transcript is the first step. Announced as `device-nan-encoding`, whose own definition in pipeline/artifact.rs says validation derives no tolerance from it, so the row stays divergent. Open: translator work, on the orchestrator's todo list.
|
||||
half-texel-nans-rgba16f llvmpipe divergent case/words/read 852 elements differ (U16), the largest difference 512 Metal's `half` result of a 16-bit float texel hands back the texel's own NaN code, with its sign, its payload and its signalling bit kept (verified: this case's own committed recording of plain Metal on an M3 Max, macOS 27.0.1), and ours answers a canonicalized code. The cause is that our `half` texel access reads the image as `f32` lanes and converts them back: `lower/texture/half.rs` takes the image instruction's `f32` texel through `narrow::round_texel`, so whatever the device's half-to-float decode canonicalizes is already gone before our conversion sees it. On this venue 215 words a channel differ at EACH of the three access sites with a bound of 512, which is a narrower loss than the Apple venue's (515 words at a bound of 33279, the sign bit among them) and a wider reach than RADV's (where the image loads keep the bits and only the nearest sample moves): this device's decode keeps the sign of every NaN and some of the payload, and all three access paths lose the rest. Exactly which codes survive here is NOT established by this run -- it was read off the report's per-site counts and bound, not off a word-by-word comparison, and a word-by-word read of this venue's own transcript is the first step. Announced as `device-nan-encoding`, whose own definition in pipeline/artifact.rs says validation derives no tolerance from it, so the row stays divergent. Open: translator work, on the orchestrator's todo list.
|
||||
half-texel-nans-rgba16f llvmpipe divergent case/words/read-through-sample 852 elements differ (U16), the largest difference 512 Metal's `half` result of a 16-bit float texel hands back the texel's own NaN code, with its sign, its payload and its signalling bit kept (verified: this case's own committed recording of plain Metal on an M3 Max, macOS 27.0.1), and ours answers a canonicalized code. The cause is that our `half` texel access reads the image as `f32` lanes and converts them back: `lower/texture/half.rs` takes the image instruction's `f32` texel through `narrow::round_texel`, so whatever the device's half-to-float decode canonicalizes is already gone before our conversion sees it. On this venue 215 words a channel differ at EACH of the three access sites with a bound of 512, which is a narrower loss than the Apple venue's (515 words at a bound of 33279, the sign bit among them) and a wider reach than RADV's (where the image loads keep the bits and only the nearest sample moves): this device's decode keeps the sign of every NaN and some of the payload, and all three access paths lose the rest. Exactly which codes survive here is NOT established by this run -- it was read off the report's per-site counts and bound, not off a word-by-word comparison, and a word-by-word read of this venue's own transcript is the first step. Announced as `device-nan-encoding`, whose own definition in pipeline/artifact.rs says validation derives no tolerance from it, so the row stays divergent. Open: translator work, on the orchestrator's todo list.
|
||||
sampler-mip-linear llvmpipe divergent case/clamp-float-max/sampled 16 elements differ (F32), the largest difference 2000 Metal's `lodMinClamp` of `FLT_MAX` holds a linear-mip sample at the LAST level: lane 0 answers 2001, the level-2 value, which is the row this case's own recorded table states and which its tests hold. On this venue we answer 1.0, the level-0 value, so the clamp moved no level at all -- the first differing element is Metal 0x44FA2000 against our 0x3F800000, and the site's bound of 2000 is the whole distance between the two levels' values. The clamps reach the device as they are: `metal_lod_clamps` in crates/metal2vulkan-runtime/src/sampler.rs resolves Metal's `min > max` rule and otherwise passes the pair straight into `VkSamplerCreateInfo`'s `minLod` and `maxLod`, so a pair of `FLT_MAX` goes to the driver, whose LOD selection does not resolve it to the last level here. Which half of the pair this driver mishandles is NOT established by this run: the report names the first differing element and the bound, not the driver's arithmetic. The exact form is CPU work at sampler creation -- bring the pair into the range a driver must honour, past the texture's last level meaning the last level, with Vulkan's own `VK_LOD_CLAMP_NONE` of 1000.0 as the open bound -- and it reaches every device. The case's seven other clamp rows are exact here, and so are the nearest and not-mipmapped filters' `float-max` rows, so it is this one row of the family. Open: runtime work, on the orchestrator's todo list.
|
||||
vertex-format-float4 llvmpipe divergent case/MTLVertexFormatFloatRGB9E5/rows 38 elements differ (F32), the largest difference 65409 This is NOT a rounding difference and it is not the narrow-float NaN gap of the sibling rows in the same case. Metal's `float4` fetch of an `MTLVertexFormatFloatRGB9E5` attribute answers 1.0 (0x3F800000) in the fourth component, the missing-component default of a three-channel format, and we answer 0 (0x0) -- the first differing element of every one of these sites. Beyond the default, the `float4` and `half4` legs move 38 of the site's elements with a bound of 65409, a whole value at the top of the format's range (its largest representable value is 65408), so this device's decode of the shared 5-bit exponent parts from Metal's as well, where the `instance-step` leg's 12 differing elements all move by exactly 1 and are consistent with the fourth-component default alone. The cause is that the format is handed to Vulkan's fixed-function vertex input as `VK_FORMAT_E5B9G9R9_UFLOAT_PACK32` (crates/metal2vulkan/src/metal/vertex.rs), and that packed shared-exponent format is not one a driver must offer as a vertex buffer format at all. The translator's own pulled decode is right about both halves and is the exact form already in the tree: `components` in crates/metal2vulkan/src/lower/stage_io/fetch.rs computes `m * 2^(e - 24)` with contraction forbidden, which is exact for a 9-bit mantissa, and `decode` fills a missing fourth component with 1.0. So the fix is to stop handing this format to fixed-function input -- pull the fetch, or carry the Metal format in `VertexFetch::FixedFunction` so the plan can correct after the load, which is the same handle the narrow-float NaN rows need. Which path each leg of this case takes on this device is NOT established by this run; the two legs' different bounds say they differ. Open: translator work, on the orchestrator's todo list.
|
||||
vertex-format-float4 llvmpipe divergent case/MTLVertexFormatUChar2Normalized/rows 8 elements differ (F32), the largest difference 0.00000005960464477539063 Metal converts a normalized vertex field as `c / (2^b - 1)`, correctly rounded, and this device's fixed-function vertex input is one ULP high: at the first differing element Metal answers 0x3EFEFEFF, the nearest `float` to 127/255, and we answer 0x3EFEFF00, the next `float` up, and the site's bound is that one ULP (5.96e-8, or 2.98e-8 where the differing lanes are smaller). The translator already holds the exact form and says so in its own words: `normalized` in crates/metal2vulkan/src/lower/stage_io/fetch.rs computes the quotient through `exact_division::div_exact`'s integer sequence precisely because a device division 'may be an ULP off', so the shader's pulled fetch of these formats is correctly rounded. These rows are fetched by Vulkan's fixed-function vertex input instead (the UNORM format from crates/metal2vulkan/src/metal/vertex.rs), whose normalization is the driver's, and nothing in the compile key says the attribute was a normalized integer, so no correction is emitted after the `Input` load. The fix is the handle the narrow-float NaN rows need as well: carry the attribute's Metal format in `VertexFetch::FixedFunction` so the stage-IO plan can re-normalize exactly after the load, or pull the fetch for a normalized format on a device whose conversion is not exact. Measured on this venue; the same formats are exact on the Apple venue and on RADV, so the one-ULP conversion is this driver's and the missing correction is ours. Open: translator work, on the orchestrator's todo list.
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2548,7 +2548,6 @@ fn record(
|
||||
});
|
||||
}
|
||||
}
|
||||
device.degrade_half_texel_writes(&variant.pipeline().dependencies);
|
||||
objects.degrade_bound_formats(
|
||||
std::slice::from_ref(&variant.pipeline().stage),
|
||||
Some(formats),
|
||||
|
||||
@@ -3183,53 +3183,6 @@ impl Device {
|
||||
});
|
||||
}
|
||||
|
||||
/// Announce `PrecisionNote::DeviceNanEncoding` at a draw or dispatch of a pipeline of
|
||||
/// `dependencies` whose writes through heap handles store half-float members' bits through
|
||||
/// the unsigned integer twin (`RuntimeFact::HeapHalfTexelWrites`), where the device's heap
|
||||
/// holds a live texture such a write stores the device's conversion of a NaN in
|
||||
/// (`heap_sets::NanResidue`: a half-float texture the twin does not hold, and for a `half`
|
||||
/// write a packed small float one). Every texture the device holds is at its resource ID for
|
||||
/// every command (`heap_sets.rs`), so any of them may be one the function's handles name.
|
||||
pub(crate) fn degrade_half_texel_writes(
|
||||
&self,
|
||||
dependencies: &[metal2vulkan::pipeline::RuntimeDependency],
|
||||
) {
|
||||
use metal2vulkan::pipeline::RuntimeFact;
|
||||
let residue = &self.shared().heap_nan_residue;
|
||||
let Some((stage, packed)) = dependencies
|
||||
.iter()
|
||||
.filter_map(|d| match d.fact {
|
||||
RuntimeFact::HeapHalfTexelWrites { stage, packed } => Some((stage, packed)),
|
||||
_ => None,
|
||||
})
|
||||
.find(|&(_, packed)| residue.holds(packed))
|
||||
else {
|
||||
return;
|
||||
};
|
||||
if !self
|
||||
.shared()
|
||||
.announced
|
||||
.pending(Degradation::DeviceNanEncoding)
|
||||
{
|
||||
return;
|
||||
}
|
||||
let packed = match packed {
|
||||
true => " or a packed small float (`RG11B10Float`, `RGB9E5Float`) texture",
|
||||
false => "",
|
||||
};
|
||||
self.degrade(Degradation::DeviceNanEncoding, || {
|
||||
(
|
||||
format!("the {stage:?} function of a pipeline state"),
|
||||
format!(
|
||||
"it writes texels through argument-buffer textures, and the device holds a \
|
||||
half-float texture whose `half` bits its unsigned integer view cannot \
|
||||
store (swizzled, or a wrapped image made without `MUTABLE_FORMAT`){packed}, \
|
||||
whose NaNs the device stores as it converts them, not as Metal does"
|
||||
),
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
/// Announce the specialized notes of `stages` (a variant's) that hold under `specialization`,
|
||||
/// the one a `VkPipeline` of the variant is made with, `at` its making or a bind
|
||||
/// ([`Occurrence`]): the notes the bound formats and samplers leave on an arm that is not
|
||||
|
||||
@@ -57,7 +57,7 @@ use super::function_table::TableShared;
|
||||
use super::generated_commands::Commands;
|
||||
use super::gpu_pools::GpuPools;
|
||||
use super::gpu_time::{self, FromHost, Timing};
|
||||
use super::heap_sets::{DeviceHeaps, NanResidue};
|
||||
use super::heap_sets::DeviceHeaps;
|
||||
use super::host_memory::Importer;
|
||||
use super::interop::Interop;
|
||||
use super::loader_word::LoaderWord;
|
||||
@@ -261,9 +261,6 @@ pub(super) struct DeviceShared {
|
||||
/// The heap sets and the texture table every command buffer shares (`heap_sets.rs`). Its
|
||||
/// lock is taken before `resource_ids`', never under it.
|
||||
pub(super) heaps: Mutex<DeviceHeaps>,
|
||||
/// The live textures the heap holds whose NaN a heap write of a half-float twin's function
|
||||
/// converts (`heap_sets::NanResidue`), read at draws and dispatches without `heaps`.
|
||||
pub(super) heap_nan_residue: NanResidue,
|
||||
/// The live visible-function tables, by resource ID: an argument buffer can name each, for
|
||||
/// a dispatch of the state that made it (`function_table.rs`).
|
||||
pub(super) function_tables: Mutex<BTreeMap<u64, Weak<TableShared>>>,
|
||||
@@ -1726,7 +1723,6 @@ impl Device {
|
||||
sampler_count: SamplerCount::new(limits.max_sampler_allocation_count),
|
||||
sampler_sets: Mutex::default(),
|
||||
heaps: Mutex::default(),
|
||||
heap_nan_residue: NanResidue::default(),
|
||||
function_tables: Mutex::default(),
|
||||
internal: Mutex::new(None),
|
||||
internal_done: OwnTimeline::default(),
|
||||
|
||||
@@ -733,7 +733,6 @@ fn announce(device: &Device, p: &Prepared, objects: &VariantObjects) {
|
||||
[(®ion.specialization, None)],
|
||||
);
|
||||
}
|
||||
device.degrade_half_texel_writes(&p.variant.pipeline().dependencies);
|
||||
device.degrade_bound_formats(std::slice::from_ref(&p.variant.pipeline().stage), None);
|
||||
// The values the variant's plan pushes for the commands the GPU writes.
|
||||
for (n, region) in p.commands.regions.iter().enumerate() {
|
||||
|
||||
@@ -121,7 +121,7 @@ use metal2vulkan::pipeline::{
|
||||
};
|
||||
use std::any::Any;
|
||||
use std::collections::{BTreeMap, HashMap, VecDeque};
|
||||
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::{Arc, Weak};
|
||||
|
||||
/// The heap's set number.
|
||||
@@ -231,57 +231,12 @@ struct Placed {
|
||||
generation: u64,
|
||||
serial: u64,
|
||||
flags: u32,
|
||||
/// Whether a heap write stores the device's conversion of a NaN in it ([`NanResidue::of`]).
|
||||
residue: [bool; 2],
|
||||
/// The key of the buffer whose bytes its images and texel views lie in
|
||||
/// (`Texture::bytes_key`), whose rebind or detach writes its elements again ([`renew_over`]).
|
||||
bytes: Option<ResourceKey>,
|
||||
texture: Weak<TextureShared>,
|
||||
}
|
||||
|
||||
/// The live textures the device's heap holds in which a `float` or `half` write through a heap
|
||||
/// handle of a function that states `RuntimeFact::HeapHalfTexelWrites` stores the device's
|
||||
/// conversion of a NaN, not Metal's (`bind::heap_write_nans_converted`): those of every such
|
||||
/// function (a half-float texture its unsigned integer twin does not hold), and those of one
|
||||
/// whose `half` writes reach packed small floats too. Counted as they are placed and cleared, so
|
||||
/// a draw or dispatch reads them without the `heaps` lock (`Device::degrade_half_texel_writes`).
|
||||
#[derive(Default)]
|
||||
pub(super) struct NanResidue {
|
||||
/// By `packed`: `false` counts the textures every such write converts, `true` those a `half`
|
||||
/// write converts.
|
||||
counts: [AtomicUsize; 2],
|
||||
}
|
||||
|
||||
impl NanResidue {
|
||||
/// Of a texture of `facts`: whether a write under `HeapHalfTexelWrites { packed }` converts
|
||||
/// its NaN, by `packed`.
|
||||
fn of(facts: &metal2vulkan::bind::TextureFacts) -> [bool; 2] {
|
||||
[false, true].map(|packed| metal2vulkan::bind::heap_write_nans_converted(facts, packed))
|
||||
}
|
||||
|
||||
fn add(&self, residue: [bool; 2]) {
|
||||
for (count, held) in self.counts.iter().zip(residue) {
|
||||
if held {
|
||||
count.fetch_add(1, Ordering::Relaxed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn remove(&self, residue: [bool; 2]) {
|
||||
for (count, held) in self.counts.iter().zip(residue) {
|
||||
if held {
|
||||
count.fetch_sub(1, Ordering::Relaxed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether the heap holds a texture whose NaN a write under
|
||||
/// `HeapHalfTexelWrites { packed }` converts.
|
||||
pub(super) fn holds(&self, packed: bool) -> bool {
|
||||
self.counts[usize::from(packed)].load(Ordering::Relaxed) > 0
|
||||
}
|
||||
}
|
||||
|
||||
/// Images retired while command buffers that may read them run (the module docs): each waits
|
||||
/// for the tickets taken before it.
|
||||
#[derive(Debug)]
|
||||
@@ -533,13 +488,12 @@ impl DeviceHeaps {
|
||||
held.push(texture.clone());
|
||||
let facts = texture.facts();
|
||||
let flags = handle_entry_flags(&facts);
|
||||
let residue = NanResidue::of(&facts);
|
||||
let bytes = texture.bytes_key();
|
||||
// The neutral's entry until every set holds the texture.
|
||||
if let Some(table) = &self.table {
|
||||
table.put(id, id, 0, 0);
|
||||
}
|
||||
self.unplace(device, id);
|
||||
self.unplace(id);
|
||||
for entry in self.sets.values_mut() {
|
||||
let (writes, shadow) = texture_writes(device, &entry.images, id, &texture, notes)?;
|
||||
entry.write(device, writes)?;
|
||||
@@ -548,14 +502,12 @@ impl DeviceHeaps {
|
||||
if let Some(table) = &self.table {
|
||||
table.put(id, id, id as u32, flags);
|
||||
}
|
||||
device.shared().heap_nan_residue.add(residue);
|
||||
self.textures.insert(
|
||||
id,
|
||||
Placed {
|
||||
generation,
|
||||
serial,
|
||||
flags,
|
||||
residue,
|
||||
bytes,
|
||||
texture: weak,
|
||||
},
|
||||
@@ -564,17 +516,15 @@ impl DeviceHeaps {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Forget the texture placed at ID `id`, and its count in the device's [`NanResidue`].
|
||||
fn unplace(&mut self, device: &Device, id: u64) {
|
||||
if let Some(placed) = self.textures.remove(&id) {
|
||||
device.shared().heap_nan_residue.remove(placed.residue);
|
||||
}
|
||||
/// Forget the texture placed at ID `id`.
|
||||
fn unplace(&mut self, id: u64) {
|
||||
self.textures.remove(&id);
|
||||
}
|
||||
|
||||
/// Clear ID `id`: the neutral's entry, no element of it kept for a version made later, and
|
||||
/// the neutral at it in each version a command buffer has yet to commit (the module docs).
|
||||
fn clear(&mut self, device: &Device, id: u64) -> Result<(), Error> {
|
||||
self.unplace(device, id);
|
||||
self.unplace(id);
|
||||
for entry in self.sets.values_mut() {
|
||||
entry.shadows.remove(&id);
|
||||
}
|
||||
|
||||
@@ -733,9 +733,7 @@ fn plan_held(
|
||||
Some(_) => choice.vk_format,
|
||||
None => format,
|
||||
});
|
||||
// And a written-only binding's view: a half-float texture's unsigned integer alias,
|
||||
// through which a slot that only writes it stores Metal's bits where the device does
|
||||
// not store a written half's NaN as its bits.
|
||||
// And a written-only binding's view, where its choice differs.
|
||||
views.extend(storage_view_formats(pf, profile));
|
||||
// A `ulong` atomic updates Metal's `ulong` texture (`RG32Uint`) through an
|
||||
// `R64_UINT` view of the same bytes: a texture made for atomics takes it where the
|
||||
@@ -918,9 +916,7 @@ pub(super) fn view_formats(
|
||||
out.push(m.format);
|
||||
}
|
||||
}
|
||||
// A storage binding's views, the read-and-write choice's and a written-only one's (a
|
||||
// half-float texture's unsigned integer alias where the device does not store a written
|
||||
// half's NaN as its bits).
|
||||
// A storage binding's views, the read-and-write choice's and a written-only one's.
|
||||
if usage.contains(ImageUsageFlags::STORAGE) {
|
||||
out.extend(storage_view_formats(pf, profile));
|
||||
}
|
||||
|
||||
@@ -8515,7 +8515,6 @@ impl RenderLowering {
|
||||
};
|
||||
// The formats the draw binds, which a specialized notice names.
|
||||
let formats = |slot| tables.bound_format(slot);
|
||||
device.degrade_half_texel_writes(&variant.pipeline().dependencies);
|
||||
(variant.objects()).degrade_bound_formats(&variant.pipeline().stages, Some(&formats));
|
||||
// A variant whose notes test no bound value is quiet at every draw, and kept as none
|
||||
// (`Device::tests_bound_values`).
|
||||
|
||||
@@ -1940,9 +1940,6 @@ impl RenderLowering {
|
||||
];
|
||||
let tables = crate::binding::Tables::new(&stages);
|
||||
let formats = |slot| tables.bound_format(slot);
|
||||
self.core
|
||||
.device()
|
||||
.degrade_half_texel_writes(&variant.pipeline().dependencies);
|
||||
self.core
|
||||
.device()
|
||||
.degrade_bound_formats(&variant.pipeline().stages, Some(&formats));
|
||||
|
||||
@@ -1113,7 +1113,6 @@ impl RenderLowering {
|
||||
.objects()
|
||||
.tested_formats(&|slot| tables.bound_format(slot))
|
||||
});
|
||||
device.degrade_half_texel_writes(&variant.pipeline().dependencies);
|
||||
device.degrade_bound_formats(
|
||||
std::slice::from_ref(&variant.pipeline().stage),
|
||||
Some(&|slot| tables.bound_format(slot)),
|
||||
|
||||
@@ -57,7 +57,7 @@ use super::address::{ObjectsToken, RangeToken};
|
||||
use super::address_map::AddressModeMap;
|
||||
use super::attachment_stand_in::KeptBacking;
|
||||
use super::attributes::PurgeableState;
|
||||
use super::binding_view::{binding_view, texture_facts, views_as, VkView};
|
||||
use super::binding_view::{binding_view, texture_facts, VkView};
|
||||
use super::buffer::{Buffer, CallerMemory, HostPages, MemoryHold, NotedTexture};
|
||||
use super::buffer_texture::{Texels, TexelsHome};
|
||||
use super::churn_counts::{Owned, Recycled};
|
||||
@@ -133,7 +133,7 @@ use metal2vulkan::error::{
|
||||
Capability, Feature, LinearNeed, RuntimeDriverDefect, SparseNeed, Unsupported,
|
||||
};
|
||||
use metal2vulkan::metal::format::{
|
||||
aspects, is_depth_stencil, storage_view_formats, ycbcr_format, ClearRoute, ExtendedRange,
|
||||
aspects, is_depth_stencil, ycbcr_format, ClearRoute, ExtendedRange,
|
||||
};
|
||||
use metal2vulkan::metal::{PixelFormat, TextureType, TextureUsage};
|
||||
use metal2vulkan::vk::{
|
||||
@@ -4575,17 +4575,6 @@ impl Texture {
|
||||
facts.sparse = self.is_sparse();
|
||||
// A two-plane YCbCr texture whose planes a function may read in place.
|
||||
facts.ycbcr_in_place = self.0.planes_in_place.map(|p| p.words);
|
||||
// A wrapped image made without `MUTABLE_FORMAT` takes no view in a storage binding's
|
||||
// other formats (a half-float texture's unsigned integer alias): its storage slots keep
|
||||
// its own format's view. A texture whose storage binding takes the usage shadow binds
|
||||
// the shadow, made with them.
|
||||
facts.own_format_views = !self.needs_usage_shadow(true)
|
||||
&& self.image().is_ok_and(|image| {
|
||||
let profile = self.device().compile_device().profile();
|
||||
storage_view_formats(record.pixel_format, profile)
|
||||
.iter()
|
||||
.any(|&format| !views_as(image.plan(), format, false))
|
||||
});
|
||||
facts
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
279b25d4ceb5684cd6f9efc45d83750398c9ad2ee2c46d1232f1f9f18c20824b
|
||||
4cbdf0184b91c0c1769d469dda76befee0c1ac4ad864071e3991d14b1c6e3fd4
|
||||
@@ -19,11 +19,8 @@
|
||||
//! stored as another NaN is counted apart, not as a failure, where the device announces
|
||||
//! `device-nan-encoding` (the recorded near-equivalent).
|
||||
//!
|
||||
//! The product writes through the storage choice's class (`metal::format::storage_choice`):
|
||||
//! as computed, the device's conversion rounding every value and storing every NaN; or, on a device
|
||||
//! not measured to store a written `half`'s NaN as its bits, as the bits the shader rounds toward
|
||||
//! zero, through the texture's unsigned integer alias (`StorageImageClass::HalfBits`). A case is
|
||||
//! held to Metal's rounding where the device is measured to make it
|
||||
//! The product writes as computed, the device's conversion rounding every value and storing every
|
||||
//! NaN. A case is held to Metal's rounding where the device is measured to make it
|
||||
//! (`DriverDeviation::MetalHalfStorageWrites`: RADV, ANV, NVIDIA's measured GPUs, lavapipe from
|
||||
//! Mesa 26.0.8 through 26.2.4 and MoltenVK), the measurement of the deviation on that device;
|
||||
//! elsewhere the module records the device's conversion (`PrecisionNote::DeviceColorConversion`),
|
||||
|
||||
@@ -155,7 +155,7 @@ use crate::pipeline::layout::{BindingSource, DescriptorBinding, PipelineLayout};
|
||||
use crate::pipeline::lower_inputs::StorageImageClass;
|
||||
use crate::pipeline::sym::{
|
||||
CombinedSampler, HandleClass, ImageAccess, ImageDim, ImageHandleClass, SampledType, SamplerRef,
|
||||
SlotClass, SlotRef, Stage, StorageFormatClass, SyntheticBinding,
|
||||
SlotClass, SlotRef, Stage, SyntheticBinding,
|
||||
};
|
||||
use crate::vk;
|
||||
|
||||
@@ -271,14 +271,6 @@ pub(crate) fn fit(shape: &TextureShape, class: &ImageHandleClass) -> Fit {
|
||||
&& (!class.depth_compare || is_depth_stencil(pixel_format))
|
||||
&& usage.intersects(needs)
|
||||
&& !(storage && is_depth_stencil(pixel_format));
|
||||
// A float storage group's unsigned integer twin holds exactly the half-float members whose
|
||||
// handles name it ([`half_bits_held`]); every other texture is another class's.
|
||||
if class.format == StorageFormatClass::HalfBits {
|
||||
return match shaped && half_bits_held(shape) {
|
||||
true => Fit::Holds,
|
||||
false => Fit::No,
|
||||
};
|
||||
}
|
||||
// A resident texture of a format the table holds no representation of (ASTC's 4x2 and 8x4
|
||||
// footprints) fits no class: its element is the neutral, and nothing is refused, since the heap
|
||||
// does not know which of its textures the function reads.
|
||||
@@ -297,56 +289,6 @@ pub(crate) fn fit(shape: &TextureShape, class: &ImageHandleClass) -> Fit {
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether a member of facts `shape` is a texture whose `half` bits a heap write stores through
|
||||
/// the unsigned integer twin (`StorageFormatClass::HalfBits`): a texture of
|
||||
/// `metal::texel_format::HALF_BITS_FORMATS` that reads unswizzled and whose image takes views in
|
||||
/// other formats, whose handle carries its own class (one of `heap_half_bits_indices`). One whose
|
||||
/// image takes no view in another format (`TextureFacts::own_format_views`) carries its own-view
|
||||
/// index ([`handle_entry_flags`]) and is written through the float class, as before.
|
||||
fn half_bits_held(shape: &TextureShape) -> bool {
|
||||
match *shape {
|
||||
TextureShape::Texture {
|
||||
pixel_format,
|
||||
swizzle,
|
||||
own_format_views,
|
||||
..
|
||||
} => {
|
||||
!own_format_views
|
||||
&& crate::metal::texel_format::HALF_BITS_FORMATS.contains(&pixel_format)
|
||||
&& crate::metal::texel_format::reads_unswizzled(pixel_format, swizzle)
|
||||
}
|
||||
TextureShape::Buffer { .. } => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether a write through a heap handle of a function that states
|
||||
/// `RuntimeFact::HeapHalfTexelWrites { packed, .. }` stores the device's conversion of a NaN in a
|
||||
/// texture of `facts`, not Metal's: a writable (`ShaderWrite` or `BlockWritesOnly`) texture of
|
||||
/// `R16Float`, `RG16Float` or `RGBA16Float` that the unsigned integer twin does not hold (a
|
||||
/// swizzled one, or one whose image takes no view in another format,
|
||||
/// [`TextureFacts::own_format_views`]), and where `packed` a writable `RG11B10Float` or
|
||||
/// `RGB9E5Float` one, whose canonical NaN the device converts. Every other texture stores
|
||||
/// Metal's answer or is no storage member. A consumer announces
|
||||
/// `PrecisionNote::DeviceNanEncoding` at a draw or dispatch of such a function whose heap holds
|
||||
/// such a texture.
|
||||
pub fn heap_write_nans_converted(facts: &TextureFacts, packed: bool) -> bool {
|
||||
let shape = facts.shape();
|
||||
let TextureShape::Texture {
|
||||
pixel_format,
|
||||
usage,
|
||||
..
|
||||
} = shape
|
||||
else {
|
||||
return false;
|
||||
};
|
||||
let writable = usage
|
||||
.intersects(metal::TextureUsage::SHADER_WRITE | metal::TextureUsage::BLOCK_WRITES_ONLY);
|
||||
let half = crate::metal::texel_format::HALF_BITS_FORMATS.contains(&pixel_format);
|
||||
let small = !crate::metal::texel_format::half_channels(pixel_format)
|
||||
&& crate::metal::format::half_write_nans_converted(pixel_format);
|
||||
writable && ((half && !half_bits_held(&shape)) || (packed && small))
|
||||
}
|
||||
|
||||
/// Whether a member of facts `shape` is a texture a heap reads by its raw texels: an unswizzled,
|
||||
/// not sparse texture of one sample, of a form of `ExtendedRange::HEAP_READ`.
|
||||
fn raw_held(shape: &TextureShape) -> bool {
|
||||
@@ -408,24 +350,6 @@ fn member_view(
|
||||
Feature::ArgumentBufferTextures,
|
||||
)));
|
||||
}
|
||||
// The twin holds the member through its unsigned integer alias, which the device writes
|
||||
// without a format.
|
||||
if class.format == StorageFormatClass::HalfBits {
|
||||
let Some(format) = crate::metal::format::heap_half_bits_view(pixel_format, profile) else {
|
||||
return Err(BindError::Unsupported(Unsupported::not_implemented(
|
||||
Feature::ArgumentBufferTextures,
|
||||
)));
|
||||
};
|
||||
return Ok(ImageViewDesc {
|
||||
view_type: view_type(class)?,
|
||||
format,
|
||||
aspect: vk::ImageAspectFlags::COLOR,
|
||||
layout,
|
||||
components: vk::ComponentMapping::IDENTITY,
|
||||
level: None,
|
||||
shader_swizzle: false,
|
||||
});
|
||||
}
|
||||
if class.access == ImageAccess::Storage {
|
||||
// The class does not say which accesses the function makes, so the member serves
|
||||
// every access the device lets a heap make.
|
||||
@@ -433,13 +357,8 @@ fn member_view(
|
||||
let c = storage_choice(pixel_format, use_, profile).map_err(bind_error)?;
|
||||
// The class's one formatless declaration cannot convert per element: a member is viewed
|
||||
// through its own format.
|
||||
let per_element = matches!(
|
||||
c.class,
|
||||
StorageImageClass::Identity | StorageImageClass::HalfBits
|
||||
);
|
||||
// A half-float member's writes are the device's conversion's, as an `Identity` member's:
|
||||
// the alias a slot only written takes (`StorageImageClass::HalfBits`) is a slot's alone.
|
||||
let aliased = c.alias.is_some() && c.class != StorageImageClass::HalfBits;
|
||||
let per_element = c.class == StorageImageClass::Identity;
|
||||
let aliased = c.alias.is_some();
|
||||
// An `A8Unorm` texture held in red (`StorageImageClass::AlphaInRed`): its `R8_UNORM`
|
||||
// image, whose texels a heap access converts where the handle carries `A8Unorm`'s class
|
||||
// (`metal::texel_format::heap_alpha_in_red_index`), which a swizzle that moves its alpha
|
||||
@@ -537,11 +456,7 @@ pub fn heap_element(
|
||||
/// out-of-bounds alpha of 1; bits 16 to 28 the index of the texture's texel class
|
||||
/// (`metal::texel_format::heap_class_index` of its pixel format and swizzle), by which the shader
|
||||
/// emulates Metal's linear filter of the texture's texels, 0 for a swizzled texture; every other
|
||||
/// bit 0. A writable half-float texture whose image takes no view in another format
|
||||
/// ([`TextureFacts::own_format_views`]) carries its class's own-view index
|
||||
/// (`metal::texel_format::heap_own_view_index`), so a heap write reaches it through the float
|
||||
/// class and not the unsigned integer twin, which cannot view it. A caller passes the word
|
||||
/// through as is.
|
||||
/// bit 0. A caller passes the word through as is.
|
||||
pub fn handle_entry_flags(facts: &TextureFacts) -> u32 {
|
||||
entry_flags(&facts.shape())
|
||||
}
|
||||
@@ -554,21 +469,7 @@ fn entry_flags(shape: &TextureShape) -> u32 {
|
||||
Some(true) => FLAG_OUT_OF_BOUNDS_ALPHA_ONE,
|
||||
_ => 0,
|
||||
};
|
||||
let own_view = match *shape {
|
||||
TextureShape::Texture {
|
||||
usage,
|
||||
own_format_views: true,
|
||||
..
|
||||
} if usage.intersects(
|
||||
metal::TextureUsage::SHADER_WRITE | metal::TextureUsage::BLOCK_WRITES_ONLY,
|
||||
) =>
|
||||
{
|
||||
crate::metal::texel_format::heap_own_view_index(pixel_format, swizzle)
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
let index = own_view
|
||||
.unwrap_or_else(|| crate::metal::texel_format::heap_class_index(pixel_format, swizzle));
|
||||
let index = crate::metal::texel_format::heap_class_index(pixel_format, swizzle);
|
||||
let class = index << FLAG_TEXEL_CLASS.trailing_zeros();
|
||||
alpha | (class & FLAG_TEXEL_CLASS)
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ fn shape(ty: TextureType, pf: PixelFormat, samples: u32, usage: TextureUsage) ->
|
||||
TextureShape::Texture {
|
||||
address_modes: crate::metal::sampler::AddressModeMap::IDENTITY,
|
||||
offset_base_axes: 0,
|
||||
own_format_views: false,
|
||||
ycbcr_in_place: false,
|
||||
texture_type: ty,
|
||||
pixel_format: pf,
|
||||
@@ -1452,88 +1451,3 @@ fn a_heap_member_a_mode_two_write_would_round_is_refused() {
|
||||
}
|
||||
assert!(checked > 0, "no profile holds a format the check refuses");
|
||||
}
|
||||
|
||||
/// On a profile where a heap write stores half-float members' bits through the unsigned integer
|
||||
/// twin (`metal::format::heap_half_bits`), the twin class is a heap class and holds exactly the
|
||||
/// writable, unswizzled `R16Float`, `RG16Float` and `RGBA16Float` textures whose image takes
|
||||
/// views in other formats, each through its unsigned integer alias; one whose image takes no
|
||||
/// other view carries its class's own-view index, the neutral in the twin, and is a texture a
|
||||
/// heap write converts (`heap_write_nans_converted`), as a packed small float is for a `half`
|
||||
/// write. Elsewhere no twin class exists.
|
||||
#[test]
|
||||
fn a_half_float_member_is_held_through_its_alias_in_the_unsigned_twin() {
|
||||
use crate::metal::texel_format::{heap_class_index, heap_own_view_index, HALF_BITS_FORMATS};
|
||||
use crate::metal::TextureSwizzleChannels as Swizzle;
|
||||
let mut twins = 0;
|
||||
for (stem, p) in &committed_profiles().expect("profiles") {
|
||||
let twin = ImageHandleClass {
|
||||
format: StorageFormatClass::HalfBits,
|
||||
..class(
|
||||
ImageDim::D2,
|
||||
false,
|
||||
false,
|
||||
SampledType::Uint,
|
||||
ImageAccess::Storage,
|
||||
)
|
||||
};
|
||||
let declared = heap_classes(p).contains(&HandleClass::Image(twin));
|
||||
assert_eq!(declared, crate::metal::format::heap_half_bits(p), "{stem}");
|
||||
if !declared {
|
||||
continue;
|
||||
}
|
||||
twins += 1;
|
||||
let layout = vk::ImageLayout::GENERAL;
|
||||
let element = |facts: &TextureFacts| {
|
||||
heap_element(p, &HandleClass::Image(twin), facts, layout).expect("an element")
|
||||
};
|
||||
let facts = |pf: PixelFormat, usage: TextureUsage, own: bool| {
|
||||
let mut f = TextureFacts::new(TextureType::Type2D, pf);
|
||||
f.usage = usage;
|
||||
f.own_format_views = own;
|
||||
f
|
||||
};
|
||||
let aliases = [
|
||||
vk::Format::R16_UINT,
|
||||
vk::Format::R16G16_UINT,
|
||||
vk::Format::R16G16B16A16_UINT,
|
||||
];
|
||||
for (&pf, alias) in HALF_BITS_FORMATS.iter().zip(aliases) {
|
||||
let held = facts(pf, WRITE, false);
|
||||
match element(&held) {
|
||||
HeapElement::View(v) => assert_eq!(v.format, alias, "{stem} {pf:?}"),
|
||||
other => panic!("{stem} {pf:?}: {other:?}"),
|
||||
}
|
||||
let flags = handle_entry_flags(&held) >> FLAG_TEXEL_CLASS.trailing_zeros();
|
||||
let own = heap_class_index(pf, Swizzle::DEFAULT);
|
||||
assert_eq!(flags, own, "{stem} {pf:?}");
|
||||
assert!(!heap_write_nans_converted(&held, true), "{stem} {pf:?}");
|
||||
// An image of its own format's views alone: the float class's, announced.
|
||||
let wrapped = facts(pf, WRITE, true);
|
||||
assert_eq!(element(&wrapped), HeapElement::Neutral, "{stem} {pf:?}");
|
||||
let flags = handle_entry_flags(&wrapped) >> FLAG_TEXEL_CLASS.trailing_zeros();
|
||||
assert_eq!(
|
||||
Some(flags),
|
||||
heap_own_view_index(pf, Swizzle::DEFAULT),
|
||||
"{stem} {pf:?}"
|
||||
);
|
||||
assert!(heap_write_nans_converted(&wrapped, false), "{stem} {pf:?}");
|
||||
// Not writable: no storage member, nothing converted.
|
||||
let read = facts(pf, READ, false);
|
||||
assert_eq!(element(&read), HeapElement::Neutral, "{stem} {pf:?}");
|
||||
assert!(!heap_write_nans_converted(&read, true), "{stem} {pf:?}");
|
||||
}
|
||||
for pf in [
|
||||
PixelFormat::RGBX16Float,
|
||||
PixelFormat::RGBA32Float,
|
||||
PixelFormat::RGBA16Uint,
|
||||
PixelFormat::RG11B10Float,
|
||||
] {
|
||||
let f = facts(pf, WRITE, false);
|
||||
assert_eq!(element(&f), HeapElement::Neutral, "{stem} {pf:?}");
|
||||
let small = pf == PixelFormat::RG11B10Float;
|
||||
assert!(!heap_write_nans_converted(&f, false), "{stem} {pf:?}");
|
||||
assert_eq!(heap_write_nans_converted(&f, true), small, "{stem} {pf:?}");
|
||||
}
|
||||
}
|
||||
assert!(twins > 0, "no committed profile takes the twin");
|
||||
}
|
||||
@@ -225,9 +225,8 @@ pub use graphics::{
|
||||
TessellationDispatch, TessellationRecords,
|
||||
};
|
||||
pub use heap::{
|
||||
handle_entry, handle_entry_flags, heap_classes, heap_element, heap_raw_form,
|
||||
heap_write_nans_converted, HeapElement, HeapElements, HeapSource, HANDLE_ENTRY_BYTES,
|
||||
HANDLE_TABLE_CAPACITY, NEUTRAL_HEAP_ELEMENT,
|
||||
handle_entry, handle_entry_flags, heap_classes, heap_element, heap_raw_form, HeapElement,
|
||||
HeapElements, HeapSource, HANDLE_ENTRY_BYTES, HANDLE_TABLE_CAPACITY, NEUTRAL_HEAP_ELEMENT,
|
||||
};
|
||||
pub use index_bounds::{
|
||||
index_bounds_fill_module, index_bounds_fill_run_module, index_bounds_plan_module,
|
||||
|
||||
@@ -69,9 +69,6 @@ impl NeutralResource {
|
||||
let format = match (storage, class.format) {
|
||||
(false, StorageFormatClass::NotStorage) => None,
|
||||
(true, StorageFormatClass::Unknown) => Some(storage_neutral(class.sampled_type)),
|
||||
(true, StorageFormatClass::HalfBits) if class.sampled_type == SampledType::Uint => {
|
||||
Some(storage_neutral(class.sampled_type))
|
||||
}
|
||||
(true, StorageFormatClass::Format(f)) if serves(f, class.sampled_type) => Some(f),
|
||||
_ => return None,
|
||||
};
|
||||
@@ -182,12 +179,9 @@ pub(crate) fn numeric_type(format: vk::Format) -> Option<SampledType> {
|
||||
/// dimension, arrayed-ness, and sample count SPIR-V allows, each numeric type, depth comparison for
|
||||
/// float 2D and cube images, sampled or storage with each storage format class the profile
|
||||
/// supports. Cube arrays need `imageCubeArray`, multisampled storage images
|
||||
/// `shaderStorageImageMultisample`. And the unsigned integer twin of a float storage heap group
|
||||
/// (`StorageFormatClass::HalfBits`) of each shape a heap writes, where a heap write stores a
|
||||
/// half-float member's bits through it (`metal::format::heap_half_bits`).
|
||||
/// `shaderStorageImageMultisample`.
|
||||
pub fn image_classes(profile: &DeviceProfile) -> Vec<ImageHandleClass> {
|
||||
let f = profile.fields();
|
||||
let half_bits = crate::metal::format::heap_half_bits(profile);
|
||||
let types = [SampledType::Float, SampledType::Sint, SampledType::Uint];
|
||||
let shapes = [
|
||||
(ImageDim::D1, false, false),
|
||||
@@ -252,16 +246,6 @@ pub fn image_classes(profile: &DeviceProfile) -> Vec<ImageHandleClass> {
|
||||
out.push(class(ty, false, ImageAccess::Storage, format));
|
||||
}
|
||||
}
|
||||
// A float storage heap group's unsigned integer twin, of the shapes a heap writes.
|
||||
let written = !multisampled && !matches!(dim, ImageDim::Cube | ImageDim::Buffer);
|
||||
if ty == SampledType::Uint && written && half_bits {
|
||||
out.push(class(
|
||||
ty,
|
||||
false,
|
||||
ImageAccess::Storage,
|
||||
StorageFormatClass::HalfBits,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
out
|
||||
|
||||
@@ -59,8 +59,8 @@ use crate::error::{BindError, Capability, Error, Feature, LowerFamily, Unsupport
|
||||
use crate::metal::bicubic::{texels as bicubic_texels, BicubicTexels};
|
||||
use crate::metal::format::{
|
||||
accessed_without_format, aspects, direct_format, is_depth_stencil, sampled_type, srgb_raw_twin,
|
||||
storage_choice_viewed, texel_buffer_alpha_in_red, vk_format, writes_dropped,
|
||||
ycbcr_writes_stored, ExtendedRange, FormatMapping, StorageUse,
|
||||
storage_choice, texel_buffer_alpha_in_red, vk_format, writes_dropped, ycbcr_writes_stored,
|
||||
ExtendedRange, FormatMapping, StorageUse,
|
||||
};
|
||||
use crate::metal::sampler::{
|
||||
check_border_view, check_sampler, opaque_black_reads_transparent, vk_filtering,
|
||||
@@ -982,18 +982,10 @@ impl ResourcePlanner<'_> {
|
||||
vk::Format::R32G32B32A32_UINT,
|
||||
)),
|
||||
Some(
|
||||
bound @ (TextureShape::Texture { pixel_format, .. }
|
||||
| TextureShape::Buffer { pixel_format, .. }),
|
||||
TextureShape::Texture { pixel_format, .. }
|
||||
| TextureShape::Buffer { pixel_format, .. },
|
||||
) if accessed => {
|
||||
let aliased = !matches!(
|
||||
bound,
|
||||
TextureShape::Texture {
|
||||
own_format_views: true,
|
||||
..
|
||||
}
|
||||
);
|
||||
let c = storage_choice_viewed(pixel_format, use_, self.profile, aliased)
|
||||
.map_err(bind_error)?;
|
||||
let c = storage_choice(pixel_format, use_, self.profile).map_err(bind_error)?;
|
||||
let view = direct_format(pixel_format)
|
||||
.ok_or_else(|| internal("a storage texture without a format"))?;
|
||||
Some((c, view))
|
||||
@@ -1013,22 +1005,13 @@ impl ResourcePlanner<'_> {
|
||||
}
|
||||
other => other,
|
||||
};
|
||||
// A half-float texture the function only writes through its unsigned integer alias
|
||||
// (`StorageImageClass::HalfBits`), and an `RGB9E5Float` texture through `R32_UINT`
|
||||
// (`StorageImageClass::SharedExponentBits`): the slot is declared of the alias's numeric
|
||||
// type, as its neutral is.
|
||||
// An `RGB9E5Float` texture through `R32_UINT` (`StorageImageClass::SharedExponentBits`):
|
||||
// the slot is declared of the alias's numeric type, as its neutral is.
|
||||
let base = match choice {
|
||||
Some((c, _))
|
||||
if matches!(
|
||||
c.class,
|
||||
StorageImageClass::HalfBits | StorageImageClass::SharedExponentBits
|
||||
) =>
|
||||
{
|
||||
ImageHandleClass {
|
||||
sampled_type: SampledType::Uint,
|
||||
..base
|
||||
}
|
||||
}
|
||||
Some((c, _)) if c.class == StorageImageClass::SharedExponentBits => ImageHandleClass {
|
||||
sampled_type: SampledType::Uint,
|
||||
..base
|
||||
},
|
||||
_ => base,
|
||||
};
|
||||
let mut variant = choice
|
||||
|
||||
@@ -91,7 +91,6 @@ fn compatibility_is_type_samples_numeric_type_and_depth() {
|
||||
let tex = |texture_type, pixel_format, sample_count| TextureShape::Texture {
|
||||
address_modes: crate::metal::sampler::AddressModeMap::IDENTITY,
|
||||
offset_base_axes: 0,
|
||||
own_format_views: false,
|
||||
ycbcr_in_place: false,
|
||||
texture_type,
|
||||
pixel_format,
|
||||
@@ -162,7 +161,6 @@ fn a_ulong_slot_binds_only_rg32uint_textures() {
|
||||
let tex = |pixel_format| TextureShape::Texture {
|
||||
address_modes: crate::metal::sampler::AddressModeMap::IDENTITY,
|
||||
offset_base_axes: 0,
|
||||
own_format_views: false,
|
||||
ycbcr_in_place: false,
|
||||
texture_type: TextureType::Type2D,
|
||||
pixel_format,
|
||||
@@ -256,7 +254,6 @@ fn a_numeric_slot_binds_either_integer_type() {
|
||||
TextureShape::Texture {
|
||||
address_modes: crate::metal::sampler::AddressModeMap::IDENTITY,
|
||||
offset_base_axes: 0,
|
||||
own_format_views: false,
|
||||
ycbcr_in_place: false,
|
||||
texture_type: TextureType::Type2D,
|
||||
pixel_format,
|
||||
@@ -624,7 +621,6 @@ fn an_immutable_linear_sampler_needs_a_filterable_view() {
|
||||
TextureShape::Texture {
|
||||
address_modes: crate::metal::sampler::AddressModeMap::IDENTITY,
|
||||
offset_base_axes: 0,
|
||||
own_format_views: false,
|
||||
ycbcr_in_place: false,
|
||||
texture_type: TextureType::Type2D,
|
||||
pixel_format: pf,
|
||||
@@ -725,7 +721,6 @@ fn a_linear_compare_sampler_needs_no_filterable_view() {
|
||||
TextureShape::Texture {
|
||||
address_modes: crate::metal::sampler::AddressModeMap::IDENTITY,
|
||||
offset_base_axes: 0,
|
||||
own_format_views: false,
|
||||
ycbcr_in_place: false,
|
||||
texture_type: TextureType::Type2D,
|
||||
pixel_format: pf,
|
||||
@@ -820,7 +815,6 @@ fn bicubic_texels_follow_the_bound_format() {
|
||||
TextureShape::Texture {
|
||||
address_modes: crate::metal::sampler::AddressModeMap::IDENTITY,
|
||||
offset_base_axes: 0,
|
||||
own_format_views: false,
|
||||
ycbcr_in_place: false,
|
||||
texture_type: TextureType::Type2D,
|
||||
pixel_format: pf,
|
||||
@@ -915,7 +909,6 @@ fn an_explicit_cube_gradient_binding_takes_an_anisotropic_sampler_isotropically(
|
||||
TextureShape::Texture {
|
||||
address_modes: crate::metal::sampler::AddressModeMap::IDENTITY,
|
||||
offset_base_axes: 0,
|
||||
own_format_views: false,
|
||||
ycbcr_in_place: false,
|
||||
texture_type: TextureType::Cube,
|
||||
pixel_format: PixelFormat::RGBA8Unorm,
|
||||
@@ -1124,7 +1117,6 @@ fn texel_format_follows_the_bound_format() {
|
||||
Some(TextureShape::Texture {
|
||||
address_modes: crate::metal::sampler::AddressModeMap::IDENTITY,
|
||||
offset_base_axes: 0,
|
||||
own_format_views: false,
|
||||
ycbcr_in_place: false,
|
||||
texture_type: TextureType::Type2D,
|
||||
pixel_format,
|
||||
@@ -1308,7 +1300,6 @@ fn a_separate_pair_takes_the_combined_pairs_checks() {
|
||||
TextureShape::Texture {
|
||||
address_modes: crate::metal::sampler::AddressModeMap::IDENTITY,
|
||||
offset_base_axes: 0,
|
||||
own_format_views: false,
|
||||
ycbcr_in_place: false,
|
||||
texture_type: TextureType::Type2D,
|
||||
pixel_format: pf,
|
||||
|
||||
@@ -1148,7 +1148,6 @@ impl TextureFacts {
|
||||
swizzle: self.swizzle,
|
||||
address_modes: self.address_modes,
|
||||
offset_base_axes: self.offset_base_axes(),
|
||||
own_format_views: self.own_format_views,
|
||||
ycbcr_in_place: self.ycbcr_in_place.is_some(),
|
||||
}
|
||||
}
|
||||
@@ -1362,13 +1361,6 @@ pub struct TextureFacts {
|
||||
/// (`SpecKey::OffsetBaseAxes`, [`TextureFacts::offset_base_axes`]).
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
pub parent_base_size: [u32; 3],
|
||||
/// The texture's image is viewed in its own format alone: a wrapped image made without
|
||||
/// `MUTABLE_FORMAT` (`false` for every texture the runtime makes). A storage slot that only
|
||||
/// writes such a half-float texture is bound through the format's own view, with the class
|
||||
/// it took previously (its `half` NaNs the device's, announced), not the unsigned integer alias
|
||||
/// (`StorageImageClass::HalfBits`) the image cannot take.
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
pub own_format_views: bool,
|
||||
/// The texture's two planes, where a function reads them in place
|
||||
/// ([`YCbCrInPlace`](crate::bind::YCbCrInPlace), the runtime's extension): a two-plane YCbCr
|
||||
/// texture of a converted 4:2:0 format whose planes the consumer views as one texel buffer.
|
||||
@@ -1396,7 +1388,6 @@ impl TextureFacts {
|
||||
address_modes: metal::sampler::AddressModeMap::IDENTITY,
|
||||
parent_relative_level: 0,
|
||||
parent_base_size: [0; 3],
|
||||
own_format_views: false,
|
||||
ycbcr_in_place: None,
|
||||
}
|
||||
}
|
||||
@@ -1990,11 +1981,6 @@ pub enum TextureShape {
|
||||
/// rule specializes on them (`SpecKey::OffsetBaseAxes`).
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
offset_base_axes: u8,
|
||||
/// The texture's image is viewed in its own format alone
|
||||
/// ([`TextureFacts::own_format_views`]): a storage slot takes no alias view of it that
|
||||
/// another choice serves.
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
own_format_views: bool,
|
||||
/// The texture's planes are read in place where a slot's function reads them so
|
||||
/// ([`TextureFacts::ycbcr_in_place`]): such a slot takes its in-place variant
|
||||
/// (`VariantKey::ycbcr_in_place`).
|
||||
|
||||
+1
-2
@@ -824,7 +824,7 @@ codec_enum! {
|
||||
ImageDim { D1, D2, D3, Cube, Buffer }
|
||||
SampledType { Float, Sint, Uint, Uint64 }
|
||||
ImageAccess { Sampled, Storage }
|
||||
StorageFormatClass { NotStorage, Unknown, Format(f0), HalfBits }
|
||||
StorageFormatClass { NotStorage, Unknown, Format(f0) }
|
||||
HandleClass { Image(f0), Sampler { compare, integer, cube_gradient }, FunctionTable }
|
||||
SyntheticBinding {
|
||||
ArgumentTable, ExecutionStatus, RootTable, HandleTable, ConstantBlob, TessellationFactors, Imageblock,
|
||||
@@ -1263,7 +1263,6 @@ codec_enum! {
|
||||
HeapCrossClassNeutral { stage, class, every_member },
|
||||
AnisotropicSampler { slot },
|
||||
StorageTextureIntegerChannels { slot },
|
||||
HeapHalfTexelWrites { stage, packed },
|
||||
MovableStorageWrites { early_variant },
|
||||
SynthesizedGeometry { weights, layer, viewport },
|
||||
ObjectThreadgroupArena { static_bytes, payload },
|
||||
|
||||
Vendored
+3
-3
@@ -60,7 +60,7 @@ mod tests;
|
||||
/// unchanged version, and its bless records the version. Independent of the crate's version and of
|
||||
/// [`ARTIFACT_FORMAT_VERSION`]. The commit that bumps it says what changed; this comment keeps no
|
||||
/// history.
|
||||
pub const SEMANTICS_VERSION: u32 = 1880;
|
||||
pub const SEMANTICS_VERSION: u32 = 1883;
|
||||
|
||||
/// The byte-layout version of encoded artifacts (`CompiledFunction::to_bytes` and the
|
||||
/// [`PipelineArtifact`] encodings). Every encoded artifact carries it, and a decode under another
|
||||
@@ -70,7 +70,7 @@ pub const SEMANTICS_VERSION: u32 = 1880;
|
||||
/// re-typed in an encoded type, its `codec` body or its `envelope`. A variant removed while its tag
|
||||
/// stays unused needs no bump: an entry holding it fails to decode, which is a miss. The commit that
|
||||
/// bumps it says what changed; this comment keeps no history.
|
||||
pub const ARTIFACT_FORMAT_VERSION: u32 = 464;
|
||||
pub const ARTIFACT_FORMAT_VERSION: u32 = 466;
|
||||
|
||||
/// The version of what this crate's runtime does with a compiled pipeline: instantiating a binding
|
||||
/// plan (`BindingPlan::instantiate_*`: descriptor ranges, push bytes, root, argument, and handle
|
||||
@@ -93,7 +93,7 @@ pub const ARTIFACT_FORMAT_VERSION: u32 = 464;
|
||||
/// changes no behaviour, and then updates that hash alone with the commit saying why, or changes
|
||||
/// behaviour and also bumps this version. The commit that bumps it says what changed; this comment
|
||||
/// keeps no history.
|
||||
pub const RUNTIME_VERSION: u32 = 1662;
|
||||
pub const RUNTIME_VERSION: u32 = 1665;
|
||||
|
||||
/// The digest of the sources this build of the crate was compiled from: SHA-256, as lowercase hex,
|
||||
/// of the manifest, the build script, and exactly the files the crate roots' module tree compiles
|
||||
|
||||
@@ -251,9 +251,6 @@ pub fn mechanism(fact: &RuntimeFact, profile: &DeviceProfile) -> Mechanism {
|
||||
// Keyed by the slots bound to a sampler whose word states anisotropy, where the
|
||||
// function's samples take Metal's anisotropic filter, emulated.
|
||||
RuntimeFact::AnisotropicSampler { .. } => Mechanism::Variant,
|
||||
// The binder holds each half-float member the twin takes there; the consumer announces
|
||||
// a member it does not take where its heap holds one.
|
||||
RuntimeFact::HeapHalfTexelWrites { .. } => Mechanism::BinderView,
|
||||
// The pipeline's own stages, which every draw of its class runs; the consumer announces
|
||||
// them.
|
||||
RuntimeFact::SynthesizedGeometry { .. } => Mechanism::None,
|
||||
|
||||
@@ -238,10 +238,6 @@ fn every_fact() -> Vec<RuntimeFact> {
|
||||
index: 0,
|
||||
},
|
||||
},
|
||||
RuntimeFact::HeapHalfTexelWrites {
|
||||
stage: Stage::Kernel,
|
||||
packed: true,
|
||||
},
|
||||
RuntimeFact::MovableStorageWrites {
|
||||
early_variant: true,
|
||||
},
|
||||
@@ -350,7 +346,6 @@ fn variant(f: &RuntimeFact) -> usize {
|
||||
RuntimeFact::HeapCrossClassNeutral { .. } => 79,
|
||||
RuntimeFact::AnisotropicSampler { .. } => 80,
|
||||
RuntimeFact::StorageTextureIntegerChannels { .. } => 81,
|
||||
RuntimeFact::HeapHalfTexelWrites { .. } => 82,
|
||||
RuntimeFact::MovableStorageWrites { .. } => 83,
|
||||
RuntimeFact::SynthesizedGeometry { .. } => 84,
|
||||
RuntimeFact::ObjectThreadgroupArena { .. } => 85,
|
||||
@@ -358,7 +353,7 @@ fn variant(f: &RuntimeFact) -> usize {
|
||||
RuntimeFact::ReplayBindings => 88,
|
||||
RuntimeFact::MergedDraws => 89,
|
||||
RuntimeFact::QuadPrimitiveIds => 90,
|
||||
RuntimeFact::RotatedWeights => 91,
|
||||
RuntimeFact::RotatedWeights => 82,
|
||||
RuntimeFact::PrivateList => 86,
|
||||
RuntimeFact::MeshLastFirst => 71,
|
||||
RuntimeFact::YCbCrInPlace { .. } => 65,
|
||||
@@ -369,7 +364,7 @@ fn variant(f: &RuntimeFact) -> usize {
|
||||
fn mechanism_is_total_over_every_fact_and_profile() {
|
||||
let facts = every_fact();
|
||||
let covered: std::collections::BTreeSet<usize> = facts.iter().map(variant).collect();
|
||||
assert_eq!(covered, (0..92).collect(), "every_fact misses a variant");
|
||||
assert_eq!(covered, (0..91).collect(), "every_fact misses a variant");
|
||||
for (stem, _) in super::committed_profiles() {
|
||||
let dev = device(&stem);
|
||||
let p = dev.profile();
|
||||
@@ -494,8 +489,7 @@ fn mechanism_is_total_over_every_fact_and_profile() {
|
||||
crate::device::profile::BufferAccess::Addressed => Mechanism::PushConstant,
|
||||
_ => Mechanism::SyntheticBinding,
|
||||
},
|
||||
RuntimeFact::HeapNumericType { .. }
|
||||
| RuntimeFact::HeapHalfTexelWrites { .. } => Mechanism::BinderView,
|
||||
RuntimeFact::HeapNumericType { .. } => Mechanism::BinderView,
|
||||
RuntimeFact::StageInRegion
|
||||
| RuntimeFact::StageInStride { .. }
|
||||
| RuntimeFact::StorageTextureLevels { .. }
|
||||
|
||||
@@ -200,17 +200,6 @@ fn normalized(fb: &mut FunctionBuilder<'_>, s: Form, v: Value, k: u32) -> BResul
|
||||
fb.binary(BinOp::FMul, c, r)
|
||||
}
|
||||
|
||||
/// An upper estimate of the SPIR-V words of [`small_float`] by `rule` on `lanes` lanes: one
|
||||
/// channel's, and each of its constants (at most 18) as a vector of `lanes`.
|
||||
pub fn small_float_words(rule: ChannelWrite, lanes: u8) -> u64 {
|
||||
let composites = if lanes > 1 {
|
||||
18 * (3 + u64::from(lanes))
|
||||
} else {
|
||||
0
|
||||
};
|
||||
channel_words(rule) + composites + 16
|
||||
}
|
||||
|
||||
/// `x` (`f32` lanes of form `f`) each rounded by the small-float rule `rule`
|
||||
/// ([`ChannelWrite::FloatTowardZero`] or [`ChannelWrite::FloatNearestEven`]), every lane by the
|
||||
/// same instructions on the whole vector; another rule is malformed.
|
||||
|
||||
@@ -912,8 +912,6 @@ fn from_image(
|
||||
StorageImageClass::AlphaInRed => alpha_in_red(fb, x, true)?,
|
||||
// A `YCbCrWrite` slot is only written (`StorageImageClass::YCbCrWrite`).
|
||||
StorageImageClass::YCbCrWrite => x,
|
||||
// A half-float texel's bits, through its unsigned integer alias: Metal's read, whole.
|
||||
StorageImageClass::HalfBits => return half_bits_texel(fb, decl, form, x),
|
||||
// An `RGB9E5Float` word, through its `R32_UINT` alias, decoded exactly.
|
||||
StorageImageClass::SharedExponentBits => return shared_exponent_texel(fb, form, x),
|
||||
};
|
||||
@@ -1652,7 +1650,6 @@ pub fn to_image(
|
||||
))
|
||||
}
|
||||
StorageImageClass::YCbCrWrite => ycbcr_write_texel(fb, form, x)?,
|
||||
StorageImageClass::HalfBits => half_bits(fb, form, x)?,
|
||||
StorageImageClass::SharedExponentBits => shared_exponent_word(fb, form, x)?,
|
||||
};
|
||||
match decl.x_channel && form.lanes == 4 {
|
||||
@@ -1713,79 +1710,6 @@ fn ycbcr_write_texel(fb: &mut FunctionBuilder<'_>, form: TexelForm, x: SValue) -
|
||||
fb.composite_construct(ty, &words)
|
||||
}
|
||||
|
||||
/// The held texel (`form`, a `half` or `float` result) of a `HalfBits` slot's image texel `x` (a
|
||||
/// `uvec4`: each channel of its format a half's bits, a channel it lacks the integer the device's
|
||||
/// read gives, 0 or alpha 1, and Metal's out-of-bounds texel's likewise): each channel's half
|
||||
/// widened exactly (`narrow::from_bits`), Metal's `half` read of the half stored, a NaN's sign
|
||||
/// and payload kept, a `float` result's too, where Metal's `float` read of a half NaN is
|
||||
/// `0x7fc00000` (the M3 Max: every NaN, fast and safe math; `PrecisionNote::DeviceNanEncoding`); a
|
||||
/// lane the format lacks its integer converted (0.0, alpha 1.0).
|
||||
fn half_bits_texel(
|
||||
fb: &mut FunctionBuilder<'_>,
|
||||
decl: &ImageDecl,
|
||||
form: TexelForm,
|
||||
x: SValue,
|
||||
) -> BResult<SValue> {
|
||||
use crate::lower::arith::legal::{FloatFmt, Form, Held};
|
||||
let channels = match decl.format {
|
||||
crate::spv::ImageFormat::R16ui => 1,
|
||||
crate::spv::ImageFormat::Rg16ui => 2,
|
||||
_ => 4,
|
||||
};
|
||||
let half = Form {
|
||||
held: Held::Float(FloatFmt::Half),
|
||||
lanes: 4,
|
||||
};
|
||||
let mut v = narrow::from_bits(fb, half, x)?;
|
||||
let f32_ = f32_ty(fb)?;
|
||||
for lane in channels..4u32 {
|
||||
let word = fb.composite_extract(x, &[lane])?;
|
||||
let constant = fb.convert(ConvOp::ConvertUToF, word, f32_)?;
|
||||
v = fb.composite_insert(constant, v, &[lane])?;
|
||||
}
|
||||
// An RGBX texel reads alpha 1 (`RGBX16Float`).
|
||||
if decl.x_channel {
|
||||
let one = f32s(fb, 1, 1.0)?;
|
||||
v = fb.composite_insert(one, v, &[3])?;
|
||||
}
|
||||
match form.lanes {
|
||||
1 => fb.composite_extract(v, &[0]),
|
||||
_ => Ok(v),
|
||||
}
|
||||
}
|
||||
|
||||
/// The `uvec` a `HalfBits` slot stores for held texel `x` (`f32` lanes of `form`): each lane's
|
||||
/// half bits in its low 16 bits (`narrow::to_bits`, exact for every half, a NaN's sign and
|
||||
/// payload included). A `half` texel's lanes are halves already, widened exactly; a `float`
|
||||
/// texel's are first rounded to a half, which no conversion of the device's makes through the
|
||||
/// alias: toward zero, as Metal stores it (`color_write::small_float`: past 65504 to 65504, an
|
||||
/// infinity kept, every NaN `0x7fc00000`, whose bits are Metal's `0x7e00`). An integer texel is
|
||||
/// not one a half-float slot takes.
|
||||
fn half_bits(fb: &mut FunctionBuilder<'_>, form: TexelForm, x: SValue) -> BResult<SValue> {
|
||||
use crate::lower::arith::legal::{FloatFmt, Form, Held};
|
||||
let x = match form.conv {
|
||||
TexelConv::F32 => {
|
||||
let f = Form {
|
||||
held: Held::Float(FloatFmt::F32),
|
||||
lanes: form.lanes,
|
||||
};
|
||||
crate::lower::arith::color_write::small_float(
|
||||
fb,
|
||||
f,
|
||||
x,
|
||||
crate::pipeline::color_writes::HALF,
|
||||
)?
|
||||
}
|
||||
TexelConv::F16 => x,
|
||||
_ => {
|
||||
return Err(crate::spirv::error::BuildError::Type(
|
||||
crate::spirv::error::TypeRule::FunctionSignature,
|
||||
))
|
||||
}
|
||||
};
|
||||
crate::lower::arith::narrow::to_bits(fb, form.half(), x)
|
||||
}
|
||||
|
||||
/// The held texel (`form`, a `half` or `float` result) of a `SharedExponentBits` slot's image texel
|
||||
/// `x` (a `uvec4`, the `RGB9E5Float` word in its first lane): each of red, green and blue its
|
||||
/// mantissa `m` times `2^(e - 24)` for the word's exponent `e`, exact in `f32` and in `half` (nine
|
||||
@@ -1943,26 +1867,14 @@ fn heap_class_among(
|
||||
}
|
||||
|
||||
/// The estimated words of a write's conversion by storage class `class` on four lanes: an 8-bit
|
||||
/// sRGB format's codes ([`srgb_codes`]), a half-float texel's bits ([`half_bits`]), an `RGB9E5Float` word ([`shared_exponent_word`]), or a YCbCr
|
||||
/// texel's bits and mark ([`ycbcr_write_texel`]), none for the other classes' swizzles, which the
|
||||
/// write's base estimate covers.
|
||||
/// sRGB format's codes ([`srgb_codes`]), an `RGB9E5Float` word ([`shared_exponent_word`]), or a
|
||||
/// YCbCr texel's bits and mark ([`ycbcr_write_texel`]), none for the other classes' swizzles,
|
||||
/// which the write's base estimate covers.
|
||||
pub(crate) fn class_write_words(class: StorageImageClass) -> u32 {
|
||||
use crate::lower::arith::color_write;
|
||||
match class {
|
||||
StorageImageClass::YCbCrWrite => YCBCR_WRITE_WORDS,
|
||||
StorageImageClass::SrgbEncode | StorageImageClass::SrgbEncodeBgra => SRGB_WRITE_WORDS,
|
||||
StorageImageClass::SharedExponentBits => SHARED_EXPONENT_WORDS,
|
||||
// A `float` texel's rounding, then four lanes' bits.
|
||||
StorageImageClass::HalfBits => {
|
||||
let half = crate::lower::arith::legal::Form {
|
||||
held: crate::lower::arith::legal::Held::Float(
|
||||
crate::lower::arith::legal::FloatFmt::Half,
|
||||
),
|
||||
lanes: 1,
|
||||
};
|
||||
color_write::small_float_words(crate::pipeline::color_writes::HALF, 4) as u32
|
||||
+ 4 * crate::lower::arith::narrow::bits_words(half)
|
||||
}
|
||||
_ => 0,
|
||||
}
|
||||
}
|
||||
@@ -3143,79 +3055,6 @@ pub(crate) fn heap_raw_image(
|
||||
fb.load(p, MemAccess::default())
|
||||
}
|
||||
|
||||
/// Where a `half` or `float` write through heap handle `handle` of heap group `group` stores a
|
||||
/// half-float member's bits through the group's unsigned integer twin (`HeapPlan::bits`):
|
||||
/// whether the handle's class index names one of the formats the twin holds (a `bool`,
|
||||
/// `metal::texel_format::heap_half_bits_indices`), and the twin's image at the handle's element,
|
||||
/// loaded through a `NonUniform` access chain.
|
||||
fn heap_twin(
|
||||
cx: &mut EmitCx<'_>,
|
||||
fb: &mut FunctionBuilder<'_>,
|
||||
group: u32,
|
||||
handle: ValueId,
|
||||
) -> BResult<(SValue, SValue)> {
|
||||
let bits = cx
|
||||
.plan
|
||||
.families
|
||||
.texture
|
||||
.heap
|
||||
.get(&group)
|
||||
.and_then(|h| h.bits);
|
||||
let Some((class, _)) = bits else {
|
||||
return Err(cx.fail(format!("heap group {group} has no unsigned twin")));
|
||||
};
|
||||
let Some(g) = cx.decl.families.texture.heap.get(&class).copied() else {
|
||||
return Err(cx.fail(format!("heap class {class:?} is not declared")));
|
||||
};
|
||||
let indices = crate::metal::texel_format::heap_half_bits_indices();
|
||||
let is_bits = heap_class_among(cx, fb, handle, &indices)?;
|
||||
let h = cx.operand(fb, handle)?;
|
||||
let element = heap_element_index(cx, fb, h)?;
|
||||
let ptr = fb.module().global_value(g)?;
|
||||
let p = fb.access_chain_non_uniform(ptr, element)?;
|
||||
let img = fb.load(p, MemAccess::default())?;
|
||||
Ok((is_bits, img))
|
||||
}
|
||||
|
||||
/// The words [`heap_twin`]'s class test emits, at most: the field's shift and mask, and per
|
||||
/// member class the twin holds its constant, comparison and union.
|
||||
pub(crate) fn heap_bits_words() -> u32 {
|
||||
let n = crate::metal::texel_format::heap_half_bits_indices().len() as u32;
|
||||
20 + 14 * n
|
||||
}
|
||||
|
||||
/// A half-float member's write through the heap's unsigned integer twin: where the handle names
|
||||
/// one, its texel's bits through the twin's image, else the float class's.
|
||||
#[derive(Clone, Copy)]
|
||||
struct TwinWrite {
|
||||
is_bits: SValue,
|
||||
img: SValue,
|
||||
bits: SValue,
|
||||
}
|
||||
|
||||
/// Write `texel` to `img` at `at`, or where `twin` names a member the twin holds, its bits
|
||||
/// through the twin's image.
|
||||
fn store(
|
||||
fb: &mut FunctionBuilder<'_>,
|
||||
(img, at, texel): (SValue, SValue, SValue),
|
||||
mem: TexelMemory,
|
||||
twin: Option<TwinWrite>,
|
||||
) -> BResult<()> {
|
||||
let Some(t) = twin else {
|
||||
return fb.write(img, at, texel, &ImageOperands::default(), mem);
|
||||
};
|
||||
let then: ArmFn<'_, ()> = Box::new(move |fb, _| {
|
||||
fb.write(t.img, at, t.bits, &ImageOperands::default(), mem)?;
|
||||
Ok(ArmEnd::FallThrough(Vec::new()))
|
||||
});
|
||||
let other: ArmFn<'_, ()> = Box::new(move |fb, _| {
|
||||
fb.write(img, at, texel, &ImageOperands::default(), mem)?;
|
||||
Ok(ArmEnd::FallThrough(Vec::new()))
|
||||
});
|
||||
fb.if_(&mut (), t.is_bits, then, Some(other))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The table an extended-range texel of `form` converts through: the module's for an `_sRGB`
|
||||
/// form (`ArithPlan::extended_range_srgb`), the form's own for a padded `_sRGB` one
|
||||
/// (`ArithPlan::padded_srgb`), none for a linear one.
|
||||
@@ -3285,19 +3124,6 @@ fn write(cx: &mut EmitCx<'_>, fb: &mut FunctionBuilder<'_>, w: &Write) -> BResul
|
||||
(true, ImageRef::Heap { handle, .. }) => heap_alpha_in_red(cx, fb, handle, texel, false)?,
|
||||
_ => texel,
|
||||
};
|
||||
// A half-float member's bits through the group's unsigned integer twin, where the handle's
|
||||
// class names one: its image is the float element's, viewed through its integer alias.
|
||||
let twin = match (w.heap_bits, w.image) {
|
||||
(true, ImageRef::Heap { group, handle }) => {
|
||||
let (is_bits, twin_img) = heap_twin(cx, fb, group, handle)?;
|
||||
Some(TwinWrite {
|
||||
is_bits,
|
||||
img: twin_img,
|
||||
bits: half_bits(fb, w.texel, v)?,
|
||||
})
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
let mem = texel_memory(cx, fb, &w.image)?;
|
||||
// A write to a sparse texture is dropped.
|
||||
let kept = sparse_writes_kept(cx, fb, &w.image)?;
|
||||
@@ -3308,7 +3134,7 @@ fn write(cx: &mut EmitCx<'_>, fb: &mut FunctionBuilder<'_>, w: &Write) -> BResul
|
||||
cond = fb.binary(BinOp::LogicalAnd, cond, c)?;
|
||||
}
|
||||
let then: ArmFn<'_, ()> = Box::new(move |fb, _| {
|
||||
store(fb, (img, coord, texel), mem, twin)?;
|
||||
fb.write(img, coord, texel, &ImageOperands::default(), mem)?;
|
||||
Ok(ArmEnd::FallThrough(Vec::new()))
|
||||
});
|
||||
fb.if_(&mut (), cond, then, None)?;
|
||||
@@ -3317,12 +3143,12 @@ fn write(cx: &mut EmitCx<'_>, fb: &mut FunctionBuilder<'_>, w: &Write) -> BResul
|
||||
if !w.guard {
|
||||
// A write through the null heap element, or at a level the texture lacks, is dropped.
|
||||
let cond = match (live, within) {
|
||||
(None, None) => return store(fb, (img, coord, texel), mem, twin),
|
||||
(None, None) => return fb.write(img, coord, texel, &ImageOperands::default(), mem),
|
||||
(Some(c), None) | (None, Some(c)) => c,
|
||||
(Some(a), Some(b)) => fb.binary(BinOp::LogicalAnd, a, b)?,
|
||||
};
|
||||
let then: ArmFn<'_, ()> = Box::new(move |fb, _| {
|
||||
store(fb, (img, coord, texel), mem, twin)?;
|
||||
fb.write(img, coord, texel, &ImageOperands::default(), mem)?;
|
||||
Ok(ArmEnd::FallThrough(Vec::new()))
|
||||
});
|
||||
fb.if_(&mut (), cond, then, None)?;
|
||||
@@ -3339,7 +3165,7 @@ fn write(cx: &mut EmitCx<'_>, fb: &mut FunctionBuilder<'_>, w: &Write) -> BResul
|
||||
inb = fb.binary(BinOp::LogicalAnd, inb, within)?;
|
||||
}
|
||||
let then: ArmFn<'_, ()> = Box::new(move |fb, _| {
|
||||
store(fb, (img, coord, texel), mem, twin)?;
|
||||
fb.write(img, coord, texel, &ImageOperands::default(), mem)?;
|
||||
Ok(ArmEnd::FallThrough(Vec::new()))
|
||||
});
|
||||
fb.if_(&mut (), inb, then, None)?;
|
||||
@@ -3461,12 +3287,6 @@ fn slice<'c>(cx: &mut EmitCx<'c>, fb: &mut FunctionBuilder<'_>, s: &Slice) -> BR
|
||||
let dims = coord_len(&decl);
|
||||
let s = *s;
|
||||
let mem = texel_memory(cx, fb, &s.image)?;
|
||||
// Whether the handle names a member the unsigned integer twin holds, and the twin's image,
|
||||
// read once, outside the loop.
|
||||
let twin = match (s.heap_bits, s.image) {
|
||||
(true, ImageRef::Heap { group, handle }) => Some(heap_twin(cx, fb, group, handle)?),
|
||||
_ => None,
|
||||
};
|
||||
let body: LoopFn<'_, EmitCx<'c>> = Box::new(move |fb, cx, lc| {
|
||||
let k = fb.load(counter, MemAccess::default())?;
|
||||
let done = fb.binary(BinOp::UGreaterThanEqual, k, n)?;
|
||||
@@ -3482,31 +3302,14 @@ fn slice<'c>(cx: &mut EmitCx<'c>, fb: &mut FunctionBuilder<'_>, s: &Slice) -> BR
|
||||
let cell = imageblock::cell_offset(cx, fb, x, y, s.cell_bytes)?;
|
||||
let field = u32s(fb, 1, s.field)?;
|
||||
let off = fb.binary(BinOp::IAdd, cell, field)?;
|
||||
let (texel, twin) = match s.bits {
|
||||
Some(leaf) => {
|
||||
let v = imageblock::load(cx, fb, leaf, s.contained, off)?;
|
||||
(cell_bits(fb, &decl, s.texel.lanes, v)?, None)
|
||||
}
|
||||
None => {
|
||||
let v = imageblock::load(cx, fb, s.leaf, s.contained, off)?;
|
||||
let held = slice_texel(fb, s.texel, v)?;
|
||||
let form = TexelForm {
|
||||
conv: s.texel.conv,
|
||||
lanes: 4,
|
||||
};
|
||||
let test = NanTest::for_modes(&cx.plan.families.arith.modes);
|
||||
let texel = to_image(fb, &decl, form, held, cx.decl.families.arith.srgb, test)?;
|
||||
let twin = match twin {
|
||||
Some((is_bits, img)) => Some(TwinWrite {
|
||||
is_bits,
|
||||
img,
|
||||
bits: half_bits(fb, form, held)?,
|
||||
}),
|
||||
None => None,
|
||||
};
|
||||
(texel, twin)
|
||||
}
|
||||
let v = imageblock::load(cx, fb, s.leaf, s.contained, off)?;
|
||||
let held = slice_texel(fb, s.texel, v)?;
|
||||
let form = TexelForm {
|
||||
conv: s.texel.conv,
|
||||
lanes: 4,
|
||||
};
|
||||
let test = NanTest::for_modes(&cx.plan.families.arith.modes);
|
||||
let texel = to_image(fb, &decl, form, held, cx.decl.families.arith.srgb, test)?;
|
||||
let ty = vec(fb, u, dims)?;
|
||||
let delta = if dims == 2 {
|
||||
fb.composite_construct(ty, &[x, y])?
|
||||
@@ -3518,10 +3321,10 @@ fn slice<'c>(cx: &mut EmitCx<'c>, fb: &mut FunctionBuilder<'_>, s: &Slice) -> BR
|
||||
if !s.guard {
|
||||
// A level the texture lacks drops the slice, as the null heap element does.
|
||||
let Some(within) = within else {
|
||||
return store(fb, (img, at, texel), mem, twin);
|
||||
return fb.write(img, at, texel, &ImageOperands::default(), mem);
|
||||
};
|
||||
let then: ArmFn<'_, EmitCx<'c>> = Box::new(move |fb, _| {
|
||||
store(fb, (img, at, texel), mem, twin)?;
|
||||
fb.write(img, at, texel, &ImageOperands::default(), mem)?;
|
||||
Ok(ArmEnd::FallThrough(Vec::new()))
|
||||
});
|
||||
fb.if_(cx, within, then, None)?;
|
||||
@@ -3534,7 +3337,7 @@ fn slice<'c>(cx: &mut EmitCx<'c>, fb: &mut FunctionBuilder<'_>, s: &Slice) -> BR
|
||||
inb = fb.binary(BinOp::LogicalAnd, inb, within)?;
|
||||
}
|
||||
let then: ArmFn<'_, EmitCx<'c>> = Box::new(move |fb, _| {
|
||||
store(fb, (img, at, texel), mem, twin)?;
|
||||
fb.write(img, at, texel, &ImageOperands::default(), mem)?;
|
||||
Ok(ArmEnd::FallThrough(Vec::new()))
|
||||
});
|
||||
fb.if_(cx, inb, then, None)?;
|
||||
@@ -3556,27 +3359,6 @@ fn slice<'c>(cx: &mut EmitCx<'c>, fb: &mut FunctionBuilder<'_>, s: &Slice) -> BR
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The `HalfBits` image texel of a `half` slice's cell bits `v` (`lanes` 16-bit lanes, each
|
||||
/// zero-extended in a `u32`): the lanes, a 0 (the half `+0.0`) for each lane the element lacks,
|
||||
/// and RGBX's green in the fourth channel, the texel [`to_image`] makes of the cell's widened
|
||||
/// halves.
|
||||
fn cell_bits(
|
||||
fb: &mut FunctionBuilder<'_>,
|
||||
decl: &ImageDecl,
|
||||
lanes: u8,
|
||||
v: SValue,
|
||||
) -> BResult<SValue> {
|
||||
let form = TexelForm {
|
||||
conv: TexelConv::I16 { signed: false },
|
||||
lanes,
|
||||
};
|
||||
let x = slice_texel(fb, form, v)?;
|
||||
match decl.x_channel {
|
||||
true => x_channel_write(fb, x),
|
||||
false => Ok(x),
|
||||
}
|
||||
}
|
||||
|
||||
/// A cooperative slice's first cell and step: the invocation's index in the threadgroup and the
|
||||
/// threadgroup's threads.
|
||||
fn shares(cx: &mut EmitCx<'_>, fb: &mut FunctionBuilder<'_>) -> BResult<(SValue, SValue)> {
|
||||
|
||||
@@ -432,10 +432,6 @@ pub struct Write {
|
||||
pub cross: Option<CrossWrite>,
|
||||
/// How an integer texel's lanes are saturated to the bound format's channels ([`int_range`]).
|
||||
pub saturate: IntRange,
|
||||
/// A `half` or `float` written through a heap handle stores a half-float member's bits
|
||||
/// through the group's unsigned integer twin where the handle's class names one
|
||||
/// ([`heap_bits`], `emit::heap_bits`).
|
||||
pub heap_bits: bool,
|
||||
}
|
||||
|
||||
/// A write's declared texel and the bound format of a texture of another numeric class
|
||||
@@ -830,11 +826,6 @@ impl TextureStrategy {
|
||||
}
|
||||
+ if w.cross.is_some() { 48 } else { 0 }
|
||||
+ w.saturate.words()
|
||||
+ if w.heap_bits {
|
||||
heap_bits_write_words()
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
TextureStrategy::Atomic(a) => a.words(),
|
||||
TextureStrategy::Query(q) => {
|
||||
@@ -1285,21 +1276,6 @@ pub fn declare(
|
||||
let g = heap_array(mb, plan.stage, class, decl)?;
|
||||
d.heap.insert(class, g);
|
||||
}
|
||||
// The unsigned integer twins the writes of half-float members store their bits through,
|
||||
// each declared once; a group of the float class decorates it as the float class.
|
||||
for h in plan.families.texture.heap.values() {
|
||||
let Some((class, decl)) = h.bits else {
|
||||
continue;
|
||||
};
|
||||
if d.heap.contains_key(&class) {
|
||||
continue;
|
||||
}
|
||||
let g = heap_array(mb, plan.stage, class, decl)?;
|
||||
if h.volatile && volatile_decorated(plan) {
|
||||
mb.volatile(g)?;
|
||||
}
|
||||
d.heap.insert(class, g);
|
||||
}
|
||||
// The classes of other numeric types the reads and queries of a member of another class
|
||||
// read it through, each declared once.
|
||||
for (class, decl) in plan
|
||||
@@ -1358,13 +1334,6 @@ fn declare_heap_classes(mb: &mut ModuleBuilder) -> BResult<GlobalId> {
|
||||
mb.plain_global(crate::spirv::ir::StorageClass::Private, arr, Some(init))
|
||||
}
|
||||
|
||||
/// The words a heap texture's `half` or `float` write adds where it stores a half-float member's
|
||||
/// bits through the unsigned integer twin, at most: the test of the class index, the bits, the
|
||||
/// twin's access chain and load, and the branch between the two writes.
|
||||
pub(crate) fn heap_bits_write_words() -> u32 {
|
||||
emit::heap_bits_words() + emit::class_write_words(StorageImageClass::HalfBits) + 96
|
||||
}
|
||||
|
||||
/// The words [`heap_texel_class`] emits, at most: the field's shift and mask, the clamp into the
|
||||
/// table, the access chain and the load, with their constants.
|
||||
pub(crate) const HEAP_CLASS_WORDS: u32 = 48;
|
||||
@@ -2172,40 +2141,32 @@ pub fn routine_words(
|
||||
pub const HEAP_CLASS_CENSUS: &str = "sampler.heap.texel_class";
|
||||
|
||||
/// What a `float` write to texture `image` (of storage class `class`) relies on or records where it
|
||||
/// may reach a half-float image ([`may_store_half`]), which the device converts whole. Its rounding of each channel to
|
||||
/// `half` (Metal rounds toward zero, a finite value past 65504 to 65504) is Metal's where the
|
||||
/// profile takes `DriverDeviation::MetalHalfStorageWrites` (the module requires its property), else
|
||||
/// the device's (`PrecisionNote::DeviceColorConversion`), but for a half-float member a heap's
|
||||
/// unsigned integer twin holds (`heap_bits`), whose bits the shader writes. Its NaN is Metal's
|
||||
/// may reach a half-float image ([`may_store_half`]), which the device converts whole. Its rounding
|
||||
/// of each channel to `half` (Metal rounds toward zero, a finite value past 65504 to 65504) is
|
||||
/// Metal's where the profile takes `DriverDeviation::MetalHalfStorageWrites` (the module requires
|
||||
/// its property), else the device's (`PrecisionNote::DeviceColorConversion`). Its NaN is Metal's
|
||||
/// `0x7e00` where the profile takes `DriverDeviation::MetalHalfStorageNans` (the module requires its
|
||||
/// property), else the device's encoding of it (`PrecisionNote::DeviceNanEncoding`), but for a
|
||||
/// member the twin holds, which stores Metal's (the runtime announces the note where the heap holds
|
||||
/// a half-float texture the twin does not: `RuntimeFact::HeapHalfTexelWrites`). A write that may
|
||||
/// reach a packed small float image, a heap write's or a slot's whose choice declares such a format
|
||||
/// property), else the device's encoding of it (`PrecisionNote::DeviceNanEncoding`). A write that
|
||||
/// may reach a packed small float image, a heap write's or a slot's whose choice declares such a format
|
||||
/// or none ([`small_float_storage`]), stores its NaN as the device converts it too: Metal stores
|
||||
/// every NaN there as its canonical one, and RADV and NVIDIA keep another NaN's payload bits.
|
||||
pub(super) fn half_storage_facts(
|
||||
cx: &mut SelectCx<'_>,
|
||||
image: ImageRef,
|
||||
class: StorageImageClass,
|
||||
heap_bits: bool,
|
||||
) -> Result<(), Error> {
|
||||
use crate::device::requirements::VkProperty;
|
||||
if class == StorageImageClass::Identity && may_store_half(cx, image)? {
|
||||
let rounds = cx
|
||||
if cx
|
||||
.profile
|
||||
.takes_driver_deviation(DriverDeviation::MetalHalfStorageWrites);
|
||||
match (heap_bits, rounds) {
|
||||
(true, _) => {}
|
||||
(false, true) => {
|
||||
cx.families
|
||||
.texture
|
||||
.storage_properties
|
||||
.insert(VkProperty::MetalHalfStorageWrites);
|
||||
}
|
||||
(false, false) => {
|
||||
cx.precision.insert(PrecisionNote::DeviceColorConversion);
|
||||
}
|
||||
.takes_driver_deviation(DriverDeviation::MetalHalfStorageWrites)
|
||||
{
|
||||
cx.families
|
||||
.texture
|
||||
.storage_properties
|
||||
.insert(VkProperty::MetalHalfStorageWrites);
|
||||
} else {
|
||||
cx.precision.insert(PrecisionNote::DeviceColorConversion);
|
||||
}
|
||||
if cx
|
||||
.profile
|
||||
@@ -2215,8 +2176,6 @@ pub(super) fn half_storage_facts(
|
||||
.texture
|
||||
.storage_properties
|
||||
.insert(VkProperty::MetalHalfStorageNans);
|
||||
} else if heap_bits {
|
||||
heap_half_texel_writes(cx, false);
|
||||
} else {
|
||||
cx.precision.insert(PrecisionNote::DeviceNanEncoding);
|
||||
}
|
||||
@@ -2255,16 +2214,9 @@ fn small_float_storage(cx: &SelectCx<'_>, image: ImageRef) -> Result<bool, Error
|
||||
/// The write records `PrecisionNote::DeviceNanEncoding` where the stored NaN stays the device's:
|
||||
/// a 16-bit float channel's on a profile without `DriverDeviation::MetalHalfTexelWrites`, a 32-bit
|
||||
/// or packed small float channel's, a slot's whose choice declares no format, a texel buffer's
|
||||
/// declaring none, and a heap element's, which may be a 32-bit float texture's (where the group's
|
||||
/// unsigned integer twin holds its half-float members too, which states
|
||||
/// `RuntimeFact::HeapHalfTexelWrites`). A normalized or integer channel stores no NaN; nor does a
|
||||
/// slot whose choice writes the half's bits through the texture's unsigned integer alias
|
||||
/// (`StorageImageClass::HalfBits`), which every device stores exactly.
|
||||
pub(super) fn half_write_nans(
|
||||
cx: &mut SelectCx<'_>,
|
||||
image: ImageRef,
|
||||
heap_bits: bool,
|
||||
) -> Result<(), Error> {
|
||||
/// declaring none, and a heap element's, which may be any of them. A normalized or integer channel
|
||||
/// stores no NaN.
|
||||
pub(super) fn half_write_nans(cx: &mut SelectCx<'_>, image: ImageRef) -> Result<(), Error> {
|
||||
use crate::device::requirements::VkProperty;
|
||||
use crate::vk::NumericFormat as N;
|
||||
// Whether the stored NaN is exact (`Exact`), a 16-bit float channel's (`Sixteen`, Metal's on
|
||||
@@ -2286,18 +2238,11 @@ pub(super) fn half_write_nans(
|
||||
}
|
||||
};
|
||||
let stored = match image {
|
||||
ImageRef::Heap { .. } => {
|
||||
if heap_bits {
|
||||
heap_half_texel_writes(cx, true);
|
||||
}
|
||||
Stored::Device
|
||||
}
|
||||
ImageRef::Heap { .. } => Stored::Device,
|
||||
ImageRef::Slot(index) => {
|
||||
let slot = slot_of(cx, index)?.slot;
|
||||
match cx.inputs.storage_images.get(&slot) {
|
||||
Some(c) => match c.class {
|
||||
// The half's own bits, written through the unsigned integer alias.
|
||||
StorageImageClass::HalfBits => Stored::Exact,
|
||||
StorageImageClass::Identity => declared(c.vk_format),
|
||||
_ => Stored::Exact,
|
||||
},
|
||||
@@ -2323,38 +2268,6 @@ pub(super) fn half_write_nans(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Whether a `half` or `float` write (`texel`) to texture `image` of shape `shape` stores a
|
||||
/// half-float member's bits through its heap group's unsigned integer twin (`HeapPlan::bits`,
|
||||
/// `emit::heap_bits`): a heap write of one sample, not to a cube or texture buffer, neither an
|
||||
/// extended-range encode nor another class's (`encoded`), on a device where every half-float
|
||||
/// format has the unsigned integer alias the twin holds it through
|
||||
/// (`metal::format::heap_half_bits`: a device not measured to store a written `half`'s NaN as its
|
||||
/// bits, `DriverDeviation::MetalHalfTexelWrites`). Marks the group's writes, and the handle
|
||||
/// carries its class index, which names a member the twin holds
|
||||
/// (`metal::texel_format::heap_half_bits_indices`).
|
||||
pub(super) fn heap_bits(
|
||||
cx: &mut SelectCx<'_>,
|
||||
image: ImageRef,
|
||||
shape: ImageShape,
|
||||
(texel, encoded): (TexelConv, bool),
|
||||
) -> bool {
|
||||
let ImageRef::Heap { group, .. } = image else {
|
||||
return false;
|
||||
};
|
||||
let applies = matches!(texel, TexelConv::F32 | TexelConv::F16)
|
||||
&& !encoded
|
||||
&& !shape.ms
|
||||
&& !matches!(shape.dim, ImageDim::Buffer | ImageDim::Cube)
|
||||
&& crate::metal::format::heap_half_bits(cx.profile);
|
||||
if applies {
|
||||
if let Some(h) = cx.families.texture.heap.get_mut(&group) {
|
||||
h.writes_bits = true;
|
||||
}
|
||||
cx.families.access.heap_class_index = true;
|
||||
}
|
||||
applies
|
||||
}
|
||||
|
||||
/// Whether a storage read or write of a `float` or `half` texel (`texel`) through heap handle
|
||||
/// `image` of shape `shape` converts an `A8Unorm` member's texels: a heap access, not to a texture
|
||||
/// buffer (no heap class holds one), on a device that holds such a texture's alpha in
|
||||
@@ -2379,18 +2292,6 @@ pub(super) fn heap_alpha_in_red(
|
||||
applies
|
||||
}
|
||||
|
||||
/// Record that the stage's `half` (`packed`) or `float` writes through heap handles store
|
||||
/// half-float members' bits through the unsigned integer twin, and leave the device's conversion
|
||||
/// of a NaN to the members it does not hold (`RuntimeFact::HeapHalfTexelWrites`), which the
|
||||
/// runtime announces where the heap holds one.
|
||||
fn heap_half_texel_writes(cx: &mut SelectCx<'_>, packed: bool) {
|
||||
cx.facts
|
||||
.insert(crate::pipeline::facts::RuntimeFact::HeapHalfTexelWrites {
|
||||
stage: cx.stage,
|
||||
packed,
|
||||
});
|
||||
}
|
||||
|
||||
/// What a `float` (or `half`, held widened) texel's write in form `texel` to texture `image` of
|
||||
/// shape `shape` relies on or records where the texture's format may be a normalized one, whose
|
||||
/// conversion the device makes: Metal stores each channel's value clamped to its range (a NaN 0)
|
||||
@@ -3103,24 +3004,12 @@ fn select_read_as(
|
||||
storage_class(cx, image)?,
|
||||
StorageImageClass::SrgbEncode | StorageImageClass::SrgbEncodeBgra
|
||||
);
|
||||
// A storage slot's half-float texels, through its unsigned integer alias, widened exactly
|
||||
// (the slot's planning declares it): Metal's read, a NaN's included. So is an `RGB9E5Float`
|
||||
// slot's word through its `R32_UINT` alias, decoded exactly.
|
||||
let half_bits = storage
|
||||
// An `RGB9E5Float` slot's word through its `R32_UINT` alias, decoded exactly (the slot's
|
||||
// planning declares it).
|
||||
let words = storage
|
||||
&& matches!(texel.conv, TexelConv::F16 | TexelConv::F32)
|
||||
&& matches!(
|
||||
storage_class(cx, image)?,
|
||||
StorageImageClass::HalfBits | StorageImageClass::SharedExponentBits
|
||||
);
|
||||
// A `float` read of a half-float texel's own bits widens a NaN with its sign and payload, where
|
||||
// Metal reads every half NaN as `0x7fc00000`.
|
||||
if texel.conv == TexelConv::F32
|
||||
&& half_bits
|
||||
&& storage_class(cx, image)? == StorageImageClass::HalfBits
|
||||
{
|
||||
cx.precision.insert(PrecisionNote::DeviceNanEncoding);
|
||||
}
|
||||
let exact = raw || srgb_codes || half_bits;
|
||||
&& storage_class(cx, image)? == StorageImageClass::SharedExponentBits;
|
||||
let exact = raw || srgb_codes || words;
|
||||
// An extended-range texel is decoded exactly to `f32`, which a `half` result rounds to
|
||||
// nearest even, as Metal answers. A read is one texel.
|
||||
if texel.conv == TexelConv::F16 && !exact && extended.is_none() {
|
||||
@@ -3377,15 +3266,11 @@ fn select_write(
|
||||
mode_rounded_write(cx, image, texel, extended.is_some())?;
|
||||
// Its alpha in red where the class is `A8Unorm`'s and the device holds such a texture so.
|
||||
let heap_alpha_red = heap_alpha_in_red(cx, image, shape, texel.conv);
|
||||
// A half-float member's bits through the group's unsigned integer twin, where the handle's
|
||||
// class names one.
|
||||
let encoded = extended.is_some() || cross.is_some();
|
||||
let heap_bits = heap_bits(cx, image, shape, (texel.conv, encoded));
|
||||
if texel.conv == TexelConv::F32 {
|
||||
half_storage_facts(cx, image, class, heap_bits)?;
|
||||
half_storage_facts(cx, image, class)?;
|
||||
}
|
||||
if texel.conv == TexelConv::F16 && extended.is_none() {
|
||||
half_write_nans(cx, image, heap_bits)?;
|
||||
half_write_nans(cx, image)?;
|
||||
}
|
||||
// A `half` texel's too, held widened: Metal stores its value by the same rule.
|
||||
if matches!(texel.conv, TexelConv::F32 | TexelConv::F16) && extended.is_none() {
|
||||
@@ -3418,7 +3303,6 @@ fn select_write(
|
||||
swizzle,
|
||||
cross,
|
||||
saturate,
|
||||
heap_bits,
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
@@ -25,10 +25,7 @@
|
||||
//!
|
||||
//! The copy is one counted loop over the block's cells in the writing invocation (a builder
|
||||
//! loop), each iteration a contained arena leaf load
|
||||
//! (`access::imageblock::load`) and a texture write. A `half` element written to a slot that
|
||||
//! stores each channel's half bits (`StorageImageClass::HalfBits`) loads the cells' bits as 16-bit
|
||||
//! integers and writes them as they are: the texel the widening and `narrow::to_bits` would give,
|
||||
//! since the two are inverse on every bit pattern (a NaN's sign and payload included). A block
|
||||
//! (`access::imageblock::load`) and a texture write. A block
|
||||
//! past the imageblock's extent in either axis is clipped to it (the cells past it are not the
|
||||
//! imageblock's; Metal leaves them undefined).
|
||||
//!
|
||||
@@ -90,16 +87,9 @@ pub struct Slice {
|
||||
/// The slot's storage class (`super::storage_class`): a converting one moves or encodes each
|
||||
/// texel's channels (`RotateArgb`'s rotation, `SrgbEncode`'s codes).
|
||||
pub class: StorageImageClass,
|
||||
/// Each texel of a half-float member stores its bits through the heap group's unsigned
|
||||
/// integer twin where the handle's class names one (`super::Write::heap_bits`).
|
||||
pub heap_bits: bool,
|
||||
/// Every invocation of the workgroup writes a strided share of the cells, then a workgroup
|
||||
/// barrier (`super::cooperative`); else the writing invocation writes them all.
|
||||
pub cooperative: bool,
|
||||
/// A `half` element written to a slot that stores each channel's half bits
|
||||
/// (`StorageImageClass::HalfBits`): the cells loaded as this leaf of 16-bit integers, each
|
||||
/// lane the channel's bits as they are.
|
||||
pub bits: Option<Leaf>,
|
||||
}
|
||||
|
||||
impl Slice {
|
||||
@@ -108,11 +98,6 @@ impl Slice {
|
||||
+ if self.contained { 64 } else { 0 }
|
||||
+ if self.guard { 48 } else { 0 }
|
||||
+ super::emit::class_write_words(self.class)
|
||||
+ if self.heap_bits {
|
||||
super::heap_bits_write_words()
|
||||
} else {
|
||||
0
|
||||
}
|
||||
+ if self.cooperative { 24 } else { 0 }
|
||||
+ 320
|
||||
}
|
||||
@@ -313,37 +298,15 @@ pub(super) fn select(
|
||||
};
|
||||
let guard = slot::write_guard(cx, false);
|
||||
let class = super::storage_class(cx, image)?;
|
||||
// A half-float member's bits through the group's unsigned integer twin, where the handle's
|
||||
// class names one.
|
||||
let heap_bits = super::heap_bits(cx, image, t.image, (conv, false));
|
||||
if conv == TexelConv::F32 {
|
||||
super::half_storage_facts(cx, image, class, heap_bits)?;
|
||||
super::half_storage_facts(cx, image, class)?;
|
||||
}
|
||||
if matches!(conv, TexelConv::F32 | TexelConv::F16) {
|
||||
super::norm_storage_facts(cx, image, t.image, TexelForm { conv, lanes })?;
|
||||
}
|
||||
if conv == TexelConv::F16 {
|
||||
super::half_write_nans(cx, image, heap_bits)?;
|
||||
super::half_write_nans(cx, image)?;
|
||||
}
|
||||
// A `half` element to a slot of half bits: the cells' bits as they are.
|
||||
let bits = match conv == TexelConv::F16 && class == StorageImageClass::HalfBits && !image.heap()
|
||||
{
|
||||
true => Some(Leaf {
|
||||
form: Form {
|
||||
held: held_on(
|
||||
cx.profile,
|
||||
Held::Int {
|
||||
bits: 16,
|
||||
container: 32,
|
||||
},
|
||||
)?,
|
||||
lanes,
|
||||
},
|
||||
bytes,
|
||||
path,
|
||||
}),
|
||||
false => None,
|
||||
};
|
||||
mark(cx, image, |u| u.write = true);
|
||||
// Every invocation shares the write where its guard selects local id 0 at a uniform point.
|
||||
let cooperative = match super::cooperative::guard(cx, call, m)? {
|
||||
@@ -369,8 +332,6 @@ pub(super) fn select(
|
||||
guard,
|
||||
contained: imageblock::contained(cx),
|
||||
class,
|
||||
heap_bits,
|
||||
cooperative,
|
||||
bits,
|
||||
})))
|
||||
}
|
||||
@@ -386,14 +386,6 @@ pub struct HeapPlan {
|
||||
/// set by [`finish`] for a sampled color group of one sample. The binder holds each member in
|
||||
/// the class of its own numeric type, and the neutral in the others.
|
||||
pub cross: std::collections::BTreeMap<TexelClass, (ImageHandleClass, ImageDecl)>,
|
||||
/// Its `half` or `float` writes store a half-float member's bits through the unsigned integer
|
||||
/// twin where the handle's class index names one (`Write::heap_bits`); set by `select_write`.
|
||||
pub writes_bits: bool,
|
||||
/// The twin of a written float storage group ([`HeapPlan::writes_bits`]): the formatless
|
||||
/// unsigned integer storage class of its shape that holds half-float members through their
|
||||
/// unsigned integer aliases (`StorageFormatClass::HalfBits`), and its declaration; set by
|
||||
/// [`finish`]. The binder holds each such member there too, at the same element.
|
||||
pub bits: Option<(ImageHandleClass, ImageDecl)>,
|
||||
}
|
||||
|
||||
impl HeapPlan {
|
||||
@@ -415,8 +407,6 @@ impl HeapPlan {
|
||||
cross_queries: false,
|
||||
uncrossed: false,
|
||||
cross: Default::default(),
|
||||
writes_bits: false,
|
||||
bits: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -783,13 +773,12 @@ fn storage_format(
|
||||
}
|
||||
// The converting classes exist for 8-bit UNORM color formats, half and small float ones and
|
||||
// 1-bit alpha ones only. A YCbCr write slot's `float` texels are stored as their bits in an
|
||||
// unsigned integer image, whose class `declare_slot` gives it., as a half-float slot only
|
||||
// written stores its half bits in its unsigned integer alias.
|
||||
// unsigned integer image, whose class `declare_slot` gives it, as an `RGB9E5Float` slot
|
||||
// stores its words in its `R32_UINT` alias.
|
||||
let converting = !matches!(
|
||||
choice.class,
|
||||
StorageImageClass::Identity
|
||||
| StorageImageClass::YCbCrWrite
|
||||
| StorageImageClass::HalfBits
|
||||
| StorageImageClass::SharedExponentBits
|
||||
);
|
||||
if converting && texel != TexelClass::Float {
|
||||
@@ -1060,17 +1049,16 @@ fn declare_slot(
|
||||
if ycbcr_write && (s.uses.read || s.uses.atomic || !float) {
|
||||
return Err(Unsupported::not_implemented(Feature::Format).into());
|
||||
}
|
||||
// A slot that reads and writes a half-float texture through its unsigned integer alias
|
||||
// holds each texel's half bits there (`StorageImageClass::HalfBits`): a `float` slot's reads
|
||||
// A slot that reads and writes an `RGB9E5Float` texture through its `R32_UINT` alias holds
|
||||
// each texel's word there (`StorageImageClass::SharedExponentBits`): a `float` slot's reads
|
||||
// and writes, as the binder chooses it (`metal::format::storage_choice`); no atomic.
|
||||
let half_bits = storage
|
||||
&& cx.inputs.storage_images.get(&s.slot).is_some_and(|c| {
|
||||
matches!(
|
||||
c.class,
|
||||
StorageImageClass::HalfBits | StorageImageClass::SharedExponentBits
|
||||
)
|
||||
});
|
||||
if half_bits && (s.uses.atomic || !float) {
|
||||
let words = storage
|
||||
&& cx
|
||||
.inputs
|
||||
.storage_images
|
||||
.get(&s.slot)
|
||||
.is_some_and(|c| c.class == StorageImageClass::SharedExponentBits);
|
||||
if words && (s.uses.atomic || !float) {
|
||||
return Err(Unsupported::not_representable(Feature::Format).into());
|
||||
}
|
||||
// A texture of another class, read in its own (`LoweringInputs::cross_class`), only where
|
||||
@@ -1081,7 +1069,7 @@ fn declare_slot(
|
||||
}
|
||||
let texel = match extended {
|
||||
Some(_) => TexelClass::Uint,
|
||||
None if ycbcr_write || half_bits => TexelClass::Uint,
|
||||
None if ycbcr_write || words => TexelClass::Uint,
|
||||
None => image_class(cx.inputs, s),
|
||||
};
|
||||
if shape.depth && storage {
|
||||
@@ -1336,21 +1324,6 @@ pub fn finish(cx: &mut SelectCx<'_>) -> Result<(), Error> {
|
||||
let sampled_float = class.access == ImageAccess::Sampled
|
||||
&& class.sampled_type == SampledType::Float
|
||||
&& !class.depth_compare;
|
||||
// The unsigned integer twin of a float storage group whose writes store half bits.
|
||||
let storage_float = class.access == ImageAccess::Storage
|
||||
&& class.sampled_type == SampledType::Float
|
||||
&& !class.multisampled;
|
||||
h.bits = (h.writes_bits && storage_float).then_some((
|
||||
ImageHandleClass {
|
||||
sampled_type: SampledType::Uint,
|
||||
format: StorageFormatClass::HalfBits,
|
||||
..class
|
||||
},
|
||||
ImageDecl {
|
||||
texel: TexelClass::Uint,
|
||||
..decl
|
||||
},
|
||||
));
|
||||
h.raw = (h.reads_raw && sampled_float).then_some((
|
||||
ImageHandleClass {
|
||||
sampled_type: SampledType::Uint,
|
||||
|
||||
@@ -24,7 +24,7 @@ use crate::bind::neutral::numeric_type;
|
||||
use crate::device::enables::format_exposure_gap;
|
||||
use crate::device::requirements::{FormatUsage, VkFeature};
|
||||
use crate::device::DeviceProfile;
|
||||
use crate::error::{Capability, DescriptorError, DriverDeviation, Error, Feature, Unsupported};
|
||||
use crate::error::{Capability, DescriptorError, Error, Feature, Unsupported};
|
||||
use crate::metal::{
|
||||
PixelFormat, TextureSwizzle, TextureSwizzleChannels, TextureType, TextureUsage,
|
||||
};
|
||||
@@ -2017,19 +2017,6 @@ pub(crate) fn integer_channels_word(pf: PixelFormat) -> u32 {
|
||||
})
|
||||
}
|
||||
|
||||
/// Whether the device's conversion decides the NaN a `half` texel written to a texture of pixel
|
||||
/// format `pf` stores, once the write hands it the half widened: 16-bit float channels
|
||||
/// (`metal::texel_format::half_channels`, whose store `DriverDeviation::MetalHalfTexelWrites`
|
||||
/// states Metal's) and a packed small float's (`RG11B10Float`, `RGB9E5Float`). A 32-bit float
|
||||
/// channel stores its bits, and a normalized or integer one no NaN.
|
||||
pub fn half_write_nans_converted(pf: PixelFormat) -> bool {
|
||||
use crate::vk::NumericFormat as N;
|
||||
crate::metal::texel_format::half_channels(pf)
|
||||
|| direct_format(pf).and_then(|f| f.block()).is_some_and(|b| {
|
||||
b.packed_bits.is_some() && matches!(b.color, Some(N::Ufloat | N::Sfloat))
|
||||
})
|
||||
}
|
||||
|
||||
/// The class of pixel format `pf` (`metal::texel_format::TexelFormat`'s word, as its `half`
|
||||
/// conversion takes it): the value a specialized note's test of
|
||||
/// `SpecKey::BoundTexelFormat` reads for a texture of `pf` bound at its slot
|
||||
@@ -2907,25 +2894,12 @@ pub(crate) fn storage_choice(
|
||||
pf: PixelFormat,
|
||||
use_: StorageUse,
|
||||
profile: &DeviceProfile,
|
||||
) -> Result<StorageImageChoice, Error> {
|
||||
storage_choice_viewed(pf, use_, profile, true)
|
||||
}
|
||||
|
||||
/// [`storage_choice`] of a texture whose image takes views in other formats only where
|
||||
/// `aliased`: an image viewed in its own format alone (a wrapped one made without
|
||||
/// `MUTABLE_FORMAT`) takes no half-float alias (`StorageImageClass::HalfBits`) and keeps its
|
||||
/// format's own choice, as before.
|
||||
pub(crate) fn storage_choice_viewed(
|
||||
pf: PixelFormat,
|
||||
use_: StorageUse,
|
||||
profile: &DeviceProfile,
|
||||
aliased: bool,
|
||||
) -> Result<StorageImageChoice, Error> {
|
||||
let x = x_channel(pf);
|
||||
if x && use_.texel_buffer {
|
||||
return Err(Unsupported::not_implemented(Feature::Format).into());
|
||||
}
|
||||
let mut choice = held_storage_choice(pf, use_, profile, aliased)?;
|
||||
let mut choice = held_storage_choice(pf, use_, profile)?;
|
||||
choice.x_channel = x;
|
||||
Ok(choice)
|
||||
}
|
||||
@@ -2935,7 +2909,6 @@ fn held_storage_choice(
|
||||
pf: PixelFormat,
|
||||
use_: StorageUse,
|
||||
profile: &DeviceProfile,
|
||||
aliased: bool,
|
||||
) -> Result<StorageImageChoice, Error> {
|
||||
use vk::Format as F;
|
||||
let (aspects, candidates) = candidates(pf)?;
|
||||
@@ -2999,14 +2972,6 @@ fn held_storage_choice(
|
||||
// alias, whose encode the shader applies before it moves green into the fourth lane.
|
||||
let srgb_x =
|
||||
x_channel(pf) && use_.write && matches!(alias, Some((_, StorageImageClass::SrgbEncode)));
|
||||
// A half-float texture the function only writes, on a device not measured to store a written
|
||||
// half's NaN as its bits: viewed through its unsigned integer alias, through which the shader
|
||||
// writes the bits Metal stores (`StorageImageClass::HalfBits`).
|
||||
if let Some(view) = half_bits_view(pf, use_, profile).filter(|_| aliased) {
|
||||
let mut choice = StorageImageChoice::new(view, StorageImageClass::HalfBits);
|
||||
choice.alias = Some(AliasView::new(image));
|
||||
return Ok(choice);
|
||||
}
|
||||
// Vulkan's conversion to a shared-exponent texel rounds each mantissa half up, where Metal
|
||||
// truncates it: an `RGB9E5Float` write takes its word alias, whose encode is Metal's, even on a
|
||||
// device that stores the format.
|
||||
@@ -3048,65 +3013,10 @@ fn held_storage_choice(
|
||||
Err(Unsupported::needs_any_of(Feature::Format, alternatives).into())
|
||||
}
|
||||
|
||||
/// The unsigned integer alias through which a function that writes a half-float texture of `pf`
|
||||
/// (`R16Float`, `RG16Float`, `RGBA16Float`, `RGBX16Float`: every format of 16-bit float
|
||||
/// channels, `metal::texel_format::half_channels`), and may read it, stores the bits Metal stores
|
||||
/// (`StorageImageClass::HalfBits`), on a device not measured to store a written `half`'s NaN as
|
||||
/// its bits (`DriverDeviation::MetalHalfTexelWrites`; there the format's own view serves, as
|
||||
/// before): `R16_UINT`, `R16G16_UINT` or `R16G16B16A16_UINT`, where the device stores it for
|
||||
/// `use_` and the shader can declare it by its SPIR-V image format. `None` elsewhere, where the
|
||||
/// format's own choice stands. `RGBX16Float`'s image is `RGBA16Float`'s: its RGBX conversion moves
|
||||
/// green's bits into the fourth lane after the class's (`StorageImageChoice:: x_channel`), and its
|
||||
/// read takes alpha 1.
|
||||
fn half_bits_view(
|
||||
pf: PixelFormat,
|
||||
use_: StorageUse,
|
||||
profile: &DeviceProfile,
|
||||
) -> Option<vk::Format> {
|
||||
use vk::Format as F;
|
||||
let view = match pf {
|
||||
PixelFormat::R16Float => F::R16_UINT,
|
||||
PixelFormat::RG16Float => F::R16G16_UINT,
|
||||
PixelFormat::RGBA16Float | PixelFormat::RGBX16Float => F::R16G16B16A16_UINT,
|
||||
_ => return None,
|
||||
};
|
||||
if !use_.write || profile.takes_driver_deviation(DriverDeviation::MetalHalfTexelWrites) {
|
||||
return None;
|
||||
}
|
||||
let declared = spirv_image_format(view)?;
|
||||
let declarable = !crate::spirv::requirements::extended_format(declared)
|
||||
|| profile.fields().images.storage_extended_formats;
|
||||
(declarable && profile.supports_format(view, use_.usage())).then_some(view)
|
||||
}
|
||||
|
||||
/// The unsigned integer alias through which a heap's twin (`StorageFormatClass::HalfBits`, a
|
||||
/// formatless declaration) holds a written half-float texture of `pf` on `profile`:
|
||||
/// [`half_bits_view`]'s for a write, where the device writes it without a format. `None` for
|
||||
/// every other format, and on a device of `DriverDeviation::MetalHalfTexelWrites`.
|
||||
pub(crate) fn heap_half_bits_view(pf: PixelFormat, profile: &DeviceProfile) -> Option<vk::Format> {
|
||||
let use_ = StorageUse::texture(false, true);
|
||||
let view = half_bits_view(pf, use_, profile)?;
|
||||
without_format_gaps(view, use_, profile)
|
||||
.is_empty()
|
||||
.then_some(view)
|
||||
}
|
||||
|
||||
/// Whether a function's `half` and `float` writes through a heap handle store a half-float
|
||||
/// member's bits through the heap's unsigned integer twin on `profile`
|
||||
/// (`StorageFormatClass::HalfBits`): every format of
|
||||
/// `metal::texel_format::HALF_BITS_FORMATS` has its alias there ([`heap_half_bits_view`]), so
|
||||
/// the twin's indices (`heap_half_bits_indices`) name only members it holds.
|
||||
pub(crate) fn heap_half_bits(profile: &DeviceProfile) -> bool {
|
||||
crate::metal::texel_format::HALF_BITS_FORMATS
|
||||
.iter()
|
||||
.all(|&pf| heap_half_bits_view(pf, profile).is_some())
|
||||
}
|
||||
|
||||
/// The formats a storage binding views a texture of `pf` as on `profile`, for any use: the
|
||||
/// read-and-write choice's ([`storage_image_choice`]: its alias view's format, else the direct
|
||||
/// format) and a written-only one's (a half-float texture's unsigned integer alias on a device
|
||||
/// not measured to store a written `half`'s NaN as its bits). A texture's image lists each among
|
||||
/// its view formats. Empty where the device stores no texture of `pf`.
|
||||
/// format) and a written-only one's where it differs. A texture's image lists each among its view
|
||||
/// formats. Empty where the device stores no texture of `pf`.
|
||||
pub fn storage_view_formats(pf: PixelFormat, profile: &DeviceProfile) -> Vec<vk::Format> {
|
||||
let mut formats = Vec::new();
|
||||
for use_ in [
|
||||
|
||||
@@ -1928,47 +1928,36 @@ fn storage_choices_on_committed_profiles_are_declarable() {
|
||||
}
|
||||
}
|
||||
|
||||
/// A half-float storage texture a function writes takes `Identity` on every committed profile: the
|
||||
/// device converts each value and NaN (`lower::texture`'s `half_storage_facts` records what it
|
||||
/// relies on or notes); so do a read-only use and another float format. On a profile not measured
|
||||
/// to store a written `half`'s NaN as its bits (`DriverDeviation::MetalHalfTexelWrites`), a written
|
||||
/// use takes the unsigned integer alias (`StorageImageClass::HalfBits`) wherever the alias serves
|
||||
/// it, an image of its own format alone `Identity`.
|
||||
/// A half-float storage texture takes `Identity` on every committed profile, for every use, written
|
||||
/// or read, image or texel buffer: the device converts each value and NaN (`lower::texture`'s
|
||||
/// `half_storage_facts` and `half_write_nans` record what it relies on or notes). So does another
|
||||
/// float format.
|
||||
#[test]
|
||||
fn half_float_storage_writes_take_their_measured_class() {
|
||||
let mut seen = BTreeSet::new();
|
||||
fn half_float_storage_takes_its_own_format() {
|
||||
let mut seen = 0;
|
||||
for (stem, dev) in committed_devices() {
|
||||
let p = dev.profile();
|
||||
let want = StorageImageClass::Identity;
|
||||
for pf in [
|
||||
PixelFormat::R16Float,
|
||||
PixelFormat::RG16Float,
|
||||
PixelFormat::RGBA16Float,
|
||||
PixelFormat::RGBX16Float,
|
||||
] {
|
||||
let use_ = StorageUse::READ_WRITE_TEXTURE;
|
||||
let Ok(choice) = storage_choice_viewed(pf, use_, p, false) else {
|
||||
continue;
|
||||
};
|
||||
assert_eq!(choice.class, want, "{stem} {pf:?}");
|
||||
seen.insert(want);
|
||||
let bits = |use_| match half_bits_view(pf, use_, p) {
|
||||
Some(_) => StorageImageClass::HalfBits,
|
||||
None => want,
|
||||
};
|
||||
let aliased = storage_choice(pf, use_, p).expect("a choice");
|
||||
assert_eq!(aliased.class, bits(use_), "{stem} {pf:?} aliased");
|
||||
seen.insert(aliased.class);
|
||||
let buffer_use = StorageUse::texel_buffer(false, true);
|
||||
if let Ok(buffer) = storage_choice(pf, buffer_use, p) {
|
||||
assert_eq!(buffer.class, bits(buffer_use), "{stem} {pf:?} texel buffer");
|
||||
}
|
||||
if let Ok(read) = storage_choice(pf, StorageUse::texture(true, false), p) {
|
||||
assert_eq!(
|
||||
read.class,
|
||||
StorageImageClass::Identity,
|
||||
"{stem} {pf:?} read"
|
||||
);
|
||||
for use_ in [
|
||||
StorageUse::READ_WRITE_TEXTURE,
|
||||
StorageUse::texture(false, true),
|
||||
StorageUse::texture(true, false),
|
||||
StorageUse::texel_buffer(false, true),
|
||||
] {
|
||||
if let Ok(choice) = storage_choice(pf, use_, p) {
|
||||
assert_eq!(
|
||||
choice.class,
|
||||
StorageImageClass::Identity,
|
||||
"{stem} {pf:?} {use_:?}"
|
||||
);
|
||||
assert_eq!(choice.alias, None, "{stem} {pf:?} {use_:?}");
|
||||
seen += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Ok(choice) =
|
||||
@@ -1981,7 +1970,7 @@ fn half_float_storage_writes_take_their_measured_class() {
|
||||
);
|
||||
}
|
||||
}
|
||||
assert_eq!(seen.len(), 2, "{seen:?}");
|
||||
assert!(seen > 0, "no committed profile stores a half-float texture");
|
||||
}
|
||||
|
||||
/// A `BGR10A2Unorm` storage texture or texture buffer is stored through its own `A2R10G10B10`
|
||||
|
||||
@@ -696,13 +696,6 @@ pub fn reads_unswizzled(pf: PixelFormat, swizzle: TextureSwizzleChannels) -> boo
|
||||
/// class looks up in its own copy of this table. The binder and the function come from one build,
|
||||
/// whose `SEMANTICS_VERSION` changes with any class.
|
||||
///
|
||||
/// After them, from the own-view base, the classes of `R16Float`, `RG16Float` and `RGBA16Float`
|
||||
/// again ([`HALF_BITS_FORMATS`]' order): the index of an unswizzled writable texture of one of them
|
||||
/// whose image takes no view in another format (`TextureFacts::own_format_views`), so a write
|
||||
/// through a heap handle reaches it through the float class, not the unsigned integer twin that
|
||||
/// holds its `half` bits elsewhere ([`heap_half_bits_indices`]). Every routine that reads the class
|
||||
/// takes it as the class of the same value, and a read of another numeric class as an own class's.
|
||||
///
|
||||
/// After them, from [`heap_extended_base`], one [`TexelFormat::OTHER`] per form of
|
||||
/// `ExtendedRange::HEAP_READ` in its order: the index of a heap texture of that form, whose texels
|
||||
/// a function decodes from its raw codes where the index names it, and which every routine that
|
||||
@@ -723,8 +716,6 @@ pub fn heap_classes() -> &'static [u32] {
|
||||
/// markers, and the classes of the formats no read of another class takes.
|
||||
struct HeapLayout {
|
||||
classes: Vec<u32>,
|
||||
/// Where the own-view half-float classes start, past the sorted own ones.
|
||||
own_view: u32,
|
||||
extended: u32,
|
||||
numeric: u32,
|
||||
own_only: u32,
|
||||
@@ -745,8 +736,6 @@ fn heap_layout() -> &'static HeapLayout {
|
||||
let of = |pf: PixelFormat| heap_class(pf, TextureSwizzleChannels::DEFAULT).0;
|
||||
let mut classes = sorted(PixelFormat::ALL.iter().map(|&pf| of(pf)).collect());
|
||||
let index = |n: usize| u32::try_from(n).unwrap_or(u32::MAX);
|
||||
let own_view = index(classes.len());
|
||||
classes.extend(HALF_BITS_FORMATS.iter().map(|&pf| of(pf)));
|
||||
let extended = index(classes.len());
|
||||
classes.extend(
|
||||
crate::metal::format::ExtendedRange::HEAP_READ
|
||||
@@ -765,7 +754,6 @@ fn heap_layout() -> &'static HeapLayout {
|
||||
));
|
||||
HeapLayout {
|
||||
classes,
|
||||
own_view,
|
||||
extended,
|
||||
numeric,
|
||||
own_only,
|
||||
@@ -812,39 +800,6 @@ pub fn heap_numeric(pf: PixelFormat) -> Option<crate::pipeline::sym::SampledType
|
||||
}
|
||||
}
|
||||
|
||||
/// The half-float formats whose texture a heap's unsigned integer twin
|
||||
/// (`StorageFormatClass::HalfBits`) holds through its unsigned integer alias, in the own-view
|
||||
/// classes' order ([`heap_classes`]). `RGBX16Float` is not among them: no heap storage class
|
||||
/// holds an RGBX texture (`bind::heap`'s storage elements), whose conversion a formatless
|
||||
/// declaration cannot make per element.
|
||||
pub const HALF_BITS_FORMATS: [PixelFormat; 3] = [
|
||||
PixelFormat::R16Float,
|
||||
PixelFormat::RG16Float,
|
||||
PixelFormat::RGBA16Float,
|
||||
];
|
||||
|
||||
/// The indices in [`heap_classes`] of [`HALF_BITS_FORMATS`]' own classes: a write through a heap
|
||||
/// handle carrying one stores the `half` bits through the unsigned integer twin, where the module
|
||||
/// declares one (`HeapPlan::bits`). A texture of such a format whose image takes no view in
|
||||
/// another format carries the class's own-view index instead ([`heap_own_view_index`]).
|
||||
pub fn heap_half_bits_indices() -> Vec<u32> {
|
||||
HALF_BITS_FORMATS
|
||||
.iter()
|
||||
.map(|&pf| heap_class_index(pf, TextureSwizzleChannels::DEFAULT))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// The own-view index in [`heap_classes`] of a texture of `pf` made with `swizzle` whose image
|
||||
/// takes no view in another format: for an unswizzled one of [`HALF_BITS_FORMATS`], its class's
|
||||
/// own-view entry, which holds the same class as [`heap_class_index`]'s but is none of
|
||||
/// [`heap_half_bits_indices`] (a swizzle that reads as none keeps it, [`reads_unswizzled`]);
|
||||
/// `None` for every other texture, whose index is its own.
|
||||
pub fn heap_own_view_index(pf: PixelFormat, swizzle: TextureSwizzleChannels) -> Option<u32> {
|
||||
let k = HALF_BITS_FORMATS.iter().position(|&f| f == pf)?;
|
||||
let k = u32::try_from(k).ok()?;
|
||||
reads_unswizzled(pf, swizzle).then_some(heap_layout().own_view + k)
|
||||
}
|
||||
|
||||
/// The index in [`heap_classes`] of `A8Unorm`'s class, which no other format's texture carries:
|
||||
/// a storage read or write through a heap handle carrying it converts the member's texels where
|
||||
/// the device holds such a texture's alpha in red (`metal::format::alpha_in_red`), which a heap's
|
||||
@@ -890,7 +845,7 @@ pub fn heap_class_index(pf: PixelFormat, swizzle: TextureSwizzleChannels) -> u32
|
||||
return base + k;
|
||||
}
|
||||
let (from, own) = match crosses_classes(pf) {
|
||||
true => (0, &layout.classes[..layout.own_view as usize]),
|
||||
true => (0, &layout.classes[..layout.extended as usize]),
|
||||
false => (layout.own_only, &layout.classes[layout.own_only as usize..]),
|
||||
};
|
||||
let class = heap_class(pf, swizzle).0;
|
||||
@@ -1372,16 +1327,7 @@ mod tests {
|
||||
let classes = heap_classes();
|
||||
let base = heap_extended_base() as usize;
|
||||
assert_eq!(classes.first(), Some(&TexelFormat::OTHER.0));
|
||||
let own_view = heap_layout().own_view as usize;
|
||||
assert_eq!(own_view + HALF_BITS_FORMATS.len(), base);
|
||||
assert!(classes[..own_view].windows(2).all(|w| w[0] < w[1]));
|
||||
for (k, &pf) in HALF_BITS_FORMATS.iter().enumerate() {
|
||||
let own = heap_class_index(pf, TextureSwizzleChannels::DEFAULT) as usize;
|
||||
assert!(own < own_view, "{pf:?}");
|
||||
let viewed = heap_own_view_index(pf, TextureSwizzleChannels::DEFAULT);
|
||||
assert_eq!(viewed, Some((own_view + k) as u32), "{pf:?}");
|
||||
assert_eq!(classes[own_view + k], classes[own], "{pf:?}");
|
||||
}
|
||||
assert!(classes[..base].windows(2).all(|w| w[0] < w[1]));
|
||||
let numeric = heap_numeric_base() as usize;
|
||||
assert_eq!(numeric, base + ExtendedRange::HEAP_READ.len());
|
||||
let own_only = heap_layout().own_only as usize;
|
||||
@@ -1487,10 +1433,6 @@ mod tests {
|
||||
/// The heap classes of the half-float family without a packed field are the unswizzled
|
||||
/// half-float formats' and no other format's: `RGBX16Float`'s too, `RGBA16Float`'s texels with
|
||||
/// three channels.
|
||||
///
|
||||
/// The own-view entries of `R16Float`, `RG16Float` and `RGBA16Float` are half classes too, and
|
||||
/// the twin's indices are exactly those formats' own: no other format's texture, swizzled or
|
||||
/// not, carries one, and none carries an own-view index.
|
||||
#[test]
|
||||
fn a_heap_write_finds_the_half_formats_by_index() {
|
||||
use crate::metal::bicubic::BicubicTexels;
|
||||
@@ -1508,28 +1450,10 @@ mod tests {
|
||||
PixelFormat::RGBA16Float,
|
||||
PixelFormat::RGBX16Float,
|
||||
];
|
||||
assert_eq!(
|
||||
half.len(),
|
||||
wanted.len() + HALF_BITS_FORMATS.len(),
|
||||
"{half:?}"
|
||||
);
|
||||
let bits = heap_half_bits_indices();
|
||||
let swizzle = TextureSwizzleChannels::new(
|
||||
crate::metal::TextureSwizzle::Blue,
|
||||
crate::metal::TextureSwizzle::Green,
|
||||
crate::metal::TextureSwizzle::Red,
|
||||
crate::metal::TextureSwizzle::Alpha,
|
||||
);
|
||||
assert_eq!(half.len(), wanted.len(), "{half:?}");
|
||||
for &pf in PixelFormat::ALL {
|
||||
let i = heap_class_index(pf, TextureSwizzleChannels::DEFAULT);
|
||||
assert_eq!(half.contains(&i), wanted.contains(&pf), "{pf:?}");
|
||||
assert_eq!(bits.contains(&i), HALF_BITS_FORMATS.contains(&pf), "{pf:?}");
|
||||
assert!(!bits.contains(&heap_class_index(pf, swizzle)), "{pf:?}");
|
||||
let viewed = heap_own_view_index(pf, TextureSwizzleChannels::DEFAULT);
|
||||
assert_eq!(viewed.is_some(), HALF_BITS_FORMATS.contains(&pf), "{pf:?}");
|
||||
if let Some(v) = viewed {
|
||||
assert!(half.contains(&v) && !bits.contains(&v), "{pf:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -809,8 +809,7 @@ pub enum PrecisionNote {
|
||||
/// pixel fetch of a `half` texel: Metal hands back the texel's own NaN, sign and payload, and
|
||||
/// Vulkan states no encoding for a 16-bit float texel's decode (MoltenVK answers the canonical
|
||||
/// NaN for every one); on a device that rounds a `half` through its conversion under the float
|
||||
/// controls (ANV, RADV), the NaN that conversion makes of the device's decode. Also recorded by
|
||||
/// a `float` read of a 16-bit float texture through its unsigned integer alias. Also recorded
|
||||
/// controls (ANV, RADV), the NaN that conversion makes of the device's decode. Also recorded
|
||||
/// by a `half` texel's write to a storage texture that may hold a float format, a slot whose
|
||||
/// storage choice declares none or a heap element: Metal stores a 16-bit float texel's NaN as
|
||||
/// the half's own bits and a 32-bit or packed small float one's as its canonical NaN, and the
|
||||
|
||||
@@ -701,18 +701,6 @@ pub enum RuntimeFact {
|
||||
/// where a Vulkan write of a value the channel cannot represent is undefined. The binder
|
||||
/// writes `metal::format::integer_channels_word` of the bound format, and 0 for a neutral.
|
||||
StorageTextureIntegerChannels { slot: SlotRef },
|
||||
/// The `stage` function writes `half` texels (where `packed`), or `float` ones, through heap
|
||||
/// handles on a device not measured to store a written `half`'s NaN as its bits
|
||||
/// (`DriverDeviation::MetalHalfTexelWrites`), and stores each half-float member's bits
|
||||
/// through its group's unsigned integer twin (`StorageFormatClass::HalfBits`), which every
|
||||
/// device stores exactly. A member the twin does not hold stores the device's conversion of a
|
||||
/// NaN, not Metal's: a half-float texture that is swizzled or whose image takes no view in
|
||||
/// another format, and where `packed` a packed small float one (`RG11B10Float`,
|
||||
/// `RGB9E5Float`); `bind::heap_write_nans_converted` names such a texture, which the consumer
|
||||
/// announces `PrecisionNote::DeviceNanEncoding` for at a draw or dispatch whose heap holds
|
||||
/// one. The module records that note for these writes too: a 32-bit or packed small float
|
||||
/// member's NaN is the device's.
|
||||
HeapHalfTexelWrites { stage: Stage, packed: bool },
|
||||
/// The render pipeline draws through synthesized geometry stages, one per topology class, of
|
||||
/// which a draw runs its class's (`RenderPipeline::runs_stage`): its fragment function reads
|
||||
/// `[[barycentric_coord]]` on a device without `fragmentShaderBarycentric` (`weights`), or its
|
||||
|
||||
@@ -1418,24 +1418,12 @@ pub enum StorageImageClass {
|
||||
/// Metal's do (probe `a8`, an M3 Max under macOS 27.0.1: kernel writes of `float` and `half`
|
||||
/// texels and `read_write` access).
|
||||
AlphaInRed,
|
||||
/// A half-float image (`R16Float`, `RG16Float`, `RGBA16Float`) written by a device not
|
||||
/// A 4:4:4 two-plane YCbCr texture a slot only writes, through an `R32G32B32A32_UINT` image
|
||||
/// of the texture's own (the consumer's write shadow): the shader writes each texel as the
|
||||
/// bits of its red, green and blue `float` channels (a `half` texel's widened exactly) and a
|
||||
/// 1, the mark of a written texel, which the consumer then encodes into the planes as Metal
|
||||
/// stores it (`bind::ycbcr_write`). The slot is declared `Rgba32ui`; it has no reads.
|
||||
YCbCrWrite,
|
||||
/// A half-float image (`R16Float`, `RG16Float`, `RGBA16Float`) a slot writes, and may read,
|
||||
/// on a device not measured to store a written `half`'s NaN as its bits
|
||||
/// (`DriverDeviation::MetalHalfTexelWrites`), viewed through its unsigned integer alias of
|
||||
/// the same channels (`R16_UINT`, `R16G16_UINT`, `R16G16B16A16_UINT`): the shader writes each
|
||||
/// channel's half bits, a `half` texel's own (a NaN's sign and payload kept, as Metal stores
|
||||
/// them) and a `float` texel's rounded toward zero to the half Metal stores (a finite value
|
||||
/// past 65504 to 65504, an infinity kept, every NaN `0x7e00`), which every device stores
|
||||
/// exactly; a read widens each channel's half exactly, a `float` read's NaN `0x7fc00000`, as
|
||||
/// Metal reads them. The slot is declared of the alias's unsigned integer format; it takes no
|
||||
/// atomic.
|
||||
HalfBits,
|
||||
/// An `RGB9E5Float` image a slot writes, and may read, viewed through its `R32_UINT` alias, on
|
||||
/// every device (one that stores the format rounds each mantissa half up, as Vulkan's
|
||||
/// conversion states, where Metal truncates it): the shader writes each texel as the word Metal
|
||||
|
||||
@@ -212,13 +212,6 @@ pub enum StorageFormatClass {
|
||||
Unknown,
|
||||
/// A storage image declared with this format.
|
||||
Format(vk::Format),
|
||||
/// An unsigned integer storage image declared with format `Unknown`, of the half-float
|
||||
/// textures a heap holds through their unsigned integer aliases (`R16_UINT`, `R16G16_UINT`,
|
||||
/// `R16G16B16A16_UINT`): a float storage heap group's twin, through which a function writes
|
||||
/// such a member's `half` bits where its handle's class names one, on a device not measured
|
||||
/// to store a written `half`'s NaN as its bits. Apart from the formatless unsigned class, so
|
||||
/// an unsigned group never reaches a half-float texture.
|
||||
HalfBits,
|
||||
}
|
||||
|
||||
/// The image part of a [`HandleClass`].
|
||||
|
||||
@@ -10,19 +10,18 @@
|
||||
//! - through the select and a threadgroup `half4` array, read back by another thread after a
|
||||
//! barrier (move 2);
|
||||
//! - into an `RGBA16Float` storage texture, as loaded and through the select, through the class the
|
||||
//! binder chooses for the profile (`storage_image_choice`): where the class stores the half's
|
||||
//! bits (`StorageImageClass::HalfBits`) each texel must be the bits; elsewhere the module hands
|
||||
//! the device the widened half, whose store is the device's conversion (a NaN's encoding is the
|
||||
//! device's there, recorded as `PrecisionNote::DeviceNanEncoding`), so the texel must be the exact
|
||||
//! widening of each value that is not a NaN, and a NaN for each NaN.
|
||||
//! binder chooses for the profile (`storage_image_choice`): the module hands the device the
|
||||
//! widened half, whose store is the device's conversion (a NaN's encoding is the device's there,
|
||||
//! recorded as `PrecisionNote::DeviceNanEncoding`), so the texel must be the exact widening of
|
||||
//! each value that is not a NaN, and a NaN for each NaN.
|
||||
//!
|
||||
//! Each runs on every committed profile under the default policy and under
|
||||
//! `DevicePolicy::exact_answers`. A module may leave a NaN's bits to the device, and then says so:
|
||||
//! a `half` read from its bits by the device's widening (`PrecisionNote::NativeHalfConversion`,
|
||||
//! wherever the module rounds to `half` through the device's conversion) or a NaN's bits left to
|
||||
//! the device's arithmetic and conversions (`PrecisionNote::NativeNanEncoding`, under either
|
||||
//! policy). There a NaN pattern need only come back a NaN (a move through the select, the
|
||||
//! threadgroup array or a half-bits texel; a move straight to a buffer reuses the loaded bits). No
|
||||
//! policy). There a NaN pattern need only come back a NaN (a move through the select or the
|
||||
//! threadgroup array; a move straight to a buffer reuses the loaded bits). No
|
||||
//! other pattern may change, nor any where the module records neither note.
|
||||
//!
|
||||
//! The profiles and policies compile to a few distinct modules: each runs once, all at once on
|
||||
@@ -39,7 +38,6 @@ use crate::lower::select::{LowerInputs, Plan};
|
||||
use crate::metal::format::storage_image_choice;
|
||||
use crate::metal::PixelFormat;
|
||||
use crate::pipeline::interface::PushLoc;
|
||||
use crate::pipeline::lower_inputs::StorageImageClass;
|
||||
use crate::pipeline::sym::{
|
||||
Axis, PushField, ResourceKind, ResourceSlot, SlotClass, SlotRef, SpecKey, Stage,
|
||||
};
|
||||
@@ -199,12 +197,10 @@ struct Found {
|
||||
texels: Vec<(u16, u32)>,
|
||||
}
|
||||
|
||||
/// One distinct module of the kernel: what runs, whether its texture class stores the half's bits,
|
||||
/// and the notes its translation records.
|
||||
/// One distinct module of the kernel: what runs, and the notes its translation records.
|
||||
struct Compiled {
|
||||
plan: Plan,
|
||||
module: TypedModule,
|
||||
bits: bool,
|
||||
notes: Vec<String>,
|
||||
}
|
||||
|
||||
@@ -239,14 +235,12 @@ fn compile_once(
|
||||
.iter()
|
||||
.map(|n| format!("{n:?}"))
|
||||
.collect();
|
||||
let bits = choice.class == StorageImageClass::HalfBits;
|
||||
let words: Arc<[u32]> = Arc::from(artifact.module.words.as_slice());
|
||||
Some((
|
||||
words,
|
||||
Compiled {
|
||||
plan,
|
||||
module,
|
||||
bits,
|
||||
notes,
|
||||
},
|
||||
))
|
||||
@@ -286,9 +280,7 @@ fn run_once(c: &Compiled, what: &str) -> Found {
|
||||
let at = imgs[0].index(0, 0, 0, [g % WIDTH, y, 0]).expect("texel");
|
||||
let t = imgs[0].texels[at][lane];
|
||||
let h = h as u16;
|
||||
let ok = if c.bits {
|
||||
t == u32::from(h)
|
||||
} else if is_nan(h) {
|
||||
let ok = if is_nan(h) {
|
||||
f32::from_bits(t).is_nan()
|
||||
} else {
|
||||
t == widened(h)
|
||||
@@ -301,8 +293,8 @@ fn run_once(c: &Compiled, what: &str) -> Found {
|
||||
Found { changed, texels }
|
||||
}
|
||||
|
||||
/// Every `half` pattern comes back as its bits from each move (buffer, select, threadgroup array,
|
||||
/// half-bits texel) on every profile under every policy, but that a NaN pattern may come back
|
||||
/// Every `half` pattern comes back as its bits from each move (buffer, select, threadgroup array)
|
||||
/// and as its exact widening from the texel on every profile under every policy, but that a NaN pattern may come back
|
||||
/// another NaN where the module records the note that leaves a NaN's bits to the device (the module
|
||||
/// docs).
|
||||
#[test]
|
||||
@@ -344,10 +336,6 @@ fn every_half_pattern_moves_as_its_bits() {
|
||||
.iter()
|
||||
.any(|n| n == "NativeHalfConversion" || n == "NativeNanEncoding");
|
||||
let nan_only = |list: &[(u16, u16)]| list.iter().all(|&(h, got)| is_nan(h) && is_nan(got));
|
||||
let nan_texels = found
|
||||
.texels
|
||||
.iter()
|
||||
.all(|(h, t)| is_nan(*h) && u16::try_from(*t).is_ok_and(is_nan));
|
||||
let mut moved_nans = 0;
|
||||
for (k, list) in found.changed.iter().enumerate() {
|
||||
if list.is_empty() {
|
||||
@@ -366,17 +354,11 @@ fn every_half_pattern_moves_as_its_bits() {
|
||||
));
|
||||
}
|
||||
if !found.texels.is_empty() {
|
||||
if noted && c.bits && nan_texels {
|
||||
moved_nans += found.texels.len();
|
||||
} else {
|
||||
report.push(format!(
|
||||
"{policy_name} {stem}: half bits {}: {} texel channels, first {:x?}, notes \
|
||||
{notes:?}",
|
||||
c.bits,
|
||||
found.texels.len(),
|
||||
&found.texels[..found.texels.len().min(4)]
|
||||
));
|
||||
}
|
||||
report.push(format!(
|
||||
"{policy_name} {stem}: {} texel channels, first {:x?}, notes {notes:?}",
|
||||
found.texels.len(),
|
||||
&found.texels[..found.texels.len().min(4)]
|
||||
));
|
||||
}
|
||||
if moved_nans > 0 {
|
||||
device_nans.push(format!("{policy_name} {stem}: {moved_nans} ({notes:?})"));
|
||||
|
||||
@@ -840,11 +840,8 @@ declare void @air.write_texture_2d.v4f32(ptr addrspace(1), <2 x i32>, <4 x float
|
||||
.filter(|(op, at)| *op == OP_DECORATE && w[at + 2] == DECORATION_VOLATILE)
|
||||
.map(|(_, at)| w[at + 1])
|
||||
.collect();
|
||||
// The written float storage class's unsigned integer twin, where the profile writes a
|
||||
// half's bits through one, is a second array, volatile with it.
|
||||
let arrays = image_arrays(&a);
|
||||
let twin = usize::from(crate::metal::format::heap_half_bits(&p));
|
||||
assert_eq!(arrays.len(), 1 + twin, "one class, one array, and its twin");
|
||||
assert_eq!(arrays.len(), 1, "one class, one array");
|
||||
let want = if volatile { arrays } else { Vec::new() };
|
||||
assert_eq!(volatile_ids, want, "{volatile}");
|
||||
}
|
||||
@@ -1300,27 +1297,17 @@ fn assert_binder_classes(a: &FunctionArtifact, p: &DeviceProfile, stem: &str) {
|
||||
/// integer twin (its members of a form a heap reads held there raw, `HeapPlan::raw`), and its
|
||||
/// reads and queries the class of each other numeric type (a member of another numeric class
|
||||
/// read in its own, `HeapPlan::cross`).
|
||||
///
|
||||
/// And the unsigned integer twin of a written float storage group (`StorageFormatClass::HalfBits`),
|
||||
/// beside the formatless float storage class of its shape.
|
||||
fn siblings(a: &FunctionArtifact) -> usize {
|
||||
let images = heap_image_classes(a);
|
||||
images
|
||||
.iter()
|
||||
.filter(|c| {
|
||||
let sampled = c.access == ImageAccess::Sampled
|
||||
c.access == ImageAccess::Sampled
|
||||
&& matches!(c.sampled_type, SampledType::Sint | SampledType::Uint)
|
||||
&& images.contains(&ImageHandleClass {
|
||||
sampled_type: SampledType::Float,
|
||||
..**c
|
||||
});
|
||||
let twin = c.format == crate::pipeline::sym::StorageFormatClass::HalfBits
|
||||
&& images.contains(&ImageHandleClass {
|
||||
sampled_type: SampledType::Float,
|
||||
format: crate::pipeline::sym::StorageFormatClass::Unknown,
|
||||
..**c
|
||||
});
|
||||
sampled || twin
|
||||
})
|
||||
})
|
||||
.count()
|
||||
}
|
||||
@@ -1652,8 +1639,8 @@ declare i32 @air.get_width_texture_2d(ptr addrspace(1), i32)
|
||||
// Both loads call the module's one search function, so its 16 steps (one
|
||||
// `OpULessThanEqual` each: of the `u64` ids with `shaderInt64`, else of the low
|
||||
// words) and its read of the table's length are emitted once. The module was
|
||||
// about 3,500 words with a search per load; it is 1,520 with `u64` ids and 2,202
|
||||
// with word ids.
|
||||
// about 3,500 words with a search per load; it is within 1,600 with `u64` ids
|
||||
// and 2,300 with word ids, the bounds below.
|
||||
// The write's normalized channels are the device's conversion: noted where the
|
||||
// profile is not measured to store Metal's codes, or where it stores a texture
|
||||
// of a 1-bit alpha, which it rounds otherwise.
|
||||
@@ -1673,16 +1660,15 @@ declare i32 @air.get_width_texture_2d(ptr addrspace(1), i32)
|
||||
assert_eq!(count(&a, OP_FUNCTION_CALL), 2, "{stem}");
|
||||
assert_eq!(count(&a, OP_ULESS_THAN_EQUAL), 16, "{stem}");
|
||||
assert_eq!(count(&a, OP_ARRAY_LENGTH), 1, "{stem}");
|
||||
// And a half-float member's bits through the unsigned integer twin, where the
|
||||
// profile takes it.
|
||||
let bits = match crate::metal::format::heap_half_bits(&p) {
|
||||
true => crate::lower::texture::heap_bits_write_words() as usize,
|
||||
false => 0,
|
||||
};
|
||||
let bound = bits + if p.fields().leaf.int64 { 1_600 } else { 2_300 };
|
||||
// And an `A8Unorm` member's alpha moved into red where the device holds such a
|
||||
// texture so (`metal::format::alpha_in_red`): the class index's read and the
|
||||
// conversion.
|
||||
let a8 = crate::metal::format::alpha_in_red(crate::metal::PixelFormat::A8Unorm, &p);
|
||||
let alpha = if a8 { 100 } else { 0 };
|
||||
let bound = alpha + if p.fields().leaf.int64 { 1_600 } else { 2_300 };
|
||||
assert!(
|
||||
a.module.words.len() <= bound,
|
||||
"{stem}: {} words over {bound} (bits {bits})",
|
||||
"{stem}: {} words over {bound} (alpha in red {a8})",
|
||||
a.module.words.len()
|
||||
);
|
||||
assert_eq!(uses(&a, "texture.write.heap"), 1, "{stem}");
|
||||
@@ -1740,25 +1726,17 @@ declare void @air.write_texture_2d.{elem}(ptr addrspace(1), <2 x i32>, {ty}, i32
|
||||
)
|
||||
}
|
||||
|
||||
/// A `half` (or `float`) texel written through an argument buffer's texture, on a profile where
|
||||
/// every half-float format has its unsigned integer alias and the device is not measured to store
|
||||
/// a written `half`'s NaN as its bits (`metal::format::heap_half_bits`), declares the float
|
||||
/// storage group's unsigned integer twin (`StorageFormatClass::HalfBits`) beside it and states
|
||||
/// `RuntimeFact::HeapHalfTexelWrites` for the members the twin does not hold: a `half` write's fact
|
||||
/// counts packed small floats too, a `float` write's is stated only where the device's conversion
|
||||
/// of a NaN to a half-float texel is not measured to be Metal's
|
||||
/// (`DriverDeviation::MetalHalfStorageNans`).
|
||||
/// Elsewhere the module declares one class. Every such write records
|
||||
/// `PrecisionNote::DeviceNanEncoding`: the heap may hold a 32-bit or packed small float texture,
|
||||
/// whose NaN is the device's.
|
||||
/// A `half` (or `float`) texel written through an argument buffer's texture is the device's write
|
||||
/// on every committed profile: the module declares the one formatless float storage class, and
|
||||
/// records `PrecisionNote::DeviceNanEncoding`, since the heap may hold a half-float, 32-bit or
|
||||
/// packed small float texture, whose stored NaN is the device's.
|
||||
#[test]
|
||||
fn a_heap_texel_write_stores_half_bits_through_the_unsigned_twin() {
|
||||
use crate::error::DriverDeviation;
|
||||
fn a_heap_texel_write_is_the_devices_write() {
|
||||
for float in [false, true] {
|
||||
let Some(bc) = assemble("heap_texel_write", &heap_texel_write_kernel(float)) else {
|
||||
return;
|
||||
};
|
||||
let mut twins = 0;
|
||||
let mut compiled = 0;
|
||||
for (stem, p) in committed_profiles().expect("profiles") {
|
||||
let what = format!("{stem} float {float}");
|
||||
let a = match compile(&bc, "heap_texel_write", &p) {
|
||||
@@ -1771,29 +1749,18 @@ fn a_heap_texel_write_stores_half_bits_through_the_unsigned_twin() {
|
||||
};
|
||||
link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{what}: L3: {e}"));
|
||||
assert_binder_classes(&a, &p, &what);
|
||||
let twin = crate::metal::format::heap_half_bits(&p);
|
||||
let declared = heap_image_classes(&a)
|
||||
.iter()
|
||||
.any(|c| c.format == crate::pipeline::sym::StorageFormatClass::HalfBits);
|
||||
assert_eq!(declared, twin, "{what}");
|
||||
let noted = a.precision.contains(&PrecisionNote::DeviceNanEncoding);
|
||||
let fact = |packed| {
|
||||
a.facts.contains(&RuntimeFact::HeapHalfTexelWrites {
|
||||
stage: Stage::Kernel,
|
||||
packed,
|
||||
})
|
||||
};
|
||||
assert!(noted, "{what}: {:?}", a.precision);
|
||||
if twin {
|
||||
twins += 1;
|
||||
let float_fact = !p.takes_driver_deviation(DriverDeviation::MetalHalfStorageNans);
|
||||
assert_eq!(fact(true), !float, "{what}");
|
||||
assert_eq!(fact(false), float && float_fact, "{what}");
|
||||
} else {
|
||||
assert!(!fact(true) && !fact(false), "{what}");
|
||||
}
|
||||
let classes = heap_image_classes(&a);
|
||||
assert_eq!(classes.len(), 1, "{what}: {classes:?}");
|
||||
assert_eq!(classes[0].access, ImageAccess::Storage, "{what}");
|
||||
assert_eq!(classes[0].sampled_type, SampledType::Float, "{what}");
|
||||
assert!(
|
||||
a.precision.contains(&PrecisionNote::DeviceNanEncoding),
|
||||
"{what}: {:?}",
|
||||
a.precision
|
||||
);
|
||||
compiled += 1;
|
||||
}
|
||||
assert!(twins > 0, "no committed profile takes the twin");
|
||||
assert!(compiled > 0, "no committed profile writes through a heap");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2023,8 +1990,7 @@ fn an_argument_buffer_depth_texture_reads_through_the_float_class() {
|
||||
assert_eq!(uses(&a, "access.handle.lookup"), 2, "{stem}");
|
||||
assert_eq!(uses(&a, heap_read(&p)), 1, "{stem}");
|
||||
assert_eq!(uses(&a, "texture.write.heap"), 1, "{stem}");
|
||||
let twin = usize::from(crate::metal::format::heap_half_bits(&p));
|
||||
assert_eq!(bindings_of(&t, is_heap).len(), 2 + twin, "{stem}");
|
||||
assert_eq!(bindings_of(&t, is_heap).len(), 2, "{stem}");
|
||||
let classes: Vec<_> = a
|
||||
.interface
|
||||
.descriptors
|
||||
@@ -2485,16 +2451,8 @@ fn an_imageblock_slice_writes_an_argument_buffer_texture() {
|
||||
1,
|
||||
"{name} on {stem}"
|
||||
);
|
||||
// The written float storage class, and its unsigned integer twin where the profile
|
||||
// writes a half's bits through one.
|
||||
let (twins, classes): (Vec<_>, Vec<_>) = heap_image_classes(&a)
|
||||
.into_iter()
|
||||
.partition(|c| c.format == crate::pipeline::sym::StorageFormatClass::HalfBits);
|
||||
assert_eq!(
|
||||
twins.len(),
|
||||
usize::from(crate::metal::format::heap_half_bits(&p)),
|
||||
"{name} on {stem}: {twins:?}"
|
||||
);
|
||||
// The written float storage class alone.
|
||||
let classes = heap_image_classes(&a);
|
||||
assert_eq!(classes.len(), 1, "{name} on {stem}: {classes:?}");
|
||||
let c = classes[0];
|
||||
assert_eq!(
|
||||
|
||||
@@ -182,8 +182,7 @@ fn heap_writes(plan: &BindingPlan) -> Vec<&WriteSource> {
|
||||
/// other numeric types beside a sampled class (the unsigned integer twin a float read or query
|
||||
/// declares, and the classes a read or query of a member of another numeric class reads it
|
||||
/// through), where the array is the one whose neutral at element 0 is of numeric type `own`: a
|
||||
/// sampled one, or where there is none a storage one (beside the unsigned integer twin a half-float
|
||||
/// write declares for a storage class).
|
||||
/// sampled one, or where there is none a storage one.
|
||||
fn heap_writes_of(plan: &BindingPlan, own: SampledType) -> Vec<&WriteSource> {
|
||||
let heap: Vec<_> = plan.descriptors.iter().filter(|d| d.set == 1).collect();
|
||||
let numeric = |binding: u32, storage: bool| {
|
||||
@@ -922,8 +921,7 @@ fn a_depth_member_is_held_by_the_float_class_through_its_depth_view() {
|
||||
};
|
||||
let plan = pipe.plan(&dev, &state.shape()).expect("plan");
|
||||
let heap = &pipe.layout.sets[1].bindings;
|
||||
let twin = crate::metal::format::heap_half_bits(dev.profile());
|
||||
assert_eq!(heap.len(), 2 + usize::from(twin));
|
||||
assert_eq!(heap.len(), 2);
|
||||
for b in heap {
|
||||
let BindingSource::Heap(HandleClass::Image(class)) = b.source else {
|
||||
panic!("{:?}", b.source);
|
||||
@@ -943,10 +941,6 @@ fn a_depth_member_is_held_by_the_float_class_through_its_depth_view() {
|
||||
})
|
||||
.collect();
|
||||
match class.access {
|
||||
// The twin holds half-float members alone: every element its neutral.
|
||||
_ if class.format == crate::pipeline::sym::StorageFormatClass::HalfBits => {
|
||||
assert_eq!(views, vec![None, None, None]);
|
||||
}
|
||||
ImageAccess::Sampled => {
|
||||
assert_eq!(class.sampled_type, SampledType::Float);
|
||||
assert!(!class.depth_compare);
|
||||
|
||||
@@ -1054,15 +1054,14 @@ const HALF_PATTERNS: [u16; 20] = [
|
||||
0x0400, 0x7BFF, 0xFBFF, 0x3C00, 0xC000, 0x5555, 0x1234, 0xBEEF,
|
||||
];
|
||||
|
||||
/// A `half` slice written to an `RGBA16Float` texture through its unsigned integer alias
|
||||
/// (`StorageImageClass::HalfBits`) copies each cell's half bits as they are, in the shared form
|
||||
/// (the guard local id 0 after the barrier) and the writing invocation's (another invocation's
|
||||
/// guard): each texel's channels are the cell's halves, NaN payloads, signaling NaNs and
|
||||
/// denormals included, and nothing above their 16 bits.
|
||||
/// A `half` slice written to an `RGBA16Float` texture hands the device each cell's halves widened
|
||||
/// exactly, in the shared form (the guard local id 0 after the barrier) and the writing
|
||||
/// invocation's (another invocation's guard): each texel's channels are the cell's halves'
|
||||
/// widenings (the interpreter keeps `f32` texels), signaling NaNs and denormals included, and a
|
||||
/// NaN for each NaN, whose stored bits are the device's conversion's.
|
||||
#[test]
|
||||
fn a_half_slice_to_half_bits_copies_the_cells_bits() {
|
||||
use crate::lower::strategy::Strategy;
|
||||
use crate::lower::texture::TextureStrategy;
|
||||
fn a_half_slice_hands_the_device_the_cells_halves() {
|
||||
use crate::lower::arith::narrow::f32_of_half_bits;
|
||||
let lane = |i: usize, l: usize| HALF_PATTERNS[(i * 4 + l) % HALF_PATTERNS.len()];
|
||||
let mut src = Vec::new();
|
||||
for i in 0..16 {
|
||||
@@ -1083,30 +1082,12 @@ fn a_half_slice_to_half_bits_copies_the_cells_bits() {
|
||||
continue;
|
||||
};
|
||||
let class = inputs.storage_images[&kernel_texture(0)].class;
|
||||
assert_eq!(class, StorageImageClass::Identity, "{name} {stem}");
|
||||
let (plan, m) = match typed_module_with(&bc, "half_slice", &p, &inputs) {
|
||||
Ok(x) => x,
|
||||
Err(Error::NeedsInput(_) | Error::Unsupported(_)) => continue,
|
||||
Err(e) => panic!("{name} {stem}: {e}"),
|
||||
};
|
||||
let bits: Vec<bool> = plan
|
||||
.strategy
|
||||
.iter()
|
||||
.flatten()
|
||||
.filter_map(|s| match s {
|
||||
Strategy::Texture(TextureStrategy::ImageblockSlice(s)) => {
|
||||
Some(s.bits.is_some())
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
assert_eq!(
|
||||
bits,
|
||||
[class == StorageImageClass::HalfBits],
|
||||
"{name} {stem}: {class:?}"
|
||||
);
|
||||
if class != StorageImageClass::HalfBits {
|
||||
continue;
|
||||
}
|
||||
assert_eq!(
|
||||
plan.families.texture.cooperative.is_empty(),
|
||||
name == "writer",
|
||||
@@ -1122,12 +1103,20 @@ fn a_half_slice_to_half_bits_copies_the_cells_bits() {
|
||||
for y in 0..4u32 {
|
||||
for x in 0..4u32 {
|
||||
let i = (y * 4 + x) as usize;
|
||||
let want = [0, 1, 2, 3].map(|l| u32::from(lane(i, l)));
|
||||
assert_eq!(texel(&imgs[0], 0, x, y), want, "{name} {stem} ({x}, {y})");
|
||||
let got = texel(&imgs[0], 0, x, y);
|
||||
for (l, &t) in got.iter().enumerate() {
|
||||
let h = lane(i, l);
|
||||
let what = format!("{name} {stem} ({x}, {y}) lane {l} {h:#06x}: {t:#x}");
|
||||
if h & 0x7C00 == 0x7C00 && h & 0x3FF != 0 {
|
||||
assert!(f32::from_bits(t).is_nan(), "{what}");
|
||||
} else {
|
||||
assert_eq!(t, f32_of_half_bits(u32::from(h)), "{what}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ran += 1;
|
||||
}
|
||||
}
|
||||
assert!(ran > 0, "no profile writes half bits");
|
||||
assert!(ran > 0, "no profile writes a half slice");
|
||||
}
|
||||
@@ -428,9 +428,8 @@ const OP_IS_NAN: u16 = 156;
|
||||
/// with it (a choice of a class rounding to `half` is a 16-bit float format's, declared or not;
|
||||
/// such a device's own choice declares no format, so the test declares one there too);
|
||||
/// bound in `RGBA8Unorm` it records none. Where the choice declares no format and no class, the
|
||||
/// write records the note. A choice of the `RGBA16Float` texture's unsigned integer alias
|
||||
/// (`StorageImageClass::HalfBits`, on a profile without the deviation) writes the half's bits and
|
||||
/// records nothing; so does `RGBX16Float`'s, whose image is `RGBA16Float`'s.
|
||||
/// write records the note. A choice declaring `RGBA16Float` on every profile records the note or
|
||||
/// requires the property as the profile's deviation says.
|
||||
#[test]
|
||||
fn a_half_texel_write_records_the_device_nan_encoding_where_it_may_not_be_metal_s() {
|
||||
use crate::device::requirements::VkProperty;
|
||||
@@ -439,7 +438,7 @@ fn a_half_texel_write_records_the_device_nan_encoding_where_it_may_not_be_metal_
|
||||
return;
|
||||
};
|
||||
let slot = texture_slot(0);
|
||||
let (mut float, mut formatless, mut measured, mut aliased) = (0, 0, 0, 0);
|
||||
let (mut float, mut formatless, mut measured, mut device) = (0, 0, 0, 0);
|
||||
for (stem, p) in committed_profiles().expect("profiles") {
|
||||
let keeps = p.takes_driver_deviation(DriverDeviation::MetalHalfTexelWrites);
|
||||
let compiled = |pf: PixelFormat| {
|
||||
@@ -454,7 +453,6 @@ fn a_half_texel_write_records_the_device_nan_encoding_where_it_may_not_be_metal_
|
||||
ok(a, &p, &format!("{stem} {pf:?}")),
|
||||
choice.vk_format == crate::vk::Format::UNDEFINED
|
||||
&& choice.class == StorageImageClass::Identity,
|
||||
choice.class == StorageImageClass::HalfBits,
|
||||
)),
|
||||
}
|
||||
};
|
||||
@@ -466,7 +464,7 @@ fn a_half_texel_write_records_the_device_nan_encoding_where_it_may_not_be_metal_
|
||||
PixelFormat::RGBX16Float,
|
||||
PixelFormat::RGBA32Float,
|
||||
] {
|
||||
let Some((a, undeclared, bits)) = compiled(pf) else {
|
||||
let Some((a, undeclared)) = compiled(pf) else {
|
||||
continue;
|
||||
};
|
||||
let what = format!("{stem}: {pf:?}: tests {}, noted {}", tests(&a), noted(&a));
|
||||
@@ -476,17 +474,6 @@ fn a_half_texel_write_records_the_device_nan_encoding_where_it_may_not_be_metal_
|
||||
continue;
|
||||
}
|
||||
match pf {
|
||||
// Through the unsigned integer alias the half's bits are written as they are:
|
||||
// no note, no measured property.
|
||||
PixelFormat::RGBA16Float | PixelFormat::RGBX16Float if bits => {
|
||||
assert!(!keeps && !noted(&a), "{what}");
|
||||
let relied = &a.requirements.properties;
|
||||
assert!(
|
||||
!relied.contains(&VkProperty::MetalHalfTexelWrites),
|
||||
"{what}"
|
||||
);
|
||||
aliased += 1;
|
||||
}
|
||||
PixelFormat::RGBA16Float | PixelFormat::RGBX16Float => {
|
||||
assert_eq!(noted(&a), !keeps, "{what}");
|
||||
assert_eq!(
|
||||
@@ -506,8 +493,9 @@ fn a_half_texel_write_records_the_device_nan_encoding_where_it_may_not_be_metal_
|
||||
}
|
||||
}
|
||||
// A device of the deviation writes a half-float texture without a format, so its
|
||||
// committed choice declares none; one that declares `RGBA16Float` stores Metal's NaN.
|
||||
if keeps {
|
||||
// committed choice declares none; one that declares `RGBA16Float` stores Metal's NaN there,
|
||||
// and the device's elsewhere.
|
||||
{
|
||||
let declared = crate::pipeline::lower_inputs::StorageImageChoice::new(
|
||||
crate::vk::Format::R16G16B16A16_SFLOAT,
|
||||
StorageImageClass::Identity,
|
||||
@@ -519,23 +507,24 @@ fn a_half_texel_write_records_the_device_nan_encoding_where_it_may_not_be_metal_
|
||||
Err(Error::NeedsInput(_) | Error::Unsupported(_)) => {}
|
||||
a => {
|
||||
let a = ok(a, &p, &what);
|
||||
assert!(!noted(&a), "{what}");
|
||||
assert!(
|
||||
assert_eq!(noted(&a), !keeps, "{what}");
|
||||
assert_eq!(
|
||||
a.requirements
|
||||
.properties
|
||||
.contains(&VkProperty::MetalHalfTexelWrites),
|
||||
keeps,
|
||||
"{what}"
|
||||
);
|
||||
measured += 1;
|
||||
measured += usize::from(keeps);
|
||||
device += usize::from(!keeps);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
assert!(
|
||||
float > 0 && formatless > 0 && measured > 0 && aliased > 0,
|
||||
float > 0 && formatless > 0 && measured > 0 && device > 0,
|
||||
"the committed profiles cover a declared float format ({float}), a formatless choice \
|
||||
({formatless}), the measured deviation ({measured}) and the half-float alias \
|
||||
({aliased})"
|
||||
({formatless}), the measured deviation ({measured}) and the device's NaN ({device})"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -3500,7 +3500,6 @@ field metal2vulkan::bind::TessellationScanModule.spirv pub spirv: Arc<[u32]>
|
||||
field metal2vulkan::bind::TextureFacts.address_modes pub address_modes: metal::sampler::AddressModeMap
|
||||
field metal2vulkan::bind::TextureFacts.array_length pub array_length: u32
|
||||
field metal2vulkan::bind::TextureFacts.mipmap_level_count pub mipmap_level_count: u32
|
||||
field metal2vulkan::bind::TextureFacts.own_format_views pub own_format_views: bool
|
||||
field metal2vulkan::bind::TextureFacts.parent_base_size pub parent_base_size: [u32; 3]
|
||||
field metal2vulkan::bind::TextureFacts.parent_relative_level pub parent_relative_level: u32
|
||||
field metal2vulkan::bind::TextureFacts.pixel_format pub pixel_format: metal::PixelFormat
|
||||
@@ -4576,7 +4575,6 @@ fn metal2vulkan::bind::handle_entry_flags pub fn handle_entry_flags(facts: &Text
|
||||
fn metal2vulkan::bind::heap_classes pub fn heap_classes(profile: &DeviceProfile) -> Vec<HandleClass>
|
||||
fn metal2vulkan::bind::heap_element pub fn heap_element(profile: &DeviceProfile, class: &HandleClass, facts: &TextureFacts, layout: vk::ImageLayout) -> Result<HeapElement, BindError>
|
||||
fn metal2vulkan::bind::heap_raw_form pub fn heap_raw_form(facts: &TextureFacts) -> Option<crate::metal::format::ExtendedRange>
|
||||
fn metal2vulkan::bind::heap_write_nans_converted pub fn heap_write_nans_converted(facts: &TextureFacts, packed: bool) -> bool
|
||||
fn metal2vulkan::bind::index_bounds_fill_module pub fn index_bounds_fill_module(device: &Device) -> Result<IndexBoundsFillModule, Error>
|
||||
fn metal2vulkan::bind::index_bounds_fill_run_module pub fn index_bounds_fill_run_module(device: &Device) -> Result<IndexBoundsFillModule, Error>
|
||||
fn metal2vulkan::bind::index_bounds_plan_module pub fn index_bounds_plan_module(device: &Device) -> Result<IndexBoundsPlanModule, Error>
|
||||
@@ -4642,7 +4640,6 @@ fn metal2vulkan::metal::format::direct_format pub fn direct_format(pf: PixelForm
|
||||
fn metal2vulkan::metal::format::explicit_imageblock_sample_length pub fn explicit_imageblock_sample_length(data_size: u32, alignment: u32, colors: u32) -> Option<u32>
|
||||
fn metal2vulkan::metal::format::extended_range_blend pub fn extended_range_blend(pf: PixelFormat, profile: &DeviceProfile) -> Result<(), Unsupported>
|
||||
fn metal2vulkan::metal::format::footprint pub fn footprint(pf: PixelFormat) -> Option<Footprint>
|
||||
fn metal2vulkan::metal::format::half_write_nans_converted pub fn half_write_nans_converted(pf: PixelFormat) -> bool
|
||||
fn metal2vulkan::metal::format::image_type pub fn image_type(ty: TextureType) -> Option<(vk::ImageType, vk::ImageCreateFlags)>
|
||||
fn metal2vulkan::metal::format::image_view_type pub fn image_view_type(ty: TextureType) -> Option<vk::ImageViewType>
|
||||
fn metal2vulkan::metal::format::imageblock_sample_length pub fn imageblock_sample_length(formats: &[Option<PixelFormat>]) -> Option<u32>
|
||||
@@ -12231,7 +12228,7 @@ variant metal2vulkan::bind::TessellationRecords::Pool Pool
|
||||
variant metal2vulkan::bind::TexelWords::ColorPlane ColorPlane
|
||||
variant metal2vulkan::bind::TexelWords::Raw Raw
|
||||
variant metal2vulkan::bind::TextureShape::Buffer Buffer { pixel_format: metal::PixelFormat, swizzle: metal::TextureSwizzleChannels }
|
||||
variant metal2vulkan::bind::TextureShape::Texture Texture { texture_type: metal::TextureType, pixel_format: metal::PixelFormat, sample_count: u32, usage: metal::TextureUsage, mipmap_level_count: u32, sparse: bool, swizzle: metal::TextureSwizzleChannels, address_modes: metal::sampler::AddressModeMap, offset_base_axes: u8, own_format_views: bool, ycbcr_in_place: bool }
|
||||
variant metal2vulkan::bind::TextureShape::Texture Texture { texture_type: metal::TextureType, pixel_format: metal::PixelFormat, sample_count: u32, usage: metal::TextureUsage, mipmap_level_count: u32, sparse: bool, swizzle: metal::TextureSwizzleChannels, address_modes: metal::sampler::AddressModeMap, offset_base_axes: u8, ycbcr_in_place: bool }
|
||||
variant metal2vulkan::bind::TileMapError::Region Region { level: u32, slice: u32, origin: [u32; 3], size: [u32; 3] }
|
||||
variant metal2vulkan::bind::TileMapError::Shape Shape
|
||||
variant metal2vulkan::bind::TileMapError::TextureType TextureType { texture_type: TextureType }
|
||||
@@ -13650,7 +13647,6 @@ variant metal2vulkan::pipeline::RuntimeFact::FragmentImageblock FragmentImageblo
|
||||
variant metal2vulkan::pipeline::RuntimeFact::FramebufferFetch FramebufferFetch { color: u32 }
|
||||
variant metal2vulkan::pipeline::RuntimeFact::FunctionTableRange FunctionTableRange { addressed: bool }
|
||||
variant metal2vulkan::pipeline::RuntimeFact::HeapCrossClassNeutral HeapCrossClassNeutral { stage: Stage, class: ImageHandleClass, every_member: bool }
|
||||
variant metal2vulkan::pipeline::RuntimeFact::HeapHalfTexelWrites HeapHalfTexelWrites { stage: Stage, packed: bool }
|
||||
variant metal2vulkan::pipeline::RuntimeFact::HeapNumericType HeapNumericType { class: ImageHandleClass }
|
||||
variant metal2vulkan::pipeline::RuntimeFact::HeapRawSamples HeapRawSamples { stage: Stage, sampler: Option<u32> }
|
||||
variant metal2vulkan::pipeline::RuntimeFact::HeapWriteRounding HeapWriteRounding { stage: Stage, halves: bool }
|
||||
@@ -13779,11 +13775,9 @@ variant metal2vulkan::pipeline::StandInView::SamplePlanes SamplePlanes { layers:
|
||||
variant metal2vulkan::pipeline::StorageAttachmentView::Attachment Attachment
|
||||
variant metal2vulkan::pipeline::StorageAttachmentView::SamplePlanes SamplePlanes { layers: u32 }
|
||||
variant metal2vulkan::pipeline::StorageFormatClass::Format Format(vk::Format)
|
||||
variant metal2vulkan::pipeline::StorageFormatClass::HalfBits HalfBits
|
||||
variant metal2vulkan::pipeline::StorageFormatClass::NotStorage NotStorage
|
||||
variant metal2vulkan::pipeline::StorageFormatClass::Unknown Unknown
|
||||
variant metal2vulkan::pipeline::StorageImageClass::AlphaInRed AlphaInRed
|
||||
variant metal2vulkan::pipeline::StorageImageClass::HalfBits HalfBits
|
||||
variant metal2vulkan::pipeline::StorageImageClass::Identity Identity
|
||||
variant metal2vulkan::pipeline::StorageImageClass::RotateArgb RotateArgb
|
||||
variant metal2vulkan::pipeline::StorageImageClass::SharedExponentBits SharedExponentBits
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -473,7 +473,6 @@ surface! {
|
||||
fn handle_entry_flags;
|
||||
fn heap_element;
|
||||
fn heap_raw_form;
|
||||
fn heap_write_nans_converted;
|
||||
enum HeapElement N;
|
||||
const HANDLE_ENTRY_BYTES;
|
||||
const HANDLE_TABLE_CAPACITY;
|
||||
@@ -920,7 +919,6 @@ surface! {
|
||||
fn padded_words;
|
||||
fn extended_range_blend;
|
||||
fn x_channel;
|
||||
fn half_write_nans_converted;
|
||||
fn bound_texel_format;
|
||||
struct YCbCrFormat N;
|
||||
enum ChromaSubsampling N;
|
||||
|
||||
+3
-3
@@ -76,7 +76,7 @@ Columns:
|
||||
| `QuadOperations` | Quad operations in a stage without quad support | devices without VkLimit::MinSubgroupSize; devices without VkProperty::SubgroupQuadOperationsInAllStages | `device` | 2: `crates/metal2vulkan/src/device/subgroup.rs (subgroup_tier, 2 sites)` | `app`: quad shuffles in kernels on devices without quad operations there |
|
||||
| `SimdgroupMatrix` | Simdgroup matrix operations | every device (not implemented) | `ours` | 1: `crates/metal2vulkan/src/lower/simd/matrix.rs (not_implemented)` | `rare`: simdgroup matrix kernels |
|
||||
| `ArgumentBufferPointers` | Argument buffers holding buffer pointers (dynamic roots) | devices without buffer device addresses (`addressed_needs`) | `device` | 1: `crates/metal2vulkan/src/device/metal.rs (unsupported_features)` | `app`: argument buffers holding buffer pointers |
|
||||
| `ArgumentBufferTextures` | Argument buffers holding textures or samplers (handle domain) | devices short of a device limit the site names; devices without a capability the site computes (`gaps`); devices without a capability the site computes (`missing`); devices without a capability the site computes (`needs`); every device (not implemented) | `ours` | 17: `crates/metal2vulkan-runtime/src/families/features.rs (tier2)`, `crates/metal2vulkan-runtime/src/pipeline/objects.rs (create_set_layout)` (+10) | `app`: argument buffers holding textures and samplers (bindless) |
|
||||
| `ArgumentBufferTextures` | Argument buffers holding textures or samplers (handle domain) | devices short of a device limit the site names; devices without a capability the site computes (`gaps`); devices without a capability the site computes (`missing`); devices without a capability the site computes (`needs`); every device (not implemented) | `ours` | 16: `crates/metal2vulkan-runtime/src/families/features.rs (tier2)`, `crates/metal2vulkan-runtime/src/pipeline/objects.rs (create_set_layout)` (+10) | `app`: argument buffers holding textures and samplers (bindless) |
|
||||
| `ArgumentBufferObjects` | Argument-buffer members that are pipeline states, ICBs, function tables, or acceleration structures | every device (not implemented) | `ours` | 5: `crates/metal2vulkan/src/lower/access/encode.rs (select_command, 3 sites)`, `crates/metal2vulkan/src/memory/provenance.rs (access)` (+1) | `rare`: pipeline states and ICBs in argument buffers |
|
||||
| `DereferenceLoadedPointer` | Dereferencing a pointer loaded from memory or made from an integer | devices short of a Vulkan feature the site names; devices without buffer device addresses (`addressed_needs`); every device (no Vulkan mechanism) | `device` | 4: `crates/metal2vulkan/src/lower/access/dynamic.rs (plan_misses)`, `crates/metal2vulkan/src/lower/access/local.rs (access_ptr)` (+2) | `app`: pointers loaded from argument buffers |
|
||||
| `PointerToInteger` | Storing a pointer or converting it to an integer | - | `-` | via a helper: 1: `crates/metal2vulkan/src/lower/access/dynamic.rs (require_addresses)` | `rare`: pointer to integer casts |
|
||||
@@ -578,7 +578,7 @@ Each refusal's sites, with the function that builds it.
|
||||
- `feature::QuadOperations`: `crates/metal2vulkan/src/device/subgroup.rs (subgroup_tier, 2 sites)`
|
||||
- `feature::SimdgroupMatrix`: `crates/metal2vulkan/src/lower/simd/matrix.rs (not_implemented)`
|
||||
- `feature::ArgumentBufferPointers`: `crates/metal2vulkan/src/device/metal.rs (unsupported_features)`
|
||||
- `feature::ArgumentBufferTextures`: `crates/metal2vulkan-runtime/src/families/features.rs (tier2)`; `crates/metal2vulkan-runtime/src/pipeline/objects.rs (create_set_layout)`; `crates/metal2vulkan-runtime/src/resource_ids.rs (check_capacity)`; `crates/metal2vulkan/src/bind/heap.rs (array)`; `crates/metal2vulkan/src/bind/heap.rs (member_view, 5 sites)`; `crates/metal2vulkan/src/lower/access/handle.rs (select)`; `crates/metal2vulkan/src/lower/sampler/select.rs (select_heap_sampling)`; `crates/metal2vulkan/src/lower/sampler/select.rs (select_one)`; `crates/metal2vulkan/src/lower/sampler/select.rs (select_sampling)`; `crates/metal2vulkan/src/lower/texture/atomic.rs (select)`; `crates/metal2vulkan/src/lower/texture/slot.rs (declare_heap, 2 sites)`; `crates/metal2vulkan/src/pipeline/link.rs (heap_set)`
|
||||
- `feature::ArgumentBufferTextures`: `crates/metal2vulkan-runtime/src/families/features.rs (tier2)`; `crates/metal2vulkan-runtime/src/pipeline/objects.rs (create_set_layout)`; `crates/metal2vulkan-runtime/src/resource_ids.rs (check_capacity)`; `crates/metal2vulkan/src/bind/heap.rs (array)`; `crates/metal2vulkan/src/bind/heap.rs (member_view, 4 sites)`; `crates/metal2vulkan/src/lower/access/handle.rs (select)`; `crates/metal2vulkan/src/lower/sampler/select.rs (select_heap_sampling)`; `crates/metal2vulkan/src/lower/sampler/select.rs (select_one)`; `crates/metal2vulkan/src/lower/sampler/select.rs (select_sampling)`; `crates/metal2vulkan/src/lower/texture/atomic.rs (select)`; `crates/metal2vulkan/src/lower/texture/slot.rs (declare_heap, 2 sites)`; `crates/metal2vulkan/src/pipeline/link.rs (heap_set)`
|
||||
- `feature::ArgumentBufferObjects`: `crates/metal2vulkan/src/lower/access/encode.rs (select_command, 3 sites)`; `crates/metal2vulkan/src/memory/provenance.rs (access)`; `crates/metal2vulkan/src/memory/provenance.rs (classify)`
|
||||
- `feature::DereferenceLoadedPointer`: `crates/metal2vulkan/src/lower/access/dynamic.rs (plan_misses)`; `crates/metal2vulkan/src/lower/access/local.rs (access_ptr)`; `crates/metal2vulkan/src/lower/access/local.rs (threadgroup_constant_refusal)`; `crates/metal2vulkan/src/memory/plan.rs (analyze)`
|
||||
- `feature::PointerToInteger`: `crates/metal2vulkan/src/lower/access/dynamic.rs (require_addresses)`
|
||||
@@ -593,7 +593,7 @@ Each refusal's sites, with the function that builds it.
|
||||
- `feature::BufferRange`: `crates/metal2vulkan-runtime/src/function_table.rs (past_storage_buffer_range)`; `crates/metal2vulkan/src/bind/graphics.rs (patch_binding, 3 sites)`; `crates/metal2vulkan/src/bind/instantiate.rs (bind_buffers)`; `crates/metal2vulkan/src/lower/access/function_table.rs (select)`; `crates/metal2vulkan/src/lower/access/mod.rs (place_slots)`
|
||||
- `feature::Int64Arithmetic`: `crates/metal2vulkan/src/lower/arith/legal.rs (check_scalar)`; `crates/metal2vulkan/src/lower/select.rs (selector_form)`
|
||||
- `feature::Float64Arithmetic`: `crates/metal2vulkan/src/device/metal.rs (unsupported_features)`; `crates/metal2vulkan/src/lower/arith/legal.rs (check_scalar)`
|
||||
- `feature::Format`: `crates/metal2vulkan-runtime/src/binding_view.rs (binding_view)`; `crates/metal2vulkan-runtime/src/blit_plan.rs (check_formats, 3 sites)`; `crates/metal2vulkan-runtime/src/blit_plan.rs (pair_unit)`; `crates/metal2vulkan-runtime/src/blit_plan.rs (plan_levels_copy)`; `crates/metal2vulkan-runtime/src/blit_texture.rs (through_buffer)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs (make_texture_over, 3 sites)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs (texture_buffer_texel)`; `crates/metal2vulkan-runtime/src/color_resolve.rs (of_attachment)`; `crates/metal2vulkan-runtime/src/copy_plan.rs (colour_unit)`; `crates/metal2vulkan-runtime/src/copy_plan.rs (copy_unit, 2 sites)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs (scratch)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs (usable_twin)`; `crates/metal2vulkan-runtime/src/families/features.rs (read_write_tier)`; `crates/metal2vulkan-runtime/src/families/formats.rs (answers, 5 sites)`; `crates/metal2vulkan-runtime/src/families/formats.rs (atomic_gap)`; `crates/metal2vulkan-runtime/src/families/formats.rs (lacking)`; `crates/metal2vulkan-runtime/src/families/formats.rs (none)`; `crates/metal2vulkan-runtime/src/families/formats.rs (sparse_missing)`; `crates/metal2vulkan-runtime/src/families/formats.rs (unsupported)`; `crates/metal2vulkan-runtime/src/image_plan.rs (plan_held, 3 sites)`; `crates/metal2vulkan-runtime/src/render.rs (viewing)`; `crates/metal2vulkan-runtime/src/render_pass.rs (attachment_format)`; `crates/metal2vulkan-runtime/src/render_pass.rs (check_target)`; `crates/metal2vulkan-runtime/src/render_pass.rs (layout)`; `crates/metal2vulkan-runtime/src/render_pass.rs (target)`; `crates/metal2vulkan-runtime/src/resolve.rs (color)`; `crates/metal2vulkan-runtime/src/resolve.rs (unmodelled_resolve)`; `crates/metal2vulkan-runtime/src/sample_copy.rs (checked_twin)`; `crates/metal2vulkan-runtime/src/sample_copy.rs (plan)`; `crates/metal2vulkan-runtime/src/sample_interleave.rs (interleave_merge)`; `crates/metal2vulkan-runtime/src/shadow.rs (unmerged, 2 sites)`; `crates/metal2vulkan-runtime/src/texture.rs (texture_as)`; `crates/metal2vulkan-runtime/src/texture.rs (two_planes_refused)`; `crates/metal2vulkan-runtime/src/texture/decoded_twin.rs (astc_texels)`; `crates/metal2vulkan-runtime/src/texture/decoded_twin.rs (etc_texels)`; `crates/metal2vulkan-runtime/src/texture/heap.rs (planned_heap_texture)`; `crates/metal2vulkan-runtime/src/texture/surface_two_planes.rs (refused)`; `crates/metal2vulkan-runtime/src/texture/ycbcr_image.rs (converted_storage)`; `crates/metal2vulkan-runtime/src/texture/ycbcr_image.rs (new_render_shadow)`; `crates/metal2vulkan-runtime/src/texture/ycbcr_image.rs (ycbcr_write_shadow)`; `crates/metal2vulkan-runtime/src/two_planes.rs (unmeasured)`; `crates/metal2vulkan-runtime/src/view_plan.rs (check_format, 5 sites)`; `crates/metal2vulkan-runtime/src/ycbcr.rs (refused)`; `crates/metal2vulkan/src/bind/extended_shadow.rs (extended_shadow_module)`; `crates/metal2vulkan/src/bind/plan/resources.rs (extended_sampler)`; `crates/metal2vulkan/src/bind/plan/resources.rs (plain_texture, 2 sites)`; `crates/metal2vulkan/src/bind/plan/resources.rs (require_filter_features)`; `crates/metal2vulkan/src/bind/sample_interleave.rs (finish)`; `crates/metal2vulkan/src/bind/sample_interleave.rs (interleave_split_module)`; `crates/metal2vulkan/src/bind/shadow_copy_in.rs (shadow_copy_in_module)`; `crates/metal2vulkan/src/bind/unused_bits.rs (unused_bits_module)`; `crates/metal2vulkan/src/lower/access/tile.rs (storage_format)`; `crates/metal2vulkan/src/lower/fragment/color.rs (select_param, 2 sites)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs (extended_range_blend, 5 sites)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs (plan)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs (select_output, 3 sites)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs (select_read)`; `crates/metal2vulkan/src/lower/sampler/select.rs (select_extended)`; `crates/metal2vulkan/src/lower/sampler/select.rs (texel_in)`; `crates/metal2vulkan/src/lower/stage_io/extended_color.rs (plan)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs (entry)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs (zeroed_output)`; `crates/metal2vulkan/src/lower/stage_io/word_color.rs (plan)`; `crates/metal2vulkan/src/lower/texture/mod.rs (cross_class)`; `crates/metal2vulkan/src/lower/texture/mod.rs (select)`; `crates/metal2vulkan/src/lower/texture/mod.rs (select_image)`; `crates/metal2vulkan/src/lower/texture/mod.rs (select_read_as, 2 sites)`; `crates/metal2vulkan/src/lower/texture/mod.rs (select_write)`; `crates/metal2vulkan/src/lower/texture/slot.rs (atomic_format, 2 sites)`; `crates/metal2vulkan/src/lower/texture/slot.rs (declare_slot, 3 sites)`; `crates/metal2vulkan/src/lower/texture/slot.rs (storage_format, 5 sites)`; `crates/metal2vulkan/src/lower/texture/slot.rs (ulong_format, 3 sites)`; `crates/metal2vulkan/src/metal/format/mod.rs (candidateLine truncated
|
||||
- `feature::Format`: `crates/metal2vulkan-runtime/src/binding_view.rs (binding_view)`; `crates/metal2vulkan-runtime/src/blit_plan.rs (check_formats, 3 sites)`; `crates/metal2vulkan-runtime/src/blit_plan.rs (pair_unit)`; `crates/metal2vulkan-runtime/src/blit_plan.rs (plan_levels_copy)`; `crates/metal2vulkan-runtime/src/blit_texture.rs (through_buffer)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs (make_texture_over, 3 sites)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs (texture_buffer_texel)`; `crates/metal2vulkan-runtime/src/color_resolve.rs (of_attachment)`; `crates/metal2vulkan-runtime/src/copy_plan.rs (colour_unit)`; `crates/metal2vulkan-runtime/src/copy_plan.rs (copy_unit, 2 sites)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs (scratch)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs (usable_twin)`; `crates/metal2vulkan-runtime/src/families/features.rs (read_write_tier)`; `crates/metal2vulkan-runtime/src/families/formats.rs (answers, 5 sites)`; `crates/metal2vulkan-runtime/src/families/formats.rs (atomic_gap)`; `crates/metal2vulkan-runtime/src/families/formats.rs (lacking)`; `crates/metal2vulkan-runtime/src/families/formats.rs (none)`; `crates/metal2vulkan-runtime/src/families/formats.rs (sparse_missing)`; `crates/metal2vulkan-runtime/src/families/formats.rs (unsupported)`; `crates/metal2vulkan-runtime/src/image_plan.rs (plan_held, 3 sites)`; `crates/metal2vulkan-runtime/src/render.rs (viewing)`; `crates/metal2vulkan-runtime/src/render_pass.rs (attachment_format)`; `crates/metal2vulkan-runtime/src/render_pass.rs (check_target)`; `crates/metal2vulkan-runtime/src/render_pass.rs (layout)`; `crates/metal2vulkan-runtime/src/render_pass.rs (target)`; `crates/metal2vulkan-runtime/src/resolve.rs (color)`; `crates/metal2vulkan-runtime/src/resolve.rs (unmodelled_resolve)`; `crates/metal2vulkan-runtime/src/sample_copy.rs (checked_twin)`; `crates/metal2vulkan-runtime/src/sample_copy.rs (plan)`; `crates/metal2vulkan-runtime/src/sample_interleave.rs (interleave_merge)`; `crates/metal2vulkan-runtime/src/shadow.rs (unmerged, 2 sites)`; `crates/metal2vulkan-runtime/src/texture.rs (texture_as)`; `crates/metal2vulkan-runtime/src/texture.rs (two_planes_refused)`; `crates/metal2vulkan-runtime/src/texture/decoded_twin.rs (astc_texels)`; `crates/metal2vulkan-runtime/src/texture/decoded_twin.rs (etc_texels)`; `crates/metal2vulkan-runtime/src/texture/heap.rs (planned_heap_texture)`; `crates/metal2vulkan-runtime/src/texture/surface_two_planes.rs (refused)`; `crates/metal2vulkan-runtime/src/texture/ycbcr_image.rs (converted_storage)`; `crates/metal2vulkan-runtime/src/texture/ycbcr_image.rs (new_render_shadow)`; `crates/metal2vulkan-runtime/src/texture/ycbcr_image.rs (ycbcr_write_shadow)`; `crates/metal2vulkan-runtime/src/two_planes.rs (unmeasured)`; `crates/metal2vulkan-runtime/src/view_plan.rs (check_format, 5 sites)`; `crates/metal2vulkan-runtime/src/ycbcr.rs (refused)`; `crates/metal2vulkan/src/bind/extended_shadow.rs (extended_shadow_module)`; `crates/metal2vulkan/src/bind/plan/resources.rs (extended_sampler)`; `crates/metal2vulkan/src/bind/plan/resources.rs (plain_texture, 2 sites)`; `crates/metal2vulkan/src/bind/plan/resources.rs (require_filter_features)`; `crates/metal2vulkan/src/bind/sample_interleave.rs (finish)`; `crates/metal2vulkan/src/bind/sample_interleave.rs (interleave_split_module)`; `crates/metal2vulkan/src/bind/shadow_copy_in.rs (shadow_copy_in_module)`; `crates/metal2vulkan/src/bind/unused_bits.rs (unused_bits_module)`; `crates/metal2vulkan/src/lower/access/tile.rs (storage_format)`; `crates/metal2vulkan/src/lower/fragment/color.rs (select_param, 2 sites)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs (extended_range_blend, 5 sites)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs (plan)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs (select_output, 3 sites)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs (select_read)`; `crates/metal2vulkan/src/lower/sampler/select.rs (select_extended)`; `crates/metal2vulkan/src/lower/sampler/select.rs (texel_in)`; `crates/metal2vulkan/src/lower/stage_io/extended_color.rs (plan)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs (entry)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs (zeroed_output)`; `crates/metal2vulkan/src/lower/stage_io/word_color.rs (plan)`; `crates/metal2vulkan/src/lower/texture/mod.rs (cross_class)`; `crates/metal2vulkan/src/lower/texture/mod.rs (select)`; `crates/metal2vulkan/src/lower/texture/mod.rs (select_image)`; `crates/metal2vulkan/src/lower/texture/mod.rs (select_read_as, 2 sites)`; `crates/metal2vulkan/src/lower/texture/mod.rs (select_write)`; `crates/metal2vulkan/src/lower/texture/slot.rs (atomic_format, 2 sites)`; `crates/metal2vulkan/src/lower/texture/slot.rs (declare_slot, 3 sites)`; `crates/metal2vulkan/src/lower/texture/slot.rs (storage_format, 5 sites)`; `crates/metal2vulkan/src/lower/texture/slot.rs (ulong_format, 3 sites)`; `crates/metal2vulkan/src/metal/format/mod.rs (candidateLine truncated
|
||||
- `feature::DivergentImplicitLod`: `crates/metal2vulkan/src/lower/sampler/select.rs (select_sampling)`
|
||||
- `feature::ImplicitLodOutsideFragment`: `crates/metal2vulkan/src/lower/sampler/constexpr.rs (query_min_level)`; `crates/metal2vulkan/src/lower/sampler/select.rs (query_level_measured)`; `crates/metal2vulkan/src/lower/sampler/select.rs (query_min_level)`
|
||||
- `feature::MinLodClamp`: `crates/metal2vulkan/src/lower/sampler/select.rs (min_lod)`; `crates/metal2vulkan/src/lower/sampler/select.rs (select_one)`
|
||||
|
||||
Reference in new issue
Block a user