conformance: one result line could not say whether the bind was refused or the sample count was one

Component: conformance suite. Pathway: x86 macOS / Linux Vulkan. Rail: macos-15.
Test-only; no product behavior changes.

## The contract, and why one case could not witness it

A Metal kernel may declare `texture2d_ms<T, access::read>` and call
`read(coord, sample)`. Two independent obligations stand behind that: the device
must serve the multisample sampled bind from the retained target that holds the
samples, and the texture's own `get_num_samples()` must report that target's
sample count.

`msaa4_color_store_no_resolve` reads all four samples back through a kernel that
loops over `min(samples, tex.get_num_samples())`, so its result depends on both.
And the two failures are indistinguishable in it: a refused bind writes nothing,
and a served bind whose query folds to 1 writes only sample 0 — in both cases
samples 1..3 keep the readback buffer's 0xEE fill. The case cannot be the red
witness for either half, which is exactly what it was being asked to be.

## What this adds

`read_ms_texels_host_count` is `read_ms_texels` with the sample count taken from
the host constant the caller already has, never from the texture. It is a
separate kernel rather than a flag inside the first because the difference is
the whole point of the pair: the shared one would have to keep both spellings
anyway, and a reader has to be able to see that one of them does not query.

`readBackMultisample` gains `countFromTexture:` and selects between the two
pipelines. `msaa4_color_store_host_sample_count` runs the same render, the same
four unequal samples and the same comparison through it, so a difference between
the two cases is the query and nothing else.

## Results

Native oracle `scaleway-m4-macos15` (Apple M4, macOS 15.6.1), full battery:
294 cases, 0 failures, 0 skipped. Both multisample cases PASS. The tracked
baseline gains exactly one line and its SUMMARY count; no existing native
expectation moved.

Guest, rail macos-15, identified control `84452de4` (= a65348ed), full battery,
294 cases, no NOT-RUN, no panic:

  CASE msaa4_color_store_host_sample_count FAIL the readback dispatch produced
       nothing — the device refused it, or refused a bind in it

with the owning rung named on the device's own channel, the same one the sibling
case refuses at:

  compute_linux texture_shape fail reason=unstageable_multisampled pipe=164 ref=152 bind=32
  compute_record reason=texture_shape_unstageable class=unsupported kind=DispatchThreadgroups

So the new case is recorded as classified driver debt beside its sibling. It is a
coverage-and-isolation case on this build, not a repair witness: both cases refuse
at the same rung today, and the new one is the one that can move first once the
bind is served.

## Not verified

Two further control batteries of the three-run repetition were still running when
this was committed; the first is the evidence above. Because HEAD moved, their
manifests will record a different `harness_tracked_diff_sha256` than the first —
the suite, expectation and guest-binary content hashes in the same manifests are
the identity that matters and are unchanged.

No candidate boot exists for this change: it changes no product behavior, so
there is nothing to score a candidate transition against.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Anees IqbalandClaude Opus 5 committed 2026-08-30 19:29:52 +03:00
1 parent a65348ed34
commit 8449a30394
5 files changed
+65 -7

No files matched your search

