conformance: the new runtime's side makes the wait from a command buffer's own handler

The three handler-waits rows read "never-returned" in 49672 (f82dd9c768, lavapipe) without
running rt at all: rt_side left Side::handler_wait at the trait default, which answers
Unavailable("handler_wait"), and an Err where Metal never returned is the compliant verdict. So
these rows covered nothing of rt's.

- rt_side::handler_wait makes the shape as the old runtime's side does (runtime_side.rs): a
  command buffer with one 64-byte fill, whose scheduled or completed handler waits on that same
  command buffer and sends back what the wait answered; the side's own wait for the command
  buffer and for the answer are each bounded (WAIT, 60 s), so a wait rt neither refused nor
  returned from reads as never returning instead of hanging the suite.
- rt answers at once in each: a wait in a scheduled handler is Refusal::InScheduledHandler; a
  completed handler's waitUntilCompleted on its own command buffer returns, the command buffer
  being complete. The planner ruled that answer kept (no rt change), so known-gaps-rt.tsv holds
  handler-waits-completed-until-completed on every venue as an accepted difference, quoting
  Apple's sentence for waitUntilCompleted, and rt's wait_until_completed doc names where Metal's
  call never returns.

Verified: nothing yet; conf-check.sh (clippy x3, the conformance tests, and a lavapipe replay of
the three cases) follows.
This commit is contained in:
Anees Iqbal committed 2026-11-18 23:50:58 -08:00
1 parent 7cda47f536
commit d06e4b56db
3 files changed
+48 -1

No files matched your search

