A float write through an argument buffer notes the half-float and small-float NaN only where the heap can name such a texture

What: lower::texture::stored_where gave a heap element one clause of no test, so a
`float` texel's write through an argument buffer recorded DeviceNanEncoding (and,
off MetalHalfStorageWrites, DeviceColorConversion) unconditionally, whatever the
command made resident. It now gives the clause the family the caller asks about:
may_store_half the 16-bit float family (bind::heap::NAN_SIXTEEN), small_float_storage
the packed small float one (NAN_SMALL), tested on SpecKey::HeapNanFamilies, which
the runtime reads at each draw or dispatch, as a `half` write's heap note already
does (half_write_nans). SEMANTICS_VERSION 2021: the notes change under unchanged
keys on every profile without MetalHalfStorageNans.

Why: with lavapipe's MetalSmallFloatNans row, runtime_lane::half_storage_writes::
every_nan_a_kernel_writes_to_a_small_float_texture_is_metal_s_where_measured failed
on lavapipe (gem10, Mesa 26.2.6, LLVM 23.1.4) in its argument-buffer form alone:
every one of 98,298 NaN fields was Metal's, yet the dispatch, whose only resident
texture is RG11B10Float, announced device-nan-encoding for the half-float family
the heap might have held. The same over-note as the reported one, through the
argument buffer's float write.

Test that fails without it: tests::engine_handles::a_heap_texel_write_is_the_devices_write
now requires a float texel's DeviceNanEncoding to hold only under HeapNanFamilies
clauses of NAN_SIXTEEN (profile without MetalHalfStorageNans) and NAN_SMALL (without
MetalSmallFloatNans); and the lane above on lavapipe.
This commit is contained in:
Anees Iqbal committed 2026-11-11 01:30:36 -08:00
1 parent f9d09e715d
commit 7aefa49b7f
6 files changed
+71 -27

No files matched your search

+5 -4
View File
@@ -3696,10 +3696,11 @@ bound.
a fragment function computes into a 16-bit float attachment through the pixel interlock: a NaN
of the blend is the device's arithmetic's, which the storage image's store converts, where Metal
stores every NaN of the blend as `0x7e00`. A texture write records it where the stored NaN is the
device's: a constant texel none of whose lanes is a NaN records nothing, and a `half` write
through an argument buffer is announced only at a draw or dispatch whose command can name a
texture of a format family whose stored NaN is the device's (on MoltenVK on the Apple M3 Max,
a 16-bit float one; a 32-bit float or `RG11B10Float` one stores Metal's). So does a fragment
device's: a constant texel none of whose lanes is a NaN records nothing, and a `half` or
`float` write through an argument buffer is announced only at a draw or dispatch whose command
can name a texture of a format family whose stored NaN is the device's (for a `half` write on
MoltenVK on the Apple M3 Max, a 16-bit float one; a 32-bit float or `RG11B10Float` one stores
Metal's; for a `float` write, a 16-bit float or `RG11B10Float` one). So does a fragment
function's color output where the device's conversion stores its NaN, but one every return of
which holds such a constant records nothing. **Exempt:** a `half`
texel's write to a 32-bit float storage image on a profile that takes