@@ -66,6 +66,7 @@ CASE rt_pipeline PASS solid_fs pipeline built
CASE rt_render_then_sample PASS 4096 texels are the drawn colour
CASE rt_blit_to_buffer PASS 4096 texels exact through blit
CASE msaa4_color_store_no_resolve PASS 64 pixels retained four distinct samples
CASE msaa4_color_store_host_sample_count PASS 64 pixels retained four distinct samples
CASE depth_attachment_clear_without_test_state PASS stored depth clear rejected the later draw
CASE depth_test_less_without_attachment PASS z=0 compared against the absent attachment value
CASE depth_test_equal_without_attachment PASS z=0 compared against the absent attachment value
@@ -295,5 +296,5 @@ ROUTE srt_blit_iosurface_source_1920x1080_x4 sl_gpu_landed
CASE srt_blit_iosurface_source_1920x1080_x4 PASS every surface-to-surface copy moved its own frame's pixels
CASE srt_blit_buffer_backed_512x512 PASS the copy out of a buffer-backed source moved what the render had written
CASE command_buffer_cross_queue_shared_event_visibility PASS producer=4 consumer=4 completed_without_host_release=true visible=true
SUMMARY cases=293 failures=0 skipped=0
SUMMARY cases=294 failures=0 skipped=0
DEVICE name=Apple M4 unified=true
@@ -11,9 +11,20 @@
buffer_backed_alias_incompatible_widths # buffer storage image refused before translation
buffer_backed_alias_partial_row_range # buffer storage image refused before translation
# The active multisample failure is a driver refusal before translation. The
# latent translator defect behind it remains packaged in bugs/.
# The active multisample failures are a driver refusal before translation. The
# latent translator defect behind them remains packaged in bugs/.
#
# Two cases, because one result line cannot say which of two defects it saw.
# `msaa4_color_store_no_resolve` reads the samples back through a kernel that
# asks the texture for its own count; `..._host_sample_count` runs the same
# render and comparison through a kernel given the count by the host. A device
# that refuses the `texture2d_ms` bind and a device that serves it under a
# translator folding `get_num_samples()` to 1 both leave samples 1..3 unwritten,
# and only the second case can tell them apart. On this build both refuse at the
# same rung, so both are driver-owned; the second is the one that moves first
# when the bind is served.
msaa4_color_store_no_resolve # unstageable_multisampled before translation
msaa4_color_store_host_sample_count # unstageable_multisampled before translation
# Depth/stencil attachment state or contents are lost in the device model. The
# distinguishing colour shaders pass elsewhere; the log also names a depth
+31
View File
@@ -57,6 +57,37 @@ kernel void read_ms_texels(texture2d_ms<float, access::read> tex [[texture(0)]],
}
}
// The same readback with the sample count supplied by the host instead of
// queried from the texture.
//
// `read_ms_texels` above is a witness for two independent obligations at once:
// that a `texture2d_ms` bind is served at all, and that `get_num_samples()`
// reports the texture's own count. A device that serves the bind correctly but
// runs against a translator that folds the query to a constant produces the
// same result line as a device that refused the bind outright, and the two are
// opposite defects. This kernel drops the query so its result speaks only to
// the first obligation; the caller already knows the count, because it created
// the texture.
kernel void read_ms_texels_host_count(texture2d_ms<float, access::read> tex [[texture(0)]],
device uint *out [[buffer(0)]],
constant uint &width [[buffer(1)]],
constant uint &samples [[buffer(2)]],
constant uint2 &extent [[buffer(3)]],
device uint *ran [[buffer(4)]],
uint2 gid [[thread_position_in_grid]]) {
ran[0] = 1u;
if (gid.x >= extent.x || gid.y >= extent.y) { return; }
for (uint sample = 0; sample < samples; ++sample) {
float4 v = tex.read(gid, sample);
uint r = uint(round(v.r * 255.0));
uint g = uint(round(v.g * 255.0));
uint b = uint(round(v.b * 255.0));
uint a = uint(round(v.a * 255.0));
out[(gid.y * width + gid.x) * samples + sample] =
(a << 24) | (b << 16) | (g << 8) | r;
}
}
// The sampler path, with nearest filtering and unnormalized coordinates, so the
// result is still exactly one texel and any difference from `read_texels` is
// the sampler/view rather than the memory.
+6 -2
View File
@@ -23,6 +23,8 @@ let readPipe = pipeline("read_texels")
let readMultisamplePipe = pipeline("read_ms_texels")
let readMultisampleHostCountPipe = pipeline("read_ms_texels_host_count")
let samplePipe = pipeline("sample_texels")
let levelPipe = pipeline("read_level")
@@ -142,7 +144,8 @@ func readBack(_ pipe: MTLComputePipelineState,
/// image cannot look like a valid four-sample store.
func readBackMultisample(_ tex: MTLTexture,
_ w: Int, _ h: Int,
samples: Int) -> [UInt32]? {
samples: Int,
countFromTexture: Bool = true) -> [UInt32]? {
let count = w * h * samples
let out = dev.makeBuffer(length: count * 4, options: .storageModeShared)!
memset(out.contents(), 0xEE, count * 4)
@@ -150,7 +153,8 @@ func readBackMultisample(_ tex: MTLTexture,
memset(ran.contents(), 0, 4)
let cb = queue.makeCommandBuffer()!
let enc = cb.makeComputeCommandEncoder()!
enc.setComputePipelineState(readMultisamplePipe)
enc.setComputePipelineState(
countFromTexture ? readMultisamplePipe : readMultisampleHostCountPipe)
enc.setTexture(tex, index: 0)
enc.setBuffer(out, offset: 0, index: 0)
var width = UInt32(w)
+13 -2
View File
@@ -5,8 +5,18 @@ import Foundation
/// encoder ends. Four unequal samples make preservation distinguishable from
/// an implicit resolve, and the later command buffer forces the observation
/// across the encoder/submission lifetime boundary.
/// Both multisample-store cases run the same render and differ only in where the
/// readback kernel's sample count comes from. See `read_ms_texels_host_count`
/// for why that difference is worth two cases: one result line cannot say
/// whether a device served the `texture2d_ms` bind, because a bind that was
/// refused and a bind whose sample count came back as 1 both leave samples 1
/// and up unwritten.
func multisampleStoreCase() {
let label = "msaa4_color_store_no_resolve"
multisampleStoreCase(label: "msaa4_color_store_no_resolve", countFromTexture: true)
multisampleStoreCase(label: "msaa4_color_store_host_sample_count", countFromTexture: false)
}
func multisampleStoreCase(label: String, countFromTexture: Bool) {
let w = 8, h = 8, samples = 4
guard dev.supportsTextureSampleCount(samples) else {
skip(label, "device does not report 4x texture sampling")
@@ -51,7 +61,8 @@ func multisampleStoreCase() {
producer.commit()
producer.waitUntilCompleted()
guard let got = readBackMultisample(texture, w, h, samples: samples) else {
guard let got = readBackMultisample(texture, w, h, samples: samples,
countFromTexture: countFromTexture) else {
refused(label)
return
}