@@ -75,6 +75,7 @@ command-buffer-facts * refused case/facts/queue-label-is-its-own/0 Err(TheConsum
command-buffer-facts * refused case/facts/queue-label-is-its-own/1 Err(TheConsumers("a queue's label and a command buffer's device and commandQueue never reach the GPU: metal2vulkan-rt leaves them to its consumer")) The consumer's, not a gap: a queue's label and a command buffer's `device` and `commandQueue` are the consumer's own objects and never reach the GPU, so metal2vulkan-rt holds none of them and its consumer answers them from its own.
command-buffer-facts * refused case/facts/resource-state-encoder-opened Err(Unavailable({call: "resource_state_command_encoder"})) A typed refusal, as the sparse family's: metal2vulkan-rt has no resource-state command encoder (`resourceStateCommandEncoder`), which maps sparse textures alone. It waits on a replay stream that uses one.
format-footprints-plain-stragglers * refused case/MTLPixelFormatBGRA4Unorm/CubeArray/64x64x1/levels-1/samples-1/slices-2/usage-0x1/shared/size-and-align Err(Error::Unsupported("cube array textures are not built")) refused: no stream uses it yet (cube census m3-max-48683/48687/48688/48720: ten streams, no cube array texture or view). A cube array texture, which no replay stream makes or views.
handler-waits-completed-until-completed * divergent case/addCompletedHandler/waitUntilCompleted Metal did not return from this call, and we answered it: Ok An accepted difference: Apple documents waitUntilCompleted as "Blocks the current thread until the GPU finishes executing the command buffer and all of its completion handlers." Called from the command buffer's own completed handler, Metal never returns; rt answers at once because the buffer is complete.
heap-sizes-formats-without-textures * refused case/MTLPixelFormatAnyDepth/CubeArray/64x64x1/levels-1/samples-1/slices-2/usage-0x1/private/makes-texture Err(Error::Unsupported("cube array textures are not built")) refused: no stream uses it yet (cube census m3-max-48683/48687/48688/48720: ten streams, no cube array texture or view). A cube array texture, which no replay stream makes or views.
heap-sizes-formats-without-textures * refused case/MTLPixelFormatAnyDepth/CubeArray/64x64x1/levels-1/samples-1/slices-2/usage-0x1/private/size-and-align Err(Error::Unsupported("cube array textures are not built")) refused: no stream uses it yet (cube census m3-max-48683/48687/48688/48720: ten streams, no cube array texture or view). A cube array texture, which no replay stream makes or views.
heap-sizes-formats-without-textures * refused case/MTLPixelFormatAnyDepth/CubeArray/64x64x1/levels-1/samples-1/slices-2/usage-0x1/shared/makes-texture Err(Error::Unsupported("cube array textures are not built")) refused: no stream uses it yet (cube census m3-max-48683/48687/48688/48720: ten streams, no cube array texture or view). A cube array texture, which no replay stream makes or views.
Can't render this file because it contains an unexpected character in line 60 and column 319.
@@ -53,6 +53,9 @@ const WAIT: Duration = Duration::from_secs(60);
/// The bytes the command-buffer facts' one blit fills, as the other sides fill.
const TIMED_BYTES: usize = 256;
/// The bytes the command buffer of a handler's own wait fills, as the old runtime's side fills.
const HANDLER_FILL: usize = 64;
/// Why the command-buffer facts' queue label and getters are not this side's to answer.
const THE_CONSUMERS: &str = "a queue's label and a command buffer's device and commandQueue \
never reach the GPU: metal2vulkan-rt leaves them to its consumer";
@@ -1277,6 +1280,47 @@ impl Side for RtSide<'_> {
.without_resource_state_encoder(Failure::unavailable("resource_state_command_encoder")))
}
/// A wait made from a command buffer's own handler, as the old runtime's side makes it: a
/// command buffer with one small fill, whose handler `wait.from` names makes the wait
/// `wait.wait` names on that same command buffer, and sends back what the wait answered. Both
/// waits here are bounded, so a wait the runtime neither refused nor returned from is recorded
/// as never returning instead of hanging the suite: the handler would still be inside it and
/// the command buffer would never complete.
fn handler_wait(&mut self, wait: crate::handler_waits::OwnWait) -> Answer<Value> {
use crate::handler_waits::{HandlerKind, WaitKind};
let of_rt = |error: rt::Error| Failure::of_rt(&error);
let filled = self.buffer(&[0u8; HANDLER_FILL])?;
let target = self.held(filled)?.clone();
let queue = self.queue()?.clone();
let command_buffer = queue.command_buffer().map_err(of_rt)?;
let mut blit = command_buffer.blit_command_encoder().map_err(of_rt)?;
(blit.fill_buffer(&target, 0..HANDLER_FILL as u64, 0x11)).map_err(of_rt)?;
blit.end_encoding();
let (sender, answer) = mpsc::channel();
let kind = wait.wait;
let handler = move |own: &rt::CommandBuffer| {
let answered = match kind {
WaitKind::UntilCompleted => own.wait_until_completed(),
WaitKind::UntilScheduled => own.wait_until_scheduled(),
};
let _ = sender.send(answered.err().map(|error| Failure::of_rt(&error)));
};
match wait.from {
HandlerKind::Scheduled => command_buffer.add_scheduled_handler(handler),
HandlerKind::Completed => command_buffer.add_completed_handler(handler),
}
.map_err(of_rt)?;
command_buffer.commit().map_err(of_rt)?;
if waited_for(&command_buffer, WAIT).is_none() {
return Ok(Value::Nothing(Negative::NeverReturned));
}
match answer.recv_timeout(WAIT) {
Ok(None) => Ok(Value::ok(Value::Absent)),
Ok(Some(failure)) => Err(failure),
Err(_) => Ok(Value::Nothing(Negative::NeverReturned)),
}
}
fn empty_command_buffers(&mut self) -> Answer<EmptyCommandBuffers> {
let of_rt = |error: rt::Error| Failure::of_rt(&error);
let order: Arc<Mutex<Vec<String>>> = Arc::default();
+3 -1
View File
@@ -570,7 +570,9 @@ impl CommandBuffer {
/// handlers have run. A command buffer held in a group goes at once, as
/// [`CommandQueue::send_now`](crate::CommandQueue::send_now) sends it. In a completed handler
/// or a listener of its device, on the completion thread, which runs the handlers: at once
/// for one completed or ended, its own handler's command buffer among them.
/// for one completed or ended, its own handler's command buffer among them, where Metal's
/// call never returns (Metal's wait is for the command buffer's completion handlers too, the
/// one it is called from among them).
///
/// Err: [`Refusal::InScheduledHandler`] in a scheduled handler; [`Refusal::WaitOnOwnThread`]
/// in a completed handler or a listener of its device for one not yet completed or ended.